How do
Illustrative focus pattern
AI ENGINEERING / LLMS
From your words to an AI-generated response.
Follow the complete journey of a prompt as it becomes tokens, numerical vectors, contextual representations, and finally a generated answer.
Interactive lab
Change the input, select a token, and follow each transformation.
01 / Tokenization
Each outlined chip is one illustrative token. Real token boundaries and IDs depend on the model's tokenizer.
02 / Embeddings
03 / Positional encoding
Position signals here are illustrative; real models may use learned positions or methods such as RoPE.
04 / Self-attention
Choose a query token
Attention weights · softmax(QKᵀ / √dₖ)
Toy vectors and scores make the calculation visible; they are not outputs from a trained model.
05 / Multi-head attention
How do
Illustrative focus pattern
How models
Illustrative focus pattern
How AI
Illustrative focus pattern
06 / Transformer block
Token embeddings combine with position signals.
07 / Next-token prediction
2.41.81.30.60.1Logit → softmax(logit / temperature) → next-token probability. Higher temperature flattens the distribution.
08 / Autoregressive generation
Context How do AI models learn?
Each step adds a token to the context used for the next prediction.