πŸ¦‰

Book notes

AI Engineering

Building Applications with Foundation Models

A framework for building applications on top of foundation models (both LLMs and large multimodal models). It follows the real arc of an AI product: decide whether to build, understand how the model works, evaluate rigorously, then improve results through prompt engineering, context construction (RAG and agents), finetuning, and dataset engineering β€” before optimizing inference and closing the loop with user feedback.

These pages are study notes β€” a chapter-by-chapter distillation of the key concepts, each paired with a quiz. They are a companion to the book, not a replacement for it. For the full treatment, case studies, and references, read the original.

Original work & credit

Chip Huyen

Author of Designing Machine Learning Systems (O'Reilly); has built ML tooling and systems across industry for over a decade.

Title
AI Engineering
Publisher
O'Reilly Media, Inc.
Published
December 2024
ISBN
978-1-098-16630-4

These notes are independent, original summaries created for study purposes. All rights to the underlying work belong to Chip Huyen and O'Reilly Media, Inc.. Please support the author by reading the full book.

Chapters

10 of many
1

Introduction to Building AI Applications with Foundation Models

How language models grew into foundation models via self-supervision, the explosion of use cases, planning an AI product (use-case evaluation, the role of AI vs. humans, defensibility, expectations), and the three-layer AI engineering stack.

pp. 1–52 16-Q quiz β†’
2

Understanding Foundation Models

The design decisions that shape a model: training-data recipes, model architecture and scale, post-training/alignment, and how sampling turns probabilities into responses β€” explaining hallucination and inconsistency.

pp. 53–96 15-Q quiz β†’
3

Evaluation Methodology

How to evaluate open-ended responses: language-modeling metrics (perplexity), exact evaluation, AI-as-a-judge and its biases, and comparative evaluation (Elo/Bradley–Terry ranking).

pp. 97–160 17-Q quiz β†’
4

Evaluate AI Systems

Turning methodology into a pipeline: choosing criteria, model selection, building an evaluation pipeline, and using data to compare and pick models for your application.

pp. 145–192 15-Q quiz β†’
5

Prompt Engineering

What a prompt is and why prompt engineering works, best practices for writing prompts, context and in-context learning, and defending against prompt attacks.

pp. 193–232 15-Q quiz β†’
6

RAG and Agents

Two context-construction patterns: retrieval-augmented generation (retrievers, chunking, embeddings) and agents (planning, tool use, reflection) β€” the well-proven and the frontier.

pp. 233–290 15-Q quiz β†’
7

Finetuning

When to finetune and when not to, memory-efficient approaches (PEFT/LoRA), model merging, and how to reason about a model's memory footprint.

pp. 291–336 15-Q quiz β†’
8

Dataset Engineering

Getting data for finetuning and beyond: data acquisition, annotation guidelines, data synthesis, and processing β€” plus what data quality means and how to evaluate it.

pp. 337–388 15-Q quiz β†’
9

Inference Optimization

Making inference cheaper and faster at both the model level (quantization, distillation) and the inference-service level (batching, KV caching, parallelism).

pp. 389–436 15-Q quiz β†’
10

AI Engineering Architecture and User Feedback

Assembling the concepts into an end-to-end application architecture, then designing a user-feedback system that collects useful signal while preserving a good experience.

pp. 437–480 15-Q quiz β†’