Preface

Author: Chip Huyen (also wrote Designing Machine Learning Systems)
Publisher: O’Reilly, 2025

What This Book Is About

A framework for adapting foundation models (LLMs + LMMs) to real-world applications. Covers the end-to-end process: evaluation, prompt engineering, RAG, agents, finetuning, dataset engineering, inference optimization, and architecture.

Key questions the book answers:

  • Should I build this AI application?
  • How do I evaluate outputs? Can AI evaluate AI?
  • What causes hallucinations, and how to detect/mitigate them?
  • When to finetune vs. not finetune?
  • How much data do I need?
  • How to make models faster, cheaper, and secure?

What This Book Is Not

  • Not a tutorial (framework for selecting tools, not how to use them)
  • Not an ML theory book (practical focus)

What You Should Already Know (Helpful but Not Required)

  • Probabilistic concepts: sampling, determinism, distribution
  • ML concepts: supervision, self-supervision, log-likelihood, gradient descent, backpropagation
  • Neural network architectures: feedforward, recurrent, transformer
  • Metrics: accuracy, F1, cosine similarity, cross entropy

Book Structure (Chapter Map)

ChapterFocus
1What AI engineering is; use cases; planning
2How foundation models work under the hood
3–4Evaluation methodology and pipelines
5Prompt engineering
6RAG and agents (context construction)
7Finetuning (model adaptation)
8Dataset engineering
9Inference optimization
10End-to-end architecture + user feedback

Companion Book

Designing Machine Learning Systems (DMLS) — covers traditional ML (tabular data, feature engineering, model training). AI Engineering covers foundation model apps (prompting, context construction, parameter-efficient finetuning). Both are self-contained and modular.

Author’s Criteria for “What Lasts”

  1. Does the problem result from fundamental AI limitations, or will it go away with better models?
  2. What do top researchers and engineers consider most important?
  3. Lindy’s Law: if something has been around for a while, it will continue to exist.