具有MixAttention的推理友好型模型
Inference-Friendly Models With MixAttention
AI总结:
本文提出MixAttention架构,结合滑动窗口注意力与跨层KV缓存共享,显著降低内存消耗并提升推理速度,同时保持模型在长短上下文任务中的性能。
摘要:
键值(KV)缓存的大小在决定现代语言模型推理过程中的最大上下文长度和并发请求数量方面起着至关重要的作用。KV缓存大小与注意力头的数量和处理的令牌数量成正比增长,导致内存消耗增加以及长输入推理变慢。在这项工作中,我们探索了MixAttention的使用,这是一种与Character.AI发布的一篇博客密切相关的模型架构修改。MixAttention将滑动窗口注意力(仅将最近的一小部分令牌存储在KV缓存中)与跨层的KV缓存共享相结合。我们的实验表明,MixAttention显著降低了内存使用并提高了推理速度,同时在短上下文和长上下文任务中均未牺牲模型性能。我们还探索了该架构的各种配置,确定了那些在优化资源效率的同时保持各评估指标质量的配置。
英文摘要:
The size of the key-value (KV) cache plays a critical role in determining both the maximum context length and the number of concurrent requests supported during inference in modern language models. The KV cache size grows proportionally with the number of attention heads and the tokens processed, leading to increased memory consumption and slower inference for long inputs. In this work, we explore the use of MixAttention, a model architecture modification closely related to a blog published by Character.AI. MixAttention combines sliding window attention, where only a small subset of recent tokens is stored in the KV cache, with KV cache sharing across layers. Our experiments demonstrate that MixAttention significantly reduces memory usage and improves inference speed without sacrificing model performance in both short and long-context tasks. We also explore various configurations of this architecture, identifying those that maintain quality across evaluation metrics while optimizing resource efficiency.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。