NanoGPT Speedrun: The Ultimate Guide to Pushing LLM Training Efficiency to Its Limits

NanoGPT Speedrun is an open-source competition to train GPT models to a benchmark in the shortest wall-clock time possible.
NanoGPT Speedrun is an open-source speed competition rooted in Andrej Karpathy's nanoGPT project, where participants race to train a GPT model to GPT-2-level validation loss in the shortest wall-clock time on fixed hardware (e.g., 8 H100s). All records must be publicly reproducible. The underlying optimizations span architecture improvements (RoPE, QK normalization), novel optimizers (Muon), low-precision training (bf16/fp8), and kernel fusion — techniques that compound into order-of-magnitude speedups. For everyday developers, tracking this competition offers a fast track to learning current best practices and rethinking the underrated value of doing more with less.
What Is NanoGPT Speedrun
As the arms race in large language models grows increasingly intense, a more engineering-driven competition has been quietly gaining traction in the developer community — NanoGPT Speedrun. Its goal is simple and pure: train a GPT model to a target performance benchmark (typically measured by validation loss or perplexity) in the shortest time possible. This isn't about who has the most compute — it's about who has the cleverest methods, the most refined code, and the most extreme optimizations.
The concept originated from Andrej Karpathy's nanoGPT project. nanoGPT reproduces the core GPT-2 architecture in minimalist code, making it a go-to reference for countless developers learning the Transformer training pipeline. Speedrun builds on this foundation by introducing a racing dimension: given fixed hardware conditions (e.g., 8 H100 GPUs), who can reach GPT-2-level validation loss in the shortest wall-clock time?
The so-called "Frontier" refers to this constantly-refreshed efficiency boundary. Every time a record is broken, it signals that the community has made a meaningful advance in training techniques.
Perplexity is a core metric for evaluating language model quality — essentially the exponentiated form of validation cross-entropy loss: PPL = e^loss. Lower perplexity means the model predicts test text more accurately. GPT-2 achieves a validation loss of approximately 3.28 on OpenWebText, corresponding to a perplexity of roughly 26.6 — the most commonly used target benchmark in NanoGPT Speedrun. Wall-clock time refers to the actual physical elapsed time from the start of training to reaching the target metric, as distinct from GPU compute time or FLOPs — it's a holistic measure of the entire training pipeline's efficiency, including data loading, communication overhead, and all other stages.
Why NanoGPT Speedrun Is Worth Paying Attention To
A Paradigm Shift from Stacking Compute to Competing on Efficiency
Over the past few years, capability improvements in large models have largely relied on brute-force scaling of parameters and training data. But the cost of this path is becoming increasingly unsustainable — training a frontier model can easily run tens of millions of dollars. NanoGPT Speedrun represents a different approach: squeezing more value out of the same hardware budget through algorithmic and engineering optimization.
The significance of these competitions goes far beyond entertainment. Every validated acceleration technique can potentially be transferred to real industrial-scale training. When training time shrinks from hours to tens of minutes, the savings aren't just in electricity — they translate directly into faster research iteration cycles.
The Collective Intelligence of the Open-Source Community
The beauty of Speedrun lies in its transparency and reproducibility. All records must include public code, which anyone can verify, learn from, and attempt to beat. This open-competition model allows cutting-edge training optimization techniques to spread rapidly, rather than being locked away inside a handful of large companies.
A Deep Dive into the Key Optimization Techniques
Breaking records doesn't rely on a single silver bullet — it's the accumulation of many careful optimizations. Here are the core techniques commonly seen in these competitions:
Model Architecture Improvements
- RoPE Positional Encoding: Replacing traditional absolute position embeddings with Rotary Position Embeddings provides more stable performance on long sequences and has become standard in mainstream Transformer architectures.
- QK Normalization: Normalizing the Query and Key vectors in the attention mechanism improves training stability, allowing more aggressive learning rates without triggering gradient explosion.
- Activation Functions and Normalization Choices: For example, using squared ReLU or adjusting LayerNorm placement (Pre-Norm vs. Post-Norm) can yield significant improvements in convergence speed.
RoPE (Rotary Position Embedding) was proposed by Su Jianlin in 2021. The core idea is to encode positional information into the Query and Key vectors via rotation matrices, so that attention scores naturally incorporate relative position information without relying on explicit absolute position embeddings. Its advantages include stronger extrapolation (handling sequences longer than those seen during training), more natural integration with the attention mechanism, and more stable training behavior compared to learnable position embeddings. RoPE is now used by major open-source models including LLaMA, Mistral, and Qwen. QK Normalization applies L2 normalization or LayerNorm to Q and K before computing attention weights, preventing dot-product values from exploding as sequence length or model depth grows — enabling larger initial learning rates and faster early convergence.
Optimizer and Training Strategy Tuning
Novel optimizers — such as Muon, which is specifically designed for matrix parameters — play an important role in these competitions. Compared to the traditional AdamW, they can significantly accelerate convergence in certain scenarios. Additionally, learning rate scheduling strategies, warmup phase design, and dynamic batch size adjustment are all details that competitors refine repeatedly.
Muon (Momentum + Orthogonalization Update) is an optimizer designed by Jordan Juravsky and collaborators specifically for matrix parameters. Its key innovation is applying orthogonalization to the gradient matrix after the momentum update (based on Nesterov momentum and Newton-Schulz iteration), keeping the weight matrix updates consistent in the spectral norm sense. Compared to AdamW, Muon converges faster on Transformer linear layers because it implicitly applies better preconditioning to the parameters. Notably, Muon is typically only used for hidden-layer matrix weights, while embedding and output layers retain AdamW — this hybrid strategy is a common configuration in NanoGPT Speedrun. AdamW is the decoupled weight decay variant of the Adam optimizer and remains the baseline choice for most large model training.
Engineering and Hardware Optimizations
- Mixed-Precision Training: Leveraging low-precision floating-point formats like bf16/fp8 to dramatically increase compute throughput while maintaining numerical stability.
- Operator Fusion and Kernel Optimization: Reducing memory transfers and kernel launch overhead on the GPU to lower non-compute time during training.
- Data Loading and Preprocessing Pipeline Optimization: Ensuring GPUs never sit idle waiting for data by fully overlapping compute and I/O.
Each of these optimizations may only contribute a few percentage points individually, but when applied systematically together, the cumulative speedup is often orders of magnitude.
bf16 (Brain Float 16) is a 16-bit floating-point format designed by Google for deep learning. It shares the same 8-bit exponent as fp32, giving it an identical dynamic range with reduced mantissa precision (7 bits vs. 23 bits). Compared to fp16, bf16 requires almost no loss scaling to maintain training stability and has become the preferred training precision on modern GPUs like H100 and A100. fp8 is a more aggressive 8-bit floating-point format natively supported by H100 for matrix multiplication, theoretically doubling compute throughput again — but it requires more careful numerical calibration to ensure convergence. Kernel fusion refers to combining multiple consecutive GPU operations into a single custom CUDA kernel to reduce the number of intermediate writes back to device memory. A classic example is FlashAttention, which fuses the matrix multiplications, softmax, and dropout in attention computation into a single kernel — reducing memory usage from O(n²) to O(n) while significantly boosting compute throughput.
Community Response and In-Depth Discussion
On Hacker News, NanoGPT Speedrun topics have sparked sustained technical discussions. Developers are generally enthusiastic about these competitions, viewing them as a way to turn the abstract concept of "training efficiency" into a concrete, quantifiable, and learnable target.
Some thought-provoking concerns have also emerged: while record-breaking results are impressive, there's a risk of "overfitting the benchmark" — optimizations tuned to improve a specific number on a particular dataset may not generalize to real-world tasks. Hardware standardization is also a prerequisite for fair competition, since different GPU generations make cross-comparison complicated.
Practical Takeaways for Everyday Developers
Even if you have no intention of competing yourself, NanoGPT Speedrun still offers significant value:
- An excellent deep learning learning resource. Public record-setting code is often a distillation of current best practices — reading it is like learning Transformer training while standing on the shoulders of giants.
- Dramatically lower experimentation barriers. When training a functional small model takes only tens of minutes, individual developers can afford to iterate quickly without being priced out by high compute costs.
- A new appreciation for the value of efficiency. In an era when everyone is chasing bigger models, squeezing the most out of existing resources is itself an underrated core competency.
Conclusion
NanoGPT Speedrun Frontier isn't just a game for technical enthusiasts — it reflects a healthy direction for AI development: pursuing scale while never losing sight of efficiency and engineering craftsmanship. When the industry's attention is overly fixated on the numbers game of parameter counts, this community of developers obsessed with "doing more with less" is quietly accumulating the most practical knowledge in the entire ecosystem.
This efficiency frontier will continue to be pushed forward. For those who care about the underlying technology of AI, following this competition may be one of the best ways to understand the essence of modern large model training.
Related articles

Insufficient Source Material to Generate a Valid Article
The provided source material is a single unrelated tweet with no AI or tech relevance — insufficient to support a complete, valid technical article.

Insufficient Source Material to Generate a Valid AI/Tech Article
This source material is a tweet about the ages of Underworld members — unrelated to AI or tech, and insufficient to support a full article.

Insufficient Material: Unable to Generate a Valid AI/Tech Article
The provided material is a condolence tweet about a San Diego mosque attack — unrelated to AI/tech and too limited to generate a valid technical article.