HeadlinesBriefing favicon HeadlinesBriefing.com

nanocode: Train Your Own Claude Code for $200 Using TPUs

Hacker News •
×

Developer Salman Mohammadi has released nanocode, an open-source library that lets you train your own Claude Code-style model for as little as $200 on Google TPUs. The project, inspired by Andrej Karpathy's nanochat, provides end-to-end training infrastructure using Constitutional AI principles and JAX. Users can reproduce a 1.3B parameter model in roughly 9 hours or a smaller 477M parameter version in 1.5 hours.

The training approach emphasizes agentic coding behaviors through synthetic data generation and preference optimization. Mohammadi's implementation includes a specialized tokenizer trained on both FineWeb_EDU and The Stack V2 datasets at a 5:1 ratio, resulting in 50.9% better code tokenization compared to the original nanochat tokenizer. The project supports Google's TRC program for free TPU access and works with NVIDIA GPUs, though it's optimized for TPUs.

Early benchmarks show the 1.3B parameter model achieves a CORE score of 0.227, slightly below GPT-2 XL but with superior coding capabilities. The model uses a 4096 context length versus nanochat's 2048, supporting multi-turn conversations. Mohammadi positions nanocode as a practical tool for developers wanting to create custom coding assistants without the massive compute budgets typically required for frontier model training.