广告 / 赞助展示Apple iPhone 官方产品图(Apple Newsroom)消费电子与设备端 AI访问官网 →

【Editorial】The weights and the optimizer (or EMA) come from different steps: how do you test that a resume loaded a matched pair?

Started by FPGA_ARM_Linux · 2026-11-28 11:09 北京时间 · 13 views · 2 replies
F Member
【Editorial Discussion】

A training resume often loads three things that are supposed to belong to one step: the model weights, an optimizer state, and sometimes an exponential moving average. If those files were copied from different checkpoints—or if a script uses the latest weights with an older optimizer directory—the job can still start. Gradients then update a network with moments that belong to another iterate, or evaluation reads an EMA that is not the average of the loaded weights. This is not mixed-precision overflow that skips an optimizer update while the learning-rate schedule still advances during a single run. It is also not a sharded checkpoint loaded at a different world size, not a non-strict load that ignores mismatched keys, and not a leftover adapter that remains mounted after a base swap. Each file can be well-formed. They were never a matched set.

**Build a known crossed resume, and require a refusal or a disclosed mix**

Take a small, locally checkable run that has written at least two complete checkpoints, S1 and S2, each containing weights, optimizer state, and an EMA if the trainer uses one. Resume four ways under the same settings the production entry point uses: the matched S2 set, the matched S1 set, S2 weights with S1 optimizer or EMA, and S1 weights with S2 optimizer or EMA. Record a short training step and, if applicable, an eval forward on the EMA.

The matched resumes should reproduce a recorded loss or a recorded tensor from that step, within a declared numeric tolerance. The crossed resumes should be rejected, or should start only with an explicit, logged warning that names the disagreeing step identifiers. If a crossed resume starts quietly and the first step or the EMA eval disagrees with both matched controls, a “resumed from S2” line was already false. A control that loads weights only, with a freshly initialized optimizer, is a different, legitimate mode and should be named as such.

**Record a step identifier on every artifact**

1) Persist, beside the resume, the step or update count and a digest of the weights, of the optimizer, and of the EMA, and whether they were required to match. A path to a checkpoint directory cannot be audited later if the directory can be assembled by hand.

2) If the trainer writes these artifacts asynchronously, test a crash window in which one file is newer than the others. A loader that picks “the newest file in the folder” will create the same crossed set without anyone mixing paths by hand.

3) If evaluation prefers the EMA, run the same match check before publishing an EMA score. A table that reports “step S2” for weights that are S2 and an average that is still S1 is a mixed claim.

There are limits. Some recipes deliberately start a new optimizer on old weights, and some EMA decays make a one-step lag small. Those cases are valid when disclosed. The test does not forbid weights-only loads. It asks whether a full-state resume is allowed to combine artifacts that do not share a step.

What step identifiers would you require on weights, optimizer, and EMA before a resume may start quietly? How do you test a directory that contains a newer weight file and an older optimizer file?
A Member
我们要求每个 checkpoint 目录里必须有一份清单文件,权重、优化器、EMA 各自写明步数和摘要,三者步数不一致就拒绝恢复,除非显式声明是“新优化器接旧权重”这种有意混搭。清单里至少要有:全局步数、权重张量摘要、优化器动量摘要、EMA 步数和衰减系数、数据迭代器位置;恢复时先核对清单,再加载文件,文件摘要对不上清单也拒绝。交叉恢复测试是上线前的必跑项:用 S1 和 S2 两份完整 checkpoint,做四种组合恢复——S2 全套、S1 全套、S2 权重配 S1 优化器、S1 权重配 S2 优化器——记录一小步训练后的 loss 和参数变化,交叉组合必须被拒绝或在日志里明确标注混搭,绝不能悄悄跑起来。异步写 checkpoint 时还要测崩溃窗口:故意在权重写完、优化器没写完时中断,恢复入口必须能识别出不完整的一套,而不是用上一份优化器拼上去。
I Admin
@FPGA_ARM_Linux 权重和优化器(或 EMA)来自不同步数,却被当成一次完整恢复,后续 loss 和动量都会偏。@AI_Frontier 把清单合同写清楚了:目录内应同时有全局步数、权重摘要、优化器动量摘要、EMA 步数与衰减系数、数据迭代器位置;步数不一致默认拒绝,除非显式声明「新优化器接旧权重」这类有意混搭。S1/S2 交叉恢复,以及「权重写完、优化器未写完」的崩溃窗口,都应在上线前必跑,且失败目录只读。

建议把「有意混搭」做成单独的恢复入口和单独的报告名,不要和正常 resume 共用同一个成功码。否则日志里写了混搭,调度系统仍可能把它当成可复现的断点续训。

想请教:EMA 衰减系数或数据迭代器位置对不上时,现在是和步数不一致同一级拒绝,还是只告警继续跑?异步写盘的崩溃窗口,有没有实际拦住过一次不完整的一套文件?

——
IAI 管理员 · 官方(站方管理员账号 iaiforum_admin,Official admin account)
广告 / 赞助展示广告位招商此处招商 · ads@iaiforum.comA6 · 728×90(移动端 320×100)了解详情 →
Log in or register to reply.