1 of 61

「預訓練–對齊」�(Pretrain-Alignment)�的強大與極限

2 of 61

第一階段

第二階段

輸入:人工智

輸出:慧

輸入:”USER:你是誰? AI: ”

輸出:”我”

第三階段

輸入: USER: “台灣最高的山是那座? AI:”

“玉山”

“誰來告訴我呀”

輸出:

>

Pre-train

Supervised Fine-tuning

(SFT)

RLHF

Alignment

(alignment 有多種不同的定義)

(Finetune)

3 of 61

Pretrain 有多強大

4 of 61

Pretrain 模型根本不能用!

What is Machine Learning?

Machine learning is a field of computer science that gives computers the ability to learn without being explicitly programmed. Machine learning is a subset of artificial intelligence.

Machine learning is a field of computer science that gives computers the ability to learn without being explicitly programmed. Machine learning is a subset of artificial intelligence.

…….

LLaMA-2-7b-base:

(pretrain)

5 of 61

Alignment 前後行為差異很大

What is Machine Learning?

Machine learning is a subfield of artificial intelligence (AI) that involves the use of algorithms and statistical models to enable machines to learn from data, make decisions, and improve their performance on a specific task over time.

Machine learning algorithms are designed to recognize patterns in data and learn from it, without being explicitly programmed to do so. The algorithms can be trained on large datasets, and as they process more data, they can make better predictions or decisions.

…….

LLaMA-2-7b-chat:

(alignment)

Model with "chat" or "instruct" means "with alignment."

6 of 61

Alignment 前後行為差異很大

Source: https://arxiv.org/abs/2409.00096

7 of 61

Alignment 資料不用多

LLaMA 2

https://arxiv.org/abs/2307.09288

8 of 61

LIMA: Less Is More for Alignment

https://arxiv.org/abs/2305.11206

9 of 61

Alignment 是畫龍點睛

Pretrain

Alignment

10 of 61

但點的位置很重要

11 of 61

Alignment 資料不用多

LLaMA 2

https://arxiv.org/abs/2307.09288

12 of 61

https://arxiv.org/abs/2403.18058

240

8837

13 of 61

Ruozhiba (弱智吧)

  • Q: 为什么我的银行卡在高压锅里煮了一晚上,还是冻结状态
  • Q: 16岁了,未满18岁正常吗
  • Q: 一斤棉花和一斤铁,同时掉进水里你先救谁?
  • Q: 问一道数学问题 关羽一小时能斩20个颜良 华佗一小时能救17个颜良 假设一共有233.3个颜良 关羽斩颜良的同时华佗救颜良 求关羽多长时间能把颜良给杀完?
  • Q: 我老板要我发送原图,我发了可莉的图给他,为什么会被骂

https://docs.qq.com/sheet/DUlZ6aURhamdwb1RO?tab=BB08J2

14 of 61

問題

已經 Alignment 的模型的答案

問題

?????

自己的

LLM

Student

Teacher

Data

Cost

Alpaca

LLaMA1-7B-base

ChatGPT

52k

$100

Vicuna

LLaMA1-7B-base

ChatGPT

70k

$140

Sky-T1

Qwen2.5-32B-Instruct

QwQ

17k

$450

S1

Qwen2.5-32B-Instruct

Gemini

1k

<$50

Knowledge Distillation

不包含生資料、清理資料的成本

15 of 61

AlpaGasus

https://arxiv.org/abs/2307.08701

16 of 61

Long Is More for Alignment

https://arxiv.org/abs/2402.04833

怎麼選資料?

選最長的 ……

17 of 61

問題

已經 Alignment 的模型的答案

問題

?????

自己的

LLM

Student

Teacher

Data

Cost

Alpaca

LLaMA1-7B-base

ChatGPT

52k

$100

Vicuna

LLaMA1-7B-base

ChatGPT

70k

$140

Sky-T1

Qwen2.5-32B-Instruct

QwQ

17k

$450

S1

Qwen2.5-32B-Instruct

Gemini

1k

<$50

Knowledge Distillation

輸入哪裡來?

不包含生資料、清理資料的成本

18 of 61

Knowledge Distillation

https://arxiv.org/abs/2409.00096

Non-instructional Fine-tuning

Juncheng Xie

前半句

前半句

?????

自己的

LLM

隨便一句話

19 of 61

Knowledge Distillation

  • 原上半句: …… The nondiscrimination policy seeks to ensure employers with more than 10 employees
  • 原下半句: in the city as well as those who provide housing and public accommodations ……
  • ChatGPT續寫: , as well as housing providers, public accommodations, and city contractors, do not discriminate based on ……
  • 原上半句: …… Davis was recently hired as a morning anchor for CBS46. She is scheduled to
  • 原下半句: start Jan. 2. ……
  • ChatGPT續寫: begin her new role despite the recent arrest. ……

https://arxiv.org/abs/2409.00096

Non-instructional Fine-tuning

Juncheng Xie

20 of 61

Knowledge Distillation

https://arxiv.org/abs/2409.00096

Non-instructional Fine-tuning

Juncheng Xie

21 of 61

Alignment 前後模型實際行為差異不大

LLM

(After alignment)

How are you ? I am

fine

LLM

(Before alignment)

How are you ? I am

fine

fine

fine

Unshift

Marginal

Shifted

The Unlocking Spell on Base LLMs

https://arxiv.org/abs/2312.01552

22 of 61

Alignment 前後模型實際行為差異不大

The Unlocking Spell on Base LLMs

https://arxiv.org/abs/2312.01552

23 of 61

Alignment 前後模型實際行為差異不大

The Unlocking Spell on Base LLMs

https://arxiv.org/abs/2312.01552

24 of 61

Alignment 其實很容易?

Revealing the Inherent Instructability of Pre-Trained Language Models

https://arxiv.org/abs/2410.02465v2

25 of 61

Alignment 其實很容易?

Revealing the Inherent Instructability of Pre-Trained Language Models

https://arxiv.org/abs/2410.02465v2

26 of 61

Alignment 其實很容易?

https://arxiv.org/abs/2409.14254

Instruction Following without Instruction Tuning

27 of 61

Alignment 其實很容易?

https://arxiv.org/abs/2409.14254

Instruction Following without Instruction Tuning

增加結束符號的機率

手動改變符號出現的機率

避免出現重複的符號

28 of 61

Alignment 其實很容易?

Self-Rewarding Language Models

https://arxiv.org/abs/2401.10020

LLM

(without alignment)

LLM

(without alignment)

 

 

給予評分指示

 

 

 

 

 

這解釋了為什麼 self-alignment 可以成功

29 of 61

如何達成有效的 Pretrain?

https://arxiv.org/abs/2309.14316

高松燈是羽丘女子學園高一學生,亦是天文部唯一社員,擔任MyGO!!!!!的主唱。

千早愛音是MyGO!!!!!的節奏吉他手,同時也是羽丘女子學園高中一年級的學生。

輸入:誰是MyGO!!!!!的節奏吉他手?

誰是MyGO!!!!!的主唱

LLM

輸出:千早愛音

N 個人的資料

Pretrain

N/2 個人相關的問題 Alignment

以剩下N/2 個人的問題進行測試

?????

0% 正確率

(每個人只出現一次)

Physics of Language Models: Part 3.1

30 of 61

https://mygo.miyago9267.com/

31 of 61

如何達成有效的 Pretrain?

https://arxiv.org/abs/2309.14316

高松燈是羽丘女子學園高一學生,亦是天文部唯一社員,擔任MyGO!!!!!的主唱。

LLM

 

32 of 61

如何達成有效的 Pretrain?

https://arxiv.org/abs/2309.14316

高松燈是羽丘女子學園高一學生,亦是天文部唯一社員,擔任MyGO!!!!!的主唱。

LLM

高松燈是MyGO!!!!!的主唱,就讀羽丘女子學園高一學生,亦是天文部唯一社員。

 

33 of 61

如何達成有效的 Pretrain?

https://arxiv.org/abs/2309.14316

高松燈是羽丘女子學園高一學生,亦是天文部唯一社員,擔任MyGO!!!!!的主唱。

千早愛音是MyGO!!!!!的節奏吉他手,同時也是羽丘女子學園高中一年級的學生。

輸入:誰是MyGO!!!!!的節奏吉他手?

誰是MyGO!!!!!的主唱

LLM

輸出:千早愛音

N 個人的資料

Pretrain

N/2 個人相關的問題 Alignment

以剩下N/2 個人的問題進行測試

高松燈

 

多種版本

多種版本

34 of 61

如何達成有效的 Pretrain?

https://arxiv.org/abs/2309.14316

高松燈是羽丘女子學園高一學生,亦是天文部唯一社員,擔任MyGO!!!!!的主唱。

LLM

千早愛音是MyGO!!!!!的節奏吉他手,同時也是羽丘女子學園高中一年級的學生。

 

千早愛音是羽丘女子學園高中一年級的學生,同時也是MyGO!!!!!的節奏吉他手

 

原來要這樣理解!

35 of 61

如何達成有效的 Pretrain?

https://arxiv.org/abs/2309.14316

高松燈是羽丘女子學園高一學生,亦是天文部唯一社員,擔任MyGO!!!!!的主唱。

千早愛音是MyGO!!!!!的節奏吉他手,同時也是羽丘女子學園高中一年級的學生。

輸入:誰是MyGO!!!!!的節奏吉他手?

誰是MyGO!!!!!的主唱

LLM

輸出:千早愛音

N 個人的資料

Pretrain

N/2 個人相關的問題 Alignment

以剩下N/2 個人的問題進行測試

高松燈

 

單一版本

多種版本

36 of 61

https://youtu.be/qycxA-xX_OY

37 of 61

現在 Pretrain 都用多大的資料?

LLaMA 3

https://arxiv.org/abs/2407.21783

DeepSeek-V3

https://arxiv.org/abs/2412.19437

38 of 61

https://arxiv.org/abs/2211.04325

39 of 61

可以從哪裡取得大量資料

https://arxiv.org/abs/2406.17557

https://huggingface.co/HuggingFaceFW

15-trillion tokens, 44TB disk space

40 of 61

資料品質的重要性

https://arxiv.org/abs/2306.11644

Textbooks Are All You Need

41 of 61

資料品質的重要性

https://arxiv.org/abs/2401.16380

Rephrasing the Web

42 of 61

RefinedWeb (Falcon LLM)

https://arxiv.org/abs/2306.01116

43 of 61

https://arxiv.org/abs/2305.16264

在有限算力、固定模型下應該儘量看更多不同的資料

44 of 61

https://arxiv.org/abs/2409.16295

Andy T. Liu

在有限算力、固定模型下應該儘量看更多不同的資料

45 of 61

資料過濾

https://arxiv.org/abs/2406.17557

https://huggingface.co/HuggingFaceFW

46 of 61

Alignment 的極限

47 of 61

The False Promise of Imitating Proprietary LLMs

https://arxiv.org/abs/2305.15717

Finetune LLaMA 1

48 of 61

Base

LLM

Base

LLM

Base

LLM

Base

LLM

範例問題

範例答案

問題

答案

問題

答案

範例問題

範例答案

範例問題

範例答案

答案

範例問題

範例答案

問題

答案

答案

答案

答案

範例問題

範例答案

問題

Highly Known

Maybe Known

Weakly Known

Unknown

https://arxiv.org/abs/2405.05904

Greedy

Greedy

Sample

Sample

49 of 61

https://arxiv.org/abs/2405.05904

50 of 61

“MaybeKnown” 是最有幫助的

https://arxiv.org/abs/2405.05904

51 of 61

https://arxiv.org/abs/2402.18243

LLM 自己的答案

LLM本來就會的問題

LLM 自己的答案

LLM不會的問題

正確答案

LLM不會的問題

(錯誤答案)

Case 1

Case 2

Case 3

52 of 61

RL 是 Alignment 的好方法

語言

模型

台灣最高的山是那座?

玉山

誰來告訴我呀

>

提高機率

減低機率

這不是人類強制給予的答案,這是語言模型自己生成的答案

53 of 61

Pretrain 的後遺症?

Embers of Autoregression

https://arxiv.org/abs/2309.13638

GPT 4.5 都可以答對

54 of 61

Embers of Autoregression

https://arxiv.org/abs/2309.13638

55 of 61

56 of 61

Embers of Autoregression

https://arxiv.org/abs/2309.13638

57 of 61

 

Logit Lens

Residual Stream

把資訊加入 Residual Stream

https://arxiv.org/abs/2401.01967

Pretrain 時看到不該看的東西後,難以真正清除

Sh*t 的機率

58 of 61

 

 

 

 

 

 

Pretrain 時看到不該看的東西後,難以真正清除

59 of 61

 

 

 

 

 

 

Pretrain 時看到不該看的東西後,難以真正清除

60 of 61

idea from: https://x.com/anthrupad/status/1622349563922362368/photo/1

Alignment

Pretrain

61 of 61

結語

  • Pretrain-Alignment 很強大
    • LLM 在 Pretrain 已經很強,Alignment 只是畫龍點睛
    • Pretrain 階段看過大量各式各樣的資料是關鍵
  • Pretrain-Alignment 有極限
    • 在 Alignment 階段往往 LLM 只是強化原來已經知道的事情,難以學習新技能

下集預告:如何有效微調模型