The prompt
7 tokens“We reply within five business …”
The start of a sentence from Larkspur’s guides.
Module 7 · Transformers
A language model writes one token at a time. Each time, every token of the prompt becomes a vector, attention lets each one weigh the tokens before it, and the last one ends up as a score for every token the model knows. Here you open a tiny one up and watch.
The whole idea in one example
“We reply within five business …”
The start of a sentence from Larkspur’s guides.
Larkspur mini’s five likeliest, of all 768.
Pick one, add it to the prompt, run again, and a reply grows one token at a time. Larkspur mini is tiny: 51,072 numbers, trained only on Larkspur’s own documents. It runs for real in your browser. It shows how the machinery works; it is no provider’s model.
How it works
The model reads the prompt’s tokens and scores the next one
Vaswani and colleagues introduced the Transformer in 2017, a network built on attention alone, with no recurrence or convolutions.
Source, checked 21 October 2026
Each token weighs the tokens before it
Scaled dot-product attention is softmax(QKᵀ / √d_k) V: each query is scored against every key, and the scores weight the values.
Source, checked 21 October 2026
Token 4 looks only back, never ahead
The original Transformer's decoder masks attention so a position cannot look at the positions after it, which keeps generation one token at a time.
Source, checked 21 October 2026
2 layers of 2 heads, each looking its own way
Multi-head attention runs several heads side by side, so the model can attend to different kinds of information at once.
Source, checked 21 October 2026
The story
Larkspur Supply Co.’s team opens up “Larkspur mini”, a tiny model trained only on Larkspur’s own documents, and watches it work in the browser. You’re on the team that wants to know why it says what it says, and what a long prompt costs.
Played Tokens? Larkspur mini reads the same tokens as this site’s tokenizer there. RAG chapter 2 showed why you can’t send everything; chapter 6 here shows what a long prompt costs inside.
Your path


Chapter 2 · done
How does a token id become something the model can compute with, and how does it know where the token sits?


Chapter 4 · done
Why does a model have many heads and many layers, and how do their results come together?


Chapter 6 · done
Why does the work grow faster than the prompt, and what does the KV cache save?

Engineers, product managers and analysts who use language models and want to see what happens inside one. It builds on Tokens & embeddings; any maths is optional.