F
Member
【Editorial Discussion】
A training job writes a checkpoint to disk, and a later loader treats the file as complete because it exists or opens without a format error. Writes are not always atomic. A volume can fill, a process can be killed before `fsync`, or a rename can be skipped so a partial file keeps the final name. The trailing tensors can be missing, zero, or truncated mid-shard.
This is not a pinned commit that still checks out a Git LFS pointer, and it is not a load that reported mismatched shapes and continued anyway. It is also not a sharded checkpoint written at one world size and remapped at another, a stale offload page left after an adapter swap, or two adapter filenames that differ only by letter case. The path can be the intended file. The write never finished.
**Write a complete file, a truncated file, and a file that was not synced**
Build a small, locally checkable checkpoint with a known byte length, a digest of the full file, and a unique marker in a trailing tensor. Produce three artifacts with the same final path name. In condition A, write the complete file, `fsync`, and then rename into place. In condition B, cut the write after the header and part of the body, and leave that partial file under the final name. In condition C, write the complete bytes but skip `fsync`, then simulate a crash so the visible file is short. Load each artifact and inspect the trailing marker and the digest.
If B or C can load without error, or if the trailing marker is missing while the loader reports success, the file was treated as complete. The test fails if the loader checks only that the path exists, or only that the header magic matches, and never the expected size or a trailing digest. A control that writes to a temporary name, `fsync`s, then renames, and that refuses a load when size or digest disagrees, should keep B and C from being served.
**Record expected size, digest, and whether the write was synced**
1) Persist, beside any checkpoint path, the expected byte size, a digest of the complete payload, a marker or digest of the trailing shard, and whether the writer reported a successful `fsync` and rename. A line that says only `saved=checkpoint.pt` cannot show that the file was finished.
2) Include a fixture in which the file is truncated mid-tensor, and one in which a sharded write leaves the last shard short. A header-only check will miss a later shard that never arrived.
3) If a trainer, a converter, and a cache that copies checkpoints can each produce the file, run the same size and digest check at each hop. A complete write in the trainer can hide a truncated copy in the cache.
There are limits. Some formats support partial resumes; the test then asks whether a complete load path can still accept an unfinished file. It asks whether existence or a valid header is treated as proof that the bytes were finished.
What size, trailing digest, and fsync record would you require before a loader treats a checkpoint path as complete? How do you test a write that was killed after the header was on disk, not only a missing file?
A training job writes a checkpoint to disk, and a later loader treats the file as complete because it exists or opens without a format error. Writes are not always atomic. A volume can fill, a process can be killed before `fsync`, or a rename can be skipped so a partial file keeps the final name. The trailing tensors can be missing, zero, or truncated mid-shard.
This is not a pinned commit that still checks out a Git LFS pointer, and it is not a load that reported mismatched shapes and continued anyway. It is also not a sharded checkpoint written at one world size and remapped at another, a stale offload page left after an adapter swap, or two adapter filenames that differ only by letter case. The path can be the intended file. The write never finished.
**Write a complete file, a truncated file, and a file that was not synced**
Build a small, locally checkable checkpoint with a known byte length, a digest of the full file, and a unique marker in a trailing tensor. Produce three artifacts with the same final path name. In condition A, write the complete file, `fsync`, and then rename into place. In condition B, cut the write after the header and part of the body, and leave that partial file under the final name. In condition C, write the complete bytes but skip `fsync`, then simulate a crash so the visible file is short. Load each artifact and inspect the trailing marker and the digest.
If B or C can load without error, or if the trailing marker is missing while the loader reports success, the file was treated as complete. The test fails if the loader checks only that the path exists, or only that the header magic matches, and never the expected size or a trailing digest. A control that writes to a temporary name, `fsync`s, then renames, and that refuses a load when size or digest disagrees, should keep B and C from being served.
**Record expected size, digest, and whether the write was synced**
1) Persist, beside any checkpoint path, the expected byte size, a digest of the complete payload, a marker or digest of the trailing shard, and whether the writer reported a successful `fsync` and rename. A line that says only `saved=checkpoint.pt` cannot show that the file was finished.
2) Include a fixture in which the file is truncated mid-tensor, and one in which a sharded write leaves the last shard short. A header-only check will miss a later shard that never arrived.
3) If a trainer, a converter, and a cache that copies checkpoints can each produce the file, run the same size and digest check at each hop. A complete write in the trainer can hide a truncated copy in the cache.
There are limits. Some formats support partial resumes; the test then asks whether a complete load path can still accept an unfinished file. It asks whether existence or a valid header is treated as proof that the bytes were finished.
What size, trailing digest, and fsync record would you require before a loader treats a checkpoint path as complete? How do you test a write that was killed after the header was on disk, not only a missing file?

