How Query Visibility Changes KV-Cache Compression Rankings: Matched-Budget Audit

A matched-budget audit reveals that query visibility drastically alters KV-cache compression rankings: SnapKV drops -0.066 below a simple baseline.

martes, 28 de julio de 2026 • 4 min read • Q2BSTUDIO Team

Auditoría de presupuesto: consulta visible vs. agnóstica

KV-cache compression has become an indispensable technique for reducing computational and memory costs in large language models (LLMs). However, the way these compression methods are evaluated can distort their true utility in production environments. A recent study reveals that query visibility during compression completely alters the ranking of existing techniques, with direct implications for companies integrating generative AI into their processes.

Until now, most KV-cache compression evaluations were conducted under a 'query-aware' protocol: the question is appended to the context before compression. This approach is convenient in the lab, but does not reflect the most economically relevant use case: compress a document once and answer many future questions against it. In that reuse scenario, compression must happen without knowing the query — that is, in a 'query-agnostic' manner.

The study audits six published compression methods against three trivial baselines, using three open-source models of 7 to 9 billion parameters, with over 144,000 paired evaluations on the RULER-8192 dataset and 40,800 on LongBench. The results are striking: when compression is performed without seeing the query, rankings change dramatically. For instance, SnapKV, one of the most widely deployed methods, loses to the 'keep the start and the recent window' baseline by an average of -0.066 points. In contrast, KeyDiff consistently outperforms the best of three trivial baselines in 31 out of 36 cells.

The reason is structural: SnapKV uses the query itself within its 64-token observation window to score the relevance of context tokens, giving it an artificial advantage in query-aware evaluations. When that advantage disappears under the agnostic protocol, its performance drops. KeyDiff, on the other hand, uses a scoring signal that contains no query term at all, maintaining its effectiveness regardless of query visibility.

For a company developing AI-based solutions, this difference is not trivial. Imagine a customer service system that must answer questions about an extensive knowledge base. If the system compresses documents every time a query arrives, latency and compute costs skyrocket. The alternative is to compress the documents once and reuse that compressed cache for all future questions. But if the compression method depends on the query, its performance will be deceptively good in lab tests and disappointing in production.

From a technical perspective, the research demonstrates that the evaluation protocol must align with the use case. For applications where the query is not known in advance — such as internal search engines, virtual assistants, or recommendation systems — it is advisable to select compression methods that are robust to the agnostic scenario. Transparency about how each method uses query information is key to making informed decisions.

At Q2BSTUDIO, as a software and technology development company, we address these challenges from a comprehensive perspective. Our team builds custom applications that integrate optimized language models for real-world environments, where KV-cache efficiency makes the difference between a reactive and a proactive system. We work with cloud platforms such as AWS or Azure to deploy scalable infrastructures that manage compression intelligently, reducing operational costs without sacrificing accuracy.

Additionally, in the AI domain, we develop intelligent agents that directly benefit from these techniques: an agent querying a database of agnostically compressed documents can respond in milliseconds, maintaining coherence over long conversations. Cybersecurity also plays a relevant role: when compressing sensitive data, we ensure that neither the information nor the scoring signals are exposed through encryption protocols and continuous auditing. We also integrate Business Intelligence (BI) solutions with Power BI to visualize the performance of these systems, identifying bottlenecks in real time.

In short, the study underscores the need to evaluate KV-cache compression techniques under conditions that reflect real usage. Query visibility is not a minor detail: it completely alters the ranking of methods and, therefore, the architectural decisions made by engineering teams. In a market where LLM efficiency is a competitive factor, betting on methods proven in agnostic scenarios, such as KeyDiff, can make the difference between a functional product and one that does not scale.

At Q2BSTUDIO, we offer support in selecting and implementing these technologies, ensuring that every solution — whether a corporate chatbot, a document analysis system, or a sales assistant — is backed by a solid technical foundation and adapted to the real needs of the business. Properly evaluated KV-cache compression is a powerful lever for democratizing access to generative AI without compromising user experience.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.