Skip to content

Report prompt KV weight versions in generation metadata - #44164

Merged
fzyzcjy merged 1 commit into
sglang-milesfrom
tom/refactor-miles-repo-sglang/deliver-3
Oct 14, 2026
Merged

fzyzcjy merged 1 commit into
sglang-milesfrom
tom/refactor-miles-repo-sglang/deliver-3

Conversation

@fzyzcjy

@fzyzcjy fzyzcjy commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

CI States

Latest PR Test (Base): ❌ Run #38503948215
Latest PR Test (Extra): ❌ Run #38503948193
Latest PR Test (AMD ROCm 10): ❌ Run #38503948175

@fzyzcjy

fzyzcjy commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/rl/test_weight_version_spans.py

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Rebase Required Before Re-run

A major update has landed on main. Your PR is diverged relative to required base commit 60878c3fba50.

Re-run was not dispatched. What to do:

  • Rebase your branch onto the latest main and push again
  • Follow issue #21065 for context
  • CI-fix PRs may request the bypass-maintenance label to skip this check

@fzyzcjy

fzyzcjy commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

AI-assisted validation report (Codex), requested by the PR author. Not ready to merge: the exact head has failing new unit tests.

  • Head: 653fbddb34e5bc4f989f7b1330e686619f91564f; scope: sglang-miles...head (the intended base). No source/test changes were made.
  • Remote: 1 NVIDIA RTX 4090, lmsysorg/sglang:latest, Python 3.12.3, PyTorch 2.13.0+cu130, pytest 9.1.1. Imports resolve to the synced exact-head source.
  • Pytest summary: 422 passed, 38 skipped, 4 failed, plus 127 passing subtests. The four failures comprise two failed methods and two failed subtests of a third method; JUnit therefore records 3 failing parent test cases, not four independent methods.
Test file (under test/) Passed parents Failed parents Skipped
registered/unit/hardware_backend/mlx/test_attention_patching.py 0 0 38
registered/unit/managers/test_batch_result_processor_hidden_states.py 9 0 0
registered/unit/managers/test_batch_result_processor_mamba_boundary.py 1 0 0
registered/unit/managers/test_batch_result_processor_spec_grammar.py 7 0 0
registered/unit/managers/test_msgpack_ipc_roundtrip.py 10 0 0
registered/unit/managers/test_multi_tokenizer_mixin.py 9 0 0
registered/unit/managers/test_output_streamer_customized_info.py 15 0 0
registered/unit/managers/test_scheduler_weight_version_tracking.py 24 3 0
registered/unit/mem_cache/test_kv_weight_version_tracker.py 24 0 0
registered/unit/model_executor/test_model_runner_kv_weight_versions.py 3 0 0
registered/unit/server_args/test_server_args.py 282 0 0
registered/unit/utils/test_weight_versions.py 37 0 0

Failure: test_scheduler_weight_version_tracking.py constructs Scheduler with __new__ but omits tree_cache. Scheduler.process_batch_result() unconditionally calls self.tree_cache.flush_pending_backups() at scheduler.py:4818, raising AttributeError in:

  • test_pending_result_uses_version_captured_when_batch_ran
  • test_result_copy_finishes_before_slot_indices_are_consumed
  • test_spec_decode_does_not_restamp_restored_prefill_slots (overlap=False and True)

Suggested correction: initialize the fixture's unrelated cache dependency (tree_cache with flush_pending_backups), retaining all existing KV-version assertions. This has not been applied or validated yet.

Reproduction on the exact head in the environment above:

python -m pytest -q test/registered/unit/hardware_backend/mlx/test_attention_patching.py test/registered/unit/managers/test_batch_result_processor_hidden_states.py test/registered/unit/managers/test_batch_result_processor_mamba_boundary.py test/registered/unit/managers/test_batch_result_processor_spec_grammar.py test/registered/unit/managers/test_msgpack_ipc_roundtrip.py test/registered/unit/managers/test_multi_tokenizer_mixin.py test/registered/unit/managers/test_output_streamer_customized_info.py test/registered/unit/managers/test_scheduler_weight_version_tracking.py test/registered/unit/mem_cache/test_kv_weight_version_tracker.py test/registered/unit/model_executor/test_model_runner_kv_weight_versions.py test/registered/unit/server_args/test_server_args.py test/registered/unit/utils/test_weight_versions.py --junitxml=/scratch/pr44164-unit.xml

Limitations:

  • All 38 MLX cases skipped: no Apple/MLX execution coverage.
  • The modified two-GPU RL file test/registered/rl/test_weight_version_spans.py is not validated yet; remote validation is being prepared.
  • Lint passed, but normal CI did not execute the tests. The targeted rerun was rejected by the main maintenance gate; this PR deliberately targets sglang-miles. No bypass or base change was applied.
  • Full local evidence: /Volumes/MyExternal/domains/agent-default/artifacts/sglang/2026-10-14-pr44164-validation/ (unit.log, unit.xml, unit-xml-env.log, sync.log, environment.log); these are local paths, not publicly downloadable CI artifacts.

@fzyzcjy

fzyzcjy commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

AI-assisted validation follow-up (Codex), requested by the PR author.

  • Head unchanged: 653fbddb34e5bc4f989f7b1330e686619f91564f; no source, test, threshold, or server argument modifications.
  • RL attempt: test/registered/rl/test_weight_version_spans.py, two NVIDIA B200 GPUs, lmsysorg/sglang:latest, original TP=2 / DP=2 / EAGLE configuration. H100/H200 capacity was unavailable; the earlier 4090 was released before this allocation.
  • Result: 24 setup errors, 0 test bodies executed. The server failed to download lmsys/sglang-ci-dsv3-test/resolve/main/config.json with HTTP 401 Unauthorized. The model was absent from the shared cache. This is an environment/access blocker, not evidence of an RL assertion failure or successful feature coverage.
  • Reproduction: HF_HOME=/scratch/pr44164-hf timeout 1800 python -m pytest -q -s test/registered/rl/test_weight_version_spans.py --junitxml=/scratch/pr44164-rl.xml.
  • Artifacts: /Volumes/MyExternal/domains/agent-default/artifacts/sglang/2026-10-14-pr44164-validation/rl.log, rl-xml-env.log, rl-environment.log, and rl-sync.log (local retained artifacts, not public CI downloads).
  • Merge recommendation remains no: the independently reproduced unit failures still need correction; RL coverage remains missing; the main maintenance gate also blocks CI for this deliberately sglang-miles-based PR. No bypass label or base change was applied.

Add optional per-slot KV weight-version tracking and expose run-length encoded prompt provenance through generation metadata, including cache reuse and abort responses.

Capture target write locations and serving versions alongside routed-expert capture. Carry records through the same result paths and finalize them beside routed-expert and indexer outputs after their existing synchronization.

Centralize optional tracker creation and reject encoder-decoder, embedding/reward, and pipeline-parallel configurations when enabled. Include unit coverage and speculative multi-turn cache-reuse assertions.

Align regression tests with the existing merged IPC role field and session-end version publication contract. Keep strict schema and pre-publication assertions. Limit long test generations to 3072 tokens so prompt plus completion fits the 4096-token CI model context; retain all boundary and abort assertions.

Validated on two H200 GPUs: 263 unit tests and 24 RL tests passed, including EAGLE, DP Attention, and multi-turn prefix reuse.
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles-repo-sglang/deliver-3 branch from 653fbdd to 99d65b8 Compare October 14, 2026 02:59
@fzyzcjy

fzyzcjy commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

AI-assisted follow-up (Codex), requested by the PR author.

  • Amended and pushed: 99d65b886cdbe7675705082d5007c6d900e08cf2; the PR still contains one commit onto sglang-miles.
  • Incremental fix: only test/registered/unit/managers/test_scheduler_weight_version_tracking.py, +2/-1. The fixture now supplies tree_cache.flush_pending_backups, sharing that cache with SchedulerBatchResultProcessor. No production changes, assertion removals, threshold changes, skip additions, or altered scenarios.
  • Remote targeted regression: the three previously failing parent methods now pass: 3 passed, 2 subtests passed.
  • Remote final run: all original 12 changed unit-test files rerun at the new head: 424 passed, 38 skipped, 129 subtests passed, 0 failures. All 38 skips require MLX; no Apple backend coverage is claimed.
  • Environment: one RTX 4090, lmsysorg/sglang:latest, exact committed source synced using tom-remote; the resource has been unbound and released. The changed test's remote and local SHA-256 is a0b8d442378d71a78280f5251566f0e021b175074cb23ca412d72aaa21280f73.
  • Lint: all applicable hooks passed for the modified test file. Full-repository pre-commit run --all-files was attempted but cannot be reported green: local environment lacks PyYAML/Rust tooling. The targeted lint rerun used a temporary uv environment with PyYAML. No lint changes were produced.
  • Remaining limits: RL was not rerun for this fixture-only amendment. Its prior two-GPU attempt was blocked by HTTP 401 fetching the required model, with zero test bodies executed. The separate CI maintenance gate remains unresolved; this is not an all-CI-green or full merge-gate PASS claim.
  • Retained evidence: /Volumes/MyExternal/domains/agent-default/artifacts/sglang/2026-10-14-pr44164-validation/fixture-targeted.log, fixture-full.log, fixture-xml-status.log, fixture-sync.log, and fixture-pre-commit*.log. These local artifacts contain exact commands and test output; they are not public CI downloads. Remote git status hit the image's ownership check; source identity is supported by clean local commit + sync record + matching test hash, not a claim that the image's Git metadata equals the PR head.

Reproduce the focused regression at the new head:

python -m pytest -q \
  test/registered/unit/managers/test_scheduler_weight_version_tracking.py::TestSchedulerBatchWeightVersion::test_pending_result_uses_version_captured_when_batch_ran \
  test/registered/unit/managers/test_scheduler_weight_version_tracking.py::TestSchedulerBatchWeightVersion::test_result_copy_finishes_before_slot_indices_are_consumed \
  test/registered/unit/managers/test_scheduler_weight_version_tracking.py::TestSchedulerBatchWeightVersion::test_spec_decode_does_not_restamp_restored_prefill_slots

@fzyzcjy
fzyzcjy merged commit f312781 into sglang-miles Oct 14, 2026
69 of 80 checks passed
@fzyzcjy
fzyzcjy deleted the tom/refactor-miles-repo-sglang/deliver-3 branch October 14, 2026 03:02
guapisolo pushed a commit that referenced this pull request Oct 15, 2026
Cherry-picked from sglang-miles (f312781). Miles main reads
--sglang-enable-prefill-weight-versions on every rollout, and only an
import block in test_scheduler_weight_version_tracking.py conflicted.
nv-hwoo pushed a commit to nv-hwoo/sglang that referenced this pull request Oct 20, 2026
nanjiangwill pushed a commit to modal-projects/sglang that referenced this pull request Oct 21, 2026
… metadata (sgl-project#44164)

(cherry picked from commit 36b1d3b)

(conflict resolved: io_struct.py AbortReq keeps only prefill_weight_versions; the prefix field belongs to c40cd81, which is not picked)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VDwTQn4gGFgVhzGXFs4aJx
nanjiangwill pushed a commit to modal-projects/sglang that referenced this pull request Oct 21, 2026
… metadata (sgl-project#44164)

(cherry picked from commit 36b1d3b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VDwTQn4gGFgVhzGXFs4aJx
nanjiangwill pushed a commit to modal-projects/sglang that referenced this pull request Oct 29, 2026
…lative truncation (sgl-project#43387)

Conflict resolved by hand: test/registered/unit/managers/test_batch_result_processor_spec_grammar.py, imports only; sglang-miles [41/42]
(sgl-project#44164) added the KvWeightVersionTracker import where this commit adds
release_kv_cache and get_context, and all three are kept.

(cherry picked from commit 86e67f7)
Claude-Session: https://claude.ai/code/session_01VDwTQn4gGFgVhzGXFs4aJx
nanjiangwill pushed a commit to modal-projects/sglang that referenced this pull request Oct 29, 2026
…lative truncation (sgl-project#43387)

Conflict resolved by hand: test/registered/unit/managers/test_batch_result_processor_spec_grammar.py, imports only; sglang-miles [41/42]
(sgl-project#44164) added the KvWeightVersionTracker import where this commit adds
release_kv_cache and get_context, and all three are kept.

(cherry picked from commit 86e67f7)
Claude-Session: https://claude.ai/code/session_01VDwTQn4gGFgVhzGXFs4aJx
nanjiangwill pushed a commit to modal-projects/sglang that referenced this pull request Nov 1, 2026
…lative truncation (sgl-project#43387)

Conflict resolved by hand: test/registered/unit/managers/test_batch_result_processor_spec_grammar.py, imports only; sglang-miles [41/42]
(sgl-project#44164) added the KvWeightVersionTracker import where this commit adds
release_kv_cache and get_context, and all three are kept.

(cherry picked from commit 86e67f7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apple-silicon documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant