Next token
An autoregressive model produces a distribution over possible next tokens, chooses one under a decoding rule, appends it and repeats.
Before you start: Review Attention first. Python-like examples use variables, lists and functions.
Follow the mechanism
Prefix
Provide the tokens already available.
Start with an everyday explanation
Predicting the next note in a song resembles choosing a continuation. A plausible next note does not establish that the song describes a true event.
See a concrete example
A toy distribution is approve 0.45, reject 0.33, settled 0.14 and pending 0.08. Greedy decoding picks approve even if the actual policy record says reject.
A claim to question
The most probable continuation is not necessarily the correct decision.
Try before revealing the answer
Write a decision rule that refuses to approve a claim without a verified record, regardless of generated wording.
Show the worked answer
Keep the business decision in authorized application logic. Let the model explain the verified outcome and cite the record; do not execute a sampled decision as authority.
Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.
Engineering details and trade-offs
A softmax converts logits into a probability distribution. Greedy decoding selects the highest probability; sampling can draw another token.
Stop rules, maximum output length and tool-call protocols are part of generation control. Token probability is not the probability a real-world claim is true.
Reason through the example
A toy distribution is approve 0.45, reject 0.33, settled 0.14 and pending 0.08. Greedy decoding picks approve even if the actual policy record says reject.
Implement and test
Write a decision rule that refuses to approve a claim without a verified record, regardless of generated wording.
Inspect the reasoning and expected result
Keep the business decision in authorized application logic. Let the model explain the verified outcome and cite the record; do not execute a sampled decision as authority.
What to measure
State the expected result before changing a control. Record your inputs, compare the observed result and explain one limit of this model. In a real implementation, test the failure case as well as the normal path.
Answer before reading the reference
Why can fluent text still be wrong?
A defensible answer
The generation objective favors plausible sequences. Truth requires evidence, task-specific checks and sometimes tools; fluency and local token likelihood do not supply those guarantees.
Prepare the follow-up
How do stop conditions prevent an endless agent conversation?
Show follow-up reasoning
The controller enforces step, token, time and tool budgets independently of generated text. Define success, blocked, failed and cancelled terminal states. Repeated observations or proposals should trigger a bounded retry or stop rather than another unlimited continuation.
Use the engineering explanation and worked task above to support your response. Identify which assumptions you would need to verify in production.
Choose a practice depth
- New to GenAI
- Define next token with the everyday example and name its key limitation.
- Applied experience
- Explain the example, implementation choice and a measured failure case. Use the exercise as a small design review.
- Senior or systems depth
- Answer the follow-up, compare alternatives and justify an evaluation or rollout plan with operational constraints.
Self-review your answer
0/4 checks selected. This is self-assessment, not an interview score.
Your explanation and revision notes
Loading local notes…