Skip to content

Complete opt-in Qwen HiCache state transfer and backport QSA/restore fixes - #9

Merged
kanadaj merged 26 commits into
kanadaj:mainfrom
ktsaou:wip/qwen-hicache-state
Sep 14, 2026
Merged

kanadaj merged 26 commits into
kanadaj:mainfrom
ktsaou:wip/qwen-hicache-state

Conversation

@ktsaou

@ktsaou ktsaou commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Qwen HiCache previously restored KV/Mamba buffers without all PLE and compressed QSA state, so a reused prefix could differ from its original computation. This updates the isolated HiCache profile onto current main, carries the missing target/draft state through RAM and files, and adds upstream QSA, router and restore-order corrections.

The ordinary Dockerfile and default profiles remain unchanged. The opt-in build pins the cumulative parent and verifies the complete 4,393-file runtime inventory.

Changes:

  • PLE convolution/N-gram checkpoints, host sizing and layer waits.
  • Compressed QSA target/draft sidecar, complete-page requirements and file-miss handling.

Upstream backports/adaptations:

Upstream SGLang PR Local patch Change used
#38851 0023 Initialize page-strided QSA scratch, use 64-bit gather offsets, and convert FP8 gathered values correctly.
#38290 0024 Wait before reading router bias in both Triton and radix kernels. The existing bias API is retained.
#36738 0025 Order H2D restoration after in-flight forwards that may still write reused pages.
#36743 0025 Wait for the final restored layer before copying an entire Mamba slot.
#39446 0026 Clamp compressed-key gather rows for short cached extensions.

These changes were adapted to the pinned cumulative runtime. PRs #36743 and #39446 were open when imported; the included regression tests validate the applied changes locally. Patches 0020–0022 contain the Qwen companion-state work preserved from this draft.

Validation:

  • 67 cache CPU tests, 95 repository tests, and focused GPU gather/router/restore checks.
  • Post-restoration tools 48/48, mixed efforts 96/96, and image-bearing tool results 16/16.
  • A 603-second mixed-load run reached 64 active requests: media 32/32, exact 523,264-token retrieval, tools 288/288, and clean cancellation/drain without background client errors.
  • Disk reuse across a full restart returned 4/4 correct answers with explicit disk hits and measured H2D restoration; final tool replay passed 48/48.
  • Short-prompt decode measured 249 tokens/s at C1 and 2,843 aggregate tokens/s at C64. This is not a matched cache-on/off comparison.

The tested TP2/MTP3 configuration retains scheduler overlap, target/draft graphs, 64 request slots, 512k context and multimodal inputs, using 60GB aggregate RAM HiCache and a 512GB file payload cap. Prefill CUDA graphs remain disabled as in the baseline; no additional performance feature was disabled.

Limits: only the kernel transfer path and built-in file backend are covered. Best-effort prefetch can recompute, so the strict all-request disk-hit assertion remains recorded as failed; correct recomputation alone is not counted as restoration. One prefetched request reported a device hit. RAM-only pressure tests did not establish host hits, while the combined disk path exercised RAM-to-GPU restoration. Very short video ordering remains a known limitation; longer multi-frame fixtures pass.

Configuration, historical failures and detailed results: docs/hicache-wip.md.

ktsaou and others added 26 commits September 14, 2026 09:12
fix(qwen): map minimal reasoning effort to low
Reuse the ordered Qwen parser for complete outputs whose tool or renewed-reasoning boundaries would otherwise collapse. Add focused regressions and refresh the cumulative source attestations on merged minimal-effort alias main.
fix(responses): preserve Qwen phase and item order
fix(qwen): enable Flash-Next multimodal processor paths
fix(runtime): surface invalid generated token failures
…-compat-20260914

docs: record cumulative compatibility image publication
@ktsaou ktsaou changed the title WIP: preserve Qwen PLE and QSA state across HiCache tiers Complete opt-in Qwen HiCache state transfer and backport QSA/restore fixes Sep 14, 2026
@ktsaou
ktsaou marked this pull request as ready for review September 14, 2026 20:15
@kanadaj
kanadaj merged commit f9da248 into kanadaj:main Sep 14, 2026
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.

2 participants