Skip to content

verify: the batched K/V append writes a streamed K8V4 state's host copy (#1188, #1169) - #1264

Closed
merbanan wants to merge 1 commit into
Niko1221:mainfrom
merbanan:fix/1188-k8v4-stream
Closed

merbanan wants to merge 1 commit into
Niko1221:mainfrom
merbanan:fix/1188-k8v4-stream

Conversation

@merbanan

@merbanan merbanan commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

#783's batched append of a verify window's cells passed no host copy for the hybrid K8V4 format (int8 and q4_0 pass st.host, and the per-token path passes K8V4's two halves). With --kv-resident, a block that was not resident when its cells were appended came back from the host copy without them, so the tokens a window wrote were lost: free generation degenerated into repetition (#1188, #1135) and parked conversations lost their decode-written turns (#1169). The batched path now passes the same host halves as the per-token path.

…py (Niko1221#1188, Niko1221#1169)

Niko1221#783's batched append of a verify window's cells passed no host copy for the
hybrid K8V4 format (int8 and q4_0 pass st.host, and the per-token path passes
K8V4's two halves).  With --kv-resident, a block that was not resident when its
cells were appended came back from the host copy without them, so the tokens a
window wrote were lost: free generation degenerated into repetition (Niko1221#1188,
Niko1221#1135) and parked conversations lost their decode-written turns (Niko1221#1169).  The
batched path now passes the same host halves as the per-token path.
@konijiwa110

Copy link
Copy Markdown
Contributor

Tested this on a 2080 Ti (sm_75, CUDA 13.3, Linux): main (82f46a8) against main + this PR, nothing else applied. Swift 1.5 IQ3_XXS pack, --kv k8v4 --kv-resident 32768 --max-context 262144 --spec 4 with the MTP head, parking on (4 slots).

The probe is a chat where each turn asks the model to repeat the user's message word for word (greedy, thinking off). The turns are appended one at a time, so each request reads only ~40 new tokens. That's 8 turns per chain, two chains per row:

history before the probes main main + #1264
none 0/16 16/16
~16.5K tokens 0/16 16/16
~165K tokens not run 16/16

On main it looked like #1169. With no history at all, the model repeated a sentence from a different conversation that had run on the same server a few minutes earlier. In a real ~188K-token session it only saw the first word of a new message. It also failed with all the history inside the resident window (16.5K < 32768), which fits parked/restored state being read from the host copy. --prompt-cache 2 and --suffix-draft 0 didn't change anything. int8 with the same --kv-resident was clean (32/32), and so was a 3080 running int8.

Thanks for tracking this down.

@Niko1221

Niko1221 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thank you, Benjamin. This is in 0.1.40.2 with your authorship kept, unchanged. It fixes the repetition on a count-to-300 test on both CUDA (sm_86) and HIP (gfx1201).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants