Play Training Lab · 简体中文 · Neural Atelier
Train a small rover controller one step at a time. It can answer with three tokens: HOLD, GO, and CHECK. Choose the data or reward, apply a gradient update, and watch each command's probability change. The game runs entirely in the browser and saves checkpoints on the device. English and Chinese are available on desktop and mobile.
Play the 16 pretraining missions. Each deal starts with a small budget or a set of records on the table. Play a card to change the board, then submit the result. You can undo a move, replay the same deal, or try a new deal. Cleared missions and unfinished runs are saved in this browser.
| Station | One challenge to try |
|---|---|
| Data expedition | Open a fresh packet or reread an old one. Spend four updates and see which commands the model learned. Play |
| Corpus inspection | Move reports between training and validation. Keep all reports from each trip together while fulfilling the validation quota. Play |
| Training control room | Decide when to spend the two old batches among four new ones. Check both final command probabilities. Play |
| Experiment design | Check a one-run claim on paired training sets. Draw your conclusion from matched held-out losses. Play |
Start with the reading boundary in a four-word log. Move it one word and watch the prediction target change. The course builds from that example through 50 hands-on steps.
| Chapter | Steps | What you work out |
|---|---|---|
| Pretraining | 24 | Predict the next token, update three scores and test what happens when data gets scarce, duplicated or unevenly sampled. |
| SFT | 5 | Write the demonstration, select which tokens contribute to loss, score its answer, update the model, and save a checkpoint. |
| DPO | 5 | Label a pair, divide its probabilities, compare the ratio with a frozen reference, apply β, and update the two scores. |
| RL with REINFORCE | 6 | Draw a reply, score it, try a misleading reward, subtract a baseline, update the policy, and draw again. |
| GRPO | 10 | Sample a group, score each reply, center and scale rewards, and try an all-tie group. Then explore policy ratios, clipping, KL and the group-size setting in verl. |
Move a control to see the numbers and formula change together. Save for comparison keeps the current result on screen while you try a second setting. Check this step gives feedback and opens the next step when you meet the goal. You can also explore the steps in any order from the chapter menu. Returning to the game restores your place, settings, and comparisons in that browser.
The pretraining chapter starts with eight steps on prediction, loss and parameter updates. Use the remaining sixteen steps to investigate the training data.
- Count the budget (3 steps). Mark the target positions in a text window, count how many a batch supplies, and work out how many updates fit within 96 target reads. Count targets
- Shrink or repeat the corpus (6 steps). Keep three of twelve records and check which endings disappear. Then read three records four times or twelve records once. Each run trains on twelve target positions. The browser updates the model, freezes its scores and measures loss on the same six held-out records. Shrink the corpus · Compare equal budgets
- Inspect the data (6 steps). Find exact copies, measure how copying a line changes its training weight, and remove overlap between training and evaluation. Change the mix of two domains and check each domain’s loss. Find the copies
- Try twelve draws (1 experiment). Choose the number of distinct records in each run. Keep spending 48 target reads on 16 updates and see how often the draws miss CHECK. Compare the smallest, median and largest loss on the same 24 held-out records. Compare twelve training sets
Each chapter ends with an open-ended training bench. Guided lessons use fixed examples so you can replay a calculation. The full benches let you change data, take multiple gradient steps, and carry your saved model into later experiments.
| Experiment | What you control | What you can observe |
|---|---|---|
| Pretraining | Add log lines to a next-token corpus | The tokens' frequencies shape the next-token distribution. |
| Supervised fine-tuning (SFT) | Pick a demonstration for the instruction “Stop the rover” | Cross-entropy increases the demonstrated answer's probability. |
| Direct preference optimization (DPO) | Choose a preferred and a rejected response | The chosen/rejected odds move relative to their odds under a frozen reference. |
| REINFORCE | Sample eight replies and score correctness or brevity | Rewarding brevity makes the short, incorrect command more likely. |
| Group relative policy optimization (GRPO) | Score a group uniformly, switch reward rules, or reuse the rollout | Equal rewards have zero group advantage. A mixed group supplies a gradient. Reusing a group changes the policy ratios and can activate clipping. |
SFT can initialize its three trainable scores from a completed pretraining experiment. DPO and the two RL experiments independently start from the SFT checkpoint when available. Jumping ahead uses a built-in starting policy. Resetting an experiment loads its available starting checkpoint and keeps earned badges.
Each run trains three logits for one fixed prefix or instruction. A softmax converts them into a categorical distribution. The model has a one-token response and an explicit loss for each method. Transferring a checkpoint copies the three scores. This small action space lets the game calculate gradients and KL exactly. A production language model predicts many tokens with a shared neural network.
GRPO uses sample standard deviation, importance ratios against the rollout policy, and a clipped surrogate. An optional exact forward KL term penalizes divergence from a separate frozen reference policy. REINFORCE uses a zero baseline and draws a fresh on-policy rollout for the next update. Displayed losses are evaluated before each update and have different meanings across experiments.
From the repository root, start a static server with Python 3.
python3 -m http.server 8000 --bind 127.0.0.1Open the local game. Run the numerical tests with Node.js 20 or newer.
node --test tests/*.test.mjsThe course catalog connects the bilingual exercises to the guided interface. The full experiments use the gradient implementation, mission rules, and teaching notes. Serve the root HTML files, the root CSS files, favicon.svg, and the src directory for a static deployment.
- Examine the fixed-compute experiments on repeated data and their released training material. Scaling Data-Constrained Language Models · datablations
- Explore the studies behind the exercises on duplicates, train–validation overlap, and domain weighting. Lee et al. on deduplication · DoReMi
- Follow a text batch from inputs to shifted target tokens in nanoGPT.
- Read about human-written demonstrations in InstructGPT and preference pairs in the DPO paper.
- Compare policy gradients, the original GRPO paper, and the verl GRPO guide.
- Find the group size, advantage estimator, and KL settings in verl's Qwen3 GRPO recipe. The game implements its own browser-sized trainer.
MIT licensed.