Hands-On Large Language Models [Alammar]
#1
[Image: ?format=webp]

Hands-On Large Language Models: Language Understanding and Generation
Authors: Jay Alammar & Maarten Grootendorst
Publication date: September 2024
Publisher: O’Reilly Media, Inc.
Length: 428 pages
Level: Beginner to intermediate
ISBN: 9781098150952 

Summary

Hands-On Large Language Models is a practical, visually oriented introduction to how modern large language models work and how they can be used in real applications. The authors deliberately follow an “intuition-first” approach: rather than beginning with heavy mathematics, they build an understanding of concepts such as tokenization, embeddings, attention, Transformers, encoder and decoder architectures, contextual representations, and text generation. The first part explains what happens inside an LLM, including token embeddings, Transformer blocks, positional embeddings, attention mechanisms, context windows, decoding, and techniques for making generation more efficient. 

The second and largest part turns these ideas into practical NLP systems. It covers text classification, clustering, topic modeling, prompt engineering, semantic search, RAG, agents, and multimodal models. Readers learn how embeddings can be used to represent documents mathematically, how dense retrieval and rerankers improve search, and how retrieved documents can be supplied to an LLM through Retrieval-Augmented Generation. The book also introduces BERTopic, LangChain-style chains and agents, ReAct reasoning, CLIP, and multimodal models that connect text and images. 

The final section goes deeper into training and fine-tuning. It explains contrastive learning and SBERT for embedding models, fine-tuning BERT-like representation models, few-shot methods such as SetFit, and fine-tuning generative LLMs. Important modern techniques including LoRA, QLoRA, PEFT, supervised fine-tuning, model quantization, RLHF, reward models, and Direct Preference Optimization (DPO) are introduced together with methods for evaluating generative models. The result is a book that bridges the gap between simply calling an LLM API and understanding enough of the underlying machinery to build, adapt, and evaluate sophisticated language-AI systems. 

Key takeaways
  • LLMs are more than chatbots. The book emphasizes embeddings, classification, clustering, semantic search, recommendation, retrieval, and multimodal applications alongside text generation. 
  • Embeddings are a central concept. Much of modern NLP can be understood as representing words, sentences, and documents as vectors and comparing them in high-dimensional spaces.
  • RAG is one of the most practically important architectures covered:
    documents → embeddings → retrieval → reranking → context → LLM → answer. 
  • Fine-tuning does not necessarily mean retraining an entire LLM. Techniques such as LoRA, QLoRA, and PEFT allow comparatively efficient adaptation of pretrained models. 
  • The book is particularly valuable for someone who already knows some Python and basic machine learning but wants to progress from using ChatGPT-like systems toward actually understanding and building LLM applications.
  • Its strongest feature is the combination of conceptual intuition + visual explanations + executable practical workflows, rather than treating LLMs purely as a theoretical deep-learning topic. 

O’Reilly — Hands-On Large Language Models
┌────────────────────────────────┐
│  KONSTANTINOS MICHAILIDIS    │
└────────────────────────────────┘
Reply


Messages In This Thread
Hands-On Large Language Models [Alammar] - by mklabgr - 09-05-2026, 01:41 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)