[GH-ISSUE #2787] [Feature request] 16-bit KV cache option above 8K context (to A/B against int8) #1119

Closed
opened 2026-11-04 01:48:39 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @mbaaku on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2787

What: an opt-in --kv f16 (or bf16) for contexts above 8K. Today the choices there are int8 (default), k8v4 and q4_0; full precision is used only up to 8K.

Why: with Qwen3.8-Flash-Next Coder IQ1_M (v0.1.44.1, SYCL, Arc Pro B60, --kv int8, --max-context 131072) as the model of a coding agent, tool-call formatting degrades with prompt length:

  • the first broken calls appear around 15–25k prompt tokens;
  • at ~79k we saw a streak of calls with an empty body (<function=Bash></function>, no parameter), 48 in 40 minutes against 19 well-formed ones;
  • at ~100k a reply looped in its reasoning until max tokens.

The broken calls are already in the raw model output (STRATA_DEBUG=1), so this is generation, not parsing. It may be the weight quantization alone, but the KV cache is the other quantized part that grows with context, and there is currently no way to rule it out. docs/DETAILS.md measures q4_0 against int8 (perplexity +8–12% on long documents); a 16-bit option would allow the same comparison one step up.

What we would measure: the share of malformed tool calls per 10k prompt tokens over the same agent workload with int8 vs f16, from the STRATA_DEBUG raw output. Happy to post the numbers here.

Cost we understand: twice the KV memory of int8, so fewer experts in VRAM or a shorter context. It would be an opt-in for diagnosis and for cards with room to spare, not a new default.

Originally created by @mbaaku on GitHub (Oct 16, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2787 **What:** an opt-in `--kv f16` (or `bf16`) for contexts above 8K. Today the choices there are `int8` (default), `k8v4` and `q4_0`; full precision is used only up to 8K. **Why:** with Qwen3.8-Flash-Next Coder IQ1_M (v0.1.44.1, SYCL, Arc Pro B60, `--kv int8`, `--max-context 131072`) as the model of a coding agent, tool-call formatting degrades with prompt length: - the first broken calls appear around 15–25k prompt tokens; - at ~79k we saw a streak of calls with an empty body (`<function=Bash></function>`, no parameter), 48 in 40 minutes against 19 well-formed ones; - at ~100k a reply looped in its reasoning until max tokens. The broken calls are already in the raw model output (`STRATA_DEBUG=1`), so this is generation, not parsing. It may be the weight quantization alone, but the KV cache is the other quantized part that grows with context, and there is currently no way to rule it out. `docs/DETAILS.md` measures q4_0 against int8 (perplexity +8–12% on long documents); a 16-bit option would allow the same comparison one step up. **What we would measure:** the share of malformed tool calls per 10k prompt tokens over the same agent workload with `int8` vs `f16`, from the `STRATA_DEBUG` raw output. Happy to post the numbers here. **Cost we understand:** twice the KV memory of int8, so fewer experts in VRAM or a shorter context. It would be an opt-in for diagnosis and for cards with room to spare, not a new default.
Author
Owner

@nghia1930mmm-cmd commented on GitHub (Oct 16, 2026):

2815521

Trên 16 tháng 10, 2026 22:44:23 GMT+07:00, Maciej Fleszar @.***> đã viết:

mbaaku created an issue (Niko1221/Strata#2787)

What: an opt-in --kv f16 (or bf16) for contexts above 8K. Today the choices there are int8 (default), k8v4 and q4_0; full precision is used only up to 8K.

Why: with Qwen3.8-Flash-Next Coder IQ1_M (v0.1.44.1, SYCL, Arc Pro B60, --kv int8, --max-context 131072) as the model of a coding agent, tool-call formatting degrades with prompt length:

  • the first broken calls appear around 15–25k prompt tokens;
  • at ~79k we saw a streak of calls with an empty body (<function=Bash></function>, no parameter), 48 in 40 minutes against 19 well-formed ones;
  • at ~100k a reply looped in its reasoning until max tokens.

The broken calls are already in the raw model output (STRATA_DEBUG=1), so this is generation, not parsing. It may be the weight quantization alone, but the KV cache is the other quantized part that grows with context, and there is currently no way to rule it out. docs/DETAILS.md measures q4_0 against int8 (perplexity +8–12% on long documents); a 16-bit option would allow the same comparison one step up.

What we would measure: the share of malformed tool calls per 10k prompt tokens over the same agent workload with int8 vs f16, from the STRATA_DEBUG raw output. Happy to post the numbers here.

Cost we understand: twice the KV memory of int8, so fewer experts in VRAM or a shorter context. It would be an opt-in for diagnosis and for cards with room to spare, not a new default.

--
Reply to this email directly or view it on GitHub:
https://github.com/Niko1221/Strata/issues/2787
You are receiving this because you are subscribed to this thread.

Message ID: @.***>

<!-- gh-comment-id:6220529885 --> @nghia1930mmm-cmd commented on GitHub (Oct 16, 2026): 2815521 Trên 16 tháng 10, 2026 22:44:23 GMT+07:00, Maciej Fleszar ***@***.***> đã viết: >mbaaku created an issue (Niko1221/Strata#2787) > > >**What:** an opt-in `--kv f16` (or `bf16`) for contexts above 8K. Today the choices there are `int8` (default), `k8v4` and `q4_0`; full precision is used only up to 8K. > >**Why:** with Qwen3.8-Flash-Next Coder IQ1_M (v0.1.44.1, SYCL, Arc Pro B60, `--kv int8`, `--max-context 131072`) as the model of a coding agent, tool-call formatting degrades with prompt length: >- the first broken calls appear around 15–25k prompt tokens; >- at ~79k we saw a streak of calls with an empty body (`<function=Bash></function>`, no parameter), 48 in 40 minutes against 19 well-formed ones; >- at ~100k a reply looped in its reasoning until max tokens. > >The broken calls are already in the raw model output (`STRATA_DEBUG=1`), so this is generation, not parsing. It may be the weight quantization alone, but the KV cache is the other quantized part that grows with context, and there is currently no way to rule it out. `docs/DETAILS.md` measures q4_0 against int8 (perplexity +8–12% on long documents); a 16-bit option would allow the same comparison one step up. > >**What we would measure:** the share of malformed tool calls per 10k prompt tokens over the same agent workload with `int8` vs `f16`, from the `STRATA_DEBUG` raw output. Happy to post the numbers here. > >**Cost we understand:** twice the KV memory of int8, so fewer experts in VRAM or a shorter context. It would be an opt-in for diagnosis and for cards with room to spare, not a new default. > > >-- >Reply to this email directly or view it on GitHub: >https://github.com/Niko1221/Strata/issues/2787 >You are receiving this because you are subscribed to this thread. > >Message ID: ***@***.***>
Author
Owner

@nghia1930mmm-cmd commented on GitHub (Oct 16, 2026):

Trên 16 tháng 10, 2026 22:44:23 GMT+07:00, Maciej Fleszar @.***> đã viết:

mbaaku created an issue (Niko1221/Strata#2787)

What: an opt-in --kv f16 (or bf16) for contexts above 8K. Today the choices there are int8 (default), k8v4 and q4_0; full precision is used only up to 8K.

Why: with Qwen3.8-Flash-Next Coder IQ1_M (v0.1.44.1, SYCL, Arc Pro B60, --kv int8, --max-context 131072) as the model of a coding agent, tool-call formatting degrades with prompt length:

  • the first broken calls appear around 15–25k prompt tokens;
  • at ~79k we saw a streak of calls with an empty body (<function=Bash></function>, no parameter), 48 in 40 minutes against 19 well-formed ones;
  • at ~100k a reply looped in its reasoning until max tokens.

The broken calls are already in the raw model output (STRATA_DEBUG=1), so this is generation, not parsing. It may be the weight quantization alone, but the KV cache is the other quantized part that grows with context, and there is currently no way to rule it out. docs/DETAILS.md measures q4_0 against int8 (perplexity +8–12% on long documents); a 16-bit option would allow the same comparison one step up.

What we would measure: the share of malformed tool calls per 10k prompt tokens over the same agent workload with int8 vs f16, from the STRATA_DEBUG raw output. Happy to post the numbers here.

Cost we understand: twice the KV memory of int8, so fewer experts in VRAM or a shorter context. It would be an opt-in for diagnosis and for cards with room to spare, not a new default.

--
Reply to this email directly or view it on GitHub:
https://github.com/Niko1221/Strata/issues/2787
You are receiving this because you are subscribed to this thread.

Message ID: @.***>

<!-- gh-comment-id:6220568844 --> @nghia1930mmm-cmd commented on GitHub (Oct 16, 2026): 28155321. Trên 16 tháng 10, 2026 22:44:23 GMT+07:00, Maciej Fleszar ***@***.***> đã viết: >mbaaku created an issue (Niko1221/Strata#2787) > > >**What:** an opt-in `--kv f16` (or `bf16`) for contexts above 8K. Today the choices there are `int8` (default), `k8v4` and `q4_0`; full precision is used only up to 8K. > >**Why:** with Qwen3.8-Flash-Next Coder IQ1_M (v0.1.44.1, SYCL, Arc Pro B60, `--kv int8`, `--max-context 131072`) as the model of a coding agent, tool-call formatting degrades with prompt length: >- the first broken calls appear around 15–25k prompt tokens; >- at ~79k we saw a streak of calls with an empty body (`<function=Bash></function>`, no parameter), 48 in 40 minutes against 19 well-formed ones; >- at ~100k a reply looped in its reasoning until max tokens. > >The broken calls are already in the raw model output (`STRATA_DEBUG=1`), so this is generation, not parsing. It may be the weight quantization alone, but the KV cache is the other quantized part that grows with context, and there is currently no way to rule it out. `docs/DETAILS.md` measures q4_0 against int8 (perplexity +8–12% on long documents); a 16-bit option would allow the same comparison one step up. > >**What we would measure:** the share of malformed tool calls per 10k prompt tokens over the same agent workload with `int8` vs `f16`, from the `STRATA_DEBUG` raw output. Happy to post the numbers here. > >**Cost we understand:** twice the KV memory of int8, so fewer experts in VRAM or a shorter context. It would be an opt-in for diagnosis and for cards with room to spare, not a new default. > > >-- >Reply to this email directly or view it on GitHub: >https://github.com/Niko1221/Strata/issues/2787 >You are receiving this because you are subscribed to this thread. > >Message ID: ***@***.***>
Author
Owner

@christopherrobertbrooks-tech commented on GitHub (Oct 18, 2026):

int8 vs fp16 KV up to ~120K on CUDA (V100): int8 looks safe as the default

On CUDA --kv fp16 already runs at long context (--max-context 131072), so here is the A/B this issue asks for, on the same Coder IQ1_M model. In case it helps with gate G-C too.

Setup: Tesla V100-PCIe 32 GB (sm_70), Strata 0.1.41, Coder IQ1_M, everyday config (vision on the GPU, resident RAM mode). Only --kv changes between arms: fp16 / int8 / q4_0 / k8v4. Each length uses 4 different stretches of real code and docs, from this repo's own source. Greedy, thinking off. Quality is the KL of the first answer token's distribution against fp16 (from STRATA_DUMP_FIRST_LOGITS), plus tools/needle_bench.py at 32K/64K/128K × depths 10/30/50/70/90.

KL vs fp16 (nats) 8K 32K 64K ~120K
int8 0.004 0.003 0.006 0.015
k8v4 0.025 0.017 0.013 0.013
q4_0 0.019 0.017 0.030 0.043
  • int8 is indistinguishable from fp16 up to 64K: the same top-1 token in 12/12 documents, KL 0.001–0.008. At ~120K it rises slightly: 3/4 top-1, and most of the 0.015 is one near-tie (fp16 47% vs int8 41% on its top token). With n=4 per length, that row is the least certain.
  • q4_0 drifts 3–7× more and grows with length, matching the q4_0 note in DETAILS.md. k8v4 sits in between.
  • Needles: 15/15 for every setting at every length.
  • int8 is also the fastest here, because the smaller cache leaves room for more experts. That's 11,642 vs 10,817 cached experts; seconds per ~120K-token request: int8 84, q4_0 92, k8v4 94, fp16 96.

For this issue: on this setup the int8 KV cache doesn't change the model's output in any measurable way below 64K, so tool calls breaking at 15–25K are unlikely to come from it. The weight quantization or the agent's context look like better suspects. For gate G-C: setup already writes int8 above 8K, so this suggests the engine default could follow.

Data and scripts: https://github.com/christopherrobertbrooks-tech/strata-kv-precision

<!-- gh-comment-id:6256352734 --> @christopherrobertbrooks-tech commented on GitHub (Oct 18, 2026): ## int8 vs fp16 KV up to ~120K on CUDA (V100): int8 looks safe as the default On CUDA `--kv fp16` already runs at long context (`--max-context 131072`), so here is the A/B this issue asks for, on the same Coder IQ1_M model. In case it helps with gate G-C too. **Setup:** Tesla V100-PCIe 32 GB (sm_70), Strata 0.1.41, Coder IQ1_M, everyday config (vision on the GPU, resident RAM mode). Only `--kv` changes between arms: fp16 / int8 / q4_0 / k8v4. Each length uses 4 different stretches of real code and docs, from this repo's own source. Greedy, thinking off. Quality is the KL of the first answer token's distribution against fp16 (from `STRATA_DUMP_FIRST_LOGITS`), plus `tools/needle_bench.py` at 32K/64K/128K × depths 10/30/50/70/90. | KL vs fp16 (nats) | 8K | 32K | 64K | ~120K | |---|---|---|---|---| | **int8** | **0.004** | **0.003** | **0.006** | 0.015 | | k8v4 | 0.025 | 0.017 | 0.013 | 0.013 | | q4_0 | 0.019 | 0.017 | 0.030 | 0.043 | - **int8 is indistinguishable from fp16 up to 64K:** the same top-1 token in 12/12 documents, KL 0.001–0.008. At ~120K it rises slightly: 3/4 top-1, and most of the 0.015 is one near-tie (fp16 47% vs int8 41% on its top token). With n=4 per length, that row is the least certain. - **q4_0 drifts 3–7× more and grows with length,** matching the q4_0 note in DETAILS.md. k8v4 sits in between. - **Needles: 15/15 for every setting at every length.** - **int8 is also the fastest here,** because the smaller cache leaves room for more experts. That's 11,642 vs 10,817 cached experts; seconds per ~120K-token request: int8 84, q4_0 92, k8v4 94, fp16 96. **For this issue:** on this setup the int8 KV cache doesn't change the model's output in any measurable way below 64K, so tool calls breaking at 15–25K are unlikely to come from it. The weight quantization or the agent's context look like better suspects. **For gate G-C:** setup already writes `int8` above 8K, so this suggests the engine default could follow. Data and scripts: https://github.com/christopherrobertbrooks-tech/strata-kv-precision
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271258334 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#1119
No description provided.