MInference
FreeTo speed up Long-context LLMs' inference, approximate and dynamic sparse calculate the attention, which reduces inference latency by up to 10x for pre-filling on an A100 while maintaining accuracy.
About MInference
MInference is an open-source library by Microsoft for accelerating long-context LLM inference. It leverages the dynamic sparse nature of LLMs' attention, which exhibits static patterns per head, to speed up the pre-filling stage. The method first determines offline which sparse pattern each attention head belongs to, then approximates the sparse index online and dynamically computes attention using optimized custom kernels. This approach achieves up to a 10x speedup for pre-filling on an A100 GPU while maintaining accuracy. It supports million-token prompts and works with long-context LLMs such as LLaMA-3-8B-1M and GLM-4-1M. MInference has been integrated into frameworks like SGLang and vLLM. The project also includes SCBench for KV cache-centric evaluation and MMInference for multi-modal long-context VLMs. MInference was accepted as a NeurIPS'24 Spotlight, ICLR'25, and ICML'25.
Key Features
Pros & Cons
- Up to 10x speedup on A100 while preserving accuracy
- Open source with clear documentation and examples
- Integrates with popular LLM serving frameworks (vLLM, SGLang)
- Validated by acceptance at top ML conferences (NeurIPS, ICLR, ICML)
- Supports very long contexts (million tokens) on a single GPU
- Speedup primarily targets pre-filling stage; decode stage benefit may vary
- Requires offline profiling to determine sparse patterns for each model
- Optimized for specific GPU architectures (e.g., A100)