Recent breakthroughs in AI have not only increased demand for AI products, they've also lowered the barriers to entry for those who want to build AI products. The model-as-a-service approach has transformed AI from an esoteric discipline into a powerful development tool that anyone can use. Everyone, including those with minimal or no prior AI experience, can now leverage AI models to build applications. In this book, author Chip Huyen discusses AI engineering: the process of building applications with readily available foundation models. The book starts with an overview of AI engineering, explaining how it differs from traditional ML engineering and discussing the new AI stack. The more AI is used, the more opportunities there are for catastrophic failures, and therefore, the more important evaluation becomes. This book discusses different approaches to evaluating open-ended models, including the rapidly growing AI-as-a-judge approach. AI application developers will discover how to navigate the AI landscape, including models, datasets, evaluation benchmarks, and the seemingly infinite number of use cases and application patterns. You'll learn a framework for developing an AI application, starting with simple techniques and progressing toward more sophisticated methods, and discover how to efficiently deploy these applications.
Designing Data-Intensive Applications by Martin Kleppmann
AI Engineering by Chip Huyen
Many engineering teams instinctively reach for finetuning as a way to "teach" a model their private data. The thinking is that if you train it on your documents, it will "know" them. However, this is often a misuse of the technique. Finetuning is most effective at altering the form and behavior of a model—making it communicate in a certain style, adhere to a specific JSON schema, or follow a complex chain of instructions. It is an expensive and imprecise tool for knowledge injection.
The book argues that RAG is the superior tool for providing facts. By retrieving relevant information from an external knowledge base at inference time and adding it to the prompt context, you get several advantages:
Factual Grounding: The model is less likely to hallucinate because its context is bounded by the retrieved documents.
Traceability: You know exactly which source documents were used to generate an answer.
Up-to-date Knowledge: The knowledge base can be updated continuously without the cost of retraining/finetuning the model itself.
The core takeaway is that teams should default to RAG for knowledge-based tasks and reserve the more complex and expensive process of finetuning for tasks that require altering the model's fundamental behavior. This seems like a critical architectural decision that could save significant resources. Curious to hear how others are approaching this trade-off.
[1]: https://www.bishopbook.com [2]: https://www.oreilly.com/library/view/ai-engineering/97810981... [3]: https://d2l.ai [4]: https://udlbook.github.io/udlbook/
- Prompt Engineering for LLMs by John Berryman and Albert Ziegler: https://www.amazon.com/Prompt-Engineering-LLMs-Model-Based-A...
- AI Engineering by Chip Huyen, which I recommend based on the strength of this extract about "agents": https://huyenchip.com/2025/01/07/agents.html
1) Designing Machine Learning Systems: An Iterative Process for Production-Ready Applications by Chip Huyen.
2) AI Engineering: Building Applications with Foundation Models by Chip Huyen (this is a very recent book).
3) Generative Deep Learning: Teaching Machines To Paint, Write, Compose, and Play by David Foster.
4) Building LLMs for Production: Enhancing LLM Abilities and Reliability with Prompting, Fine-Tuning, and RAG by Bouchard & Peters.