BasinKV keeps 2,048 tokens of KV cache on the GPU and fetches the rest while the layers run
A serving layer for llama.cpp, SGLang and vLLM that moves long-context KV cache to RAM or NVMe. Its README reports 256K context on a 24 GB card.
Long prompts fill GPU memory with KV cache, the stored attention state that grows with every token of context. BasinKV, released on December 1 by Zellige, keeps only a small fixed slice of that cache on the GPU and parks the rest in host RAM or on NVMe. It plugs into llama.cpp, SGLang and vLLM V1. The README describes it as an implementation and extension of the OasisKV lookahead-prefetch design by Can Xiao, Sukmin Cho and colleagues.
How it works
Each full-attention head gets a fixed working set on the GPU, 2,048 tokens by default. That set holds a few always-kept “sink” tokens, a local ring of recent tokens, and blocks retrieved from further back. The full history lives off the GPU.
The question is which old blocks to bring back. Evicted blocks are scored on the GPU using a compact index, and the ones that look relevant are fetched over PCIe asynchronously while the model’s layers are still computing. A “one-hop successor” rule also fetches the block after each retrieved one, to catch content that straddles a block boundary.
The detail we liked is about shapes. Because the GPU buffers never change size, the README says unmodified FlashAttention and FlashInfer kernels and whole-model CUDA graphs keep working. There is no custom attention kernel to maintain. The host copy is compressed, with a 4-bit format the README puts at about 1.97 times smaller than 8-bit.
The numbers
All figures are the project’s own. On an L4 with 24 GB, stock llama.cpp running Qwen3.6-35B-A3B at Q4_K_M ran out of memory from 64K tokens of context. With BasinKV the README reports the same model at 256K producing 67.12 tokens per second, with 84.8 MiB of GPU memory spent on cache and index.
On an A100 the same model at 256K went from 95.01 to 141.12 tokens per second, and passed 18 of 18 coding checks with 96.2 percent retrieval at 240K. Gains elsewhere are smaller: 1.17 to 1.26 times on two Gemma 4 models, and 1.08 times on Inkling 2 Mini at 64K.
It is not free. Qwen3-8B at 128K needed the window raised to 4,096 tokens and still scored 16 of 18 on coding. Models that use MLA attention, including DeepSeek-V3 and Kimi K2, are rejected outright on all three engines. Several hybrid-attention combinations are listed as planned.
One more thing from the commit log. A launch-day commit says it tightened the README and removed a section titled “Where Stock Still Wins”. We would have liked to read that section.
Try it yourself
The repo is Apache-2.0 and installs with pip install -e .. You need an NVIDIA GPU with CUDA; the README’s tests ran on L4, A100 and H100 cards. The llama.cpp and SGLang integrations are pinned to specific upstream commits, and llama.cpp needs a wiring patch.
We have not run it. This is based on the README and the commit log, which had 12 commits by December 2.