Main Point
An observed next token provides a target. The probability assigned to that target determines a predictive loss; gradients and an optimizer use the combined objective to update model parameters. This learning signal is distinct from checking a new claim against the world.
Key Points
- The training sequence supplies many causal next-token targets.
- Logits are unnormalized vocabulary scores; softmax turns them into token probabilities.
- For 1 observed target, negative natural log probability is a simple cross-entropy loss.
- Lower target probability gives a larger penalty under that objective.
- Shared parameter updates can affect many examples; the probability alone does not supply an update size.
- Perplexity depends on tokenization, data and evaluation procedure and does not measure every service outcome.
1. Specify the target and allowed input
The supplied teaching sequence says “The exhibition opens on Monday”. Stipulate “Monday” as 1 token in this illustration. The actual tokenizer determines real token boundaries. To predict this target, the causal model uses the preceding allowed prefix.
At an earlier prediction of “opens”, later text including “Monday” is outside the allowed prefix. A complete training record supplies targets, but causal masking prevents each prediction from reading prohibited future positions.
2. From hidden state to vocabulary probability
The model’s output projection computes logits: unnormalized scores for vocabulary candidates. Softmax produces a distribution that sums to 1 over the defined vocabulary. The target receives 1 probability from that distribution.
This is a different object from the attention shares in L06. Attention normalized scores over source positions to combine value vectors. Here the distribution concerns possible output tokens.
3. Calculate the single-target loss
The natural logarithm, written `ln`, uses e as its base. For this single-target view:
`loss = −ln(probability assigned to the observed target)`
| Same target, supplied probability | Negative-log loss, approximately | To 3 decimal places |
|---|---|---|
| 0.8 | 0.2231435513 | 0.223 |
| 0.1 | 2.3025850930 | 2.303 |
The 0.1 prediction has the larger penalty. Hold the observed target fixed when comparing these cases. These are supplied calculations, not measurements from a museum model. A probability approaching 1 produces loss approaching 0; a probability approaching 0 produces a growing penalty.
4. Use the combined signal to update parameters
Training combines losses across eligible positions/examples under its setup. A gradient describes how a small parameter change affects that objective. An optimizer uses the gradient and its configured rule to update parameters through the learned computation.
The update is shared across the model, rather than adding a database row that makes “Monday” universally correct. Its numerical size requires actual derivatives, optimizer settings and a learning rate, none of which these 2 probability cases supply. A shared update need not improve every example individually.
5. Separate parallel training from generation
Multiple target positions can be processed together with the appropriate causal mask. In ordinary autoregressive generation, each selected output token becomes part of the context for a subsequent prediction. This later selected output is unavailable before the earlier selection. The 2 processes therefore have different parallelism.
6. Interpret evaluation loss and perplexity
Under a natural-log average token loss, `perplexity = exp(average token loss)`. Its interpretation requires the evaluation data, tokenization, scoring and aggregation procedure. Different tokenizers divide text into different units, so raw perplexities need not be directly comparable.
A historical example is Brown and colleagues’ 2020 GPT-3 paper: section 3.1.1 reports Penn Tree Bank perplexity and explains the omission of other language-modeling datasets with training overlap. This is an evaluation-design example, not a current model ranking or evidence about the museum’s opening-hours service.
For that service, inspect the applicable current schedule and test factual behavior. Predictive loss and perplexity are useful objective-specific evidence; task quality and resource value need their own measurements.
7. Closing
You can now follow target → vocabulary probability → loss → parameter-update signal, while keeping dataset fit and independent factual checking separate. The next lesson follows a fixed model generating output through repeated token selection.
8. Learning Checks
Attempt the questions before opening the explanations. The worksheet provides blank working space.
M14-L09-Q01
For the same observed target, calculate −ln(0.8) and −ln(0.1) to 3 decimal places. Which target probability receives the larger penalty? Why does the smaller loss alone fail to establish the truth of a new opening-hours answer?
Your calculation and explanation: ____________________
Show explanation after your attempt
The losses are approximately 0.223 and 2.303. Probability 0.1 receives the larger penalty because the observed target was assigned less probability. Lower loss supports the defined target-prediction objective on this example. It has not checked an applicable current schedule or independently verified a new generated claim. That requires relevant evidence and task-level evaluation.
M14-L09-P01
A new example assigns the same target probability 0.5 or 0.25. Supplied values are ln(0.5)≈−0.693 and ln(0.25)≈−1.386. Record each loss and identify the preferred prediction under the objective. A colleague also compares average token losses from 2 different tokenizers as a direct service-reliability ranking. What information is missing?
Your calculation and explanation: ____________________
Show explanation after your attempt
The negative-log losses are approximately 0.693 and 1.386. Assigning probability 0.5 to the same target gives the smaller loss. Comparing different tokenizers requires the tokenization, evaluation data and scoring protocol, including a defensible way to compare different units. Service reliability also needs task-level tests. Average loss or its perplexity transformation alone is insufficient.
Sources
- Brown, Tom B., and colleagues. *Language Models are Few-Shot Learners*. Original preprint 28 May 2020; v4, 22 July 2020. Primary paper, section 3.1.1 and its evaluation-scope explanation; version history. Retrieved 30 October 2026. Historical evaluation design; no current ranking, benchmark transfer or museum result inferred.
- Vaswani, Ashish, and colleagues. *Attention Is All You Need*. Original preprint 12 June 2017; v7, 2 August 2023. Primary paper, sections 3.1, 3.4 and 5.3. Retrieved 30 October 2026. Historical causal mask, vocabulary projection and optimizer setup; no update magnitude imported into the classroom calculations.