Separate pretraining text from a demonstration

Watch prefixes in words such as preferred and rejected. · 190 words

Pretraining text is ordinary documents used to teach a model language patterns. In a causal language model, pretraining repeatedly predicts the next token. A tokenizer may represent a whole word, part of a word, or punctuation as a token. For example, a museum guide may say, "The east wing opens at 10 AM." Such text teaches facts, names, and sentence structure without requiring questions, selected answers, or rewards from people.

An instruction demonstration pairs a request with a suitable reply: request, "What time does the east wing open?" reply, "The east wing opens at 10 AM." For the example, use this simplified token sequence: [What, time, does, the, east, wing, open, ?, The, east, wing, opens, at, 10, AM, .]. In a trainer configured to ignore target label -100, replace each request label with that value. The model can still attend to those prompt tokens when predicting the reply. Keep labels for the reply tokens. The reply loss measures how well the model predicts those tokens, using earlier correct tokens as context. Pretraining therefore learns from many ordinary text tokens; instruction tuning learns to answer requests from selected reply tokens.

Check your recall

In the museum demonstration, which tokens should be masked, and which tokens should receive the reply loss?

Check your answer

Mask all request tokens from "What" through "?". Train on the reply tokens "The", "east", "wing", "opens", "at", "10", "AM", and the final period.

Sources and credits

Original KeyTouch lesson. Background reading · Nathan Lambert · Reinforcement Learning from Human Feedback.