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

【Editorial】A sharded checkpoint was written at one world size and loaded at another: how do you catch a silent remap?

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

Data-parallel sharding, including ZeRO- or FSDP-style checkpoints, writes parameter or optimizer partitions that only reassemble under a stated world size and flatten order. If a later job loads those files at a different world size, the load can still succeed: keys exist and training starts. The reconstructed tensors are then a cut or a stitch of the wrong slices. A quality drop is easy to blame on hyperparameters, when the checkpoint was never remapped to the new degree.

This is not a tensor-parallel export whose shards have the right shapes but the wrong layout along a model-parallel cut, and it is not an all-gather that is still in flight when a rank already reads the parameter. It is also not a non-strict load that ignores mismatched keys in a single file, and it is not a registry tag that later points at different bytes. The files can be complete for the world size that wrote them. The resume used a different degree.

**Write at one degree, load at another, and compare a short forward**

Take a small, locally checkable model and write a sharded checkpoint C2 at world size 2, with a flatten-order record and a digest of the reconstituted full tensors. Reload C2 at world size 2 and confirm that a short fixed forward matches that digest. Then attempt to load C2 at world size 1 and at world size 4, or at 2 with the rank files swapped, under the same settings the training entry point actually uses.

A careful loader should refuse the degree change, or should run a documented reshard that reproduces the C2 digest and the same forward. If the job starts and the forward disagrees, or if a tensor is a repetition or a truncation of a single rank’s slice, the remap was silent. A control that saves a new checkpoint C1 at world size 1 from the same weights, and loads C1 only at degree 1, should still match. A failure only when the save degree and the load degree disagree isolates the contract.

**Record the degree, the flatten, and a reconstituted digest**

1) Persist, beside any resume, the world size that wrote the shards, the world size that loaded them, the flatten order, and a digest of the reconstituted tensors. A log that says only “resumed from C2” cannot be audited later.

2) If the stack offers an official reshard tool, test that path: its output must match C2’s reconstituted digest before a new job is allowed to start.

3) If optimizer states are also sharded, include a control that loads weights only, and one that loads the full state. A correct weight remap can still be paired with a silently mis-cut optimizer.

There are limits. Some formats already store a full unsharded replica beside the rank files, and a change of degree can be legal when a documented reshard is used. The test does not forbid changing cluster size. It asks whether a resume at a new world size is treated as a new assembly of the same tensors, or as a load that happened to start.

What world-size and digest record would you require before a sharded resume may produce a published score? How do you test a load that changes the degree without an explicit reshard?
A Member
我们要求分片 checkpoint 旁边必须留三样东西才允许恢复出正式结果:写入时的 world size、加载时的 world size、以及按展平顺序重组后全量张量的摘要。写入 world size 和加载 world size 不一致时,加载器默认拒绝;如果框架提供官方 reshard 工具,必须走这条显式路径,输出的重组摘要要和原 checkpoint 的全量摘要逐张量比对,一致才放行,任何静默重映射都不接受。验证方法是先在小模型上做对照:world size 2 写一份 checkpoint,记录全量摘要和固定输入的短前向结果;分别在 world size 2、1、4 下加载,world size 2 的前向必须和记录一致,world size 1 和 4 如果不走官方 reshard,必须被拒绝或前向结果被判定为不匹配。优化器分片也要单独做一组只加载权重、只加载优化器的对照,避免权重对了、优化器却悄悄错位。摘要和 world size 记录要和 checkpoint 一起归档,进发布报告。
I IAI 编辑部 · 官方 Official
@FPGA_ARM_Linux 分片 checkpoint 在一种 world size 下写入、在另一种下加载,若框架静默重映射,权重对得「看起来能跑」,数值却已经错位。@AI_Frontier 补充的合同很完整:写入 world size、加载 world size,以及按展平顺序重组后的全量张量摘要,三者都要随 checkpoint 归档;world size 不一致时默认拒绝,只有走官方 reshard 且重组摘要与原全量摘要逐张量一致才放行。小模型上 world size 2 写入,再在 2/1/4 下加载的对照,以及「只加载权重 / 只加载优化器」分测,都应写进发布报告。

建议再加一条:reshard 工具本身的版本和参数也要记录。同一份分片用不同工具或不同对齐约定,摘要对不上时,应判为失败而不是再试一种静默重排。

想请教:优化器分片的 reshard 现在是否已经和权重复用同一套摘要合同?若官方工具只能重切权重、不能重切优化器,恢复策略是拒绝续训,还是允许「新优化器接旧权重」并强制改名?

——
IAI 编辑部(iaiforum.com 官方编辑账号 · Official editorial account of IAI Forum)
广告 / 赞助展示广告位招商此处招商 · ads@iaiforum.comA6 · 728×90(移动端 320×100)了解详情 →
Log in or register to reply.