r/LocalLLaMA • u/ghgi_ • 5h ago
Showcase BasinKV: Long context without the KV cache tax, No context slowdowns, drop-in RAM/NVMe KV offloading for llama.cpp, SGLang, and vLLM, no retraining, Supports models today.
Hello LocalLLaMA! Zellige AI team here to showcase and open-source our latest work:
BasinKV: a cross-engine system that runs 256K context on a 24 GB GPU, with no decode slowdown as context grows (And much more! Keep reading below.)
In the middle of the memory crunch, if you run long-context models locally, you know the pain. You end up running your favorite models heavily quantized, not because the weights don't fit, but because you want long agent sessions plus the weights. And the deeper the context gets, the slower every token becomes, because each step reads the entire KV cache. Eventually you just run out of memory or have to downsize.
BasinKV keeps only a small, fixed working set of the KV cache on the GPU (2,048 tokens by default) and stores the full history in host RAM or NVMe. A tiny GPU index works out which blocks matter next and prefetches them in the background. Your attention kernels and CUDA graphs stay completely stock.
It works with llama.cpp, SGLang, and vLLM V1, and builds on the OasisKV lookahead-prefetch work by Xiao et al. (arXiv:2608.08097), extended for newer models like the Qwen3.x hybrids.
Results (A100 80GB, Q4_K_M, llama.cpp)
- Qwen3.6-35B-A3B @ 256K: 141 tok/s vs 95 stock (1.49x), using ~8.9 GiB less VRAM
- Qwen3-8B @ 128K: 124 tok/s vs 54 stock (2.29x)
- Qwen3.8-27B @ 128K: 50 tok/s vs 41 stock (1.22x)
We also ran Qwen3.6-35B-A3B at full 256K context on a single 24 GB NVIDIA L4 (84.8 MiB GPU KV+index with WHT-INT4 + SphereIndex). Decode stays basically flat, going from 69.9 tok/s on an empty context to 67.1 tok/s at 256K, and it passes passkey tests at 64K and 203K. Stock F16 KV runs out of memory starting at 64K.
Quality holds up:
- 18/18 on multi-turn long-context coding
- Even with stock on RepoPatch-LC (7/10 each)
- Slightly ahead on 240K retrieval (96.2% vs 94.5%) and a LongBench v2 subset (45.0% vs 42.5%, within noise)
- "Vibes" tests hold up too: Qwen3.8-27B on the same set of real-world tasks did within margin of error, while staying faster since it never got hit with long-context slowdowns.
Does this mean it's perfect? No. We discuss the tradeoffs in our paper.
A couple of notes
- It isn't always the best choice: stock is still faster on one of our HBM tests (about 20%) when the full context fits in HBM. There is nuance to this, but in general BasinKV pays off when memory is the bottleneck or when you need deep context and/or large concurrency.
- Deep pure-attention models like Qwen3-8B do better with a bigger window (4,096).
- Tasks that count things scattered across the whole context, like RULER
cwe, suffer at very small windows. We find this nearly inconsequential for the average agent workload (our "vibes" tests pass), though we can't say it's unnoticeable for every workload.
But... does it scale?
While we've mostly framed this for local rigs here, it goes far beyond single-GPU setups.
Serving multiple users? The SGLang integration reaches 581 tok/s aggregate across 16 concurrent 64K sessions (over 1M active tokens) on one A100 serving BF16 Qwen3.8-27B with native MTP (and 470 tok/s no-MTP on H100 FP8, 2.03x shorter batch wall time than stock FP8 KV). There's also a zero-fork vLLM V1 plugin for persistent RAM/NVMe prefix caches.
More details in our write-up, and happy to answer questions here. We've been very busy at Zellige AI, so stay tuned if you're interested in our upcoming release working with thinkingmachines inkling-2-mini.
Code: https://github.com/zellige-ai/basinkv Write-up: https://zellige.ai/research/basinkv-launch
For the nerds: Full Paper: https://zellige.ai/research/basinkv




11
u/YearnMar10 4h ago
But does it work with Strata?
Edit: nice idea btw and great work (if it works!)
5
u/Additional-Point-824 4h ago
Does this also work on AMD cards? (ROCm or Vulkan)
3
u/BS_BlackScout 2h ago
Is there a minimum VRAM requirement (24GB) or have I misunderstood the post?
2
u/aelma_z 3h ago
Wow. This gives some hope on multi-user serving with RAM kv offload? Or did i misunderstood the tech ?
2
u/thesolewalker 3h ago
Is this cuda only or can be possible to port to vulkan/rocm? Asking on behalf of gpu poor AMD users.
18
u/True_Requirement_891 5h ago
This is some cool work, finally I can do more than 16k CTX with Bonsai-2.5-27b on my 8gb 3070ti
8
u/caetydid llama.cpp 4h ago
This is highly appreciated! Looking forward for it to mature and land in llama.cpp / strata and the likes.
1
u/randygeneric 2h ago
is this somehow similar to omlx's tier-2 kv-caching (ssd)?
i was on the border to fork llama-server for that, because the maintainer rejects the idea (won't happen).
1
u/RangersStolen 32m ago
So, any model? Gemma4 31b included? Because that would be fantastic.
1
u/Erulogos 24m ago
Is this a Qwen specific enhancement, or will it work for other models as well?
2
u/Rorp24 1h ago
Really cool idea on paper, but what is the catch ? Can we have the benchmark on accuracy, prefill speed and decode speed ?
1
u/nymical23 4h ago
Thank you for your work.
Will it work for EXL3 (exllamav3) quants via TabbyAPI?
1
u/selfCodingDude 4h ago
Bro WTF this is insane!
1
u/chimpera 2h ago
How would this perform at 2x 524k on 27b.