mirror of
https://github.com/kvcache-ai/sglang.git
synced 2026-11-05 01:07:39 +00:00
[PR #95] [MERGED] fix(kv-cache): guard compressed pool initialization for non-SWA models #95
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/sglang#95
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?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/sglang/pull/95
Author: @yyj6666667
Created: 9/11/2026
Status: ✅ Merged
Merged: 9/11/2026
Merged by: @yyj6666667
Base:
main← Head:fix/guard-compressed-kv-pool-init📝 Commits (2)
4f22278fix(kv-cache): guard compressed pool initialization for non-SWA modelsdefb49bchore: remove test changes from KV guard PR📊 Changes
1 file changed (+2 additions, -1 deletions)
View changed files
📝
python/sglang/srt/model_executor/model_runner_kv_cache_mixin.py(+2 -1)📄 Description
Summary
Scope the compressed-attention capacity branch introduced by #83 to hybrid-SWA models. Kimi and other non-SWA models retain the original
profile_max_num_token()path, without accessing an inapplicable compressed-attention flag.Why
#83 added a direct read of
model_config.is_swa_with_compressed_attentionat the shared KV-pool initialization entry point. Historically,_derive_hybrid_model()returned early for non-SWA models before defining that field. This caused Kimi's initialization to fail withAttributeError, independently of thecompressed-tensorspackage.Current main already initializes the flags to
Falsein4afb5b541. This PR preserves that fix and additionally guards the consumer withis_hybrid_swa, so correctness does not rely solely on the new default. It does not claim that current main still reproduces the historical missing-field error.Changes and scope
model_config.is_hybrid_swaas the first short-circuit condition before readingis_swa_with_compressed_attention.--max-total-tokensis supplied.Only one runtime condition changes. No Kimi whitelist, model/config-file modifications, kernel changes, dependency/version changes, tokenizer changes, or unrelated experimental patches are included. The later GPU-memory profiling and capacity clamping code is untouched.
Validation
The unchanged 12 hybrid-configuration tests pass after the cleanup. Before removing the additional test changes, 42 CPU cases passed, including the capacity-selection branches and legacy configurations without the compressed-attention field. An in-memory negative control failed the 12 missing-field cases without the guard. Those additional tests are not part of the final PR diff.
Ruff (
F401,F821), isort,git diff --check, and Black for the changed runtime lines passed. Existing formatting elsewhere is untouched.Validation boundary: these are CPU configuration/branch regressions, not GPU inference or Adapter end-to-end acceptance. This PR addresses the KV initialization regression only; it does not claim to resolve every Kimi loading issue. No PyPI release is part of this PR.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.