[GH-ISSUE #4927] [Engine] KVA with batch slots: allow KVA and read cold batch prompts in one run #2263

Open
opened 2026-11-04 01:58:01 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @bayerhazard on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4927

Short

KVA is disabled whenever --batch / parallel slots are used. This change enables KVA for batch serving and reads a cold KVA prompt in one run; on our 24 GB RTX 5090 Laptop it cuts 70K/190K prompt TTFT from 22.5 s to 19.1 s. This is the simple form for long solo prompts; a concurrent second request has to wait (see #4930 for the interleaved form).

Our system

  • Olares One: Intel Core Ultra 9 275HX (24 threads), 96 GB RAM, NVIDIA RTX 5090 Laptop 24 GB, Linux (Olares 1.12.7), CUDA 13.
  • Qwen3.8-Flash-Next IQ3_S (GSQ-RCO), 200K context, INT8 KV, parallel: 2, --prefill auto:32768, KVA split 36 / suffix 2048, MTP --spec 6, engine 0.1.55 (Strata 0.2.9).
  • One GPU, text prompts.

The solution

Two small changes in src/program/generate.cpp against v0.2.9:

  1. remove the else if (o.batch > 0) ke.blocked = "batch slots (--batch)"; line;
  2. for a cold KVA-eligible part (pos0 == 0, long enough, one GPU), read that part in one run instead of splitting it with batch_read_piece, and skip the read_windows path for it. The internal prefill chunking still applies; KVA sees the full part length.

Branch: https://git.aimighty.olares.de/aimighty/strata/src/branch/kva-batch-029/src/program/generate.cpp
Diff: 8 insertions, 3 deletions in one file.

What it brings

  • tools/batch_test.py, 40K prompt, greedy (temperature=0 top_k=1), --adapt-every 1000000 --pcie-frac 0: KVA approximated 32768 of 38914 positions; solo and batch long output identical.
  • Stress 70K/190K, KVA off -> on: TTFT 22.5 s -> 19.1 s (~15%), prompt throughput 3134 -> 3568 tok/s.
  • Concurrent 100K + 25K (direct server): long request 43.6 s -> 37.1 s; short request 18.35 s -> 37.1 s (it waits for the whole long prompt).
  • App release with this change: Performance PASS, Agentic 0.992 (Wings 0.959), Stability PASS (KV 100/150/180/190K, vision, 300 s soak), refusal 0/48.

Limits

  • The whole-prompt read disables slot interleaving; this is the trade-off fixed by #4930. The simple version is not the preferred multi-request form.
  • One CUDA GPU; layer splits still decline KVA; HIP/SYCL not tested. Images and continuation reads stay exact. The 28K system prompt still gets 0 approximation with the 32K chunk.
  • No PR yet; the branch is a fork and the app-side gates above are the evidence.

Request

Please consider adopting KVA+batch upstream. #4930 is the interleaved follow-up and the preferred form for parallel slots; this issue documents the simple first step. I can open a PR and run the required CUDA/HIP/SYCL builds/tests.

Originally created by @bayerhazard on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4927 ## Short KVA is disabled whenever `--batch` / `parallel` slots are used. This change enables KVA for batch serving and reads a cold KVA prompt in one run; on our 24 GB RTX 5090 Laptop it cuts 70K/190K prompt TTFT from 22.5 s to 19.1 s. This is the simple form for long solo prompts; a concurrent second request has to wait (see #4930 for the interleaved form). ## Our system - Olares One: Intel Core Ultra 9 275HX (24 threads), 96 GB RAM, NVIDIA RTX 5090 Laptop 24 GB, Linux (Olares 1.12.7), CUDA 13. - Qwen3.8-Flash-Next IQ3_S (GSQ-RCO), 200K context, INT8 KV, `parallel: 2`, `--prefill auto:32768`, KVA split 36 / suffix 2048, MTP `--spec 6`, engine 0.1.55 (Strata 0.2.9). - One GPU, text prompts. ## The solution Two small changes in `src/program/generate.cpp` against v0.2.9: 1. remove the `else if (o.batch > 0) ke.blocked = "batch slots (--batch)";` line; 2. for a cold KVA-eligible part (`pos0 == 0`, long enough, one GPU), read that part in one run instead of splitting it with `batch_read_piece`, and skip the `read_windows` path for it. The internal prefill chunking still applies; KVA sees the full part length. Branch: https://git.aimighty.olares.de/aimighty/strata/src/branch/kva-batch-029/src/program/generate.cpp Diff: 8 insertions, 3 deletions in one file. ## What it brings - `tools/batch_test.py`, 40K prompt, greedy (`temperature=0 top_k=1`), `--adapt-every 1000000 --pcie-frac 0`: KVA `approximated 32768 of 38914 positions`; solo and batch long output **identical**. - Stress 70K/190K, KVA off -> on: TTFT **22.5 s -> 19.1 s** (~15%), prompt throughput **3134 -> 3568 tok/s**. - Concurrent 100K + 25K (direct server): long request **43.6 s -> 37.1 s**; short request **18.35 s -> 37.1 s** (it waits for the whole long prompt). - App release with this change: Performance PASS, Agentic 0.992 (Wings 0.959), Stability PASS (KV 100/150/180/190K, vision, 300 s soak), refusal 0/48. ## Limits - The whole-prompt read disables slot interleaving; this is the trade-off fixed by #4930. The simple version is not the preferred multi-request form. - One CUDA GPU; layer splits still decline KVA; HIP/SYCL not tested. Images and continuation reads stay exact. The 28K system prompt still gets 0 approximation with the 32K chunk. - No PR yet; the branch is a fork and the app-side gates above are the evidence. ## Request Please consider adopting KVA+batch upstream. #4930 is the interleaved follow-up and the preferred form for `parallel` slots; this issue documents the simple first step. I can open a PR and run the required CUDA/HIP/SYCL builds/tests.
Author
Owner

@bayerhazard commented on GitHub (Nov 1, 2026):

Follow-up for the multi-request cost of the whole-prompt read: #4930. Interleaved variant measured on the same box: long 100K request 38.19 s (KVA off 43.62), short 25K request 16.59 s (whole-prompt 37.12, KVA off 18.35). The initial simple version in this issue is fine for solo long prompts; #4930 is the preferred form for parallel slots.

<!-- gh-comment-id:6559620651 --> @bayerhazard commented on GitHub (Nov 1, 2026): Follow-up for the multi-request cost of the whole-prompt read: #4930. Interleaved variant measured on the same box: long 100K request 38.19 s (KVA off 43.62), short 25K request 16.59 s (whole-prompt 37.12, KVA off 18.35). The initial simple version in this issue is fine for solo long prompts; #4930 is the preferred form for parallel slots.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2263
No description provided.