NanoChat : Le Guide Complet du Harness d'Entraînement LLM à $100 de Karpathy
NanoChat est le harness d'entraînement LLM le plus simple par Andrej Karpathy. Entraînez GPT-2 pour ~$48 (2h sur 8×H100), puis parlez-lui dans un web UI ChatGPT-like. Un seul dial (--depth). 45 300+ étoiles, Python, MIT.
Qu'est-ce que c'est ?
Pipeline LLM complet minimal : tokenisation → préentraînement → SFT → RL → évaluation → chat UI. GPT-2 coûtait ~$43,000 en 2019 — NanoChat : $48.
- Étoiles : 45 300+ ⭐ — Forks : 5 996 — Contributeurs : 47
Pipeline Complet
- Tokenizer — Entraîner BPE, évaluer compression
- Préentraînement — base_train.py, CORE score, BPB
- SFT + RL — Fine-tuning supervisé + renforcement
- Évaluation — ARC, GSM8K, MMLU, HumanEval, SpellingBee
- Chat — Web UI + CLI + exécution Python (tool use)
Le Dial --depth
Un seul paramètre configure tout : --depth 26 = GPT-2 (~$48). Largeur, têtes, LR, horizon calculés automatiquement.
Comparaison
| Fonctionnalité | NanoChat | nanoGPT | LitGPT | Axolotl |
|---|---|---|---|---|
| Pipeline | 6 étapes complètes | Préentraînement | Pre + SFT | SFT + RL |
| Dial unique | ✅ --depth | ❌ | ❌ | ❌ |
| Chat UI | ✅ | ❌ | ✅ | ❌ |
| Coût GPT-2 | ~$48 | ~$100s | Variable | N/A |
Quand choisir : Pipeline chatbot complet par Karpathy, un seul dial.
Conclusion
La masterclass de Karpathy. 45.3K étoiles, $48 pour GPT-2.
