Suplemento · interativo

Inside a Large Language Model

Tokens, camadas, pesos e o sistema construído em volta, desmontados à mão.

A large language model is a trained mathematical system. It turns language into numbers, pushes those numbers through many layers, and writes text one token at a time. It is not a database, a search engine, or a mind. And it is never the whole system.

The print edition draws this cross-section once. Here you can walk it stop by stop: one component per stop, what it does, and the limit worth keeping in view. Three small demos then let you try the mechanics yourself.

1The cross-section

Read the drawing downward: input falls through tokens and layers into the next token. Training and the surrounding system sit outside that flow. Scroll, or press any part of the figure.

08 · the system around ittools · people · rules06 ·trainingpretraining04 ·parameterslearned weights07 ·post-trainalignment01 · input + contextprompt · history · documents02 · tokenslanguage as numbers03 · transformerlayers × N · attention05 · next tokendecoding, one at a timeappend · repeat
fig. 1 · the model as a stack of processing layers; training and the surrounding system stay outside the flow
  1. 01

    Input and context

    Everything the model can work with is here: the prompt, the conversation so far, any documents or tool results placed in front of it. It has nothing else. Only this context, plus what training left in its weights.

    limit ·A larger context does not guarantee the model will notice, remember, or correctly use every detail in it.

  2. 02

    Tokenization

    Before any processing, language is cut into tokens: whole words, parts of words, punctuation, spaces. Each token maps to a number the model can compute with.

    limit ·The model does not read language as people do. Its units are statistical, not semantic.

  3. 03

    Transformer layers

    Dozens of repeated layers transform the numbers. Attention lets every position relate to every other, and most of the model's language processing happens here.

    limit ·No layer handles grammar and no layer handles reasoning. Their functions are spread across the stack and hard to pin down.

  4. 04

    Parameters and weights

    Billions of learned numbers decide how each layer transforms its input. Training adjusted these values until the model got good at recognizing patterns in language.

    limit ·Parameters are not a database of facts. More of them does not mean more accurate, safer, or more knowledgeable.

  5. 05

    Output generation

    The model scores every possible next token, picks one through a process called decoding, appends it to the context, and repeats. Text emerges one piece at a time.

    limit ·A likely continuation is not necessarily a true or verified statement.

  6. 06

    Training data and pretraining

    Before anyone uses the model, it learns by predicting missing or next tokens across an enormous collection of text. Its general capabilities come from this step.

    limit ·The data decides which perspectives the model has seen, and which errors and biases it may reproduce.

  7. 07

    Post-training and alignment

    After pretraining comes guidance: supervised examples, human feedback, preference optimization, safety training, system instructions. This shapes how the model follows instructions and handles risk.

    limit ·Post-training can shape behavior. It cannot remove every error, bias, or unsafe possibility.

  8. 08

    The system around the model

    The LLM is one part of a larger apparatus: retrieval, tools, permissions, interfaces, logs, safety controls, and people. The surrounding system decides what the model can access and what it may do.

    limit ·Safety and accountability live in the whole system: monitoring, human review, institutional rules. Not in the weights alone.

···

2Watch language become numbers

The model never sees your sentence, only the tokens it breaks into. Edit the line below and watch the boundaries move.

The0·model1·does2·not3·read4·words5.6·It7·reads8·tokens9.10
11 tokens · 47 characters

An illustration, not a real tokenizer. Production tokenizers learn their vocabulary from data and map each piece to an integer id; the boundaries above follow a simple heuristic. Spaces, punctuation, and parts of words are tokens too.

3Watch attention move

Inside the layers, every position can draw on every other. That is attention. It is also why the layers have no tidy human names.

point at a word

Theriverfloodedthefieldsbecausetherainhadbeenheavy

A sketch of one attention head, not measurements from a real model. Real models run many heads like this in parallel, in every layer. Each position gathers from the others; that is how flooded finds rain six words back.

4Watch a token get chosen

Generation is a loop: score every possible next token, pick one, append it, repeat. Temperature decides how closely the picker follows the odds.

the distribution over the next tokentemperature 1.00

Asked about the hearing, the model replied:

  • The28%
  • Our16%
  • It14%
  • A12%
  • We11%
  • This9%
  • Their6%
  • One4%

the model's own odds, unadjusted

5What it is not

An LLM can be useful without being consistently correct. Capability, what the model can do on its best day, is not reliability, what you can count on every time in your room. Its behavior depends on everything connected to it: the data it was trained on, the parameters it learned, the context it receives, the way its output is generated, and the larger system around it.

An output is a prediction or a proposal. It is not yet a fact, an explanation, or a decision.

Keep that in mind whenever the model sounds fluent. Fluency is what the machine does. Judgment is yours.