arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.06562cs.LG
收藏

Mosaic: 通过全局内存规划和动态峰值镇压解锁扩散语言模型的长上下文推理

Mosaic: Unlocking Over 30$\times$ Context Length for Diffusion LLMs Inference via Global Memory Planning and Dynamic Peak Taming

Tianjin University, China(天津大学)

Liang Zheng, Bowen Shi, Yitao Hu, Jiawei Zhang, Ruofan Li, Guotao Yang, Zhixin Zhao, Zhengchao Wang, Sheng Chen, Wenxin Li, Dezhi Ran, Tao Xie, Keqiu Li

AI总结:

Mosaic通过全局内存规划和动态峰值镇压,提升扩散语言模型的长上下文推理能力,实现内存效率和推理长度的显著提升。

摘要:

扩散式大语言模型(dLLMs)已作为一种有前景的范式出现,利用同时去噪来实现全局规划和迭代细化。虽然这些能力特别有利于长上下文生成,但部署此类模型却面临一个有碍的内存容量障碍,源于严重的系统效率低下。我们发现现有的推理系统不适合这种范式:不同于受累积KV缓存限制的自回归模型,dLLMs受到瞬时激活的限制,这些激活在每一步都会重新计算。此外,通用的内存重用机制缺乏全局可见性,无法适应dLLMs动态内存峰值,这些峰值在logits和FFNs之间切换。为了解决这些不匹配,我们提出了Mosaic,一种内存高效的推理系统,从局部、静态管理转向全局、动态范式。Mosaic集成了一个仅使用掩码的logits内核以消除冗余,一个由在线启发式搜索驱动的懒惰分块优化器以自适应地缓解动态峰值,以及一个全局内存管理器以通过虚拟寻址解决碎片问题。广泛的评估显示,Mosaic在内存峰值与平均比方面实现了平均2.71倍的减少,并在相同硬件上将可支持的最大推理序列长度增加了15.89-32.98倍。这种可扩展性是在不牺牲准确性和速度的情况下实现的,甚至减少了4.12%-23.26%的延迟。

英文摘要:

Diffusion-based large language models (dLLMs) have emerged as a promising alternative to autoregressive models, leveraging simultaneous denoising to enable global planning and iterative refinement. These properties make dLLMs attractive for long-context generation. However, deploying dLLMs faces a prohibitive memory barrier, as existing inference systems are inefficient for the diffusion paradigm. We observe that current inference systems are misaligned with dLLMs. Unlike autoregressive models, whose memory footprint is dominated by the KV-Cache, dLLMs are bottlenecked by transient activations rematerialized per step. Moreover, generic memory reuse mechanisms lack the global visibility to handle dynamic memory peaks of dLLMs, which alternate between logits and feed-forward networks. To address these challenges, we present Mosaic, a memory-efficient inference system that shifts dLLM execution from local, static management to a global, dynamic paradigm. Mosaic integrates (i) a mask-only logits kernel eliminating redundant activation materialization, (ii) a lazy chunking optimizer using online heuristics to tame dynamic memory peaks, and (iii) a global memory manager leveraging virtual addressing to mitigate memory fragmentation. Evaluations show that Mosaic reduces the memory peak-to-average ratio by 2.71$\times$ on average and increases the maximum inference sequence length on identical hardware by 15.30-32.34$\times$. Crucially, Mosaic is training-free and preserves exact model outputs, while reducing end-to-end latency by 2.5%-55.4%. Our code is publicly available at https://github.com/flashserve/Mosaic.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑