Abstract
Autoregressive (AR) image generation models like Janus-Pro have achieved state-of-the-art results by treating visual tokens as sequences. However, the quadratic growth of the Key-Value (KV) cache creates a significant memory bottleneck. This paper introduces SSD (Spatial-Semantic Head Decoupling), a novel framework that compresses the KV cache by 5x and boosts throughput by up to 6.6x. By categorizing attention heads into spatial-locality and semantic-sink archetypes, SSD applies specialized compression strategies that maintain high image quality while drastically reducing resource requirements.
Introduction: The KV Cache Bottleneck
Modern multimodal models generate photorealistic images by predicting visual tokens sequentially. As the resolution increases, the number of tokens grows, leading to a massive KV cache that consumes memory and slows down inference. While text-based Large Language Models (LLMs) have established KV compression techniques, visual tokens possess unique spatial relationships that standard methods often fail to preserve. The primary challenge lies in reducing the cache size without losing the structural integrity or semantic coherence of the generated image.
Methodology: Spatial-Semantic Head Decoupling
The core innovation of SSD lies in the observation that attention heads in vision models are not monolithic. They generally fall into two categories based on their attention patterns:
- Spatial-Locality Heads: These heads focus on immediate neighbors, capturing local textures and details. SSD manages these using a sliding window policy, retaining only the most recent tokens to save space.
- Semantic-Sink Heads: These heads focus on global context and "anchors" that define the image's overall meaning. SSD employs a heavy-hitter retention policy to keep tokens that consistently receive high attention over time.
The SSD workflow involves an offline profiling stage to classify heads based on a sparsity metric, followed by adaptive compression during inference. A buffering mechanism is also utilized to reduce the computational overhead of identifying heavy-hitter tokens, further accelerating the generation process.
Key Insights: Anchors and Sparsity
Research into the attention patterns of the Janus-Pro model revealed several critical insights that inform the SSD framework:
- Margin Columns as Anchors: In raster-scanned generation (left-to-right, top-to-bottom), tokens at the image margins often act as organic semantic anchors, aggregating global information for the model.
- Pyramidal Sparsity: Lower layers typically exhibit broader attention to establish the image's structural framework, while higher layers become increasingly localized to focus on fine-grained details.
- Semantic Concentration: Specific tokens consistently act as "sinks" for attention. This phenomenon is visualized through MSE spikes at certain token positions, indicating where the model's semantic focus is concentrated.
Results and Performance
SSD was evaluated on the Janus-Pro (1B and 7B) models using the GenEval and DPG-Bench benchmarks. The results demonstrate significant efficiency gains without compromising quality:
- Memory Efficiency: Achieved a 5x reduction in peak memory usage compared to full-cache baselines.
- Throughput Boost: Provided a 6.6x speedup at a batch size of 128, reaching up to 10.7x with the optional buffering mechanism for the 1B model.
- Quality Preservation: Minimal impact on visual fidelity and prompt adherence was observed, with SSD often outperforming general-purpose LLM compression methods like H2O or StreamingLLM.
Conclusion
SSD provides a robust solution for the memory constraints of AR image generation. By decoupling spatial and semantic attention, it enables high-quality generation on resource-constrained, consumer-grade hardware. Future work may explore integrating SSD with head-wise budget allocation and optimizing the prefill phase for a more comprehensive efficiency framework.
Summary updated