Files
nexus/wiki/concepts/PagedAttention.md

28 lines
896 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PagedAttention
## Metadata
- **Type**: Concept
- **Category**: AI/LLM/Inference Optimization
## Definition
PagedAttention 是 vLLM 项目开发的一种注意力机制优化算法,将 KV Cache 切分为固定大小的"块"block并通过页表式映射管理这些块类似于操作系统虚拟内存的调度方式。这种方法避免了按序列分配大块连续内存导致的碎片化和 OOM内存溢出同时支持动态并发与复用。
## Details
- **核心思想**: 将 KV Cache 分块管理,类似操作系统虚拟内存
- **分块大小**: 固定大小的块block
- **管理方式**: 页表式映射
- **优势**:
- 避免碎片化和 OOM
- 支持动态并发
- 支持相同前缀的 KV 块复用(如 beam search 和重复前缀场景)
- 减少 prefill预填充时间
## Related Concepts
- [[vLLM]]
- [[KV Cache]]
- [[LLM]]