执行摘要
回退 WNA16 MoE oracle 迁移重构
PR body 指出 int_wna16.py got merged incorrectly in #42647,因此需要 back out the PR 以便修复后重新提交。
该 PR 是修复性回退,值得相关人员了解合并过程中出现的问题,但普通使用者无需深究。关注后续意图为正确合并的重新提交。
没有实质性的 review 讨论。DarkLight1337 批准了该回退 PR,未留下评论。
PR body 指出 int_wna16.py got merged incorrectly in #42647,因此需要 back out the PR 以便修复后重新提交。
该 PR 是修复性回退,值得相关人员了解合并过程中出现的问题,但普通使用者无需深究。关注后续意图为正确合并的重新提交。
没有实质性的 review 讨论。DarkLight1337 批准了该回退 PR,未留下评论。
moe_wna16.py:移除对 select_wna16_moe_backend 等 oracle 函数的导入和调用,恢复原有的直接根据 weight_bits 构造 QuantKey 和配置的方法;删除 process_weights_after_loading 方法(约 150 行删除)。
int_wna16.py:简化 _get_priority_backends,移除 may_have_zp、may_have_bias 参数,同时将 TRITON backend 从枚举和选择路径中移除(删除约 91 行)。
auto_gptq.py:移除 replace_or_register 辅助函数,将其逻辑内联为多个条件性的 replace_parameter 调用;不再传递 may_have_zp、may_have_bias 给 select_wna16_moe_backend。
triton_moe.py:将 TritonWNA16Experts 的各支持方法改为直接 raise NotImplementedError,表明该类不再被 oracle 使用。
compressed_tensors_moe_wna16_marlin.py:用基于后端比较的方式替换 is_marlin 属性,调整 is_transposed 和 process_weights_after_loading 中的后端判断逻辑。
其他文件:fused_moe.py 删除对 int_wna16 的导入;awq_marlin.py 删除 WNA16MoEBackend 导入;gptq_utils.py 删除 flatten_list 函数及使用处。
| 文件 | 模块 | 状态 | 重要度 |
|---|---|---|---|
vllm/model_executor/layers/quantization/moe_wna16.py |
MoE 量化 | modified | 8.45 |
vllm/model_executor/layers/fused_moe/oracle/int_wna16.py |
MoE oracle | modified | 7.88 |
vllm/model_executor/layers/quantization/auto_gptq.py |
量化核心 | modified | 7.68 |
vllm/model_executor/layers/quantization/utils/gptq_utils.py |
工具函数 | modified | 7.38 |
vllm/model_executor/layers/fused_moe/experts/triton_moe.py |
专家层 | modified | 7.22 |
vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe/compressed_tensors_moe_wna16_marlin.py |
量化压缩 | modified | 6.43 |
vllm/model_executor/layers/fused_moe/fused_moe.py |
MoE 融合 | modified | 6.02 |
vllm/model_executor/layers/quantization/awq_marlin.py |
AWQ 量化 | modified | 5.17 |
vllm/model_executor/layers/quantization/moe_wna16.py
data-contract
最核心变更文件,删除了 150 行 oracle 相关调用,恢复了原有的量化权重初始化逻辑。
# moe_wna16.py 回退后的 MoeWNA16Method 类核心部分
class MoeWNA16Method(FusedMoEMethodBase):
def __init__(self, quant_config: MoeWNA16Config, moe: "FusedMoEConfig") -> None:
super().__init__(moe)
self.quant_config = quant_config
# 回退后不再通过 oracle 选择后端,直接保存 quant_config
def create_weights(self, layer, num_experts, hidden_size,
intermediate_size_per_partition, params_dtype,
**extra_weight_attrs):
# 直接使用 quant_config 中的参数构建量化权重,不再依赖 oracle
layer.quant_config = self.quant_config
bit8_pack_factor = self.quant_config.bit8_pack_factor
group_size = self.quant_config.group_size
# ... 后续权重创建逻辑略
vllm/model_executor/layers/quantization/auto_gptq.py
data-contract
移除 replace_or_register 辅助函数,将逻辑内联,直接使用 replace_parameter 和 register_parameter。
# auto_gptq.py 回退后 AutoGPTQMoEMethod.process_weights_after_loading 中的内联替换
# 之前使用 replace_or_register 辅助函数,现在直接内联
if w13_input_global_scale is not None:
if hasattr(layer, "w13_input_global_scale"):
replace_parameter(layer, "w13_input_global_scale", w13_input_global_scale)
else:
layer.register_parameter(
"w13_input_global_scale",
torch.nn.Parameter(w13_input_global_scale, requires_grad=False),
)
# 类似处理 w2_input_global_scale, w13_bias, w2_bias 等
当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。
此回退的潜在风险包括:丢失了 #42647 中 oracle 架构带来的后端选择灵活性和性能优化(如 FlashInfer Monolithic 支持),可能导致某些场景下性能回退。此外,回退本身没有附带新的测试覆盖,需依赖后续重新合并时的正确性验证。
对用户的直接影响是使用 WNA16 (W8A16/W4A16) 量化的 MoE 模型将回退到旧的量化逻辑,后端选择改为静态优先级(FlashInfer > Marlin > BatchedMarlin),不再根据是否含 zero-point 或 bias 动态调整。同时,TritonWNA16Experts 在 oracle 路径中被暂停使用。对团队而言,需要尽快修复合并问题并重新提交。
当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。
参与讨论