[2/N][Sync sglang-miles] Support INT4 QAT for RL - #23701
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
💡 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".
| @app.post("/post_process_weights") | ||
| async def post_process_weights(req: PostProcessWeightsReqInput, request: Request): |
There was a problem hiding this comment.
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 👍 / 👎.
| if quant_method is not None and hasattr( | ||
| quant_method, "process_weights_after_loading" | ||
| ): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 👍 / 👎.
Motivation
Synced from https://github.com/sgl-project/sglang/pull/18639 and add tests with super tiny fix
Modifications
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci