HyperAIHyperAI

Command Palette

Search for a command to run...

LLM
Transformer

GAUGEROPE: انتباه كامن قابل للتنفيذ متوافق مع RoPE

Yuanhang Gao Xiangrui Yang Lingyuan Meng Yuanfeng Chen Dongsheng Li

الملخص

يقلل ضغط ذاكرة التخزين المؤقت الكامنة للمفاتيح والقيم من البصمة الذاكرية عبر تمثيل المفاتيح والقيم التاريخية في صيغ مدمجة. غير أن حالات المفاتيح المضغوطة العامة تتطلب إعادة بناء إلى البعد الأصلي قبل تطبيق RoPE وحساب درجات الانتباه، مما يضيف عبئًا يتزايد مع طول التسلسل في مسار فك الترميز. نحدد في هذا العمل متى يمكن لتمثيل كامن للمفاتيح والقيم أن يعمل مباشرة بوصفه حالة تنفيذ لنموذج RoPE مُدرَّب مسبقًا. فبالنسبة للمحوِّلات القائمة على RoPE، يتطلب التنفيذ الخطي الساكن الدقيق لمسار المفاتيح الدوراني أن يحافظ التحويل من الكامن إلى الأصلي على فعل RoPE المُدرَّب مسبقًا عبر علاقة تشابك، مما يقصر الخلط الدقيق على الإحداثيات التي تتشارك تردد RoPE نفسه. واسترشادًا بهذا التحديد، نبني GAUGEROPE، وهو تمثيل كامن قابل للتنفيذ للمفاتيح والقيم دون الحاجة إلى تدريب. يجمع هذا التمثيل بين حامل متوافق مع RoPE يحافظ على الفعل الدوراني وتصحيح تقريبي متبقٍّ للمفاتيح والقيم مستقل عن الموضع يكمّل معلومات المفاتيح والقيم، ويُقيَّم كلاهما دون إعادة بناء كثيفة للمفاتيح والقيم التاريخية لكل رمز. يحقق GaugeRoPE على نموذج Mistral-7B ضغطًا لذاكرة المفاتيح والقيم بمقدار 5.85× مع الحفاظ على جودة قريبة من خط الأساس الكامل لذاكرة التخزين المؤقت. وتؤكد نتائج إضافية على بنية الانتباه متعدد الرؤوس صحة البناء خارج نطاق الانتباه متعدد الاستعلامات المجمعة. ويحقق GaugeRoPE زيادة في إنتاجية فك الترميز تصل إلى 2.48× مقارنة بخط الأساس غير المضغوط عبر التنفيذ الكامن المباشر.

One-sentence Summary

Researchers at the National University of Defense Technology propose GaugeRoPE, a training-free executable latent KV representation that combines a RoPE-compatible carrier with an approximate position-independent residual key-value correction, allowing it to avoid per-token dense historical K/V reconstruction and, on Mistral-7B, achieve 5.85×5.85\times5.85× KV compression while maintaining quality close to the full-cache baseline and up to 2.48×2.48\times2.48× the decode throughput of the vanilla uncompressed baseline through direct latent execution.

Key Contributions

  • The paper characterizes the static original-frequency linear maps that carry pretrained RoPE exactly, showing that distinct RoPE frequencies cannot mix while same-frequency copies admit arbitrary complex-linear mixing. This identifies when a latent key state can serve directly as the execution state of a RoPE-based transformer.
  • The paper introduces GaugeRoPE, a training-free latent KV representation that combines a RoPE-compatible carrier with an approximate position-independent residual key-value correction. Historical attention is evaluated directly from compressed latent states without per-token dense reconstruction of native keys or values.
  • Experiments on Mistral-7B show that GaugeRoPE maintains quality close to the full-cache baseline at 5.85× KV compression and achieves up to 2.48× the decode throughput of the vanilla uncompressed baseline, with additional MHA results validating the construction beyond GQA.

Introduction

Autoregressive LLM decoding maintains a growing KV cache, which creates substantial GPU memory and memory-traffic costs at long context lengths and large batch sizes. Post-training low-rank KV compression reduces storage, but prior methods such as Palu reconstruct generic compressed keys into native space before rotary position encoding, so reconstruction overhead scales with sequence length and erodes much of the compression benefit. Architectural alternatives like MLA and TransMLA avoid full reconstruction by decoupling RoPE during pretraining or conversion, but for pretrained GQA and MHA models the structural challenge remains: direct latent scoring is possible only when the latent key space is closed under the pretrained rotary action. The authors characterize the static linear maps that remain exactly compatible with pretrained RoPE, showing that distinct frequencies cannot mix while same-frequency copies admit arbitrary complex-linear mixing. They introduce GaugeRoPE, which combines a RoPE-compatible carrier with a position-independent residual key-value correction to execute historical attention directly from compressed latent states without per-token native-key reconstruction.

Method

The authors leverage the structural properties of Rotary Position Embeddings (RoPE) to design GaugeRoPE, a method that compresses the key-value cache without breaking positional invariance. Standard low-rank key representations fail to absorb the decoder into the query side because RoPE introduces position-dependent rotations. To overcome this, GaugeRoPE constructs a RoPE-compatible latent space that preserves the exact rotary action while drastically reducing the cache footprint.

The core of the architecture relies on a RoPE-compatible carrier. The authors demonstrate that an exact RoPE-compatible map must be block diagonal in frequency. For each frequency, they stack the pre-RoPE key coordinates across all heads sharing that frequency and compute a Gram matrix. The leading eigenvectors of this matrix form the low-rank carrier basis. When utilizing a rank-one basis, the complex phases are folded offline into the pretrained query and key projections. This phase alignment enables purely real-valued inference while preserving the pretrained attention function.

Because a finite-rank carrier cannot span the entire key space, the authors introduce a joint residual key-value (RKV) code to store complementary information. The residual key is defined as the difference between the original key and the key reconstructed from the compatible carrier, expressed as rK=k−k^G\mathbf{r}^K = \mathbf{k} - \hat{\mathbf{k}}^GrK=k−k^G. A joint principal component analysis encoder then compresses the flattened residual key and value vectors into a position-independent RKV code.

As shown in the figure below:

The execution pipeline splits the attention computation into two parallel paths that avoid per-token historical native key and value reconstruction. In the first path, the query is projected into the carrier latent space, and the score is computed using latent RoPE. In the second path, the residual key decoder is absorbed into the query side, allowing the residual score to be computed directly from the position-independent RKV code. These two scores are summed to form the final attention logits before the softmax operation. Finally, the values are aggregated in the latent space and decoded once through a shared output projection, completing the efficient attention mechanism.

Experiment

The evaluation compares GaugeRoPE against full models and post-training low-rank and quantization baselines on RULER and LongBench using Mistral-7B, Qwen2.5-7B, and CodeLlama-7B. Results show that GaugeRoPE maintains long-context retrieval and generation quality close to the uncompressed model while reducing KV storage, with stronger passage retrieval and length scaling than low-rank baselines, and it generalizes across GQA and standard MHA backbones. Ablations indicate that the complex compatible carrier plus residual correction improves attention fidelity and generation stability, and the direct decoding design removes historical KV reconstruction, yielding lower latency and higher throughput than compressed baselines at long contexts.

GaugeRoPE at 50% compression achieves the highest RULER average among the low-rank cache methods, with stronger CWE-FWE and QA scores than Palu and ReCalKV, while variable tracking is slightly lower. Its mixed-precision 8/4-bit version reaches about 5.85x compression and closely tracks the unquantized GaugeRoPE on RULER and LongBench, using less per-token KV storage than 6-bit Palu and ReCalKV while outperforming them on RULER. KIVI remains stronger on LongBench but weaker on needle-in-a-haystack, and retaining a small native recent-token cache further improves GaugeRoPE on both RULER and LongBench. At equal 50% compression, GaugeRoPE outperforms Palu and ReCalKV on the RULER average, with gains concentrated in CWE-FWE and QA. The 8/4-bit GaugeRoPE configuration reaches higher compression than 6-bit Palu and ReCalKV, uses less per-token KV storage, and still improves RULER.

The LongBench comparison shows the Full model with the highest average, while KIVI 2-bit is the closest compressed method overall. Among low-rank approaches, GaugeRoPE is stronger in summarization, synthetic, and code tasks but weaker in single-doc QA and few-shot, whereas Palu and ReCalKV show the opposite pattern. Quantized GaugeRoPE reduces per-token KV storage substantially with only a small LongBench average decrease. Full model leads the LongBench average, with KIVI 2-bit compression as the closest overall competitor among the compared methods. GaugeRoPE achieves the best summarization, synthetic, and code scores among low-rank methods, but its single-doc QA and few-shot scores are the lowest across all compared methods. Palu and ReCalKV retain stronger single-doc QA and few-shot performance, while their synthetic and code scores are generally lower than GaugeRoPE's. Quantized GaugeRoPE reduces per-token KV storage by 65.8% while decreasing the LongBench average by only 0.20 points relative to its unquantized counterpart.

GaugeRoPE is tested on Qwen2.5-7B with GQA and CodeLlama-7B with standard MHA at nominal 2x compression with BF16 caches. It retains 88.1% of the full RULER score on Qwen2.5-7B and a similar relative share on CodeLlama-7B, with comparable absolute gaps. This supports transfer across grouped-query and multi-head attention backbones. On Qwen2.5-7B, GaugeRoPE retains 88.1% of the full baseline RULER score. On CodeLlama-7B, GaugeRoPE preserves a similar relative share of full quality under standard MHA. The larger head multiplicity in CodeLlama is noted as supporting a wider compatible carrier under the same construction.

The experiments evaluate GaugeRoPE against low-rank and quantized KV cache baselines on RULER and LongBench, as well as across Qwen2.5-7B with GQA and CodeLlama-7B with MHA. At equal 50% compression, GaugeRoPE leads low-rank methods on RULER, especially in CWE-FWE and QA, while its 8/4-bit mixed-precision version closely tracks unquantized quality with much lower per-token KV storage. On LongBench, GaugeRoPE excels at summarization, synthetic, and code tasks but lags Palu and ReCalKV on single-doc QA and few-shot, while KIVI remains the closest compressed competitor overall. The method also transfers across GQA and MHA backbones, preserving a similar share of full RULER quality on both models.


بناء الذكاء الاصطناعي بالذكاء الاصطناعي

من الفكرة إلى الإطلاق — سرّع تطوير الذكاء الاصطناعي الخاص بك مع المساعدة البرمجية المجانية بالذكاء الاصطناعي، وبيئة جاهزة للاستخدام، وأفضل أسعار لوحدات معالجة الرسومات.

البرمجة التعاونية باستخدام الذكاء الاصطناعي
وحدات GPU جاهزة للعمل
أفضل الأسعار

HyperAI Newsletters

اشترك في آخر تحديثاتنا
سنرسل لك أحدث التحديثات الأسبوعية إلى بريدك الإلكتروني في الساعة التاسعة من صباح كل يوم اثنين
مدعوم بواسطة MailChimp