This is Andrej Karpathy's minimal GPT implementation in roughly 300 lines of readable PyTorch code. You can train a character-level model on Shakespeare in five minutes on a CPU, or reproduce GPT-2 124M on OpenWebText with multi-GPU if you have the hardware. The entire architecture fits in model.py with zero abstractions, making it genuinely hackable for learning how transformers work under the hood. It's not for production use. If you're trying to understand attention mechanisms or experiment with architecture changes without wading through framework abstractions, this is the cleanest starting point. The code assumes you know PyTorch basics but explains nothing else, which is exactly the point.
- skills.sh installs
- 1K
- GitHub stars
- 14.4K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add orchestra-research/ai-research-skills --skill nanogpt --agent claude-codeInstalls into .claude/skills of the current project.
Files
nanoGPT - Minimalist GPT Training
Quick start
nanoGPT is a simplified GPT implementation designed for learning and experimentation.
Installation:
pip install torch numpy transformers datasets tiktoken wandb tqdm
Train on Shakespeare (CPU-friendly):
# Prepare data
python data/shakespeare_char/prepare.py
# Train (5 minutes on CPU)
python train.py config/train_shakespeare_char.py
# Generate text
python sample.py --out_dir=out-shakespeare-char
Output:
ROMEO:
What say'st thou? Shall I speak, and be a man?
JULIET:
I am afeard, and yet I'll speak; for thou art
One that hath been a man, and yet I know not
What thou art.
Common workflows
Workflow 1: Character-level Shakespeare
Complete training pipeline:
# Step 1: Prepare data (creates train.bin, val.bin)
python data/shakespeare_char/prepare.py
# Step 2: Train small model
python train.py config/train_shakespeare_char.py
# Step 3: Generate text
python sample.py --out_dir=out-shakespeare-char
Sponsors
Details
- Repository
- github.com/orchestra-research/ai-research-skills
- Categories
- Code Review & Quality, AI & Agent Building, Data Science & ML
- First seen
- Jun 3, 2026
More from orchestra-research/ai-research-skills
All 95- Pytorch Fsdp21K
- Awq Quantization1K
- Modal Serverless Gpu1K
- Moe Training1K
- Sglang1K
- Chroma1K
- Instructor1K
- Speculative Decoding1K
- Llama Factory1K
- Model Merging1K
- Nemo Curator1K
- Transformer Lens Interpretability1K
- Distributed Llm Pretraining Torchtitan1K
- Openrlhf Training1K
- Evaluating Code Models1K
- Gptq1K
- Sentencepiece1K
- Outlines1K
- Llamaindex1K
- Pyvene Interventions1K
- Simpo Training1K
- Slime Rl Training1K
- Training Llms Megatron1K
- Guidance1K
