执行摘要
本PR通过新增VLM TP=4 CI测试和优化MMMU评估prompt与解析器,显著提升多模态测试覆盖和评估准确性,将准确率从约0.34提升至0.75-0.78,延迟从145秒降低至28秒,为VLM开发提供更可靠的测试基准。
功能与动机
动机源于填补4-GPU测试套件中VLM测试的空白,并改进MMMU评估的准确性和效率。PR body明确指出:"Add Qwen3.5-27B VLM TP=4 MMMU test to stage-c-test-4-gpu-h100 per-commit CI (previously no VLM tests in any 4-GPU suite)"和"Improve MMMU eval prompt... to increase accuracy from ~0.34 to ~0.75-0.78"。这些变更参考了Kimi-Vendor-Verifier的CoT指令格式,旨在标准化答案提取。
实现拆解
主要改动集中在两个文件:
- python/sglang/test/simple_eval_mmmu_vlm.py:
-
解析器优化:在_parse_multi_choice_response函数中添加正则表达式匹配,优先查找"Answer: X"模式:
answer_matches = re.findall(r"[Aa]nswer\\s*:\\s*\\*?\\*?\\s*\\(?([A-Z])\\)?", response)
if answer_matches:
candidate = answer_matches[-1]
if candidate in all_choices:
return candidate
-
test/registered/vlm/test_vlm_tp4.py:
- 新增测试类
TestVLMTP4,配置Qwen3.5-27B模型在TP=4下运行,设置服务器参数并执行MMMU评估。
- 关键参数包括
--tp-size 4和准确性阈值验证(MMMU_ACCURACY_THRESHOLD = 0.65)。
评论区精华
gemini-code-assist[bot]在review中提出两点改进:
"The regex is currently case-sensitive for the answer letter ([A-Z]). While the prompt instructs the model to use a specific format, models may occasionally output lowercase letters (e.g., Answer: a). Making this check case-insensitive would improve the robustness of the parser."
"These arguments (--mamba-*) are specific to Mamba/SSM architecture models. Since Qwen3.5 is a Transformer-based model, these flags are irrelevant and should be removed to avoid confusion and ensure the configuration is clean."
这些建议聚焦于正确性和设计优化,可能已在合并前采纳,以增强代码健壮性和可维护性。
风险与影响
- 风险:解析器变更可能意外影响其他依赖MMMU评估的测试,如果正则表达式未完全覆盖模型输出变体,可能导致解析失败。新增CI测试可能增加运行时资源消耗,影响CI流水线效率。prompt指令的普适性有限,可能不适用于所有VLM模型。
- 影响:正面影响显著,提升了VLM测试的全面性和评估准确性,为团队提供了更可靠的性能基准;负面影响可控,但需监控CI稳定性和评估一致性。
关联脉络
从历史PR看,本PR是VLM和多模态测试演进的一部分:
- PR 21767:添加VLM相关CI测试,扩展量化模型覆盖,与本PR共同完善测试基础设施。
- PR 21873:优化评估测试的网络超时设置,与本PR的评估逻辑改进相辅相成,提升测试鲁棒性。
这些关联显示团队在持续增强多模态测试的覆盖和可靠性,为未来功能开发奠定基础。
参与讨论