← Back to Leaderboard
Bzellige-ai

zellige-ai/basinkv

Sparse KV offload for long-context LLM serving with a fixed GPU working set

Engineering Health (Methodology)
B+ · 71/100
Maintenance Activity
● Updated today
Latest Release
v0.1.1
Commercial License Check
Custom / Check Repo

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption10/25
Release Cadence20/20
License Clarity6/20
Self-HostedGPUCLI
Total Stars
★ 177
24h Growth
+45
7d Growth
+45
Forks
13

GitHub Star History

Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.

zellige-ai/basinkv Star History (2026-11-30 - 2026-12-04) DAILY STAR HISTORY (5-DAY D1 TELEMETRY) +176 in 4d · avg +44/day 187 94 0 2026-11-30: ★ 12026-12-01: ★ 342026-12-02: ★ 1112026-12-03: ★ 1322026-12-04: ★ 177 ★ 177 11-30 12-02 12-04

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

BasinKV extends existing inference engines rather than replacing the serving stack. Its sparse decode path keeps a fixed GPU working set per full-attention head: attention-sink blocks, retrieved blocks, and a ring of recent tokens share static pages managed by src/oasiskv/pool.py. Full KV history is offloaded to pinned host RAM or NVMe. The selector scores evicted blocks on the GPU and prefetches selected blocks over PCIe while earlier layers compute. Static buffer shapes let the engine retain its stock FlashAttention or FlashInfer decode kernels and CUDA graphs on supported paths.

The implementation separates block selection (selector.py), the CUDA SphereIndex (sphere_index_cuda.py), host KV encoding (wht_int4_kv.py), and persistent prefix reuse (prefix_cache.py). Integration depth differs by engine: llama.cpp and SGLang use pinned wiring patches, whereas vLLM V1 loads an out-of-tree KVConnectorBase_V1 plugin for Mode 1 prefix caching. Mode 2 sparse decode is a separate path requiring three upstream hooks. The distribution is named basinkv, while v0.1 retains the oasiskv namespace in code and launch flags.

Key Capabilities & Differentiators

The model matrix covers dense GQA/MHA and selected recurrent or sliding-window attention hybrids. Verified paths include Qwen models and Gemma 4 E4B on llama.cpp and SGLang, and Granite 4.0 H Micro state caching on vLLM 0.34.0. vLLM Mode 1 can persist hybrid state alongside attention KV, preserving the recurrent state losslessly at exact token boundaries. Compatibility is engine-specific: Inkling 2 Mini is live-verified on llama.cpp, wired and kernel-tested on SGLang with caching off, and planned for vLLM. MLA models are rejected at initialization across all three engines.

The sparse path supports Quest selection, SphereIndex, and one-hop successor co-fetch for cues spanning block boundaries. In a BF16 Qwen3.8-27B partial-RoPE ablation, setting alpha to 0.25 raised per-step top-8 recall from 29.9% with unweighted Quest to 95.5% and recovered 5/5 128K RULER cases from 0/5. On an A100-80GB PCIe, llama.cpp decoded Qwen3.6-35B-A3B Q4_K_M at 256K at 141.12 tok/s versus 95.01 tok/s stock, with 22.4 GiB versus 31.5 GiB measured VRAM. These are results for specific model, engine, and hardware combinations, not general throughput or quality guarantees.

Trade-offs & Limitations

Stock dense attention avoids block selection and host transfers. Prefer it when KV already fits at the target concurrency and predictable latency or full-history attention matters more than VRAM savings. Native FP8 KV is an intermediate baseline where available: it reduces GPU residency without introducing sparse retrieval. BasinKV trades resident KV for GPU index memory, host capacity, and PCIe traffic. Prefetch can overlap with compute, but weights, index memory, and prefill allocations remain outside the fixed KV-page budget. In llama.cpp, hot slabs and indexes also scale with -np.

Start with Quest and INT8 host KV when retrieval quality matters most. Move to SphereIndex with WHT-INT4 when host RAM, NVMe capacity, or GPU index memory is the binding constraint, and retest quality on your workload. Dense models such as Qwen3-8B and Llama 3 can warrant 4,096 resident tokens instead of 2,048. Evaluate retrieval and task accuracy together with time to first token and tail latency under concurrency: passkeys and decode throughput alone do not establish production parity. The patched paths also carry an upgrade burden that the vLLM Mode 1 connector avoids, at the cost of not offering sparse decode.

Hardware & Deployment Guide

This is a self-hosted stack targeting Linux with Python 3.10 or later and CUDA-capable NVIDIA GPUs for the sparse serving paths. For llama.cpp, pin commit ca123ba76311290ec6ab041dd2058fed8d9f03d2, run integrations/llamacpp/apply_llamacpp_wiring.py, and build the CUDA targets with CMake. SGLang uses editable installs and integrations/sglang/apply_wiring.py against pinned commit a3f0bff5babfe18d3862e134449cd8fd11fcb84a; the sparse launch selects --attention-backend oasiskv and disables RadixCache. The supplied SWA hybrid preset also leaves prefix caching off and does not use MTP.

For unmodified vLLM V1, install basinkv or use an editable checkout, disable native prefix caching in the supplied setup, and pass OasisKVConnector through --kv-transfer-config. Start with explicit RAM and NVMe budgets and choose the KV encoding deliberately: the sample mixed-tier preset uses INT8, while the connector defaults to WHT-INT4. The package manifest identifies version 0.1.0 as Beta, and no GitHub release is listed. Treat the pinned checkouts and verified vLLM configurations as the starting point for upgrade testing rather than assuming compatibility with newer engine versions.

GPU residency: Static pages hold sink, retrieved, and recent KV; the default budget is 2,048 tokens per full-attention head.
Block index: SphereIndex uses a WHT-rotated INT4 centroid and separate RoPE and non-RoPE radii; metadata occupies 136 bytes per block at head dimension 256.
Host compression: WHT-INT4 stores each K or V vector in D/2 + 4 bytes, using 3.88× less space than BF16 at D = 256.
Boundary retrieval: One-hop successor score propagation lets the next block compete for a top-k slot when a cue crosses a block boundary.
Integration boundary: Sparse decode uses pinned patches for llama.cpp and SGLang; unmodified vLLM V1 exposes prefix caching through OasisKVConnector.
Measured concurrency: SGLang on one H100-80GB reached 470.4 tok/s versus 358.0 tok/s with stock FP8 KV for Qwen3.8-27B-FP8 at 16 × 64K, recovering 16/16 passkeys.
Best For

Self-hosted NVIDIA GPU long-context serving where dense KV exhausts VRAM, or vLLM V1 deployments that explicitly need RAM/NVMe prefix reuse without patching the engine.

Skip If

The model uses MLA, your workload requires exact full-history attention or stock KV already meets the target, or you need sparse decode but cannot maintain engine patches.

Reviewed on 2026-12-03 · Grounded in GitHub README, root file tree & releases · Newer release v0.1.1 (2026-12-03) shipped after this reviewMethodology

Quick Start & Installation

Self-HostedGPUCLI
pip install basinkv   # or `pip install -e .` from a checkout; registers the vLLM plugin entry point

# Qwen3-8B, RAM + NVMe tiered prefix cache (verified on vLLM 0.19.1)
vllm serve Qwen/Qwen3-8B --no-enable-prefix-caching --kv-transfer-config '{
  "kv_connector": "OasisKVConnector",
  "kv_role": "kv_both",
  "kv_connector_extra_config": {
    "cache_mode": "mixed", "pcie_quant": "int8",
    "prefix_cache_dir": "/tmp/basinkv_cache",
    "prefix_cache_ram_gb": 4.0, "prefix_cache_nvme_gb": 32.0
  }
}'

# Gemma 4 / Gemma 3 multi-group SWA + full attention (SupportsHMA, verified on vLLM 0.34.0)
vllm serve google/gemma-4-26B-A4B-it --no-enable-prefix-caching --kv-transfer-config '{
  "kv_connector": "OasisKVConnector",
  "kv_role": "kv_both",
  "kv_connector_extra_config": {
    "cache_mode": "nvme", "pcie_quant": "wht_int4",
    "prefix_cache_dir": "/tmp/basinkv_cache_gemma4", "prefix_cache_

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
basinkv ★177+45Python—Sparse KV offload for long-context LLM serving with a fixed GPU working set
DeepInfer27.7k+1.3kPythonApache-2.0An accelerator-tuned offline inference engine for DeepSeek-V4.1-Flash
vllm98.2k+435PythonApache-2.0Paged-KV inference engine for high-throughput, self-hosted LLM serving
sglang39.4k+237PythonApache-2.0Self-hosted inference runtime for serving LLMs and multimodal models across acce

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/zellige-ai/basinkv.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

zellige-ai/basinkv Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about basinkv

Does installing the vLLM connector enable sparse decode?

No. OasisKVConnector in Mode 1 adds RAM/NVMe prefix caching to unmodified vLLM V1. It reuses previously computed state but does not enable fixed-working-set sparse decode. For that, vLLM Mode 2 needs three upstream hooks; the patched llama.cpp and SGLang integrations are the more direct paths.

What should I size beyond the resident GPU KV window?

The default 2,048-token window caps resident KV pages per full-attention head, not total VRAM. Budget separately for weights, the block index, prefill buffers, and concurrent sequences, plus host RAM for the offloaded history and PCIe bandwidth for retrieval. For example, the 256K Qwen3.6-35B-A3B Q4_K_M run on a 24 GB L4 used 84.8 MiB for GPU KV plus index but peaked at 21.4 GiB overall.

What should a commercial self-hosting review cover?

The package manifest declares Apache-2.0. Review the LICENSE file and applicable notice obligations before redistribution, and check the upstream engine and model-weight terms separately. For self-hosted deployments, treat persisted prefix caches as data derived from prompts and set access and retention policies accordingly.

When is stock dense or reduced-precision KV the better choice?

Start with stock engine settings. If dense KV or native reduced-precision KV meets your context, concurrency, and latency targets, it avoids sparse block selection, PCIe fetches, and patch maintenance. If GPU KV is the binding constraint, compare BasinKV's Quest + INT8 preset against that baseline using your own long-context quality tests and tail-latency measurements.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining zellige-ai/basinkv? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature zellige-ai/basinkv on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare