mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3303] [Engine] q36 (qwen35moe) KV cache is always fp32: --kv / --kv-resident are not parsed, so 256K context OOMs on a 16 GB card #1340
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#1340
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 @conlododo on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3303
Area:
[Engine] (speed, kernels, models, the server and API)Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)What happened
With the Qwen3.6-35B-A3B (arch
qwen35moe) own-engine path, raising--max-contextfails at model load once the fp32 KV cache no longer fits.--max-context 262144OOMs on a 16 GB card, while 32768 and 100000 start and serve normally on the same card and model.The q36 engine allocates its K/V cache as plain fp32 (
dalloc()iscudaMalloc(n * 4)), and unlike the generic Flash-Next path it has no KV-quantization option:--kv,--kv-residentand--specare not parsed at all (passing them is ignored with "not an option of this engine"). So aqwen35moemodel cannot trade KV precision for context length, and 256K is unreachable on 16 GB even though the same model does 256K on a 32 GB card.I expected
--kv int8/--kv k8v4(as documented for the generic path, and as used by an IQ3_S Flash-Next pack at 1M context) to work for this architecture too, or at least to be documented as unsupported forqwen35moe.Smallest steps or command that reproduce it
Observed (16 GB card, 30 GB RAM, Ubuntu 24.04):
The same command with
--max-context 32768and--max-context 100000starts fine. Passing--kv k8v4in addition changes nothing (it is reported as "not an option of this engine").Reproduction status
Reproduced locallyStrata version
strata 0.1.45(built from source with setup.py; engine/strata reports "strata 0.1.45")Graphics card, memory and system
RTX 5060 Ti 16 GB · 30 GB RAM · Ubuntu 24.04 (kernel 7.0.0-38). Also reproduced the same 256K limit onRTX 4080 SUPER 32 GB · 62 GB RAMonly insofar as 32 GB does fit it; the 16 GB card is where it fails.Model, size and settings
Qwen3.6-35B-A3B-UD-Q4_K_XL · UD-Q4_K_XL (Unsloth Dynamic, 22 GB, 753 tensors, 5.15 BPW) · context swept 32K / 100K / 256K · pictures off · --mtp 2 · --prefill autoMetadata of this file:
n_head_kv = 2,key_length = value_length = 256,block_count = 41,full_attention_interval = 4,nextn_predict_layers = 1.Logs
Measured KV slope between the two working points: −3.7 GiB for +67,328 cells ≈ 59 MiB per 1K cells → ≈15.5 GiB at 262,144 cells. Plus 4.40 GiB dense and ~0.80 GiB for the MTP block, that is ≈20.7 GiB, over the 16.3 GiB the card reports.
For reference, the same model on this card decodes at 126–133 tok/s at 32K (MTP drafts accepted 237/324, 229/342) and 91–94 tok/s at 100K, so the engine itself is fine — only the KV budget is the wall.
What would fix it (for whoever picks this up)
--kv int8|q4_0|k8v4in the q36 engine (src/qwen35/q36_engine.cu), storing K/V in the quantized form the generic path uses (src/program/generate.cpp:2336); the quantized attention kernels already exist in the tree (src/kernels/cuda/qsa_decode_attn.cu,include/strata/kernels/kv_stream.hpp).--kv-resident Nstreaming, as for Flash-Next, so the cache can live partly outside VRAM.qwen35moehas no KV compression (and therefore a ~160K ceiling on 16 GB) would save the next person the same experiment.Side note that may be worth documenting separately: a LoRA merged with
llama-export-loracomes back with the touched tensors as F16, which the native MMVQ rejects (blk.0.attn_qkv.weight is F16, which the native MMVQ does not take). Re-quantizing only those tensors back to their original per-tensor types (taken from the base file) produced a byte-size-identical file that loads normally.@github-actions[bot] commented on GitHub (Oct 20, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Oct 20, 2026):
Thanks, this follows the format now.
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.