HACK++: Towards More Effective Head-Aware Key-Value Compression for Efficient Visual Autoregressive Modeling

Ziran Qin, Yuchen Jiang, Mingbao Lin, Youru Lv, Hang Guo, Wen Fei, Weiyao LinarXiv 2026

TL;DR

HACK++ is a training-free Key-Value (KV) cache compression framework designed specifically for Visual Autoregressive (VAR) models. By identifying a stable functional split between "contextual" and "structural" attention heads and decoupling immediate attention computation from long-term cache storage, HACK++ slashes memory footprints by over 2× and accelerates inference while maintaining near-lossless image generation quality.

What Problem Does This Paper Address?

Autoregressive (AR) models have taken the visual generation world by storm, but traditional next-token prediction models suffer from painfully long decoding chains. Visual Autoregressive (VAR) models fix this by shifting to a next-scale paradigm, generating images as a coarse-to-fine sequence of multi-scale token maps. While this allows for highly parallel decoding within each scale, it introduces a massive new bottleneck.

As generation progresses, vanilla VAR models indiscriminately cache the KV pairs of all historical scales. Because the sequence length grows cumulatively, the per-step attention computation becomes increasingly expensive ($O(n^4)$ complexity), and the KV cache rapidly inflates until it dominates memory consumption.

Existing KV cache compression methods built for Large Language Models (LLMs) fail here. LLMs cleanly separate a one-time prefilling stage from single-token decoding. VAR models, by contrast, interleave prefilling and decoding behaviors at every single scale. Simply applying LLM compression rules discards tokens that VAR attention critically depends on, leading to severe image degradation.

Methods

The authors introduce HACK++, a training-free, head-aware compression framework that operates in two stages:

  1. Offline Calibration: A one-time, near-free calibration step using just 50 samples. It calculates attention variance to classify attention heads into two categories and precomputes cross-scale attention priors.
  2. Online Inference: During image generation, HACK++ applies a Decoupled Attention and Cache Compression pipeline:
  3. Phase 1 (Pre-attention): Bounds immediate attention computation cost under an attention budget ($B_a$) by selecting a temporary subset of tokens.
  4. Phase 2 (Post-attention): Compresses the actual accumulated KV cache stored for future scales under a tighter cache budget ($B_c$), ensuring $B_c < B_a$ for maximum memory savings.
Fig. 1: (a) Vanilla VAR caches all KV pairs across scales without compression. (b) HACK applies a coupled compression pipeline (Ba =Bc) with head-aware, pattern-specific estimation and a fixed asymmetric allocation. (c) HACK++ hacks down both attention complexity and cache length via a decoupled pipeline (Ba > Bc) for more aggressive cache reduction, with enhanced pattern-specific estimation and a reliance-aware budget adapting across head types, layers, and scales.

To select which tokens to keep, HACK++ uses Pattern-Specific Importance Estimation:

  • Contextual Heads use a lightweight query-subset attention mechanism to approximate token importance online.
  • Structural Heads bypass expensive online attention matrices entirely, using a cheap combination of precomputed offline scale priors and online value norms.

Finally, a Reliance-Aware Adaptive Cache Budget Allocation dynamically shifts the cache budget across head types, layers, and generation steps based on how heavily future steps are expected to rely on that specific history.

Datasets

The framework was validated across seven different VAR-family models spanning three distinct tasks:

  • Text-to-Image Generation: Evaluated on MJHQ-30K, HPSv2.1, and ImageReward.
  • Class-Conditional Generation: Evaluated on ImageNet-1K.
  • Unified Understanding-and-Generation: Evaluated on GenEval and DPG-Bench.

Key Insights and Ideas

  • The Contextual vs. Structural Dichotomy: The authors discovered that VAR attention heads naturally and stably split into two types. Contextual Heads exhibit a vertical attention pattern, focusing on semantic consistency regardless of query position. Structural Heads exhibit a multi-diagonal pattern, mapping query-dependent spatial configurations across scales to maintain geometric coherence.
Fig. 2: Attention Patterns of Contextual and Structural Heads. Both Contextual and Structural heads exhibit consistent vertical and multi-diagonal patterns, respectively, across different samples and scales.
  • Asymmetric Failure Modes: Head-masking experiments revealed that disabling contextual heads destroys semantic grounding (e.g., missing objects from prompts), while disabling structural heads causes severe geometric deformation and texture inconsistency.
Fig. 3: Impact of selective head masking (15% of total heads for each type on VAR-d30, 30% for Infinity-8B). Compared with the original generation (a), masking contextual heads (b) disrupts semantic grounding, losing fine-grained content consistency with the conditioning, whereas masking structural heads (c) retains the coarse semantic direction but causes geometric deformation and degraded spatial coherence.
  • Decoupling Attention from Cache: Immediate attention computation and future cache storage serve entirely different purposes. The authors observed a massive "redundancy gap" where cached historical tokens occupy a huge fraction of the attention input but receive very little actual attention mass at later scales. Treating them separately allows for much more aggressive cache eviction.
Fig. 4: Attention and cache require stage-decoupled compression. (a) Scale-normalized attention entropy decreases consistently across generation steps, indicating progressively more concentrated and redundant attention. (b) At later generation steps, cached historical tokens occupy a far larger fraction of the attention input than the attention mass they actually receive, exposing a substantial redundancy gap between cache storage and attention contribution.

Key Results

  • Near-Lossless Compression: On the Infinity-2B and 8B models, HACK++ maintained near-lossless image generation quality using only a 30% attention budget and a 10% cache budget. It remained remarkably robust even under an extreme 1% cache budget.
  • Resource Efficiency: For Infinity-8B, HACK++ reduced the memory footprint by 2.04× (dropping from 59.00 GB to 28.89 GB) and accelerated inference throughput by 1.52×.
  • Enhanced Batching: By shrinking the KV cache footprint, HACK++ allows models to scale to much larger batch sizes. When combined with FlashAttention, vanilla Infinity-8B (which normally out-of-memories past a batch size of 4) successfully scaled to a batch size of 18, yielding a 2.76× throughput gain.

Limitations and Future Work

While highly effective, the authors note that their current head taxonomy is binary (contextual vs. structural). A finer-grained taxonomy based on nuanced historical scale reliance could unlock even higher compression ratios. Additionally, they suggest that the clear separation of semantic and spatial control in early scales opens up exciting future avenues for controllable generation and image editing, allowing users to selectively manipulate specific head types to steer content or layout.

Summary updated

BibTeX
@misc{qin2026hack,
  author = {Ziran Qin and Yuchen Jiang and Mingbao Lin and Youru Lv and Hang Guo and Wen Fei and Weiyao Lin},
  title = {{HACK++: Towards More Effective Head-Aware Key-Value Compression for Efficient Visual Autoregressive Modeling}},
  year = {2026},
  eprint = {2606.08302},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.08302},
}
Figure