NeurIPS 2026QuestionsPapersAreasAboutMarkdown

CommunityKV: Efficient Long-Context Decoding via Graph Partitioning

Joe McKenna, Anastasios Alexandridis, Nathan Susanj, Jing Liu

NeurIPS page · Open on the map

Category: Efficient LLM Inference & Training › Sparse Long-Context Attention · Type: new method · Keywords: long-context decoding, sparse attention, community detection, key-value cache, Transformer efficiency

Areas: Memory › Model Memory Optimization › KV Cache Optimization; Long Context › Long-context mechanisms › Efficient long-context attention; Model Architectures & Sequence Modeling › Language Model Architectures › Sparse Attention

Summary

CommunityKV formulates sparse attention as a community detection problem, enabling efficient long-context decoding with higher throughput than exact attention.

Explained to a 5-year-old

CommunityKV is a trick that helps computers read long stories faster. It makes the computer only look at the most important parts of the story instead of everything. It groups similar words together and remembers them in a smart way. When the computer writes more words, it quickly adds them to the right group. This helps the computer finish the story quicker without using a lot of memory.

Explained to a 5-year-old, longer

CommunityKV is a new idea that makes computers read very long texts more quickly. Regular computers look at every word when they pay attention, which takes a lot of time and memory. CommunityKV only looks at the words that are most useful, like a shortcut. It builds a picture of how words are related by looking at scores from the computer’s memory. This picture is called a token graph, and it shows which words belong together. The computer then splits this picture into groups, or communities, of similar words. By using these groups, the computer can retrieve the right words fast without checking everything. When the computer writes a new word, it uses a simple rule to put the word into the correct community instantly. This rule works in constant time, meaning it does not need to redo the whole picture each time. Because the groups stay stable, the computer does not have to rebuild them during decoding. This makes the decoding process faster and uses less memory than the usual method. As a result, long documents can be processed more efficiently, helping applications like reading long articles or books.

For a technical reader

CommunityKV addresses the quadratic memory and compute cost of self-attention in long-context Transformers by replacing full attention with a sparse retrieval scheme. It builds a token graph from the QKT scores already computed during pre-fill, partitions the graph into semantically coherent communities, and uses a constant-time local update rule to assign newly generated tokens to these communities during streaming decoding. This design eliminates the need for global re-partitioning, enabling efficient updates without additional training. Evaluations on open-weight models show up to 1.86× higher decoding throughput than exact FlashAttention-2 while maintaining accuracy. The framework is training-free and can be dropped into existing Transformer pipelines to improve latency and memory usage for long-document tasks.

Problem

Scaling Transformers to long contexts suffers from quadratic self-attention cost and growing key-value cache memory transfer, making efficient decoding challenging. Existing sparse attention methods either need large-scale training or use coarse heuristics that are hard to update during streaming decoding.

Method

The approach builds a token graph from QKT scores computed during prefill, partitions it into communities to retrieve coherent token groups, and uses a local update rule to assign new tokens to communities in constant time, enabling sparse retrieval without global re-partitioning.

Results

The approach achieves up to 1.86× higher decoding throughput than exact FlashAttention-2 with negligible accuracy degradation on open weight models and long context benchmarks.

Contributions

It introduces a training-free framework that formulates sparse attention as a community detection problem, constructs token graphs from existing scores, and provides a constant-time local update rule for streaming decoding.

Practical relevance

This enables practitioners to decode long sequences more efficiently on existing hardware, reducing memory bandwidth and improving throughput for applications such as long-document understanding and retrieval.

Research questions this paper is counted under

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction