TokenTown: A visual way to understand how LLMs work
TL;DR Highlight
A browser city sim shows one token's round trip through a transformer.
Who Should Read
A backend developer who calls LLM APIs but has no feel for how tokens are processed inside the model
Core Mechanics
- A transformer drawn as a city
- Each district is one stage of the model.
- A convoy moves through tokenizing, embedding, positional encoding, the layer ring and the sampler.
- The layer ring repeats per layer
- One lap is attention, residual, feed-forward, residual.
- At the end it makes a probability distribution, picks one token and loops back.
- Parts are really computed
- Tokenizer split, embedding lookup, causal attention, GELU feed-forward and temperature/top-p sampling run live in the browser.
- Attention runs over a real growing KV cache.
- Prefill processes all prompt tokens at once while decode processes one.
- Scale is shrunk
- 12 dimensions instead of thousands, 2 heads instead of dozens.
- 2–12 layers instead of 80, a few hundred words instead of 100k+.
- Some parts are deliberately faked
- Weights are random and nothing is trained.
- Logits blend in a bigram prior from a small corpus, and attention gets sink and recency bias.
- The generated text is scenery, the mechanism is the lesson.
- Controls are simple
- Space pauses, S steps one stage, R resets.
- Speed runs 0.4× to 8×, with Layers, Temperature and Top-p sliders.
Community Reactions
- Other visualizers preferred
- A commenter said Brendan Bycroft's LLM visualiser (bbycroft.net/llm) helped them most.
- Another wanted an interactive 3Blue1Brown-style version.
- Criticism of the explanation text
- Commenters said the copy reads like generic Claude output heavy with jargon.
- Another asked to state the prerequisites.
- A factual inconsistency pointed out
- One comment noted the text says it is not a loop but a stack of blocks, yet the visual loops 6 times.
- Usability complaints
- One asked for mobile support.
- Others called it unhelpful or asked to filter vibe-coded projects from the homepage.
How to Apply
- Watch prefill vs decode in TokenTown
- Enter a prompt and press Run to see prefill process all tokens at once.
- Compare with decode, which handles one token at a time.
- Use it to explain why long prompts delay the first response.
- Feel sampling with the Temperature and Top-p sliders
- Run the same prompt while changing Temperature.
- See how output variety shifts before setting API defaults.
- Use it for onboarding with a backup resource
- Show TokenTown first.
- Pair it with bbycroft.net/llm since the explanations are thin.
Terminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls