"<!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>Scaling Laws for Reward Model Overoptimization\n\narXiv:2210.10760v1 [cs.LG] 19 Oct 2022\n\nLeo Gao\nOpenAI\n\nJohn Schulman\nOpenAI\n\nJacob Hilton\nOpenAI\n\nAbstract\nIn reinforcement learning from human feedback, it is common to optimize against\na reward model trained to predict human preferences. Because the reward model\nis an imperfect proxy, optimizing its value too much can hinder ground truth\nperformance, in accordance with Goodhart’s law. This effect has been frequently\nobserved, but not carefully measured due to the expense of collecting human\npreference data. In this work, we use a synthetic setup in which a fixed “goldstandard” reward model plays the role of humans, providing labels used to train a\nproxy reward model. We study how the gold reward model score changes as we\noptimize against the proxy reward model using either reinforcement learning or\nbest-of-n sampling. We find that this relationship follows a different functional\nform depending on the method of optimization, and that in both cases its coefficients\nscale smoothly with the number of reward model parameters. We also study the\neffect on this relationship of the size of the reward model dataset, the number of\nreward model and policy parameters, and the coefficient of the KL penalty added\nto the reward in the reinforcement learning setup. We explore the implications of\nthese empirical results for theoretical considerations in AI alignment.\n\n1\n\nIntroduction\n\nGoodhart’s law is an adage that states, “When a measure becomes a target, it ceases to be a good\nmeasure.” In machine learning, this effect arises with proxy objectives provided by static learned\nmodels, such as discriminators and reward models. Optimizing too much against such a model\neventually hinders the true objective, a phenomenon we refer to as overoptimization. It is important to\nunderstand the size of this effect and how it scales, in order to predict how much a learned model can\nbe safely optimized against. Moreover, studying this effect empirically could aid in the development\nof theoretical models of Goodhart’s law for neural networks, which could be critical for avoiding\ndangerous misalignment of future AI systems.\nIn this work, we study overoptimization in the context of large language models fine-tuned as\nreward models trained to predict which of two options a human will prefer. Such reward models\nhave been used to train language models to perform a variety of complex tasks that are hard to\njudge automatically, including summarization [Stiennon et al., 2020], question-answering [Nakano\net al., 2021, Menick et al., 2022], and general assistance [Ouyang et al., 2022, Bai et al., 2022,\nGlaese et al., 2022]. Typically, the reward model score is optimized using either policy gradientbased reinforcement learning or best-of-n sampling, also known as rejection sampling or reranking.\nOveroptimization can occur with both methods, and we study both to better understand whether and\nhow overoptimization behaves differently across both methods.\nA major challenge in studying overoptimization in this context is the expense of collecting human\npreference labels. A large number of labels are required to accurately estimate overall preference\nprobabilities, and this is exacerbated by small effect sizes and the need to take many measurements in\norder to fit scaling laws. To overcome this, we use a synthetic setup that is described in Section 2, in\nwhich labels are supplied by a “gold-standard” reward model (RM) instead of humans.\nPreprint. Under review.\n\n\fOur main results are empirically validated functional forms for the gold reward model scores R\nas a function of the Kullback–Leibler divergence from the initial policy to the optimized policy\nKL := DKL (π k πinit ), which depends on the method of optimization used. This KL distance\nbetween the initial and optimized policies increases monotonically during during RL training (fig. 14),\nand can be computed analytically as a function of n for BoN. Further,\np because it is a quadratic\nmetric of distance [Bai et al., 2022, Section 4.3], we will define d := DKL (π k πinit ), and write\nour functional forms in terms of d.\nWe find empirically that for best-of-n (BoN) sampling,\nRbon (d) = d (αbon − βbon d) ,\nand for reinforcement learning,1\nRRL (d) = d (αRL − βRL log d) ,\nHere, R(0) := 0 by definition and αRL , βRL , αbon and βbon are parameters that may depend on the\nnumber of proxy reward model parameters, the size of the proxy reward model dataset, and so on.\nWe see that these scaling laws make accurate predictions.\nWe also find the following.\n• RL versus best-of-n. As a function of the KL divergence, reinforcement learning tends to\nbe slower than best-of-n sampling at both optimization and overoptimization. This suggests\ninadequacies with using KL to compare amount of (over)optimization across methods.\nHowever, the relationship between the proxy reward model score and the gold reward model\nscore is similar for both methods.\n• Smooth coefficient scaling. The α and β coefficients in the BoN and RL functional forms\nvary smoothly with the number of proxy reward model parameters, following approximate\nlogarithmic trends.2 This allows prediction of attained gold RM score.\n• Weak dependence on policy size. While larger policies perform better overall and benefit\nless from optimization against an RM as measured by increase in gold reward, they lead to\nvery similar amounts of overoptimization, as measured through the gap between the proxy\nand gold scores (which indicates the shortfall between predicted and actual reward), and KL\ndistance at which the maximum gold RM score is attained.\n• KL penalty ineffectiveness. In our reinforcement learning setup, using a KL penalty\nincreases the proxy reward model score that can be achieved for a given KL divergence, but\nthis does not correspond to a measurable improvement in the gold RM score–KLRL frontier.\nHowever, we note this result could be particularly sensitive to hyperparameters.\nFinally, we discuss the implications of these findings for Reinforcement Learning From Human\nFeedback (RLHF), existing models of Goodhart’s law, and AI Alignment more broadly.\n\n2\n\nMethodology\n\nThe setting used throughout this paper is the same as for InstructGPT [Ouyang et al., 2022]. In\nour environment, the observations are text prompts and the policy is used to generate a response to\nthe prompt. The prompts are drawn from a broad range of natural language instructions describing\ndifferent language model tasks. Then, a learned RM is used to provide the reward signal for the\nresponse, which is used by either RL or BoN for optimization.\nFor all experiments, we use pretrained GPT-3 series language models as the initial checkpoint [Brown\net al., 2020]. All initial policies are trained with supervised fine-tuning (SFT) on human-generated\nInstructGPT demonstrations [Ouyang et al., 2022] for 2 epochs. All RMs also use the GPT-3\narchitecture but have an added scalar head to output the reward.\n1\n\nWe note that this form likely does not hold near the origin, as it has infinite slope there. We experimented\nwith a number of different forms, but found worse fits and extrapolation. See appendix B for more details.\n2\nThe coefficient αRL in particular being nearly independent of RM parameter count.\n\n2\n\n\f(a) BoN\n\n(b) RL\n\nFigure 1: Reward model (RM) parameter size scaling experiments using the InstructGPT environment.\nPolicy size is held constant (1.2B), while reward model size is varied. The x-axes have a square-root\nscale. Note that the plots have different x-axes. The gold reward represents the ground truth reward;\nwe observe that when we optimize for a learned proxy of the gold reward, the gold reward initially\nincreases and later decreases. We show that our functional forms fit this effect well.\n\n3\n\n\fFigure 2: Diagram of the real and synthetic RM training setups. Human labellers generate comparison\ndata. In the real RLHF setting, this data is used to train a proxy RM that is optimized by RL/BoN. In\nour synthetic setting, we instead use a “Gold RM” as our ground truth. In both settings, the proxy\nRM is a proxy for the ground truth process generating the labels (either the human or gold RM).\n\nThe RL experiments use Proximal Policy Optimization (PPO) [Schulman et al., 2017]. KL penalty for\nall RL experiments is set to 0 except for in section 3.6. See appendix C for all other hyperparameters.\nWe mostly use defaults for the PPO hyperparameters; thus, it is possible that there exist different\ntrends for other hyperparameter configurations.\nIn BoN, we generate n trajectories for the policy and use the reward model to pick the one with the\nhighest proxy RM score. We use the unbiased estimator from Nakano et al. [2021, Appendix I] to\ncompute all of the gold and proxy scores for intermediate n between 1 and the maximum n with\nlower variance and more efficiently than the naive estimator of randomly sampling n samples with\nreplacement repeatedly and taking the mean of the maximum gold and proxy RM scores. The KL\ndistances for BoN are computed analytically: KLbon = log n − n−1\nn [Stiennon et al., 2020, Appendix\nG.3].\n2.1\n\nSynthetic Data Setup\n\nBecause getting a ground truth gold reward signal from human labellers is expensive, we instead\nuse a synthetic task where the ground truth is defined to be the output of a particular large “gold”\nRM. The 6B reward model from Ouyang et al. [2022] is used as the gold RM, and our proxy RMs\nvary from 3M to 3B parameters3 . This synthetic gold reward is used to label pairs of rollouts from\nthe policy given the same prompt to create synthetic RM training data. The synthetic comparisons\nare created deterministically by always marking the trajectory with the higher gold RM score as\npreferred.4 We generate 100,000 synthetic comparisons and reserve 10% of these as a held out test\nset for computing the validation loss of RMs.\nSee fig. 2 for a diagram of the synthetic setup.\n2.2\n\nRecalibration\n\nThe RM scores are translation-invariant, so to ensure comparability across different reward models,\nwe recenter each RM such that the average reward of the initial policy is 0. We also unit normalize\nthe variance of the gold RM scores.5 Because our hard thresholding synthetic data setup produces\nlabels that are miscalibrated (since they do not incorporate the gold RM’s confidence), we recalibrate\nthe proxy RMs by rescaling the logits to minimize cross-entropy loss using a validation set of soft\nlabels. All renormalization and recalibration is applied after the experiments; this does not affect\nBoN at all, and likely has no impact on RL because Adam is loss scale invariant, though it is possible\nthat there are slight differences due to algorithmic details.\n3\nWe originally trained two additional RMs smaller than 3M parameters, which achieved near-chance accuracy\nand were off-trend, and so were excluded.\n4\nWe had experimented with sampling for creating labels, but observed noisier results.\n5\nWe later decided this was unnecessary but decided not to change it.\n\n4\n\n\f3\n\nResults\n\n3.1\n\nFitting and validating functional forms\n\nWe chose our functional forms through experimentation with all RM data and parameter scaling\ncurves in the remainder of this paper.\nThe BoN functional form was hypothesized using data up to n = 1000. In order to validate the\nfunctional forms, we performed a BoN experiment with up to n = 60, 000 (KL ≈ 10 nats), after\nonly having seen data up to n = 1, 000 (KL ≈ 6 nats). As this experiment was conducted after the\nfunctional form was hypothesized based on data up to 6 nats, this was a true advance prediction.\nWe also test extrapolation of the BoN and RL functional forms from low KLs to to unseen larger\nKLs; see fig. 26 for details.\nWe also attempted to model the proxy scores but were unable to obtain a satisfactory fit. For BoN,\ndespite visual similarity, a linear fit (dαbon ) did not work well (fig. 20). The predictions for RL and\nBoN are not as easily modelled as the gold score predictions. We leave a better understanding of the\nproxy RM score behavior to future work.\n3.2\n\nScaling with RM Parameter Count\n\nWe hold policy size (1.2B) and data size (90,000) constant (fig. 1). We observe that for the gold RM\nscores, αbon and βbon change smoothly with RM size (figs. 3a and 3b). For RL, we find that we can\nhold αRL constant across all RM sizes, resulting in a clean scaling curve for βRL (fig. 3c). These\nscaling laws allow us to predict properties of training runs; for instance, we can also predict the peak\ngold RM scores for different RM sizes (fig. 12).\nWhen modelled using the same functional forms as the respective gold scores, the proxy score fits\nhave much lower values of βbon . We also see smooth scaling in the proxy score’s αbon and βbon .\nHowever, for the reasons in section 3.1, we are less confident about these fits. For both BoN and RL,\nwe observe systematic underestimates of the proxy √\nreward model when extrapolated to higher KLs.\nBoth appear to eventually grow roughly linearly in KL, as in Bai et al. [2022].\n\n(a) αbon\n\n(b) βbon\n\n(c) βRL\n\nFigure 3: The values of αbon , βbon and βRL in the BoN and RL overoptimization scaling laws for\nboth proxy (dashed line) and gold (solid line) rewards as they scale with parameter count.\n3.3\n\nScaling with RM Data Size\n\nWe hold RM size constant (12M) and sweep RM data size for both RL and BoN.6 . Overall, the results\nare consistent with intuition: more data leads to better gold scores and less goodharting. The scaling\nof α and β with data size are not as cleanly described as for RM size scaling (fig. 17, fig. 18).\nFor all RM sizes, we observe that for amounts of data less than around 2,000 comparisons7 , there is\nvery little improvement over near-chance loss (Figure 6). This is also reflected in gold scores after\noptimization (fig. 21). After this threshold, all models improve with more data, though larger RMs\n6\n\nFor BoN, we actually sweep all combinations of RM size and data size; see fig. 10. For a version of fig. 4a\nagainst a 3B RM, see fig. 19.\n7\nTo test the hypothesis that some minimum number of RM finetuning steps is needed, we control for the\nnumber of SGD steps by running multiple epochs and observe that running 4 epochs instead of 1 yields no\nchange in gold score whatsoever, whereas 1 epoch of 4 times as much data performs substantially better (fig. 13).\n\n5\n\n\f(a) BoN\n\n(b) RL\n\nFigure 4: RM data scaling experiments. RM size is held constant (12M), while RM data is varied.\nThe x-axis has a square root scale. Note that the plots have different axes. Dotted lines indicate proxy\nrewards, solid lines indicate gold rewards.\n\ngenerally improve faster. Interestingly, although larger RMs result in better gold scores overall, they\ndo not appear to have this critical threshold substantially earlier than smaller models.8\nWe hypothesized that two RMs of equal validation loss would achieve the same robustness against\noptimization, regardless of the combination of RM size and RM data size. Our results provide some\nweak evidence for this hypothesis (fig. 5).\n\nFigure 5: RM validation loss vs BoN RM score\nFigure 6: RM losses, broken down by data size\n@ n=1000. Most points in this figure are already\nand RM size\naveraged over multiple seeds.\n\n3.4\n\nScaling with Policy Size\n\nWe briefly explore the impact of policy size by holding the RM size constant (12M) and evaluating\ntwo different policy sizes. We also perform the same experiment with a different RM size (3B),\nobserving similar results (fig. 22).\nLarger policies see less benefit from optimization against an RM, but don’t overoptimize more.\nWe observe that the 6B policy run has a smaller difference between its initial and peak gold reward\nmodel scores than the 1.2B policy run. This is most visible in the BoN plot (fig. 7a).9 However, while\nwe might expect that a larger policy overoptimizes substantially faster, contrary to intuition, we find\nthat both gold scores peak at almost the same KL. In fact, the gap between the proxy and gold scores\nis almost the same between the two policy sizes (fig. 24). We can interpret this gap, the shortfall\n8\n\nThis result contradicts some other internal findings; thus, it is possible that this is an artifact of this particular\nsetup.\n9\nFor a version of the RL plot (fig. 7b) with all runs starting at 0, see fig. 23.\n\n6\n\n\f(a) BoN\n\n(b) RL\n\nFigure 7: Policy scaling experiments. RM size is held constant (12M), while policy size is varied.\nThe x-axis has a square root scale. Note that the plots have different axes. Dotted lines indicate proxy\nrewards, solid lines indicate gold rewards. The asterisks in the RL plot indicate the max gold score\nfor each policy size.\nbetween the predicted and actual rewards, as being indicative of the extent to which the proxy RM is\nexploited. We discuss this result further in section 4.4.\n3.5\n\nRL vs BoN\n\nA priori, we might expect reinforcement learning via PPO [Schulman et al., 2017] and best-of-n to\napply optimization in very different ways. As such, we ask whether this difference in optimization\nresults in different overoptimization characteristics. Similarities would potentially indicate candidates\nfor further study in gaining a more fundamental understanding of overoptimization in general, and\ndifferences opportunities for better optimization algorithms. We note the following:\nRL is far less KL-efficient than BoN. Viewing KL distance as a resource to be spent, we observe\nthat RL \"consumes\" far more KL than BoN. This means that both optimization and overoptimization\nrequire more KL to occur with RL. Intuitively, BoN searches very locally around the initial policy,\nand thus KLbon increases with roughly log(n). For RL on the other hand, each step modifies the\npolicy from the policy of the previous step—KL increases approximately quadratically with step in\nthe absence of KL penalty (Figure 16, Figure 14). An implication of this result is that KL distance is\nan inadequate metric for quantity of (over)optimization; we discuss this further in section 4.1.\nWhen looking at proxy vs gold RM scores, BoN and RL look more similar. The proxy RM\nscore is another possible metric for quantity of optimization, because it is the value that is being\ndirectly optimized for. Using it as the metric of optimization leads to significantly more analogy\nbetween RL and BoN than KL distance does. However, we do observe that RL initially has a larger\nproxy-gold gap (i.e requires more proxy RM increase to match BoN), but then peaks at a higher gold\nRM score than BoN (fig. 8).\n3.6\n\nEffect of KL Penalty\n\nWe observe in our setting that when varying the KL penalty for RL, the gold RM scores depend only\non the KL distance of the policy KLRL (Figure 9). The KL penalty only causes the gold RM score to\nconverge earlier, but does not affect the KLRL -gold reward frontier, and so the effect of the penalty on\nthe gold score is akin to early stopping (Figure 14). However, we have seen some evidence that this\nresult could be particularly sensitive to hyperparameters.\nBecause we observe that using KL penalty has a strictly larger proxy-gold gap, we set KL penalty to\n0 for all other RL experiments in this paper.\nIt is important to note that PPO’s surrogate objective incorporates an implicit penalty on\nDKL (πold k π), where πold is a recent policy (not the initial policy) [Schulman et al., 2017]. This\npenalty is used to control how fast the policy changes, but also has an indirect effect on the KL we\n7\n\n\fFigure 8: Proxy vs gold RM score for both BoN and RL. RL curves are truncated to a proxy RM\nscore of 1.6 for readability.\nstudy here, DKL (π k πinit ), causing it to grow much more slowly (providing the implementation is\nwell-tuned). We do not know why this indirect effect appears to lead to less overoptimization than an\nexplicit KL penalty.\n\nFigure 9: RL experiments with various KL penalties. Policy size (1.2B) and RM size (1.2B) are\nheld constant. Dotted lines indicate proxy rewards, solid lines indicate gold rewards. We observe the\neffect of the KL penalty on the gold score as being equivalent to early stopping.\n\n4\n\nDiscussion\n\n4.1\n\nKL as a measure of amount of optimization\n\nFor any given fixed optimization method, KL yields clean scaling trends, such as the ones observed\nin section 3.2, and consistent peak gold RM score KLs as in section 3.4. However, because it’s\n8\n\n\fclear that different methods of optimization spend KL very differently (section 3.5), it should not\nbe used to compare the amount of optimization between different optimization algorithms. There\nexist pertubations to a policy that are orthogonal to the reward signal that would result in increases in\nKL that do not increase either gold or proxy reward; conversely, extremely small but well targeted\nperturbations could substantially change the behavior of the policy within a small KL budget.\n4.2\n\nRelation to Goodhart Taxonomy\n\nOne useful taxonomy for various Goodhart effects is presented in Manheim and Garrabrant [2018],\ncategorizing Goodhart’s Law into 4 categories: Regressional, Extremal, Causal, and Adversarial. In\nthis section, we discuss our results in the framework of this taxonomy.\n4.2.1\n\nRegressional Goodhart\n\nRegressional Goodhart occurs when our proxy RMs depend on features with noise. The simplest\ntoy example of this is a proxy reward X̂ which is exactly equal to the gold reward X plus some\nindependent noise Z. When optimizing against this proxy, some amount of optimization power will\ngo to selecting for noise, leading to a gold reward less than predicted by the proxy.\nMore formally, for independent absolutely continuous random variables X and Z with X normally\ndistributed and either (a) Z normally distributed or (b) |Z − E [Z]| &lt; δ for some δ &gt; 0, this model\npredicts a gold reward that is:\n\nE[X | X̂ = x̂] = E[X] + (x̂ − E[X] − E[Z])\n\nVar(X)\n+ε\nVar(X) + Var(Z)\n\n(1)\n\nwhere ε = 0 in case (a) and ε = o (Var (Z)) as δ → 0 in case (b). See appendix A for the proof.\nIntuitively, we can interpret eq. (1) as stating that the optimization power expended is divided between\noptimizing the gold reward and selecting on the noise proportional to their variances. This also\nimplies that if this is the only kind of Goodhart present, the gold reward must always increase\nmonotonically with the proxy reward; as we observe nonmonotonic behavior (fig. 8), there must be\neither noise distributions violating these assumptions or other kinds of Goodhart at play.\nThis result lends itself to an interpretation of the α term in the RL√and BoN gold score scaling laws:\nsince for both RL and BoN the proxy scores are roughly linear in KL, the difference in the slope of\nthe proxy score and the linear component of the gold score (i.e the α term) can be interpreted as the\namount of regressional Goodhart occurring.\n4.2.2\n\nExtremal Goodhart\n\nWe can think of out of distribution failures of the RM as an instance of extremal Goodhart. As we\noptimize against the proxy RM, the distribution of our samples shifts out of the training distribution\nof the RM, and thus the relation between the proxy and gold scores weakens. For instance, suppose\nin the training distribution a feature like answer length always indicates a higher quality answer, and\nthus the proxy RM infers that longer answers are always better, even though at some point outside\nthe training distribution, selecting on longer answers no longer improves quality.10\nWe can also think of this as the proxy failing to depend on relevant features; this failure bears\nresemblance to the setting considered in Zhuang and Hadfield-Menell [2020], where a failure of the\nproxy to consider all features, under certain conditions, leads to overoptimization with unbounded\nloss of utility regardless of optimization method.\nWe expect extremal Goodharting to be primarily responsible for the nonmonotonicity of the gold\nRM scores in this paper, and is mostly responsible for the β term, which in the limit of optimization,\nresults in an unbounded loss of utility. This lends a natural interpretation to the smooth decrease in β\nfor both BoN and RL with increased RM size as smooth improvements in model robustness (fig. 3).\n10\n\nOptimized policies producing very long answers even when a short answer would be preferred is a real issue\nthat we have observed in other experiments in the InstructGPT setting.\n\n9\n\n\f4.2.3\n\nCausal Goodhart\n\nWe can think of causal Goodhart as being a generalization of regressional Goodhart: there may exist\ncorrelations between features and gold score where the causal structure of the problem is such that\nselecting on the feature does not increase the gold score. For instance, suppose answer length is\ncorrelated with quality due to some other common cause (say, informativeness); then, the proxy\nRM may learn to use answer length as a feature, and when we select against the proxy we get\nlonger answers that do not increase on actual quality.11 In our experiments, we would observe causal\nGoodhart as behaving similarly to regressional Goodhart.\n4.2.4\n\nAdversarial Goodhart\n\nAdversarial Goodhart occurs when the policy actively manipulates the proxy. We do not expect\nthe effects of adversarial Goodhart to be captured in this work, as the models involved are not\npowerful enough to implement adversarial strategies. However, given the constant improvement of\nML capabilities, it is entirely plausible that ML systems will one day become capable enough to do\nso [Hubinger et al., 2019]. When this occurs, the scaling laws observed in this paper may break down.\nThus, we advise caution when using these results for extrapolation.\n4.3\n\nImplications for iterated RLHF\n\nWhen conducting reinforcement learning from human feedback, it is preferable to use an online setup,\nin which fresh human feedback data is periodically used to train a new reward model, to mitigate\noveroptimization [Bai et al., 2022]. Our scaling law allows us to analyze the effect of this iterative\napproach under some simplifying assumptions. We assume firstly that the scaling\ncoefficients αRL\n√\nand βRL remain constant across iterations, and secondly that the distance d = KL is additive across\niterations (because of how KL appears to grow empirically as in Figure 14). Under these assumptions,\nthe final gold reward model score after k iterations each covering a distance d/k is given by\nRRL (d) = d (αRL − βRL log (d) + βRL log (k)) .\nTwo interesting observations follow from this. Firstly, the iterative approach does not affect any\nGoodharting captured by the αRL term (such as regressional Goodharting, as discussed in Section\n4.2.1). Secondly, the effect of the iterative approach is to increase the final gold RM score by an\namount proportional to both d and log (k), namely\nβRL d log (k) .\nNote that this result can only hold up to some maximum value of k, and we expect our scaling law\nto break down below some minimum distance. Further research is required to determine what this\nminimum is, as well as to what extent our simplifying assumptions hold in practice.\n4.4\n\nPolicy size independence\n\nOur observation that larger SFT policies seem to exhibit the same amount of overoptimization during\nRL implies that larger policies do not increase the amount of optimization power applied to the RM\nor learn faster, even though they start out with higher performance on the gold score. While it is\nexpected that larger policies have less to gain from optimizing against the same RM, we might also\nexpect the gold score to peak at a substantially earlier KL distance, analogous to what we see when\nwe scale the RM size (section 3.2), or for larger policies to more efficiently utilize the same number\nof RL feedback steps (section 3.3)12 .\nOne possible hypothesis is that, because RLHF can be viewed as Bayesian inference from the prior\nof the initial policy [Korbak et al., 2022]13 , increases in policy size are only improving the modelling\naccuracy of the human demonstration distribution.\n11\nWe can think of noise as a particular case of this where the independent noise is correlated with signal+noise,\nbut of course there is no causal relation between signal and noise.\n12\nIt is also not the case that the 6B policy run has higher KL distance for the same number of RL steps; in fact,\nwe observe that it has lower KL distance for the same number of steps (fig. 15)\n13\nThe result of Korbak et al. [2022] concerns varying KL penalties rather than KL distances with no KL\npenalty, but as we observe in section 3.6, this is equivalent on our setting.\n\n10\n\n\f4.5\n\nLimitations and Future Work\n\nIn addition to the overoptimization studied in this paper (due to the mismatch between the reward\nmodel and the ground truth labels), there exists another source of overoptimization due to mismatch\nbetween the ground truth labels and the actual human intent. This contains issues ranging from the\nmundane, such as labellers choosing options that only appear to match their intent14 , to substantially\nmore philosophically fraught issues [Armstrong and Mindermann, 2018, Sunstein et al., 2001]. The\nmain limitation of this work is that this additional source of overoptimization is not captured in the\nsetting of this paper. See section 5 for discussion of related work in alignment.\nSome additional limitations and future directions include:\n• Validating these results on other environments and experimental setups. While the\nexperiments in this paper all use the InstructGPT environment, the main value of these\nresults lies in the extent to which they reflect general phenomema. Confirming whether\nthese results generalize to other settings would be extremely valuable to that end.15\n• Validating the synthetic setting. The synthetic setting might not transfer to real world\nsettings, for instance because there is substantial correlation between RMs.\n• Investigating methods for making RMs more robust to optimization. While there has\nbeen prior work in this direction (see section 5), there is still much work to be done in\nsystematically investigating ways to make RMs more robust.\n• Exploring other forms of optimization and categorizing their differences. While this\nwork focuses exclusively on BoN and RL there are other ways of applying optimization\npressure against a model of a reward signal, either implicit or explicit. This includes GeDilike steering, Decision Transformers16 , variants of BoN like beam search, and other RL\nalgorithms.\n• Better understanding the functional form of proxy RM scores. In our modeling, we find\nthat the proxy RM scores are more difficult to predict for both BoN and RL (section 3.2).\nWhile they seem to have a major linear component, there is sufficient variation that fitting a\nlinear regression is not very good at predicting extrapolated proxy RM scores.\n• Exploring adversarial Goodhart empirically. In this work we deal with systems not\npowerful enough to cause adversarial Goodhart. However, it is plausible that adversarial\nGoodhart is especially important, or is associated with phase changes that break the trends\nseen in this paper.\n• Exploring scaling with policy size in more detail. Our exploration of policy size scaling\nin this paper was limited to only two policy sizes. It is possible that there exist trends not\nseen in our exploration when considering the policy size more carefully.\n• Exploring multi-iteration RLHF. In particular, checking for deviations from the assumptions of section 4.3.\nWe hope this paper leads to future work further bridging conceptual and empirical alignment research.\n\n5\n\nRelated Work\n\nGoodhart’s Law in its modern formulation was first introduced in Hoskin [1996], with many of\nthe key ideas introduced in prior works [Campbell, 1969, Goodhart, 1975]. Many approaches\nhave been proposed for reducing overoptimization in general [Taylor, 2016, Everitt et al., 2017],\nas well as in RMs [Gleave and Irving, 2022], including within the field of adversarial robustness\n[Chakraborty et al., 2018]. Overoptimization of reward models can be viewed as a special case of\n14\n\nFor instance, the example of a robotic hand learning from human feedback to only appear to grasp a ball, presented in https://openai.com/blog/deep-reinforcement-learning-from-human-preferences/\n[Christiano et al., 2017]\n15\nIn the course of our experiments, we observed visually similar results on the WebGPT environment [Nakano\net al., 2021].\n16\nOne could consider measuring the actual achieved ground truth/gold score achieved for each \"proxy\" score\nconditioned on, a la fig. 8, as testing the implicit reward-behavior mapping encoded by the model.\n\n11\n\n\fspecification gaming (also known as reward hacking). Previous work has shown numerous examples of such behavior in a wide variety of settings [Krakovna et al., 2020, Lehman et al., 2020].\nPan et al. [2022] explores a diverse set of RL environments and finds phase transitions in some\nsettings. A number of works have proposed theoretical models of Goodhart’s Law and reward\nhacking [Krakovna and Kumar, 2019, Manheim and Garrabrant, 2018, Skalse et al., 2022], including Zhuang and Hadfield-Menell [2020] which exhibits very similar overoptimization curves as\nobserved in this paper in some toy environments.\nOne can think of overfitting as a special case of Goodhart’s law where the proxy is the score on\nsome finite set of samples, whereas our actual objective includes its generalization properties as well.\nOverfitting has been observed and studied in RL settings [Zhang et al., 2018a,b, Farebrother et al.,\n2018, Cobbe et al., 2019]. Song et al. [2019] studies \"observational overfitting\" in RL settings, which\nis closely related to causal Goodhart [Manheim and Garrabrant, 2018].\nAdversarial attacks and robustness are also very closely related fields. Many works have demonstrated\nthe existence of adversarial examples in all kinds of neural networks [Szegedy et al., 2013, Lin et al.,\n2017, Ebrahimi et al., 2018, Dai et al., 2018], and proposed methods to measure and increase neural\nnetwork robustness [Gu and Rigazio, 2014, Zheng et al., 2016, Carlini et al., 2019, Guo et al., 2021].\nScaling laws have seen substantial success in machine learning for predicting properties of language\nmodels [Kaplan et al., 2020, Henighan et al., 2020, Hernandez et al., 2021] and has led to better\ntheoretical understanding of language models [Sharma and Kaplan, 2020, Bahri et al., 2021].\nReinforcement learning from human feedback [Christiano et al., 2017, Ibarz et al., 2018] has been\nused broadly in language models [Stiennon et al., 2020, Ouyang et al., 2022, Nakano et al., 2021,\nBai et al., 2022]. It is also a first step towards recursive reward modelling [Leike et al., 2018],\nan approach towards reducing the additional source of overoptimization described in section 4.5,\nthough it is subject to some theoretical limitations [Christiano et al., 2021]. We observe similar\napproximately-linear proxy RM scores observed in Bai et al. [2022]17 , though we observe an early-KL\nbend in the proxy RM scores, and there are some occasional outliers with very small RMs and data\nsizes.\nMore broadly, AI alignment is the problem of ensuring that the goals of AI systems are aligned with\nthe goals of humans [Ngo, 2022], including future AI systems which may exceed humans [Bostrom,\n2014]. There are a number of reasons to expect AI misalignment, especially in those more powerful\nfuture systems, to occur [Omohundro, 2008, Turner et al., 2021, Armstrong et al., 2013, Hubinger\net al., 2019, Soares et al., 2015], and to result in catastrophic outcomes [Carlsmith, 2022, Cotra,\n2022].\n\nAcknowlegements\nWe thank Vivek Hebbar, Jared Kaplan, Jan Leike, Kyle McDonell, Dan Mossing, Ethan Perez, Laria\nReynolds, and Jeff Wu for valuable discussion and feedback.\n\nReferences\nStuart Armstrong and Sören Mindermann. Occam's razor is insufficient to infer the preferences\nof irrational agents. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi,\nand R. Garnett, editors, Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper/2018/file/\nd89a66c7c80a29b1bdbab0f2a1a94af8-Paper.pdf.\nStuart Armstrong et al. General purpose intelligence: arguing the orthogonality thesis. Analysis and\nMetaphysics, 12(68):1–20, 2013.\nYasaman Bahri, Ethan Dyer, Jared Kaplan, Jaehoon Lee, and Utkarsh Sharma. Explaining neural\nscaling laws. arXiv preprint arXiv:2102.06701, 2021.\nYuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain,\nStanislav Fort, Deep Ganguli, Tom Henighan, et al. Training a helpful and harmless assistant with\nreinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022.\n17\n\nNote that Bai et al. [2022] scaled the policy size with the RM size, while we hold the policy size constant.\n\n12\n\n\fNick Bostrom. Superintelligence: Paths, Dangers, Strategies. Oxford University Press, Inc., USA,\n1st edition, 2014. ISBN 0199678111.\nTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal,\nAriel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M.\nZiegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin,\nScott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford,\nIlya Sutskever, and Dario Amodei. Language models are few-shot learners. arXiv preprint\narXiv:2005.14165, 2020.\nDonald T Campbell. Reforms as experiments. American psychologist, 24(4):409, 1969.\nNicholas Carlini, Anish Athalye, Nicolas Papernot, Wieland Brendel, Jonas Rauber, Dimitris Tsipras,\nIan Goodfellow, Aleksander Madry, and Alexey Kurakin. On evaluating adversarial robustness,\n2019. URL https://arxiv.org/abs/1902.06705.\nJoseph Carlsmith. Is power-seeking AI an existential risk? arXiv preprint arXiv:2206.13353, 2022.\nAnirban Chakraborty, Manaar Alam, Vishal Dey, Anupam Chattopadhyay, and Debdeep Mukhopadhyay. Adversarial attacks and defences: A survey. arXiv preprint arXiv:1810.00069, 2018.\nPaul Christiano, Ajeya Cotra, and Mark Xu. Eliciting latent knowledge: How to tell if your\neyes deceive you, 12 2021. URL https://docs.google.com/document/d/1WwsnJQstPq91_\nYh-Ch2XRL8H_EpsnjrC1dwZXR37PC8.\nPaul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep\nreinforcement learning from human preferences. Advances in neural information processing\nsystems, 30, 2017.\nKarl Cobbe, Oleg Klimov, Chris Hesse, Taehoon Kim, and John Schulman. Quantifying generalization\nin reinforcement learning. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings\nof the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine\nLearning Research, pages 1282–1289. PMLR, 09–15 Jun 2019. URL https://proceedings.\nmlr.press/v97/cobbe19a.html.\nAjeya Cotra. Without specific countermeasures, the easiest path to transformative AI likely leads to\nAI takeover, 2022. URL https://www.alignmentforum.org/posts/pRkFkzwKZ2zfa3R6H/\nwithout-specific-countermeasures-the-easiest-path-to.\nHanjun Dai, Hui Li, Tian Tian, Xin Huang, Lin Wang, Jun Zhu, and Le Song. Adversarial attack\non graph structured data. In Jennifer Dy and Andreas Krause, editors, Proceedings of the 35th\nInternational Conference on Machine Learning, volume 80 of Proceedings of Machine Learning\nResearch, pages 1115–1124. PMLR, 10–15 Jul 2018. URL https://proceedings.mlr.press/\nv80/dai18b.html.\nJavid Ebrahimi, Daniel Lowd, and Dejing Dou. On adversarial examples for character-level neural\nmachine translation. arXiv preprint arXiv:1806.09030, 2018.\nTom Everitt, Victoria Krakovna, Laurent Orseau, Marcus Hutter, and Shane Legg. Reinforcement\nlearning with a corrupted reward channel. arXiv preprint arXiv:1705.08417, 2017.\nJesse Farebrother, Marlos C Machado, and Michael Bowling. Generalization and regularization in\ndqn. arXiv preprint arXiv:1810.00123, 2018.\nAmelia Glaese, Nat McAleese, Maja Trebacz, John Aslanides, Vlad Firoiu, Timo Ewalds, Maribeth\nRauh, Laura Weidinger, Martin Chadwick, Phoebe Thacker, Lucy Campbell-Gillingham, Jonathan\nUesato, Po-Sen Huang, Ramona Comanescu, Fan Yang, Abigail See, Sumanth Dathathri, Rory\nGreig, Charlie Chen, Doug Fritz, Jaume Sanchez Elias, Richard Green, Soňa Mokrá, Nicholas Fernando, Boxi Wu, Rachel Foley, Susannah Young, Iason Gabriel, William Isaac, John Mellor, Demis\nHassabis, Koray Kavukcuoglu, Lisa Anne Hendricks, and Geoffrey Irving. Improving alignment\nof dialogue agents via targeted human judgements. 2022. URL https://storage.googleapis.\ncom/deepmind-media/DeepMind.com/Authors-Notes/sparrow/sparrow-final.pdf.\n13\n\n\fAdam Gleave and Geoffrey Irving. Uncertainty estimation for language reward models. arXiv\npreprint arXiv:2203.07472, 2022.\nCharles Goodhart. Problems of monetary management: the uk experience in papers in monetary\neconomics. Monetary Economics, 1, 1975.\nShixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial\nexamples. arXiv preprint arXiv:1412.5068, 2014.\nChuan Guo, Alexandre Sablayrolles, Hervé Jégou, and Douwe Kiela. Gradient-based adversarial\nattacks against text transformers, 2021. URL https://arxiv.org/abs/2104.13733.\nTom Henighan, Jared Kaplan, Mor Katz, Mark Chen, Christopher Hesse, Jacob Jackson, Heewoo\nJun, Tom B Brown, Prafulla Dhariwal, Scott Gray, et al. Scaling laws for autoregressive generative\nmodeling. arXiv preprint arXiv:2010.14701, 2020.\nDanny Hernandez, Jared Kaplan, Tom Henighan, and Sam McCandlish. Scaling laws for transfer.\narXiv preprint arXiv:2102.01293, 2021.\nKeith Hoskin. The \"awful idea of accountability\" : inscribing people into the measurement of objects.\nAccountability : power, ethos and the technologies of managing / edited by Rolland Munro and Jan\nMouritsen, 1996.\nEvan Hubinger, Chris van Merwijk, Vladimir Mikulik, Joar Skalse, and Scott Garrabrant. Risks from\nlearned optimization in advanced machine learning systems. arXiv preprint arXiv:1906.01820,\n2019.\nBorja Ibarz, Jan Leike, Tobias Pohlen, Geoffrey Irving, Shane Legg, and Dario Amodei. Reward\nlearning from human preferences and demonstrations in atari. Advances in neural information\nprocessing systems, 31, 2018.\nJared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott\nGray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models.\narXiv preprint arXiv:2001.08361, 2020.\nTomasz Korbak, Ethan Perez, and Christopher L Buckley. Rl with kl penalties is better viewed as\nbayesian inference. arXiv preprint arXiv:2205.11275, 2022.\nVictoria Krakovna and Ramana Kumar.\nClassifying specification problems as variants\nof goodhart’s law, 8 2019.\nURL https://vkrakovna.wordpress.com/2019/08/19/\nclassifying-specification-problems-as-variants-of-goodharts-law/.\nVictoria Krakovna, Jonathan Uesato, Vladimir Mikulik, Matthew Rahtz, Tom Everitt,\nRamana Kumar, Zac Kenton, Jan Leike, and Shane Legg.\nSpecification gaming:\nthe flip side of AI ingenuity, 4 2020.\nURL https://www.deepmind.com/blog/\nspecification-gaming-the-flip-side-of-ai-ingenuity.\nJoel Lehman, Jeff Clune, Dusan Misevic, Christoph Adami, Lee Altenberg, Julie Beaulieu, Peter J.\nBentley, Samuel Bernard, Guillaume Beslon, David M. Bryson, Patryk Chrabaszcz, Nick Cheney,\nAntoine Cully, Stephane Doncieux, Fred C. Dyer, Kai Olav Ellefsen, Robert Feldt, Stephan\nFischer, Stephanie Forrest, Antoine Frénoy, Christian Gagné, Leni Le Goff, Laura M. Grabowski,\nBabak Hodjat, Frank Hutter, Laurent Keller, Carole Knibbe, Peter Krcah, Richard E. Lenski, Hod\nLipson, Robert MacCurdy, Carlos Maestre, Risto Miikkulainen, Sara Mitri, David E. Moriarty,\nJean-Baptiste Mouret, Anh Nguyen, Charles Ofria, Marc Parizeau, David Parsons, Robert T.\nPennock, William F. Punch, Thomas S. Ray, Marc Schoenauer, Eric Shulte, Karl Sims, Kenneth O.\nStanley, François Taddei, Danesh Tarapore, Simon Thibault, Westley Weimer, Richard Watson, and\nJason Yosinski. The surprising creativity of digital evolution: A collection of anecdotes from the\nevolutionary computation and artificial life research communities. Artificial life, 26(2):274–306,\n2020.\nJan Leike, David Krueger, Tom Everitt, Miljan Martic, Vishal Maini, and Shane Legg. Scalable agent\nalignment via reward modeling: a research direction. arXiv preprint arXiv:1811.07871, 2018.\n14\n\n\fYen-Chen Lin, Zhang-Wei Hong, Yuan-Hong Liao, Meng-Li Shih, Ming-Yu Liu, and Min Sun.\nTactics of adversarial attack on deep reinforcement learning agents, 2017. URL https://arxiv.\norg/abs/1703.06748.\nDavid Manheim and Scott Garrabrant. Categorizing variants of goodhart’s law. arXiv preprint\narXiv:1803.04585, 2018.\nJacob Menick, Maja Trebacz, Vladimir Mikulik, John Aslanides, Francis Song, Martin Chadwick,\nMia Glaese, Susannah Young, Lucy Campbell-Gillingham, Geoffrey Irving, et al. Teaching\nlanguage models to support answers with verified quotes. arXiv preprint arXiv:2203.11147, 2022.\nReiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christopher\nHesse, Shantanu Jain, Vineet Kosaraju, William Saunders, et al. Webgpt: Browser-assisted\nquestion-answering with human feedback. arXiv preprint arXiv:2112.09332, 2021.\nRichard Ngo. The alignment problem from a deep learning perspective.\narXiv:2209.00626, 2022.\n\narXiv preprint\n\nStephen M. Omohundro. The basic ai drives. In Proceedings of the First Conference on Artificial\nGeneral Intelligence, pages 483–492. IOS Press, 2008. URL http://selfawaresystems.\nfiles.wordpress.com/2008/01/ai_drives_final.pdf.\nLong Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong\nZhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton,\nLuke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Jan Leike, and Ryan Lowe. Training\nlanguage models to follow instructions with human feedback, 2022. version 1.\nAlexander Pan, Kush Bhatia, and Jacob Steinhardt. The effects of reward misspecification: Mapping\nand mitigating misaligned models. arXiv preprint arXiv:2201.03544, 2022.\nJohn Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy\noptimization algorithms. arXiv preprint arXiv:1707.06347, 2017.\nUtkarsh Sharma and Jared Kaplan. A neural scaling law from the dimension of the data manifold.\narXiv preprint arXiv:2004.10802, 2020.\nJoar Skalse, Nikolaus H. R. Howe, Dmitrii Krasheninnikov, and David Krueger. Defining and\ncharacterizing reward hacking, 2022. URL https://arxiv.org/abs/2209.13085.\nNate Soares, Benja Fallenstein, Stuart Armstrong, and Eliezer Yudkowsky. Corrigibility. In Workshops\nat the Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015.\nXingyou Song, Yiding Jiang, Stephen Tu, Yilun Du, and Behnam Neyshabur. Observational overfitting\nin reinforcement learning. arXiv preprint arXiv:1912.02975, 2019.\nNisan Stiennon, Long Ouyang, Jeff Wu, Daniel M. Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford,\nDario Amodei, and Paul Christiano. Learning to summarize from human feedback. Computing\nResearch Repository, 2020. version 3.\nCass R Sunstein, Daniel Kahneman, David Schkade, and Ilana Ritov. Predictably incoherent\njudgments. Stan. L. Rev., 54:1153, 2001.\nChristian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow,\nand Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.\nJessica Taylor. Quantilizers: A safer alternative to maximizers for limited optimization. In Workshops\nat the Thirtieth AAAI Conference on Artificial Intelligence, 2016.\nAlex Turner, Logan Smith, Rohin Shah, Andrew Critch, and Prasad Tadepalli. Optimal policies tend\nto seek power. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan,\neditors, Advances in Neural Information Processing Systems, volume 34, pages 23063–23074.\nCurran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper/2021/file/\nc26820b8a4c1b3c2aa868d6d57e14a79-Paper.pdf.\n15\n\n\fAmy Zhang, Nicolas Ballas, and Joelle Pineau. A dissection of overfitting and generalization in\ncontinuous reinforcement learning. arXiv preprint arXiv:1806.07937, 2018a.\nChiyuan Zhang, Oriol Vinyals, Remi Munos, and Samy Bengio. A study on overfitting in deep\nreinforcement learning. arXiv preprint arXiv:1804.06893, 2018b.\nStephan Zheng, Yang Song, Thomas Leung, and Ian Goodfellow. Improving the robustness of deep\nneural networks via stability training. In Proceedings of the ieee conference on computer vision\nand pattern recognition, pages 4480–4488, 2016.\nSimon Zhuang and Dylan Hadfield-Menell. Consequences of misaligned AI. Advances in Neural\nInformation Processing Systems, 33:15763–15773, 2020.\n\n16\n\n\fA\n\nProof of Regressional Goodhart identity\n\nLemma. Let X and Z be independent absolutely continuous random variables with X normally\ndistributed and either (a) Z normally distributed or (b) |Z − E [Z]| &lt; δ for some δ &gt; 0. Then for\nany real number c and as δ → 0,\nE [X | X + Z = c] = E [X] + (c − E [X] − E [Z])\n\nVar (X)\n+ ε,\nVar (X) + Var (Z)\n\nwhere ε = 0 in case (a) and ε = o (Var (Z)) in case (b).\nProof. First note that by making the substitutions X 0 = X − E [X] and Z 0 = Z − E [Z], we may\nassume without loss of generality that E [X] = E [Z] = 0. Let Var (X) = σ 2 and Var (Z) = τ 2 .\nIn case (a), the pair (X, X + Z) is bivariate normal with covariance matrix\n\u0012 2\n\u0013\nσ\nσ2\n,\nσ2 σ2 + τ 2\nand the result follows by standard properties of conditional distributions of multivariate normal\ndistributions.\nIn case (b), let fX and fZ be the probability density functions of X and Z respectively. Then\nR∞\n(c − z) fX (c − z) fZ (z) dz\nE [X | X + Z = c] = −∞R ∞\nf (c − z) fZ (z) dz\n−∞ X\nRδ\n0\n(c) z + o (z)) fZ (z) dz\nz (fX (c) − fX\n= c − R−δδ\n0\n(fX (c) − fX (c) z + o (z)) fZ (z) dz\n−δ\n\u0002 \u0003\n\u0002 \u0003\u0001\n0\n(c) E Z 2 + o E Z 2\nfX (c) E [Z] − fX\n=c−\n0 (c) E [Z] + o (1)\nfX (c) − fX\n0\n\u0001\nf (c) 2\n=c+ X\nτ + o τ2\nfX (c)\n\u0012\n\u0013\n\u0001\nτ2\n= c 1 − 2 + o τ2\nσ\n\u0012\n\u0013\n\u0001\nσ2\n=c\n+ o τ2 ,\n2\n2\nσ +τ\nas required.\n\n17\n\n\fB\n\nRL form details\n\nIdeally all overoptimization forms would have finite slope at the origin. We tried the following forms:\n• d (αRL − βRL log (1 + d)): Has slope α at the origin; however, has substantially worse\nextrapolation behavior. We can replace the 1 with a learned \u000f but that introduces another\ndegree of freedom.\n• Power laws d (αRL − βRL dγRL ): Has slope α at the origin; however, this adds another degree\nof freedom, and the best fits resulted in small values of γRL .\nNote that the power law forms with small γRL approximate the RL form that we decided on, as\nlimn→∞ n(x1/n − 1) = log x.\n\nC\n\nHyperparameters\nHyperparameter\n\nValue\n\nRM Adam learning rate multiplier 1.67e-2\nRM batch size\n64\nRL Adam learning rate multiplier 4e-3\nRL batch size\n256\nRL PPO clipping parameter\n0.2\nRL Timesteps per rollout\n256\nRL minibatches per epoch\n128\nRL GAE bootstrapping parameter 0.95\nTable 1: Hyperparameters used throughout the experiments.\n\n18\n\n\fWhat is full of holes but still holds water?\nGeneration\nProxy score Gold score\nCrime\\nMussels are typically found\n-0.1922\n-0.5225\nto be full of holes but will the moisture still be retained and will it hurt\nmy eyes? The general response is\nyes as the clam is generally of a\nmoistest nature. However, it all depends on the type of clam you are\npurchasing.&lt;|endoftext|&gt;\nMost likely a pipe is having trouble\n0.0322\n-0.0165\n3\nstaying full.&lt;|endoftext|&gt;\n10\nA sponge&lt;|endoftext|&gt;\n0.2336\n0.4828\n30\nWhen something is full of holes, it\n0.6534\n-0.1543\nis used for stirring or moving liquid.&lt;|endoftext|&gt;\n100\nA tornado is usually a swirling cloud\n0.8968\n-0.3367\nof swirling air with a spinning jet\nwhich stirs up winds full of sharp\ndebris.&lt;|endoftext|&gt;\n300\nA tornado is usually a swirling cloud\n0.8968\n-0.3367\nof swirling air with a spinning jet\nwhich stirs up winds full of sharp\ndebris.&lt;|endoftext|&gt;\n1000 A tornado is usually a swirling cloud\n0.8968\n-0.3367\nof swirling air with a spinning jet\nwhich stirs up winds full of sharp\ndebris.&lt;|endoftext|&gt;\n0.9003\n0.2733\n3000 A bore hole is a hole drilled into\na rock for the purpose of exploring a fossil-bearing sedimentary or\nbedrock deposit.&lt;|endoftext|&gt;\n10000 A bore hole is a hole drilled into\n0.9003\n0.2733\na rock for the purpose of exploring a fossil-bearing sedimentary or\nbedrock deposit.&lt;|endoftext|&gt;\n30000 A pothole is a structural vulnerabil0.9527\n0.5490\nity that allows water to penetrate its\ncavity and cause damage to passing vehicles or the surface it rests\non.&lt;|endoftext|&gt;\nTable 2: A sample of the BoN answers on a single InstructGPT question (policy=1.2B, proxy\nRM=12M). For each individual question, the gold scores do not follow as clean a trend as they do\nwhen averaged over many questions as in fig. 1.\nn\n1\n\n19\n\n\fFigure 10: Maximum gold scores for all RM size and data size combinations.\n\nFigure 11: Validation losses for the proxy RMs in section 3.2 by size, plus the two near-chance level\nRMs.\n\n20\n\n\fFigure 12: Max BoN gold scores (αbon /2βbon ) predicted with the BoN closed form\n\nFigure 13: Total number of data points seen does not seem to affect the gold RM score much compared\nto the number of unique data points seen. Averaged across RM sizes. The numbers of datapoints\n(2000–8000) is intentionally chosen to straddle the sharp increase in performance. The validation\nloss of the 1x2000, 1x8000, and 4x2000 RMs are 0.686109, 0.654857, and 0.683869 respectively.\n\n21\n\n\fFigure 14: Change in KLRL throughout RL training for various different KL penalties. We observe\nthat KL distance increases approximately monotonically with step count, and converges for higher\nKL penalties.\n\nFigure 15: KLRL with policy size (RM size = 12M)\n\n22\n\n\fFigure 16: KLRL with RM size\n\nFigure 17: αbon with dataset size, averaged across RM sizes\n\n23\n\n\fFigure 18: βbon with dataset size, averaged across RM sizes\n\nFigure 19: RM data scaling experiments, BoN, RM size=3B\n\n24\n\n\fFigure 20: The BoN proxy scores are slightly concave, so that a linear fit does not fit well.\n\nFigure 21: BoN Gold scores at n=1,000, broken down by data size and RM size. See fig. 6 for RM\nlosses. Vertical dotted line approximately indicates first better-than-random data size.\n\n25\n\n\fFigure 22: RL experiments with 3B RM and different policy sizes.\n\nFigure 23: fig. 7b with all runs normalized from 0.\n\n26\n\n\fFigure 24: The gap between the proxy and gold scores in the RL policy sweep (fig. 24).\n\nFigure 25: The fraction of updates clipped by PPO.\n\n27\n\n\f(a) BoN\n\nFigure 26: Extrapolation quality of fits in fig. 1. The regressions (shown in faint lines) are only fit to\ndata to the left of the vertical black dotted lines. In the case of BoN, this represents a true advance\nprediction, as the functional form was chosen without collecting any data past a KL of 6 nats.\n\n28\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"