Saber: 一种高效的采样方法,具有自适应加速和回溯增强的重新遮蔽,用于扩散语言模型
Saber: An Efficient Sampling with Adaptive Acceleration and Backtracking Enhanced Remasking for Diffusion Language Model
AI总结:
本文提出Saber算法,通过动态调整每步未遮蔽令牌数量和回溯机制提升代码生成的推理速度和输出质量,实验显示在多个基准上Pass@1准确率提升1.9%,推理速度提升251.4%。
摘要:
扩散语言模型(DLMs)正成为替代主流自回归范式的有吸引力的替代品,提供内在的并行生成和双向上下文建模优势。然而,对于具有严格结构约束的任务如代码生成,DLMs面临推理速度与输出质量之间的关键权衡,减少采样步骤以加速生成往往导致灾难性性能下降。我们发现根本原因在于:1)结构序列解码步骤中的生成难度非均匀,使DLMs的静态加速策略不优;2)DLMs生成的token上下文持续演变,导致早期高置信度预测变为不可逆错误。本文介绍了一种高效的采样方法Saber,即具有自适应加速和回溯增强的重新遮蔽,是一种新的训练自由的DLMs采样算法,首次在代码生成中实现了更好的推理速度和输出质量。Saber根据模型演进的置信度动态调整每步未遮蔽令牌数量,并利用回溯机制回退置信度下降的令牌,其有效性由理论分析支持。在多个主流代码生成基准上的广泛实验显示,Saber在主流DLM采样方法上平均提升Pass@1准确率1.9%,同时实现平均251.4%的推理加速。通过利用DLMs的内在优势,我们的工作显著缩小了与自回归模型在代码生成中的性能差距。
英文摘要:
Diffusion language models (DLMs) are emerging as a compelling alternative to the dominant autoregressive paradigm, offering inherent advantages in parallel generation and bidirectional context modeling. However, for the tasks with strict structural constraints such as code generation, DLMs face a critical trade-off between inference speed and output quality, where accelerating generation by reducing sampling steps often leads to catastrophic performance collapse. We find that the fundamental reasons are: 1) the generation difficulty is non-uniform in the structured sequence decoding steps, making DLM's static acceleration strategy suboptimal; 2) the context of tokens generated by DLM evolves continuously, causing early high-confidence predictions to turn into irreversible errors. In this paper, we introduce efficient Sampling with Adaptive acceleration and Backtracking Enhanced Remasking (i.e., Saber), a novel training-free sampling algorithm for DLMs that first achieves both better inference speed and output quality in code generation. Saber dynamically adjusts the number of tokens unmasked per step based on the model's evolving confidence, and utilizes a backtracking mechanism to revert tokens whose confidence drops as new context emerges, with its effectiveness supported by theoretical analysis. Extensive experiments on multiple mainstream code generation benchmarks show that Saber boosts Pass@1 accuracy by an average of 1.9\% over mainstream DLM sampling methods, while achieving an average 251.4\% inference speedup. By leveraging the inherent advantages of DLMs, our work significantly narrows the performance gap with autoregressive models in code generation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。