Chapter 10. Smarter, Better, Faster, Stronger: Optimizing LLMs and AI Agents
As you’ve seen throughout the book, transformers are generalists. They can generate text, compose music, write code, and create or classify images. You’ve learned that end-to-end reinforcement learning combined with chain of thought can spark internal reasoning and help models solve more complex problems. You’ve also gained an understanding that dividing problems into subproblems and allowing language models to collaborate in a multi-agent system can turn them into robust tools for challenging tasks.
Yet as task complexity grows, these capabilities are not enough. Extended reasoning, multi-step decision making, and production-grade reliability expose weak points. Without optimization, even the largest models or the most advanced agentic systems can have problems with difficult reasoning chains, waste computation on trivial problems, or fail to adapt in real-world deployments.
Optimization is the missing piece. If you think about it, world-class athletes don’t rely on talent or regular practice alone. They depend on an ecosystem that includes targeted training, recovery, nutrition, and mental preparation. In the same way, transformers can’t rely only on pretraining or supervised fine-tuning. They need reinforcement signals, adaptive reasoning strategies, efficient test-time scaling, and strong systems-level infrastructure. In practice, this means going beyond the baseline with post-training frameworks ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access