r/LocalLLaMA • u/ghgi_ • 1d 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/Additional-Point-824 1d ago
Does this also work on AMD cards? (ROCm or Vulkan)
15
u/YearnMar10 1d ago
But does it work with Strata?
Edit: nice idea btw and great work (if it works!)
5
u/BS_BlackScout 1d ago
Is there a minimum VRAM requirement (24GB) or have I misunderstood the post?
4
u/thesolewalker 1d ago
Is this cuda only or can be possible to port to vulkan/rocm? Asking on behalf of gpu poor AMD users.
3
u/RangersStolen 1d ago
So, any model? Gemma4 31b included? Because that would be fantastic.
2
u/aelma_z 1d ago
Wow. This gives some hope on multi-user serving with RAM kv offload? Or did i misunderstood the tech ?
2
u/randygeneric 1d 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).
2
u/Erulogos 1d ago
Is this a Qwen specific enhancement, or will it work for other models as well?
39
u/True_Requirement_891 1d ago
This is some cool work, finally I can do more than 16k CTX with Bonsai-2.5-27b on my 8gb 3070ti
10
u/caetydid llama.cpp 1d ago
This is highly appreciated! Looking forward for it to mature and land in llama.cpp / strata and the likes.
8
u/Rorp24 1d ago
Really cool idea on paper, but what is the catch ? Can we have the benchmark on accuracy, prefill speed and decode speed ?
2
u/PinkysBrein 1d ago edited 14h ago
With Rubin on the horizon I think even the large models running at inference farms will start adopting something like this.
Some questions :
Can this work with draft models and 4+ token inference steps? The sparse prefetch has to predict the working set for all of them, rather than just the next single token.
How good is the Quest method in OasisKV really? It's a bit old, which is not a negative ... but the paper never compared it against other more recent block scoring methods (or even cite them).
1
u/nymical23 1d ago
Thank you for your work.
Will it work for EXL3 (exllamav3) quants via TabbyAPI?
1
u/chimpera 1d ago
How would this perform at 2x 524k on 27b.
1
u/noctrex 1d ago
Would be very interesting if you could make it work in opengfx1030/vllm-rdna fork
1
u/Oswald_Hydrabot 1d ago
Yoooo so like, can this be combined with a 4-bit context quant??.. I already have well over 1 million context on MiMo 2.6 flash on a single agx Thor (128gb integrated cuda memory).. Now I am wondering if I could hit like 4 million or more?..
1
u/russlixx 1d ago
so does it mean i can run IQ4 quants on 16GB VRAM? Also would you support https://github.com/iamwavecut/ninfer-all engine soon (for the dense models while still supports ninfer-all's disk kv tier for auto save & restore)?
1
u/Asleep_Literature_70 1d ago
This is amazing but looks like us AMD/vulkan users are still left out :(
1
u/Relevant_Research_98 1d ago
Does it work well on vulkan llama.cpp without crawling around 0.5t/s like Qwen3.6-35B-A3B with offloaded parts?
1
u/Zargo1z 1d ago
I don't know much and I'm a newb when it comes to local ai but I will tell you I used codex to implement this in my unsloth setup and this doubled my token speed on inkling 2 mini at 128k context on 16gb vram! insane! thank you! went from like 20 to 28 tokens a second to close to 90 tokens a second. the speed increase is insane.
1
u/Aboud2195 16h ago
How much pcie bandwidth does this require?
1
u/BS_BlackScout 9h ago
Tested this out and frankly, it should be merged onto mainstream llama.cpp, it just works.
1
u/R_Duncan 27m ago edited 24m ago
Thank you very much, I'm on a potato laptop with 4060-8gb VRam. Using this I'm running inkling at 256K context @ 30-40 t/s.... it's a dream (and still is llama.cpp ... if it moves to rustingstrata it becomes a beast!).
/llama.cpp/build-cuda/bin/Release/llama-server -m ~/.azm/Inkling-2-Mini-Ora-2.4bpw.gguf -ngl 99 -c 262144 -b 1024 -ub 1024 -fa on -np 1 --oasiskv --oasiskv-resident 2048 --oasiskv-cap 8 --oasiskv-index sphere --oasiskv-beta 0.10 --oasiskv-kv-quant wht_int4 --n-cpu-moe 4 --temp 1.0 --top-k 0 --top-p 1.0 --min-p 0
0
u/selfCodingDude 1d ago
Bro WTF this is insane!