Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: John Berryman, Albert Ziegler

Rating No ratings yet

This book provides a solid foundation of LLM principles and explains how to apply them in practice. When first integrating LLMs into workflows, most developers struggle to coax useful insights from them. That's because communicating with AI is different from communicating with humans. This guide shows you how to present your problem in the model-friendly way called prompt engineering.

AI Reading Assistant

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

AI guide
# Prompt Engineering for LLMs — Reading Guide ## 【One-Line Pitch】 A practical, engineering-focused guide to mastering prompt engineering for large language models, written by two early GitHub Copilot developers who show you how to treat LLMs as text completion engines and build reliable applications around them. Ideal for application engineers, software developers, and technical leads integrating LLMs into products or workflows. ## 【Book Arc】 - **Opening (~0%–9%)**: Introduces the book's purpose and audience—application engineers who need to integrate LLMs into their codebases. Sets up the central principle that LLMs are fundamentally text completion engines that mimic training data patterns, and outlines the three-part structure: foundations, core techniques, and advanced workflows. - **Early (~9%–28%)**: Presents the authors' personal discovery narratives from their GitHub Copilot days, illustrating the "magic" of LLMs through concrete coding examples—including generating working Rust functions from docstrings alone. Establishes why prompt engineering matters through real-world experience. - **Early–Middle (~28%–44%)**: Builds historical and technical foundations of language models, tracing evolution from Markov models (1948) through seq2seq architectures (2014) to transformers. Explains the information bottleneck problem in earlier architectures and why transformer-based models overcame these limitations. - **Middle (~44%–53%)**: Chronicles the GPT revolution—from the 2018 GPT paper through GPT-2's emergent multitask capabilities to GPT-3 and GPT-4's scaling breakthroughs. Demonstrates how raw pre-trained models began outperforming task-specific fine-tuned models, setting the stage for prompt engineering as a discipline. - **Late (~53%–100%)**: The excerpts do not cover the book's later sections in detail, but the introduction indicates these cover core prompt engineering techniques (context sourcing, ranking, prompt packing, templating) and advanced topics (loops, pipelines, workflows, LLM evaluation). ## 【Key Takeaways】 - **LLMs are text completion engines, not reasoning systems** (Opening): Understanding this fundamental principle shapes everything—you must craft prompts that resemble training data patterns rather than expecting logical reasoning. This mental model prevents common frustration when LLMs behave unexpectedly. - **Prompt engineering is a distinct engineering discipline** (Opening): Converting problems into model-friendly prompts and translating completions back into valuable results is a specialized role—the "LLM wrangler"—that requires both programming skills and empathy for how models "think." - **Empathy with the model is a core prerequisite** (Early): Unlike any prior technology, successful LLM interaction requires understanding how the model processes information. This means recognizing that clear language, familiar patterns, and concise prompts work better than novel formulations. - **Scale creates emergent capabilities** (Middle): GPT-2's jump from 117M to 1.5B parameters—trained on 40GB of text—unexpectedly enabled raw pre-trained models to compete with task-specific fine-tuned models. This scaling insight explains why modern LLMs respond so well to well-crafted prompts. - **The transformer architecture solved the information bottleneck** (Middle): Earlier seq2seq models compressed entire inputs into a fixed "thought vector," losing information from longer texts. Transformers eliminated this constraint, enabling the context-rich processing that makes modern prompt engineering possible. - **Historical context explains current best practices** (Middle): Understanding the evolution from Markov models to seq2seq to transformers reveals why today's LLMs behave as they do—and why prompt patterns that mirror training data structures are more reliable than invented formats. - **Real-world validation came from code generation** (Early): The authors' Copilot experience showed LLMs could generate entire working functions from docstrings alone—demonstrating that well-specified prompts (even in unfamiliar languages like Rust) can produce production-quality output. ## 【Reading Tips】 - **Skim the historical chapters (~28%–53%)** if you're already familiar with LLM architecture—the key insight to retain is the scaling-to-emergence narrative, not every architectural detail. - **Deep-read the opening sections (~0%–9%)** for the foundational principle that "LLMs are text completion engines"—this mental model underpins every technique in the rest of the book. - **Pay special attention to the Copilot anecdotes (~25%–34%)**—they provide concrete, memorable examples of what good prompt engineering looks like in practice, especially the Rust docstring example. - **Note that the excerpts primarily cover Part I (Foundations)**—the core techniques and advanced workflow sections are not represented in this sample, so plan to read those chapters for actionable prompt engineering methods. - **Keep the book's stated structure in mind**—Part II covers context sourcing, ranking, prompt packing, and templating; Part III covers loops, pipelines, workflows, and evaluation. Use these as your roadmap. ## 【Coverage Limits】 This guide is based on excerpts covering approximately the first half of the book (foundations and historical context). The detailed prompt engineering techniques, advanced workflows, and evaluation methods described in the book's introduction are not covered in the available source material. ##
Excerpt 1
d related trade dress are trademarks of O’Reilly Media, Inc. The views expressed in this work are those of the authors and do not represent the publisher’s v...
View in text
Excerpt 2
us on LinkedIn: https://linkedin.com/company/oreilly-media . Watch us on YouTube: https://youtube.com/oreillymedia . Acknowledgments Thank you to our technic...
View in text
Excerpt 3
help: fn number_to_string(number: i32) -> String { Perfect! I didn’t know how to annotate types for the input arguments or return value of functions, but as...
View in text
Excerpt 4
researchers that the GPT architecture was something special. This is clearly evidenced in the second paragraph of the OpenAI blog post introducing GPT-2 : Ou...
View in text
Excerpt 5
ey maintain context and information from prior interactions. A chat application is the quintessential example here. With each new exchange from the user, the...
View in text
Excerpt 6
success on unseen data) are supposed to prevent this defect. That prevention sometimes fails, and instead of learning facts and patterns, the model learns ch...
View in text
Excerpt 7
Tip If you have access to an LLM producing completions (i.e., the raw LLM, not wrapped in a chat interface like ChatGPT), this might be a good occasion to tr...
View in text
Excerpt 8
y to hazard a guess yourself before you read on. Figure 2-8. Asking OpenAI’s text-babbage-001 model to translate a text to all caps This produces some funny...
View in text
Tags
AI categories
Artificial IntelligenceAIProgramming
Publish Year: 2025
Language: English
File Format: EPUB
File Size: 10.8 MB