What problem does it solve? Learning how GPT models work internally is difficult when production frameworks hide implementation behind layers of abstraction, making it hard to experiment with transformer architecture or train a language model on limited hardware. ## Core Features & Use Cases - Minimal GPT Implementation: A complete GPT-2 architecture in roughly 300 lines of readable PyTorch code covering attention, MLP blocks, and autoregressive generation. - Flexible Training Pipelines: Train character-level models on Shakespeare in minutes on CPU, reproduce GPT-2 124M on OpenWebText with multi-GPU DDP, or fine-tune from OpenAI pretrained checkpoints. - Custom Dataset Support: Prepare your own text corpora with character-level or BPE tokenization saved as memory-mapped binary files. - Use Case: A student wants to understand transformers hands-on, so they train a small character-level model on Shakespeare in five minutes on a laptop CPU, then inspect the attention and training loop code line by line. ## Quick Start Train a small GPT model on the Shakespeare dataset using nanoGPT and then generate sample text from the trained checkpoint.