IndexShare: could neighbouring layers reuse the search?
An indexer has already found candidate positions. Discover what another layer can reuse, what it must recompute, and when the selection needs refreshing.
A lightning indexer makes attention cheaper by choosing which earlier positions to read. But it still has to score the available history to make that choice. Repeat the search in every layer, and that preparation becomes a significant part of the work.
The next layer searches again
Each layer receives a changed representation, so its best positions can differ. Running another indexer gives that layer a fresh choice. It also repeats the scan over the history.
The diagrams use GLM-5.2 / GLM-5.3. Its MLA cache stores 512 latent coordinates plus 64 rotary-key coordinates per position, separately for each layer:
Both layers might decide to read many of the same positions. Could we save the second search while still letting the second layer ask its own question?
Reuse the addresses, read different contents
The reusable result is a list of selected positions. Pass that list to the next layer and let it gather its own cached representations at those addresses.
The next layer still computes its own query, attention scores and collected result. Its stored keys and values can be different, even at the same positions. Reusing the search therefore leaves useful work for that layer to do:
This is different from sharing K/V caches across layers. Here, we share where to look. Each layer retains its own attention representations and decides how strongly to use the supplied candidates.
That distinction matters for the saving too. We remove an indexer scan from a reusing layer. We do not remove that layer’s attention calculation, its main cache or the work of fetching its selected entries.
Refresh the choice before it becomes stale
A selection made earlier cannot anticipate every later query. If it leaves out a useful position, changing attention weights among the retained candidates cannot bring that position back.
We could therefore train a short group of layers to use one choice, then run a fresh indexer for the next group. The compromise is between the cost of searching again and the freedom to choose different candidates.
The worked GLM-5.2 / GLM-5.3 model uses IndexShare. Its indexer has 32 heads with 128-coordinate keys, and chooses up to 2,048 positions. A typical four-layer group computes a selection in its first layer and reuses it in the next three:
Across the 78-layer model, 21 layers run an indexer and 57 reuse a selection. That is 21 full indexer scans rather than 78 for each token, while all 78 attention layers still perform their reads. The diagram shows layers 7–10, one group in that configured schedule; the opening dense layers have their own selections.
Sharing is part of the model’s design and training. Turning off indexers in an arbitrary existing model would change which information its layers can access.
The same question appears in CSA: choosing useful summaries has a cost of its own. Models can spend that cost at different depths. Streaming scores and choosing coarse blocks before individual tokens tackle other parts of the search; they do not need to be folded into this mechanism.
Sources and worked example
- GLM-5 model architecture and checkpoint sources.
- GLM-5.2 checkpoint and GLM-5.3 checkpoint: IndexShare schedules.
- GLM DSA configuration: full/shared indexer modes and their layer schedule.
- GLM DSA implementation: shared layers consume earlier top-k indices while preparing their own queries and main attention cache.
The picker is restricted to the GLM-5.2 / 5.3 profile. GLM-5 and GLM-5.3-Flash do not use this same sharing schedule. The drawn columns sample a much longer history; their highlighted positions are an illustrative selection. The per-layer MLA cache label counts 512 latent coordinates plus 64 rotary-key coordinates. Selected positions are shared within a token’s layer traversal, not fixed for the next generated token.