ellmiott

A language model, taken apart

Inside the next token.

Build a small GPT. Follow a prediction through the numbers.
Every prediction below comes from real model weights.

01—06

Six experiments.
One open notebook.

Start exploring
Loading the model…Small enough to inspect.
01 / EXPERIMENT

A little context. A new possibility.

Runs in your browser
7 characters
0.80
More predictableMore surprising

Each step samples with the selected seed; a full continuation advances the random generator.

CONTINUATIONREADY WHEN YOU ARE
One character at a time. See where it goes.
THE NEXT CHARACTERT = 0.80

What might come next?

A prediction is a distribution of possibilities. Sampling picks one.

Loading real model weights…

MOST LIKELY—
UNCERTAINTY—

Probabilities include your temperature and top-k settings. Higher uncertainty means more possible next characters.

TEXT → TOKENS → NUMBERS

There’s a vector behind every character.

Select a token to inspect its embedding.
Your input tokens will appear here.
Token embedding
First 8 learned dimensions
02 / UNDER THE SURFACE

Which characters get attention?

The future is off limits. ↙
LessMore
Predicting from ↓
Attending to →

Each row distributes one token’s attention across itself and earlier tokens.

03 / LEARNING, MEASURED

Practice leaves a trace.

Read the model card
CROSS-ENTROPY LOSS ↓
TrainValidation

Loading recorded training measurements…

Lower loss means better next-character predictions. Validation uses held-out text the model did not train on.

LEARNABLE PARAMETERS—A decoder-only transformer
TRAINING STEPS—Measured from the actual run
THE READING MATERIALLoading corpus details…Source and provenance included
YOUR TEXT / YOUR WEIGHTS

Teach it something of your own.

Learning happens here. ↙

Choose plain text, train a small GPT from scratch, then explore its predictions and attention in the lab. Your text stays on this device. No account, API key, or server training.

400–200,000 characters, 2–256 distinct characters. The first 90% trains the model; the last 10% is held out for validation.

Inspect the character vocabulary

02 / WATCH IT LEARN

From random guesses
to familiar patterns.

One transformer layer, four attention heads, 32 embedding dimensions, and a 32-character context. This is smaller than the published Shakespeare model.

Choose your text to begin. Keep this tab open while training.

TRAIN LOSS—
VALIDATION LOSS—
Cross-entropy, nats per character · lower is better
StepTrainValidation
04 / FIELD NOTES

Learn by changing something.

The full six-lesson course
01

Letters become tokens.

Start with “The ”. Select each character and compare its learned vector of numbers.

Read the lesson
02

Where letters live.

Inspect both e’s in “letter”. The same character shares a learned vector, even in different positions.

Read the lesson
03

Context changes everything.

Try “The ”, then “The king ”. Watch how the same space leads to a different next character.

Read the lesson
04

Take one head away.

Disable an attention head, then re-enable it. See whether the likely next characters change.

Read the lesson
05

Follow the learning curve.

Compare untrained, early, and trained checkpoints. A falling loss is evidence of learning, not a promise of wisdom.

Read the lesson
06

Turn up the temperature.

Keep the same prompt and seed. Compare low and high temperatures as the distribution changes.

Read the lesson