LiveLoRA:实现 LoRA 更新后 KV 缓存的精确迁移
LiveLoRA: Exact KV Cache Migration Across LoRA Updates for LLM Agents
跑着大量长会话智能体的团队换 LoRA 版本时不用再全量重放历史了。论文在 Qwen2.5-3B 上实测 68.98 倍加速,解码只多 4.8% 开销,还给出了等价性证明。做在线学习、个性化智能体或者频繁热更新适配器的服务端工程值得看。
论文提出 LiveLoRA,一种模型与运行时协同设计方法,解决 LLM 智能体在更换 LoRA 适配器后必须重放全部交互历史的问题。核心机制是冻结底层 decoder 块并固定 K/V 适配器下投影,使每个 token 的基础投影和低秩坐标在适配器版本切换时保持不变,运行时再重建候选 K/V、用最终块重估最新 token,并原子性地提交适配器、缓存与下一 token logits。论文证明了在给定模型假设下,该方法的续写结果与全历史 re-prefill 在精确算术下等价。
实验在 Qwen2.5-3B-Instruct 上进行:32 个活跃会话、每会话 8K token 的场景下,相对全历史 re-prefill 的成对发布加速中位数在五次运行中平均达 68.98 倍;服务基准显示解码开销约为 4.8%,与原生缓存解码接近。与保留边界重放相比,紧凑保留在 8K 上下文时额外会话存储减少 3.42 倍,发布加解码成本相近。
LiveLoRA: Exact KV Cache Migration Across LoRA Updates for LLM Agents
Updating an LLM adapter should not require replaying the full interaction history of every active session. Yet reusing key-value (KV) cache entries computed under an earlier version mixes model versions, while full-history re-prefill becomes increasingly costly as histories and session fleets grow. We introduce LiveLora, a model-runtime co-design for exact final-block KV cache migration. Frozen lower decoder blocks and fixed K/V adapter down-projections preserve each token's base projections and low-rank coordinates across adapter versions. The runtime reconstructs candidate K/V, reevaluates the latest token through the final block, and commits the adapter, cache, and next-token logits together. We prove continuation equivalence to full-history re-prefill in exact arithmetic under the stated model assumptions. On Qwen2.5-3B-Instruct, median paired publication speedups over full-history re-prefill average $68.98\times$ across five runs for 32 active sessions with 8K tokens each. Serving benchmarks show approximately 4.8% decoding overhead relative to native cached decoding. Compared with retained-boundary replay, compact retention gives a $3.42\times$ reduction in additional session storage at 8K, with similar measured publication-plus-decoding cost. LiveLora allows persistent LLM agents to adopt new adapter versions without replaying their full interaction histories.
This report is categorized under AITOP's "Papers" desk. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include LiveLoRA, LoRA, KV Cache, Qwen2.5.
Source attribution: curated from arXiv cs.AI (@Tianyi Huang, Samuel Xu, Ivy Gu, Nathan Huang, Siqi Zhang).