Chop it up — an image is a paragraph of patches
Step one is brutally simple: cut the image into a grid of patches (ViT-style, usually 14×14 or 16×16 pixels each) and treat each patch as one "word", read left-to-right, top-to-bottom like text. Drag the patch size on the scene below and watch the token count change — and notice what happens to the tiny sign in the corner as patches grow.
The scene is generated (sky, mountain, house, and a small "SALE" sign); the patch grid and token count are computed from your slider. The sign-legibility readout measures how many patches the sign occupies.
The codebook — a dictionary of visual syllables
For generation (VQ-style tokenizers), patches don't stay as raw numbers — each is snapped to its nearest entry in a learned codebook: a finite dictionary of visual syllables. Below, a real k-means-style codebook is built live from the scene's patches. Drag the codebook size: with 256 codes the reconstruction is faithful; with 8, every patch must pick from 8 clichés and the image becomes visual mad-libs.
Real quantization running live: patches are clustered (k-means, 8 iterations) into your chosen number of codes, then each patch is replaced by its code's average — the reconstruction error is measured per pixel.
The compression tax — 588× smaller, what died?
Do the arithmetic nobody shows you: a 1024×1024 RGB image is ~3.1 million numbers. After tokenization it's 256-1024 tokens. That's a ~600× compression, and compression that violent must kill something. The autopsy below shows what: reconstruct the scene through the tokenizer and inspect the difference map — where the reds glow is what the model literally cannot know about your image.
Reconstruction = EP 02's quantizer at production-ish settings; the difference map is the actual per-pixel error, amplified for visibility. High-frequency detail dominates the loss — the universal signature of every visual tokenizer.
One vocabulary — text and pixels in the same sentence
The endgame: once images are tokens, a single model can read and write mixed sequences — text tokens and image tokens interleaved in one stream, one next-token loop for everything. Watch a unified model process a real mixed prompt below: the token stream shows text (white) and image tokens (gold) flowing through the same context window, and the same predict-next machinery producing both kinds.
Context accounting is exact for the chosen setup (1,024 tokens per image, 4,096 window). The streaming animation shows why "how many tokens does an image cost" became a real line item in multimodal API pricing.
Resolution economics — spend tokens where the pixels matter
Production dilemma: a document photo arrives. Tokenize it at low res (cheap, 256 tokens) and the fine print dies; at full res (4× tiles, 1,280 tokens) everything survives but costs 5× and crowds the context. Modern systems route: cheap global view + high-res tiles only where needed. Play the operator: choose a strategy for each of three jobs, the meters score your reading accuracy per token spent.
Accuracy-per-job curves encode the structural truth: smooth content saturates at low res; text-dense content needs patches smaller than the glyphs. Token counts match common production tiling schemes.