How an LLM Answers a Prompt

Tap any part to see what it does.

← Back toAI Explainers
Context window Your prompt “Why is the sky blue?” Tokenizer Why · is · the · sky · blue · ? Embeddings blue → 0.21, 0.47, 0.03, … Positions 1 · 2 · 3 · 4 · 5 · 6 Transformer layers attention, then feed forward, many times Next word scores one score for every token there is Probabilities the scores, squeezed to add up to 100% The choice one token is picked The answer, growing the · … the loop: the new token joins the input

    Tap a part of the pipeline, or pick one from the list. Use Follow a token to trace one piece of your prompt through the model.

    Watch one word get chosen

    The prompt is: The cat sat on the… and the model must pick the next token. These numbers are an illustration, invented for this example in the pattern a real model produces; real probabilities come from the model itself.

    mat46%
    floor18%
    chair11%
    roof7%
    sofa6%
    everything else12%

    At a low temperature the model takes mat almost every time. Turn the temperature up and floor, chair and even roof get their turn, which is why the same prompt can answer differently twice.

    The assistants you already use

    Different products, the same engine: a transformer stack choosing one token at a time. Figures last checked 29 October 2026.

    Chat assistants

    ChatGPT · Claude · Gemini

    Architecture
    The transformer, as set out in the 2017 paper
    Unit of work
    The token, about 4 characters of English
    Answers
    Generated one token at a time, then streamed
    • The assistants differ in training data, tuning and tools, not in the basic loop this page traces.
    • One app can offer several models; the pipeline is identical, the stack is bigger or smaller.

    Open weight models

    Meta Llama and others

    Weights
    Published for anyone to run
    Same recipe
    Tokenizer, embeddings, transformer stack
    Trade off
    You control the machine; you also supply the computers
    • Open models made the pipeline on this page something you can run on your own hardware.
    • Their tokenizers and layer counts are public, which is why the internals here can be described so concretely.

    Check yourself

    Five questions on what you just explored.

    Sources

    Architecture claims trace to the original transformer paper. Token figures are published rules of thumb; individual models differ.

    1. Attention is all you need Vaswani et al., 2017: the transformer paper
    2. Introduction to Large Language Models Google Machine Learning Crash Course
    3. Tokens and the rule of thumb OpenAI developer documentation

    Researched and compiled for The Signal. Figures last checked 29 October 2026.