arXiv:2507.13681cs.CLcs.AI2025-07被引 2

动态优化长对话中模型推理,提升响应速度与质量。

LoopServe: An Adaptive Dual-phase LLM Inference Acceleration System for Multi-Turn Dialogues

  • 推理分两阶段:预填充时动态筛选关键注意力,解码时渐进压缩键值缓存。
  • 在11个真实对话数据集上,相比基线推理加速2.1倍以上,响应质量更优。
  • 适合需要高效长对话的智能客服、虚拟助手等实际应用。

多轮对话在聊天机器人和虚拟助手等大语言模型应用中至关重要。随着对话历史变长,现有大模型面临日益严重的计算与内存挑战,影响其响应效率与能力。当前多数加速方法或压缩上下文,或优化键值缓存,但通常依赖固定或位置启发式策略,难以适应真实对话中动态且不可预测的模式,导致无法准确识别并优先处理关键上下文,进而降低生成质量。本文提出LoopServe,一种面向多轮对话的大语言模型自适应双阶段推理加速框架。其核心创新包括:在预填充阶段进行在线稀疏化,动态选择每个新输入最相关的注意力矩阵部分;在解码阶段采用渐进式键值压缩,基于最新生成的输出令牌自适应维护相关且高效的缓存。我们还构建了一个包含十一个多轮对话数据集的新基准,反映真实的查询位置与对话依赖关系。大量实验表明,LoopServe在多种长上下文对话任务中持续优于现有基线,显著加速了大模型推理。

原文摘要 · Abstract (English)

Multi-turn dialogues are essential in many real-world applications of large language models, such as chatbots and virtual assistants. As conversation histories become longer, existing large language models face increasing computational and memory challenges, which hinder their ability to provide efficient and responsive interactions. Most current acceleration methods either compress the context or optimize key value caching, but they often rely on fixed or position-based heuristics that do not adapt well to the dynamic and unpredictable patterns found in actual multi-turn conversations. As a result, these models cannot accurately identify and prioritize the most relevant context, leading to degraded response quality. In this paper, we present LoopServe, an adaptive dual-phase inference acceleration framework for large language models in multi-turn dialogues. LoopServe introduces two main innovations. First, it performs online sparsification during the prefilling phase by dynamically selecting the most important parts of the attention matrix for each new input. Second, it uses progressive key value compression during decoding by adaptively maintaining a relevant and efficient cache based on the most recently generated output tokens. We also propose a new benchmark with eleven multi-turn datasets that reflect realistic query positions and conversational dependencies. Extensive experiments demonstrate that LoopServe consistently achieves superior effectiveness compared to existing baselines and significantly accelerates LLM inference across a wide range of long-context dialogue tasks.

大模型推理长对话加速系统

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。