> For the complete documentation index, see [llms.txt](https://yeasy.gitbook.io/llm_internals/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yeasy.gitbook.io/llm_internals/di-san-bu-fen-tui-li-yu-bu-shu-pian/10_inference_optimization.md).

# 第十章：推理优化：第一性原理的分析

训练好的模型需要在用户请求时快速生成响应。在生产环境中，推理延迟和吞吐量直接影响用户体验和运营成本。本章从推理瓶颈的第一性原理分析出发，系统介绍 KV 缓存、FlashAttention、量化、剪枝、蒸馏和投机解码等核心优化技术。
