Learn how transformers and embeddings work by running code examples in your browser with free GPU access.
Understand prompt engineering and retrieval-augmented generation to build smarter AI applications.
Fine-tune language models on your own data without needing expensive hardware or deep ML expertise.
Build semantic search systems and multimodal AI features by following step-by-step tutorials.
This is the official code companion for "Hands-On Large Language Models," a published O'Reilly book by Jay Alammar and Maarten Grootendorst, two well-known AI educators. The book and this repository teach you how large language models (the technology behind ChatGPT, Claude, and similar AI systems) actually work, with nearly 300 custom illustrations and runnable Python code examples for every chapter. The book is aimed at developers, data scientists, and technically curious people who want to go beyond just using AI tools and actually understand how they're built and customized. You don't need a PhD, but you should be comfortable with Python code. Endorsed by Andrew Ng, founder of DeepLearning.AI, it's considered one of the most accessible deep-dives into LLM technology available. The topics covered follow a logical progression: how language models process text (tokenization and embeddings, how words get turned into numbers), what's happening inside the transformer architecture (the core design that powers modern AI), classifying text, clustering documents, prompt engineering (writing better instructions for AI), building search systems that understand meaning rather than just keywords, retrieval-augmented generation (connecting AI to your own documents), multimodal models that understand both text and images, and how to fine-tune existing models on your own data. All code examples run in Google Colab, a free, browser-based coding environment that requires no local setup and provides free GPU access. The full book is available for purchase on Amazon, O'Reilly, and other retailers. The code is free on GitHub.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.