Haidass-Translate 实验记录
本仓记录 Haidass-Translate-143M 系列实验性训练版本的评测结果,与正式发布仓分离,供内部跟踪迭代。
v3(字幕手术 + 短句合成 + 错题本教师,4ep)
数据:cleaned_8m_v2 主数据 15 源(字幕手术版,净删 19.4 万对)+ 短句收尾合成 14.98 万对(Qwen3.6 生成)+ 错题本教师翻译 4,977 对,去重后 772.99 万对,双向展开训练 4 epochs(9,345 步,约 49 亿 tokens)。起步 loss 3.36,终 loss 1.69,全程 NaN 0 次,wall time 约 5 小时 13 分(16×Ascend910)。
成绩对比(sacrebleu,贪心解码,qwen3 chat 模板)
FLORES-200 dev(中英各 997 句):
| 模型 | en→zh BLEU | en→zh chrF++ | zh→en BLEU | zh→en chrF++ |
|---|---|---|---|---|
| v3(本实验) | 27.32 | 19.02 | 15.63 | 41.87 |
| 现役 4ep 基线 | 27.56 | 19.27 | 17.17 | 43.20 |
| 5ep 终版(参考) | 27.35 | 19.08 | 17.08 | 43.12 |
FLORES+ devtest(中英各 1012 句):
| 模型 | en→zh BLEU | en→zh chrF++ | zh→en BLEU | zh→en chrF++ |
|---|---|---|---|---|
| v3(本实验) | 27.98 | 19.19 | 15.46 | 41.78 |
| 现役 4ep 基线 | 28.48 | 19.45 | 17.01 | 42.69 |
| 5ep 终版(参考) | 26.97 | 19.02 | 16.80 | 42.63 |
短句压力测试(20 条手工用例,逐条见 v3_4ep/short_v3.log)
- ≤5 token 短句 10 条:全部正常收尾,未再出现不收尾(NO_STOP)或循环——此前版本的短句病理在压测口径下消除。
- 普通长度句 10 条:8 条正常,2 条出现循环不收尾(中英各一)。
- 需要说明:短句虽然都能停下来,但翻译质量仍不稳定(存在空输出、答非所问),短句合成数据解决了"停不下来",还没有解决"译得好"。
结论
v3 数据配方(字幕手术 + 短句合成 + 教师翻译):en→zh 与基线持平(BLEU 差 -0.2~-0.5),zh→en 回退约 1.5 BLEU(两个 benchmark 一致)。短句不收尾问题按设计目标修复,但综合成绩不支持替换现役 4ep 发版。zh→en 回退的归因候选:字幕手术删改了约 4% 语料(含大量短句)、合成短句的机器味目标侧、教师样本量过小(0.06%),需要消融确认,记入 v3.1 计划。
样例(FLORES-200 dev,src / ref / hyp)
en→zh:
Local media reports an airport fire vehicle rolled over while responding. ref:当地媒体报道,一辆机场消防车在响应火警时翻了车。 hyp:当地媒体报道,机场的消防车在反应后倒塌。
zh→en:
当地时间上午 9:30 左右 (UTC 0230),JAS 39C 鹰狮战斗机撞上跑道并发生爆炸,导致机场关闭,商业航班无法正常起降。 ref:The JAS 39C Gripen crashed onto a runway at around 9:30 am local time (0230 UTC) and exploded, closing the airport to commercial flights. hyp:JAS 39C aircraft crashed into the runway and exploded, resulting in the closure of the airport and the inability to operate commercial flights.
周一,斯坦福大学医学院的科学家宣布,他们发明了一种可以将细胞按类型分类的新型诊断工具:一种可打印的微型芯片。这种芯片可以使用标准喷墨打印机制造,每片价格可能在一美分左右。 ref:On Monday, scientists from the Stanford University School of Medicine announced the invention of a new diagnostic tool that can sort cells by type: a tiny printable chip that can be manufactured using standard inkjet printers for possibly about one U.S. cent each. hyp:On Monday, Stanford University scientists announced that they have developed a new diagnostic tool that can classify cells in a way that is not only accurate, but also cost-effective: a miniature chip that can be printed using standard inkjet printing.
产物
- v3_4ep/scores_v3.txt:双 benchmark 双向 BLEU/chrF++ 原始输出
- v3_4ep/pred_v3_flores_dev.jsonl、pred_v3_floresplus_devtest.jsonl:逐句预测(src/ref/hyp)
- v3_4ep/short_v3.log:短句压测逐条记录
- HF 权重:16 卡机 /mnt/data1/mzy/eval_v3/hf_ckpt_v3(tar 包 md5 9c0efd0cfdf90dc1beb4d0740a77b46a,本机 mzy 工作区有副本)
工具·8 卡并行评测管线(tools/eval_pool.sh)
NPU 多卡并行评测 143M 级 SFT 模型的生产管线,2026-09-21 在 8×Ascend 910B3 上验证。原理:submit 自动把单 ckpt 的双向评测拆成 <名>.en-zh / <名>.zh-en 两个方向 job(eval_translate.py --direction),文件系统队列(pending/ → running/ → done|failed/,mkdir 原子抢占)调度到不同卡并行,后完工的 worker 原子合并两半预测并算分;每个 worker 绑死一张卡,支持每卡多实例。单 ckpt dev 墙钟 ~13min → ~7min,且分片合并结果与单进程逐字节一致(SHA-256 对拍验证)。
用法
eval_pool.sh submit <job名> <hf_dir> <think|htf> # HF 权重已就绪
eval_pool.sh submit-a3 <job名> <iter> <a3_ckpt目录> <think|htf> # 自动 scp+转HF+入队
eval_pool.sh submit-local <job名> <iter> <本地ckpt根目录> <think|htf>
eval_pool.sh start "0 1 2 3 4 5 6 7" 2 # 8 卡 × 2 实例 = 16 并发(默认配置)
eval_pool.sh status / results # 进度 / 分数汇总
环境变量可覆盖:EVAL_ROOT(工作区)、EVAL_DOCKER(容器名)、EVAL_A3_HOST、EVAL_SSH_KEY、EVAL_BATCH(不建议动)。
实测吞吐(143M 模型,dev 1994 句双向,910B3)
| 方案 | 单任务耗时 | 相对吞吐 |
|---|---|---|
| 独占 1 卡 batch 32(数值契约基准) | 548s | 1× |
| 方向分片(en→zh / zh→en 拆 2 卡并行,单 ckpt) | ~420s | 单任务墙钟减半 |
| 8 卡 × 1 实例 | 548s | 8× |
| 8 卡 × 2 实例(同卡并发各慢 ~18%) | ~650s | ~13.7× |
| batch 128 | 330s | 禁用(见下) |
tools/eval_translate.py 为配套生成脚本(pool worker 实际调用),单独使用时 --direction en-zh|zh-en 可只跑单方向,--rep-penalty / --no-repeat-ngram 控制解码,每个 pred 文件自动带 genconfig 旁车快照。
数值契约(都有实锤,勿违反)
- batch 固定 32:batch 32→128 时 1994 句预测变 1119 句(en→zh −0.10 / zh→en +0.24 BLEU),与历史分数不可比。提速只从实例并行来。
- 同卡多实例安全:同 ckpt 卡 2 双实例并发 vs 卡 0 独占,三方预测文件 SHA 完全一致。并发只争算力,不改数值。
- 跨卡一致:4 ckpt ×(卡 0 双跑 + 卡 1 单跑)12 组预测 SHA 全 SAME,跨卡贪心抖动不存在,但逐档对比仍建议固定同一张卡。
- greedy 口径:
do_sample=false, num_beams=1, min_new_tokens=0, repetition_penalty=1.0,EOS/pad 用模型实际值;每个 pred 文件带 genconfig 旁车。