Files
nexus/wiki/concepts/vLLM.md
2026-04-15 15:02:52 +08:00

44 lines
1.2 KiB
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.
---
title: "vLLM"
type: concept
tags: [llm, inference-optimization, gpu]
last_updated: 2025-12-20
---
## 基本信息
- **全称**Virtual Large Language Model
- **类型**:推理优化框架
- **来源**:大模型相关术语和框架总结
- **维护方**vLLM 社区
## 定义
vLLM 是开源项目,通过更好地利用 GPU 内存来加快大语言模型生成式 AI 应用的输出速度。
## 核心模块
### KV Cache
- K 和 V 是每个 token 向量化后通过线性变换得到的向量,用于注意力计算
- KV Cache 保存历史 K/V避免重复计算
- 显存开销随上下文长度、层数、头数、维度线性增长
### PagedAttention
- 将 KV Cache 切分为固定大小的块block
- 页表式映射管理,类操作系统虚拟内存
- 避免连续内存分配导致的碎片化和 OOM
- 支持多分支和重复前缀场景的 KV 块复用
### 连续批处理
- 每个解码步骤(按 token 迭代)将活跃请求组装成一个批
- 序列长度不同也能高效合批
- GPU 基本满负载运转
- 减少短任务被长任务阻塞的头阻塞
## 关联
- [[LLM]] ← 优化对象
- [[RAG]] ← 可结合使用
- [[Embedding]] ← 向量化基础
## Aliases
- vLLM
- Virtual Large Language Model