Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: John Berryman, Albert Ziegler

Large language models (LLMs) are revolutionizing the world, promising to automate tasks and solve complex problems. A new generation of software applications are using these models as building blocks to unlock new potential in almost every domain, but reliably accessing these capabilities requires new skills. This book will teach you the art and science of prompt engineering-the key to unlocking the true potential of LLMs. Industry experts John Berryman and Albert Ziegler share how to communicate effectively with AI, transforming your ideas into a language model-friendly format. By learning both the philosophical foundation and practical techniques, you'll be equipped with the knowledge and confidence to build the next generation of LLM-powered applications. Understand LLM architecture and learn how to best interact with itDesign a complete prompt-crafting strategy for an applicationGather, triage, and present context elements to make an efficient promptMaster specific prompt-crafting techniques like few-shot learning, chain-of-thought prompting, and RAG

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical field guide to building reliable LLM-powered applications, teaching you how to design prompts, manage context, and evaluate quality. Best for application engineers and product builders who want to move beyond casual chatbot use into production-grade systems. 【Book Arc】 - **Opening (~0%–10%)**: Frames why LLMs are a genuinely new software primitive and who this book serves—application engineers building products, internal tools, or data workflows. It sets the promise: understand the model, then learn to steer it. - **Early (~10%–30%)**: Builds the mental model. Covers the lineage from seq2seq to attention to the transformer, what "text in, text out" really means, fine-tuning vs. foundation models, and why hallucinations and truth bias are structural, not bugs you can scold away. - **Early–Middle (~30%–45%)**: Moves into the chat era. Explains RLHF, why honesty can't be taught by imitation alone, how reward models shape confidence and hedging, and how ChatML-style role markup structures a conversation. - **Middle (~45%–65%)**: Core techniques begin. Prompt content and context assembly—where content comes from, how to gather, triage, and present it so the prompt stays efficient rather than bloated. - **Late (~65%–85%)**: Application architecture. Converting a user's problem into the model domain, completing the prompt, transforming results back, and evaluating quality both offline and online. - **Ending (~85%–100%)**: Advanced craft—few-shot learning, chain-of-thought, RAG, and giving applications agency and autonomy, with honest caveats about when these approaches fail. 【Key Takeaways】 - **An LLM is a service that takes a string and returns a string** (Early): everything else—chat, agents, RAG—is scaffolding around this simple contract. Internalizing it prevents over-mystifying the technology. - **Hallucinations are structural, not moral failures** (Early): models are training-data mimic machines, so "don't make things up" barely helps. The workable antidote is demanding checkable background—reasoning, sources, searchable details—then verifying. - **Truth bias means your prompt's assumptions become the model's reality** (Early): if you reference something nonexistent, the model typically continues as if it exists. Prompt hygiene matters more than prompt scolding. - **Temperature is a dial on creativity vs. reproducibility** (Early): low values for deterministic tasks, mid-range for diverse candidate solutions, high values for statistically faithful or deliberately random output. Choose per task, not per habit. - **Attention is the transformer's central innovation** (Early–Middle): minibrains exchange question/answer vectors under masking constraints, which explains both the model's flexibility and its fixed-context limitation. - **RLHF teaches calibrated confidence, not just politeness** (Middle): because the model—not labelers—generates candidate completions, it learns to express certainty when consistent with internal knowledge and to hedge when not. - **Context is a budget you must triage** (Middle): gathering, filtering, and presenting context efficiently is a core engineering skill, not an afterthought. - **Evaluation must be designed in, offline and online** (Late): quality claims without measurement are guesses; the book treats evaluation as part of the application loop. 【Reading Tips】 - Deep-read the early architecture chapters even if you only want to "write prompts"—the mental model pays off in every later technique. - Skim the historical narrative (seq2seq, attention papers) on a first pass, then return when you need to reason about context limits. - Treat the temperature and RLHF sections as reference material you'll revisit when tuning real applications. - For the core techniques (few-shot, chain-of-thought, RAG), read with your own use case open—these chapters reward immediate application. - Take away one habit: always ask what the model can and cannot know, then design prompts that make verification easy. 【Coverage Limits】 This guide is synthesized from stratified excerpts covering the book's framing, architecture, chat/RLHF, and core-technique chapters; specific implementation details, code samples, and later chapters on agency and autonomy are only partially represented.
Page 6
back 46 The Process of Building an RLHF Model 47 Keeping LLMs Honest 50 Avoiding Idiosyncratic Behavior 51 RLHF Packs a Lot of Bang for the Buck 51 Beware of...
View in text
Excerpt 2
e thought vector, it preserved all the hidden state vectors generated for each token encountered in the encoding process and then allowed the decoder to “sof...
View in text
Excerpt 3
l phenomenon of confabu‐ lation, rather than hallucination. 5 You can check this by making a second query to the LLM. See Chapter 7. What Are LLMs? | 21 Figu...
View in text
Excerpt 4
creates content that exceeds the knowledge of the model. As training data, this teaches the model that if it doesn’t know an answer, it’s OK to confidently f...
View in text
Excerpt 5
see if you can make the prompt resemble computer programs, news articles, tweets, markdown documents, communication transcripts, etc. For chat models, the ov...
View in text
Excerpt 6
t a very high level. In the next chapters, we’ll dig deeply into all of the topics introduced in this chapter. You’ll learn more about where to pull context...
View in text
Excerpt 7
nd getting an idea of a user’s movie preferences may not be theoretically impossible because it requires permissive access to past purchases or emails. After...
View in text
Excerpt 8
a line, but it’s common to include key clarifications here. The introduction sets the stage (“I’m thinking about book suggestions for X.”), while the refocus...
View in text
Tags
AI categories
Artificial IntelligenceProgrammingSoftware
ISBN: 1098156153
Publisher: O'Reilly Media
Publish Year: 2025
Language: English
Pages: 282
File Format: PDF
File Size: 12.1 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…