Skip to content
HomeNewsDigestsConceptsGuidesToolbox
AboutSubscribeUA
Subscribe

AI Today Brief

The daily AI-engineering brief. Built in public. EN · UA.

XTelegramLinkedInYouTubeRSS

Follow AI Today Brief on LinkedIn for daily AI-engineering updates and the weekly “5 shifts that changed how developers work” PDF.

Explore

NewsDigestsConceptsGuides

Company

SubscribeAdvertiseAbout

Legal

Editorial policyAI disclosurePrivacyTerms

© 2026 AI Today Brief. All rights reserved.

  1. Home/
  2. News/
  3. Tutorials & guides/
  4. TokenTown Visualizes Transformer Mechanics and Key-Value Caching in Interactive City Model
Tutorials & guides

TokenTown Visualizes Transformer Mechanics and Key-Value Caching in Interactive City Model

TokenTown is an interactive browser visualizer that maps each stage of a transformer language model to an isometric city district, simulating attention, KV caching, prefill, and decode phases.

July 27, 2026· 3 min read
OKCurated by Oleksandr Kuzmenko, AI Product Engineer·Updated July 27, 2026·Sources cited on every story
AI-assisted · editor-reviewed·How we use AI
TokenTown Visualizes Transformer Mechanics and Key-Value Caching in Interactive City Model

Why it matters

Explore TokenTown to build an intuitive mental model of prompt prefilling, token decoding, and KV cache memory dynamics.

TL;DR

  • 01TokenTown simulates transformer architecture in a live browser-based isometric city.
  • 02Demonstrates real differences between parallel prefill and sequential token decoding.
  • 03Visualizes KV cache growth and multi-head scaled dot-product attention in real time.

Key facts

Model Size
12 dimensions, 2 heads, 2-12 layers
Interactivity Controls
Space (Play/Pause), S (Step), R (Reset), Speed slider (0.4x-8x)

Inside the TokenTown Architecture

The visualizer scales down large language model parameters to run live in JavaScript:

  • Model Dimensions: 12 dimensions, 2 attention heads, 2–12 configurable layers
  • Vocabulary: A few hundred words
  • Mechanics Rendered: Tokenizer split, embedding lookup, sinusoidal positional encoding, LayerNorm, multi-head attention with causal masking over a live KV cache, GELU feed-forward, and top-p sampling.

Prefill vs Decode Execution

The simulation directly highlights execution differences:

  • Prefill Phase: Processes the entire input prompt simultaneously through attention layers.
  • Decode Phase: Generates tokens sequentially, demonstrating why autoregressive generation requires persistent KV cache storage.

✓ When to use

  • When explaining LLM architecture, KV cache memory overhead, or prefill vs decode stages to engineering teams.
  • When building visual intuition for how transformer tokens flow through residual attention layers.

What to do today

  • →Visit laurentiugabriel.github.io/token-town to run the interactive tour.
  • →Use Space to pause and S to step through transformer layer dynamics step-by-step.

What the community says

  • “Looks like the PG world website we've seen on the frontpage. Did you get some inspiration from that project?”

    — jamunachavan on Hacker News

#TokenTown#Transformer

Sources

  • TokenTown – Learn how LLM's work in a SimCity-like world
  • Hacker News TokenTown Discussion
ShareShare on XShare on LinkedIn
← Previous storyClaude Shared Chats Exposed in Search Engines via Missing Indexing TagsNext story →Intel Benchmarks Agentic AI Fleets with vCPU Density and Latency Metrics

Related stories

  • Tutorials & guidesExporting Full Conversation Histories and Artifacts from Claude.ai
  • Tutorials & guidesReverse Engineering Claude's New System Prompts, Refusal Rules, and Modifiers

Email digest

Get the morning AI brief

One email a day — the stories that matter for engineers, founders and tech leads. Human-edited, with links to primary sources.

  • ✓120+ sources scanned daily
  • ✓Edited by a human
  • ✓1 email per day
  • ✓EN + UA

By subscribing you agree to the privacy policy.