mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #729] KV int8 vs fp16 KLD compare at 240K context #331
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#331
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?
Originally created by @jerry78424 on GitHub (Oct 4, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/729
The 2026-09-27 bench stopped at 8K and reported "int8 is indistinguishable from fp16".
Two questions were left open:
own tokens feed its own KV and a single flipped near-tie makes the two texts diverge?
Setup
between the two versions on this path - the update did not change numerics here).
--kv fp16vs--kv int8; fixed expert set (--expert-cache 7000budget,--adapt-swaps 0),--prefill 8192,--kv-resident 0,--max-context 262144.Method (native packs constrain the probe)
Native IQ packs leave the per-token
--dump-logitsloop before the dump site (--prefill 0is refused;69de404made the empty file honest), so there is no per-position logit series. What exists instead:STRATA_DUMP_FIRST_LOGITS- one full-vocab (248,320 f32) row at the last promptposition, i.e. the next-token distribution after attending over the entire batched-prefill KV.
Verified byte-identical across reruns (temp-0 greedy,
--spec 4lossless).--max-new 32 --temperature 0(generate mode defaults to temperature1.0 - pin it); the engine prints the generated token ids; the two arms' 32-token sequences are compared
for the first differing token. Same prefill cost, so this is nearly free.
Distribution: no growth with depth, heavy tail at near-ties
of 0.114. The sqrt(d) averaging of K/V quantization noise holds out to 240K.
near-tied tokens; 165K has both arms at NLL > 10). Same heavy-tail shape as the 8K bench.
Free generation: the texts fork quickly anyway
13 of 16 depths fork within 32 greedy tokens (indices 0,3,4,6,6,8,8,10,15,15,19,20,22; median ~8);
3 identical (150K, 210K, 225K). The sharpest point: 195K forks at token 3 with a teacher-forced KL of
7e-5 - the average distribution is nearly untouched, yet along the generated path some step always has
a top-2 gap smaller than the int8 noise (a few percent flip probability per token).
What this does and does not say
aggregate quality (the 8K perplexity numbers) is unaffected. int8 staying the default is right.
prompt diverges within a handful of tokens at most positions. That is expected at near-ties (fp16 itself
is a coin flip there).
needle bench at 240K, is the missing piece; the 9-27 needles only showed retrieval survives q4_0).
Limitations
One model (IQ3_S), one corpus, 16 points, one teacher-forced row per arm.
Fork indices bound the near-tie flip rate coarsely (n=32 steps per depth). Prompts were fed as raw token
ids (
--tokens-file), so no chat template (jinja) was applied - the arms continue a raw token streamwith no template markers anywhere in the corpus, and the ChatML markers the model emitted in its outputs
are fully learned behavior, not echoes of the input. The degenerate outputs observed on both sides (an
endoftext repeat loop at 135K on the fp16 arm, a stray tool-call end at 75K) are partly artifacts of that
un-templated state and do not imply real-serving degeneracy. The probe needs
STRATA_DUMP_FIRST_LOGITS(a debug env hook); a first-class per-position dump path for native packswould make this exact experiment much cheaper to repeat.
@BlueKingMuch commented on GitHub (Oct 6, 2026):
Thanks, this matches what I measured on a 4080 SUPER (IQ3_S, 0.1.38), with the same precautions:
--expert-cache 7000for every format so the experts sit in the same place, and fp16 run twice as a baseline (223 of 223 distributions bit-identical). KL to fp16 at 223 positions of three texts (code up to 120K, English up to 32K, German up to 16K):About your fork at token 3 at 195K with a KL of 7e-5: there's a floor below which the format doesn't matter. In a q4_0 run with all cells held exact (contexts short enough to fit into the exact window I was testing), the result was as far from fp16 as int8 (0.0071 vs 0.0066 nats): the same values read by a different kernel, i.e. in a different summation order, move the distribution that much. So greedy continuations of any path other than fp16 will fork at the first near-tie; how far the distributions are apart says more than whether they fork.
@Niko1221 commented on GitHub (Oct 7, 2026):
Thank you, this KLD data for int8 against fp16 KV at 240K is useful, and the bit-identical result between 0.1.34 and 0.1.38 is good to know. Closing as a report; a bench PR with the same numbers is welcome.