The Big Picture
What AI engineering is, and the one diagram that organizes the whole book.
Predict first (30 seconds, don't skip)
In one sentence, how do you think an AI engineer's job differs from a traditional ML engineer's? Say it out loud or jot it down. Guessing before you read, even wrongly, makes the answer stick better. You'll check yourself in section 3.
1 · A language model is a completion machine
A language model encodes statistics about language: given some context, how likely each next piece of text is. Its basic unit is the token, which can be a word, part of a word, or a character. For GPT-4 a token averages about ¾ of a word, so 100 tokens ≈ 75 words. Ch1 · Language models
The models this book is about are autoregressive: they predict the next token, append it, and repeat. That makes them completion machines. Give one a prompt and it continues the text. Many tasks fit this shape:
Question: Is this email likely spam? Here's the email: <email>
Answer: Likely spam Ch. 1's example of turning a completion machine into a spam classifier
One consequence runs through the whole book. Completions are predictions based on probabilities, so they aren't guaranteed to be correct. That probabilistic nature makes these models “both so exciting and frustrating to use.” Ch1 Chapter 2 explains the mechanism (sampling) and Chapters 3–4 explain how to live with it (evaluation).
2 · Why they got so big: self-supervision
Older successes such as the AlexNet image classifier needed supervision: humans labeling every example. Labeling costs money, and that capped how big the datasets could get. Language modeling is self-supervised, because any text already contains its own labels. Each next token is the answer for the tokens before it:
| Input (context) | Label (next token) |
|---|---|
<BOS> | I |
<BOS> I | love |
<BOS> I love | street |
| … I love street food . | <EOS> |
Adapted from Table 1-1: one sentence gives six free training examples.
The internet is full of text, so training data could grow enormously, and models grew with it into LLMs. Add images, audio, and other modalities and you get a foundation model: a general-purpose model that you build on instead of training a new model for each task. Ch1 · From LLMs to Foundation Models
3 · AI engineering vs ML engineering
AI engineering is building applications on top of foundation models. Huyen names three big shifts from traditional ML engineering: Ch1 · AI Engineering Versus ML Engineering
- Adapt, don't train. Someone else trained the model. Your work is model adaptation.
- Bigger, slower, costlier models. That puts more pressure on inference optimization and more need for engineers who can work with GPUs.
- Open-ended outputs. A spam filter is either right or wrong. A chatbot answer has endless valid forms, which makes evaluation a much bigger problem.
AI engineering differs from ML engineering in that it's less about model development and more about adapting and evaluating models.Chip Huyen, AI Engineering, Ch. 1
Now check your prediction from the top. Did you mention adaptation? Evaluation?
4 · Two ways to adapt a model
All adaptation techniques fall into two families, split by one question: do the model's weights change?
| Prompt-based | Finetuning | |
|---|---|---|
| Weights | Unchanged; you supply instructions and context | Updated by further training |
| Examples | Prompt engineering, RAG | Finetuning, incl. parameter-efficient methods such as LoRA |
| Trade-off | Easy to start, needs little data, lets you try many models | More complex, needs more data; can improve quality, latency, and cost |
Huyen's running example is generating product descriptions for a retailer. You can write detailed instructions with examples (prompt engineering), connect the model to a database of customer reviews (RAG), or further train it on great descriptions (finetuning). Adapting an existing model instead of building one is the difference between “ten examples and one weekend” and “1 million examples and six months.” Ch1
Watch your wordsPasting your journal into ChatGPT so it “sounds like you” is not training or finetuning. Teaching a model through its context is prompt engineering. Huyen calls out this mix-up explicitly. Ch1 · Training vs Pre-Training vs Finetuning vs Post-Training
5 · The map: three layers of the AI stack
Every AI application has three layers. You usually start at the top and move down only as needed. Ch1 · Three Layers of the AI Stack The book's chapters map onto them like this:
The order of work has flipped too. Traditional ML went data → model → product. With foundation models you can go product → data → model: build a demo first, and invest in data and models only once the product shows promise. That favors people from web and full-stack backgrounds who can iterate fast, which is good news for you. Ch1 · AI Engineering Versus Full-Stack Engineering (Fig. 1-16)
Check yourself
Answer from memory without scrolling up. The effort of recalling is what makes this stick.
Read next: Chip Huyen, AI Engineering, Chapter 1, sections “The Rise of AI Engineering” and “The AI Engineering Stack.” Every claim in this lesson cites a section from those two parts. Skim “Foundation Model Use Cases” and “Planning AI Applications” for now. They make more sense once you have a product idea.
Optional, 15 min: “The Rise of the AI Engineer” (swyx, Latent Space, 2023), the essay behind the job title and the source of Fig. 1-16. Chapter summaries are also in the book's companion repo.