NanoReasoner-300M (v1)
NanoReasoner-300M is a 352,321,602-parameter math and Python reasoning language model trained from random weights on Modal GPUs (B200 and H100) and Google Colab, designed to run locally on a 4 GB GTX 1050 Ti.
v1 started as an experiment to see if an LLM coding agent could design, train, and benchmark another LLM from scratch on a tight budget. Now that v1 works end to end, v2 is the real test of how good an LLM can actually make another LLM once we fix v1's bottlenecks.
Checkpoints
| File | Stage | Notes |
|---|---|---|
checkpoints/sft_v4_4_final.pt |
Recommended SFT | Best checkpoint. Trained from midtrain_final.pt for 1,600 steps (val_loss=0.4751). 6.97% greedy GSM8K, 25.0% math Pass@4, 16.67% MBPP Pass@4, 100% closed </think>. |
checkpoints/pretrain_final.pt |
Stage 1 base | 65,000 steps (8.52B tokens) across FineWeb-Edu, Cosmopedia v2, FineMath 4+, and CodeParrot Clean. |
checkpoints/midtrain_final.pt |
Stage 1.5 cooldown | 8,000 annealing steps (1.07B tokens) focused on math, Python, and arithmetic drills (9.59B total pretrain tokens). |
checkpoints/sft_v4_1_final.pt |
Early SFT baseline | SFT directly from pretrain_final.pt before cooldown (1.97% greedy GSM8K). Kept for ablation comparison. |
checkpoints/grpo_v4_1_final.pt |
Early GRPO baseline | 150 GRPO steps from sft_v4_1_final.pt (+0.84% gain on full greedy GSM8K). |
Architecture (v1)
- Parameters.
352,321,602total (264.24Min 24 transformer blocks,50.33Min tied49,152 x 1024tok_emb,37.75Min 3 sharedvalue_embedstables,66learned scalars). - Blocks.
24layers,d_model=1024,16query heads,4KV heads (4:1GQA),ReLU^2MLP (4096), per-headQK-Norm, U-Net skips,x0residual mixins,256-token sliding window on 18 layers and full2048-token attention on every 4th layer withFlexAttention. - Tokenizer. Custom
49,152-vocab SuperBPE tokenizer with single-digit splitting (0to9) and fixed<think>/</think>control tokens. - Optimizer.
MuonWithAdamWusing 5-step Polar Express Newton-Schulz orthogonalization and Moonlight RMS scaling on 2D block weights, plus fusedAdamWon embeddings and scalars.
Benchmarks
Full methodology and post-mortem notes live in NANO_REASONER_V1_BENCHMARKS.md.
Full 1,319-problem greedy GSM8K (temp=0.0, max_new_tokens=512)
| Checkpoint | Strict accuracy | Flex accuracy | Closed </think> |
Hit 512 limit |
|---|---|---|---|---|
sft_v4_1_final.pt |
26/1319 (1.97%) |
33/1319 (2.50%) |
80.44% |
259 |
grpo_v4_1_final.pt |
37/1319 (2.81%) |
38/1319 (2.88%) |
94.92% |
71 |
sft_v4_4_final.pt |
92/1319 (6.97%) |
93/1319 (7.05%) |
99.01% |
11 |
Held-out 24 GSM8K + 12 MBPP (k=4, temp=0.65)
| Checkpoint | Overall Pass@1 |
Overall Pass@4 |
Math Pass@4 |
Code Pass@4 |
Closed </think> |
|---|---|---|---|---|---|
sft_v4_1_final.pt |
2.08% |
8.33% |
8.33% |
8.33% |
96.53% |
grpo_v4_1_final.pt |
4.2% |
13.9% |
16.7% |
8.3% |
98.6% |
sft_v4_4_final.pt |
7.64% |
22.22% |
25.00% |
16.67% |
100.0% |
Zero-shot lm-eval (124,839 pairs per checkpoint)
| Benchmark | pretrain_final.pt |
midtrain_final.pt |
sft_v4_1_final.pt |
grpo_v4_1_final.pt |
|---|---|---|---|---|
arc_easy |
42.17 |
45.24 |
40.03 |
39.69 |
arc_challenge |
24.49 |
25.34 |
25.26 |
25.17 |
piqa |
59.30 |
58.27 |
59.74 |
59.90 |
hellaswag |
31.13 |
30.64 |
30.72 |
30.66 |
winogrande |
49.49 |
49.72 |
48.54 |
49.72 |
openbookqa |
26.20 |
29.00 |
27.20 |
26.80 |
mmlu_continuation |
24.91 |
25.20 |
24.63 |
24.48 |
Local inference
chat.py runs sft_v4_4_final.pt at 33.4 to 49.2 tok/s in float32 on a 4 GB GTX 1050 Ti using CUDA Graph KV-cached decoding.
python chat.py --checkpoint checkpoints/sft_v4_4_final.pt
What's next (v2)
v1 spent 25% of its weights outside transformer blocks (88.1M in embeddings and value_embeds) and capped 18 layers at 256-token attention. NANO_REASONER_V2_600M_PLAN.md lays out v2:
Qwen3-compatible full-context architecture (>92%of weights in active transformer blocks, tied32,768single-digit tokenizer,3:1RoPE/NoPE).- Single-GPU Modal
B200training stack withFlashAttention-4,Liger-Kernelfused linear cross-entropy, selectiveMXFP8orFP8, progressive1024 -> 2048sequence warmup (with4096cooldown planned), andNorMuonwith Cautious Weight Decay. - Higher-density data (
nvidia/Nemotron-CC-v2,FineWeb-Edu,Nemotron-CC-Math-v1,IFM/MegaMath,allenai/dolma3_dolmino_mix). - Verified sequence-level distillation from
thinkingmachines/Inkling-2-MiniusingvLLMandDSparkspeculative decoding (already smoke-tested on ModalB200indistill_test_inkling2_modal.pyat2,244output tok/s,$0.017for 60 traces).