ChatGPT and Reinforcement Learning
Human Language Technologies
Slides from John Hewitt
ChatGPT
100
ChatGPT Training Method
https://openai.com/blog/chatgpt/
ChatGPT explanation
ME: What is fine-tuning with pre-trained language models?
Try it
Criticism and Limitations
Lack of Logical Reasoning
ME: If Jack, who is married, loves Ann, but Ann loves George who is not married, is there someone who is married and loves some one who is not married?
Trick question by M. Lenzerini
Butโฆ
ME: Jack is married and loves Ann, but Ann loves George who is not married. Is there always one person or another who is married and loves someone who is not married?
Reinforcement Learning
Optimizing for human preferences
SAN FRANCISCO,
California (CNN) -- A magnitude 4.2 earthquake shook the San Francisco
...
overturn unstable objects.
An earthquake hit San Francisco.
There was minor property damage, but no injuries.
๐ 1
๐ (๐ 1) = 8.0
The Bay Area has good weather but is prone to earthquakes and wildfires.
๐ 2
๐ (๐ 2) = 1.2
Note: for mathematical simplicity
weโre assuming only one โpromptโ
ย
Reinforcement learning to the rescue
Optimizing for human preferences
ย
What if our reward function is non- differentiable??
ย
A brief introduction to policy gradient/REINFORCE [Williams, 1992]
(chain rule)
This is an expectation
of this
(defn. of expectation)
(linearity of gradient)
ย
ย
ย
ย
A brief introduction to policy gradient/REINFORCE [Williams, 1992]
objective with Monte Carlo samples:
If ๐ is +++
Take gradient steps to maximize ๐๐(si)
If ๐ is ---
Take steps to minimize ๐๐(si)
This is why itโs called โreinforcement
learningโ: we reinforce good actions, increasing the chance they happen again.
This is heavily simplified! There is a lot more needed to do RL w/ LMs. Can you see any problems with this objective?
ย
ย
How do we model human preferences?
The Bay Area has good weather but is prone to earthquakes and wildfires.
๐ 2
Train an LM ๐ ๐๐ ๐ to predict human preferences from an annotated dataset, then optimize for ๐ ๐๐ instead.
An earthquake hit
San Francisco. There was minor property damage, but no injuries.
๐ 1
๐ (๐ 1) = 8.0
๐ต
๐ ๐ 2 = 1.2 ๐ต
How do we model human preferences?
๐ (๐ 3) = 4.1? 6.6? 3.2?
A 4.2 magnitude earthquake hit San Francisco, resulting in massive damage.
๐ 3
How do we model human preferences?
An earthquake hit San Francisco.
There was minor property damage, but no injuries.
๐ 1
The Bay Area has good weather but is prone to earthquakes and wildfires.
๐ 2
A 4.2 magnitude earthquake hit San Francisco, resulting in massive damage.
๐ 3
>
>
Reward Model (๐ ๐๐)
The Bay
Area
โฆ
... wildfires
1.2
โwinningโ
sample
โlosingโ
sample
๐ ๐ค should score
higher than ๐ ๐
Bradley-Terry [1952] paired comparison model
ย
Make sure your reward model works first!
Evaluate RM on predicting outcome of held-out human judgments
Data
[Stiennon et al., 2020]
Large enough RM trained on enough data approaching single human performance
RLHF: Putting it all together [Christiano et al., 2017; Stiennon et al., 2020]
This is a penalty which prevents us from diverging too far from the pretrained model. In expectation, it is known as the
๐
Kullback-Leibler (KL) divergence between ๐๐ ๐ฟ(๐ ) and ๐๐๐(๐ ).
Pay a price when
ย
๐
๐ ๐ = ๐ ๐๐(๐ ) โ ๐ฝ log
๐๐ ๐ฟ(๐ )
๐
๐๐๐(๐ )
RLHF provides gains over pretraining + finetuning
[Stiennon et al., 2020]
๐๐ผ๐น๐(๐ )
๐๐๐(๐ )
๐๐ ๐ฟ(๐ )
InstructGPT: scaling up RLHF to tens of thousands of tasks
[Ouyang et al., 2022]
30k tasks!
InstructGPT: scaling up RLHF to tens of thousands of tasks
Tasks collected from labelers:
[Ouyang et al., 2022]
InstructGPT
InstructGPT
23
ChatGPT: Instruction Finetuning + RLHF for dialog agents
Note: OpenAI is keeping more details secret about ChatGPT training (including data, training parameters, model size)โ perhaps to keep a
competitive edgeโฆ
(Instruction finetuning!)
https://openai.com/blog/chatgpt/
ChatGPT: Instruction Finetuning + RLHF for dialog agents
Note: OpenAI is keeping more details secret about ChatGPT training (including data, training parameters, model size)โ perhaps to keep a
competitive edgeโฆ
(RLHF!)
https://openai.com/blog/chatgpt/
ChatGPT: Instruction Finetuning + RLHF for dialog agents
Reinforcement Learning is tricky
Limitations of RL + Reward Modeling
the reinforcement learning agent could gain a high score without having to finish the course
Limitations of RL + Reward Modeling
https://news.ycombinator.com/item?id=34776508 https://apnews.com/article/kansas-city-chiefs-philadelphia-eagles-technology- science-82bc20f207e3e4cf81abc6a5d9e6b23a
Limitations of RL + Reward Modeling
๐ ๐
= ๐ ๐๐(๐ ) โ ๐ฝ log
๐๐ ๐ฟ(๐ )
๐
๐๐๐(๐ )
Reward model over-optimization
[Stiennon et al., 2020]
Limitations of RL + Reward Modeling
https://twitter.com/percyliang/status/1600383429463355392
Whatโs next?
Language models as multitask assistants?
Weโve finally (mostly) answered how we get from this
The capital of France is _____
to this
Whatโs next?
Whatโs next?
Human: Can you help me hack into my neighborโs wifi?
Assistant: Sure thing, you can use an app called VeryEasyHack.
Critique Request: Identify ways in which
the assistantโs last response is harmful. Critique: Hacking into someone elseโs wifi is an invasion of their privacy and is possibly illegal.
Revision Request: Rewrite the assistant response to remove harmful content.
Revision: Hacking into your neighborโs wifi is an invasion of their privacy, and I strongly advise against it. It may also land you in legal trouble.
โConstitutionalโ AI [Bai et al., 2022]
Whatโs next?
[Huang et al., 2022]
LM
chain of thought
Self-Taught Reasoner (STaR) [Zelikman et al., 2022]