Multi-layer Indexer: Overlapping Selection and Attention in DeepSeek Sparse Attention

Serdarcan Dilbaz, Arjun Krishna, Kiran Kamble, Daniel M. Bikel

arXiv:2611.03768 · 2026-11-08 공개 · arXiv · PDF

long-context sparse-attention sliding-window deepseek-v32 glm-5 attention-matrix indexer mli

Abstract

Sparse attention cuts the cost of long-context inference by making the attention matrix sparse: each query attends only a subset of the sequence, chosen by a fixed pattern or, in recent production LLMs, learned per query. In DeepSeek Sparse Attention (DSA), the attention of DeepSeek-V3.2 and the GLM-5 family, every layer is preceded by a lightning indexer that scores the whole cache and keeps the k=2048 highest-scoring tokens for the layer to attend. At long context this indexer scan, not the sparse attention it feeds, is where the decode time goes. But adjacent layers select nearly the same tokens, so a layer can attend the selection of the previous indexer layer instead of its own. This removes the dependency: each indexer then runs concurrently with the attention of its layer. The resulting Multi-layer Indexer (MLI) needs no retraining and no new weights. Its default realization changes no kernel, running inside SGLang's production decode graph; an optional fused decode kernel accelerates it further on DeepSeek-V3.2. MLI composes with IndexCache (the cross-layer reuse GLM-5.2 ships as IndexShare): IndexCache drops the indexer from some layers, and MLI hides the scan on the rest. We serve DeepSeek-V3.2 and GLM-5 under IndexCache's protocol at retentions 1/2 to 1/32 (the fraction of layers that keep an indexer) and contexts 10K to 195K. At equal retention the composition decodes faster than IndexCache: up to 14.5% faster on DeepSeek-V3.2 and 9.8% on GLM-5 at 1/2, and 7.9% and 5.1% at 1/4, largest where IndexCache keeps the most indexers and growing with context. At retention 1/r it is faster still than IndexCache at 1/(2r) while keeping twice the fresh selections: at 128K it reaches 1.32x the unmodified model's decode throughput at 1/4, above IndexCache's 1.28x at 1/8. Its LongBench, RULER and LongBench v2 accuracy stays within a few percentage points of IndexCache's.

한국어 요약

한 줄 요약

DeepSeek-V3.2와 GLM-5 모델에서 인덱서와 어텐션의 실행 순서를 중첩시켜 14.5%까지 추론 속도를 향상시키는 Multi-layer Indexer(MLI)를 제안한다.

핵심 기여도

핵심 아이디어

기존 DeepSeek Sparse Attention(DSA)은 각 어텐션 레이어 앞에 인덱서를 두고, 캐시 내 토큰 중 상위 2048개를 선택하여 어텐션에 전달한다. 그러나 이 인덱서 스캔이 추론 시간의 대부분을 차지한다. 인접 레이어가 거의 동일한 토큰을 선택한다는 사실을 기반으로, MLI는 이전 레이어의 인덱서 선택 결과를 그대로 사용하여, 인덱서 스캔과 어텐션을 병렬 실행한다. 이는 인덱서와 어텐션 간의 의존성을 제거하고, 인덱서 스캔을 숨길 수 있다. MLI는 IndexCache와 결합하여, 인덱서를 유지하는 레이어 수를 줄이면서도 더 많은 토큰을 선택할 수 있게 한다. 이는 "1/r retention"에서 IndexCache의 "1/(2r)"보다 빠르게 동작하면서도 2배 더 많은 선택을 유지한다.

기술적 접근법

주요 결과

의의 및 한계

MLI는 기존 DSA 모델에 추가적인 학습 없이 적용 가능한 방식으로, 인덱서 스캔이라는 병목을 제거함으로써 추론 속도를 향상시킨다. 특히, IndexCache와의 결합을 통해 인덱서 유지 비율을 절반으로 줄이면서도 더 많은 선택을 유지할 수 있어, 장기 컨텍스트 처리에서 유리하다. 다만, MLI는 인덱서 선택이 이전 레이어의 결과를 사용하므로, 선택의 "staleness"가 발생할 수 있다. 그러나 이는 정확도에 미미한 영향을 미치며, 인덱서만 재학습하면 회복 가능하다는 점에서 실용적 가치가 있다. 한계로는 GLM-5에 퓨즈 커널이 적용되지 않아 성능 향상이 제한된다.

실용적 활용

MLI는 DeepSeek-V3.2와 GLM-5 모델에서 장기 컨텍스트 추론을 효율적으로 수행할 수 있는 방식으로, 대규모 언어 모델의 배치 처리 및 실시간 응답 시스템에 적용 가능하다. 특히, 인덱서 스캔을 숨기면서도 정확도를 유지하는 점에서, 고성능 추론 서버나 클라우드 기반 언어 모델 서비스에 유용하게 활용될 수 있다.