Paths, four steps
Inside a language model
The groundwork for every path about language models: how text becomes vectors, how scores become probabilities, how positions read one another, and how blocks of attention and MLPs build a model.
none read yet
A language model turns text into numbers, mixes the numbers between positions, and turns them back into a choice of the next token. Four topics carry that whole picture, and several paths on this site rest on them. This short path takes them in order: tokens and the vectors they become, the softmax that turns scores into probabilities, attention, and the transformer that stacks it into a model.
The steps
-
Tokens and embeddings
A model computes with vectors, not words: how text is cut into tokens and each token becomes a vector.
Crossing: also step 2 of DNA-Socket
Crossing: also step 4 of Attention paper
-
Softmax
Wherever a model chooses, whether the next token or the positions attention reads, a softmax turns its scores into probabilities.
Crossing: also step 3 of DNA-Socket
Crossing: also step 5 of Attention paper
-
Attention
How each position takes in information from the others: queries, keys and values, and the mask that keeps a language model from reading ahead.
Crossing: also step 4 of DNA-Socket
Crossing: also step 6 of Attention paper
-
Transformers
How attention and MLPs are stacked into blocks that read and add to one running vector per position, the residual stream.
Crossing: also step 5 of DNA-Socket
Crossing: also step 5 of Weight-space programming
Crossing: also step 17 of Attention paper
At the end of the path
At the end of this path you can follow a token through a language model: into a vector, through blocks that mix it with the positions before it, and out as a probability for every next token. The paths that build on it start from here.
What you mark as read is kept in this browser only, never sent.