Build a Mini Language Model in Browser
Train an educational language model on your own text corpus. Inspect vocabulary, forward predictions, training loss, and generate continuations.
Architecture Breakdown: Autoregressive Next-Token Prediction
When typing on your phone, it suggests the next word. A Language Model does the exact same thing: it looks at what came before and calculates the most likely next word to continue the thought.
At first, the model guesses randomly. Every time it predicts the wrong word, it measures its mistake (Loss) and adjusts its internal connection dials (Weights) until it memorizes the rhythm.
Click "Train Mini Model (50 Epochs)" below. Then type "the" and click "Generate Continuation" to watch your browser model write sentences!
Generate Continuations with Your Trained Model
Quick Reference & Instructions
Simple steps, pro tips, and execution details
Provide Inputs
Type, paste, or select your values in the form fields below.
Instant Live Analysis
Calculations and formatting happen automatically with zero delay as you type.
Copy or Use Output
Copy results or apply the clean output directly to your projects.
How It Works
Creates a working in-browser neural transition model, extracts vocabulary tokens, trains across user-controlled epochs, and generates completions.
Frequently Asked Questions
Common questions about calculations, assumptions, and edge cases.
Yes, Build a Mini Language Model in Browser is 100% free with unlimited calculations and zero paywalls or subscriptions.
Related Tools
Explore all llm tools →LLM Generation Simulator
Watch an LLM generate text step by step: Tokenize → Forward Pass → Softmax → Sampling → Append → Repeat.
Educational Tokenizer Simulator
Interactive educational tokenizer showing character splits, subword boundaries, token IDs, and vocabulary mappings in real-time.
LLM Training Loop Simulator
Simulate training an LLM across multiple epochs: batches, forward passes, cross-entropy loss, and AdamW weight updates with live loss curves.