Reinforcement learning with human feedback (RLHF) tunes a language model using people’s reactions to its answers. Positive feedback gradually adjusts model weights, encouraging next-word predictions that users find more useful or likable. section 10.1
The Like button as a training signal
A user’s Like tells the system that an answer was satisfactory. Repeated feedback creates pressure toward likable responses, much as rewarding an animal for an answer can make it reproduce patterns correlated with approval rather than genuine understanding. section 10.1
Listing 10.1 Counting cow legs with GPT-2
>>> from transformers import pipeline, set_seed
>>> generator = pipeline('text-generation', model='openai-gpt')
>>> set_seed(0) #1
>>> q = "There are 2 cows and 2 bulls, how many legs are there?"
>>> responses = generator(
... f"Question: {q}\nAnswer: ",
... max_new_tokens=5, #2
... num_return_sequences=10) #3
>>> answers = []
>>> for resp in responses:
... text = resp['generated_text']
... answers.append(text[text.find('Answer: ')+9:])
>>> answers
['four', 'only', '2', 'one', '30', 'one', 'three', '1', 'no', '1']
The counting example demonstrates why plausible language and positive feedback do not guarantee reliable arithmetic or reasoning. section 10.1
RLHF can improve answers after launch, but optimizing likability may reward popularity, hype, or agreement instead of truth. Models can still make obvious errors, produce nonsense, or be coaxed into unsafe behavior. section 10.1













