DIP: 用于扩散语言模型的动态上下文规划器
DIP: Dynamic In-Context Planner For Diffusion Language Models
AI总结:
DIP是一种用于扩散语言模型的上下文优化方法,通过动态选择和插入上下文示例提升生成效率,实现显著的推理加速。
摘要:
扩散语言模型(DLMs)在使用上下文示例进行通用自然语言任务时表现出强大的潜力。然而,由于双向注意力机制,DLMs在上下文长度增加时会带来显著的计算成本。本工作针对这一问题提出了一个关键发现:与自回归语言模型(ARLMs)中的顺序生成不同,DLMs中的扩散生成范式允许在生成过程中进行高效的上下文动态调整。基于这一洞察,我们提出了动态上下文规划器(DIP),一种上下文优化方法,该方法在生成过程中动态选择并插入上下文示例,而不是在提示中提前提供所有示例。结果表明,DIP在保持生成质量的同时,相对于标准推理实现了高达12.9倍的推理加速,相对于KV缓存增强推理实现了1.17倍的加速。
英文摘要:
Diffusion language models (DLMs) have shown strong potential for general natural language tasks with in-context examples. Existing In-Context Learning (ICL) approaches largely inherit the practice of autoregressive language models (ARLMs), incorporating all examples into a fixed prompt. However, applying this rigid, static-prompt paradigm to DLMs incurs substantial computational overhead, as the model must evaluate the maximum context length at every step. We address this inefficiency with a key discovery: the block-wise KV-cache mechanism inherent to DLM inference enables the \textit{low-cost dynamic adjustment of the context}. Following this intuition, our core idea is to start generation with a minimal prompt and progressively insert additional examples on the fly only when the generated tokens are of low confidence. Through rigorous empirical evaluations, we observe that average verified token confidence correlates strongly with generation accuracy, making it a reliable and computationally efficient signal of token quality. Formally, we propose \textbf{D}ynamic \textbf{I}n-Context \textbf{P}lanner (DIP), a context-optimization algorithm based on average verified confidence that dynamically ranks and inserts in-context examples during generation, rather than providing all examples up front. Experimental results on math and coding benchmarks with LLaDA-1.5 and LLaDA-8B-Instruct show that DIP achieves up to $1.59\times$ and $1.36\times$ speedups, respectively, while largely preserving the generation quality of the fixed-prompt baseline. Code: https://github.com/wmd3i/DIP
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。