BasinKV cuts long-context VRAM use with sparse offloading
Zellige AI released BasinKV, an open-source tool that offloads KV cache to RAM or NVMe for llama.cpp, SGLang, and vLLM without retraining.
Zellige AI has released BasinKV, an open-source implementation of the OasisKV architecture designed to optimize long-context inference for large language models. Published on November 30, 2026, this drop-in solution enables sparse key-value (KV) cache offloading to host RAM or NVMe storage for popular engines like llama.cpp, SGLang, and vLLM.
What happened
Long-context serving typically hits a memory wall because the KV cache grows linearly with sequence length. This forces standard engines to either run out of memory (OOM) or serialize batches while reading gigabytes of cold history for every decoded token. BasinKV addresses this by keeping only a fixed-size working set of KV blocks in GPU memory while offloading the rest.
The system maintains a resident buffer of 2,048 tokens per full-attention head by default. It scores evicted blocks on the GPU using methods like Shrunk-Box Quest INT8 or SphereIndex, then prefetches newly needed blocks asynchronously over PCIe Unified Virtual Addressing (UVA). This design allows FlashAttention, FlashInfer, and full-model CUDA graphs to run unmodified because the resident GPU buffer retains a static shape.
Benchmarks show significant improvements in concurrency and throughput. On an NVIDIA L4 with 24 GB of memory, stock llama.cpp hits CUDA OOM at 64K context lengths for certain models. BasinKV keeps the entire 256K GPU KV cache plus index in just 84.75 MiB, maintaining flat decode throughput from 69.86 tokens per second at zero depth to 67.12 tokens per second at 256K context.
How it works
BasinKV relies on five technical mechanisms to balance speed and memory efficiency. First, it uses a partial-RoPE radius weight with an alpha value of 0.25. This adjustment prevents non-rotary dimensions from drowning out dot-product signals, raising Top-8 recall from 82.5% to 95.5% compared to previous defaults.
Second, it employs SphereIndex for block scoring. Instead of storing per-block BF16 min/max bounds, it rotates the block centroid with a randomized Walsh-Hadamard transform and quantizes it to symmetric INT4. This reduces index memory usage by 7.53x while improving salient-event recall. Third, offloaded K and V vectors are Hadamard-rotated and quantized to symmetric 4-bit WHT-INT4, which cuts host RAM and NVMe footprint in half relative to INT8 with minimal speed loss.
Finally, the system includes engine plumbing that respects CUDA graphs through static fixed-shape GPU slabs and lazy host slab allocation. It also features a best-effort one-hop successor co-fetch for induction heads, which promotes boundary-straddling token pairs to prevent logit failures when cues span block boundaries.
Key details
- BasinKV is compatible with llama.cpp, SGLang, and vLLM V1 without requiring model retraining or new weights.
- On an A100-80GB PCIe, BasinKV achieved 141.12 tokens per second at 256K context, a 1.49x improvement over the stock baseline of 95.01 tokens per second.
- The system supports multiple compression tiers, including INT8, uncompressed BF16, and rotated 4-bit WHT-INT4 for maximum compression.
- In SGLang on an H100, BasinKV reduced batch wall time by half compared to stock FP8 KV, achieving 470.4 tokens per second.
- The vLLM V1 plugin persists rotated 4-bit prefix caches to RAM or NVMe, cutting on-disk snapshots by 1.94x.
- Quality checks showed 100% retrieval on 64K to 128K RULER benchmarks and 18/18 success on iterative coding tasks.
Why it matters
For engineers building products with AI, memory constraints often limit the practical context window of deployed models. BasinKV decouples context length from GPU memory capacity, allowing teams to serve longer contexts on existing hardware. This is particularly valuable for local workstations or datacenter GPUs where adding more VRAM is not feasible.
The ability to maintain flat decode throughput as context grows means more predictable latency for end users. Additionally, the support for unmodified attention kernels ensures that teams can integrate these optimizations without rewriting their core inference pipelines or sacrificing the performance benefits of CUDA graphs.
What you can do
- Clone the BasinKV repository from GitHub to access the open-source code and integration scripts.
- Test the llama.cpp integration by applying the wiring script and building with CUDA support enabled.
- Configure SGLang with the provided JSON config to enable OasisKV attention backend and speculative decoding.
- Deploy the zero-fork vLLM V1 plugin to persist prefix caches across process restarts using RAM or NVMe.
- Adjust the alpha parameter to 0.25 for hybrid models to improve Top-8 recall and retrieval accuracy.
- Use WHT-INT4 quantization when host RAM or NVMe footprint is the primary constraint for your deployment.



