双焦扩散语言模型:用于并行生成的非对称双向上下文
Bifocal Diffusion Language Models: Asymmetric Bidirectional Context for Parallel Generation
AI总结:
提出双焦扩散语言模型R2LM,通过非对称双向上下文(因果注意力+反向Mamba)解决双向注意力与KV缓存不兼容问题,实现并行生成中2.4-12.9倍吞吐提升。
摘要:
离散扩散语言模型(dLLMs)并行恢复掩码标记,相比自回归(AR)生成提供显著加速。然而,这类有前景的框架面临一个基本的架构设计困境:\ding{182} 采用双向注意力通过允许每个位置访问完整上下文实现了强大的生成质量,但本质上与KV缓存不兼容,限制了批量服务场景中的推理吞吐量;\ding{183} 相反,因果注意力支持高效的缓存推理,但丢失了所有右侧上下文,显著降低了生成质量。本文介绍双焦dLLMs,一种通过非对称双向上下文解决这一困境的新范式。类比于双焦透镜,我们将该范式实例化为R2LM(从右到左Mamba),它结合了两种互补机制:a)标准的因果注意力提供精确的左上下文,完全兼容KV缓存,同时b)一个轻量级的反向Mamba SSM侧车提供压缩的右侧上下文,而不破坏可缓存性。在Qwen3-1.7B上使用600亿token进行持续预训练的综合实验表明,R2LM在批量服务中通过并行解码和KV缓存实现了比双向dLLMs高2.4倍至12.9倍的吞吐量,比AR基线快1.9倍至2.9倍,同时在大多数基准测试上超过因果基线,并在平均性能上超越双向dLLM。
英文摘要:
Discrete diffusion language models (dLLMs) recover masked tokens in parallel, offering significant speedups over autoregressive (AR) generation. However, such promising frameworks face a fundamental architectural design dilemma: \ding{182} Adopting bidirectional attention achieves strong generation quality by allowing each position to access the full context, but is inherently incompatible with KV caching, limiting inference throughput in batch-serving scenarios; \ding{183} Conversely, causal attention enables efficient cached inference but loses all right-side context, substantially degrading generation quality. This paper introduces Bifocal dLLMs, a new paradigm that resolves this dilemma through \emph{asymmetric bidirectional context}. Analogous to bifocal lenses, we instantiate the paradigm as \textbf{R2LM} (Right-to-Left Mamba), which combines two complementary mechanisms: $a$) standard causal attention providing precise left-context with full KV cache compatibility, while $b$) a lightweight reverse Mamba SSM sidecar supplying compressed right-side context without breaking cacheability. Comprehensive experiments on continued pretraining of Qwen3-1.7B with 60B tokens demonstrate that R2LM achieves $2.4\times$ to $12.9\times$ higher throughput than bidirectional dLLMs and $1.9\times$ to $2.9\times$ speedup over AR baselines in batch serving through parallel decoding with KV caching, while exceeding the causal baseline on most benchmarks and surpassing the bidirectional dLLM on average.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。