Macalinao StudioLearnAll enriched lessons ↗
High school path · 7 sectionsSwitch to college ↗

High school / LONGER LESSON 11

Next-token prediction: probability without prophecy

Calculate sequence likelihood and separate prediction quality from reasoning claims.

Preparation: Fractions, multiplication and logarithms for the college path.

Plan 20–35 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.

Section 01 / 07

Condition on the prefix

High-school path. Calculate sequence likelihood and separate prediction quality from reasoning claims.

Preparation: Fractions, multiplication and logarithms for the college path. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.

A language model assigns probabilities to the next token using the prefix it receives. It does not know which continuation a writer will actually choose. Think of several possible endings to the same sentence; a plausible guess can still be wrong.

Worked step 1. Two continuations have probabilities 0.6 and 0.4.

Worked step 2. Both are possible; the larger one is only more likely.

Try it yourself. Is 0.6 a guarantee?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Under this distribution the other outcome still has probability 0.4.

Section 02 / 07

Multiply conditional probabilities

A whole sequence requires every successive choice. Even individually likely tokens can produce a small sequence probability. Compare log probabilities to avoid numerical underflow. Three independent coin successes at probability one half give one eighth; conditional token probabilities use the same multiplication rule.

P(x₁,…,xₙ) = ∏ᵢ P(xᵢ | x<ᵢ)

Worked step 1. Conditional probabilities are 0.8, 0.5, 0.25.

Worked step 2. The product is 0.1; negative log likelihood is about 2.303.

Try it yourself. What if another factor 0.5 is appended?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. Sequence probability becomes 0.05. This does not by itself mean the longer sentence is worse writing.

Section 03 / 07

Training sees the reference prefix

Teacher forcing supplies the recorded earlier tokens during training. During free generation, a sampled mistake can become part of the next prefix. The contexts therefore need not match. A student following a correct worked example has different support from a student continuing their own mistaken step.

Worked step 1. Input tokens are start, A, B.

Worked step 2. Targets are A, B, end.

Worked step 3. Position B must not see the target end as input.

Try it yourself. Does teacher forcing eliminate generation errors?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. It defines the training inputs. Generated prefixes and their errors still need separate evaluation.

Section 04 / 07

Loss measures a chosen prediction task

Cross-entropy penalizes low probability on the recorded target. Perplexity exponentiates mean token loss. Tokenizer, data and loss reduction must match for a fair comparison. Assigning a target probability of one half costs less than assigning one hundredth.

Worked step 1. Two target probabilities are 0.5 and 0.25.

Worked step 2. Mean loss is about 1.040.

Worked step 3. Perplexity is about 2.828.

Try it yourself. Can perplexity alone certify factual accuracy?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. It evaluates predictive likelihood on specified data, not truth, reasoning validity or suitability for every task.

Section 05 / 07

A threshold can create an apparent jump

A score may improve smoothly while an all-or-nothing success metric jumps suddenly. Investigate the metric before calling a capability an abrupt new property. If passing means ten correct answers, moving from nine to ten changes pass status sharply despite a small improvement.

Worked step 1. Plot correct answers 7,8,9,10.

Worked step 2. A pass threshold at 10 yields 0,0,0,1.

Worked step 3. Compare both plots.

Try it yourself. What extra curve should accompany pass rate?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. A graded score or calibrated likelihood can reveal changes hidden by the threshold. Use more than one measure.

Section 06 / 07

Evaluate on genuinely new problems

A memorized test answer can look like reasoning. Keep training and evaluation separated, inspect contamination risks, and test variations that require the same principle with new details. Change the numbers in a worked problem and ask for intermediate steps, not just a familiar final phrase.

Worked step 1. Write a fresh three-step problem.

Worked step 2. Check its intermediate arithmetic.

Worked step 3. Compare performance with a familiar benchmark example.

Try it yourself. Does one successful explanation prove general reasoning?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. It supports that example. Broader claims require representative tasks, error analysis and controlled comparisons.

Section 07 / 07

Mastery and transfer

Bring the pieces together. First answer the checkpoint without the worked solutions. Then explain the mechanism in your own words, using one numerical example from this lesson.

Teacher forcing supplies… Option 1: The reference prefix during training. Option 2: Future labels at inference. Option 3: Guaranteed correct generations.

Pause here and choose an answer before continuing. The checkpoint explanation follows.

Reveal worked solution

The correct choice is option 1: The reference prefix during training. Training conditions on reference prefixes; free generation conditions on generated prefixes.

Transfer task. Change one assumption in the worked example. State your prediction, calculate or test it in Workbench, then explain whether the result supports your prediction.

Reveal worked solution

Self-check rubric. Name the changed assumption, keep the other inputs fixed, show at least one intermediate calculation, and distinguish what the toy example guarantees from what would require a trained model or a real measurement.

Sources and scope

Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.

EXTENDED FIELD NOTES

What a model learns: from numbers to a useful answer

Follow a sentence through learned weights, temporary activations, and the next-token decision.

Additional reading · original lesson audio remains unchanged.

Read the full explanation · 586 words
What changes when you ask a question?

The weights stay fixed during ordinary inference. Activations change with your input.

  1. Text → tokens
  2. Tokens → vectors
  3. Learned transformations
  4. Next-token scores

Text → tokens

A model is a computation with learned settings

A language model does not contain a little librarian choosing a finished answer from a shelf. It contains a structured computation whose numerical settings were learned during training. Those settings are called parameters. Many are weights arranged in matrices; other parameters can include offsets or normalization scales. The architecture determines which operations happen and how information travels. The weights determine the particular transformations performed by those operations. Two models can share an architecture and behave differently because they learned different parameter values.

Consider a tiny operation: y = 0.6x₁ − 0.2x₂ + 0.1. With inputs x₁ = 2 and x₂ = 3, the output is 0.7. Changing the first weight from 0.6 to 0.5 changes the output to 0.5. This is a teaching example, not a miniature intelligent system. Its purpose is to make one idea visible: numerical settings influence the result. In a language model, many such transformations act together across large vectors, nonlinear functions, and layers.

Follow the sentence

First, a tokenizer turns text into a sequence of token identifiers. A token may represent a word, part of a word, punctuation, or another unit. An embedding table supplies a learned vector for each identifier. These vectors are starting representations, not complete dictionary definitions. As they pass through the network, surrounding tokens influence how the current sequence is represented.

In attention, learned projections produce queries, keys, and values. The model compares queries with keys to calculate input-dependent attention scores, then combines value representations. This distinction matters: the projection weights normally remain fixed during a conversation, while the attention scores change with the input. Feed-forward transformations further process the representations, and residual connections carry information around sublayers. Finally, an output transformation supplies scores for possible next tokens. A selection procedure chooses a continuation, which becomes part of the next input step.

Training changes the settings; a conversation changes the state

During training, a loss measures how the predictions compare with the training objective. Gradients estimate how parameter changes would affect that loss. An optimizer uses those gradients to update trainable parameters. A single example does not usually teach an isolated fact to one identifiable weight. Useful patterns emerge through many updates, and knowledge and behavior are distributed across the computation.

During ordinary inference, the parameters stay fixed. Your prompt changes the activations: the temporary numbers produced while the model runs. A cache can retain intermediate information so the system need not repeat earlier work. That cache is not a new permanent education for the model. A product may separately save conversation history or conduct later training, but those are additional mechanisms. Saying that a chatbot remembers your previous sentence does not establish that its weights changed.

Why more parameters is not a complete explanation

A parameter count describes scale, not a guarantee of reliability. Data quality, architecture, training, numerical precision, and the way a model is evaluated all matter. A large model can produce a convincing error; a smaller specialized model can perform a narrow task well. To compare systems, ask what task was tested and under what conditions, rather than treating one number as a universal intelligence score.

Return to the animation and identify three different objects: a stored weight, an activation that changes with the sentence, and an output score. If the diagram uses moving dots, those dots represent information flow; they are not literal particles inside a model. Using the small equation above on paper, change an input while keeping a weight fixed, then change the weight while keeping the input fixed. Explain why these are different experiments. That distinction will help you understand fine-tuning, quantization, caches, and model releases throughout the course.

Sources and further investigation

Source review: October 28, 2026. Model-release claims are attributed to their publishers.

Open the focused reading page →

Reset this high school path?

This removes only this path’s notes, progress and experiments from this browser.