StorySprint

A 30M-parameter GPT trained from scratch to write short children's stories, and a training speedrun: reaching the same validation loss on a single NVIDIA T4 in as little time as possible. The model below runs entirely in your browser.

Parameters
30M
Architecture
6 layers, 256-token context
Demo model training
901M tokens
Inference
In-browser, ONNX

Try the model

Examples
Sampling settings

Lower is more predictable, higher is more varied.

Sample only from the k most likely next tokens.

A token is about three quarters of a word.

Loading model...

Speedrun results

5.64x faster: from 54.75 to 9.70 minutes of training on one Kaggle T4 to reach validation loss 1.95 (baseline and final, 3 seeds each, interleaved in the same session). Test loss of the final model, evaluated once: 1.9225.

Each step below was measured against a control run of the previous configuration in the same session, because GPU speed varies by up to about 12% between sessions.

ConfigurationTime to target Step speedupTotal
Baseline: fp32, hand-written attention, AdamW51.68 min-1.00x
+ fp16 autocast and GradScaler23.34 min2.37x2.37x
+ vocabulary padded to 50,30416.32 min1.29x3.05x
+ torch.compile13.54 min1.31x3.99x
+ SDPA attention, fused AdamW13.17 min1.06x4.23x
+ LR decay ending at the target11.65 min1.13x4.78x
+ peak learning rate 1e-310.47 min1.11x5.33x
+ peak learning rate 1.5e-3 (final)9.87 min1.06x5.65x

Each time is from the session that tested that step, so rows come from different machines; step speedups compare against the same-session control and the total is their product. The first four steps make the GPU faster; the learning-rate steps make the model need fewer tokens (45M down to 35M). The demo model is separate: the same speedups, trained for 901M tokens on text with repaired punctuation, instead of stopping at the target.

Method

Model and data

A GPT-2 style decoder with 6 layers, 6 heads and 384 dimensions, trained from random weights on TinyStories with the GPT-2 tokenizer.

Measurement

Every step is timed between GPU synchronisations; validation runs off the clock on 50 fixed batches. Every run is logged with its git commit, config, seed and GPU.

In the browser

The model is exported to ONNX, compressed to 50 MB (int8 weights, fp16 embedding) and run with onnxruntime-web. Prompts are processed on your device and never sent to a server.