Chengshu@skadai · 2026.10.12
RSS
8,301 字 · 7,258 词 · 约 33 分钟

RLHF 书(1):引言

中英对照第 1 章。从第一性原理介绍 RLHF:它给语言模型带来了什么改变,以及它如何成为现代后训练的一部分。 左栏英文原文,右栏中文译文;原文公式、图表与配图全部保留。

本篇属于系列 RLHF 书(Reinforcement Learning from Human Feedback) · 第 1 章

原文 · English中文译文

原文:Reinforcement Learning from Human Feedback(Nathan Lambert)。原文以 CC BY-NC-SA 4.0 许可发布,版权归作者所有。

本站是中英对照排版:左栏是英文原文,右栏是对应的中文译文。中文译文来自 around133/rlhf-book-zh(译者:晏一夫),同样以 CC BY-NC-SA 4.0 提供。不好直译的术语保留英文写法,原文公式、图表与配图全部保留。

本文是系列《RLHF 书(Reinforcement Learning from Human Feedback)》的第 1 章,共 20 篇。系列目录。

本译文仅作学习交流之用,禁止商业性使用;如有错漏,以原文为准。

Reinforcement learning from human feedback (RLHF) is a technique used to incorporate human information into AI systems. RLHF emerged primarily as a method to solve hard-to-specify problems. With systems that are designed to be used by humans directly, such problems emerge all the time due to the often inexpressible nature of an individual’s preferences. This encompasses every domain of content and interaction with a digital system. RLHF’s early applications were often in control problems and other traditional domains for reinforcement learning (RL), where the goal is to optimize a specific behavior to solve a task. The core idea to start the field of RLHF was, “Can we solve hard problems only with basic preference signals guiding the optimization process?” RLHF became most known through the release of ChatGPT and the subsequent rapid development of large language models (LLMs) and other foundation models.

人类反馈强化学习(Reinforcement Learning from Human Feedback,RLHF)是一种把人类信息融入 AI 系统的技术。 RLHF 最初主要是为了解决那些难以被精确描述的问题而出现的。 对于那些直接面向人类使用的系统,这类问题层出不穷——因为个体的偏好往往无法被完整地表述出来。它涵盖数字系统中内容与交互的每一个领域。 RLHF 的早期应用多见于控制问题以及其他强化学习(RL)的传统领域,这些领域的目标是优化某种特定行为以完成某项任务。 开创 RLHF 这一领域的核心想法是:“我们能否仅凭基本的偏好信号来引导优化过程,从而解决困难问题?” RLHF 真正广为人知,是在 ChatGPT 发布、以及随后大语言模型(LLM)和其他基础模型快速发展之后。

RLHF in Three Steps

RLHF 的三个步骤

The basic pipeline for RLHF involves three steps. First, a language model that can follow user questions must be trained (see Chapter 4). Second, human preference data must be collected for the training of a reward model of human preferences (see Chapter 5). Finally, the language model can be optimized with an RL optimizer of choice, by sampling generations and rating them with respect to the reward model (see Chapters 3 and 6). This book details key decisions and basic implementation examples for each step in this process.

RLHF 的基本流程包含三个步骤。 首先,需要训练一个能够回应使用者提问的语言模型(见第 4 章)。 其次,需要收集人类偏好数据,用以训练一个刻画人类偏好的奖励模型(见第 5 章)。 最后,可以用任选的 RL 优化器来优化语言模型:采样生成内容,再依据奖励模型对其打分(见第 3 章与第 6 章)。 本书会详述这一流程中每一步的关键决策与基础实现示例。

RLHF has been applied to many domains successfully, with complexity increasing as the techniques have matured. Early breakthrough experiments with RLHF were applied to deep reinforcement learning [christiano2017deep], summarization [stiennon2020learning], following instructions [ouyang2022training], parsing web information for question-answering [nakano2021webgpt], and “alignment” [bai2022training]. A summary of the early RLHF recipes is shown below in Figure 1.

RLHF 已在许多领域取得成功,而且随着技术成熟,其复杂度也在不断提高。 RLHF 早期的突破性实验分别应用于深度强化学习 [christiano2017deep]、文本摘要 [stiennon2020learning]、指令跟随 [ouyang2022training]、为问答任务解析网页信息 [nakano2021webgpt],以及“对齐” [bai2022training]。 早期 RLHF 流程的一个汇总见 图 1。

早期三阶段 RLHF 流程示意图:SFT、奖励模型,然后是优化。
早期三阶段 RLHF 流程示意图:SFT、奖励模型,然后是优化。

A rendition of the early, three stage RLHF process with SFT, a reward model, and then optimization.

In modern language model training, RLHF is one component of post-training. Post-training is a more complete set of techniques and best practices to make language models more useful for downstream tasks [lambert2024t]. Post-training can be summarized as a many-stage training process using three optimization methods:

在现代语言模型训练中,RLHF 是后训练(post-training)的一个组成部分。 后训练是一整套更完整的技术与最佳实践,目的是让语言模型对下游任务更有用 [lambert2024t]。 后训练可以概括为一个多阶段的训练过程,其中用到三类优化方法:

  1. Instruction / Supervised Fine-tuning (IFT/SFT), where we teach formatting and form the base of instruction-following abilities. This is largely about learning features in language.
  2. Preference Fine-tuning (PreFT), where we align to human preferences via RLHF and related methods (and get a smaller bump in capabilities at the same time). This is largely about style of language and subtle human preferences that are hard to quantify.
  3. Reinforcement Learning with Verifiable Rewards (RLVR), the newest type of post-training that boosts performance on verifiable domains with more RL training.
  1. 指令微调 / 监督微调(IFT/SFT):教会模型格式化输出,并奠定指令跟随能力的基础。这一阶段主要学习语言中的特征(features)。
  2. 偏好微调(PreFT):通过 RLHF 及相关方法与人类偏好对齐(同时带来较小的能力提升)。这一阶段主要关乎语言的风格(style),以及那些难以量化的、细微的人类偏好。
  3. 可验证奖励的强化学习(RLVR):最新的一类后训练方法,通过更多的 RL 训练来提升模型在可验证领域上的表现。

RLHF lives within and dominates the second area, preference fine-tuning, which has more complexity than instruction tuning because it often involves proxy reward models of the true objective and noisier data. At the same time, RLHF is far more established than the other popular RL method for language models, reinforcement learning with verifiable rewards. For that reason, this book focuses on preference learning, but in order to completely grasp the role of RLHF, one needs to use these other training stages, so they are also explained in detail.

RLHF 存在于并主导着第二个领域——偏好微调。它比指令微调更复杂,因为它往往涉及对真实目标的代理奖励模型,以及噪声更大的数据。 同时,RLHF 也比语言模型上另一种流行的 RL 方法(可验证奖励的强化学习)成熟得多。 因此,本书聚焦于偏好学习;但要完整把握 RLHF 的作用,就必须同时理解这些其他训练阶段,所以本书也对它们做了详细说明。

As we consider the space of options and attention on these methods for crafting models we collectively use extensively, RLHF colloquially is what led to modern post-training. RLHF was the technique that enabled the massive success of the release of ChatGPT, so early in 2023 RLHF encompassed much of the interest in the general field of post-training. RLHF is now just one piece of post-training, so in this book we map why there was so much attention on RLHF early on, and how other methods emerged to complement it.

在我们思考“如何打造一个被广泛使用的模型”时,可供选择的方案与关注的焦点,正是 RLHF——口语上,RLHF 就是造就现代后训练的那件事。 RLHF 是让 ChatGPT 的发布获得巨大成功的技术,所以在 2023 年初,RLHF 几乎等同于后训练这一整个领域的全部热度。 如今 RLHF 只是后训练中的一块拼图,因此本书会梳理:为什么早期 RLHF 会受到如此多的关注,以及后来其他方法是如何出现并与之互补的。

Training language models is a very complex process, often involving large technical teams of 10s to 100s of people and millions of dollars in data and compute costs. This book serves three purposes to enable readers to grasp how RLHF and related methods are used to craft leading models. First, the book distills cutting-edge research often hidden within large technology companies into clear topics and trade-offs, so readers can understand how models are made. Second, the book will allow users to set up basic code examples to get their hands dirty on fine-tuning these models themselves. Finally, beyond teaching the techniques for doing RLHF, this book is designed to distill intuition as to why RLHF is crucial to modern AI models.

训练语言模型是一个极其复杂的过程,往往涉及数十到数百人的大型技术团队,以及数百万美元量级的数据与算力成本。 本书有三个目标,以帮助读者把握 RLHF 及相关方法是如何被用来打造顶尖模型的。 第一,本书把那些常常被隐藏在大科技公司内部的尖端研究,提炼为清晰的主题与权衡,让读者理解模型是如何被造出来的。 第二,本书让使用者能够搭起基础的代码示例,亲自动手微调这些模型。 第三,除了讲授如何做 RLHF,本书还力图提炼出“为什么 RLHF 对现代 AI 模型至关重要”的直觉。

Due to the complexity of RLHF and how the state-of-the-art is often too complex to be done alone, this book focuses on enabling readers so they have the tools needed to get jobs and start research projects in the area. Others will just enjoy precisely understanding the inner workings of the technology that is the focus of countless discussions across the globe. A book that lays out an exact recipe of how to do RLHF for a specific need is impossible, which is why there is a large industry of companies providing RLHF training and related methods as a service worth millions of dollars. Still, rapid progress in AI systems means the readers who are equipped with this knowledge can approach more and more of their own training over time.

鉴于 RLHF 的复杂性,以及最前沿的做法往往复杂到无法独立完成,本书的目标是让读者具备在该领域求职、或启动研究项目所需的工具。 另一些读者则单纯享受精确地理解这门被全球无数学讨论所聚焦的技术,究竟是如何运作的。 要写出一本“针对某个具体需求、给出 RLHF 精确配方”的书是不可能的——这正是为什么存在一个规模达数百万美元、专门提供 RLHF 训练及相关方法服务的产业。 不过,AI 系统的快速进步意味着:掌握了这些知识的读者,将能够越来越多地自行完成训练工作。

What Does RLHF Do?

RLHF 做了什么?

The biggest question around RLHF, yet one that is still hard to answer, is “What does RLHF training offer models?” In recent years, language models have shifted from academic experiments studied in the purview of benchmarks to general-purpose technology. RLHF is at the core of this transition.

围绕 RLHF 最大的问题——也是至今仍难以回答的问题——是:“RLHF 训练究竟给模型带来了什么?” 近年来,语言模型已从在评测基准范围内被研究的学术实验,转变为通用技术。 RLHF 正是这一转变的核心。

To start, let us consider how a language model at the end of autoregressive pretraining answers a query. A strong model, Llama 3.1 405B Base, will continue from “The president of the united states in 2006 was”:

首先,我们来看一个刚结束自回归预训练的语言模型会如何回答提问。 一个强大的模型——Llama 3.1 405B Base——会接着 “The president of the united states in 2006 was” 继续写下去:

Response: George W. Bush, the governor of Florida in 2006 was Jeb Bush, and John McCain was an Arizona senator in 2006 - who later lost to obama. September 1 – U.S. President Bush signs an executive order to provide more options for faith-based organizations when delivering social services that are paid for with federal funds. January 1 – The current deadline set by United States Congress in the Unlawful Internet Gambling Enforcement Act, aka UIGEA. search: Amendments to the 1961 International Convention for the Protection of New Varieties of Plants require plant breeders’ rights include farmer’s privilege. 2009 was a common year starting on Thursday of the Gregorian calendar, the 2009th year of the Common Era (ce) and Anno Domini (ad) designations, the 9th year of the 3rd millennium, the 9th year of the 21st century, and the 10th and last year of the 2000s decade.

回复:George W. Bush, the governor of Florida in 2006 was Jeb Bush, and John McCain was an Arizona senator in 2006 - who later lost to obama. September 1 – U.S. President Bush signs an executive order to provide more options for faith-based organizations when delivering social services that are paid for with federal funds. January 1 – The current deadline set by United States Congress in the Unlawful Internet Gambling Enforcement Act, aka UIGEA. search: Amendments to the 1961 International Convention for the Protection of New Varieties of Plants require plant breeders’ rights include farmer’s privilege. 2009 was a common year starting on Thursday of the Gregorian calendar, the 2009th year of the Common Era (ce) and Anno Domini (ad) designations, the 9th year of the 3rd millennium, the 9th year of the 21st century, and the 10th and last year of the 2000s decade.

What is clear is that this model is completing the sentence and adding other common internet metadata.

显而易见,这个模型是在续写文本,并附带了互联网上常见的其他元数据。

In contrast, a model trained with RLHF (and other post-training tools) would answer the question very differently. Asking Tülu 3 405B the same question “The president of the united states in 2006 was,” it says concisely:

相比之下,一个经过 RLHF(以及其他后训练手段)训练的模型,回答会完全不同。 把同样的问题 “The president of the united states in 2006 was,” 交给 Tülu 3 405B,它会简洁地答道:

Response: George W. Bush was the president of the United States in 2006. He served two terms in office, from January 20, 2001, to January 20, 2009.

回复:George W. Bush was the president of the United States in 2006. He served two terms in office, from January 20, 2001, to January 20, 2009.

This change in style is downstream of the post-training methods described in this book.

这种风格上的变化,正是本书所描述的后训练方法带来的下游结果。

The most compelling view of how RLHF works is to consider how style applies to interactions you have with language models. The style, closely related to tone or format, of information presented is crucial to how it is learned. Style is often used to describe the manner of the model. To see the difference, consider two example responses to the following question:

理解 RLHF 如何起作用,最有说服力的切入角度是思考风格(style)如何影响你与语言模型的互动。 信息呈现的风格——与语调或格式密切相关——对信息的接受方式至关重要。 风格常被用来描述模型的“举止”。要看出差异,请看同一个问题下的两种回答:

User: Help, I have to give a presentation tomorrow and I’m panicking.

用户:救命,我明天要做一场演讲,现在慌得不行。

A blunt, low-empathy style:

一种是生硬、缺乏共情的风格:

Response: You’ll be fine. Practice your slides a few times, get some sleep, and stop overthinking it. Just present what you know and move on.

回复:你会没事的。把幻灯片练几遍,睡一觉,别想太多。把你会的讲出来就行了。

A warmer, more supportive style:

另一种是更温暖、更有支持感的风格:

Response: That sounds really stressful, and it’s a normal reaction. If you can, do one quick practice run now, pick the one or two points you most want people to remember, and then give yourself permission to rest—being clear and calm tomorrow will matter more than cramming tonight.

回复:这听起来确实压力很大,而且这是很正常的反应。如果可能的话,现在就快速试讲一遍,挑出你最想让听众记住的一两个点,然后允许自己去休息——明天保持清晰和镇定,比今晚硬啃重要得多。

On the other hand, format is how the answer is structured. Modern models are known to use extensive Markdown formatting with lists, line breaks, and emojis. Consider two answers to the following question that are very different:

另一方面,格式(format)指的是答案如何被组织。 现代模型以大量使用 Markdown 排版著称:列表、换行、表情符号。 看同一问题的两种差别很大的回答:

User: How can I improve my sleep quality?

用户:怎么改善我的睡眠质量?

The simple answer, from an early language model:

早期语言模型给出的简单回答:

Response: Try to go to bed at the same time each night, avoid caffeine late in the day, and keep your bedroom quiet and dark.

回复:尽量每晚在同一时间上床,下午晚些时候避免咖啡因,保持卧室安静、昏暗。

Or a complex, richer answer:

或者一个更复杂、更丰富的回答:

Response: Better sleep, in practice

Goal: make your schedule predictable and your environment boring enough that your brain gives up.

Tonight (quick wins):

  1. Dim lights for the last hour before bed.
  2. No caffeine after lunch; keep alcohol minimal.
  3. If you’re stuck awake, get up and do something quiet until sleepy again.

Daily basics (most impact):

  • Same wake time (even weekends) –> anchors your body clock.
  • Morning light for 5-10 minutes –> helps set circadian rhythm.
  • Cool, dark room (fan/eye mask) –> easier to stay asleep.

If you want a simple rule: wake time fixed + caffeine cutoff + wind-down routine

If sleep problems are persistent or severe, it can be worth talking with a clinician—many issues are very treatable.

回复:实践中的更好睡眠

目标:让你的作息可预测,让环境足够无聊,以至于大脑放弃抵抗。

今晚(速效项):

  1. 睡前一小时把灯光调暗。
  2. 午饭后不再摄入咖啡因;酒精尽量少。
  3. 如果躺着睡不着,就起来做点安静的事,直到再次有困意。

日常基本功(影响最大):

  • 固定起床时间(周末也是)→ 锚定你的生物钟。
  • 早晨见光 5–10 分钟 → 帮助设定昼夜节律。
  • 房间凉爽、昏暗(风扇/眼罩)→ 更容易保持睡眠。

如果你只想要一条简单规则: 固定起床时间 + 咖啡因截止 + 睡前放松流程

如果睡眠问题持续存在或较严重,值得咨询临床医生——许多问题都是可以有效治疗的。

Instruction fine-tuning would provide the basic ability for models to respond reliably in the question-answering format, and RLHF is what takes these answers and crafts them into the reliable, warm, and engaging answers we now expect from language models.

指令微调能让模型稳定地以问答格式作答,而 RLHF 则把这些回答打磨成我们今天期待的那种可靠、温暖、有吸引力的样子。

Modern research has established RLHF as a general method to integrate subtle stylistic and related behavioral features into the models. An early, popular example of the utility of RLHF was in the application to safety [dai2023safe] [bai2022training], where RLHF enabled models to be both helpful and harmless across varied datasets. Compared to other techniques for post-training, such as instruction fine-tuning, RLHF generalizes far better across domains [kirk2023understanding] [chu2025sft] – helping create effective general-purpose models.

现代研究已经确立:RLHF 是一种把细微的风格特征及相关行为特征融入模型的通用方法。 RLHF 早期一个广为人知的用处是在安全领域的应用 [dai2023safe] [bai2022training]——RLHF 让模型能够在多样化的数据集上同时做到“有帮助”和“无害”。 与其它后训练技术(如指令微调)相比,RLHF 在不同领域之间的泛化性好得多 [kirk2023understanding] [chu2025sft]——这有助于造出有效的通用模型。

Intuitively, this can be seen in how the optimization techniques are applied. Instruction fine-tuning trains the model to predict the next token when the text preceding is close to examples it has seen. It is optimizing the model to more regularly output specific features in text. This is a per-token update.

从直观上看,这源于两种优化方式的差异。 指令微调训练模型:在当前文本与其见过的示例接近时,预测下一个词。 它是在优化模型,使其更规律地输出文本中的某些特征。这是逐 token 的更新。

RLHF on the other hand tunes completions on the response level rather than looking at the next token specifically. Additionally, it is telling the model what a better response looks like, rather than a specific response it should learn. RLHF also shows a model which types of responses it should avoid, i.e. negative feedback. The training to achieve this is often called a contrastive loss function (one whose loss is computed from the comparison between two or more examples, rather than from each example independently) and is referenced throughout this book.

而 RLHF 是在回复层面调整补全内容,而不是专门盯着下一个词。 此外,它告诉模型什么样的回复更好,而不是一个它必须学会的特定回复。 RLHF 还会向模型展示它应当避免哪些类型的回复,也就是负面反馈。 实现这一点的训练通常被称为对比式损失函数(其损失由两个或多个样本之间的比较算出,而不是由每个样本独立算出),本书会反复提到它。

While this flexibility is a major advantage of RLHF, it comes with implementation challenges. Largely, these center on how to control the optimization. As we will cover in this book, implementing RLHF often requires training a reward model, but best practices for doing so are not strongly established and depend on the area of application. With this, the optimization itself is prone to over-optimization because our reward signal is at best a proxy objective, requiring regularization. With these limitations, effective RLHF requires a strong starting point, so RLHF cannot be a solution to every problem alone and needs to be approached through a broader lens of post-training.

这种灵活性是 RLHF 的一大优势,但也带来了实现上的挑战。 这些挑战主要集中在如何控制优化。 正如本书将要展开的,实现 RLHF 往往需要训练一个奖励模型,但做这件事的最佳实践尚未牢固确立,且依赖于具体应用领域。 因此,优化本身容易发生过度优化(over-optimization),因为我们的奖励信号充其量只是一个代理目标,需要正则化来约束。 受限于此,有效的 RLHF 需要一个很强的起点——所以 RLHF 无法独自解决所有问题,必须放在后训练这一更宽广的视角下看待。

Due to this complexity, implementing RLHF is far more costly than simple instruction fine-tuning and can come with unexpected challenges such as length bias [singhal2023long] [park2024disentangling]. For model training efforts where absolute performance matters, RLHF is established as being crucial to achieving a strong fine-tuned model, but it is more expensive in compute, data costs, and time. Through the early history of RLHF after ChatGPT, there were many research papers that showed approximate solutions to RLHF via limited instruction fine-tuning, but as the literature matured it has been repeated time and again that RLHF and related methods are core stages of model performance that cannot be easily dispensed with.

由于这种复杂性,实现 RLHF 的成本远高于简单的指令微调,并且可能带来意料之外的麻烦,比如长度偏置(length bias)[singhal2023long] [park2024disentangling]。 对于追求绝对性能的模型训练工作而言,RLHF 已被确立为获得强劲微调模型的关键;但它在算力、数据成本和时间上都更昂贵。 在 ChatGPT 之后 RLHF 的早期历史中,有许多研究论文声称通过有限的指令微调就能近似达到 RLHF 的效果;但随着文献走向成熟,“RLHF 及相关方法是模型性能的核心阶段、无法轻易省去”这一点被一再证实。

Walkthrough of an RLHF Recipe

RLHF 配方实操走查

To set the stage for the book, it’s important to understand what “doing RLHF” can look like, as a minimal example, without any of the technical jargon that can be hard to grasp before solidifying fundamental intuitions. This section follows what is described as the canonical, three-stage RLHF recipe, as established with OpenAI’s InstructGPT model in 2022 [ouyang2022training].

为了给全书铺好台面,有必要先弄清“做 RLHF”在实际中是什么样子——用一个最小的例子,避开那些在直觉尚未牢固之前很难把握的技术术语。 本节沿用的,是 2022 年 OpenAI 的 InstructGPT 模型所确立的、被称为“经典三阶段 RLHF 配方”的做法 [ouyang2022training]。

The first step of the process is to transition the model from a base model that completes text to an instruction-following model that can operate in a question-answering format. This is done by using the same next-token prediction loss function on a set of carefully crafted datapoints where the model is shown only data in this question-answering format. After the model is shown these high-quality responses, the model can now be prompted with a specific sequence of tokens to know that it should answer any query with a more defined, assistant persona.

第一步,是把模型从“续写文本的基座模型”转变为“能以问答格式运作的指令跟随模型”。 做法是:在一批精心构造的数据上,使用与预训练相同的下一词预测损失——这些数据只以问答格式呈现给模型。 在让模型看过这些高质量回答之后,就可以用一段特定的 token 序列来提示模型,使它知道:面对任何提问,都应以一个更明确的“助手”人格来作答。

With this foundation of the shape of how the model should answer, the next two steps work together to improve the overall quality of the answers. These two steps serve to set up a problem where we can use reinforcement learning to update the model and make it more helpful.

有了模型应当如何作答的形态这一基础,接下来的两步共同作用,提升回答的整体质量。 这两步的作用,是把问题设置成可以用强化学习来更新模型、让它更有帮助的形式。

The first of these two steps is to train a reward model that captures human preferences. In order to apply reinforcement learning to a problem, you need a reward function that indicates quality. The goal of a reward model is to create a scalar signal that can then later be optimized with RL. In practice, this involves fine-tuning a language model (it is usually the same instruction-tuned model from the previous step) on a dataset of preference relations between pieces of text. This dataset is collected across a variety of prompts, model completions, and labelers to try and capture a robust signal of what is a better answer from a language model. The reward model learns which features in the text are better than others, so when it is used at inference-time (and during RL as the reward signal) it scores any piece of input text on how good it is.

这两步中的第一步,是训练一个捕捉人类偏好的奖励模型。 要把强化学习应用到某个问题上,你需要一个指示好坏的奖励函数。 奖励模型的目标是构造出一个标量信号,供之后用 RL 优化。 实践中,这相当于在一批“文本之间的偏好关系”数据上微调一个语言模型(通常就是上一步得到的那个指令微调模型)。 这份数据由多种提示、模型补全和标注者共同收集而来,力图捕捉一个稳健的信号:什么样的回答更好。 奖励模型学习文本中哪些特征优于另一些;于是在推理时(以及在 RL 中作为奖励信号时),它能对任意输入文本给出“有多好”的评分。

With these two pieces, a question-answering model and a reward model, we have everything we need to put together the pieces and actually do reinforcement learning from human feedback (RLHF). The actual RLHF stage proceeds by taking prompts representative of tasks the model should be good at, generating a bunch of completions, having the reward model rank them, and then using RL to figure out how to change the model and make it better. The basic primitive is that reinforcement learning is given a signal of which actions are good, in the form of tokens that a language model generates, and derives update rules that attribute different actions to different parameters in the model. The final RLHF stage shifts parameters to make good tokens more likely, and does so iteratively to maintain the general capabilities of the initial model.

有了这两样东西——一个问答模型和一个奖励模型——我们就具备了拼装起来、真正执行人类反馈强化学习(RLHF)所需的全部条件。 RLHF 阶段的实际流程是:取一批能代表模型应当擅长的任务的提示,生成一堆补全,让奖励模型给它们排序,然后用 RL 找出如何改动模型让它变得更好。 其基本原语是:强化学习获得“哪些动作是好的”这一信号(这里的“动作”就是语言模型生成的 token),并推导出把不同动作归因到模型不同参数的更新规则。 RLHF 的最后一个阶段就是移动参数,让好的 token 更可能出现,并且迭代地进行,以维持初始模型的通用能力。

Once RL is complete, and performance has saturated, this is often the final model served to the user.

当 RL 完成、性能趋于饱和,这通常就是最终交付给用户的模型。

Throughout this book, we’ll cover many recipes for how to do RLHF, and more related optimization methods that make up the broader suite of post-training. These all emerge to solve more challenging problems facing language models, and to make the strengths of the original RLHF approaches more powerful.

本书通篇会介绍许多种做 RLHF 的配方,以及构成后训练更广谱系的其它相关优化方法。 它们的出现,都是为了解决语言模型面临的更困难的挑战,并让原本 RLHF 方法的优势更加强大。

An Intuition for Post-Training

后训练的直觉理解

We’ve established that RLHF specifically and post-training generally are crucial to the performance of the latest models and how they change the models’ outputs, but not why RLHF works. Here’s a simple analogy for how so many gains can be made on benchmarks on top of any base model.

我们已经说明:RLHF 这一具体技术、以及后训练这一总范畴,对最新模型的性能及其输出方式的改变都至关重要——但还没有说明 RLHF 为什么有效。 这里给出一个简单的类比,来解释为什么在任何一个基座模型之上都能取得如此多的基准提升。

The way I’ve been describing the potential of post-training is called the elicitation interpretation of post-training, where all we are doing is extracting potential by amplifying valuable behaviors in the base model.

我对后训练潜力的这种描述方式,被称为后训练的激发式解读(elicitation interpretation)——我们所做的一切,就是通过放大基座模型中有价值的行为,把它的潜力激发出来。

To make this example click, we make the analogy between the base model – the language model that comes out of the large-scale, next-token prediction pretraining – and other foundational components in building complex systems. We use the example of the chassis of a car, which defines the space around which a car can be built. Consider Formula 1 (F1): most teams begin each year with a new chassis and engine. Then, they spend all year on aerodynamics and systems changes (of course, it is a minor oversimplification), and can dramatically improve the performance of the car. The best F1 teams improve far more during a season than chassis-to-chassis.

为了让这个比喻更直观,我们把基座模型——由大规模下一词预测预训练得到的语言模型——类比为建造复杂系统时的其它基础部件。这里用车架来打比方,车架定义了“一台车能被造出来的空间边界”。 想想一级方程式(F1):大多数车队每年都从全新的车架和引擎开始。然后他们把整年时间花在空气动力学和系统改动上(这当然是一种简化),从而可以大幅提升赛车性能。最好的 F1 车队在一个赛季内取得的提升,远超换车架带来的提升。

The same is true for post-training, where one can extract a ton of performance out of a static base model as they learn more about its quirks and tendencies. The best post-training teams extract a ton of performance in a very short time frame. The set of techniques includes everything close to and after the end of pretraining: “mid-training” like annealing / high-quality end of pretraining web data, instruction tuning, RLVR, preference-tuning, etc. A good example is the change from the first version of the Allen Institute for AI’s fully-open, small Mixture-of-Experts (MoE) model OLMoE Instruct to the second. The first model was released in the fall of 2024 [muennighoff2024olmoe], and with the second version only updating the post-training, the evaluation average on popular benchmarks went from 35 to 48 without changing the majority of pretraining [ai2_olmoe_ios_2025].

后训练也是如此:随着人们越来越了解某个静态基座模型的脾性与倾向,就能从中榨出大量性能。最好的后训练团队能在极短时间内榨出大量性能。这套技术涵盖了预训练末期及其之后的全部环节:“中期训练”(mid-training,例如退火、预训练末期的高质量网页数据)、指令微调、RLVR、偏好微调等等。一个很好的例子是 Allen Institute for AI 的全开源小型专家混合(MoE)模型 OLMoE Instruct,从第一版到第二版的变化。第一版发布于 2024 年秋 [muennighoff2024olmoe];第二版只更新了后训练,预训练主体未变,而主流基准上的评测均值就从 35 提升到了 48 [ai2_olmoe_ios_2025]。

The idea is that there is a lot of intelligence and ability within base models, but because they can only answer in next-token prediction and not question-answering format, it takes a lot of work building around them, through post-training, in order to make excellent final models.

这个想法的要点是:基座模型内部蕴含着大量智能与能力,但由于它只会以“下一词预测”而不是“问答”的方式作答,所以需要在它周围做大量工作——也就是后训练——才能造出优秀的最终模型。

Then, when you look at models such as OpenAI’s GPT-4.5 released in February 2025, which was largely a failure of a consumer product due to being too large of a base model to serve to millions of users, you can see this as a far more dynamic and exciting base for OpenAI to build onto. With this intuition, base models determine the vast majority of the potential of a final model, and post-training’s job is to cultivate all of it.

再看 OpenAI 于 2025 年 2 月发布的 GPT-4.5:它作为消费级产品基本上是失败的,因为基座模型太大,无法服务于数百万用户;但你可以把它视为一个远更有活力、更令 OpenAI 兴奋的构建基础。 按这个直觉,基座模型决定了最终模型潜力的绝大部分,而后训练的职责就是把它全部培育出来。

I’ve described this intuition as the Elicitation Theory of Post-training. This theory folds in with the reality that the majority of gains users are seeing are from post-training because it implies that there is more latent potential in a model pretrained on the internet than we can simply teach the model — such as by passing certain narrow samples in repeatedly during early types of post-training (i.e. only instruction tuning). The challenge of post-training is to reshape models from next-token prediction to conversation question-answering, while extracting all of this knowledge and intelligence from pretraining.

我把这一直觉称为后训练的激发理论(Elicitation Theory of Post-training)。 这一理论与一个现实相吻合:用户看到的性能提升,大部分来自后训练。因为它意味着,一个在互联网上预训练出来的模型,其潜在能力比我们单纯“教”给它的更多——后者例如在早期后训练(即只做指令微调)阶段反复投喂某些窄分布的样本。 后训练的挑战在于:把模型从“下一词预测”重新塑造成“对话问答”,同时把预训练获得的全部知识与智能提取出来。

A related idea to this theory is the Superficial Alignment Hypothesis, coined in the paper LIMA: Less is More for Alignment [zhou2023lima]. This paper is getting some important intuitions right but for the wrong reasons in the big picture. The authors state:

与此相关的一个想法,是论文 LIMA: Less is More for Alignment 提出的表层对齐假说(Superficial Alignment Hypothesis)[zhou2023lima]。这篇论文在细节上抓住了一些重要直觉,但从大局来看,它的理由找错了。作者写道:

A model’s knowledge and capabilities are learnt almost entirely during pretraining, while alignment teaches it which subdistribution of formats should be used when interacting with users. If this hypothesis is correct, and alignment is largely about learning style, then a corollary of the Superficial Alignment Hypothesis is that one could sufficiently tune a pretrained language model with a rather small set of examples.

模型的知识与能力几乎完全是在预训练期间学到的,而对齐教给它的只是:在与用户交互时应当使用哪种格式的子分布。如果这一假说成立——即对齐大体上关乎风格学习——那么表层对齐假说的一个推论就是:可以用相当少的样本,把预训练语言模型调得足够好。

All of the successes of deep learning should have taught you that scaling data is important to performance. Here, the major difference is that the authors are discussing alignment and style, the focus of academic post-training at the time. With a few thousand samples for instruction fine-tuning, you can change a model substantially and improve a narrow set of evaluations, such as AlpacaEval, MT-Bench, Arena (formerly Chatbot Arena, a platform where users compare anonymous model responses head-to-head), and the like. These do not always translate to more challenging capabilities, which is why Meta wouldn’t train its Llama Chat models on just this dataset. Academic results have lessons, but need to be interpreted carefully if you are trying to understand the big picture of the technological arc.

深度学习的所有成功经验本应告诉你:扩展数据规模对性能至关重要。这里的重大差异在于,作者讨论的是对齐与风格——也就是当时学术界后训练的焦点。用几千条指令微调样本,确实能大幅改变一个模型,并提升某一小类评测的表现,比如 AlpacaEval、MT-Bench、Arena(前身为 Chatbot Arena,一个让用户对匿名模型回答进行两两比较的平台)等等。但这些提升并不总能转化为更困难的能力——这也是为什么 Meta 不会仅用这个数据集去训练它的 Llama Chat 模型。学术成果有它的教益,但如果你要理解整个技术演进的大图景,就必须谨慎解读。

What this paper is showing is that you can change models substantially with a few samples. We knew this, and it is important to the short-term adaptation of new models, but their argument for performance leaves the casual readers with the wrong lessons.

这篇论文真正说明的是:用少量样本就能显著改变模型。 这一点我们早就知道,它对模型的短期适配也很重要;但它关于性能的论证,会给随意浏览的读者留下错误的结论。

If we change the data, the impact could be far higher on the model’s performance and behavior, but it is far from “superficial.” Base language models today (with no post-training) can be trained on some mathematics problems with reinforcement learning, learn to output full chain-of-thought reasoning, and then score higher on a full suite of reasoning evaluations like BigBenchHard, Zebra Logic, AIME, etc.

如果换掉数据,对模型性能和行为的影响可能大得多,而且远谈不上“表层”。今天的基座语言模型(不做任何后训练)可以在一些数学题上用强化学习训练,学会输出完整的思维链推理,进而在 BigBenchHard、Zebra Logic、AIME 等一整套推理评测上取得更高分。

The superficial alignment hypothesis is wrong for the same reason that people who think RLHF and post-training are just for vibes are still wrong. This was a field-wide lesson we had to overcome in 2023 (although many AI observers are still rooted in this belief). Post-training has far outgrown that, and we are coming to see that the style of models operates on top of behavior — such as the now popular long chain of thought.

表层对齐假说之所以是错的,和“认为 RLHF 与后训练只是在调语气”的人之所以是错的一样。 这是我们在 2023 年不得不跨过的、整个领域的教训(尽管许多 AI 观察者仍固守这一信念)。 后训练早已远远超出那个阶段,我们正逐渐认识到:模型的风格运行在行为之上——比如如今流行的长思维链。

As the AI community shifts post-training further into the era of agentic and reasoning models, the superficial alignment hypothesis breaks down further. RL methods are becoming an increasingly large share of the compute needed to train frontier language models. In the short time since reinforcement learning with verifiable rewards (RLVR) was coined in our work on Tülu 3 in the fall of 2024 [lambert2024t], the scale of compute used for post-training has grown dramatically. DeepSeek R1, famous for popularizing RLVR, used only about 5% of their overall compute in post-training – 147K H800 GPU hours for RL training on R1 [guo2025deepseek], relative to 2.8M GPU hours for pretraining the underlying DeepSeek V3 base model [deepseekai2025deepseekv3technicalreport].

随着 AI 社区把后训练进一步推向智能体与推理模型的时代,表层对齐假说会进一步瓦解。 RL 方法在前沿语言模型训练所需算力中所占的份额正越来越大。 自从“可验证奖励的强化学习”(RLVR)在我们 2024 年秋的 Tülu 3 工作中被提出以来 [lambert2024t],后训练所用的算力规模已急剧增长。 因普及 RLVR 而闻名的 DeepSeek R1,后训练只占其总计算量的约 5%——R1 的 RL 训练用了 147K H800 GPU 小时 [guo2025deepseek],而预训练底层的 DeepSeek V3 基座模型用了 2.8M GPU 小时 [deepseekai2025deepseekv3technicalreport]。

The science studying the core methods of scaling RL as of 2026 shows that individual ablation runs can take 10-100K GPU hours [khatri2025art], the equivalent of the compute used for the RL stage of Olmo 3.1 Think 32B (released in November of 2025), which trained for 4 weeks on 200 GPUs [teamolmo2025olmo3]. The science of scaled post-training is in its very early stages as of 2026, adopting ideas and methods from pretraining language models and applying them in this new domain, so the exact GPU hours used will change, but the trend of increased compute on post-training will continue. Altogether, the elicitation theory of post-training is likely to become the correct view only when applying a lighter post-training recipe – something useful for specializing a model – relative to the compute-intensive frontier models.

截至 2026 年,研究 RL 扩展核心方法的科学表明:单次消融实验就可能消耗 10–100K GPU 小时 [khatri2025art]——相当于 Olmo 3.1 Think 32B(2025 年 11 月发布)RL 阶段所用的算力,后者在 200 张 GPU 上训练了 4 周 [teamolmo2025olmo3]。 截至 2026 年,规模化的后训练科学仍处于极早期,它借鉴预训练语言模型的思想与方法,并将其应用到这一新领域;因此具体的 GPU 小时数还会变化,但后训练算力持续增长的趋势会延续下去。 总体而言,后训练的激发理论,可能只有在采用较轻量后训练配方时才成立——也就是那些用于把模型专门化的做法——相对于算力密集型的前沿模型而言。

How We Got Here

我们如何走到今天

Why does this book make sense now? How much will change in the future?

为什么这本书在现在这个时候有意义?未来会有多少变化?

Post-training, the craft of eliciting powerful behaviors from a raw pretrained language model, has gone through many seasons and moods since the release of ChatGPT that sparked the renewed interest in RLHF. In the era of Alpaca [alpaca], Vicuna [vicuna2023], Koala [koala_blogpost_2023], and Dolly [DatabricksBlog2023DollyV1], a limited number of human datapoints with extended synthetic data in the style of Self-Instruct were used to fine-tune the original LLaMA to get similar behavior to ChatGPT. The benchmark for these early models was fully vibes (and human evaluation) as we were all so captivated by the fact that these small models can have such impressive behaviors across domains. It was justified excitement.

后训练——从原始预训练语言模型中激发强大行为的手艺——自 ChatGPT 发布(引发了 RLHF 的新一轮热度)以来,已经经历了许多季节与情绪。 在 Alpaca [alpaca]、Vicuna [vicuna2023]、Koala [koala_blogpost_2023] 和 Dolly [DatabricksBlog2023DollyV1] 的时代,人们用有限的人类数据点,加上大量 Self-Instruct 风格的合成数据,去微调最初的 LLaMA,使其表现出与 ChatGPT 相似的行为。 这些早期模型的评判标准完全靠感觉(以及人工评估)——因为我们都被“这些小模型竟然能在各个领域展现出如此惊人的行为”这一点迷住了。 那份兴奋是合理的。

Open post-training was moving faster, releasing more models, and making more noise than its closed counterparts. Companies were scrambling, e.g. DeepMind merging with Google Brain or new labs being started, and taking time to follow it up. There are phases of open recipes surging and then lagging behind.

开放后训练跑得比闭源同行更快、发布的模型更多、声量也更大。 公司们则在仓促应对,例如 DeepMind 与 Google Brain 的合并、或新实验室的创立,都需要时间跟上。 开放配方经历过“猛冲然后落后”的阶段。

The era following Alpaca et al., the first lag in open recipes, was one defined by skepticism and doubt about reinforcement learning from human feedback (RLHF), the technique OpenAI highlighted as crucial to the success of the first ChatGPT. Many companies doubted that they needed to do RLHF. A common phrase – “instruction tuning is enough for alignment” – was so popular then that it still carries weight today despite obvious evidence against it.

继 Alpaca 等之后的那段时期,是开放配方的第一次落后,其标志是对人类反馈强化学习(RLHF)的怀疑与质疑——而 RLHF 正是 OpenAI 强调的、让初代 ChatGPT 取得成功的关键技术。 许多公司怀疑自己是否需要做 RLHF。 当时“指令微调就足以完成对齐”这句话非常流行,以至于尽管有明显反证,它至今仍有余威。

This doubt about RLHF lasted, especially in the open where groups cannot afford data budgets on the order of $100K to $1M. The companies that embraced it early ended up winning out. Anthropic published extensive research on RLHF through 2022 and now has arguably the best post-training [askell2021general] [bai2022training] [bai2022constitutional]. The delta between open groups, struggling to reproduce or even know of basic closed techniques, and leading closed models is a common theme.

这种对 RLHF 的怀疑持续了相当长一段时间,尤其是在开放社区——那里的团队负担不起 10 万到 100 万美元量级的数据预算。 而那些早早拥抱它的公司最终胜出。 Anthropic 在整个 2022 年发表了大量 RLHF 研究,如今拥有可以说是最好的后训练 [askell2021general] [bai2022training] [bai2022constitutional]。 开放团队在艰难地复现、甚至只是知晓闭源基础技术方面的挣扎,与领先闭源模型之间的差距,是一个反复出现的主题。

The first shift in open alignment methods and post-training was the story of Direct Preference Optimization (DPO) [rafailov2024direct], which showed that you can solve the same optimization problem as RLHF with fewer moving parts by taking gradient steps directly on pairwise preference data. The DPO paper, posted in May of 2023, didn’t have any clearly impactful models trained with it through the fall of 2023. This changed with the releases of a few breakthrough DPO models – all contingent on finding a better, lower learning rate. Zephyr-Beta [tunstall2023zephyr], Tülu 2 [ivison2023camels], and many other models showed that the DPO era of post-training had begun. Chris Manning literally thanked me for “saving DPO.”

开放对齐方法与后训练的第一次转向,是直接偏好优化(DPO)的故事 [rafailov2024direct]:它表明,你可以直接在成对偏好数据上做梯度更新,从而用更少的活动部件解决与 RLHF 相同的优化问题。 DPO 论文于 2023 年 5 月发表,但直到 2023 年秋,都没有出现明显有影响力的、用它训练出来的模型。 这一局面随着几个突破性的 DPO 模型发布而改变——而它们全都取决于找到了一个更好的、更低的学习率。 Zephyr-Beta [tunstall2023zephyr]、Tülu 2 [ivison2023camels] 以及许多其他模型表明:后训练的 DPO 时代已经开启。 Chris Manning 甚至真的感谢我“拯救了 DPO”。

Preference-tuning was something you needed to do to meet the table stakes of releasing a good model since late 2023. The DPO era continued through 2024, in the form of never-ending variants on the algorithm, but we were very far into another slump in open recipes. Open post-training recipes had saturated the extent of knowledge and resources available.
A year after Zephyr and Tülu 2, the same breakout dataset, UltraFeedback is arguably still state-of-the-art for preference tuning in open recipes [cui2023ultrafeedback].

自 2023 年末起,偏好微调成了发布一个像样模型的最低门槛。 DPO 时代延续到 2024 年,表现为这个算法上无穷无尽的变体;但我们已经深深走入开放配方的又一次低谷。 开放后训练配方,已经把可获得的知识与资源用到了极限。 在 Zephyr 和 Tülu 2 一年之后,同一个突破性数据集 UltraFeedback,在开放配方的偏好微调中可以说仍属最先进水平 [cui2023ultrafeedback]。

At the same time, the Llama 3.1 [dubey2024llama] and Nemotron 4 340B [adler2024nemotron] reports gave us substantive hints that large-scale post-training is much more complex and impactful. The closed labs are doing full post-training – a large multi-stage process of instruction tuning, RLHF, prompt design, etc. – where academic papers are just scratching the surface. Tülu 3 represented a comprehensive, open effort to build the foundation of future academic post-training research [lambert2024t].

与此同时,Llama 3.1 [dubey2024llama] 和 Nemotron 4 340B [adler2024nemotron] 的技术报告给了我们实质性的提示:大规模后训练要复杂得多、影响也大得多。 闭源实验室在做完整的后训练——一个由指令微调、RLHF、提示词设计等构成的大型多阶段流程——而学术论文只是触及了表面。 Tülu 3 代表了一次全面的公开努力,为未来的学术后训练研究打下基础 [lambert2024t]。

Post-training is a complex process involving the aforementioned training objectives applied in various orders to target specific capabilities. This book is designed to provide a platform for understanding all of these techniques, and as the field matures the best practices for how to interleave them will emerge.

后训练是一个复杂的过程,要按不同顺序施加前述各种训练目标,以针对特定能力。 本书旨在提供一个理解这全部技术的平台;随着领域成熟,“如何交错使用它们”的最佳实践也会逐渐浮现。

The primary areas of innovation in post-training are now in reinforcement learning with verifiable rewards (RLVR), reasoning training generally, and related ideas. These newer methods build extensively on the infrastructure and ideas of RLHF, but are evolving far faster. This book is written to capture the first stable literature for RLHF after its initial period of rapid change.

后训练当前的创新主战场,是可验证奖励的强化学习(RLVR)、广义的推理训练,以及相关想法。 这些较新的方法大量建立在 RLHF 的基础设施与思想之上,但演化快得多。 本书写作的目的,是在 RLHF 经历最初的高速变化之后,为其第一份稳定的文献留下记录。

Scope of This Book

本书范围

This book hopes to touch on each of the core steps of doing canonical RLHF implementations. It will not cover all the history of the components nor recent research methods, just techniques, problems, and trade-offs that have been proven to occur again and again.

本书希望涉及完成经典 RLHF 实现的每一个核心步骤。 它不会覆盖这些组件的全部历史,也不会覆盖最近的研究方法,只讲那些已被反复证实的技术、问题与权衡。

Chapter Summaries

章节概览

This book has the following chapters:

本书包含以下章节:

Introductions

导引

Reference material and context useful throughout the book.

全书通用的参考资料与背景。

  1. Introduction: Overview of RLHF and what this book provides.
  2. A Tiny History of RLHF: Key models and papers in the history of RLHF techniques.
  3. Training Overview: How the training objective for RLHF is designed and basics of understanding it.
  1. 引言:RLHF 的总览,以及本书提供了什么。
  2. RLHF 简史:RLHF 技术史上的关键模型与论文。
  3. 训练总览:RLHF 的训练目标如何设计,以及理解它的基础。

Core Training Pipeline

核心训练流程

The suite of techniques used to optimize language models to align them to human preferences.

用于优化语言模型、使其与人类偏好对齐的一整套技术。

  1. Instruction Fine-Tuning: Adapting language models to the question-answer format.
  2. Reward Modeling: Training reward models from preference data that act as an optimization target for RL training (or for use in data filtering).
  3. Reinforcement Learning: The core RL techniques used to optimize reward models (and other signals) throughout RLHF.
  4. Reasoning and Inference-Time Scaling: The role of new RL training methods for inference-time scaling with respect to post-training and RLHF.
  5. Direct-Alignment Algorithms: Algorithms that optimize the RLHF objective directly from pairwise preference data rather than learning a reward model first.
  6. Rejection Sampling: A basic technique for using a reward model with instruction tuning to align models.
  1. 指令微调:让语言模型适应问答格式。
  2. 奖励建模:从偏好数据训练奖励模型,它可作为 RL 训练的优化目标(或用于数据筛选)。
  3. 强化学习:在 RLHF 全过程中用于优化奖励模型(及其它信号)的核心 RL 技术。
  4. 推理与推理时扩展:新的 RL 训练方法在推理时扩展上相对于后训练和 RLHF 的作用。
  5. 直接对齐算法:不先学奖励模型,而是直接从成对偏好数据优化 RLHF 目标的算法。
  6. 拒绝采样:结合奖励模型与指令微调来对齐模型的一项基础技术。

Data & Preferences

数据与偏好

Context for the data that fuels RLHF and the big picture problem it is trying to solve.

驱动 RLHF 的数据背景,以及它试图解决的大图景问题。

  1. The Nature of Preferences: Why human preference data is needed to fuel and understand RLHF.
  2. Preference Data: How preference data is collected for RLHF.
  3. Synthetic Data: The shift away from human to synthetic data, how AI feedback works, and how distilling from other models is used.
  4. Tool Use and Function Calling: The basics of training models to call functions or tools in their outputs.
  1. 偏好的本质:为什么需要人类偏好数据来驱动并理解 RLHF。
  2. 偏好数据:如何为 RLHF 收集偏好数据。
  3. 合成数据:从人类数据向合成数据的转移、AI 反馈如何工作,以及如何从其他模型蒸馏。
  4. 工具使用与函数调用:训练模型在其输出中调用函数或工具的基础。

Practical Considerations

实践考量

Fundamental problems and discussions for implementing and evaluating RLHF.

实现与评估 RLHF 时的根本问题与讨论。

  1. Over-Optimization: Qualitative observations of why RLHF goes wrong and why over-optimization is inevitable with a soft optimization target in reward models.
  2. Regularization: Tools to constrain these optimization tools to effective regions of the parameter space.
  3. Evaluation: The ever evolving role of evaluation (and prompting) in language models.
  4. Crafting Model Character and Products: How RLHF is shifting in its applicability as major AI laboratories use it to subtly match their models to their products.
  1. 过度优化:对 RLHF 为何出错的定性观察,以及为什么在奖励模型这种“软”优化目标下过度优化不可避免。
  2. 正则化:把优化工具约束在参数空间有效区域内的手段。
  3. 评估:评估(以及提示词)在语言模型中不断演变的作用。
  4. 塑造模型性格与产品:随着各大 AI 实验室用它来微妙地匹配自家产品,RLHF 的适用范围正在如何变化。

Appendices

附录

Reference material for definitions and extended discussions.

定义与扩展讨论的参考资料。

  • Appendix A - Definitions: Mathematical definitions for RL, language modeling, and other ML techniques leveraged in this book.
  • Appendix B - Beyond “Just Style”: How RLHF is often underestimated in its role in improving the user experience of models due to the crucial role that style plays in information sharing.
  • 附录 A - 定义:本书用到的 RL、语言建模及其他 ML 技术的数学定义。
  • 附录 B - 超越“只是风格”:由于风格在信息传递中扮演关键角色,RLHF 在提升模型用户体验方面的作用常被低估。

Target Audience

目标读者

This book is intended for audiences with entry level experience with language modeling, reinforcement learning, and general machine learning. It will not have exhaustive documentation for all the techniques, but just those crucial to understanding RLHF.

本书面向的是在语言建模、强化学习和通用机器学习方面具备入门级经验的读者。 它不会为所有技术提供详尽的文档,只覆盖理解 RLHF 所必需的部分。

How to Use This Book

如何使用本书

This book was largely created because there were no canonical references for important topics in the RLHF workflow. Given the pace of progress on LLMs overall, combined with the complex nature of collecting and using human data, RLHF is an unusually academic field where published results are often noisy and hard to reproduce across multiple settings. To develop strong intuitions, readers are encouraged to read multiple papers on each topic rather than taking any single result as definitive. To facilitate this, the book includes numerous, academic-style citations to the canonical reference for a claim.

本书的诞生,很大程度上是因为 RLHF 工作流中的若干重要主题缺乏规范参考。 考虑到 LLM 整体的进步速度,再加上收集与使用人类数据本身的复杂性,RLHF 是一个异常“学术化”的领域:已发表的结果常常噪声很大,且难以在多种设定下复现。 为培养牢固的直觉,建议读者就每个主题多读几篇论文,而不是把任何单一结果当作定论。 为便于做到这一点,本书为每个论断都附上了学术风格的引用,指向其规范来源。

The contributions of this book are supposed to give you the minimum knowledge needed to try a toy implementation or dive into the literature. This is not a comprehensive textbook, but rather a quick book for reminders and getting started.

本书的贡献,是给你“尝试一个玩具实现、或深入文献”所需的最低限度知识。 这不是一本面面俱到的教科书,而是一本用于提醒与快速上手的速览小书。

The print edition of this book was published by Manning in July 2026, while the web version continues to collect minor improvements and errata fixes. If you spot a typo or an important omission, please contribute a fix or suggestion on GitHub.

本书的纸质版由 Manning 于 2026 年 7 月出版,而网络版会持续收录小幅改进与勘误修正。如果你发现错别字或重要遗漏,欢迎在 GitHub 上提交修复或建议。

About the Author

关于作者

Dr. Nathan Lambert is a researcher and writer focusing on building the open science of language models. He came here through a Ph.D. in robotics and building an RLHF team shortly after the release of ChatGPT. He has released many models trained with RLHF, their subsequent datasets, and training codebases in his time at the Allen Institute for AI (Ai2) and Hugging Face. Examples include Zephyr-Beta, Tülu 2, OLMo, TRL, Open Instruct, and many more. He has written extensively on RLHF, including many blog posts and academic papers.

Nathan Lambert 博士是一位研究者与写作者,专注于构建语言模型的开放科学。他拥有机器人学博士学位,在 ChatGPT 发布后不久组建了一个 RLHF 团队,由此走上这条路。 在 Allen Institute for AI(Ai2)和 Hugging Face 期间,他发布了许多用 RLHF 训练的模型,以及配套的数据集和训练代码库。 例如 Zephyr-Beta、Tülu 2、OLMo、TRL、Open Instruct 等。 他就 RLHF 写过大量内容,包括许多博客文章和学术论文。

Future of RLHF

RLHF 的未来

With the investment in language modeling, many variations on the traditional RLHF methods emerged. RLHF colloquially has become synonymous with multiple overlapping approaches. RLHF is a subset of preference fine-tuning (PreFT) techniques, including Direct Alignment Algorithms (See Chapter 8), which are the class of methods downstream of DPO that solve the preference learning problem by taking gradient steps directly on preference data, rather than learning an intermediate reward model. RLHF is the tool most associated with rapid progress in “post-training” of language models, which encompasses all training after the large-scale autoregressive training on primarily web data. This textbook is a broad overview of RLHF and its directly neighboring methods, such as instruction tuning and other implementation details needed to set up a model for RLHF training.

随着对语言建模的持续投入,传统 RLHF 方法衍生出许多变体。 口语上的 RLHF,已经变成多种相互重叠的方法的同义词。 RLHF 是偏好微调(PreFT)技术的一个子集,后者还包括直接对齐算法(见第 8 章)——即 DPO 之后那一类方法:直接在偏好数据上做梯度更新来解决偏好学习问题,而不训练中间的奖励模型。 RLHF 是与语言模型“后训练”快速进展关联最紧密的工具;而后训练涵盖了在主要以网页数据做大规模自回归训练之后的所有训练。 本教材是对 RLHF 及其直接邻近方法(如指令微调)的宽泛概览,也包括为开展 RLHF 训练而搭建模型所需的其它实现细节。

As more successes of fine-tuning language models with RL emerge, such as OpenAI’s o1 reasoning models, RLHF will be seen as the bridge that enabled further investment of RL methods for fine-tuning large base models. At the same time, while the spotlight of focus may be more intense on the RL portion of RLHF in the near future – as a way to maximize performance on valuable tasks – the core of RLHF is that it is a lens for studying the grand problems facing modern forms of AI. How do we map the complexities of human values and objectives into systems we use on a regular basis? This book hopes to be the foundation of decades of research and lessons on these problems.

随着用 RL 微调语言模型的成功案例不断涌现——例如 OpenAI 的 o1 推理模型——RLHF 将被视为那座桥梁:它促成了后续对“用 RL 方法微调大型基座模型”的更多投入。 与此同时,尽管在不久的将来,聚光灯可能更强烈地打在 RLHF 中“RL”这一部分上——把它当作在重要任务上最大化性能的手段——但 RLHF 的核心意义在于:它是一面透镜,用来研究现代形态 AI 所面临的宏大问题。 我们如何把人类价值与目标的复杂性,映射到我们日常使用的系统之中? 本书希望成为围绕这些问题、未来数十年研究与教训的基石。

讨论

用 GitHub 账号留言;评论保存在公开仓库chengshu-blog-discussions的 Discussions 里。也可通过 RSS 订阅后续文章。