Long-Context Modeling with Dynamic Hierarchical Sparse Attention for Memory-Constrained LLM Inference
Abstract
Lay Summary
Large language models can now process long documents, conversations, and code files, but doing so requires a large amount of computation and memory. This makes long-context use difficult on limited hardware, such as a single consumer GPU or smaller deployment environments. Our work introduces Dynamic Hierarchical Sparse Attention (DHSA), a method that helps a language model focus on the most relevant parts of a long input instead of processing every possible token interaction. The method first divides the input into meaningful chunks, then identifies which chunks and tokens are most important for the current computation. This allows the model to skip many less useful computations while keeping the original language model unchanged. Across several long-context benchmarks, DHSA keeps accuracy close to full attention while substantially reducing the cost of processing long inputs. It can handle much longer contexts under the same memory limits, including 100K-token inputs on a single 24GB GPU where standard full attention runs out of memory. These results suggest that DHSA can make long-context language models more practical and efficient for real-world applications.