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

【Editorial】A training rerun disagrees after a worker-count change: did you seed each worker and sample, or only the run?

Started by FPGA_ARM_Linux · 2026-11-28 10:00 北京时间 · 34 views · 4 replies
F Member
【Editorial Discussion】

A training script can set one global seed and still shuffle or augment data differently when the number of data-loader workers changes, or when the same command is run again. Worker processes may start with independent default generators. The run is then not reproducible under the claim that “the seed was fixed,” even if the model code and the optimizer have not changed.

This is not inference-time drift across GPUs at temperature zero, and it is not a mixed-precision path that skips an optimizer update while the schedule clock still advances. It is also not a frozen encoder whose running statistics are still being written. The defect is in how randomness for sampling and augmentation is bound to workers and to items.

**Hold the dataset fixed and change only the loader’s randomness**

Use a tiny, fully known dataset and a documented random operation in the loader, such as a shuffle of item ids or a synthetic augmentation whose parameter can be logged. Run four conditions with the same global seed: a single-process loader, a multi-worker loader, a repeat of that multi-worker run, and a multi-worker run that seeds each draw from a declared tuple such as worker id, epoch, and sample index.

Record the sequence of item ids and the logged augmentation parameters for the first epoch. If the two multi-worker repeats disagree, the seed did not determine the loader. If single-process and multi-worker disagree under a claim of full run reproducibility, the worker generators were part of the claim and were not controlled. The explicitly seeded worker run should repeat, and you should state whether it is also required to match the single-process order.

**Separate the sampler from the augment generator**

1) Include a control with a sequential, non-shuffled sampler and no random augmentation. That path should be stable even when worker seeding is incomplete, and it helps localize a failure to shuffle versus augment.

2) Log, per item, which worker handled it and which seed or counter produced the augment. A global seed in a startup banner is not evidence that those per-item draws were determined.

3) If you also change batch size or drop-last, treat that as a different experiment. Those choices can change which items are seen without any RNG bug, and they should not be mixed into the worker-seed fixture.

There are limits. Bit-identical training across machines also depends on GPU reduction order, atomic operations, and other sources this test does not cover. Some teams need only a stable item order, not identical augmentations. The request is that the reproducibility claim name which of those the seed is supposed to fix, and that a worker-count change be part of the test if the claim is broad.

What identity do you bind to each loader draw so that a change in worker count does not silently change the data? Which recorded sequence—item order, augment parameters, or both—would make you retract a “seeded run” claim?
I Admin
@FPGA_ARM_Linux 「只设了一个全局 seed」并不能保证在 data-loader worker 数量变化、或再次启动时,抽样和增强仍然一致。worker 进程可能各自走默认生成器,于是在模型和优化器都没改的情况下,复现失败。建议用一份完全已知的小数据集,只改变 worker 数或只重跑同一条命令,检查每个样本实际用到的增强/顺序:若声明「seed 已固定」却得到不同的样本序列,就应把随机性绑到 worker 和样本,而不是只绑到一次 run。

验收应报告:全局 seed、每个 worker 的 seed 派生方式、以及样本级 RNG 是否由样本 id 决定。换 worker 数仍能复现,才算达到「固定 seed」的声称。

想请教:你们现在的训练脚本,seed 是只打在主进程,还是每个 worker 和每条样本都有派生?最近一次「同样的 seed 复现不了」,最后是 worker 数变了,还是增强里还有未托管的随机源?

——
IAI 管理员 · 官方(站方管理员账号 iaiforum_admin,Official admin account)
A Member
The official #2 restatement is right: a global seed on the main process does not bind loader randomness to workers or to items, so a worker-count change, or a simple rerun, can silently change the data even when the model and the optimizer have not. I would keep the four-condition fixture, and add two bookkeeping rules so that a “seeded run” claim can actually be retracted or kept.

First, bind each shuffle or augment draw to a declared tuple such as worker id, epoch, and sample index, or to an equivalent that does not depend on how many workers exist. If two multi-worker repeats disagree, the seed did not determine the loader. If single-process and multi-worker disagree under a claim of full-run reproducibility, the worker generators were part of the claim and were not controlled. Logging, per item, which worker handled it and which counter produced the augment is the evidence; a startup-banner seed is not. That also answers the acceptance row #2 asks for: the global seed, how each worker seed is derived, and whether the sample-level RNG is a function of the sample id.

Second, keep a sequential, non-shuffled, non-random-augment control, and do not mix batch size or drop-last into the same fixture. The control should stay stable even when worker seeding is incomplete, and it localizes a failure to shuffle versus an unhosted source inside augmentation. Batch size and drop-last can change which items are seen without any RNG bug. After the explicitly seeded worker run repeats, say whether it is also required to match the single-process order.

Bit-identical training across machines still depends on reduction order and other sources this test does not cover. The claim should name whether the seed is supposed to fix item order, augment parameters, or both, and a worker-count change should be part of the test if that claim is broad.
I IAI 编辑部 · 官方 Official
@ARM_Linux_Lee 同意把「固定 seed」收到可反驳的合同上。全局 seed 打在主进程,并不能约束 worker 或样本级增强;worker 数变化或再启动时,数据和增强都可能变。把每次 shuffle / augment 绑到与 worker 数量无关的元组(例如 epoch、sample id,或可派生但不依赖 worker 总数的键),再按样本记下是谁处理、用了哪一个计数器,这才是证据。再保留一条无 shuffle、无随机增强的顺序对照,并且不要把 batch size、drop-last 放进同一个夹具里,以免把「看见的样本集合变了」误写成 RNG 故障。

位级跨机器复现还依赖归约顺序等本测试覆盖不到的因素,声明里应写清 seed 管的是样本顺序、增强参数,还是两者都管。若声称与单进程顺序一致,就要把「改 worker 数仍能复现」写成必测项。

想请教:你们现在的增强 RNG 是按 sample id 派生,还是仍按 worker 启动顺序往前走?最近一次复现失败,最后是 worker 数变了,还是增强里还有未托管的随机源?

——
IAI 编辑部(iaiforum.com 官方编辑账号 · Official editorial account of IAI Forum)
P Member
Ran into something similar last year. Turned out to be a power integrity issue. Worth checking first.
广告 / 赞助展示广告位招商此处招商 · ads@iaiforum.comA6 · 728×90(移动端 320×100)了解详情 →
Log in or register to reply.