You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: validate quantization methods before startup - #1666
Quantization options are now listed according to the selected hardware platform in the command-line interface.
Quantization methods can be loaded on demand, with supported options filtered by platform.
Bug Fixes
Server startup now validates text and vision quantization settings before proceeding.
Invalid methods and malformed or unreadable configuration files return clearer errors, including the relevant command-line option or configuration location.
The quantization registry now stores method paths and imports classes when requested. New configuration validation checks quantization types and YAML structure. CLI arguments use registered methods as choices, and server startup validates both quantization configurations for the selected platform.
The registry stores method paths, lists and validates registered methods, and imports method classes on lookup. Quantization modules no longer register methods through decorators. Tests cover lazy imports and no-quantization lookup.
Configuration loading and validation lightllm/common/quantization/__init__.py, unit_tests/server/test_quantization_start_args.py
load_quant_config validates quantization types, YAML structure, mixed-bit entries, and file errors. _parse_custom_cfg uses the helper. Tests cover invalid configurations, file errors, and mixed-config precedence.
CLI and server startup validation lightllm/server/api_cli.py, lightllm/server/api_server.py, unit_tests/server/test_quantization_start_args.py
CLI choices use registered quantization methods. Server startup validates both quantization configurations for the selected platform. Tests cover CLI rejection and MUSA startup cases.
sequenceDiagram
participant api_cli
participant QUANTMETHODS
participant launch_server
participant load_quant_config
api_cli->>QUANTMETHODS: list supported methods for CLI choices
api_cli->>launch_server: pass parsed arguments
launch_server->>load_quant_config: validate quantization type and configuration
load_quant_config->>QUANTMETHODS: validate method for hardware platform
Loading
Suggested reviewers:shihaobai, hiworldwzj
Merge Risk: Minimal · up to 8e196
No actionable merge-blocking issue is established for this change; it is mergeable after normal checks.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: validating quantization methods before service startup.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 14 functions across 5 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
非法量化名称在参数解析时直接报错;启动入口按
--hardware_platform校验 LLM、ViT 及混合量化 YAML,参数先后顺序不影响结果。结构检查覆盖必填字段、mix_bits条目和layer_nums,错误包含选项、文件路径和条目位置。YAML 覆盖命令行时只校验最终采用的配置,文件读取失败也会附加选项和路径上下文。名称、别名及配置优先级保持不变,量化实现按需加载。相关回归 159 项、Black、Flake8 通过。另验证了 8 个真实 CLI 用例,覆盖文件读取失败、YAML 覆盖和无 YAML 时的平台拒绝。GPU 可见环境下,5 个真实 CLI 负例均在启动服务前拒绝,覆盖错误方法、缺失 name、null layer_nums 和 MUSA/CUDA 方法不匹配。
以下 GPU 矩阵对应提交
2efe81df2;后续提交仅修正配置校验和错误上下文,未重跑 GPU 矩阵。本地 GPU 4–7,4 张 H200,torch 2.9.1 / CUDA 12.8,Qwen3.5-0.8B BF16 checkpoint,TP1、仅文本。每种配置完成同一组 GSM8K 200 题,5-shot、并发 8,decode graph 开启、prefill graph 关闭:
原基线
7184978的 BF16、Triton per-tensor、混合配置在相同 200 题上准确率分别也是 32.5%、30.0%、31.5%,但并发逐题文本并非完全一致。进一步固定并发 1、关闭 CUDA Graph、linear_att_hash_page_size=4096,BF16 和 Triton per-tensor 各 32 题的 PR/基线文本分别 32/32 完全一致,启动探针的逐 token logprob 也一致。全局
fp8w8a8-b128-triton在 Qwen3.5 的linear_in_proj预热触发triton.cdiv(N, block_n) == Bscale.shape[1]断言;原基线相同参数同处复现,该项未通过。本轮为抽样 GPU 验证,未做全量 GSM8K 或全词表 logits 对拍;MUSA 覆盖仅限配置校验。接替 #1663,代码提交保持一致;此前审查记录保留在原 PR。
Summary by CodeRabbit