IndexPool Breakdown: 4-to-1 Index Cache Compression

    This article explores IndexPool, a technique designed to optimize long-context large language models by compressing the indexer cache. It examines the dual costs of long contexts in terms of memory and latency, the role of the indexer in hybrid attention architectures, and how IndexPool utilizes weighted pooling to reduce indexer cache size by 75%. Additionally, it provides hypothetical estimates for memory and latency savings, outlines a pre-deployment verification checklist, and discusses potential trade-offs in recall quality.

    1. Two Costs of Long Context

    The context windows of large language models have expanded from tens of thousands to millions of tokens. Capabilities such as long-document analysis, code repository comprehension, and ultra-long conversations rely on this expansion, but it comes at a cost, primarily in memory and latency.

    Regarding memory, standard multi-head attention must cache Key and Value tensors (i.e., the KV cache) for each token. At a scale of 1M tokens, even with quantization or grouped-query attention, the KV cache still occupies a massive amount of VRAM, often becoming the upper limit for batch size before compute does.

    Regarding latency, models using sparse attention require a lightweight indexer. At each decoding step, the indexer must retrieve fragments relevant to the current query from historical tokens. The indexer has its own cache, the size of which is proportional to the context length. A larger cache means more index computation and memory access per step, which subsequently slows down decoding speed.

    IndexPool specifically targets this indexer cache.

    2. Division of Labor Among Three Components

    Hybrid architectures often combine linear attention and sparse attention. The responsibilities of the three components are as follows:

    Component Main Duty Cached Object Cost as Context Grows
    Linear Attention Captures local dependencies Fixed-size recurrent state Approximately constant
    Sparse Attention Precise computation on recalled key tokens KV of recalled tokens Proportional to recall count
    Indexer Recalls relevant tokens from global history Index representation per token Linearly grows with context length

    The linear state is a form of lossy compression, meaning critical long-distance information can easily be lost, requiring the indexer to supplement global dependencies. The indexer’s cache size, memory access patterns, and matching computation volume collectively determine the speed of the sparse pathway under ultra-long contexts.

    3. IndexPool Core: Weighted Pooling

    IndexPool’s approach is to compress four cache vectors at the same position in the indexer into one, reducing the indexer cache size to a quarter of its original volume.

    3.1 What are the 4 Cache Vectors?

    Public materials do not list the specific fields of these four cache vectors. They typically correspond to different projection views or granularity levels, each serving different stages of the retrieval process. For specific details, refer to the model’s research paper or implementation code.

    3.2 The Weighted Pooling Process

    Weighted pooling differs from simple truncation or averaging. It allows each vector to participate in the merge based on its own contribution. The process can be summarized in three steps:

    1. Retrieve the four cache vectors at the same position.
    2. Calculate four weights, each corresponding to the importance of one vector.
    3. Perform a weighted sum to output one vector, serving as the sole index representation for subsequent matching and retrieval.

    The code below is illustrative, intended to explain the data flow, and does not represent the official implementation:

    1. # C: 4 index cache vectors at the same position, shape [4, d]
    2. # gate: gating function outputting 4 scores; can be trained or heuristic
    3. scores = gate(C) # shape [4]
    4. w = softmax(scores) # 4 non-negative weights summing to 1
    5. v = (w[:, None] * C).sum(axis=0) # Merged result, shape [d]

    Public materials do not specify whether the weights are trainable or differentiable.

    3.3 The Cost of Compression

    Pooling inevitably loses information. After compressing four vectors into one, details suppressed by lower weights may affect retrieval. Therefore, it is necessary to compare the Top-k recall rate on long-context retrieval benchmarks before and after compression to ensure performance remains within an acceptable range.

    4. How to Estimate the Benefits

    4.1 Benefits Are Specific to the Indexer Cache

    The “75% cache reduction” refers solely to the indexer cache itself. It does not include the main KV cache, activations, or the recurrent state of linear attention. The end-to-end VRAM reduction must be recalculated based on the actual proportions of each component.

    4.2 A Hypothetical Example

    Assume the following conditions: a context of 1,048,576 tokens (~1M), a single-layer index vector dimension d of 128, 2 bytes per value (bf16), 4 caches saved per position, and calculations for a single layer only.

    • Indexer cache before compression: 1,048,576 × 128 × 2 × 4 = 1,073,741,824 bytes (~1 GiB).
    • Indexer cache after compression: 1,048,576 × 128 × 2 × 1 = 268,435,456 bytes (~256 MiB).
    • A single layer saves approximately 768 MiB. If each layer has an indexer cache, the savings will multiply by the number of layers.

    4.3 Theoretical Latency Upper Bound

    Assume that each decoding step requires a complete read of the indexer cache and that memory access is the bottleneck; thus, read time is proportional to the byte count. If the VRAM bandwidth is 2 TB/s:

    • Before compression, a single layer reads approximately 0.54 ms per step.
    • After compression, a single layer reads approximately 0.13 ms per step.
    • The theoretical saving per step for a single layer is about 0.4 ms.

    This is a theoretical upper bound that ignores computation, cache hits, and parallel overlap. Actual gains may be smaller and require empirical testing.

    4.4 Relationship with Other Optimizations

    IndexPool acts on the cache structure and is independent of methods like KV cache quantization and paged management; theoretically, they can be stacked. The actual effects of stacking still need to be measured individually.

    5. Pre-Deployment Verification Checklist

    1. Locate the bottleneck first. Use profiling to record the VRAM peak of the indexer cache, the bytes read per decoding step, and the Top-k recall latency. If these metrics account for a very small proportion of the total time, there is no need to modify the indexer.
    2. Evaluate recall quality. Use long-context retrieval benchmarks to compare recall rates before and after compression, and check whether end-to-end task metrics degrade.
    3. Coordinate the hybrid architecture. The granularity of the indexer cache and the timing of pooling should align with the state update rhythm of linear attention to avoid information duplication or misalignment between the two pathways.
    4. Grayscale latency comparison. Under real-world workloads (e.g., long-document Q&A, codebase tasks), compare P50 and P99 decoding latency, as well as VRAM peaks, before and after compression.

    6. Unconfirmed Information

    • The specific fields and dimensions of the four cache vectors.
    • The source of the weights (trained vs. heuristic) and whether they are differentiable.
    • Empirical data regarding retrieval loss.
    • The specific models, versions, and public sources applying this technology.

    There are claims that an open-source multimodal model with a total of 320B parameters uses this technology, but due to the lack of verifiable model names and sources, this figure is not adopted in this article.

    7. Summary

    IndexPool demonstrates that long-context optimization cannot solely focus on the main KV cache; the indexer’s auxiliary cache also grows with context. Weighted pooling merges the four index caches per position into one, reducing the indexer cache to a quarter of its size, at the cost of potential recall loss. Whether to adopt it depends on whether your bottleneck genuinely lies in the indexing pathway and whether the compressed recall passes your own benchmarks.