RFC: Integrating KVMem virtual working set for 256K context on 16GB VRAM (Working prototype ready in fork)
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 8/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- cpp
調査の方向性
This is an RFC, not a scoped task: it asks the maintainer to choose between upstreaming a ~36K LOC KVMem working-set engine and keeping it as a downstream fork, and the 27-comment thread is where that decision is being made. To follow it, read the fork branch beellama-kvmem and the referenced ggml-cuda/gated_delta_net.cu Blackwell fix, then the thread for the maintainer's answer. Done means an architectural decision plus, at most, a targeted PR such as the GDN CUDA fix; nothing here is a first contribution.
索引モデルが issue の本文から書いたものです。
説明
RFC: Integrating KVMem virtual working set for 256K context on 16GB VRAM (Working prototype ready in fork)
Context & Motivation
Large context windows (128K–256K) on 27B+ models like Qwen3.8-27B (and hybrid architectures with Gated Delta Net) are traditionally difficult to run on consumer hardware (16GB VRAM cards like RTX 4080 / RTX 5060 Ti).
While BeeLlama's native KVarN (and SWA) provides substantial cache savings (~2.67x with kvarn6), pushing beyond 100K–128K on 16GB VRAM still pushes right up against physical memory limits.
We have successfully integrated the KVMem virtual working set engine (arXiv:2609.04852) into BeeLlama v0.4.6, maintaining full compatibility with BeeLlama's core optimizations while allowing true 256K context streaming.
A fully working implementation, benchmarks, and Windows binaries are available in the fork:
👉 Repository & Branch: Andgihat/beellama.cpp (branch: beellama-kvmem)
👉 Release & Binaries: v0.4.6-kvmem
How it works
- Host RAM Virtual Working Set: The complete 262,144 (256K) context lives in pinned Host RAM (DDR5, ~8–12 GB).
- Fixed GPU Slot Pool: Only an active working set (e.g. Budget $B = 36K$ + Reserve $R = 16K$) sits in VRAM (~14.6 GB total with weights, zero OOM).
- Graph Recall & Cache Quantization: Blocks (128 tokens) are staged in/out over PCIe on the fly using Hadamard-rotated quantized slots (
q4_0/q8_0). - Blackwell sm_120 Fix: In the process, we resolved a GDN warp reduction bug in
ggml-cuda/gated_delta_net.cu(lanes_per_colstride and pointer offset checkkeep_rs = K > 1), restoring 100% correct mathematics for hybrid Qwen3.8 on RTX 50-series GPUs.
Benchmark Results (Qwen3.8-27B-UD-Q3_K_XL on RTX 5060 Ti 16GB)
Tested on real text documents from 10K to 256K context:
- Prompt Processing (Prefill @ 10K+ tokens):
915.84 tokens/s(10,196 tokens processed in 11.13s with-b 2048 -ub 1024). - Decode Speed:
35.6 - 40.3 tokens/swith built-in MTP (--spec-type draft-mtp). - MTP Acceptance Rate:
76.0%(consistent 2.46 tokens/round). - RAM Usage @ 10K: Only 187 MB with
q4_0cache. - VRAM Headroom: Fits comfortably within 15.3 GB on a 16GB GPU.
Question for Maintainer (@Anbeeld)
Because the KVMem integration is relatively substantial (~36K LOC including tests, standalone llama-kvmem-server, and runtime adapters), we wanted to check with you first:
- Upstream PR: Would you be interested in having KVMem integrated directly into upstream BeeLlama (e.g. as an optional feature / server target)?
- Specialized Fork: Or would you prefer we maintain this as a specialized downstream fork / companion project (
beellama-kvmem), and only submit targeted PRs (such as the Blackwell GDN CUDA fixes ingated_delta_net.cu) to upstream?
Happy to adapt the changes or submit targeted PRs depending on your architectural preferences. Thank you for the awesome work on BeeLlama!
- 主要言語
- C++
- スター
- 1.2k
- フォーク
- 80
- 平均マージ
- 4日 20時間
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Anbeeld/beellama.cpp のほかの issue
-
[BUG] KVarN assertion failure in build_inp_mem_hybrid_iswa() due to uninitialized self_kvarn_rotオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Anbeeld/beellama.cpp#205 ·
-
難易度 3/5 半日 初心者へのやさしさ 58/100
Anbeeld/beellama.cpp#206 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
Anbeeld/beellama.cpp#204 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Anbeeld/beellama.cpp#203 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Anbeeld/beellama.cpp#202 · コメント 1 件 ·
Anbeeld/beellama.cpp の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
CachyOS/packageinstaller#144 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
TomerAberbach/profiler-md#951 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] Default key routing (JavaStringHash) picks a different partition than the Java client for about half of keys対応中かも @0z5a が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/pulsar-client-go#1575 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pocoproject/poco#5764 ·
メンテナーはふだん 2 日以内に返信
-
bug cpp-core-guidelines low-priority
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
NatronGitHub/openfx-supportext#164 ·
メンテナーはふだん 1 日以内に返信