SparseVILA: Decoupling Visual Sparsity for Efficient VLM Inference

Authors: Samir Khaki (NVIDIA/U of Toronto), Junxian Guo (MIT), Jiaming Tang (MIT), Shang Yang (MIT), Yukang Chen (NVIDIA), Konstantinos N. Plataniotis (U of Toronto), Yao Lu (NVIDIA), Song Han (NVIDIA/MIT), Zhijian Liu (NVIDIA/UC San Diego) Affiliations: NVIDIA, MIT, UC San Diego, University of Toronto Venue: ICCV 2025 | arXiv: 2510.17777

机构: NVIDIA, MIT, UC San Diego, University of Toronto

发表: ICCV 2025 | arXiv: 2510.17777

代码: 暂未公开(截至 2026-03-12 未找到官方 GitHub 仓库)

一句话总结: SparseVILA 将视觉 token 稀疏化解耦到 prefill 和 decoding 两个阶段——prefill 阶段用 query-agnostic 方式剪枝冗余视觉 token,decoding 阶段用 query-aware 方式仅检索与当前问题相关的 token,实现最高 4.0x prefill / 2.5x decoding / 2.6x 端到端加速,同时保持甚至提升多轮对话和长视频理解的精度。


1. Motivation (研究动机)

1.1 VLM 推理瓶颈

VLM(Vision Language Models)处理高分辨率图像、长视频时,视觉 token 数量可达数万甚至数十万,导致:

  • Prefill 阶段:compute-bound,视觉 token 主导计算量
  • Decoding 阶段:memory-bound,KV cache 中大量视觉条目导致内存带宽瓶颈
  • 多轮对话:每轮需重新处理同一视觉上下文,延迟累积严重

Figure 3 解读: 不同任务中 prefill 与 decoding 的延迟占比差异显著。Image 任务 prefill 占 85%,Video 任务 decoding 占 65%,Reasoning 任务 decoding 占 58%。这表明不能用统一的稀疏策略处理两个阶段——需要根据各阶段的计算特性分别优化。

1.2 现有方法的局限

现有 token 剪枝方法分为两类,各有致命缺陷:

类别代表方法优点致命缺陷
Query-AgnosticVisionZip, PruMerge, HIRED不依赖文本输入,多轮稳定无法适应不同 query 的需求,高稀疏率下丢失细粒度信息
Query-AwareFastV, PDrop, SparseVLM根据 query 动态选择相关 token永久删除 token 后无法恢复,多轮对话性能急剧下降

Figure 2 解读: 即使使用 query-aware oracle(贪心选择使输出与完整模型一致的最优 token 子集),在多轮对话中精度仍持续下降(POPE 数据集上从 R-0 到 R-15 下降约 10%)。这说明 query-aware 在 prefill 阶段做的 token 剪枝是不可逆的——一旦删除,后续轮次无法恢复。


2. Idea (核心思想)

2.1 核心洞察

关键洞察: 视觉稀疏性不应在推理流水线中统一施加,而应根据 prefill 和 decoding 两个阶段的不同计算特性进行解耦

  • Prefill 阶段:轻量级 query-agnostic 剪枝,移除全局冗余 token,保留足够的视觉覆盖
  • Decoding 阶段:激进的 query-aware 检索,从完整 KV cache 中仅激活与当前 query 相关的 token

2.2 Decoupled Sparsity 的设计动机

┌─────────────────────────────────────────────────────────────┐
│                    SparseVILA Pipeline                       │
│                                                             │
│  ┌──────────────────────┐   ┌────────────────────────────┐  │
│  │   Prefill Stage      │   │   Decoding Stage (per turn)│  │
│  │                      │   │                            │  │
│  │  Visual Encoder      │   │  Query Embedding           │
│  │       ↓              │   │       ↓                    │
│  │  Salience Score      │   │  Attn(Q, V_KV) → r_i      │
│  │       ↓              │   │       ↓                    │
│  │  Prune low-salience  │   │  Select top-r_d tokens     │
│  │  (query-agnostic)    │   │  (query-aware)             │
│  │       ↓              │   │       ↓                    │
│  │  LLM Prefill         │   │  Pack into contiguous KV   │
│  │  → Full Visual KV    │   │       ↓                    │
│  │    Cache retained    │   │  Autoregressive Decoding   │
│  └──────────────────────┘   └────────────────────────────┘  │
│                                                             │
│  Sparsity: 轻量级 (60-75%)      Sparsity: 激进 (75-95%)      │
│  执行一次,多轮复用               每轮动态调整                   │
└─────────────────────────────────────────────────────────────┘

Table 1 验证: 在 RoboVQA 上对比 prefill-only 与 decoupled sparsity:

Prefill SparsityDecode SparsityPrefill 加速Decode 加速E2E 加速RoboVQA
0%0%1.0x1.0x1.0x86.4
90%0%14.6x1.1x1.4x80.0
70%85%4.9x1.2x1.4x89.1

将稀疏性从 prefill 重新分配到 decoding 后,在相同 E2E 加速下精度从 80.0 提升到 89.1(甚至超过无稀疏 baseline 86.4)。

2.3 Visual Attention Sink 与 Retrieval Token 的发现

Figure 8 解读: LLaVA-1.5 不同 LLM 层中视觉 token 的 attention 分析。Layer 2(浅层)中 attention 集中在少数固定 token 上,这些是 Visual Attention Sink——跨 query 保持稳定的”锚点”token。Layer 19(深层)中 attention 模式随 query 变化,出现 Visual Retrieval Token——动态响应 query 内容。SparseVILA 的 decoupled 设计同时捕获两种 token:prefill 保留 sink token(全局重要性高),decoding 检索 retrieval token(query 相关性高)。IoU 分析:Layer 2 的跨 query IoU 为 70%(sink 稳定),Layer 19 为 21%(retrieval 多变),SparseVILA 整体为 40%。


3. Method (方法)

3.1 Prefill 阶段:Query-Agnostic Pruning

目标: 在不知道用户 query 的情况下,基于视觉冗余性移除不重要的 token。

Token Salience Estimation

根据视觉编码器类型,采用不同的 salience 计算策略:

Case 1: 有 summary token 的编码器(如 CLIP)

其中 表示第 个视觉 token 对全局 [CLS] token 的 attention 贡献。

Case 2: 有多个 summary token 的编码器(如 RADIO)

对所有 summary token 的 attention 取平均。

Case 3: 无 summary token 的编码器(如 SigLIP, QwenVL)

对所有 token 之间的 intra-visual attention 取平均。

剪枝规则: 按 salience 排序,移除 salience 最低的 个 token( 为 prefill 保留比例)。

高效 Triton Kernel 实现

对长视频(数十万 token),显式构建完整 attention 矩阵会导致内存爆炸。论文实现了自定义 Triton kernel:

  • 流式 softmax 归一化 + salience 累加,无需显式构建完整 attention 矩阵
  • SigLIP 类编码器加速 3x,QwenVL 类编码器加速 10x

Figure 5 解读: Triton kernel 的性能对比。(a) Vision Encoder 端:SigLIP 在 512 帧时 naive 实现约 300ms,Triton kernel 约 100ms(3x 加速);QwenVL 在 256K 序列长度时 naive 实现约 15s,Triton kernel 约 1.5s(10x 加速)。(b) LLM Decoder 端:Llama2 backbone 上 Triton kernel 实现约 1.5x 加速,Qwen2 backbone 上约 1.8x 加速。

3.2 Decoding 阶段:Query-Aware Retrieval

目标: 在 decoding 生成时,从保留的视觉 KV cache 中仅检索与当前 query 最相关的 token。

Query-Aware Token Selection

在 decoding 开始前,计算 query embedding 与视觉 KV cache 条目之间的 aggregate attention strength:

其中 为 query token 集合, 为第 个视觉 token 的 KV cache 条目。选择 最高的 个 token( 为 decoding 稀疏率)。

关键设计:

  • 被选中的 KV 条目被紧凑打包到连续内存区域,避免稀疏访问模式
  • 未被选中的 token 不被删除——仍保留在 KV cache 中,可在后续轮次被检索
  • 该操作与 FlashAttention2 的 prefill path 并发执行,额外开销仅 1.5x naive 实现

Rotary Position Embedding 处理

不同 VLM 使用不同的位置编码方案,剪枝后需要特殊处理:

位置编码类型使用模型处理方式
统一 RoPELLaVA-NeXT, LongVILA保留被选 token 的连续位置索引范围
Multimodal RoPEQwen2.5-VL沿 temporal/height/width 维度重建最小连续位置网格,后移文本位置以保持全局连续性

3.3 整体实现要点

  • Prefill 负责一次性完成全局剪枝,并保留完整视觉 KV cache
  • Decoding 按轮次检索相关 token,并将其打包成连续 KV cache
  • 两阶段 sparsity 分别面向 compute-bound 与 memory-bound 瓶颈优化

4. Experimental Setup (实验设置)

4.1 评测模型与稀疏配置

  • Image benchmark: LLaVA-NeXT-7B,Prefill 60% / Decode 75%
  • Video understanding: LongVILA-7B (256f)、Qwen2.5-VL-7B (4fps)、Nemotron-Nano-VL-8B (256f)
  • Video captioning: LongVILA-7B (256f),Prefill 75% / Decode 90%
  • Physical reasoning: Cosmos-Reason1-7B (24fps),Prefill 75% / Decode 95%

4.2 评测任务与基准

  • Image benchmarks: AI2D, ChartQA, DocVQA, GQA, InfoVQA, MME, POPE, ScienceQA, TextVQA
  • Video understanding: LVB, MLVU, NExT-QA, Video-MME
  • Video captioning: Video-ChatGPT 指标 CI, DO, CU, TU, C, Overall
  • Physical reasoning: HoloAssist, RoboFail, RoboVQA
  • Visual retrieval: V-NIAH(Visual Needle-in-a-Haystack)
  • Efficiency analysis: kernel runtime、overhead、理论加速与实测加速

4.3 备注

  • 论文展示了不同任务下 prefill 与 decoding 的延迟占比,但具体 prompt 模板、解码超参与部分实现细节在当前 note 中未详细说明
  • 以下结果均沿用论文中的表格与图示信息整理。

5. Experimental Results (实验结果)

5.1 Image Benchmark(Table 2)

方法PDE2E 加速AI2DChartQADocVQAGQAInfoVQAMMEPOPESQATextVQA
Baseline001.0x63.953.063.663.528.41857.884.569.358.2
FastV.8001.2x61.831.633.555.322.01568.276.766.752.7
SparseVLM.7501.2x63.239.941.859.722.21823.983.469.657.6
VisionZip.8001.2x62.938.248.560.324.21727.484.167.957.1
SparseVILA.60.751.2x64.147.858.062.725.61831.085.869.659.1

关键发现: 在相同 1.2x E2E 加速下,SparseVILA 在 document/chart 理解任务上比 prior art 降低 >15% 的精度退化。在 AI2D、POPE、ScienceQA、TextVQA 上甚至超过 baseline

5.2 Video Understanding(Table 3)

模型PDP 加速D 加速E2ELVBMLVUNExT-QAVideo-MME
LongVILA-7B (256f) baseline001.0x1.0x1.0x53.864.978.658.8
+ SparseVILA.75.905.1x1.6x2.1x54.165.379.058.7
Qwen2.5-VL-7B (4fps) baseline001.0x1.0x1.0x59.265.576.062.3
+ SparseVILA.75.906.0x2.0x1.9x60.170.781.966.3
Nemotron-Nano-VL-8B (256f) baseline001.0x1.0x1.0x55.360.975.855.2
+ SparseVILA.75.954.0x2.5x2.6x55.963.176.656.6

关键发现:

  • 在所有视频理解 benchmark 上,SparseVILA 不仅保持精度还普遍提升(Qwen2.5-VL 上 MLVU +5.2, NExT-QA +5.9)
  • 最高实现 6.0x prefill / 2.5x decoding / 2.6x E2E 加速
  • 精度提升归因于紧凑 KV cache 使模型更聚焦于关键视觉线索

5.3 Video Captioning(Table 4)

模型: LongVILA-7B (256f) | Prefill 75% / Decode 90%

方法P 加速D 加速E2ECIDOCUTUCOverall
Baseline1.0x1.0x1.0x2.342.212.811.702.462.31
VisionZip28.5x1.5x2.1x2.042.032.561.712.112.09
PruMerge28.5x1.5x2.1x2.072.002.571.752.102.10
SparseVILA5.1x1.6x2.1x2.352.272.851.902.392.35

SparseVILA 在相同 2.1x 加速下将 Video-ChatGPT 总分从 2.31 提升到 2.35(temporal understanding +0.2)。

5.4 Physical Reasoning(Table 6)

模型: Cosmos-Reason1-7B (24fps) | Prefill 75% / Decode 95%

方法P 加速D 加速E2EHoloAssistRoboFailRoboVQAAverage
Baseline1.0x1.0x1.0x72.054.088.271.4
FastV1.0x1.1x1.3x46.037.080.952.5
SparseVILA0.4x2.0x1.9x75.058.094.575.9

SparseVILA 实现 1.9x E2E 加速 + 4.5% 精度提升(平均从 71.4 到 75.9)。

5.5 Visual Retrieval (V-NIAH)

Figure 6 解读: Visual Needle-in-a-Haystack 检索准确率热力图。SparseVLM 和 FastV 在超过 32 帧后即失效(8K context 限制),出现大面积绿色/黄色区域表示检索失败。SparseVILA 在 200 帧内保持近乎完美的检索准确率(几乎全绿),展示了其在长上下文场景下的显著优势。这得益于 decoupled 设计——prefill 保留完整 KV cache,decoding 时动态检索。

5.6 Efficiency Analysis

Figure 7 解读: Decoding attention kernel 的加速效果。SparseVILA 在所有模型/任务组合上都实现显著加速:LLaVA-NeXT [Image] 3.3x, InternVL-3.5 [Image] 4.7x, LongVILA [Video] 4.2x, Nemotron [Video] 11.4x, Qwen2.5-VL [Video] 4.2x, Cosmos [Reason] 6.8x。加速来源于减少 KV cache 的有效大小,降低 memory-bound decoding 的内存访问量。

Overhead 对比(Table 7):

方法LongVILA-7B CUDA TimeOverhead %理论加速实测加速
PruMerge448.3ms1.84%7.41x6.49x
VisionZip206.3ms0.85%7.41x6.94x
SparseVILA94.9ms0.39%3.98x3.91x

SparseVILA 的 overhead 仅为 PruMerge 的 1/5,实测加速与理论加速的 gap 最小(3.98x vs 3.91x),说明其 kernel 设计高效。

内存节省: Prefill 阶段 token 剪枝额外减少 KV memory 72.5%,linear FLOPs 减少 87.6%(LongVILA-7B)。


6. 代码实现映射

注:截至 2026-03-12,SparseVILA 官方代码尚未公开。以下为根据论文描述推测的关键实现模块。

论文组件推测实现位置关键技术
Token Salience Estimationvisual_encoder/salience.pyTriton kernel 流式 softmax + accumulation
Prefill Pruningprefill/prune.pyTop-k selection on salience scores
Query-Aware Retrievaldecode/retrieval.pyAttn(Q, V_KV) 计算 + 与 FlashAttention2 并发
KV Cache Packingdecode/kv_packing.py连续内存打包,避免稀疏访问
RoPE Reconstructiondecode/rope_handler.py统一 RoPE: 保留连续 index;M-RoPE: 重建最小 T/H/W 网格
Multi-Turn KV Evictioneval/multi_turn.py每轮仅删除前一轮 Q/A 的 KV 条目
Inference Pipeline基于 TinyChatW8A8 (SmoothQuant) + W4A16 (AWQ) 量化

相关开源项目: