Reinforcement Learning in Natural Language Generation
Swaroop Nath
Why Reinforcement Learning? | Key Insight
Token-by-Token match
Any Generic Reward
Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF
Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF
Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF
Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF
Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF
Learning Algorithms
Given inputs (X) and outputs (Y), how do you learn the mapping?
X
𝑓
Y
Learning Algorithms
Given inputs (X) and outputs (Y), how do you learn the mapping?
X
𝑓
Y
X
𝐅(𝜃)
Ŷ
Y
≃
Trainable using Gradient-based Algorithms
Some notion of goodness
What is this notion of goodness?
Text Generation
Fluency
The Department of Computer Science and
Engineering at IIT Bombay is thrilled to
announce the upcoming RISC 2024 . . .
The Computer Science of and Department
Engineering upcoming at is thrilled to
the announce RISC 2024 IIT Bombay . . .
What is this notion of goodness?
Text Generation
Fluency
Indian Institute of Technology Bombay is
in India.
Indian Institute of Technology Bombay is
in the Australian continent, located in
New Zealand.
Hallucination
What is this notion of goodness?
Text Generation
Fluency
Indian Institute of Technology Bombay is
in India.
L'Indian Institute of Technology Bombay
se trouve en Inde.
Hallucination
Language
What is this notion of goodness?
Text Generation
Fluency
Hallucination
Language
Clarity
Coherence
Conciseness
Tonality
Originality
Engagement
Inclusivity
Bias and Stereotypes
Audience Appropriateness
What is this notion of goodness?
Text Generation
Fluency
Hallucination
Language
Clarity
Coherence
Conciseness
Tonality
Originality
Engagement
Inclusivity
Bias and Stereotypes
Audience Appropriateness
An Oracle
Oracle takes all factors into account and scores the text
The Department of Computer Science and
Engineering at IIT Bombay is thrilled to
announce the upcoming RISC 2024 . . .
r
Fluency
Hallucination
Language
Clarity
Coherence
Conciseness
An Oracle
Typically humans play the role of Oracle!
The Department of Computer Science and
Engineering at IIT Bombay is thrilled to
announce the upcoming RISC 2024 . . .
r
Preference Modeling
Difficult for human to provide a scalar score!
However the score reflects in preference!
A
B
>
What is Preference Feedback?
Another Large Model
Trained on Human Preference Data
What is Preference Feedback?
Another Large Model
Trained on Human Preference Data
Various Possible Outputs
What is Preference Feedback?
Another Large Model
Trained on Human Preference Data
AI Trainer
What is Preference Feedback?
Another Large Model
Trained on Human Preference Data
AI Trainer ranks outputs
What is Preference Feedback?
Another Large Model
Trained on Human Preference Data
Train Preference Reward Model on this data
What is Preference Feedback?
Another Large Model
Trained on Human Preference Data
Preference Feedback Model
Acts as Human Feedback
Realization: InstructGPT
Realization: InstructGPT
Supervised Fine
Tuning
Realization: InstructGPT
Supervised Fine Instruction Tuning
Subtle Difference
Realization: InstructGPT
Collecting data from model for AI Trainer labelling and Preference Model Training
Realization: InstructGPT
RLHF Training using Preference Model to reward generations
Preference Modeling | Underlying Math
Difficult for human to provide a scalar score!
However the score reflects in preference!
Bradley-Terry model1 provides a way to extract latent-reward-model from preference data
1R. A. Bradley and M. E. Terry. Rank analysis of incomplete block designs: I. the method of paired comparisons. Biometrika, 39(3/4):324–345, 1952. doi: https://doi.org/10.2307/2334029
Preference Modeling | Underlying Math
Difficult for human to provide a scalar score!
However the score reflects in preference!
Bradley-Terry model1 provides a way to extract latent-reward-model from preference data
1R. A. Bradley and M. E. Terry. Rank analysis of incomplete block designs: I. the method of paired comparisons. Biometrika, 39(3/4):324–345, 1952. doi: https://doi.org/10.2307/2334029
Requires a lot of human-preference data
Reward Model
𝜑
= 𝑓 (X, Y)
X → input text
Y → output from LLM
Reward Model
𝜑
= 𝑓 (X, Y)
(X, Y)
𝑣1
𝑣2
𝑣n
.
.
For the task of creative writing
𝑣i’s are specified by domain experts
Signifies what features are important in the reward
𝚿
Hallucination
Reward Model
𝜑
= 𝑓 (X, Y)
(X, Y)
𝑣1
𝑣2
𝑣n
.
.
𝜑
= 𝑓 (𝑣)
Requires no training data
Requires training data
Reward Model
𝜑
= 𝑓 (X, Y)
(X, Y)
𝑣1
𝑣2
𝑣n
.
.
𝜑
= 𝑓 (𝑣)
Domain Knowledge gives me features
These features compress variability in data
Thus effectively reducing the data requirement
Putting it all together -- RLHF
𝚿
𝑣1
𝑣2
𝑣n
𝜑
X
𝐅(𝜃)
Ŷ
X
𝐅(𝜃)
Ŷ
Y
≃
r
RL Algorithm
Ok, but how does it perform on a domain?
E-Commerce Opinion Summarization
Input: Reviews
Output: Opinion Summary
Domain Specification
E-Commerce Opinion Summarization
Input: Reviews
Output: Opinion Summary
Set of features:
Preference Annotations for only 940 pairs!
> 20x reduction in dataset size!
Results
Analysis
Conclusion
We show a new way to do RLHF, by leveraging domain knowledge
We show one way to reduce human preference requirement (>20x)
We see that our approach leads to better performance
We see that our approach actually provides alignment too
THANK YOU!!
Pushpak Bhattacharyya
Harshad Khadilkar
Swaroop Nath