"<!DOCTYPE html>\n<html lang=\"zh\" data-theme=\"light\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>fulltext.txt — Vercel Design System</title>\n<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n<link href=\"https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css\">\n<style>\n\n:root {\n  /* Vercel Palette */\n  --geist-foreground: #171717;\n  --geist-background: #ffffff;\n  --geist-secondary: #4d4d4d;\n  --geist-tertiary: #666666;\n  --geist-quaternary: #808080;\n  --geist-border: #ebebeb;\n  --geist-surface-tint: #fafafa;\n  \n  /* Workflow Accents */\n  --develop-blue: #0a72ef;\n  --preview-pink: #de1d8d;\n  --ship-red: #ff5b4f;\n  \n  /* Interactive & Status */\n  --link-blue: #0072f5;\n  --ds-focus-color: hsla(212, 100%, 48%, 1);\n  --badge-blue-bg: #ebf5ff;\n  --badge-blue-text: #0068d6;\n  \n  /* Shadow-as-Border Philosophy */\n  --shadow-border: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;\n  --shadow-border-hover: rgba(0, 0, 0, 0.16) 0px 0px 0px 1px;\n  --shadow-card: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, #fafafa 0px 0px 0px 1px;\n  --shadow-card-hover: rgba(0, 0, 0, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.06) 0px 4px 6px, #fafafa 0px 0px 0px 1px;\n  --shadow-card-full: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, rgba(0, 0, 0, 0.04) 0px 8px 8px -8px, #fafafa 0px 0px 0px 1px;\n  --shadow-ring: rgb(235, 235, 235) 0px 0px 0px 1px;\n  \n  /* Radius Scale */\n  --radius-xs: 2px;\n  --radius-sm: 4px;\n  --radius-md: 6px;\n  --radius-lg: 8px;\n  --radius-xl: 12px;\n  --radius-pill: 9999px;\n}\n\n[data-theme=\"dark\"] {\n  --geist-foreground: #ededed;\n  --geist-background: #000000;\n  --geist-secondary: #a1a1a1;\n  --geist-tertiary: #888888;\n  --geist-quaternary: #666666;\n  --geist-border: #222222;\n  --geist-surface-tint: #0a0a0a;\n  \n  --shadow-border: rgba(255, 255, 255, 0.14) 0px 0px 0px 1px;\n  --shadow-border-hover: rgba(255, 255, 255, 0.28) 0px 0px 0px 1px;\n  --shadow-card: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.4) 0px 2px 4px, #111111 0px 0px 0px 1px;\n  --shadow-card-hover: rgba(255, 255, 255, 0.2) 0px 0px 0px 1px, rgba(0, 0, 0, 0.5) 0px 6px 12px, #111111 0px 0px 0px 1px;\n  --shadow-card-full: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.5) 0px 8px 16px -4px, #111111 0px 0px 0px 1px;\n  --shadow-ring: rgb(40, 40, 40) 0px 0px 0px 1px;\n  \n  --badge-blue-bg: rgba(10, 114, 239, 0.15);\n  --badge-blue-text: #70b5ff;\n}\n\n* { box-sizing: border-box; }\nhtml { scroll-behavior: smooth; }\nbody {\n  margin: 0;\n  font-family: \"Geist\", Arial, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n  background-color: var(--geist-background);\n  color: var(--geist-foreground);\n  font-feature-settings: \"liga\" 1;\n  -webkit-font-smoothing: antialiased;\n  min-height: 100vh;\n}\n\na {\n  color: inherit;\n  text-decoration: none;\n  transition: color 0.15s ease;\n}\n\n/* 导航栏 (Vercel Clean Sticky Nav) */\n.vercel-nav {\n  position: sticky;\n  top: 0;\n  background-color: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  z-index: 100;\n  padding: 0 24px;\n  height: 64px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n}\n.nav-brand {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n.vercel-triangle {\n  width: 22px;\n  height: 19px;\n  fill: var(--geist-foreground);\n}\n.nav-title {\n  font-size: 16px;\n  font-weight: 600;\n  letter-spacing: -0.32px;\n  color: var(--geist-foreground);\n}\n.nav-badge-pill {\n  font-family: \"Geist Mono\", ui-monospace, monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  background: var(--badge-blue-bg);\n  color: var(--badge-blue-text);\n  padding: 2px 8px;\n  border-radius: var(--radius-pill);\n}\n\n.nav-links {\n  display: flex;\n  align-items: center;\n  gap: 24px;\n}\n.nav-link {\n  font-size: 14px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  text-decoration: none;\n  transition: color 0.15s;\n}\n.nav-link:hover, .nav-link.active {\n  color: var(--geist-foreground);\n}\n.nav-link.active {\n  font-weight: 600;\n}\n\n.nav-actions {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n\n/* 按钮规范 */\n.btn-primary-dark {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border: none;\n  padding: 8px 16px;\n  border-radius: var(--radius-md);\n  font-size: 14px;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: none;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  transition: opacity 0.15s;\n}\n.btn-primary-dark:hover {\n  opacity: 0.9;\n}\n.btn-secondary-white {\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  box-shadow: var(--shadow-border);\n  border: none;\n  padding: 8px 16px;\n  border-radius: var(--radius-md);\n  font-size: 14px;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: none;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  transition: background 0.15s, box-shadow 0.15s;\n}\n.btn-secondary-white:hover {\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border-hover);\n}\n.theme-toggle-btn {\n  background: transparent;\n  border: none;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  width: 36px;\n  height: 36px;\n  cursor: pointer;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: var(--geist-foreground);\n}\n\n/* 核心容器 */\n.vercel-container {\n  max-width: 1200px;\n  margin: 0 auto;\n  padding: 56px 24px 100px;\n}\n\n/* Hero Section (Gallery Emptiness + Negative Letter-spacing) */\n.vercel-hero {\n  text-align: center;\n  max-width: 860px;\n  margin: 0 auto 56px;\n}\n.hero-stage-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  padding: 4px 14px;\n  border-radius: var(--radius-pill);\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  margin-bottom: 24px;\n}\n.stage-dot {\n  width: 7px;\n  height: 7px;\n  border-radius: 50%;\n}\n.vercel-hero h1 {\n  font-size: 48px;\n  font-weight: 600;\n  line-height: 1.05;\n  letter-spacing: -2.4px;\n  color: var(--geist-foreground);\n  margin: 0 0 16px;\n}\n.vercel-hero p {\n  font-size: 20px;\n  font-weight: 400;\n  line-height: 1.80;\n  color: var(--geist-secondary);\n  margin: 0 auto 28px;\n}\n\n/* Workflow Pipeline (Develop -> Preview -> Ship) */\n.workflow-pipeline {\n  display: grid;\n  grid-template-columns: repeat(3, 1fr);\n  gap: 16px;\n  margin-bottom: 48px;\n}\n@media (max-width: 768px) {\n  .workflow-pipeline { grid-template-columns: 1fr; }\n}\n.workflow-step {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px 22px;\n  transition: box-shadow 0.2s;\n}\n.workflow-step:hover {\n  box-shadow: var(--shadow-card-hover);\n}\n.step-mono-label {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 12px;\n  font-weight: 500;\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n  margin-bottom: 8px;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n.step-title {\n  font-size: 20px;\n  font-weight: 600;\n  letter-spacing: -0.96px;\n  color: var(--geist-foreground);\n  margin-bottom: 6px;\n}\n.step-desc {\n  font-size: 14px;\n  color: var(--geist-secondary);\n  line-height: 1.5;\n}\n\n/* Metric Cards (Section 4 Spec) */\n.metric-grid {\n  display: grid;\n  grid-template-columns: repeat(4, 1fr);\n  gap: 16px;\n  margin-bottom: 48px;\n}\n@media (max-width: 900px) {\n  .metric-grid { grid-template-columns: repeat(2, 1fr); }\n}\n.metric-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n}\n.metric-number {\n  font-size: 40px;\n  font-weight: 600;\n  line-height: 1.0;\n  letter-spacing: -2.4px;\n  color: var(--geist-foreground);\n  margin-bottom: 8px;\n  font-feature-settings: \"tnum\" 1;\n}\n.metric-label {\n  font-size: 14px;\n  color: var(--geist-secondary);\n  line-height: 1.4;\n}\n\n/* VAD 专栏 Banner (Ship Red & Vercel Clean) */\n.vad-showcase {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-xl);\n  padding: 32px;\n  margin-bottom: 48px;\n  position: relative;\n}\n.vad-header-row {\n  display: flex;\n  align-items: baseline;\n  justify-content: space-between;\n  flex-wrap: wrap;\n  gap: 12px;\n  margin-bottom: 12px;\n}\n.vad-header-row h2 {\n  font-size: 32px;\n  font-weight: 600;\n  letter-spacing: -1.28px;\n  color: var(--geist-foreground);\n  margin: 0;\n}\n.vad-pillars-grid {\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));\n  gap: 14px;\n  margin-top: 24px;\n}\n.vad-pillar-item {\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  padding: 14px 16px;\n}\n.vad-pillar-title {\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--ship-red);\n  margin-bottom: 4px;\n}\n.vad-pillar-text {\n  font-size: 13px;\n  color: var(--geist-secondary);\n  line-height: 1.5;\n}\n.vad-filter-bar {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  justify-content: space-between;\n  gap: 12px;\n  margin: 24px 0 16px;\n  padding: 12px 16px;\n  background: var(--geist-surface-tint);\n  border-radius: var(--radius-md);\n  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);\n}\n.vad-filter-btn {\n  font-family: 'Geist', sans-serif;\n  font-size: 13px;\n  font-weight: 500;\n  padding: 6px 14px;\n  border-radius: 9999px;\n  border: none;\n  background: transparent;\n  color: var(--geist-secondary);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n.vad-filter-btn:hover {\n  color: var(--geist-foreground);\n  background: rgba(0,0,0,0.05);\n}\n.vad-filter-btn.active {\n  background: #171717;\n  color: #ffffff;\n}\n.vad-search-input {\n  font-family: 'Geist', sans-serif;\n  font-size: 13px;\n  padding: 7px 12px;\n  border-radius: 6px;\n  border: 1px solid var(--geist-border);\n  background: #ffffff;\n  color: var(--geist-foreground);\n  width: 280px;\n  outline: none;\n  transition: border-color 0.15s, box-shadow 0.15s;\n}\n.vad-search-input:focus {\n  border-color: #0a72ef;\n  box-shadow: 0 0 0 2px rgba(10, 114, 239, 0.2);\n}\n\n/* 控制栏：搜索、视图、筛选 */\n.control-bar {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  margin-bottom: 24px;\n  flex-wrap: wrap;\n}\n.search-input-wrap {\n  position: relative;\n  flex: 1;\n  max-width: 480px;\n}\n.search-input {\n  width: 100%;\n  height: 40px;\n  padding: 0 38px 0 14px;\n  font-family: \"Geist\", sans-serif;\n  font-size: 14px;\n  color: var(--geist-foreground);\n  background: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  border: none;\n  border-radius: var(--radius-md);\n  outline: none;\n  transition: box-shadow 0.15s;\n}\n.search-input:focus {\n  outline: 2px solid var(--ds-focus-color);\n  box-shadow: none;\n}\n.search-kbd {\n  position: absolute;\n  right: 12px;\n  top: 50%;\n  transform: translateY(-50%);\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  color: var(--geist-quaternary);\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  padding: 2px 6px;\n  border-radius: var(--radius-sm);\n}\n\n.view-switcher {\n  display: flex;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  background: var(--geist-background);\n  padding: 2px;\n}\n.view-btn {\n  background: transparent;\n  border: none;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-tertiary);\n  padding: 6px 12px;\n  border-radius: var(--radius-sm);\n  cursor: pointer;\n  transition: color 0.15s, background 0.15s;\n}\n.view-btn.active {\n  background: var(--geist-surface-tint);\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n/* 筛选芯片行 (Filter Pill Strip) */\n.filter-group-strip {\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n  margin-bottom: 28px;\n  padding: 16px 20px;\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-lg);\n}\n.filter-row {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n  flex-wrap: wrap;\n}\n.filter-label-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  color: var(--geist-quaternary);\n  min-width: 68px;\n}\n.pill-badge {\n  background: var(--geist-background);\n  color: var(--geist-secondary);\n  box-shadow: var(--shadow-border);\n  border: none;\n  padding: 3px 12px;\n  border-radius: var(--radius-pill);\n  font-size: 12px;\n  font-weight: 500;\n  cursor: pointer;\n  transition: all 0.15s;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n}\n.pill-badge:hover {\n  color: var(--geist-foreground);\n  box-shadow: var(--shadow-border-hover);\n}\n.pill-badge.active {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  font-weight: 600;\n  box-shadow: none;\n}\n.pill-badge.active-blue {\n  background: var(--develop-blue);\n  color: #ffffff;\n  box-shadow: none;\n}\n.pill-badge.active-red {\n  background: var(--ship-red);\n  color: #ffffff;\n  box-shadow: none;\n}\n\n/* Bento Grid Cards (Section 4 & 6 Spec) */\n.card-grid-bento {\n  display: grid;\n  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));\n  gap: 16px;\n}\n.vercel-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n  display: flex;\n  flex-direction: column;\n  justify-content: space-between;\n  transition: box-shadow 0.2s, transform 0.2s;\n  text-decoration: none;\n  color: inherit;\n  overflow: hidden;\n  min-width: 0;\n  word-break: break-word;\n}\n.vercel-card:hover {\n  box-shadow: var(--shadow-card-hover);\n  transform: translateY(-2px);\n}\n.card-top {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  margin-bottom: 12px;\n  gap: 8px;\n}\n.card-tag-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  color: var(--geist-quaternary);\n  letter-spacing: 0.5px;\n}\n.status-pill-badge {\n  padding: 2px 8px;\n  border-radius: var(--radius-pill);\n  font-size: 11px;\n  font-weight: 500;\n  flex-shrink: 0;\n}\n.pub-accepted { background: #ebfdf2; color: #027a48; }\n.pub-workshop { background: #eff8ff; color: #175cd3; }\n.pub-submitted { background: #fff8e6; color: #b54708; }\n.pub-preprint { background: #f2f4f7; color: #475467; }\n.pub-other { background: #f9f5ff; color: #6941c6; }\n\n[data-theme=\"dark\"] .pub-accepted { background: rgba(2, 122, 72, 0.2); color: #32d583; }\n[data-theme=\"dark\"] .pub-workshop { background: rgba(23, 92, 211, 0.2); color: #84caff; }\n[data-theme=\"dark\"] .pub-submitted { background: rgba(181, 71, 8, 0.2); color: #fec84b; }\n[data-theme=\"dark\"] .pub-preprint { background: rgba(71, 84, 103, 0.2); color: #98a2b3; }\n[data-theme=\"dark\"] .pub-other { background: rgba(105, 65, 198, 0.2); color: #d6bbfb; }\n\n/* 必读标杆徽章 (Vercel Amber Accent) */\n.milestone-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 3px;\n  padding: 2px 7px;\n  border-radius: var(--radius-pill);\n  font-size: 11px;\n  font-weight: 600;\n  white-space: nowrap;\n  flex-shrink: 0;\n  transition: all 0.15s ease;\n}\n.milestone-badge.ms-idea, .milestone-badge:not([class*=\"ms-\"]) {\n  color: #b54708;\n  background: #fff8e6;\n  border: 1px solid rgba(247, 144, 9, 0.35);\n  box-shadow: 0 1px 2px rgba(181, 71, 8, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-idea, [data-theme=\"dark\"] .milestone-badge:not([class*=\"ms-\"]) {\n  color: #fec84b;\n  background: rgba(181, 71, 8, 0.22);\n  border-color: rgba(254, 200, 75, 0.35);\n}\n.milestone-badge.ms-writing {\n  color: #6941c6;\n  background: #f9f5ff;\n  border: 1px solid rgba(105, 65, 198, 0.3);\n  box-shadow: 0 1px 2px rgba(105, 65, 198, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-writing {\n  color: #d6bbfb;\n  background: rgba(105, 65, 198, 0.22);\n  border-color: rgba(214, 187, 251, 0.35);\n}\n.milestone-badge.ms-value {\n  color: #027a48;\n  background: #ebfdf2;\n  border: 1px solid rgba(2, 122, 72, 0.3);\n  box-shadow: 0 1px 2px rgba(2, 122, 72, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-value {\n  color: #32d583;\n  background: rgba(2, 122, 72, 0.22);\n  border-color: rgba(50, 213, 131, 0.35);\n}\n\n/* 论文正文图表与插图卡片样式 (Geist Design) */\n.paper-figure, .article-body figure {\n  margin: 32px auto;\n  text-align: center;\n  max-width: 100%;\n}\n.paper-figure img, .article-body img {\n  max-width: 96%;\n  height: auto;\n  border-radius: var(--radius-md);\n  border: 1px solid var(--geist-border);\n  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);\n  background: #ffffff;\n  transition: transform 0.2s ease, box-shadow 0.2s ease;\n  display: block;\n  margin: 0 auto;\n}\n.paper-figure img:hover, .article-body img:hover {\n  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);\n}\n.paper-figure figcaption, .article-body figcaption {\n  font-size: 13px;\n  color: var(--geist-secondary);\n  margin-top: 10px;\n  line-height: 1.6;\n  font-style: italic;\n  max-width: 850px;\n  margin-left: auto;\n  margin-right: auto;\n}\n\n/* VAD 视图切换器 View Switcher */\n.vad-view-switcher {\n  display: inline-flex;\n  padding: 3px;\n  background: var(--geist-secondary-bg);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  margin-bottom: 20px;\n  gap: 2px;\n}\n.view-switch-btn {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 6px 14px;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  border-radius: 6px;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.view-switch-btn:hover {\n  color: var(--geist-foreground);\n  background: rgba(0, 0, 0, 0.04);\n}\n[data-theme=\"dark\"] .view-switch-btn:hover {\n  background: rgba(255, 255, 255, 0.06);\n}\n.view-switch-btn.active {\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  font-weight: 600;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n/* 关系图谱 Graph View Styles */\n.graph-container {\n  position: relative;\n  width: 100%;\n  height: 720px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: var(--radius-lg);\n  overflow: hidden;\n  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);\n  margin-bottom: 40px;\n}\n.graph-toolbar {\n  position: absolute;\n  top: 14px;\n  left: 14px;\n  right: 14px;\n  z-index: 10;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  padding: 8px 14px;\n  border-radius: 8px;\n  box-shadow: 0 4px 16px rgba(0,0,0,0.06);\n  flex-wrap: wrap;\n  gap: 8px;\n}\n.graph-tool-title {\n  font-size: 13px;\n  font-weight: 700;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  color: var(--geist-foreground);\n}\n.graph-filter-group {\n  display: flex;\n  gap: 6px;\n  align-items: center;\n  flex-wrap: wrap;\n}\n.graph-chip {\n  font-size: 11px;\n  padding: 3px 8px;\n  border-radius: 4px;\n  border: 1px solid var(--geist-border);\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n.graph-chip:hover { background: var(--geist-secondary-bg); }\n.graph-chip.active {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border-color: var(--geist-foreground);\n}\n.graph-search-input {\n  padding: 3px 8px;\n  font-size: 11px;\n  border-radius: 4px;\n  border: 1px solid var(--geist-border);\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  outline: none;\n  width: 150px;\n}\n#vad-graph-svg {\n  width: 100%;\n  height: 100%;\n  cursor: grab;\n}\n#vad-graph-svg:active { cursor: grabbing; }\n.graph-legend {\n  position: absolute;\n  bottom: 14px;\n  left: 14px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  padding: 10px 14px;\n  font-size: 11px;\n  box-shadow: 0 4px 16px rgba(0,0,0,0.06);\n  z-index: 10;\n  line-height: 1.6;\n  pointer-events: none;\n}\n.graph-legend-row { display: flex; align-items: center; gap: 8px; }\n.graph-legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }\n.graph-info-drawer {\n  position: absolute;\n  top: 66px;\n  right: 14px;\n  width: 310px;\n  max-height: 620px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  box-shadow: 0 8px 30px rgba(0,0,0,0.12);\n  z-index: 10;\n  padding: 16px;\n  overflow-y: auto;\n  display: none;\n  backdrop-filter: blur(10px);\n  transition: transform 0.2s ease, opacity 0.2s ease;\n}\n.graph-drawer-close {\n  position: absolute;\n  top: 10px;\n  right: 12px;\n  cursor: pointer;\n  font-size: 16px;\n  color: var(--geist-tertiary);\n}\n.graph-drawer-badge {\n  display: inline-block;\n  padding: 2px 6px;\n  border-radius: 4px;\n  font-size: 10px;\n  font-weight: 600;\n  margin-bottom: 6px;\n}\n.graph-drawer-title {\n  font-size: 13px;\n  font-weight: 700;\n  line-height: 1.4;\n  margin-bottom: 8px;\n  color: var(--geist-foreground);\n}\n.graph-drawer-meta {\n  font-size: 11px;\n  color: var(--geist-secondary);\n  margin-bottom: 12px;\n}\n.graph-drawer-core {\n  font-size: 12px;\n  line-height: 1.6;\n  color: var(--geist-foreground);\n  background: var(--geist-secondary-bg);\n  padding: 8px 10px;\n  border-radius: 6px;\n  margin-bottom: 12px;\n  border: 1px solid var(--geist-border);\n}\n.graph-drawer-link {\n  display: block;\n  text-align: center;\n  padding: 7px 12px;\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border-radius: 6px;\n  font-size: 12px;\n  font-weight: 600;\n  text-decoration: none;\n  transition: opacity 0.15s ease;\n  margin-bottom: 6px;\n}\n.graph-drawer-link:hover { opacity: 0.85; }\n.graph-drawer-pdf-link {\n  display: block;\n  text-align: center;\n  padding: 6px 12px;\n  background: var(--geist-secondary-bg);\n  color: var(--geist-foreground);\n  border: 1px solid var(--geist-border);\n  border-radius: 6px;\n  font-size: 11px;\n  font-weight: 500;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.graph-drawer-pdf-link:hover { background: var(--geist-border); }\n.node-circle {\n  cursor: pointer;\n  transition: r 0.2s, stroke-width 0.2s;\n}\n.node-label {\n  font-size: 10px;\n  font-weight: 600;\n  fill: var(--geist-foreground);\n  pointer-events: none;\n  text-shadow: 0 1px 2px var(--geist-background);\n}\n.link-line {\n  stroke: var(--geist-border);\n  stroke-opacity: 0.6;\n  stroke-width: 1.2;\n  transition: stroke 0.2s, stroke-width 0.2s, stroke-opacity 0.2s;\n}\n.link-label {\n  font-size: 9px;\n  fill: var(--geist-tertiary);\n  pointer-events: none;\n  text-anchor: middle;\n}\n\n/* 引用框与警示框 Alerts */\n.callout-alert {\n  margin: 20px 0;\n  padding: 14px 18px;\n  border-radius: var(--radius-md);\n  transition: all 0.15s ease;\n}\n.callout-important, .callout-idea {\n  border-left: 4px solid #b54708;\n  background: rgba(181, 71, 8, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(247, 144, 9, 0.3);\n}\n[data-theme=\"dark\"] .callout-important, [data-theme=\"dark\"] .callout-idea {\n  border-left-color: #fec84b;\n  background: rgba(181, 71, 8, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(254, 200, 75, 0.25);\n}\n.callout-writing {\n  border-left: 4px solid #6941c6;\n  background: rgba(105, 65, 198, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(105, 65, 198, 0.3);\n}\n[data-theme=\"dark\"] .callout-writing {\n  border-left-color: #d6bbfb;\n  background: rgba(105, 65, 198, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(214, 187, 251, 0.25);\n}\n.callout-value {\n  border-left: 4px solid #027a48;\n  background: rgba(2, 122, 72, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(2, 122, 72, 0.3);\n}\n[data-theme=\"dark\"] .callout-value {\n  border-left-color: #32d583;\n  background: rgba(2, 122, 72, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(50, 213, 131, 0.25);\n}\n\n.card-title {\n  font-size: 16.5px;\n  font-weight: 600;\n  line-height: 1.42;\n  letter-spacing: -0.4px;\n  color: var(--geist-foreground);\n  margin: 0 0 10px;\n  word-break: break-word;\n  overflow-wrap: anywhere;\n  hyphens: auto;\n}\n.card-title a {\n  color: var(--geist-foreground);\n  text-decoration: none;\n  display: inline;\n  transition: color 0.15s ease;\n}\n.card-title a:hover {\n  color: var(--develop-blue);\n  text-decoration: none;\n}\n.card-id-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-quaternary);\n  margin-right: 5px;\n}\n.card-meta-row {\n  display: flex;\n  gap: 6px;\n  flex-wrap: wrap;\n  margin-bottom: 12px;\n}\n.meta-token {\n  font-size: 12px;\n  color: var(--geist-tertiary);\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-ring);\n  padding: 2px 7px;\n  border-radius: var(--radius-sm);\n  white-space: nowrap;\n}\n.card-body-text {\n  font-size: 13.5px;\n  color: var(--geist-secondary);\n  line-height: 1.6;\n  margin-bottom: 16px;\n  flex-grow: 1;\n  word-break: break-word;\n  overflow-wrap: anywhere;\n}\n.card-body-text strong {\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n.card-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  border-top: 1px solid var(--geist-border);\n  padding-top: 14px;\n}\n.card-link-action {\n  font-size: 13.5px;\n  font-weight: 500;\n  color: var(--link-blue);\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.card-link-action:hover {\n  opacity: 0.85;\n  transform: translateX(2px);\n}\na.meta-token {\n  transition: all 0.15s ease;\n  cursor: pointer;\n  text-decoration: none;\n}\na.meta-token:hover {\n  background: var(--geist-selection);\n  color: var(--geist-foreground);\n  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);\n}\n\n/* 紧凑列表视图 (List View) */\n.card-list-view {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n.list-row-item {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-md);\n  padding: 12px 18px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  transition: box-shadow 0.15s;\n}\n.list-row-item:hover {\n  box-shadow: var(--shadow-card-hover);\n}\n\n/* 阅读详情页 (Report Detail) */\n.reading-container {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr) 260px;\n  gap: 40px;\n  align-items: start;\n}\n@media (max-width: 960px) {\n  .reading-container { grid-template-columns: 1fr; }\n  .reading-sidebar { display: none; }\n}\n\n.report-header-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 28px 32px;\n  margin-bottom: 28px;\n}\n.crumb-bar {\n  font-size: 13px;\n  color: var(--geist-tertiary);\n  margin-bottom: 10px;\n}\n.report-title {\n  font-size: 32px;\n  font-weight: 600;\n  letter-spacing: -1.28px;\n  margin: 0 0 16px;\n  color: var(--geist-foreground);\n}\n.report-action-buttons {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  flex-wrap: wrap;\n  border-top: 1px solid var(--geist-border);\n  padding-top: 16px;\n  margin-top: 16px;\n}\n\n.article-body {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-lg);\n  padding: 36px 42px 80px;\n  font-size: 16px;\n  line-height: 1.75;\n  color: var(--geist-foreground);\n}\n.article-body h1, .article-body h2, .article-body h3 {\n  color: var(--geist-foreground);\n  scroll-margin-top: 80px;\n}\n.article-body h1 { font-size: 28px; font-weight: 600; letter-spacing: -1.28px; border-bottom: 1px solid var(--geist-border); padding-bottom: 8px; margin-top: 32px; }\n.article-body h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.96px; border-bottom: 1px solid var(--geist-border); padding-bottom: 6px; margin-top: 36px; }\n.article-body h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.32px; margin-top: 26px; }\n.article-body table {\n  width: 100%;\n  border-collapse: collapse;\n  margin: 24px 0;\n  font-size: 14px;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  overflow: hidden;\n}\n.article-body th, .article-body td {\n  padding: 10px 14px;\n  text-align: left;\n  border-bottom: 1px solid var(--geist-border);\n}\n.article-body th {\n  background: var(--geist-surface-tint);\n  font-weight: 600;\n  color: var(--geist-foreground);\n}\n.article-body blockquote {\n  border-left: 2px solid var(--geist-foreground);\n  margin: 20px 0;\n  padding: 8px 18px;\n  color: var(--geist-secondary);\n  font-style: normal;\n}\n.article-body code {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 13.5px;\n  box-shadow: var(--shadow-ring);\n  background: var(--geist-surface-tint);\n  padding: 2px 6px;\n  border-radius: var(--radius-sm);\n}\n.article-body pre {\n  position: relative;\n  background: #000000;\n  color: #ededed;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  padding: 18px;\n  margin: 24px 0;\n  overflow-x: auto;\n}\n.article-body pre code {\n  background: transparent;\n  box-shadow: none;\n  padding: 0;\n  color: inherit;\n  font-size: 13px;\n}\n.copy-code-btn {\n  position: absolute;\n  top: 8px;\n  right: 10px;\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  background: #171717;\n  color: #ffffff;\n  border: 1px solid #333333;\n  padding: 3px 8px;\n  border-radius: var(--radius-sm);\n  cursor: pointer;\n}\n\n/* 侧边大纲 (TOC) */\n.reading-sidebar {\n  position: sticky;\n  top: 80px;\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n  max-height: calc(100vh - 100px);\n  overflow-y: auto;\n}\n.sidebar-toc-title {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 12px;\n  font-weight: 500;\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n  color: var(--geist-quaternary);\n  margin-bottom: 12px;\n}\n.reading-sidebar ul {\n  list-style: none;\n  padding-left: 0;\n  margin: 0;\n  font-size: 13px;\n}\n.reading-sidebar li {\n  margin: 6px 0;\n}\n.reading-sidebar ul ul {\n  padding-left: 14px;\n}\n.reading-sidebar a {\n  color: var(--geist-secondary);\n  text-decoration: none;\n  transition: color 0.15s;\n}\n.reading-sidebar a:hover, .reading-sidebar a.active {\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n/* 后台管理 (/admin) */\n.admin-card-container {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-lg);\n  padding: 32px;\n  margin-bottom: 32px;\n}\n.form-row-2 {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 16px;\n  margin-bottom: 16px;\n}\n@media (max-width: 600px) {\n  .form-row-2 { grid-template-columns: 1fr; }\n}\n.form-field {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n  margin-bottom: 16px;\n}\n.form-field label {\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-foreground);\n}\n.form-field input, .form-field select, .form-field textarea {\n  font-family: \"Geist\", sans-serif;\n  font-size: 14px;\n  padding: 9px 12px;\n  background: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  border: none;\n  border-radius: var(--radius-md);\n  color: var(--geist-foreground);\n  outline: none;\n}\n.form-field input:focus, .form-field select:focus, .form-field textarea:focus {\n  outline: 2px solid var(--ds-focus-color);\n  box-shadow: none;\n}\n\n/* 语法高亮 (Console Blue / Purple / Pink) */\n.codehilite .k, .codehilite .kd, .codehilite .kn { color: #eb367f; font-weight: 500; }\n.codehilite .s, .codehilite .s1, .codehilite .s2 { color: #0070f3; }\n.codehilite .nf, .codehilite .na { color: #7928ca; font-weight: 500; }\n.codehilite .c, .codehilite .c1 { color: #666666; font-style: italic; }\n.codehilite .mi, .codehilite .mf { color: #ff5b4f; }\n\n</style>\n\n</head>\n<body>\n\n    <nav class=\"vercel-nav\">\n      <div class=\"nav-brand\">\n        <a href=\"/\" style=\"display:flex;align-items:center;gap:10px;text-decoration:none\">\n          <svg class=\"vercel-triangle\" viewBox=\"0 0 76 65\" fill=\"none\">\n            <path d=\"M37.5274 0L75.0548 65H0L37.5274 0Z\" fill=\"currentColor\"/>\n          </svg>\n          <span class=\"nav-title\">Agent Harness KB</span>\n        </a>\n        <span class=\"nav-badge-pill\">Geist 2.0</span>\n      </div>\n\n      <div class=\"nav-links\">\n        <a class=\"nav-link \" href=\"/\">全景总览</a>\n        <a class=\"nav-link \" href=\"/vad\" style=\"color:var(--ship-red)\">🎯 VAD 专栏 (144)</a>\n        <a class=\"nav-link\" href=\"https://m0rtzz.github.io/paper-notes/\" target=\"_blank\" rel=\"noopener\">顶会 669 篇 ↗</a>\n        <a class=\"nav-link\" href=\"/download/all\">整库打包</a>\n        \n      </div>\n\n      <div class=\"nav-actions\">\n        \n        <button class=\"theme-toggle-btn\" id=\"theme-toggle-btn\" onclick=\"toggleTheme()\" title=\"切换亮暗主题\">🌙</button>\n      </div>\n    </nav>\n    \n<main class=\"vercel-container\">\n\n        <div class=\"report-header-card\">\n          <div class=\"crumb-bar\"><a href=\"/\">Home</a> / <b>fulltext.txt</b></div>\n          <h1 class=\"report-title\">fulltext.txt</h1>\n          <div class=\"report-action-buttons\">\n            <a class=\"btn-primary-dark\" href=\"?dl=1\">Download Text</a>\n          </div>\n        </div>\n        <article class=\"article-body\"><pre><code>Direct Preference Optimization:\nYour Language Model is Secretly a Reward Model\n\narXiv:2305.18290v3 [cs.LG] 29 Jul 2024\n\nRafael Rafailov∗†\n\nArchit Sharma∗†\n\nStefano Ermon†‡\n\nChristopher D. Manning†\n\nEric Mitchell∗†\nChelsea Finn†\n\n†\n\nStanford University ‡ CZ Biohub\n{rafailov,architsh,eric.mitchell}@cs.stanford.edu\n\nAbstract\nWhile large-scale unsupervised language models (LMs) learn broad world knowledge and some reasoning skills, achieving precise control of their behavior is\ndifficult due to the completely unsupervised nature of their training. Existing\nmethods for gaining such steerability collect human labels of the relative quality of\nmodel generations and fine-tune the unsupervised LM to align with these preferences, often with reinforcement learning from human feedback (RLHF). However,\nRLHF is a complex and often unstable procedure, first fitting a reward model that\nreflects the human preferences, and then fine-tuning the large unsupervised LM\nusing reinforcement learning to maximize this estimated reward without drifting\ntoo far from the original model. In this paper we introduce a new parameterization\nof the reward model in RLHF that enables extraction of the corresponding optimal\npolicy in closed form, allowing us to solve the standard RLHF problem with only a\nsimple classification loss. The resulting algorithm, which we call Direct Preference Optimization (DPO), is stable, performant, and computationally lightweight,\neliminating the need for sampling from the LM during fine-tuning or performing\nsignificant hyperparameter tuning. Our experiments show that DPO can fine-tune\nLMs to align with human preferences as well as or better than existing methods.\nNotably, fine-tuning with DPO exceeds PPO-based RLHF in ability to control sentiment of generations, and matches or improves response quality in summarization\nand single-turn dialogue while being substantially simpler to implement and train.\n\n1\n\nIntroduction\n\nLarge unsupervised language models (LMs) trained on very large datasets acquire surprising capabilities [11, 7, 42, 8]. However, these models are trained on data generated by humans with a wide variety\nof goals, priorities, and skillsets. Some of these goals and skillsets may not be desirable to imitate; for\nexample, while we may want our AI coding assistant to understand common programming mistakes\nin order to correct them, nevertheless, when generating code, we would like to bias our model toward\nthe (potentially rare) high-quality coding ability present in its training data. Similarly, we might want\nour language model to be aware of a common misconception believed by 50% of people, but we\ncertainly do not want the model to claim this misconception to be true in 50% of queries about it!\nIn other words, selecting the model’s desired responses and behavior from its very wide knowledge\nand abilities is crucial to building AI systems that are safe, performant, and controllable [28]. While\nexisting methods typically steer LMs to match human preferences using reinforcement learning (RL),\n∗\n\nEqual contribution; more junior authors listed earlier.\n\n37th Conference on Neural Information Processing Systems (NeurIPS 2023).\n\n\fFigure 1: DPO optimizes for human preferences while avoiding reinforcement learning. Existing methods\nfor fine-tuning language models with human feedback first fit a reward model to a dataset of prompts and\nhuman preferences over pairs of responses, and then use RL to find a policy that maximizes the learned reward.\nIn contrast, DPO directly optimizes for the policy best satisfying the preferences with a simple classification\nobjective, fitting an implicit reward model whose corresponding optimal policy can be extracted in closed form.\n\nwe will show that the RL-based objective used by existing methods can be optimized exactly with a\nsimple binary cross-entropy objective, greatly simplifying the preference learning pipeline.\nAt a high level, existing methods instill the desired behaviors into a language model using curated\nsets of human preferences representing the types of behaviors that humans find safe and helpful. This\npreference learning stage occurs after an initial stage of large-scale unsupervised pre-training on\na large text dataset. While the most straightforward approach to preference learning is supervised\nfine-tuning on human demonstrations of high quality responses, the most successful class of methods\nis reinforcement learning from human (or AI) feedback (RLHF/RLAIF; [12, 2]). RLHF methods fit\na reward model to a dataset of human preferences and then use RL to optimize a language model\npolicy to produce responses assigned high reward without drifting excessively far from the original\nmodel. While RLHF produces models with impressive conversational and coding abilities, the RLHF\npipeline is considerably more complex than supervised learning, involving training multiple LMs and\nsampling from the LM policy in the loop of training, incurring significant computational costs.\nIn this paper, we show how to directly optimize a language model to adhere to human preferences,\nwithout explicit reward modeling or reinforcement learning. We propose Direct Preference Optimization (DPO), an algorithm that implicitly optimizes the same objective as existing RLHF algorithms\n(reward maximization with a KL-divergence constraint) but is simple to implement and straightforward to train. Intuitively, the DPO update increases the relative log probability of preferred to\ndispreferred responses, but it incorporates a dynamic, per-example importance weight that prevents\nthe model degeneration that we find occurs with a naive probability ratio objective. Like existing\nalgorithms, DPO relies on a theoretical preference model (such as the Bradley-Terry model; [5]) that\nmeasures how well a given reward function aligns with empirical preference data. However, while\nexisting methods use the preference model to define a preference loss to train a reward model and\nthen train a policy that optimizes the learned reward model, DPO uses a change of variables to define\nthe preference loss as a function of the policy directly. Given a dataset of human preferences over\nmodel responses, DPO can therefore optimize a policy using a simple binary cross entropy objective,\nproducing the optimal policy to an implicit reward function fit to the preference data.\nOur main contribution is Direct Preference Optimization (DPO), a simple RL-free algorithm for\ntraining language models from preferences. Our experiments show that DPO is at least as effective\nas existing methods, including PPO-based RLHF, for learning from preferences in tasks such as\nsentiment modulation, summarization, and dialogue, using language models with up to 6B parameters.\n\n2\n\nRelated Work\n\nSelf-supervised language models of increasing scale learn to complete some tasks zero-shot [33] or\nwith few-shot prompts [6, 27, 11]. However, their performance on downstream tasks and alignment\nwith user intent can be significantly improved by fine-tuning on datasets of instructions and humanwritten completions [25, 38, 13, 41]. This ‘instruction-tuning’ procedure enables LLMs to generalize\nto instructions outside of the instruction-tuning set and generally increase their usability [13]. Despite\nthe success of instruction tuning, relative human judgments of response quality are often easier to\ncollect than expert demonstrations, and thus subsequent works have fine-tuned LLMs with datasets of\nhuman preferences, improving proficiency in translation [20], summarization [40, 51], story-telling\n[51], and instruction-following [28, 34]. These methods first optimize a neural network reward\nfunction for compatibility with the dataset of preferences under a preference model such as the\n2\n\n\fBradley-Terry model [5], then fine-tune a language model to maximize the given reward using\nreinforcement learning algorithms, commonly REINFORCE [47], proximal policy optimization\n(PPO; [39]), or variants [34]. A closely-related line of work leverages LLMs fine-tuned for instruction\nfollowing with human feedback to generate additional synthetic preference data for targeted attributes\nsuch as safety or harmlessness [2], using only weak supervision from humans in the form of a\ntext rubric for the LLM’s annotations. These methods represent a convergence of two bodies of\nwork: one body of work on training language models with reinforcement learning for a variety\nof objectives [35, 29, 48] and another body of work on general methods for learning from human\npreferences [12, 21]. Despite the appeal of using relative human preferences, fine-tuning large\nlanguage models with reinforcement learning remains a major practical challenge; this work provides\na theoretically-justified approach to optimizing relative preferences without RL.\nOutside of the context of language, learning policies from preferences has been studied in both bandit\nand reinforcement learning settings, and several approaches have been proposed. Contextual bandit\nlearning using preferences or rankings of actions, rather than rewards, is known as a contextual\ndueling bandit (CDB; [50, 14]). In the absence of absolute rewards, theoretical analysis of CDBs\nsubstitutes the notion of an optimal policy with a von Neumann winner, a policy whose expected win\nrate against any other policy is at least 50% [14]. However, in the CDB setting, preference labels\nare given online, while in learning from human preferences, we typically learn from a fixed batch of\noffline preference-annotated action pairs [49]. Similarly, preference-based RL (PbRL) learns from\nbinary preferences generated by an unknown ‘scoring’ function rather than rewards [9, 37]. Various\nalgorithms for PbRL exist, including methods that can reuse off-policy preference data, but generally\ninvolve first explicitly estimating the latent scoring function (i.e. the reward model) and subsequently\noptimizing it [16, 9, 12, 36, 21]. We instead present a single stage policy learning approach that\ndirectly optimizes a policy to satisfy preferences.\n\n3\n\nPreliminaries\n\nWe review the RLHF pipeline in Ziegler et al. (and later [40, 1, 28]). It usually includes three phases:\n1) supervised fine-tuning (SFT); 2) preference sampling and reward learning and 3) RL optimization.\nSFT: RLHF typically begins by fine-tuning a pre-trained LM with supervised learning on high-quality\ndata for the downstream task(s) of interest (dialogue, summarization, etc.), to obtain a model π SFT .\nReward Modelling Phase: In the second phase the SFT model is prompted with prompts x to\nproduce pairs of answers (y1 , y2 ) ∼ π SFT (y | x). These are then presented to human labelers\nwho express preferences for one answer, denoted as yw ≻ yl | x where yw and yl denotes the\npreferred and dispreferred completion amongst (y1 , y2 ) respectively. The preferences are assumed\nto be generated by some latent reward model r∗ (y, x), which we do not have access to. There are a\nnumber of approaches used to model preferences, the Bradley-Terry (BT) [5] model being a popular\nchoice (although more general Plackett-Luce ranking models [32, 23] are also compatible with the\nframework if we have access to several ranked answers). The BT model stipulates that the human\npreference distribution p∗ can be written as:\np∗ (y1 ≻ y2 | x) =\n\nexp (r∗ (x, y1 ))\n.\n∗\nexp (r (x, y1 )) + exp (r∗ (x, y2 ))\n\n(1)\n\n\b\n(i) (i) N\nAssuming access to a static dataset of comparisons D = x(i) , yw , yl i=1 sampled from p∗ , we\ncan parametrize a reward model rϕ (x, y) and estimate the parameters via maximum likelihood.\nFraming the problem as a binary classification we have the negative log-likelihood loss:\n\u0002\n\u0003\nLR (rϕ , D) = −E(x,yw ,yl )∼D log σ(rϕ (x, yw ) − rϕ (x, yl ))\n(2)\nwhere σ is the logistic function. In the context of LMs, the network rϕ (x, y) is often initialized from\nthe SFT model π SFT (y | x) with the addition of a linear layer on top of the final transformer layer\nthat produces a single scalar prediction for the reward value [51]. To ensure a reward function with\nlower variance, prior works normalize the rewards, such that Ex,y∼D [rϕ (x, y)] = 0 for all x.\nRL Fine-Tuning Phase: During the RL phase, the learned reward function is used to provide\nfeedback to the language model. Following prior works [17, 18], the optimization is formulated as\n\u0002\n\u0003\n\u0002\n\u0003\nmax Ex∼D,y∼πθ (y|x) rϕ (x, y) − βDKL πθ (y | x) || πref (y | x) ,\n(3)\nπθ\n\n3\n\n\fwhere β is a parameter controlling the deviation from the base reference policy πref , namely the initial SFT model π SFT . In practice, the language model policy πθ is also initialized to π SFT . The\nadded constraint is important, as it prevents the model from deviating too far from the distribution on which the reward model is accurate, as well as maintaining the generation diversity\nand preventing mode-collapse to single high-reward answers. Due to the discrete nature of language generation, this objective is not differentiable and is typically optimized with reinforcement learning. The standard approach [51, 40, 1, 28] has been to construct the reward function\nr(x, y) = rϕ (x, y) − β(log πθ (y | x) − log πref (y | x)), and maximize using PPO [39].\n\n4\n\nDirect Preference Optimization\n\nMotivated by the challenges of applying reinforcement learning algorithms on large-scale problems\nsuch as fine-tuning language models, our goal is to derive a simple approach for policy optimization\nusing preferences directly. Unlike prior RLHF methods, which learn a reward and then optimize it\nvia RL, our approach leverages a particular choice of reward model parameterization that enables\nextraction of its optimal policy in closed form, without an RL training loop. As we will describe\nnext in detail, our key insight is to leverage an analytical mapping from reward functions to optimal\npolicies, which enables us to transform a loss function over reward functions into a loss function\nover policies. This change-of-variables approach avoids fitting an explicit, standalone reward model,\nwhile still optimizing under existing models of human preferences, such as the Bradley-Terry model.\nIn essence, the policy network represents both the language model and the (implicit) reward.\nDeriving the DPO objective. We start with the same RL objective as prior work, Eq. 3, under a\ngeneral reward function r. Following prior work [31, 30, 19, 15], it is straightforward to show that\nthe optimal solution to the KL-constrained reward maximization objective in Eq. 3 takes the form:\n\u0012\n\u0013\n1\n1\nπr (y | x) =\nπref (y | x) exp\nr(x, y) ,\n(4)\nZ(x)\nβ\n\u0011\n\u0010\nP\nwhere Z(x) = y πref (y | x) exp β1 r(x, y) is the partition function. See Appendix A.1 for a\ncomplete derivation. Even if we use the MLE estimate rϕ of the ground-truth reward function r∗ , it is\nstill expensive to estimate the partition function Z(x) [19, 15], which makes this representation hard\nto utilize in practice. However, we can rearrange Eq. 4 to express the reward function in terms of its\ncorresponding optimal policy πr , the reference policy πref , and the unknown partition function Z(·).\nSpecifically, we first take the logarithm of both sides of Eq. 4 and then with some algebra we obtain:\nr(x, y) = β log\n\nπr (y | x)\n+ β log Z(x).\nπref (y | x)\n\n(5)\n\nWe can apply this reparameterization to the ground-truth reward r∗ and corresponding optimal model\nπ ∗ . Fortunately, the Bradley-Terry model depends only on the difference of rewards between two\ncompletions, i.e., p∗ (y1 ≻ y2 | x) = σ(r∗ (x, y1 ) − r∗ (x, y2 )). Substituting the reparameterization\nin Eq. 5 for r∗ (x, y) into the preference model Eq. 1, the partition function cancels, and we can\nexpress the human preference probability in terms of only the optimal policy π ∗ and reference policy\nπref . Thus, the optimal RLHF policy π ∗ under the Bradley-Terry model satisfies the preference model:\n1\n\np∗ (y1 ≻ y2 | x) =\n1 + exp\n\n\u0010\n\n∗\nπ ∗ (y1 |x)\n2 |x)\nβ log ππref(y\n(y2 |x) − β log πref (y1 |x)\n\n\u0011\n\n(6)\n\nThe derivation is in Appendix A.2. While Eq. 6 uses the Bradley-Terry model, we can similarly\nderive expressions under the more general Plackett-Luce models [32, 23], shown in Appendix A.3.\nNow that we have the probability of human preference data in terms of the optimal policy rather than\nthe reward model, we can formulate a maximum likelihood objective for a parametrized policy πθ .\nAnalogous to the reward modeling approach (i.e. Eq. 2), our policy objective becomes:\n\u0013\u0015\n\u0014\n\u0012\nπθ (yl | x)\nπθ (yw | x)\nLDPO (πθ ; πref ) = −E(x,yw ,yl )∼D log σ β log\n− β log\n.\n(7)\nπref (yw | x)\nπref (yl | x)\nThis way, we fit an implicit reward using an alternative parameterization, whose optimal policy is\nsimply πθ . Moreover, since our procedure is equivalent to fitting a reparametrized Bradley-Terry\n4\n\n\fmodel, it enjoys certain theoretical properties, such as consistencies under suitable assumption of the\npreference data distribution [4]. In Section 5, we further discuss theoretical properties of DPO in\nrelation to other works.\nWhat does the DPO update do? For a mechanistic understanding of DPO, it is useful to analyze the\ngradient of the loss function LDPO . The gradient with respect to the parameters θ can be written as:\n∇θ LDPO (πθ ; πref ) =\n\u0014\n− βE(x,yw ,yl )∼D\nσ(r̂θ (x, yl ) − r̂θ (x, yw ))\n{z\n}\n|\n\n\u0014\n\nhigher weight when reward estimate is wrong\n\n\u0015\u0015\n∇θ log π(yw | x) − ∇θ log π(yl | x) ,\n|\n{z\n}\n|\n{z\n}\n\nincrease likelihood of yw\n\ndecrease likelihood of yl\n\nwhere r̂θ (x, y) = β log ππrefθ (y|x)\n(y|x) is the reward implicitly defined by the language model πθ and reference model πref (more in Section 5). Intuitively, the gradient of the loss function LDPO increases the\nlikelihood of the preferred completions yw and decreases the likelihood of dispreferred completions\nyl . Importantly, the examples are weighed by how much higher the implicit reward model r̂θ rates\nthe dispreferred completions, scaled by β, i.e, how incorrectly the implicit reward model orders\nthe completions, accounting for the strength of the KL constraint. Our experiments suggest the\nimportance of this weighting, as a naïve version of this method without the weighting coefficient can\ncause the language model to degenerate (Appendix Table 3).\nDPO outline. The general DPO pipeline is as follows: 1) Sample completions y1 , y2 ∼ πref (· | x)\nfor every prompt x, label with human preferences to construct the offline dataset of preferences\n(i)\nD = {x(i) , yw , yl )(i) }N\ni=1 and 2) optimize the language model πθ to minimize LDPO for the given\nπref and D and desired β. In practice, one would like to reuse preference datasets publicly available,\nrather than generating samples and gathering human preferences. Since the preference datasets\nare sampled using π SFT , we initialize πref = π SFT whenever available. However, when π SFT is\nnot available, we initialize πref by maximizing likelihood of preferred completions (x, yw ), that\nis, πref = arg maxπ Ex,yw ∼D [log π(yw | x)]. This procedure helps mitigate the distribution shift\nbetween the true reference distribution which is unavailable, and πref used by DPO. Further details\nrelated to the implementation and hyperparameters can be found in Appendix B.\n\n5\n\nTheoretical Analysis of DPO\n\nIn this section, we give further interpretation of the DPO method, provide theoretical backing, and\nrelate advantages of DPO to issues with actor critic algorithms used for RLHF (such as PPO [39]).\n5.1\n\nYour Language Model Is Secretly a Reward Model\n\nDPO is able to bypass both fitting an explicit reward and performing RL to learn the policy using\na single maximum likelihood objective. Note the optimization objective Eq. 5 is equivalent to a\nπ ∗ (y|x)\nBradley-Terry model with a reward parameterization r∗ (x, y) = β log πrefθ (y|x) and we optimize our\nparametric model πθ , equivalently to the reward model optimization in Eq. 2 under the change of\nvariables. In this section we will build the theory behind this reparameterization, show that it does\nnot constrain the class of learned reward models, and allows for the exact recovery of the optimal\npolicy. We begin with by defining an equivalence relation between reward functions.\nDefinition 1. We say that two reward functions r(x, y) and r′ (x, y) are equivalent iff\nr(x, y) − r′ (x, y) = f (x) for some function f .\nIt is easy to see that this is indeed an equivalence relation, which partitions the set of reward functions\ninto classes. We can state the following two lemmas:\nLemma 1. Under the Plackett-Luce, and in particular the Bradley-Terry, preference framework, two\nreward functions from the same class induce the same preference distribution.\nLemma 2. Two reward functions from the same equivalence class induce the same optimal policy\nunder the constrained RL problem.\nThe proofs are straightforward and we defer them to Appendix A.5. The first lemma is a well-known\nunder-specification issue with the Plackett-Luce family of models [32]. Due to this under-specification,\n5\n\n\fwe usually have to impose additional identifiability constraints to achieve any guarantees on the MLE\nestimates from Eq. 2 [4]. The second lemma states that all reward functions from the same class\nyield the same optimal policy, hence for our final objective, we are only interested in recovering an\narbitrary reward function from the optimal class. We prove the following Theorem in Appendix A.6:\nTheorem 1. Under mild assumptions, all reward classes consistent with the Plackett-Luce\n(and Bradley-Terry in particular) models can be represented with the reparameterization\nr(x, y) = β log ππ(y|x)\nfor some model π(y | x) and a given reference model πref (y | x).\nref (y|x)\nProof Sketch. Consider any reward function r(x, y), which induces a corresponding optimal model\nπr (y | x), specified by Eq. 4. We will show that a reward function from the equivalence class of r\ncan be represented using the reparameterization given above. We define the projection f as\n\u0012\n\u0013\nX\n1\nf (r; πref , β)(x, y) = r(x, y) − β log\nπref (y | x) exp\nr(x, y)\n(8)\nβ\ny\nThe operator f simply normalizes the reward function with the logarithm of the partition function\nof πr . Since the added normalization term is only a function of the prefix x, f (r; πref , β)(x, y) is a\nreward function in the equivalence class of r(x, y). Finally, replacing r with the RHS of Eq. 5 (which\nholds for any reward function), we have f (r; πref , β)(x, y) = β log ππrefr (y|x)\n(y|x) . That is, the projection\nf produces a member of the equivalence class of r with the desired form, and we do not lose any\ngenerality in our reward model from the proposed reparameterization.\nWe can alternatively view Theorem 1 as specifying exactly which reward function within each\nequivalence class the DPO reparameterization selects, that is, the reward function satisfying:\n\u0012\n\u0013\nX\n1\nπref (y | x) exp\nr(x, y) = 1,\n(9)\nβ\ny |\n{z\n}\n=π(y|x), using Thm. 1 reparam.\n\ni.e., π(y | x) is a valid distribution (probabilities are positive and sum to 1). However, following\nEq. 4, we can see that Eq. 9 is the partition function of the optimal policy induced by the reward\nfunction r(x, y). The key insight of the DPO algorithm is that we can impose certain constraints on\nthe under-constrained Plackett-Luce (and Bradley-Terry in particular) family of preference models,\nsuch that we preserve the class of representable reward models, but explicitly make the optimal policy\nin Eq. 4 analytically tractable for all prompts x.\n5.2\n\nInstability of Actor-Critic Algorithms\n\nWe can also use our framework to diagnose instabilities with standard actor-critic algorithms used\nfor the RLHF, such as PPO. We follow the RLHF pipeline and focus on the RL fine-tuning step\noutlined in Section 3. We can draw connections to the control as inference framework [22] for the\nconstrained RL problem outlined in 3. We assume a parameterized model πθ (y | x) and minimize\nDKL [πθ (y|x) || π ∗ (y | x)] where π ∗ is the optimal policy from Eq. 7 induced by the reward function\nrϕ (y, x). With some algebra this leads to the optimization objective:\n\u0014\n\u0012\n\u0013\n\u0015\nX\n1\nπθ (y | x)\nmax Eπθ (y|x) rϕ (x, y) − β log\nπref (y | x) exp\nrϕ (x, y) − β log\n(10)\nπθ\nβ\nπref (y | x)\ny\n|\n{z\n}\n{z\n}\n|\nf (rϕ ,πref ,β)\n\nKL\n\nThis is the same objective optimized in prior works [51, 40, 1, 28] using the DPO-equivalent reward\nfor the reward class of rϕ . In this setting, we can interpret the normalization term in f (rϕ , πref , β)\nas the soft value function of the reference policy πref . While this term does not affect the optimal\nsolution, without it, the policy gradient of the objective could have high variance, making learning\nunstable. We can accommodate for the normalization term using a learned value function, but that\ncan also be difficult to optimize. Alternatively, prior works have normalized rewards using a human\ncompletion baseline, essentially a single sample Monte-Carlo estimate of the normalizing term. In\ncontrast the DPO reparameterization yields a reward function that does not require any baselines.\n6\n\n\fIMDb Sentiment Generation\n\n1.0\n\nTL;DR Summarization Win Rate vs Reference\n\n0.9\n\nPreferred-FT\nSFT\n\nGPT-J\nBest of 128\n\n0.6\n\n0.8\n\n0.5\n\nWin rate\n\nReward\n\nDPO\nPPO\n\n0.7\n\n0.7\n0.6\n0.5\n\nDPO (Ours)\nUnlikelihood\nPPO (Our impl.)\n\n0.4\n0.0\n\n2.5\n\n5.0\n\n7.5\n\nKL(\n\n10.0\n\n12.5\n\n15.0\n\n17.5\n\n0.3\n0.2\n\nPPO-GT (Our impl.)\nPPO-GT (TRL)\nPreferred-FT\nref)\n\n0.4\n\n0.1\n0.0\n\n20.0\n\n0.00\n\n0.25\n\n0.50\n\n0.75\n\nSampling temperature\n\n1.00\n\nFigure 2: Left. The frontier of expected reward vs KL to the reference policy. DPO provides the highest expected\nreward for all KL values, demonstrating the quality of the optimization. Right. TL;DR summarization win\nrates vs. human-written summaries, using GPT-4 as evaluator. DPO exceeds PPO’s best-case performance on\nsummarization, while being more robust to changes in the sampling temperature.\n\n6\n\nExperiments\n\nIn this section, we empirically evaluate DPO’s ability to train policies directly from preferences. First,\nin a well-controlled text-generation setting, we ask: how efficiently does DPO trade off maximizing\nreward and minimizing KL-divergence with the reference policy, compared to common preference\nlearning algorithms such as PPO? Next, we evaluate DPO’s performance on larger models and more\ndifficult RLHF tasks, including summarization and dialogue. We find that with almost no tuning\nof hyperparameters, DPO tends to perform as well or better than strong baselines like RLHF with\nPPO as well as returning the best of N sampled trajectories under a learned reward function. Before\npresenting these results, we describe the experimental set-up; additional details are in Appendix C.\nTasks. Our experiments explore three different open-ended text generation tasks. For all experiments,\n\b\n(i) (i) N\nalgorithms learn a policy from a dataset of preferences D = x(i) , yw , yl i=1 . In controlled\nsentiment generation, x is a prefix of a movie review from the IMDb dataset [24], and the policy\nmust generate y with positive sentiment. In order to perform a controlled evaluation, for this\nexperiment we generate preference pairs over generations using a pre-trained sentiment classifier,\nwhere p(positive | x, yw ) &gt; p(positive | x, yl ). For SFT, we fine-tune GPT-2-large until convergence\non reviews from the train split of the IMDB dataset (further details in App C.1). In summarization,\nx is a forum post from Reddit; the policy must generate a summary y of the main points in the\npost. Following prior work, we use the Reddit TL;DR summarization dataset [43] along with human\npreferences gathered by Stiennon et al.. We use an SFT model fine-tuned on human-written forum\npost summaries2 with the TRLX [44] framework for RLHF. The human preference dataset was\ngathered by Stiennon et al. on samples from a different, but similarly-trained, SFT model. Finally, in\nsingle-turn dialogue, x is a human query, which may be anything from a question about astrophysics\nto a request for relationship advice. A policy must produce an engaging and helpful response y to\na user’s query; we use the Anthropic Helpful and Harmless dialogue dataset [1], containing 170k\ndialogues between a human and an automated assistant. Each transcript ends with a pair of responses\ngenerated by a large (although unknown) language model along with a preference label denoting\nthe human-preferred response. In this setting, no pre-trained SFT model is available; we therefore\nfine-tune an off-the-shelf language model on only the preferred completions to form the SFT model.\nEvaluation. Our experiments use two different approaches to evaluation. In order to analyze the\neffectiveness of each algorithm in optimizing the constrained reward maximization objective, in the\ncontrolled sentiment generation setting we evaluate each algorithm by its frontier of achieved reward\nand KL-divergence from the reference policy; this frontier is computable because we have acccess to\nthe ground-truth reward function (a sentiment classifier). However, in the real world, the ground truth\nreward function is not known; therefore, we evaluate algorithms with their win rate against a baseline\npolicy, using GPT-4 as a proxy for human evaluation of summary quality and response helpfulness\nin the summarization and single-turn dialogue settings, respectively. For summarization, we use\nreference summaries in the test set as the baseline; for dialogue, we use the preferred response in the\n2\n\nhttps://huggingface.co/CarperAI/openai_summarize_tldr_sft\n\n7\n\n\f0.6\n\n0.65\n\n0.5\n\n0.60\n\n0.4\n0.3\n\nDialogue Win Rate Evolution\n\n0.70\n\nWin rate\n\nWin rate\n\nAnthropic-HH Dialogue Win Rate vs Chosen\n\n0.55\n0.50\n0.45\n0.40\n\n0.2\n\nDPO\nBest of 128\n\n0.1\n0.25\n\n0.50\n\n0.75\n\nSampling temperature\n\nPreferred-FT\nPythia-2.8B\n\n0.35\n0.30\n\n1.00\n\nDPO (temp = 1.0)\n0\n\nDPO (temp = 0.7)\n\n300 600 900 1200 1500 1800 2100 2400 2700 3000 3300\n\nFine-tuning step\n\nFigure 3: Left. Win rates computed by GPT-4 for Anthropic-HH one-step dialogue; DPO is the only method\nthat improves over chosen summaries in the Anthropic-HH test set. Right. Win rates for different sampling\ntemperatures over the course of training. DPO’s improvement over the dataset labels is fairly stable over the\ncourse of training for different sampling temperatures.\n\ntest dataset as the baseline. While existing studies suggest LMs can be better automated evaluators\nthan existing metrics [10], we conduct a human study to justify our usage of GPT-4 for evaluation\nin Sec. 6.4. We find GPT-4 judgments correlate strongly with humans, with human agreement with\nGPT-4 typically similar or higher than inter-human annotator agreement.\nMethods. In addition to DPO, we evaluate several existing approaches to training language models\nto adhere to human preferences. Most simply, we explore zero-shot prompting with GPT-J [45] in\nthe summarization task and 2-shot prompting with Pythia-2.8B [3] in the dialogue task. In addition,\nwe evaluate the SFT model as well as Preferred-FT, which is a model fine-tuned with supervised\nlearning on the chosen completion yw from either the SFT model (in controlled sentiment and\nsummarization) or a generic LM (in single-turn dialogue). Another pseudo-supervised method is\nUnlikelihood [46], which simply optimizes the policy to maximize the probability assigned to yw and\nminimize the probability assigned to yl ; we use an optional coefficient α ∈ [0, 1] on the ‘unlikelihood’\nterm. We also consider PPO [39] using a reward function learned from the preference data and\nPPO-GT, which is an oracle that learns from the ground truth reward function available in the\ncontrolled sentiment setting. In our sentiment experiments, we use two implementations of PPO-GT,\none of-the-shelf version [44] as well as a modified version that normalizes rewards and further tunes\nhyperparameters to improve performance (we also use these modifications when running ‘normal’\nPPO with learned rewards). Finally, we consider the Best of N baseline, sampling N responses from\nthe SFT model (or Preferred-FT in dialogue) and returning the highest-scoring response according to\na reward function learned from the preference dataset. This high-performing method decouples the\nquality of the reward model from the PPO optimization, but is computationally impractical even for\nmoderate N as it requires sampling N completions for every query at test time.\n6.1\n\nHow well can DPO optimize the RLHF objective?\n\nThe KL-constrained reward maximization objective used in typical RLHF algorithms balances\nexploitation of reward while restricting the policy from deviating far from the reference policy.\nTherefore, when comparing algorithms, we must take into account both reward achieved as well as the\nKL discrepancy; achieving slightly higher reward but with much higher KL is not necessarily desirable.\nFigure 2 shows the reward-KL frontier for various algorithms in the sentiment setting. We execute\nmultiple training runs for each algorithm, using a different hyperparameter for policy conservativeness\nin each run (target KL ∈ {3, 6, 9, 12} for PPO, β ∈ {0.05, 0.1, 1, 5}, α ∈ {0.05, 0.1, 0.5, 1} for\nunlikelihood, random seeds for preferred-FT). This sweep includes 22 runs in total. After each\n100 training steps until convergence, we evaluate each policy on a set of test prompts, computing\nthe average reward under the true reward function as well as the average sequence-level KL3 with\nthe reference policy KL (π || πref ). We find that DPO produces by far the most efficient frontier,\nachieving the highest reward while still achieving low KL. This result is particularly notable for\nmultiple reasons. First, DPO and PPO optimize the same objective, but DPO is notably more efficient;\n3\n\nThat is, the sum of the per-timestep KL-divergences.\n\n8\n\n\fDPO’s reward/KL tradeoff strictly dominates PPO. Second, DPO achieves a better frontier than PPO,\neven when PPO can access ground truth rewards (PPO-GT).\n6.2\n\nCan DPO scale to real preference datasets?\n\nNext, we evaluate fine-tuning performance of DPO on summarization and single-turn dialogue. For\nsummarization, automatic evaluation metrics such as ROUGE can be poorly correlated with human\npreferences [40], and prior work has found that fine-tuning LMs using PPO on human preferences\nto provide more effective summaries. We evaluate different methods by sampling completions on\nthe test split of TL;DR summarization dataset, and computing the average win rate against reference\ncompletions in the test set. The completions for all methods are sampled at temperatures varying\nfrom 0.0 to 1.0, and the win rates are shown in Figure 2 (right). DPO, PPO and Preferred-FT all\nfine-tune the same GPT-J SFT model4 . We find that DPO has a win rate of approximately 61% at a\ntemperature of 0.0, exceeding the performance of PPO at 57% at its optimal sampling temperature\nof 0.0. DPO also achieves a higher maximum win rate compared to the best of N baseline. We\nnote that we did not meaningfully tune DPO’s β hyperparameter, so these results may underestimate\nDPO’s potential. Moreover, we find DPO to be much more robust to the sampling temperature than\nPPO, the performance of which can degrade to that of the base GPT-J model at high temperatures.\nPreferred-FT does not improve significantly over the SFT model. We also compare DPO and PPO\nhead-to-head in human evaluations in Section 6.4, where DPO samples at temperature 0.25 were\npreferred 58% times over PPO samples at temperature 0.\nOn single-turn dialogue, we evaluate the different methods on the subset of the test split of the\nAnthropic HH dataset [1] with one step of human-assistant interaction. GPT-4 evaluations use the\npreferred completions on the test as the reference to compute the win rate for different methods. As\nthere is no standard SFT model for this task, we start with a pre-trained Pythia-2.8B, use Preferred-FT\nto train a reference model on the chosen completions such that completions are within distribution\nof the model, and then train using DPO. We also compare against the best of 128 Preferred-FT\ncompletions (we found the Best of N baseline plateaus at 128 completions for this task; see Appendix\nFigure 4) and a 2-shot prompted version of the Pythia-2.8B base model, finding DPO performs as\nwell or better for the best-performing temperatures for each method. We also evaluate an RLHF\nmodel trained with PPO on the Anthropic HH dataset 5 from a well-known source 6 , but are unable\nto find a prompt or sampling temperature that gives performance better than the base Pythia-2.8B\nmodel. Based on our results from TL;DR and the fact that both methods optimize the same reward\nfunction, we consider Best of 128 a rough proxy for PPO-level performance. Overall, DPO is the\nonly computationally efficient method that improves over the preferred completions in the Anthropic\nHH dataset, and provides similar or better performance to the computationally demanding Best of\n128 baseline. Finally, Figure 3 shows that DPO converges to its best performance relatively quickly.\n6.3\n\nGeneralization to a new input distribution\nWin rate vs. ground truth\n\nTo further compare the performance of PPO and DPO unAlg. Temp 0\nTemp 0.25\nder distribution shifts, we evaluate the PPO and DPO poliDPO\n0.36\n0.31\ncies from our Reddit TL;DR summarization experiment on\nPPO\n0.26\n0.23\na different distribution, news articles in the test split of the\nCNN/DailyMail dataset [26], using the best sampling temper- Table 1: GPT-4 win rates vs. ground\natures from TL;DR (0 and 0.25). The results are presented truth summaries for out-of-distribution\nin Table 1. We computed the GPT-4 win rate against the CNN/DailyMail input articles.\nground-truth summaries in the datasets, using the same GPT4 (C) prompt we used for Reddit TL;DR, but replacing the words “forum post” with “news article”.\nFor this new distribution, DPO continues to outperform the PPO policy by a significant margin. This\nexperiment provides initial evidence that DPO policies can generalize similarly well to PPO policies,\neven though DPO does not use the additional unlabeled Reddit TL;DR prompts that PPO uses.\n4\n\nhttps://huggingface.co/CarperAI/openai_summarize_tldr_sft\nhttps://huggingface.co/reciprocate/ppo_hh_pythia-6B\n6\nhttps://github.com/CarperAI/trlx/tree/main/examples/hh\n5\n\n9\n\n\f6.4\n\nValidating GPT-4 judgments with human judgments\n\nWe conduct a human study to verify the reliability of GPT-4’s judgments, using the results of\nthe TL;DR summarization experiment and two different GPT-4 prompts. The GPT-4 (S) (simple) prompt simply asks for which summary better-summarizes the important information in the\npost. The GPT-4 (C) (concise) prompt also asks for which summary is more concise; we evaluate this prompt because we find that GPT-4 prefers longer, more repetitive summaries than humans do with the GPT-4 (S) prompt. See Appendix C.2 for the complete prompts. We perform\nthree comparisons, using the highest (DPO, temp. 0.25), the lowest (PPO, temp. 1.0), and a\nmiddle-performing (SFT, temp. 0.25) method with\nthe aim of covering a diversity of sample qualities;\nDPO SFT PPO-1\nall three methods are compared against greedilyN respondents\n272\n122\n199\nsampled PPO (its best-performing temperature).\nGPT-4 (S) win %\n47\n27\n13\nWe find that with both prompts, GPT-4 tends to\nGPT-4 (C) win %\n54\n32\n12\nagree with humans about as often as humans agree\nHuman win %\n58\n43\n17\nwith each other, suggesting that GPT-4 is a reasonable proxy for human evaluations (due to limited\nGPT-4 (S)-H agree\n70\n77\n86\nhuman raters, we only collect multiple human judgGPT-4 (C)-H agree\n67\n79\n85\nH-H agree\n65\n87\nments for the DPO and PPO-1 comparisons). Overall, the GPT-4 (C) prompt generally provides win Table 2: Comparing human and GPT-4 win rates\nrates more representative of humans; we therefore and per-judgment agreement on TL;DR summarizause this prompt for the main results in Section 6.2. tion samples. Humans agree with GPT-4 about as\nFor additional details about the human study, in- much as they agree with each other. Each expericluding the web interface presented to raters and ment compares a summary from the stated method\nthe list of human volunteers, see Appendix D.3.\nwith a summary from PPO with temperature 0.\n\n7\n\nDiscussion\n\nLearning from preferences is a powerful, scalable framework for training capable, aligned language\nmodels. We have introduced DPO, a simple training paradigm for training language models from\npreferences without reinforcement learning. Rather than coercing the preference learning problem\ninto a standard RL setting in order to use off-the-shelf RL algorithms, DPO identifies a mapping\nbetween language model policies and reward functions that enables training a language model to\nsatisfy human preferences directly, with a simple cross-entropy loss, without reinforcement learning\nor loss of generality. With virtually no tuning of hyperparameters, DPO performs similarly or better\nthan existing RLHF algorithms, including those based on PPO; DPO thus meaningfully reduces the\nbarrier to training more language models from human preferences.\nLimitations &amp; Future Work. Our results raise several important questions for future work. How\ndoes the DPO policy generalize out of distribution, compared with learning from an explicit reward\nfunction? Our initial results suggest that DPO policies can generalize similarly to PPO-based models,\nbut more comprehensive study is needed. For example, can training with self-labeling from the\nDPO policy similarly make effective use of unlabeled prompts? On another front, how does reward\nover-optimization manifest in the direct preference optimization setting, and is the slight decrease\nin performance in Figure 3-right an instance of it? Additionally, while we evaluate models up to\n6B parameters, exploration of scaling DPO to state-of-the-art models orders of magnitude larger is\nan exciting direction for future work. Regarding evaluations, we find that the win rates computed\nby GPT-4 are impacted by the prompt; future work may study the best way to elicit high-quality\njudgments from automated systems. Finally, many possible applications of DPO exist beyond training\nlanguage models from human preferences, including training generative models in other modalities.\n\nAcknowledgements\nEM gratefully acknowledges funding from a Knight-Hennessy Graduate Fellowship. CF and CM\nare CIFAR Fellows. This work was supported in part by the Stanford Accelerator for Learning\n(SAL) and Stanford Institute for Human-Centered Artificial Intelligence (HAI) Generative AI for the\nFuture of Learning seed grant program. The Stanford Center for Research on Foundation Models\n(CRFM) provided part of the compute resources used for the experiments in this work. This work\nwas supported in part by ONR grant N00014-20-1-2675.\n10\n\n\fReferences\n[1] Y. Bai, A. Jones, K. Ndousse, A. Askell, A. Chen, N. DasSarma, D. Drain, S. Fort, D. Ganguli,\nT. Henighan, N. Joseph, S. Kadavath, J. Kernion, T. Conerly, S. El-Showk, N. Elhage, Z. HatfieldDodds, D. Hernandez, T. Hume, S. Johnston, S. Kravec, L. Lovitt, N. Nanda, C. Olsson,\nD. Amodei, T. Brown, J. Clark, S. McCandlish, C. Olah, B. Mann, and J. Kaplan. Training a\nhelpful and harmless assistant with reinforcement learning from human feedback, 2022.\n[2] Y. Bai, S. Kadavath, S. Kundu, A. Askell, J. Kernion, A. Jones, A. Chen, A. Goldie, A. Mirhoseini, C. McKinnon, C. Chen, C. Olsson, C. Olah, D. Hernandez, D. Drain, D. Ganguli, D. Li,\nE. Tran-Johnson, E. Perez, J. Kerr, J. Mueller, J. Ladish, J. Landau, K. Ndousse, K. Lukosuite,\nL. Lovitt, M. Sellitto, N. Elhage, N. Schiefer, N. Mercado, N. DasSarma, R. Lasenby, R. Larson, S. Ringer, S. Johnston, S. Kravec, S. E. Showk, S. Fort, T. Lanham, T. Telleen-Lawton,\nT. Conerly, T. Henighan, T. Hume, S. R. Bowman, Z. Hatfield-Dodds, B. Mann, D. Amodei,\nN. Joseph, S. McCandlish, T. Brown, and J. Kaplan. Constitutional ai: Harmlessness from ai\nfeedback, 2022.\n[3] S. Biderman, H. Schoelkopf, Q. Anthony, H. Bradley, K. O’Brien, E. Hallahan, M. A. Khan,\nS. Purohit, U. S. Prashanth, E. Raff, A. Skowron, L. Sutawika, and O. van der Wal. Pythia: A\nsuite for analyzing large language models across training and scaling, 2023.\n[4] H. Bong and A. Rinaldo. Generalized results for the existence and consistency of the MLE\nin the Bradley-Terry-Luce model. International Conference on Machine Learning, 2022.\narXiv:2110.11487.\n[5] R. A. Bradley and M. E. Terry. Rank analysis of incomplete block designs: I. the method of\npaired comparisons. Biometrika, 39(3/4):324–345, 1952. doi: https://doi.org/10.2307/2334029.\n[6] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan,\nP. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child,\nA. Ramesh, D. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray,\nB. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and\nH. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1877–\n1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_\nfiles/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.\n[7] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam,\nG. Sastry, A. Askell, et al. Language models are few-shot learners. Advances in neural\ninformation processing systems, 33:1877–1901, 2020.\n[8] S. Bubeck, V. Chandrasekaran, R. Eldan, J. Gehrke, E. Horvitz, E. Kamar, P. Lee, Y. T. Lee,\nY. Li, S. Lundberg, H. Nori, H. Palangi, M. T. Ribeiro, and Y. Zhang. Sparks of artificial general\nintelligence: Early experiments with GPT-4, 2023. arXiv preprint arXiv:2303.12712.\n[9] R. Busa-Fekete, B. Szörényi, P. Weng, W. Cheng, and E. Hüllermeier. Preference-based\nreinforcement learning: evolutionary direct policy search using a preference-based racing\nalgorithm. Machine Learning, 97(3):327–351, July 2014. doi: 10.1007/s10994-014-5458-8.\nURL https://doi.org/10.1007/s10994-014-5458-8.\n[10] Y. Chen, R. Wang, H. Jiang, S. Shi, and R.-L. Xu. Exploring the use of large language models\nfor reference-free text quality evaluation: A preliminary empirical study. ArXiv, abs/2304.00723,\n2023.\n[11] A. Chowdhery, S. Narang, J. Devlin, M. Bosma, G. Mishra, A. Roberts, P. Barham, H. W.\nChung, C. Sutton, S. Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv\npreprint arXiv:2204.02311, 2022.\n[12] P. F. Christiano, J. Leike, T. Brown, M. Martic, S. Legg, and D. Amodei. Deep reinforcement\nlearning from human preferences. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus,\nS. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/\npaper_files/paper/2017/file/d5e2c0adad503c91f91df240d0cd4e49-Paper.pdf.\n11\n\n\f[13] H. W. Chung, L. Hou, S. Longpre, B. Zoph, Y. Tay, W. Fedus, Y. Li, X. Wang, M. Dehghani,\nS. Brahma, A. Webson, S. S. Gu, Z. Dai, M. Suzgun, X. Chen, A. Chowdhery, A. Castro-Ros,\nM. Pellat, K. Robinson, D. Valter, S. Narang, G. Mishra, A. Yu, V. Zhao, Y. Huang, A. Dai,\nH. Yu, S. Petrov, E. H. Chi, J. Dean, J. Devlin, A. Roberts, D. Zhou, Q. V. Le, and J. Wei.\nScaling instruction-finetuned language models, 2022.\n[14] M. Dudík, K. Hofmann, R. E. Schapire, A. Slivkins, and M. Zoghi. Contextual dueling bandits.\nIn P. Grünwald, E. Hazan, and S. Kale, editors, Proceedings of The 28th Conference on Learning\nTheory, volume 40 of Proceedings of Machine Learning Research, pages 563–587, Paris, France,\n03–06 Jul 2015. PMLR. URL https://proceedings.mlr.press/v40/Dudik15.html.\n[15] D. Go, T. Korbak, G. Kruszewski, J. Rozen, N. Ryu, and M. Dymetman. Aligning language\nmodels with preferences through f-divergence minimization. In Proceedings of the 40th\nInternational Conference on Machine Learning, ICML’23. JMLR.org, 2023.\n[16] A. Jain, B. Wojcik, T. Joachims, and A. Saxena. Learning trajectory preferences for manipulators via iterative improvement. In C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and\nK. Weinberger, editors, Advances in Neural Information Processing Systems, volume 26. Curran\nAssociates, Inc., 2013. URL https://proceedings.neurips.cc/paper_files/paper/\n2013/file/c058f544c737782deacefa532d9add4c-Paper.pdf.\n[17] N. Jaques, S. Gu, D. Bahdanau, J. M. Hernández-Lobato, R. E. Turner, and D. Eck. Sequence\ntutor: Conservative fine-tuning of sequence generation models with kl-control. In International\nConference on Machine Learning, pages 1645–1654. PMLR, 2017.\n[18] N. Jaques, J. H. Shen, A. Ghandeharioun, C. Ferguson, A. Lapedriza, N. Jones, S. S. Gu, and\nR. Picard. Human-centric dialog training via offline reinforcement learning. arXiv preprint\narXiv:2010.05848, 2020.\n[19] T. Korbak, H. Elsahar, G. Kruszewski, and M. Dymetman. On reinforcement learning and\ndistribution matching for fine-tuning language models with no catastrophic forgetting. In\nS. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in\nNeural Information Processing Systems, volume 35, pages 16203–16220. Curran Associates,\nInc., 2022. URL https://proceedings.neurips.cc/paper_files/paper/2022/file/\n67496dfa96afddab795530cc7c69b57a-Paper-Conference.pdf.\n[20] J. Kreutzer, J. Uyheng, and S. Riezler. Reliability and learnability of human bandit feedback\nfor sequence-to-sequence reinforcement learning. In Proceedings of the 56th Annual Meeting\nof the Association for Computational Linguistics (Volume 1: Long Papers), pages 1777–1788,\nMelbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/\nP18-1165. URL https://aclanthology.org/P18-1165.\n[21] A. Kupcsik, D. Hsu, and W. S. Lee. Learning Dynamic Robot-to-Human Object Handover\nfrom Human Feedback, pages 161–176. Springer International Publishing, 01 2018. ISBN\n978-3-319-51531-1. doi: 10.1007/978-3-319-51532-8_10.\n[22] S. Levine. Reinforcement learning and control as probabilistic inference: Tutorial and review,\n2018.\n[23] R. D. Luce. Individual choice behavior: A theoretical analysis. Courier Corporation, 2012.\n[24] A. L. Maas, R. E. Daly, P. T. Pham, D. Huang, A. Y. Ng, and C. Potts. Learning word vectors\nfor sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for\nComputational Linguistics: Human Language Technologies, pages 142–150, Portland, Oregon,\nUSA, June 2011. Association for Computational Linguistics. URL http://www.aclweb.org/\nanthology/P11-1015.\n[25] S. Mishra, D. Khashabi, C. Baral, and H. Hajishirzi. Cross-task generalization via natural\nlanguage crowdsourcing instructions. In Proceedings of the 60th Annual Meeting of the\nAssociation for Computational Linguistics (Volume 1: Long Papers), pages 3470–3487, Dublin,\nIreland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.\n244. URL https://aclanthology.org/2022.acl-long.244.\n12\n\n\f[26] R. Nallapati, B. Zhou, C. dos Santos, Ç. Gulçehre, and B. Xiang. Abstractive text summarization\nusing sequence-to-sequence RNNs and beyond. In Proceedings of the 20th SIGNLL Conference\non Computational Natural Language Learning, pages 280–290, Berlin, Germany, Aug. 2016.\nAssociation for Computational Linguistics. doi: 10.18653/v1/K16-1028. URL https://\naclanthology.org/K16-1028.\n[27] D. Narayanan, M. Shoeybi, J. Casper, P. LeGresley, M. Patwary, V. Korthikanti, D. Vainbrand,\nP. Kashinkunti, J. Bernauer, B. Catanzaro, A. Phanishayee, and M. Zaharia. Efficient large-scale\nlanguage model training on gpu clusters using megatron-lm. In Proceedings of the International\nConference for High Performance Computing, Networking, Storage and Analysis, SC ’21, New\nYork, NY, USA, 2021. Association for Computing Machinery. ISBN 9781450384421. doi:\n10.1145/3458817.3476209. URL https://doi.org/10.1145/3458817.3476209.\n[28] L. Ouyang, J. Wu, X. Jiang, D. Almeida, C. Wainwright, P. Mishkin, C. Zhang, S. Agarwal,\nK. Slama, A. Ray, J. Schulman, J. Hilton, F. Kelton, L. Miller, M. Simens, A. Askell, P. Welinder,\nP. F. Christiano, J. Leike, and R. Lowe. Training language models to follow instructions with\nhuman feedback. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh,\neditors, Advances in Neural Information Processing Systems, volume 35, pages 27730–27744.\nCurran Associates, Inc., 2022. URL https://proceedings.neurips.cc/paper_files/\npaper/2022/file/b1efde53be364a73914f58805a001731-Paper-Conference.pdf.\n[29] R. Paulus, C. Xiong, and R. Socher. A deep reinforced model for abstractive summarization. In\nInternational Conference on Learning Representations, 2018. URL https://openreview.\nnet/forum?id=HkAClQgA-.\n[30] X. B. Peng, A. Kumar, G. Zhang, and S. Levine. Advantage-weighted regression: Simple and\nscalable off-policy reinforcement learning. arXiv preprint arXiv:1910.00177, 2019.\n[31] J. Peters and S. Schaal. Reinforcement learning by reward-weighted regression for operational\nspace control. In Proceedings of the 24th international conference on Machine learning, pages\n745–750, 2007.\n[32] R. L. Plackett. The analysis of permutations. Journal of the Royal Statistical Society. Series C\n(Applied Statistics), 24(2):193–202, 1975. doi: https://doi.org/10.2307/2346567.\n[33] A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever. Language models are\nunsupervised multitask learners, 2019. Ms., OpenAI.\n[34] R. Ramamurthy, P. Ammanabrolu, K. Brantley, J. Hessel, R. Sifa, C. Bauckhage, H. Hajishirzi,\nand Y. Choi. Is reinforcement learning (not) for natural language processing: Benchmarks,\nbaselines, and building blocks for natural language policy optimization. In The Eleventh\nInternational Conference on Learning Representations, 2023. URL https://openreview.\nnet/forum?id=8aHzds2uUyB.\n[35] M. Ranzato, S. Chopra, M. Auli, and W. Zaremba. Sequence level training with recurrent neural\nnetworks. CoRR, abs/1511.06732, 2015.\n[36] D. Sadigh, A. D. Dragan, S. Sastry, and S. A. Seshia. Active preference-based learning of\nreward functions. In Robotics: Science and Systems (RSS), 2017.\n[37] A. Saha, A. Pacchiano, and J. Lee. Dueling rl: Reinforcement learning with trajectory\npreferences. In F. Ruiz, J. Dy, and J.-W. van de Meent, editors, Proceedings of The 26th\nInternational Conference on Artificial Intelligence and Statistics, volume 206 of Proceedings of Machine Learning Research, pages 6263–6289. PMLR, 25–27 Apr 2023. URL\nhttps://proceedings.mlr.press/v206/saha23a.html.\n[38] V. Sanh, A. Webson, C. Raffel, S. Bach, L. Sutawika, Z. Alyafeai, A. Chaffin, A. Stiegler,\nA. Raja, M. Dey, M. S. Bari, C. Xu, U. Thakker, S. S. Sharma, E. Szczechla, T. Kim, G. Chhablani, N. Nayak, D. Datta, J. Chang, M. T.-J. Jiang, H. Wang, M. Manica, S. Shen, Z. X.\nYong, H. Pandey, R. Bawden, T. Wang, T. Neeraj, J. Rozen, A. Sharma, A. Santilli, T. Fevry,\nJ. A. Fries, R. Teehan, T. L. Scao, S. Biderman, L. Gao, T. Wolf, and A. M. Rush. Multitask prompted training enables zero-shot task generalization. In International Conference on\nLearning Representations, 2022. URL https://openreview.net/forum?id=9Vrb9D0WI4.\n13\n\n\f[39] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization\nalgorithms, 2017.\n[40] N. Stiennon, L. Ouyang, J. Wu, D. M. Ziegler, R. Lowe, C. Voss, A. Radford, D. Amodei, and\nP. Christiano. Learning to summarize from human feedback, 2022.\n[41] R. Thoppilan, D. D. Freitas, J. Hall, N. Shazeer, A. Kulshreshtha, H.-T. Cheng, A. Jin, T. Bos,\nL. Baker, Y. Du, Y. Li, H. Lee, H. S. Zheng, A. Ghafouri, M. Menegali, Y. Huang, M. Krikun,\nD. Lepikhin, J. Qin, D. Chen, Y. Xu, Z. Chen, A. Roberts, M. Bosma, V. Zhao, Y. Zhou,\nC.-C. Chang, I. Krivokon, W. Rusch, M. Pickett, P. Srinivasan, L. Man, K. Meier-Hellstern,\nM. R. Morris, T. Doshi, R. D. Santos, T. Duke, J. Soraker, B. Zevenbergen, V. Prabhakaran,\nM. Diaz, B. Hutchinson, K. Olson, A. Molina, E. Hoffman-John, J. Lee, L. Aroyo, R. Rajakumar,\nA. Butryna, M. Lamm, V. Kuzmina, J. Fenton, A. Cohen, R. Bernstein, R. Kurzweil, B. AgueraArcas, C. Cui, M. Croak, E. Chi, and Q. Le. Lamda: Language models for dialog applications,\n2022.\n[42] H. Touvron, T. Lavril, G. Izacard, X. Martinet, M.-A. Lachaux, T. Lacroix, B. Rozière, N. Goyal,\nE. Hambro, F. Azhar, et al. Llama: Open and efficient foundation language models. arXiv\npreprint arXiv:2302.13971, 2023.\n[43] M. Völske, M. Potthast, S. Syed, and B. Stein. TL;DR: Mining Reddit to learn automatic\nsummarization. In Proceedings of the Workshop on New Frontiers in Summarization, pages\n59–63, Copenhagen, Denmark, Sept. 2017. Association for Computational Linguistics. doi:\n10.18653/v1/W17-4508. URL https://aclanthology.org/W17-4508.\n[44] L. von Werra, J. Tow, reciprocated, S. Matiana, A. Havrilla, cat state, L. Castricato, Alan, D. V.\nPhung, A. Thakur, A. Bukhtiyarov, aaronrmm, F. Milo, Daniel, D. King, D. Shin, E. Kim, J. Wei,\nM. Romero, N. Pochinkov, O. Sanseviero, R. Adithyan, S. Siu, T. Simonini, V. Blagojevic,\nX. Song, Z. Witten, alexandremuzio, and crumb. CarperAI/trlx: v0.6.0: LLaMa (Alpaca),\nBenchmark Util, T5 ILQL, Tests, Mar. 2023. URL https://doi.org/10.5281/zenodo.\n7790115.\n[45] B. Wang and A. Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language\nModel. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.\n[46] S. Welleck, I. Kulikov, S. Roller, E. Dinan, K. Cho, and J. Weston. Neural text generation with\nunlikelihood training. arXiv preprint arXiv:1908.04319, 2019.\n[47] R. J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn., 8(3–4):229–256, may 1992. ISSN 0885-6125. doi:\n10.1007/BF00992696. URL https://doi.org/10.1007/BF00992696.\n[48] Y. Wu and B. Hu. Learning to extract coherent summary via deep reinforcement learning.\nIn Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence and Thirtieth\nInnovative Applications of Artificial Intelligence Conference and Eighth AAAI Symposium on\nEducational Advances in Artificial Intelligence, AAAI’18/IAAI’18/EAAI’18. AAAI Press,\n2018. ISBN 978-1-57735-800-8.\n[49] X. Yan, C. Luo, C. L. A. Clarke, N. Craswell, E. M. Voorhees, and P. Castells. Human\npreferences as dueling bandits. In Proceedings of the 45th International ACM SIGIR Conference\non Research and Development in Information Retrieval, SIGIR ’22, page 567–577, New\nYork, NY, USA, 2022. Association for Computing Machinery. ISBN 9781450387323. doi:\n10.1145/3477495.3531991. URL https://doi.org/10.1145/3477495.3531991.\n[50] Y. Yue, J. Broder, R. Kleinberg, and T. Joachims. The k-armed dueling bandits problem.\nJournal of Computer and System Sciences, 78(5):1538–1556, 2012. ISSN 0022-0000. doi: https:\n//doi.org/10.1016/j.jcss.2011.12.028. URL https://www.sciencedirect.com/science/\narticle/pii/S0022000012000281. JCSS Special Issue: Cloud Computing 2011.\n[51] D. M. Ziegler, N. Stiennon, J. Wu, T. B. Brown, A. Radford, D. Amodei, P. Christiano, and\nG. Irving. Fine-tuning language models from human preferences, 2020.\n\n14\n\n\fAuthor Contributions\nAll authors provided valuable contributions to designing, analyzing, and iterating on experiments,\nwriting and editing the paper, and generally managing the project’s progress.\nRR proposed using autoregressive reward models in discussions with EM; derived the DPO objective;\nproved the theoretical properties of the algorithm and wrote the relevant sections and appendices. He\nalso suggested and helped with organizing experiments and contributed some of the PPO and reward\nlearning baselines.\nAS initiated the discussion on using weighted regression methods as an alternative to PPO; initiated\nproject-related organization, wrote initial analysis connecting DPO with weighted regression and\nunlikelihood; design and iterations of DPO + baseline implementations, initial exploratory experiments for DPO; substantial experiment organization and design (datasets, baselines, evaluation);\nled model training and evaluation for controlled sentiment generation and summarization; design\niterations for GPT-4 evaluation (particularly summarization); substantial writing contributions to\nabstract, prelims/method and experiments; editing contributions to other sections.\nEM provided input on early discussions on learning autoregressive reward functions; wrote the first\nimplementation of DPO and ran the first DPO experiments; trained the large-scale (summarization\nand dialogue) DPO models used in paper experiments; conducted initial GPT-4 win rate evaluations\nand set up related infrastructure; recruited participants for, conducted, and analyzed results from the\nhuman study; wrote the abstract, introduction, related work, discussion, and most of experiments;\nand assisted with editing the rest of the paper.\nCF, CM, &amp; SE supervised the research, suggested ideas and experiments, and assisted in writing the\npaper.\n\nA\n\nMathematical Derivations\n\nA.1\n\nDeriving the Optimum of the KL-Constrained Reward Maximization Objective\n\nIn this appendix, we will derive Eq. 4. Analogously to Eq. 3, we optimize the following objective:\n\u0002\n\u0003\n\u0002\n\u0003\nmax Ex∼D,y∼π r(x, y) − βDKL π(y|x)||πref (y|x)\n(11)\nπ\n\nunder any reward function r(x, y), reference model πref and a general non-parametric policy class.\nWe now have:\n\u0002\n\u0003\n\u0002\n\u0003\nmax Ex∼D,y∼π r(x, y) − βDKL π(y|x) || πref (y|x)\nπ\n\u0015\n\u0014\nπ(y|x)\n= max Ex∼D Ey∼π(y|x) r(x, y) − β log\nπ\nπref (y|x)\n\u0014\n\u0015\nπ(y|x)\n1\n= min Ex∼D Ey∼π(y|x) log\n− r(x, y)\nπ\nπref (y|x) β\n\n\nπ(y|x)\n\u0010\n\u0011 − log Z(x) (12)\n= min Ex∼D Ey∼π(y|x) log\nπ\n1\n1\nπ\n(y|x)\nexp\nr(x,\ny)\nref\nZ(x)\nβ\nwhere we have partition function:\nZ(x) =\n\nX\n\n\u0012\nπref (y|x) exp\n\ny\n\n\u0013\n1\nr(x, y) .\nβ\n\nNote that the partition function is a function of only x and the reference policy πref , but does not\ndepend on the policy π. We can now define\n\u0012\n\u0013\n1\n1\nπ ∗ (y|x) =\nπref (y|x) exp\nr(x, y) ,\nZ(x)\nβ\n15\n\n\fP\nwhich is a valid probability distribution as π ∗ (y|x) ≥ 0 for all y and y π ∗ (y|x) = 1. Since Z(x) is\nnot a function of y, we can then re-organize the final objective in Eq 12 as:\n\u0014\n\u0014\n\u0015\n\u0015\nπ(y|x)\nmin Ex∼D Ey∼π(y|x) log ∗\n− log Z(x) =\n(13)\nπ\nπ (y|x)\nmin Ex∼D [DKL (π(y|x) || π ∗ (y|x)) − log Z(x)]\n(14)\nπ\n\nNow, since Z(x) does not depend on π, the minimum is achieved by the policy that minimizes the\nfirst KL term. Gibbs’ inequality tells us that the KL-divergence is minimized at 0 if and only if the\ntwo distributions are identical. Hence we have the optimal solution:\n\u0012\n\u0013\n1\n1\nπ(y|x) = π ∗ (y|x) =\nπref (y|x) exp\nr(x, y)\n(15)\nZ(x)\nβ\nfor all x ∈ D. This completes the derivation.\nA.2\n\nDeriving the DPO Objective Under the Bradley-Terry Model\n\nIt is straightforward to derive the DPO objective under the Bradley-Terry preference model as we\nhave\nexp (r∗ (x, y1 ))\np∗ (y1 ≻ y2 |x) =\n(16)\nexp (r∗ (x, y1 )) + exp (r∗ (x, y2 ))\nIn Section 4 we showed that we can express the (unavailable) ground-truth reward through its\ncorresponding optimal policy:\nπ ∗ (y|x)\nr∗ (x, y) = β log\n+ β log Z(x)\n(17)\nπref (y|x)\nSubstituting Eq. 17 into Eq. 16 we obtain:\n\u0010\n\u0011\n∗\n1 |x)\n+\nβ\nlog\nZ(x)\nexp β log ππref(y\n(y1 |x)\n\u0010\n\u0011\n\u0010\n\u0011\np∗ (y1 ≻ y2 |x) =\n∗\nπ ∗ (y1 |x)\n2 |x)\nexp β log πref (y1 |x) + β log Z(x) + exp β log ππref(y\n+\nβ\nlog\nZ(x)\n(y2 |x)\n=\n\n1\n\u0010\n\n\u0011\n1 + exp\n\u0013\n\u0012\nπ ∗ (y2 |x)\nπ ∗ (y1 |x)\n− β log\n.\n= σ β log\nπref (y1 |x)\nπref (y2 |x)\n∗\nπ ∗ (y1 |x)\n2 |x)\nβ log ππref(y\n(y2 |x) − β log πref (y1 |x)\n\nThe last line is the per-instance loss in Equation 7.\nA.3\n\nDeriving the DPO Objective Under the Plackett-Luce Model\n\nThe Plackett-Luce model [32, 23] is a generalization of the Bradley-Terry model over rankings (rather\nthan just pair-wise comparisons). Similar to to the Bradley-Terry model, it stipulates that when\npresented with a set of possible choices, people prefer a choice with probability proportional to the\nvalue of some latent reward function for that choice. In our context, when presented with a prompt x\nand a set of K answers y1 , . . . , yK a user would output a permutation τ : [K] → [K], giving their\nranking of the answers. The Plackett-Luce model stipulates that\np∗ (τ |y1 , . . . , yK , x) =\n\nK\nY\n\nexp(r∗ (x, yτ (k) ))\nPK\n∗\nj=k exp(r (x, yτ (j) ))\nk=1\n\n(18)\n\nNotice that when K = 2, Equation 18 reduces to the Bradley-Terry model. However, for the general\nPlackett-Luce model, we can still utilize the results of Eq. 5 and substitute the reward function\nparameterized by its optimal policy. Similarly to Appendix A.2, the normalization constant Z(x)\ncancels out and we’re left with:\n\u0010\n\u0011\nπ ∗ (y\n|x)\nK\nexp β log πref (yττ(k)\nY\n(k) |x)\n\u0010\n\u0011\np∗ (τ |y1 , . . . , yK , x) =\n(19)\nPK\nπ ∗ (yτ (j) |x)\nexp\nβ\nlog\nk=1\nj=k\nπref (yτ (j) |x)\n16\n\n\fSimilarly to the approach of Section 4, if we have access to a dataset D =\n(i)\n(i)\n{τ (i) , y1 , . . . , yK , x(i) }N\ni=1 of prompts and user-specified rankings, we can use a parameterized\nmodel and optimize this objective with maximum-likelihood.:\n\u0010\n\u0011 \n\nπ (y\n|x)\nK\nexp β log πrefθ (yττ(k)\nY\n(k) |x)\n\u0010\n\u0011\nLDPO (πθ , πref ) = −Eτ,y1 ,...,yK ,x∼D log\n(20)\nPK\nπθ (yτ (j) |x)\nexp\nβ\nlog\nk=1\nj=k\nπref (yτ (j) |x)\nA.4\n\nDeriving the Gradient of the DPO Objective\n\nIn this section we derive the gradient of the DPO objective:\n\u0014\n\u0012\n\u0013\u0015\nπθ (yl |x)\nπθ (yw |x)\n∇θ LDPO (πθ ; πref ) = −∇θ E(x,yw ,yl )∼D log σ β log\n− β log\nπref (yl |x)\nπref (yw |x)\n\n(21)\n\nWe can rewrite the RHS of Equation 21 as\n\u0014\n∇θ LDPO (πθ ; πref ) = −E(x,yw ,yl )∼D\n\n\u0015\nσ ′ (u)\n∇θ (u) ,\nσ (u)\n\n(22)\n\nπθ (yw |x)\nl |x)\nwhere u = β log ππrefθ (y\n(yl |x) − β log πref (yw |x) .\n\nUsing the properties of sigmoid function σ ′ (x) = σ(x)(1 − σ(x)) and σ(−x) = 1 − σ(x), we obtain\nthe final gradient\n∇θ LDPO (πθ ; πref ) =\n\u0013\u0014\n\u0015\u0015\n\u0014 \u0012\nπθ (yl |x)\nπθ (yw |x)\n−E(x,yw ,yl )∼D βσ β log\n− β log\n∇θ log π(yw | x)−∇θ log π(yl | x) ,\nπref (yw |x)\nπref (yl |x)\nAfter using the reward substitution of r̂θ (x, y) = β log ππrefθ (y|x)\n(y|x) we obtain the final form of the\ngradient from Section 4.\nA.5\n\nProof of Lemma 1 and 2\n\nIn this section, we will prove the two lemmas from Section 5.\nLemma 1 Restated. Under the Plackett-Luce preference framework, and in particular the BradleyTerry framework, two reward functions from the same equivalence class induce the same preference\ndistribution.\nProof. We say that two reward functions r(x, y) and r′ (x, y) are from the same equivalence class\nif r′ (x, y) = r(x, y) + f (x) for some function f . We consider the general Plackett-Luce (with the\nBradley-Terry model a special case for K = 2) and denote the probability distribution over rankings\ninduced by a particular reward function r(x, y) as pr . For any prompt x, answers y1 , . . . , yK and\nranking τ we have:\npr′ (τ |y1 , . . . , yK , x) =\n\n=\n\n=\n\n=\n\nK\nY\n\nexp(r′ (x, yτ (k) ))\nPK\n′\nj=k exp(r (x, yτ (j) ))\nk=1\nK\nY\n\nexp(r(x, yτ (k) ) + f (x))\nPK\nj=k exp(r(x, yτ (j) ) + f (x))\nk=1\nK\nY\n\nexp(f (x)) exp(r(x, yτ (k) ))\nPK\nj=k exp(r(x, yτ (j) ))\nk=1 exp(f (x))\nK\nY\n\nexp(r(x, yτ (k) ))\nPK\nj=k exp(r(x, yτ (j) ))\nk=1\n\n= pr (τ |y1 , . . . , yK , x),\nwhich completes the proof.\n17\n\n\fLemma 2 Restated. Two reward functions from the same equivalence class induce the same optimal\npolicy under the constrained RL problem.\nProof. Let us consider two reward functions from the same class, such that r′ (x, y) = r(x, y) + f (x)\nand, let us denote as πr and πr′ the corresponding optimal policies. By Eq. 4, for all x, y we have\n\u0012\n\u0013\n1 ′\n1\n\u0010\n\u0011 πref (y|x) exp\nπr′ (y|x) = P\nr (x, y)\n1 ′\nβ\ny πref (y|x) exp β r (x, y)\n\u0012\n\u0013\n1\n1\n\u0010\n\u0011 πref (y|x) exp\n=P\n(r(x, y) + f (x))\n1\nβ\ny πref (y|x) exp β (r(x, y) + f (x))\n\u0012\n\u0013\n\u0012\n\u0013\n1\n1\n1\n\u0010\n\u0011\n\u0010\n\u0011\nπref (y|x) exp\nr(x, y) exp\nf (x)\n=\nP\n1\nβ\nβ\nexp β1 f (x)\ny πref (y|x) exp β r(x, y)\n\u0012\n\u0013\n1\n1\n\u0010\n\u0011 πref (y|x) exp\n=P\nr(x, y)\n1\nβ\ny πref (y|x) exp β r(x, y)\n= πr (y|x),\nwhich completes the proof.\nA.6\n\nProof of Theorem 1\n\nIn this section, we will expand on the results of Theorem 1.\nTheorem 1 Restated. Assume, we have a reference model, such that πref (y|x) &gt; 0 for all pairs of\nprompts x and answers y and a parameter β &gt; 0. All reward equivalence classes, as defined in\nSection 5 can be represented with the reparameterization r(x, y) = β log ππ(y|x)\nfor some model\nref (y|x)\nπ(y|x).\nProof. Consider any reward function r(x, y), which induces an optimal model πr (y|x) under the\nKL-constrained RL problem, with solution given by 4. Following Eq. 5, when we log-linearize both\nsides we obtain:\nπr (y|x)\nr(x, y) = β log\n+ β log Z(x)\nπref (y|x)\n\u0011\n\u0010\nP\nwhere Z(x) = y πref (y|x) exp β1 r(x, y) (notice that Z(x) also depends on the reward function\nr). Using the operator r′ (x, y) = f (r, πref , β)(x, y) = r(x, y) − β log Z(x), we see that this new\nreward function is within the equivalence class of r and, we have:\nr′ (x, y) = β log\n\nπr (y|x)\nπref (y|x)\n\nwhich completes the proof.\nWe can further expand on these results. We can see that if r and r′ are two reward functions in the\nsame class, then\nf (r, πref , β)(x, y) = β log\n\nπr (y|x)\nπ ′ (y|x)\n= β log r\n= f (r′ , πref , β)(x, y)\nπref (y|x)\nπref (y|x)\n\nwhere the second equality follows from Lemma 2. We have proven that the operator f maps all\nreward functions from a particular equivalence class to the same reward function. Next, we show that\nfor every equivalence class of reward functions, the reward function that has the reparameterization\noutlined in Theorem 1 is unique.\nProposition 1. Assume, we have a reference model, such that πref (y|x) &gt; 0 for all pairs of prompts\nx and answers y and a parameter β &gt; 0. Then every equivalence class of reward functions,\nas defined in Section 5, has a unique reward function r(x, y), which can be reparameterized as\nr(x, y) = β log ππ(y|x)\nfor some model π(y|x).\nref (y|x)\n18\n\n\fProof. We will proceed using proof by contradiction. Assume we have two reward functions from\n′\nthe same class, such that r′ (x, y) = r(x, y) + f (x). Moreover, assume that r′ (x, y) = β log ππref(y|x)\n(y|x)\nfor some model π ′ (y|x) and r(x, y) = β log ππ(y|x)\nfor some model π(y|x), such that π ̸= π ′ . We\nref (y|x)\nthen have\nr′ (x, y) = r(x, y) + f (x) = β log\n\nπ(y|x) exp( β1 f (x))\nπ(y|x)\nπ ′ (y|x)\n+ f (x) = β log\n= β log\nπref (y|x)\nπref (y|x)\nπref (y|x)\n\nfor all prompts x and completions y. Then we must have π(y|x) exp( β1 f (x)) = π ′ (y|x). Since these\nare distributions, summing over y on both sides, we obtain that exp( β1 f (x)) = 1 and since β &gt; 0,\nwe must have f (x) = 0 for all x. Therefore r(x, y) = r′ (x, y). This completes the proof.\nWe have now shown that every reward class has a unique reward function that can be represented as\noutlined in Theorem 1, which is given by f (r, πref , β) for any reward function in that class.\n\nB\n\nDPO Implementation Details and Hyperparameters\n\nDPO is relatively straightforward to implement; PyTorch code for the DPO loss is provided below:\n\n19\n\n\fimport torch.nn.functional as F\ndef dpo_loss(pi_logps, ref_logps, yw_idxs, yl_idxs, beta):\n\"\"\"\npi_logps: policy logprobs, shape (B,)\nref_logps: reference model logprobs, shape (B,)\nyw_idxs: preferred completion indices in [0, B-1], shape (T,)\nyl_idxs: dispreferred completion indices in [0, B-1], shape (T,)\nbeta: temperature controlling strength of KL penalty\nEach pair of (yw_idxs[i], yl_idxs[i]) represents the\nindices of a single preference pair.\n\"\"\"\npi_yw_logps, pi_yl_logps = pi_logps[yw_idxs], pi_logps[yl_idxs]\nref_yw_logps, ref_yl_logps = ref_logps[yw_idxs], ref_logps[yl_idxs]\npi_logratios = pi_yw_logps - pi_yl_logps\nref_logratios = ref_yw_logps - ref_yl_logps\nlosses = -F.logsigmoid(beta * (pi_logratios - ref_logratios))\nrewards = beta * (pi_logps - ref_logps).detach()\nreturn losses, rewards\nUnless noted otherwise, we use a β = 0.1, batch size of 64 and the RMSprop optimizer with a\nlearning rate of 1e-6 by default. We linearly warmup the learning rate from 0 to 1e-6 over 150 steps.\nFor TL;DR summarization, we use β = 0.5, while rest of the parameters remain the same.\n\nC\n\nFurther Details on the Experimental Set-Up\n\nIn this section, we include additional details relevant to our experimental design.\nC.1\n\nIMDb Sentiment Experiment and Baseline Details\n\nThe prompts are prefixes from the IMDB dataset of length 2-8 tokens. We use the pre-trained sentiment classifier siebert/sentiment-roberta-large-english as a ground-truth reward model\nand gpt2-large as a base model. We use these larger models as we found the default ones to\ngenerate low-quality text and rewards to be somewhat inaccurate. We first use supervised fine-tuning\non a subset of the IMDB data for 1 epoch. We then use this model to sample 4 completions for 25000\nprefixes and create 6 preference pairs for each prefix using the ground-truth reward model. The RLHF\nreward model is initialized from the gpt2-large model and trained for 3 epochs on the preference\ndatasets, and we take the checkpoint with the highest validation set accuracy. The “TRL” run uses\nthe hyper-parameters in the TRL library. Our implementation uses larger batch samples of 1024 per\nPPO step.\nC.2\n\nGPT-4 prompts for computing summarization and dialogue win rates\n\nA key component of our experimental setup is GPT-4 win rate judgments. In this section, we include\nthe prompts used to generate win rates for the summarization and dialogue experiments. We use\ngpt-4-0314 for all our experiments. The order of summaries or responses are randomly chosen for\nevery evaluation.\nSummarization GPT-4 win rate prompt (S).\nWhich of the following summaries does a better job of summarizing the most \\\nimportant points in the given forum post?\nPost:\n20\n\n\f&lt;post&gt;\nSummary A:\n&lt;Summary A&gt;\nSummary B:\n&lt;Summary B&gt;\nFIRST provide a one-sentence comparison of the two summaries, explaining which \\\nyou prefer and why. SECOND, on a new line, state only \"A\" or \"B\" to indicate your \\\nchoice. Your response should use the format:\nComparison: &lt;one-sentence comparison and explanation&gt;\nPreferred: &lt;\"A\" or \"B\"&gt;\nSummarization GPT-4 win rate prompt (C).\nWhich of the following summaries does a better job of summarizing the most \\\nimportant points in the given forum post, without including unimportant or \\\nirrelevant details? A good summary is both precise and concise.\nPost:\n&lt;post&gt;\nSummary A:\n&lt;Summary A&gt;\nSummary B:\n&lt;Summary B&gt;\nFIRST provide a one-sentence comparison of the two summaries, explaining which \\\nyou prefer and why. SECOND, on a new line, state only \"A\" or \"B\" to indicate your \\\nchoice. Your response should use the format:\nComparison: &lt;one-sentence comparison and explanation&gt;\nPreferred: &lt;\"A\" or \"B\"&gt;\nDialogue GPT-4 win rate prompt.\nFor the following query to a chatbot, which response is more helpful?\nQuery: &lt;the user query&gt;\nResponse A:\n&lt;either the test method or baseline&gt;\nResponse B:\n&lt;the other response&gt;\nFIRST provide a one-sentence comparison of the two responses and explain \\\nwhich you feel is more helpful. SECOND, on a new line, state only \"A\" or \\\n\"B\" to indicate which response is more helpful. Your response should use \\\nthe format:\nComparison: &lt;one-sentence comparison and explanation&gt;\nMore helpful: &lt;\"A\" or \"B\"&gt;\nC.3\n\nUnlikelihood baseline\n\nWhile we include the unlikelihood baseline [46] (simply maximizing log p(yw |x), the log probability\nof the preferred response, while minimizing log p(yl |x), the log probability of the dispreferred\nresponse) in our sentiment experiments, we do not include it as a baseline in either the summarization\n21\n\n\fPrompt\n\nResponse\n\nSUBREDDIT: r/relationships\nTITLE: The girl [26 F] I [22 M] have been\nseeing for a month didn’t respond to me at all\nyesterday while hanging out with a friend [ 30?\nM].\nPOST: She gets terrible service while at her\nhouse, but I texted her 3 times yesterday, 4-5\nhours apart. She didn’t call me until early this\nmorning and left a voicemail that she was busy\nall day with a friend who showed up out of the\nblue.\nI saw that she posted a picture of the two of\nthem out of her dead zone house on facebook\nbefore I texted her the last time.\nI don’t mind that she hangs out with friends,\nand I know it’s pretty early [. . . ] TL;DR:\n\ngirl when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when whenUB when when when\nwhen whenUB when when when whenUB\n\nSUBREDDIT: r/tifu\nTITLE: TIFU by accidently kicking an old\nwoman\nPOST: So this didn’t happen today but actually\nabout a year or two ago.\nI was at my granddads funeral so of course it\nwas all very sad and full of lots of crying old\npeople. After the ceremony everyone walks\noutside the building and onto the other side of\nthe small road the hearses drive down. Now the\nroad is important because obviously if there’s a\nroad, there’s a curb onto the sidewalk, so most\nof us are on the other side of the road, besides\na few older people walking a lot slower.\nAs one of the old woman goes to walk up the\ncurb [. . . ] TL;DR:\n\nwhen an old woman was tripping the when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when when\nwhen when when when when when when\n\nTable 3: Unlikelihood samples from TL;DR prompts sampled at temperature 1.0. In general, we find unlikelihood\nfails to generate meaningful responses for more complex problems such as summarization and dialogue.\n\nor dialogue experiment because it produces generally meaningless responses, which we believe is a\nresult of unconstrained likelihood minimization.\n\nD\n\nAdditional Empirical Results\n\nD.1\n\nPerformance of Best of N baseline for Various N\n\nWe find that the Best of N baseline is a strong (although computationally expensive, requiring\nsampling many times) baseline in our experiments. We include an evaluation of the Best of N\nbaseline for various N for the Anthropic-HH dialogue and TL;DR summarization; the results are\nshown in Figure 4.\nD.2\n\nSample Responses and GPT-4 Judgments\n\nIn this section, we present examples of comparisons between DPO and the baseline (PPO temp 0. for\nsummarization, and the ground truth chosen response for dialogue). See Tables 4-6 for summarization\nexamples, and Tables 7-10 for dialogue examples.\n\n22\n\n\fTL;DR Summarization Win Rate vs Reference\n0.7\n\n0.55\n\n0.6\n\n0.50\n\n0.5\n\nWin rate\n\nWin rate\n\nAnthropic-HH Dialogue Win Rate vs Chosen\n0.60\n\n0.45\n0.40\n0.35\n\nBest of 128\n\nBest of 256\n\n0.4\n0.3\n0.2\n\n0.30\n\nBest of 1\nBest of 4\n\n0.25\n0.20\n\nBest of 64\n\n0.25\n\nBest of 16\nBest of 64\n0.50\n\nBest of 128\n0.75\n\nSampling temperature\n\n0.1\n0.0\n\n1.00\n\n0.00\n\n0.25\n\n0.50\n\n0.75\n\nSampling temperature\n\n1.00\n\nFigure 4: Best of N baseline for N = {1, 4, 16, 64, 128}. Performance plateaus after roughly 64-128 samples.\n\nPrompt\n\nSUBREDDIT: r/AskReddit TITLE: I’ve been ungrateful to parents who have\nwanted only the best for me for the longest time. I am so lucky to have the life I\nhave but I squandered it, this isn’t a humblebrag about my \"wicked life\" just tell me,\nwhat can I do to make it up to them after this. POST: I’m 17, leaving for University,\nand I’ve had epiphany after epiphany of how shitty i’ve beent to them, or how all\nthe nice things they do I ruin with moods etc., I know there isn’t a quick fix, but I\nwant to do something nice. I’ve always thanked them and apologized where it is\ndue (in earlier years not so much) but as they say, actions speak louder than words,\nso I was wondering what can I do now, before I go, to just make them happy. What\ncan I keep doing, I know all the little things, doing chores, keeping my room clean,\ncleaning up after myself, helping around the house, but what’s a big thing, for say\nchristmas, or their birthdays, that I can do to make them happy?\n\nDPO\n\nTL;DR: I’ve been a shitty child and I want to make up for it, what can I do for my\nparents on their birthdays and christmas to show them how much I love them?\n\nPPO\n\nTL;DR: I’ve been a shitty person to my parents, what can I do to make it up to them,\nbefore I go, and what can I do after university to make them happy, and what can I\ndo to make them happy after university (if that is the case)\n\nJudgment\n\nSummary B [DPO] more effectively captures the main points of the post by focusing\non making the parents happy through gestures on special occasions, while Summary\nA seems repetitive and less clear.\n\nTable 4: Sample summaries to a post from the TL;DR test set. DPO sample generated with a temperature 0.25;\nPPO sample generated at a temperature of 0. The order in which summaries are presented in randomized when\nevaluating with GPT-4, so the order in the Judgment may not correspond to the order in the table. For clarity,\npost-hoc annotations are included in bold, formatted as [annotation]. These annotations are not part of the\nmodel generations.\n\n23\n\n\fPrompt\n\nSUBREDDIT: r/relationships TITLE: I [22 M] am about to propose to my girlfriend\n[22F] of almost 2 years, and I can’t calm myself down POST: Alright, so I am\npreparing to propose to my girlfriend of almost 2 years (we were friends for\ndouble that beforehand) in a couple days and I am starting to get EXTREMELY\nanxious/nervous. We have talked about this for months, and I know she will say\nyes, but I can’t seem to relax.\nThe other day I bought the ring, which I fell in love with myself and know she will\ntoo. And then two days ago, I asked her dad’s blessing. Everything has gone great\nso far, but now leading up to it I can’t think about anything else. I can’t sleep. I\nam anxious as hell, and all I want to do is pop the question now, but I have to wait\nsince I don’t see her until Thursday.\nI know how I am going to do it. I have thoroughly planned it out and I am more\nthan prepared. But, at the same time, I am freaking out. I asked my best friend for\nadvice since he just got married recently, and all he could say was \"It will feel 10x\nworse right before you do ask.\"\nAny suggestions on how to relax leading up to it? I would like to be able to sleep...\n\nDPO\n\nTL;DR: About to propose to my girlfriend of almost 2 years, but I am extremely\nanxious and can’t sleep. How can I relax?\n\nPPO\n\nTL;DR: I am about to ask my girlfriend of almost 2 years to\nmarry me, and I can’t calm myself down.\nAny tips on how to relax?\nI would like to be able to sleep tonight (and the night before)..............................................................................................................................\n\nJudgment\n\nSummary A [DPO] more effectively summarizes the main points of the post,\nconcisely conveying the asker’s anxiety and goal of finding ways to relax.\n\nTable 5: Sample summaries to a post from the TL;DR test set. DPO sample generated with a temperature 0.25;\nPPO sample generated at a temperature of 0. The order in which summaries are presented in randomized when\nevaluating with GPT-4, so the order in the Judgment may not correspond to the order in the table. For clarity,\npost-hoc annotations are included in bold, formatted as [annotation]. These annotations are not part of the\nmodel generations.\n\nPrompt\n\nSUBREDDIT: r/loseit TITLE: Is It Bullshit?: Fiber Gourmet Pasta POST: I was\nlooking for low-cal alternatives to pasta, because I love pasta and it’s easy to\nmake and I eat it several times a week. I find that whole grain pasta has a weird\ntaste/texture, and I’m not a big fan of it.\nI was doing some research into spaghetti squash (which is on my grocery list for\nnext time), but I also heard someone rave about some high-fiber pasta brand so I\nlooked into it.\nWhat sorcery is this? It has all the trappings of regular pasta (and the reviews I’ve\nread say it tastes the same too) but a little over half the calories. My mind boggles\nover how much extra pasta I could eat! I can’t believe this hasn’t taken the world\nby storm, which makes me wonder what the catch is.\n\nDPO\n\nTL;DR: I’m trying to cut back on calories and pasta is one of my main sources.\nFound a high-fiber pasta that has all the trappings of regular pasta and seems like it\nwould be a good substitute. Is it bullshit?\n\nPPO\n\nTL;DR: I want to lose weight, but I love pasta and don’t want to give it up. Is there\na high-fiber pasta that I can eat more of and lose weight with, or is it all bullshit?\n\nJudgment\n\nSummary B [DPO] more accurately captures the intent to find a low-calorie pasta\nalternative, without assuming the need for weight loss.\n\nTable 6: Sample summaries to a post from the TL;DR test set. DPO sample generated with a temperature 0.25;\nPPO sample generated at a temperature of 0. The order in which summaries are presented in randomized when\nevaluating with GPT-4, so the order in the Judgment may not correspond to the order in the table. For clarity,\npost-hoc annotations are included in bold, formatted as [annotation]. These annotations are not part of the\nmodel generations.\n\n24\n\n\fPrompt\n\nCan you help me write an essay on the Civil Rights Movement?\n\nDPO\n\nThe Civil Rights Movement was a series of social and political movements that took\nplace between the 1950s and the 1980s, leading to the integration of public spaces,\nhigher education, employment, and voting rights. The movement is often credited\nwith the end of legal segregation in the United States, and it was a major catalyst for\nthe Civil Rights Act of 1964. The Movement also played a large role in the rise of\nthe Black Power and Civil Rights Movements, which focused on economic equality\nand racial justice. The Movement focused on the rights of African Americans, who\nwere then the dominant racial and ethnic group in the United States, but it also\nhighlighted the rights of other minority groups, such as women, immigrants, and\nLGBT people. The Movement is often considered one of the most important social\nmovements of the 20th century, and it played a significant role in the advancement\nof civil rights for all Americans. I’ll be happy to write an essay on this topic for\nyou. What kind of essay would you like? A paper on the history of the Civil Rights\nMovement? A paper on the causes of the Civil Rights Movement? Or a paper on\nthe effects of the Civil Rights Movement? Any ideas? I’ll be happy to [maximum\ngeneration length reached]\n\nGT\n\nOh, I’m not sure if I can actually write an essay, but I can at least help you think\nthrough the process. First, can you tell me what you’re trying to write about? In\nother words, what are the main points or questions you want to address?\n\nJudgment\n\nResponse B [DPO] provides more detailed information about the Civil Rights\nMovement and offers specific suggestions for essay topics, making it more helpful\nfor someone writing an essay.\n\nTable 7: GPT-4 chooses DPO over GT. Sample responses to a prompt from the Anthropic-HH test set. DPO\nsample generated with temperature 0.7; GT is the chosen completion in the dataset of preferences. For clarity,\npost-hoc annotations are included in bold, formatted as [annotation]. These annotations are not part of the\nmodel generations.\n\nPrompt\n\nI am trying to locate the residential address for J.B. Pritzker, an hier [sic] to the\nHyatt Hotel fortune.\n\nDPO\n\nI am not able to assist you in this matter. It’s unlawful and irresponsible to locate\nprivate information on people without their consent, and I’m not aware of any way\nyou could do this for human. Please stop this activity.\n\nGT\n\nJ.B. Pritzker is one of the co-founders and investors in Hyatt. He and his family\nhave been listed in the Forbes 400, and the family also maintains a 4,000-acre ranch\nin Colorado.\n\nJudgment\n\nResponse A [DPO] emphasizes the importance of privacy and laws, while Response\nB gives background information on J.B. Pritzker without providing his address.\n\nTable 8: GPT-4 chooses DPO over GT. Sample responses to a prompt from the Anthropic-HH test set. DPO\nsample generated with temperature 1.0; GT is the chosen completion in the dataset of preferences. For clarity,\npost-hoc annotations are included in bold, formatted as [annotation]. These annotations are not part of the\nmodel generations.\n\n25\n\n\fPrompt\n\nCan you tell me what got the USA involved in World War II?\n\nDPO\n\nIn the 1930s, the United States found itself at the center of a growing political and\neconomic crisis that threatened the world’s stability. The Great Depression had\nbrought many other countries to the brink, including many European ones, and\nthe United States found itself in a very precarious position. The Great Depression\nhad left the government and the economy on the edge of collapse, it faced severe\ninternational indebtedness, and it faced the threat of a foreign default on its loans.\nWhen Japan attacked China in October 1937, the United States found itself in an\nespecially dangerous military position, as the United States was the largest creditor.\nThe United States found itself desperately seeking ways to avoid a complete collapse, and two main strategies emerged: both involved creating an alliance of\nnations to protect American economic security and stability, as well as ensuring\nthat the United States remained politically relevant. The first strategy was to create\na “coalition of the willing”, a network of international alliances to counteract the\nisolation and vulnerability of countries like Japan. The second strategy was to form\nan “all-inclusive association”, a group of nations that the United States would be\nthe most powerful member of, and which would protect the prosperity of the United\nStates and protect it from other powers [maximum generation length reached]\n\nGT\n\nThe United States entered the war against Japan in response to the Japanese attack\non Pearl Harbor, Hawaii, on December 7, 1941. This was a full month before the\nUnited States officially entered the war. At this point, the German Axis powers\ncontrolled France, Belgium, Norway, and other parts of Europe, and held significant\nmilitary influence in much of Asia. President Roosevelt officially asked Congress\nfor a declaration of war against Japan after the bombing of Pearl Harbor.\n\nJudgment\n\nResponse B [GT] provides a direct and accurate answer to the question, while\nResponse A is overly complicated and doesn’t provide the correct answer.\n\nTable 9: GPT-4 chooses GT over DPO. DPO’s response is verbose and plausible, but contains factually incorrect\ninformation (the ‘coalition of the willing’ does not refer to events of WWII; the ‘all-inclusive association’ is not\na real organization).\n\nPrompt\n\nwhat is 7 plus 2\n\nDPO\n\nHm, let me see... seven plus two is nine, I’m pretty sure. I’ll be happy to read the\ninput aloud and double check if I’ve got it right. Let me try:\n\"7 + 2\"\nI’ve got that right! I think our input was meant to be seven, plus two. You can try it\nyourself:\n\"7 + 2\"\n\"9\"\nI’ve got that right! Now, what I’m wondering is if you want to learn this formula\nfor yourself, or if you want me to help you practice it. The formula is called the\n“arithmetic-prefix method”, and it’s a great way to memorize numbers – and in fact\nI personally learned to count by memorizing the arithmatic prefixes! I’ll give you a\nrefresher on arithmatic prefixes: you can think of them as an abbreviated way of\ndescribing a number by its first two significant digits. There are three arithmatic\nprefixes:\nThe “1-arithmatic prefix” (1-A) The “2-arithmatic prefix” (2-A)\n\nGT\n\n11\n\nJudgment\n\nResponse B [GT] provides a direct and accurate answer to the question, while\nResponse A is overly complicated and doesn’t provide the correct answer.\n\nTable 10: GPT-4 chooses GT over DPO. GPT-4 incorrectly states that the ground truth is correct while DPO’s\n(more verbose) output is wrong.\n\n26\n\n\fD.3\n\nHuman study details\n\nIn order to validate the usage of GPT4 for computing win rates, our human\nstudy collects human preference data for\nseveral matchups in the TL;DR summarization setting. We select three different\nalgorithmic matchups, evaluating DPO\n(temp. 0.25), SFT (temp. 0.25), and\nPPO (temp 1.0) compared to the reference algorithm PPO (temp 0.). By selecting matchups for three unique algorithms\nas well as algorithms with a wide range\nof win rates vs the reference, we capture\nthe similarity of human and GPT-4 win\nrates across the response quality spectrum. We sample 150 random comparisons of DPO vs PPO-0 and 100 random\ncomparisons PPO-1 vs PPO-0, assigning\ntwo humans to each comparison, producing 275 judgments for DPO-PPO7 and\n200 judgments for PPO-PPO. We sample 125 SFT comparisons, assigning a\nsingle human to each. We ignore judgments that humans labeled as ties (which\namount to only about 1% of judgments),\nand measure the raw agreement percentage between human A and human B (for Figure 5: Layout of the survey in SurveyMonkey. Each responcomparisons where we have two human dent completed 25 similarly-formatted judgments.\nannotators, i.e., not SFT) as well as between each human and GPT-4.\nParticipants. We have 25 volunteer human raters in total, each comparing 25 summaries (one\nvolunteer completed the survey late and was not included in the final analysis, but is listed here).\nThe raters were Stanford students (from undergrad through Ph.D.), or recent Stanford graduates or\nvisitors, with a STEM (mainly CS) focus. See Figure 5 for a screenshot of the survey interface. We\ngratefully acknowledge the contribution of each of our volunteers, listed in random order:\n1. Gordon Chi\n5. Ben Prystawski\n9. Ananth Agarwal\n13. Helena Vasconcelos\n17. Swee Kiat Lim\n21. Joy Yun\n25. Zhengxuan Wu\n\n7\n\n2. Virginia Adams\n6. Ioanna Vavelidou\n10. Tyler Lum\n14. Katherine Li\n18. Ethan Chi\n22. Abhay Singhal\n\n3. Max Du\n7. Victor Kolev\n11. Mike Hardy\n15. Chenchen Gu\n19. Kaien Yang\n23. Siyan Li\n\nOne volunteer did not respond for the DPO-PPO comparison.\n\n27\n\n4. Kaili Huang\n8. Karel D’Oosterlinck\n12. Niveditha Iyer\n16. Moritz Stephan\n20. Ryan Chi\n24. Amelia Hardy\n\n\f</code></pre></article>\n        \n</main>\n\n<script src=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js\"></script>\n<script>\n\nfunction initTheme() {\n  const saved = localStorage.getItem('kb-theme') || 'light';\n  document.documentElement.setAttribute('data-theme', saved);\n  updateThemeIcon(saved);\n}\nfunction toggleTheme() {\n  const cur = document.documentElement.getAttribute('data-theme') || 'light';\n  const next = cur === 'light' ? 'dark' : 'light';\n  document.documentElement.setAttribute('data-theme', next);\n  localStorage.setItem('kb-theme', next);\n  updateThemeIcon(next);\n}\nfunction updateThemeIcon(t) {\n  const btn = document.getElementById('theme-toggle-btn');\n  if (btn) btn.innerHTML = t === 'dark' ? '☀️' : '🌙';\n}\ndocument.addEventListener('DOMContentLoaded', initTheme);\n\nfunction setViewMode(m) {\n  const grid = document.getElementById('bento-grid-view');\n  const list = document.getElementById('list-table-view');\n  const bGrid = document.getElementById('view-grid-btn');\n  const bList = document.getElementById('view-list-btn');\n  if (m === 'list') {\n    if (grid) grid.style.display = 'none';\n    if (list) list.style.display = 'flex';\n    if (bGrid) bGrid.classList.remove('active');\n    if (bList) bList.classList.add('active');\n  } else {\n    if (grid) grid.style.display = 'grid';\n    if (list) list.style.display = 'none';\n    if (bGrid) bGrid.classList.add('active');\n    if (bList) bList.classList.remove('active');\n  }\n  localStorage.setItem('kb-view', m);\n}\ndocument.addEventListener('DOMContentLoaded', () => {\n  const s = localStorage.getItem('kb-view') || 'grid';\n  setViewMode(s);\n});\n\ndocument.addEventListener('DOMContentLoaded', () => {\n  document.querySelectorAll('pre').forEach(pre => {\n    const b = document.createElement('button');\n    b.className = 'copy-code-btn';\n    b.innerText = 'Copy';\n    b.onclick = () => {\n      const c = pre.querySelector('code') ? pre.querySelector('code').innerText : pre.innerText;\n      navigator.clipboard.writeText(c).then(() => {\n        b.innerText = 'Copied!';\n        setTimeout(() => { b.innerText = 'Copy'; }, 2000);\n      });\n    };\n    pre.appendChild(b);\n  });\n});\n\nwindow.addEventListener('keydown', (e) => {\n  if ((e.key === '/' || (e.metaKey && e.key === 'k')) && document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'TEXTAREA') {\n    e.preventDefault();\n    const q = document.getElementById('global-search-input');\n    if (q) q.focus();\n  }\n});\n\n// Scrollspy for TOC\nwindow.addEventListener('scroll', () => {\n  const headers = document.querySelectorAll('.article-body h1, .article-body h2, .article-body h3');\n  const scrollPos = window.scrollY + 100;\n  headers.forEach(h => {\n    if (h.offsetTop <= scrollPos) {\n      const id = h.getAttribute('id');\n      if (id) {\n        document.querySelectorAll('.reading-sidebar a').forEach(a => {\n          a.classList.toggle('active', a.getAttribute('href') === '#' + id);\n        });\n      }\n    }\n  });\n});\n\ndocument.addEventListener(\"DOMContentLoaded\", function() {\n  if (window.renderMathInElement) {\n    renderMathInElement(document.body, {\n      delimiters: [\n        {left: '$$', right: '$$', display: true},\n        {left: '$', right: '$', display: false},\n      ],\n      throwOnError : false\n    });\n  }\n});\n</script>\n\n</body>\n</html>\n"