Skip to content

[2/N][Sync sglang-miles] Support INT4 QAT for RL - #23701

Closed
zyzshishui wants to merge 4 commits into
sgl-project:mainfrom
zyzshishui:qat
Closed

[2/N][Sync sglang-miles] Support INT4 QAT for RL#23701
zyzshishui wants to merge 4 commits into
sgl-project:mainfrom
zyzshishui:qat

Conversation

@zyzshishui

@zyzshishui zyzshishui commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Motivation

Synced from https://github.com/sgl-project/sglang/pull/18639 and add tests with super tiny fix

Modifications

  • Add post-process weights API path for restoring weights and running quantization post-processing after weight updates.
  • Support asymmetric WNA16 compressed-tensors QAT wiring, including zero-point handling for Marlin MoE.
  • Explicitly reject unsupported asymmetric WNA16 Triton MoE path.

Accuracy Tests

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 026995f3fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1227 to +1228
@app.post("/post_process_weights")
async def post_process_weights(req: PostProcessWeightsReqInput, request: Request):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add admin auth to post-process weights endpoint

This route mutates model weights but is missing @auth_level(AuthLevel.ADMIN_OPTIONAL), so it falls back to AuthLevel.NORMAL. In the current auth logic, NORMAL endpoints are allowed without credentials when only admin_api_key is configured, which means an unauthenticated caller can trigger weight post-processing/restore operations and disrupt serving.

Useful? React with 👍 / 👎.

Comment on lines +3251 to +3253
if quant_method is not None and hasattr(
quant_method, "process_weights_after_loading"
):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid reprocessing all quantized modules indiscriminately

This applies process_weights_after_loading to every module that exposes it, but many quantization schemes are not idempotent (for example, compressed-tensors linear paths convert parameter types/layouts and expect load-time structures on first pass). Calling this endpoint after normal startup/update can therefore assert or repack already-converted weights, leading to failures or corrupted outputs unless processing is limited to modules explicitly restored to load format.

Useful? React with 👍 / 👎.


def post_process_weights(self, recv_req: PostProcessWeightsReqInput):
"""Optional post-processing for updated weights (e.g., Marlin conversion)."""
success, message = self.tp_worker.post_process_weights(recv_req)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Post-process the same worker targeted by tensor updates

The new post-process path always runs on tp_worker, but tensor updates can target draft_worker when draft mode is enabled and disable_draft_model is unset/false. In that common flow, updated draft weights never receive the required post-processing, leaving draft execution with stale/incompatible weight layout.

Useful? React with 👍 / 👎.

@zyzshishui zyzshishui closed this Aug 3, 2026
@zyzshishui
zyzshishui deleted the qat branch August 3, 2026 20:23
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