Fine-Tuning, and When Not ToLesson 47 of 84

Module 5 · Objectives beyond next-token prediction

Training a head instead of generating tokens

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 9 of 9 in this chapter

This chapter’s goalChoose between supervised fine-tuning, a preference method such as DPO or KTO, a verifiable-reward method such as GRPO, and continued pretraining, and state the data each needs, the memory each costs, and the way each is gamed.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

Replace the last layer

A decoder’s final layer projects a hidden state to vocabulary size, producing a distribution over the next token. Replace that projection with a small linear layer producing one number, or six, and you have a scorer or a classifier built on the same pretrained body.

Python
from transformers import AutoModelForSequenceClassification
model = AutoModelForSequenceClassification.from_pretrained(
    "Qwen/Qwen2.5-1.5B", num_labels=1)   # 1 = regression / reward

This is what a reward model is. It is also what a quality scorer, a safety classifier, a routing model and a reranker are. In every case you have traded the ability to write text for a single cheap forward pass: no autoregressive decoding, no sampling, a fixed and tiny output.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Running Models Yourself exam.

Stuck on something?Ask Rafael, your AI tutor

How to cite: Addaly (2026) ‘Training a head instead of generating tokens’, in Fine-Tuning, and When Not To. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/fine-tuning/heads-instead-of-tokens (Accessed: 29 November 2026).