nanocode is an open-source library that walks through training your own agentic coding assistant end-to-end using Constitutional AI, entirely in JAX on TPUs. Starting from pre-training a 1.3B parameter model on FineWeb-EDU and The Stack V2, the project covers custom tokenization with tool-calling special tokens, synthetic data generation via a generate-critique loop, supervised fine-tuning on agentic rollouts, and Direct Preference Optimization (DPO) for SOUL alignment. The full d24 (1.3B param) model can be reproduced in ~9 hours on a TPU v6e-8 for around $200. The resulting agent can read/write files, grep codebases, and execute Bash commands through a CLI interface, with personality defined by a custom SOUL.md document.

22m read timeFrom github.com
Post cover image
Table of contents
Tokenization and Pre-trainingLearning by exampleYour turn

Sort: