对齐、评估与多模态面试题图文讲义5145 字

大模型RLHF相关面试题

·全库 119 / 611

《大模型RLHF相关面试题》共 14 页、0.5 万字,通篇围绕 RLHF、微调、预训练、PPO 展开,归在「对齐、评估与多模态」这一层。

覆盖RLHF微调预训练PPO数据集SFT

适合要给模型效果打分、判断它够不够用的人

目录骨架(8 节)
  1. finetuning
  2. Win rate against SFT 175B
  3. RLHF Step
  4. S Llama-2-chat
  5. 一、介绍一下 LLM 的经典预训练 Pipeline?
  6. Pretraining
  7. Supervised
  8. Alignment

原 PDF 已逐页还原成图,共 14 页,这里先放前 3 页,其中 1 页识别出了标题。右侧文字由 OCR 按版面重排,可能有个别错字,以图为准;点图可全屏放大。

本讲义目录 · 3 页
  1. 01一、介绍一下 LLM 的经典预训练 …
  2. 02目前基于 Transformer d…
  3. 03finetuning
011 / 3
第 1 页
第 1 页

一、介绍一下 LLM 的经典预训练 …

  • 一、介绍一下 LLM 的经典预训练 Pipeline?
  • 二、预训练(Pre-training)篇
  • 2.1 具体介绍一下预训练(Pre-training)?
  • 三、有监督微调(Supervised Tinetuning)篇
  • 3.1 具体介绍一下有监督微调(Supervised Tinetuning)?
  • 3.2 有监督微调(Supervised Tinetuning)的训练数据格式是什么样?
  • 3.3 预训练(Pre-training)vs 有监督微调(Supervised Tinetuning)区别?
  • 四、对齐(Alignment)篇
  • 4.1 简单介绍一下对齐(Alignment)?
  • 五、Reinforcement Learning with Human Feedback (RLHF)篇
  • 5.1 简单介绍一下 RLHF 流程?
  • 5.2 如何在在预训练好的模型上进行有监督微调?
  • 5.3 如何在有监督微调模型基础上创建一个 RM 模型?
  • 5.4 如何基于 RM 模型使用 PPO 算法微调 SFT 模型?
  • 5.5 instructGPT 的原理,讲讲 rlhf 和 reward?
  • 六、LLaMA2 的 RLHF 篇
  • 6.1 介绍一下 LLaMA 2 的 RLHF?
  • 6.2 LLaMA2 中 Margin Loss 的实现逻辑?
  • 6.3 LLaMA 2 中两个 RM 模型的实现逻辑?
  • 6.4 LLaMA2 中拒绝采样逻辑?
  • 七、RLHF 替代方案篇
  • 7.1 为什么需要 RLHF 替代方案?
  • 7.2 RLHF 有哪些替代方案?
  • 替代方案 1:Constitutional Al: Harmlessness from Al Feedback
  • 替代方案 2:The Wisdom of Hindsight Makes Language Models Better Instruction

Followers

• 替代方案 3:Direct Preference Optimization: Your Language Model is Secretly a

  • Reward Model
  • 替代方案 4:Reinforced Self-Training (ReST)for Language Modeling
  • 替代方案 5:RLAIF: Scaling Reinforcement Learning from Human Feedback with AI Feedback
  • 八、RLHF 实践篇
  • 8.1 RLHF 训练过程,怎么选取最优 checkpoint?

•参考

一、介绍一下 LLM 的经典预训练 Pipeline?

022 / 3
第 2 页
第 2 页

目前基于 Transformer d…

目前基于 Transformer decoder 的 LLM,比如 ChatGPT、LLaMA、baichuan 等,通常都会有基于预训练的 base 模 型和在 base 模型至少使用 RLHF 微调的 Chat 模型,Chat 模型的训练一般都包括如下三个步骤:预训练,有监督微 调和对齐。 1.在预训练阶段,模型会从大量无标注文本数据集中学习通用知识; 2. 使用「有监督微调」(SFT)优化模型以更好地遵守特定指令; 3. 使用对齐技术使 LLM 可以更有用且更安全地响应用户提示。

二、预训练(Pre-training)篇 2.1 具体介绍一下预训练(Pre-training)?

预训练(Pre-training):利用数十亿到数万亿个 token 的庞大文本语料库对模型继续预训练,使模型能够根据 提供的文本来预测「下一个单词」。

Pretraining

Dataset: 100B to >5T tokens

Task: Next-token

prediction on unlabeled texts Output: base model / “foundation model”

三,有监督微调(Supervised Tinetuning)篇 3.1 具体介绍一下有监督微调(Supervised Tinetuning)?

有监督微调(Supervised Tinetuning):虽然 SFT 训练目标和预训练(Pre-training)类似,也是需要模型预测 「下一个单词」,但是需要人工标注的指令数据集,其中模型的输入是一个指令(根据任务的不同,也可能包含 一段输入文本),输出为模型的预期回复内容。

Project Gutenberg (PG)is a volunteer effort to digitize and archive cultural works, as well as to

"'encourage the creation and distribution of eBooks." It was founded in 1971 by American writer Michael S. Hart and is the oldest digital library. Most of the

items in its collection are the full texts of books or individual stories in the public domain. All files can be accessed for free under an open format layout, available on almost any computer. As of 3 October 2015, Project Gutenberg had reached 50,000 items in its collection of free dBooks:

033 / 3
第 3 页:finetuning
第 3 页

finetuning

Supervised

More next-token prediction Usually 1k-50k instruction-response pairs

3.2 有监督微调(Supervised Tinetuning)的训练数据格式是什么样?

Instruction:"Write a limerick about a pelican." 指令:“写一首关于鹈鹕的打油诗。“ Output:"There once was a pelican so fine..." 输出:“从前有一只鹈鹕很好.“

模型会把"Write a limerick about a pelican”作为输入,逐个 token 进行预测,输出"There once was a pelican so

3.3 预训练(Pre-training)vs 有监督微调(Supervised Tinetuning)区别?

  • 训练目标相同:模型需要根据提供的文本来预测「下一个单词」;
  • 不同点:
  • 训练数据量不同:有监督微调(Supervised Tinetuning)需要训练数据量比预训练(Pre-training) 小很多;
  • 训练数据格式不同:有监督微调(Supervised Tinetuning)需要人工标注的训练数据,预训练(Pre-

training)不需要;

四、对齐(Alignment)篇 4.1 简单介绍一下对齐(Alignment)?

对齐(Alignment):通过微调的方式,将语言模型与人类的偏好、价值观进行对齐,这也是 RLHF 机制发挥的地 方。

“instruction";"write a limerick about a pelican.", "output";"There once was a pelican so fine,

\nHis beak was as colorful as sunshine,\nHe would fish all day,\nin truly divine!\nlnln"

“instruction":"Identify the odd one out from

资料里没有你的场景?

把你手上的数据和想解决的那个环节发上来,我们按具体情况回,不复述方法论。

发布需求