mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #453] [CLOSED] prefill: the draft layer's batched K/V for a ring too (KV streaming) - prefill +4.6% with --kv-resident #2647
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2647
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/453
Author: @architectds
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:pr/draft-kv-ring📝 Commits (1)
7d4a560prefill: the draft layer's batched K/V for a ring too (KV streaming), and STRATA_DRAFT_TIMING📊 Changes
1 file changed (+19 additions, -3 deletions)
View changed files
📝
src/prefill/prefill.cpp(+19 -3)📄 Description
What
With KV streaming (
--kv-resident), the MTP drafter's K/V is a ring of its window:kv_mode2, page p in slotp % n_slots, over a host copy.
Prefill::draft_kv(E-9) refused anything butkv_mode0, so every prompt fell back tothe drafter's own pass (
MtpDrafter::prefill), one graph per few rows over the window's cells. On a streamed sessionthat was about 4.5% of every long prompt.
kv_append_q4/kv_append) with the ring'spage table and host copy, as a streamed main layer appends.
first_needed, as before), and the ring holds them.STRATA_MTP_BATCH_RING=0restores the drafter's own pass.STRATA_DRAFT_TIMING=1prints the pass's time, synced.Measured
Setup:
--kv q4_0 --kv-resident 32768, text-only args,--prefill auto(8,192-token chunks),--spec 4 --mtp.The draft layer's step after the prompt (
STRATA_PREFILL_TIMING's "after each chunk"; the same prompts in botharms, display off):
STRATA_DRAFT_TIMING)Prefill, end to end.
STRATA_MTP_BATCH_RING=0against the default, everything else as v0.1.34.The saving grows with the prompt (median 215 / 407 / 873 ms). With a 32K-cell ring the drafter's window covers the
whole prompt, and its own pass cost about 27 ms per 1K prompt tokens.
The drafts. 128 greedy tokens after an 8K and a 16K prompt, two runs (the second with
STRATA_IQ_MT_MIN=1):Exactness.
round differently, so drafts can differ.
how many drafts it holds (#152).
STRATA_IQ_MT_MIN=1. That is thesame thing a change of drafter or of
--specdoes.Not tested here
kv_appendwith the ring's page table and host copy. Only--kv q4_0was run.draft_kv.Developed with an AI coding assistant; all numbers measured on the machine above.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.