Town 06 · LLMs
The scriptorium
Eight residents who turn a question into an answer, one piece at a time. Meet them in order: from cutting up your words, through writing and training the writer, to the help she can call on.
Tokenizer · words into pieces
The typesetter
The model never sees letters or words. She cuts your text into pieces it already knows, common words whole and rare ones in parts, and swaps each piece for a number. That is what a model counts when it counts tokens.
The ideaText becomes numbered pieces
Language model · one token at a time
The writer
She has read most of the internet, and now she does one thing: look at the words so far and guess the next one. Then she adds it and guesses again. Every answer you have ever had from a chatbot was written that way.
The ideaPredict the next word, again and again
Transformer · every word looks at every word
The listener
Before he picks a word, he glances back over everything said so far and decides what matters for this one. In “she put the cup on the table and it broke”, he knows that “it” is the cup.
The ideaEvery word weighs every other
Context window · only so much fits
The reader
She reads everything at once: what you said, what you pasted and what she has written so far. But only up to a limit. Past it, the oldest words slide out of view, and she cannot use what she can no longer see.
The ideaOnly what fits in view counts
Fine-tuning · RLHF and preferences
The tutor
Straight out of training, the writer knows a great deal and has no manners. He shows her two answers to the same question and says which one is better, thousands of times over, until she writes the better kind on her own.
The ideaLearn which answer people prefer
Embeddings · meaning as a place
The mapmaker
She turns each word, sentence or page into a point on a map with hundreds of directions. Things that mean the same land close together, even when they share no words at all.
The ideaSimilar meaning, nearby point
Retrieval-augmented generation
The researcher
Asked something she might not know, she does not guess. She finds the closest pages on the map, pulls them from the archive, and answers with them open on her desk, so she can show you where it came from.
The ideaLook it up, then answer
Agents · a model in a loop, with tools
The handyman
He does not stop at an answer. He makes a plan, picks a tool from his belt, looks at what happened, and goes round again until the job is done or he has to ask you something.
The ideaThink, act, look, repeat