Charlie Madden — The Field GuideArtificial intelligence
Open the black box one concept at a time. Learn how language models train, use context, generate answers, and fit into a reliable human workflow.
The learning path
- A model learns a pattern
- Text becomes a stream of tokens
- Context changes what a word means
- One distribution, many answers
- Fluency is not verification
- Build a workflow you can evaluate
A model learns a pattern
Data, parameters, training, and inference
Separate the process that changes a model from the process that uses it.
AI is broader than a chat window
Artificial intelligence covers many approaches and tasks: recognizing objects, recommending items, controlling systems, and generating media. This path focuses on language models, which assign probabilities to sequences of text units called tokens. A model contains learned numerical parameters. Those parameters help transform an input into an output distribution. They are not a neat collection of sentences filed by subject. A model can learn useful patterns, sometimes reproduce memorized material, and sometimes generate something wrong. None of those possibilities can be inferred from fluent style alone.
Training changes the parameters
During a common pretraining setup, the model sees text, predicts a token from preceding tokens, and receives a numerical measure of prediction error. An optimization procedure repeatedly adjusts parameters to reduce that error across many examples. Data selection matters because it shapes what patterns are available to learn, including errors, gaps, and biases. GPT-3's research paper is an important historical example of scaling this approach. It is evidence about a particular training recipe and evaluation, rather than a specification for every system available today.
Inference uses the learned parameters
When you send a prompt, ordinary inference uses the trained model to calculate outputs. It generally does not perform a training update to the base model's parameters just because the conversation continues. Instead, the system supplies a context containing instructions, messages, and perhaps documents or tool results. Changing that context can change the answer immediately. A product may separately store memories or use conversations under its policies, but storage, retrieval, and retraining are distinct mechanisms. Avoid using the single word learns for all of them.
An assistant has more than one layer
A deployed assistant may add instruction tuning, preference-based training, retrieval, tools, and product rules around a pretrained model. The InstructGPT paper demonstrates one historical approach using demonstrations and human rankings to improve instruction following. These layers influence behavior but do not make mistakes impossible. To investigate a surprising response, separate the pieces: what did training teach, what was in context, which tool was called, and what did the surrounding application do? This decomposition is more useful than assuming every behavior comes from one mysterious intelligence.
Training changes parameters. Inference uses parameters with a supplied context. An application can add other systems around both.
Sources
Text becomes a stream of tokens
Tokenization and next-token prediction
Understand the repeating step that turns a prompt into a generated answer.
Tokens are pieces, not necessarily words
Before a language model processes text, a tokenizer maps it to a sequence of identifiers. Depending on the tokenizer, a token may represent a word, part of a word, punctuation, or other bytes and characters. Common subword methods let a finite vocabulary represent unfamiliar words as smaller pieces. Sennrich and colleagues demonstrated the usefulness of subword units for translation. Different systems use different tokenizers, so a hand-drawn split is only illustrative. It should not be presented as the exact internal representation of every model.
A prediction is a distribution over possibilities
After the prefix The door is, many continuations are possible: open, closed, blue, and others. The model assigns scores that can be converted into probabilities over its vocabulary. It does not need to retrieve one prewritten sentence to continue. Choosing one token extends the sequence; the model then calculates another distribution conditioned on the extended context. Repeating this operation can produce a paragraph, a computer program, or a conversation. Some outputs are highly constrained by context, while others allow many plausible continuations.
A simple objective can support complex behavior
To predict text well across many situations, a model can benefit from learning regularities involving syntax, facts, style, and relationships. That helps explain why a next-token training objective can support much richer tasks than finishing a short phrase. It does not establish that every apparent reasoning step is reliable, or settle philosophical questions about understanding. Evaluate a capability through tasks with known criteria. A system might produce a useful explanation in one case and fail a slight variation, so one impressive answer is a weak measurement.
Token boundaries have practical effects
A character-counting request and a word-counting request may be awkward when the model operates on a different set of units. Names, languages, and formatting can consume different numbers of tokens. The available context and generated output are also bounded in tokens, with limits depending on the system. When precision matters, a calculator, parser, or short program may be a better tool than asking the model to imitate one. In this lesson's visualization, the token pieces and scores explain the idea; they are not live measurements from a deployed model.
Generated text grows one token choice at a time, with each choice changing the context for what follows.
Sources
Context changes what a word means
Representations, attention, and context limits
Explain how a transformer combines information across a sequence without treating attention as a mind-reading tool.
The same word can play different roles
Compare “the bank approved a loan” with “we sat beside the river bank.” The word bank appears in both, but surrounding words change the useful interpretation. A transformer represents tokens as numerical vectors and repeatedly updates those representations using information from the sequence. Positional information helps preserve order. Attention is one important mechanism for combining information from different positions. In a generation model, causal masking prevents a position from using future tokens that have not yet been generated. The model must continue from the information actually available.
Attention mixes information using learned weights
In the original Transformer paper, attention calculates compatibility between numerical queries and keys, then uses the resulting weights to combine value vectors. The labels query, key, and value describe mathematical roles, not literal database searches. Multiple attention heads can form different combinations in parallel. Feed-forward layers and other architectural components also transform the representations. The visual intuition is a changing set of connections between token positions. It is a simplification: drawing a bright line between two words does not expose a complete reasoning process or prove a human-like understanding.
The supplied context is a working surface
A prompt can include your task, examples, source passages, previous messages, and retrieved material. These all compete for a bounded context. Information outside the supplied context is not automatically visible, even if an application can retrieve it separately. Long context also does not guarantee that every detail will be used correctly. For a practical experiment, ask a model to interpret a sentence, then add a short passage resolving an ambiguity. Compare the answer and identify the exact evidence that should have changed it.
Make the relevant evidence easy to find
A useful document question identifies the task and supplies the passages needed to answer it. Clear labels can distinguish instructions from quoted source material. Ask for supporting passages and check whether they justify the conclusion. When documents conflict, preserve that conflict instead of asking for a smooth answer that hides it. These are workflow choices that help you inspect performance; they are not guarantees produced by the attention mechanism. Keep the mental model modest: context can influence a representation, but influence is not the same thing as verified interpretation.
Attention helps combine information across context. A connection diagram is an explanation of a mechanism, not a complete account of a model’s reasoning.
Sources
One distribution, many answers
Decoding, sampling, and temperature
Understand why repeated prompts can produce different outputs and why randomness is not a truth control.
The model and the selection rule are different
A model computes scores for possible next tokens. A decoding procedure decides what to do with them. Greedy decoding selects a highest-probability token at each step. Sampling instead draws from a distribution, allowing alternatives to appear across runs. This difference matters because generation is a sequence: an early alternate token changes the input for all later choices. Two answers can diverge substantially even when they begin with the same prompt and the same underlying model. The selection rule is part of the system you are evaluating.
Temperature changes the shape of the distribution
For positive temperature T, a common implementation divides token scores by T before applying softmax. Lower values concentrate probability on higher-scoring options; higher values spread probability more broadly. Imagine illustrative options quiet, bright, and crowded. Increasing temperature may make less likely continuations appear more often. It does not insert better knowledge, improve sources, or determine whether any option is true. A zero-temperature setting is commonly treated as greedy selection, but exact reproducibility can still depend on the system, implementation, and other conditions.
Other decoding choices affect the result too
Nucleus sampling, introduced by Holtzman and colleagues, samples from a set of candidate tokens whose probabilities cover a chosen cumulative mass. The candidate set changes as the distribution changes. Their work shows why simply maximizing sequence likelihood can produce repetitive or otherwise poor open-ended text. Quality is not one number: a story, a factual extraction, and a strict data transformation need different checks. Some products expose sampling controls while others manage them internally. Understand the concept without assuming a specific interface or a universal best setting.
Match the experiment to the job
For creative work, compare several drafts and decide which better meets the brief. For factual work, keep trusted evidence and a verification step. For extraction, check the output against the source rather than judging how confidently it is written. When comparing settings, hold the prompt and source material fixed and test multiple cases. Otherwise you cannot tell whether an apparent improvement came from the setting or an easier example. The distribution in this demo is invented for teaching; its moving bars are not measurements of a production model.
Sampling controls variation in selection. It cannot turn an unsupported answer into a verified fact.
Sources
Fluency is not verification
Grounding, retrieval, and failure modes
Recognize why a plausible answer can be wrong and how external evidence helps without removing the need to check.
Plausible text can contain false claims
A language model can generate a polished citation to a paper that does not exist. NIST's Generative AI Profile calls the confident presentation of false or erroneous generated material confabulation. The problem is especially consequential when readers mistake style for verification. The probability of a token is not a calibrated probability that a whole real-world claim is correct. Nor should a model's verbal confidence be treated as a dependable measurement. Ask which parts of an answer can be checked, against what evidence, and at what cost.
Retrieval adds a source to the working context
A retrieval system searches an external collection for passages relevant to a question and supplies them to a generator. The original retrieval-augmented generation paper combines learned parameters with retrieved information for knowledge-intensive tasks. A modern document assistant may use a different design, but the basic separation remains useful: finding evidence and generating an answer are different operations. Retrieval can supply newer or more specific material than training alone. It can also retrieve the wrong passage, miss an important document, or pass an outdated source into the answer.
Grounding requires a chain you can inspect
For a concrete claim, check whether the cited source exists, whether it actually says what the answer claims, and whether it is appropriate for the question. A valid-looking link can still be irrelevant. A correct quotation can be taken out of context. If two documents disagree, a reliable workflow should surface the disagreement. Treat retrieved material as evidence to evaluate, not as permission for that material to issue new instructions to the system. Tools, access controls, and application design matter alongside model behavior.
Build an honest stopping point
Sometimes the right result is insufficient evidence. You can define that outcome before testing: if the supplied documents do not establish an answer, the workflow should say so and identify what is missing. Use independent calculations for arithmetic and inspect consequential claims against authoritative material. The aim is to make errors easier to detect and contain. Confidence, citations, and extra context each help only when they are connected to an actual verification process. A system that admits a gap can be more useful than one that completes every sentence.
A grounded answer has an inspectable connection to relevant evidence, including a way to say the evidence is missing.
Sources
Build a workflow you can evaluate
Tasks, tests, tools, and human judgment
Design a small AI-assisted process with a clear success condition and a human accountable for the result.
Choose a task with visible boundaries
Start with something specific: extract a set of dates from supplied meeting notes and attach the sentence supporting each date. Define the input, the permitted operations, and the expected output. A narrow task makes mistakes visible. “Help with my work” leaves too much unspecified to evaluate. Also decide what happens when the source is ambiguous or incomplete. A useful first workflow can draft an answer for review while leaving consequential actions to a person. More autonomy should follow evidence about performance and consequences.
Write a small evaluation set before polishing
Collect representative examples: an easy case, an ambiguous date, two conflicting notes, and a document with no relevant date. Write the correct behavior for each, including when the system should abstain. Then compare the output with those expectations. Count unsupported claims, omissions, incorrect fields, and useful corrections. A prompt that works on one favorite example is not yet a dependable process. Keep some cases aside when revising, so improvement means more than tailoring the prompt to the exact examples already seen.
Use the right component for each job
A parser can validate a date format. A calculator can perform arithmetic. Retrieval can fetch a source. A model can interpret varied language and draft a readable explanation. A person can resolve ambiguity, judge consequences, and approve an action. Combining these components is often more reliable than asking one chat response to perform every role invisibly. Document which component did what. If the model gains access to tools, give it only the permissions the task requires and keep meaningful actions observable and reviewable.
Evaluate the whole system over time
NIST's AI Risk Management Framework emphasizes context, measurement, and ongoing management. The relevant system includes the model, sources, tools, interface, users, and conditions of use. Change one of these and old results may no longer describe the workflow. Record failures, rerun relevant cases after changes, and preserve a way to stop or recover. This path ends with a practical standard: useful output, evidence of performance, and someone responsible for the result. Next, Bitcoin offers a different perspective on rules, verification, and the boundaries of trust.
Define success, test representative cases, assign each component a clear job, and keep a human accountable for consequential results.
Sources
Glossary
- Parameter
- A learned numerical value used by a model to transform inputs and calculate outputs.
- Training
- A process that adjusts model parameters using data and an optimization objective.
- Inference
- Using a trained model to calculate an output from a supplied input or context.
- Token
- A unit of encoded input or output, such as a word fragment, punctuation mark, or other piece defined by a tokenizer.
- Context
- The bounded material supplied for a model’s current computation, including instructions, messages, and possibly external evidence.
- Attention
- A learned mechanism that combines information from positions in a sequence using numerical weights.
- Temperature
- A decoding setting that changes how concentrated or spread out token-selection probabilities are.
- Retrieval-augmented generation
- A system design that supplies retrieved external information to a model during generation.
Enable JavaScript for scroll-driven visual stories, hands-on experiments, checkpoints, and browser-local progress.