Run Karpathy's microGPT in Your Browser — No Install Needed

Explore the full GPT algorithm in 243 lines of pure Python. Train tiny models, visualize attention, generate names — all interactively.

Interactive microGPT Demo

// Output will appear here after training or generation... // Try: Type "ana" and click Generate to see microGPT predict next tokens

Why MicroGPT Playground?

🌐

Browser-Based Training & Inference

Run microGPT entirely in your browser. No Python installation, no dependencies — just open and experiment.

👁️

Interactive Attention Visualizer

Watch attention maps in real-time. See exactly how tokens attend to each other in the transformer.

📚

Zero Dependencies — Pure Education

Based on Andrej Karpathy's 243-line pure Python implementation. Learn GPT from its most atomic form.

💡

Based on @karpathy's microGPT

The viral open-source project that's helping thousands understand how LLMs actually work under the hood.

How microGPT Works

1

Tokenizer → Numbers

Convert text into token IDs using BPE tokenizer. Each word becomes a number the model can process.

2

Embed + Attention

Tokens flow through embeddings and multi-head attention. The model learns contextual relationships.

3

Logits → Next Token

Final layer outputs probability distributions. Greedy or sampling picks the next token — autoregressive generation.

Why microGPT?

Demystifies LLMs: See exactly how gradients flow, why causal masking matters, in the most atomic form possible. Perfect for students, researchers, and self-learners who want to understand the heart of modern AI.