aditya|micro-gpt lab
01Material02Language03Learning04Understanding05Voice06Score
MicroGPT Lab · The Pipeline

Watch a machine
learn language.

200 lines of pure math. No frameworks. No shortcuts. From random noise to coherent text, step by step.

All computation runs in your browser. No server. No API calls.
01Step

The Material

Every model begins with a choice: what to learn from. The dataset defines the vocabulary, the patterns, the soul of what the model will become.

02Step

The Language

Before a model can learn, it must learn to read. Text becomes integers, the only language mathematics understands. Every unique character is a token; the rest is just index arithmetic.

Complete Step 01 first to unlock this section.
↑ Go to Step 01
03Step

The Learning

Thousands of tiny adjustments, each one nudging the model toward understanding. Loss is its confusion. Watch it fall as the model begins to see the patterns in language.

Complete Step 01 first to unlock this section.
↑ Go to Step 01
04Step

The Understanding

After training, look inside. Embeddings reveal how the model organised meaning in high-dimensional space, projected down to two dimensions. Attention shows which tokens the model focuses on at each position.

Complete Step 03 first to unlock this section.
↑ Go to Step 03
05Step

The Voice

The model speaks. Temperature controls the boldness of each prediction, a dial between certainty and creativity. At zero it picks the most likely token. At high values, pure chance.

Complete Step 03 first to unlock this section.
↑ Go to Step 03
06Step

The Score

Perplexity measures how surprised the model is by unseen text. A perfect model would always predict the next token correctly. Human language models achieve around 10 to 50. Ours starts at vocab size.

Complete Step 03 first to unlock this section.
↑ Go to Step 03
Built by Aditya Saxena · Based on microgpt.py by Andrej Karpathy · Runs entirely in your browser