已合并
[Bugfix] 修复多模态tokenizer特殊token拆分逻辑,避免恶意token导致服务异常 #928
muziyuhui666创建于 4月21日
[Bugfix] 修复多模态tokenizer特殊token拆分逻辑,避免恶意token导致服务异常 #928
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 muziyuhui666 的贡献)4月21日 添加了label:stat/needs-squash
ascend-robot
4月21日 评论:
4月21日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/MindIE-LLM | ✅ 陈歆怡, xsxhw1 (2/2) | ✅ 陈歆怡 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
muziyuhui666, thanks for your pull request. All authors of the commits have signed the CLA. 👍


4月21日 添加了label:ascend-cla/yes
4月21日 添加了label:needs-issue
ascend-robot
4月21日 评论:
4月21日 评论:
Linking Issue Notice
@muziyuhui666 , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .


此处折叠了142条消息 查看更多
4月23日 删除了label:ci-pipeline-passed
4月23日 添加了label:ci-pipeline-running
4月24日 删除了label:ci-pipeline-running
4月24日 添加了label:ci-pipeline-passed
ascend-robot
4月24日 评论:
4月24日 评论:
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_ops_x86_A3 | ✅ | >>> |
| Build_ops_arm_A3 | ✅ | >>> | |
| Build_ops_x86_A2 | ✅ | >>> | |
| Build_ops_arm_A2 | ✅ | >>> | |
| Build_linux_x86_abi1_atb | ✅ | >>> | |
| Build_linux_x86_abi1_llm | ✅ | >>> | |
| Build_linux_arm_abi1_atb | ✅ | >>> | |
| Build_linux_arm_abi1_llm | ✅ | >>> | |
| Build_linux_arm_abi0_atb | ✅ | >>> | |
| Build_linux_arm_abi0_llm | ✅ | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | pre-commit | ✅ | >>> |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_linux_arm_mindie-llm | ✅ | >>> |
| UT_linux_arm_atb-models | ✅ | >>> | |
| 流水线 | PR-pipeline_MindIE-LLM_gitcode | ✅ | >>> |


合入背景
针对多模态模型服务化场景,发现
/v1/completions接口在输入恶意多模态特殊token时存在稳定性风险,可能导致推理服务异常退出(DoS现象)。本PR用于修正多模态/纯文本模型在 tokenizer 特殊token拆分行为上的判定来源,避免通过不稳定路径触发子进程崩溃。
Fix part of #536
修改内容
BaseRouter中新增统一能力标识is_multimodal(默认False)。is_multimodal=True(如 qwen2_vl、qwen3_vl、internvl、llava、llava_next、vita、glm4v、glm41v、qwen2_audio、minicpm_qwen2_v2、mllama、internlmxcomposer2、janus、yivl 等)。TokenizerWrapper中读取router_ins.is_multimodal,并据此设置split_special_tokens,统一多模态与纯文本模型行为。model_cls/load_atb_speed()的不稳定路径,避免 tokenizer worker 初始化阶段出现崩溃风险。资料变更
不涉及。
接口变更
不涉及跨代码仓或客户面可见接口变更。
本PR仅调整内部路由能力标记与 tokenizer 参数传递逻辑,对外REST/gRPC接口字段无新增、无删减、无语义变更。
测试结果
服务拉起测试
恶意请求稳定性测试
/v1/completions注入恶意多模态特殊token请求正常功能回归测试
chat/completions多模态请求、正常文本请求静态门禁测试
pre-commit run --files <changed files>CheckList