An open-source project has been developed to implement Sliding Window Attention (SWA) for Hugging Face Large Language Models, aiming to reduce KV-cache memory costs during long-context inference. The implementation includes features like attention sink tokens, a bounded recent-token window, and a circular buffer for the KV cache. Initial experiments with Qwen2.5-7B show significant memory savings, reducing KV cache size from 1.84 GB for full attention to approximately 3.5 MB with SWA, while maintaining decode latency and enabling inference at contexts that would otherwise cause out-of-memory errors. The project seeks feedback on the engineering trade-offs and compatibility with various LLM architectures. AI
IMPACT Reduces KV cache memory costs for long-context LLM inference, potentially enabling larger models or longer contexts on consumer hardware.
RANK_REASON This is an open-source implementation of an attention mechanism for existing LLMs, not a new model release or core research paper.
AI-generated summary · Google Gemini · from 1 sources. How we write summaries →