Hands-On Large Language Models
by O'Reilly Media (Jay Alammar & Maarten Grootendorst)
The illustrated route from tokens to fine-tuning, with a runnable notebook for every chapter.
Overview
Hands-On Large Language Models, published by O'Reilly in 2024, is written by Jay Alammar - author of The Illustrated Transformer and an engineering fellow at Cohere - and Maarten Grootendorst, the creator of BERTopic and KeyBERT, and its defining feature is close to 300 original illustrations that carry the explanation rather than decorate it. The book runs twelve chapters that climb deliberately from representation to generation: an introduction to language models, tokens and embeddings, looking inside transformer LLMs, text classification, text clustering and topic modelling, prompt engineering, advanced text generation techniques and tools, semantic search and retrieval-augmented generation, multimodal large language models, creating text embedding models, fine-tuning representation models for classification, and fine-tuning generation models. Every chapter ships a matching Google Colab notebook in the companion GitHub repository, which carries 28.2k stars, is Apache-2.0 licensed, and is written to run on Colab's free T4 GPU with 16GB of VRAM, with local conda setup guides provided as an alternative. Bonus visual guides added after publication cover Mamba, quantization, mixture-of-experts, reasoning LLMs and Stable Diffusion. Worth knowing before buying: Hacker News readers flagged the book's heavy reliance on LangChain in places, which dates faster than the underlying concepts do.
At a Glance
- Topic
- ML
- Level
- All Levels
- Format
- Book
- Cost
- Paid
- Duration
- 12 chapters with matching Colab notebooks; ~20-30 hours to work through
- Provider
- O'Reilly Media (Jay Alammar & Maarten Grootendorst)
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Tokenize text and inspect embedding spaces with runnable notebooks
- ✓Trace what actually happens inside a transformer forward pass
- ✓Build text classification using both representation and generative models
- ✓Cluster documents and model topics with BERTopic-style techniques
- ✓Design prompts and chain generation with practical tooling
- ✓Build semantic search and a retrieval-augmented generation pipeline end to end
- ✓Train your own text embedding model from contrastive training pairs
- ✓Fine-tune both representation and generation models for a specific task
Highlights
- •Nearly 300 original illustrations by the author of The Illustrated Transformer
- •Every chapter ships a Colab notebook that runs on a free T4 GPU
- •Bonus guides cover Mamba, quantization, mixture-of-experts and reasoning LLMs
- •Companion repository has 28.2k stars and is maintained after publication
- •Written by Cohere's Jay Alammar and BERTopic's creator Maarten Grootendorst
Who It’s For
Best For
- ✓Python developers moving into LLM engineering
- ✓Data scientists who want visual intuition before the mathematics
- ✓Teams wanting one book covering classification, search, RAG and fine-tuning
Prerequisites
- •Comfortable writing Python and working in Jupyter notebooks
- •Basic machine-learning vocabulary; deep-learning theory is not assumed
- •A free Google Colab account with T4 GPU, or a local 16GB GPU
FAQ
What is Hands-On Large Language Models?
An O'Reilly book by Jay Alammar and Maarten Grootendorst that teaches practical LLM engineering through roughly 300 original illustrations and twelve chapters of runnable Python, climbing from tokenization and embeddings through classification, clustering, prompting, semantic search and RAG, and ending in fine-tuning both representation and generation models. Aimed at Python developers moving into LLM work.
Is Hands-On Large Language Models free?
Hands-On Large Language Models is a paid resource.
What level is Hands-On Large Language Models for?
Hands-On Large Language Models is aimed at a all levels audience. Recommended background: Comfortable writing Python and working in Jupyter notebooks, Basic machine-learning vocabulary; deep-learning theory is not assumed, A free Google Colab account with T4 GPU, or a local 16GB GPU.
How long does Hands-On Large Language Models take?
Expect roughly 12 chapters with matching Colab notebooks; ~20-30 hours to work through. Most learners work through it at their own pace.
What will I learn from Hands-On Large Language Models?
You'll learn: Tokenize text and inspect embedding spaces with runnable notebooks; Trace what actually happens inside a transformer forward pass; Build text classification using both representation and generative models; Cluster documents and model topics with BERTopic-style techniques; Design prompts and chain generation with practical tooling; Build semantic search and a retrieval-augmented generation pipeline end to end; Train your own text embedding model from contrastive training pairs; Fine-tune both representation and generation models for a specific task.
Topics
Sources
This page was written from 3 sources, 2 on domains other than llm-book.com.