在多模型 agent 工作流里,同一段共享上下文被每个专用模型各跑一遍 prefill 并各存一份 KV。PrefillShare 把模型拆成「冻结的共享 prefill 模块 + 各任务专用 decode 模块」,只用 cache-conditioned 微调训 decode 去读 base 的 KV,从而一次 prefill、一份 KV 跨模型复用。精度追平全量微调,p95 延迟降 4.5×、吞吐升 3.9×。
多智能体工作流常让多个专用模型(如 Planner → Coder → Reviewer)在同一份共享上下文上依次工作。但自回归推理里 KV cache 与模型参数强耦合:即便 prompt 完全相同,参数不同的两个模型 $M_i, M_j$($\theta_i \neq \theta_j$)在每一层产生的 key/value 表示都不同,缓存互不兼容。后果有二:
Disaggregated serving(把 prefill/decode 放到不同 GPU)能缓解 prefill-decode 干扰,但不能消除跨模型冗余——相同 prompt 在不同微调模型间仍然各算各存。作者自己的前作 ICaRus 虽然能做同 prompt KV 复用,但其 logical encoder 必须与 decode 同时运行,带来额外算力开销、高并发下扩展性差。
将一个模型「分解」为两种推理角色:一个冻结的 base prefill 模块 $M_{\text{base}}$,只负责把共享上下文处理一次生成共享 KV cache $C_{\text{base}}$;以及多个任务专用 decode 模块 $M_{\text{dec}}$,各自消费同一份 $C_{\text{base}}$ 生成任务输出。关键的算法贡献是 cache-conditioned fine-tuning:冻结 prefill 模块,把 $C_{\text{base}}$ 当作常量条件信号,只微调 decode 模块去在这份「别人产生的 KV」上做 next-token 预测。系统侧再配一套 prefix-aware routing + cache handoff 管线,把请求按 User ID 钉在固定 prefill worker 上以保 prefix 局部性,跨模型切换时只做 partial prefill 增量扩展缓存。
核心技术壁垒:让一个 decode 模块可靠地从另一套参数产生的 KV 表示上解码。朴素直接共享会在高共享比例下精度崩塌(Fig. 2)。PrefillShare 用「训练时就喂冻结 base 的 $C_{\text{base}}$」把训练分布与推理分布对齐,使 decode 学会对齐 base 的 KV 分布——这一 train-inference 一致性正是它能在 100% 共享下仍逼近全量微调精度的关键,且无需 base 与微调模型间的参数同步。

Paper's Figure 1, verbatim(caption: "Comparison of a typical multi-model system and PrefillShare. ... PrefillShare decouples prefill and decoding into a shared prefill module and task-specific decode modules, fine-tuning only the decode modules ... achieving up to 4× higher throughput under high load.")
这张图一次讲清两件事。左侧「Fine-Tuning」对比:典型系统里每个任务模型各自从 base 全量微调、各存 KV;PrefillShare 只把 base 当作冻结 prefill 模块(标注 "Frozen"),仅 "Update" 各 decode 模块,从而 N 个 decoder 共用一份 prompt KV。右侧「Inference」对比:baseline 因相同 prompt 上的重复 prefill + KV 爆炸式增长导致频繁 eviction 与重算;PrefillShare 用共享 KV 实现有效 prefix caching、避免早期缓存饱和。读者应注意:省的不是单次算力,而是随模型数放大的冗余。
以下 sequence 图补足论文文字描述的 proxy 编排(Appendix B.1)——原文无对应示意图,故用 Mermaid 呈现结构:
要点:scheduler = proxy,队列纪律是按 User ID 钉住 prefill worker(prefix-locality-aware routing),保证跨模型切换命中缓存而非从头重算;KV/memory manager 与 scheduler 分离——KV 由 vLLM 的 PagedAttention 分块管理,跨节点/跨 worker 的 cache handoff 走 GPU→GPU 传输,高并发时退化为 CPU staging(见 §7)。分配单元是 vLLM 的 KV block(page)。
论文无独立「性能建模」章节,但给出了自回归/KV 的形式化(Eqs. 1-4)、方法定义(Eqs. 5-7)与内存复杂度模型(Eqs. 8-9)。下面按 framework 要求复现记号表、物理意义与检查。
| 符号 | 含义 |
|---|---|
| $X, Y$ | 输入 prompt(长 $n$)/ 生成序列(长 $T$) |
| $\theta$ | LLM 参数;$\theta_{\text{base}}$ 冻结 prefill,$\theta_{\text{dec}}$ 可训 decode |
| $F_\theta(x, C_{\text{past}})$ | Transformer 前向:输入当前 token 与过去 cache,返回下一 token 与增量 cache |
| $C_t$ | 第 $t$ 步 KV cache 状态;$C_{\text{base}}$ 为共享 prefill cache |
| $k_t, v_t$ | 第 $t$ 步跨全层聚合的 key/value 张量 |
| $N$ | 模型数 |
| $L_{\text{shared}}, L_{\text{unique}}$ | 共享前缀长度 / 模型专属段长度 |
精度侧无形式化证明——仅实证:作者用「只更新 decode 相当于一种严格正则化」定性解释 PrefillShare 偶尔反超 Full-FT,未给理论。一个形式化模型本可澄清:正则化收益 vs KV-mismatch 损失的权衡在何种任务/共享比例下净为正。

Paper's Figure 2, verbatim(caption: "GSM8K accuracy as a function of KV cache sharing ratio between the base and fine-tuned models. Naive sharing without cache-adaptive fine-tuning collapses at high sharing ratios, while PrefillShare preserves near Full-FT accuracy even at 100% sharing.")
这是方法必要性的核心证据:x 轴共享比例 0→100%,朴素共享("Feature Mismatch (Accuracy Collapse)")随比例升高精度崩塌,而 PrefillShare 在 100% 共享下仍贴近 Full-FT baseline。读者应注意——若无 cache-conditioned 微调,共享本身是无法直接工作的。

Paper's Table 1, verbatim(caption: "Accuracy on math, coding, and tool-calling benchmarks ... PrefillShare achieves accuracy comparable to full fine-tuned models across all evaluated benchmarks.")
关键数字(Full-FT → PrefillShare):LLaMA3.1-8B GSM8K 71.3→71.4、HumanEval 48.2→48.8;Qwen3-8B HumanEval 83.5→86.6、HumanEval+ 74.3→80.5(显著反超)。诚实之处:仍有若干格 PrefillShare 略输,见下 §6 workload 表脚注。

Paper's Table 2, verbatim(caption: "Accuracy of Full-FT and PrefillShare on GSM8K and GSM+ across model sizes ... indicating robustness to model scale.")
Table 2 说明方法对规模不敏感:1.7B/8B/14B 三档 GSM8K/GSM+ 上 PrefillShare 与 Full-FT 基本持平(如 Q3-1.7B 75.0→75.4、Q3-14B GSM+ 66.7→67.5)。注意 L1 标注 Table 2 存在 OCR 对齐不确定性。

Paper's Figure 3, verbatim(caption: "Serving performance under multi-model agent workloads. ... PrefillShare outperforms the baseline in both patterns, with the gap widening as the session arrival rate increases, primarily due to rising prefix-cache miss rates in the baseline.")
3 列指标(p95 延迟 / 吞吐 / TTFT)× 2 行模式(ReAct / Reflexion)。低负载两者相当;随到达率上升,baseline 尾延迟迅速膨胀、吞吐下滑,PrefillShare 因摊薄共享前缀而维持高吞吐、低尾延迟。这就是 4.5×/3.9× 头条数字的来源,且差距随负载扩大。

Paper's Figure 4, verbatim(caption: "Prefix cache hit ratio and throughput under varying max concurrent sessions. ... The baseline degrades beyond ≈40 sessions ... whereas PrefillShare sustains higher throughput over a wider range, with high-concurrency saturation driven by handoff overheads.")
上图命中率、下图吞吐随 max concurrent sessions 变化。baseline 在约 40 并发后命中率峰值 ~60% 骤降、吞吐随之掉;PrefillShare 命中率稳定近 89%,吞吐持续上升,直到约 110 并发因 handoff 压力(而非命中率下降)见顶。这张图把「收益来自去重存储」与「饱和来自实现层 staging」清楚分离——是全文最具诊断价值的一张。
Qwen3-14B 复现 Fig. 3/4:吞吐、尾延迟、命中率的定性趋势一致,但TTFT 方向不同——因 PrefillShare 峰值吞吐操作点位于更高并发,prefill worker 负载更重,故 TTFT 可能上升,即使吞吐/尾延迟改善。方向非单调、依赖操作点。
| 步骤 | 论断(paper-internal) | 依据 |
|---|---|---|
| 1 | KV 与参数强耦合:同 prompt 下 $\theta_i\neq\theta_j$ 产生互不兼容的 KV | §2.2 formal argument |
| 2 | 故多模型工作流必须各自重算 prefill 且各存 KV → 延迟+内存冗余;disaggregation 只解 prefill-decode 干扰、不解跨模型冗余 | §1 para 4-5 |
| 3 | 若把 base cache 当常量、只微调 decode 去消费它(Eq. 7),decode 可对齐 base KV 分布 → 100% 共享仍近 Full-FT(Fig. 2 反证朴素共享崩塌) | §3.2 + Fig. 2 |
| 4 | 共享一次 prefill 后,内存主导项从 $N\cdot(L_{\text{shared}}{+}L_{\text{unique}})$ 变为 $L_{\text{shared}}{+}N\cdot L_{\text{unique}}$(Eqs. 8-9),$L_{\text{shared}}\gg L_{\text{unique}}$ 时近似独立于 $N$ | §3.3 Eqs. 8-9 |
| 5 | 去重存储 → 高并发下 prefix 命中率稳定(~89% vs baseline ~60% 骤降)→ 高吞吐、低尾延迟(4.5×/3.9×) | §4.3 Fig. 3-4 |
| 6 | 剩余饱和(~110 并发吞吐回落)由 vLLM CPU-GPU KV staging 引起,非算法内在限制 | §4.3 + Appendix B.2 |
| Workload regime | PrefillShare | Baseline (per-model disaggregated) | Why |
|---|---|---|---|
| 短 prompt、低并发 | 与 baseline 相当 | 相当 | 共享前缀短、冗余少,摊薄收益不显著(§4.3 low-load) |
| 长共享上下文、高并发 | 命中率 ~89%、吞吐/尾延迟大幅领先 | >40 并发后命中率崩、尾延迟膨胀 | $L_{\text{shared}}\gg L_{\text{unique}}$,去重把内存主导项从 $N\cdot L$ 降到 $L$(Eqs. 8-9) |
| 混合 prefill-decode / 极高并发 | ~110 并发后吞吐回落 | 更早饱和 | decode 侧 KV 压力触发 vLLM CPU staging(实现层,非算法) |
| 部分精度格点 | 略输 Full-FT | — | LLaMA GSM+ 49.3<49.8、HumanEval+ 45.1<45.7;Qwen GSM8K 84.8<85.8、GSM+ 64.5<65.7、Multiple 91.0<92.0 |
论文提供实现描述但未公开代码仓库,原型建立在 vLLM disaggregated serving pipeline 之上:[实现未公开](无 file:line 可引)。以下为可复现的关键实现细节(源自正文与 Appendix B):
max concurrent sessions 作为并发上限旋钮,直接控制系统级 KV footprint(§4.3)。§12 软件→硬件反推:不触发。PrefillShare 属纯软件框架(跨模型 KV 去重 + prefix-aware 路由 + cache handoff),未涉及持久 megakernel、cache-scope 控制或互连感知调度,故不产生对未来 ISA / cache 策略的硬件诉求。