← 返回首页
READING NOTE / 020完整原文 · 分块对照

I have been fine-tuning LLMs for over 2 years now!

我微调大语言模型已经两年多了!

490 个英文词 · 2 个原文块 · 0 张保存图片

总结

作者表示,自己微调大语言模型已有两年多,并列出如果重新学习,将优先掌握的15种技术,包括LoRA、QLoRA、前缀调优、适配器调优、指令调优、P-tuning、BitFit、软提示、多任务微调和联邦微调等。文中还介绍了RLHF、RLAIF、DPO、GRPO与RLVR等偏好优化或强化学习方法;其中部分效果、成本和应用描述是作者的概括性判断。

作者特别说明,GRPO需要每个回答对应一个标量奖励。对于数学和代码任务,RLVR可通过检查器或编译器生成可验证分数;但RAG回答、客服回复和摘要等任务通常没有可直接匹配的标准答案。常见替代方案是手写奖励函数,用于评估忠实度、幻觉和完整性。

作者认为,手写奖励函数需要数日校准,权重不当可能鼓励错误行为,并且在增加工具或修改系统提示时容易失效。作者随后介绍RULER,并称其已在OpenPipe的开源ART中实现:训练时,系统将多个采样轨迹交给评判模型,让其依据智能体系统提示进行相对排序并返回分数;作者认为,相对排序比绝对评分更稳定,且可配合GRPO的组内归一化直接进入训练流程。

作者提供了ART的GitHub仓库链接(https://github.com/OpenPipe/ART),并称自己近期写过一篇包含训练循环和代码的完整解析,邀请读者继续阅读。

  • 大语言模型微调
  • 参数高效微调
  • 强化学习与偏好优化
  • GRPO与RLVR
  • RULER/ART

英文原文 01

237 词

I have been fine-tuning LLMs for over 2 years now!

Here are the top 15 techniques I'd learn if I were to fine-tune them:

Bookmark this.

1. LoRA > Freezes the base weights and trains two low-rank matrices as the update, resulting in ~95-99% fewer params to fine-tune.

2. QLoRA > LoRA on top of a 4-bit quantized base model.

3. Prefix tuning > Prepends trainable vectors to keys and values at every layer, weights frozen.

4. Adapter tuning > Inserts small trainable modules between transformer layers.

5. Instruction tuning > Supervised tuning on (instruction, response) pairs so the model follows directions instead of just continuing text.

6. P-tuning > Optimizes continuous prompt embeddings through a small encoder, mainly for NLU tasks where discrete prompts are unstable.

7. BitFit > Trains only the bias terms, ~0.08% of params, and still rivals full fine-tuning on small-to-medium datasets.

8. Soft prompts > Steer a frozen model with learned vectors instead of handcrafted tokens.

9. RLHF > Train a reward model on human preference rankings, then PPO against it. The pipeline behind the first ChatGPT.

10. RLAIF > Swaps the human labeler for an LLM judging. RLHF-level quality at a fraction of the cost.

11. DPO (Direct Preference Optimization) > Skips the reward model and optimizes preference pairs directly with a classification-style loss. Simpler than PPO.

12. GRPO (Group Relative Policy Optimization) > Samples a group of responses per prompt and normalizes their rewards within the group. DeepSeek R1 ran on it.

中文译文 01

461 字

我从事 LLM 微调已经超过两年了!

如果要微调这些模型,以下是我会学习的 15 项顶尖技术:

收藏这篇内容。

1. LoRA > 冻结基础模型的权重,并训练两个低秩矩阵作为更新,从而使需要微调的参数减少约 95%–99%。

2. QLoRA > 在 4 位量化的基础模型上使用 LoRA。

3. Prefix tuning(前缀调优) > 在每一层的键和值前面添加可训练向量,同时冻结权重。

4. Adapter tuning(适配器调优) > 在 Transformer 层之间插入小型可训练模块。

5. Instruction tuning(指令调优) > 在(指令、回答)对上进行监督式调优,使模型遵循指令,而不只是续写文本。

6. P-tuning > 通过一个小型编码器优化连续提示嵌入,主要用于离散提示不稳定的自然语言理解任务。

7. BitFit > 只训练偏置项,约占参数量的 0.08%,在中小型数据集上仍可媲美全量微调。

8. Soft prompts(软提示) > 使用学习得到的向量,而不是手工设计的词元,来引导被冻结的模型。

9. RLHF(基于人类反馈的强化学习) > 根据人类偏好排序训练奖励模型,然后以此为依据使用 PPO 进行训练。首个 ChatGPT 背后的流程。

10. RLAIF(基于 AI 反馈的强化学习) > 用负责评判的 LLM 替代人工标注者。以一小部分成本达到 RLHF 级别的质量。

11. DPO(直接偏好优化) > 跳过奖励模型,使用类似分类损失的目标函数直接优化偏好对。比 PPO 更简单。

12. GRPO(群组相对策略优化) > 针对每个提示采样一组回答,并在组内对它们的奖励进行归一化。DeepSeek R1 使用了它。

英文原文 02

253 词

13. RLVR (Reinforcement Learning with Verifiable Rewards) > Replaces the learned reward model with a checker or compiler returning verifiable scores. The free signal behind R1's math and code.

14. Multi-task fine-tuning > Trains on several tasks at once, so one model generalizes and shares representations instead of overfitting to one objective.

15. Federated fine-tuning > Tunes across decentralized clients that share only weight updates, never raw data. For when data can't leave the device.

GRPO needs exactly one scalar reward per response. RLVR (13) produces that for free on math and code by running the answer through a checker or compiler.

But tasks like a RAG answer, a support reply, or a summary have no gold label to match against.

The usual fallback is a hand-written reward function scoring faithfulness, hallucination, and completeness.

It takes days to calibrate, rewards the wrong behavior when the weights are off, and breaks every time you add a tool or edit the system prompt.

RULER, implemented in OpenPipe's ART (open-source), solves this.

During training, it passes the N sampled trajectories to a judge LLM, which ranks them relative to each other against the agent's system prompt and returns the scores.

Relative ranking is more stable than absolute scoring, and GRPO normalizes within the group anyway, so the rankings feed straight into the pipeline like with RLVR.

Here's the GitHub Repo: https://github.com/OpenPipe/ART

(don't forget to star it ⭐ )

I wrote a full breakdown recently on how exactly this works, with the training loop and code.

Read it below.

中文译文 02

488 字

13. RLVR(基于可验证奖励的强化学习) > 用返回可验证分数的检查器或编译器替代学习得到的奖励模型。R1 的数学和代码能力背后的免费信号。

14. Multi-task fine-tuning(多任务微调) > 同时在多个任务上训练,使一个模型能够泛化并共享表示,而不是对单一目标过拟合。

15. Federated fine-tuning(联邦微调) > 在去中心化客户端之间进行调优,客户端只共享权重更新,从不共享原始数据。适用于数据不能离开设备的情况。

GRPO 每个回答恰好需要一个标量奖励。RLVR(第 13 项)可以在数学和代码任务上免费产生这一奖励:将答案交给检查器或编译器运行。

但像 RAG 回答、客服回复或摘要这样的任务,没有可以用来比对的标准答案标签。

通常的后备方案是编写奖励函数,根据忠实性、幻觉和完整性进行评分。

校准它需要数天;当权重设置不当时,它会奖励错误行为;而且每次添加工具或修改系统提示时,它都会失效。

OpenPipe 的 ART(开源项目)中实现的 RULER 解决了这个问题。

训练期间,它会将 N 条采样轨迹交给一个评判 LLM,让该模型根据智能体的系统提示对这些轨迹进行相对排名,并返回分数。

相对排名比绝对评分更稳定,而且 GRPO 无论如何都会在组内进行归一化,因此这些排名会像 RLVR 中一样直接进入流程。

这是 GitHub 仓库:https://github.com/OpenPipe/ART [1]

(别忘了给它点个 star ⭐)

我最近写了一篇完整的分析文章,详细介绍这套方法究竟如何运作,其中包括训练循环和代码。

请在下方阅读。

来源与阅读说明

正文取自用户提交的本地文件,原始文件与原图按字节归档。原网页含 1 段视频,本保存件未取得视频文件;保留静态预览(如有),完整视频请从原文链接查看。中文译文逐单元生成并由另一次模型请求审校;未进行人工全文审校、线上来源比对或代码执行。作者与日期缺失时保留未知。

阅读补充解释本文内容与限制,不冒充独立知识专题或外部事实核验。图片保持原样,图内说明单独保存。阅读器沿用 ReadLess 公共组件及中文约 400 字分块规则。