1 of 41

Reinforcement Learning in Natural Language Generation

Swaroop Nath

2 of 41

Why Reinforcement Learning? | Key Insight

Token-by-Token match

Any Generic Reward

3 of 41

Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF

4 of 41

Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF

5 of 41

Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF

6 of 41

Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF

7 of 41

Leveraging Domain Knowledge for Efficient Reward Modelling in RLHF

8 of 41

Learning Algorithms

Given inputs (X) and outputs (Y), how do you learn the mapping?

X

𝑓

Y

9 of 41

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

10 of 41

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 . . .

11 of 41

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

12 of 41

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

13 of 41

What is this notion of goodness?

Text Generation

Fluency

Hallucination

Language

Clarity

Coherence

Conciseness

Tonality

Originality

Engagement

Inclusivity

Bias and Stereotypes

Audience Appropriateness

14 of 41

What is this notion of goodness?

Text Generation

Fluency

Hallucination

Language

Clarity

Coherence

Conciseness

Tonality

Originality

Engagement

Inclusivity

Bias and Stereotypes

Audience Appropriateness

15 of 41

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

16 of 41

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

17 of 41

Preference Modeling

Difficult for human to provide a scalar score!

However the score reflects in preference!

A

B

>

18 of 41

What is Preference Feedback?

Another Large Model

Trained on Human Preference Data

19 of 41

What is Preference Feedback?

Another Large Model

Trained on Human Preference Data

Various Possible Outputs

20 of 41

What is Preference Feedback?

Another Large Model

Trained on Human Preference Data

AI Trainer

21 of 41

What is Preference Feedback?

Another Large Model

Trained on Human Preference Data

AI Trainer ranks outputs

22 of 41

What is Preference Feedback?

Another Large Model

Trained on Human Preference Data

Train Preference Reward Model on this data

23 of 41

What is Preference Feedback?

Another Large Model

Trained on Human Preference Data

Preference Feedback Model

Acts as Human Feedback

24 of 41

Realization: InstructGPT

25 of 41

Realization: InstructGPT

Supervised Fine

Tuning

26 of 41

Realization: InstructGPT

Supervised Fine Instruction Tuning

Subtle Difference

27 of 41

Realization: InstructGPT

Collecting data from model for AI Trainer labelling and Preference Model Training

28 of 41

Realization: InstructGPT

RLHF Training using Preference Model to reward generations

29 of 41

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

30 of 41

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

31 of 41

Reward Model

𝜑

= 𝑓 (X, Y)

X → input text

Y → output from LLM

32 of 41

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

33 of 41

Reward Model

𝜑

= 𝑓 (X, Y)

(X, Y)

𝑣1

𝑣2

𝑣n

.

.

𝜑

= 𝑓 (𝑣)

Requires no training data

Requires training data

34 of 41

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

35 of 41

Putting it all together -- RLHF

𝚿

𝑣1

𝑣2

𝑣n

𝜑

X

𝐅(𝜃)

Ŷ

X

𝐅(𝜃)

Ŷ

Y

≃

r

RL Algorithm

36 of 41

Ok, but how does it perform on a domain?

E-Commerce Opinion Summarization

Input: Reviews

Output: Opinion Summary

37 of 41

Domain Specification

E-Commerce Opinion Summarization

Input: Reviews

Output: Opinion Summary

Set of features:

  • Aspect Coverage
  • Opinion Faithfulness
  • Opinion Coverage
  • Conciseness
  • Relevance
  • Hallucination
  • Language Correctness

Preference Annotations for only 940 pairs!

> 20x reduction in dataset size!

38 of 41

Results

39 of 41

Analysis

40 of 41

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

41 of 41

THANK YOU!!

Pushpak Bhattacharyya

Harshad Khadilkar

Swaroop Nath