A reward model turns human preference into a usable training signal. Given a prompt and candidate response, it returns one floating-point score: higher means more preferred. This avoids writing every ideal response by hand. section 16.4.1
From rankings to scores
Collect several responses for each prompt, including handwritten or model-generated answers. Human evaluators rank them from most helpful to least helpful. Train the reward model on these rankings, then use its scores to guide further model tuning. section 16.4.1
A reward model is usually a smaller Transformer that reads a complete sequence and produces a rating rather than predicting the next token. In reinforcement learning, generated responses become actions and reward scores provide feedback. section 16.4.1
Listing 16.15 Pseudocode for the simplest possible RLHF algorithm
for prompts in dataset: responses = model.generate(prompts) #1 rewards = reward_model.predict(responses) #2 good_responses = [] for response, score in zip(responses, rewards): if score > cutoff: good_responses.append(response) model.fit(good_responses) #3
The pseudocode shows the simplest loop: generate responses, score them, retain responses above a cutoff, and fit the model on those results. section 16.4.1




