src

A hand-made LLM

A 1-layer transformer with 22,375 weights. Every weight set by hand, none trained. It runs live in this page. Python version (NumPy, same weights).
Vocabulary: 10 tokens. Language: ". the cat sat on the mat ." or ". the dog ran to the park ."
Generate. Grey = prompt, green = valid, red = grammar error. Click a token to inspect it below.
1,000 generations of 40 tokens each, run in your browser
Architecture, and the residual stream (94 numbers) at . Click any token above to change position.
Attention: which earlier position each position reads
Output: P(next token) at each position
MLP: 3 hand-set AND gates
Weight count
W_U bigram part: current token to next-token logit
W_Q W_K: attention score, position i to j (first 14)
The full transformer design (this page is a 1-layer, 1-head slice of it)