Writing an LLM from scratch, part 34b -- from bigrams to GPT-2, one component at a time (in JAX)

· · July 8, 2026, 6:05 p.m.
Summary
This blog post details the author's journey in building a large language model (LLM) from scratch using JAX, documenting the process through various implementations of the GPT-2 architecture, including insights on multi-head attention, layer normalization, and dropout. The author shares personal revelations derived from experimenting and modifying strategies to optimize the model's performance, ultimately concluding that JAX offers superior results compared to PyTorch, although results show variations in performance depending on factors like loss and architecture design.
AUTHOR
Sponsored
Zulip logo Zulip
Organized team chat for people who take work seriously. Topic-based threading keeps conversations focused.
Try Zulip
Become a sponsor →
BLOG POST FEATURED ON

Add this plugin to your blog