microsoft/vattention

Dynamic Memory Management for Serving LLMs without PagedAttention

What it solves

vAttention addresses the memory management challenges of the KV-cache in LLM serving systems. Specifically, it solves the problem of needing to rewrite custom attention kernels to support dynamic memory allocation (as required by PagedAttention) and improves performance for prefill-bound workloads.

How it works

vAttention decouples the allocation of virtual memory from physical memory using CUDA virtual memory APIs. This allows the system to allocate physical memory on demand while keeping the KV-cache contiguous in virtual memory. Because the memory appears contiguous, it can be used by unmodified attention kernels without requiring the complex user-space demand paging implemented in other systems.

Who it’s for

It is designed for developers of LLM serving systems and researchers focusing on inference optimization and memory management on NVIDIA GPUs.

Highlights

  • Kernel Compatibility: Supports dynamic memory allocation for unmodified attention kernels.
  • Virtual Memory Decoupling: Uses CUDA virtual memory APIs to separate virtual and physical memory allocation.
  • Performance: Offers performance improvements over PagedAttention, particularly for prefill-bound workloads.
  • Integration: Integrated with Sarathi-Serve and supports backends like FlashAttention and FlashInfer.
  • Custom Driver Support: Includes a modified NVIDIA UVM driver to enable smaller page sizes (64KB to 256KB) beyond the default 2MB.

Related

  • Project
  • Project
  • Project
  • Project
  • Dispatch