No description
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
【One-Line Pitch】
A hands-on, highly visual guide to understanding and building with large language models, covering everything from tokenization and embeddings to fine-tuning and multimodal systems—ideal for practitioners who want to move from theory to working code without needing a massive GPU budget.
【Book Arc】
- **Opening (~0%–13%)**: Introduces the book's mission, audience, and practical setup. It frames LLMs broadly (including non-generative models) and sets expectations for running examples on modest hardware like Google Colab's free T4 GPU.
- **Early (~13%–32%)**: Builds the conceptual foundation of language AI. It traces the evolution from bag-of-words and word2vec to RNNs and the Transformer architecture, explaining key model families (encoder-only like BERT, decoder-only like GPT) and the two-step training paradigm of pretraining and fine-tuning.
- **Early–Middle (~32%–42%)**: Covers the practicalities of interacting with LLMs. It discusses proprietary vs. open-source models, API access, and walks through loading a model (Phi-3) and tokenizer with Hugging Face Transformers to generate a first piece of text.
- **Middle (~42%–48%)**: Dives into the mechanics of tokenization and embeddings. It shows how a prompt is converted into token IDs, how subword tokenization works (with examples of partial words and special tokens), and why this step is critical for model input and output.
- **Late (beyond ~48%)**: The excerpts indicate the book progresses into advanced topics—prompt engineering, semantic search and RAG, multimodal LLMs, and fine-tuning (including SFT, QLoRA, and preference tuning)—though the provided material does not detail these chapters' content.
【Key Takeaways】
- **LLMs are more than just text generators** (Early): The book deliberately includes encoder-only models, embedding models, and even bag-of-words approaches under the "LLM" umbrella, arguing that "large" is arbitrary and capability matters more than size.
- **The Transformer is the backbone of modern language AI** (Early): Understanding self-attention, encoder-decoder stacks, and masked attention in decoders explains why models like BERT and GPT work—and why they can be trained in parallel unlike earlier RNNs.
- **Tokenization is the hidden first step** (Middle): A prompt is not fed to a model as text but as a sequence of token IDs, where tokens can be whole words, word fragments, or punctuation. Decoding these IDs back to text is essential for interpreting model output.
- **Training is a multi-stage process** (Early): Pretraining on massive corpora creates base models, while fine-tuning adapts them to specific tasks or behaviors. This separation saves resources, as pretraining (e.g., Llama 2's 2-trillion-token dataset) is prohibitively expensive for most.
- **You can work with LLMs on limited hardware** (Early): The book is written for "GPU-poor" readers, using Google Colab's free T4 (16 GB VRAM) as a baseline and offering local alternatives to paid APIs where possible.
- **Responsible use is part of the craft** (Early): Bias, transparency, harmful content, IP questions, and regulation (like the EU AI Act) are not afterthoughts—they shape how and whether you deploy LLM-based systems.
- **Hands-on code is the core learning method** (Middle): Using Hugging Face's `transformers` library, you can load a model and tokenizer, create a pipeline, and generate text with just a few lines of Python—making the concepts immediately testable.
【Reading Tips】
- **Skim the historical overview in Chapter 1** if you already know what word2vec and RNNs are; focus instead on the "training paradigms" and "responsible use" sections, which frame the rest of the book.
- **Deep-read the tokenization chapter (Chapter 2)**: It's easy to skip, but understanding subword tokens and special tokens (like `<s>` and `<|assistant|>`) is essential for debugging prompts and outputs later.
- **Run the code as you go**: The book is designed for hands-on learning. Use the provided Google Colab notebooks to follow along, especially for the first text-generation example with Phi-3.
- **Treat the Transformer chapter (Chapter 3) as a reference**: The architecture details (multi-head attention, positional embeddings) are dense; revisit them when you hit later chapters on fine-tuning or multimodal models.
- **Don't worry about the latest model names**: The book explicitly aims for model-agnostic examples, so focus on the underlying techniques (e.g., RAG, QLoRA) rather than chasing specific releases.
【Coverage Limits】
This guide is based on excerpts covering roughly the first half of the book (through tokenization). Topics like prompt engineering, RAG, multimodal LLMs, and fine-tuning are mentioned in the table of contents but not detailed in the provided material.
Excerpt 1
isbn=9781098150969。 O’Reilly 标志是 O’Reilly Media, Inc. 的注册商标。Hands-On Large Language Models、封面图片及相关商业外观均为 O’Reilly Media, Inc. 的商标。 本书所表达的观点仅代表作者本人,并不代表出版方的观点...
View in text
Excerpt 2
k 中使用”部分”功能目前无法在电子书导航中正确嵌套。 ch003.xhtml 大语言模型简介 人类正处于一个转折点。从2012年开始,构建AI系统(使用深度神经网络)的发展加速推进,到2010年代末,催生了第一个能够写出与人类文章难以区分的软件系统。这个系统是一个名为”生成式预训练Transformer 2”(...
View in text
Excerpt 3
利用外部资源(如工具和文档)的大语言模型聊天机器人这是多种技术的结合,展示了如何通过额外的组件找到大语言模型的真正威力。提示工程(见 第6章 )、检索增强生成(见 第8章 )和微调大语言模型(见 第12章 )等方法都是大语言模型拼图的一部分。构建一个能够根据显示冰箱内产品的图片来编写食谱的大语言模型这是一个多模态...
View in text
Excerpt 4
plied by the number of GPUs available. 16 Marah Abdin et al. “Phi-3 technical report: A highly capable language model locally on your phone.” arXiv preprint...
View in text
Excerpt 5
元: <|endoftext|> 填充中间词元。这三个词元使LLM不仅能够根据前面的文本,还能考虑后面的文本来生成补全。该方法在论文《Efficient training of language models to fill in the middle》中有更详细的解释;其具体细节超出了本书的范围。这些特殊词元是...
View in text
Excerpt 6
下文相关的文本嵌入。 像这样的可视化对于下一章我们将开始研究基于 Transformer 的 LLM 如何工作至关重要。 文本嵌入(用于句子和整个文档) 虽然词元嵌入是 LLM 运作的关键,但许多 LLM 应用需要处理整个句子、段落甚至文本文档。这催生了能够生成文本嵌入(一个表示比单个词元更长的文本片段的单一向量...
View in text
Excerpt 7
生成的第一个词元用于生成第二个词元)。这类模型被称为自回归模型。这就是为什么你会听到文本生成大语言模型被称为自回归模型。这通常用于将文本生成模型与文本表示模型(如BERT)区分开来,后者不是自回归的。 这种自回归、逐词元生成的过程,就是我们在使用大语言模型生成文本时底层发生的情况,如下所示: prompt = &...
View in text
Excerpt 8
可能的下一个词(指的是1994年的电影)。 前馈神经网络(在所有模型层中共同作用)就是这种信息的来源,如图3-13所示。当模型被成功训练以建模一个庞大的文本档案(其中包含许多“The Shawshank Redemption”的提及)时,它学习并存储了使其成功完成此任务的信息(和行为)。 图3-13:Transf...
View in text
Tags
AI categories
AIProgramming LanguageBackend
Loading comments...
Reply to Comment
Edit Comment