Skip to content

Restore Miles checkpoints across fork commits of the same format - #382

Merged
Micah Yong (micahtyong) merged 2 commits into
mainfrom
micah/warn-checkpoint-revision
Nov 18, 2026
Merged

Micah Yong (micahtyong) merged 2 commits into
mainfrom
micah/warn-checkpoint-revision

Conversation

@micahtyong

@micahtyong Micah Yong (micahtyong) commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Addresses #381. Miles checkpoints used to restore only on the exact fork commit that saved them, so moving a config to a newer image stranded users' training states.

  • A commit mismatch now logs spindle_checkpoint_revision_mismatch instead of failing. Format, layout, model, LoRA settings and topology still have to match.
  • The format-mismatch error (v0.1.x vs v0.2.0) says which image to use.
  • When Miles v0.2.0 refuses a load as a user error, only that request fails. Before, it stopped the trainer and every model on it.

E2E

A Qwen3.5-4B training state saved on miles-v0.1.1-fdd808c, restored with optimizer through the stock Tinker SDK, then one fixed step:

Trainer Restored NLL After one step Load
fdd808c 10.601738 10.487693 197 s
52a7a99, this PR 10.601738 10.487693 173 s

Per-token logprobs are bit-identical.

Refused load on miles-v0.2.0-e814245 (W&B): client B loaded a copy of client A's checkpoint with an altered base-model fingerprint, which Miles refuses. B's request failed in 3.3 s and its slot was unchanged. A kept training on the same trainer, and B then loaded the real checkpoint and matched A's next step exactly. One trainer container served the whole run. On main, this refusal stops the trainer.

v0.1.2 pairs, same procedure:

  • DeepSeek-V4.1-Flash, f2f8447 → 99e1ebe on 2×8 B300 (A, B): restored NLL 12.273228 on both, with all per-token logprobs and step loss identical.
  • GLM-5.3 Flash, 464efc9-glm53 → 99e1ebe-glm53 on 8×B300 (A, B): restored NLL 10.546 vs 10.608 and step loss 12.082 vs 12.087. This recipe isn't deterministic: repeated reads on one client vary by about 0.1.

🤖 Generated with Claude Code

@frrad Fred Robinson (frrad) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class Config(Parent):
name = "qwen35-4b-lora-32k-attn-only"
trainer_image = "miles-v0.1.1-fdd808c"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? Is this a good default or do we want to recommend a 0.2.0 version? Maybe add a test to enforce this stays up to date / continues to refer to a version which exists?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this change was not needed; reverting.

result = self._call(coroutine)
out_of_memory = isinstance(result, dict) and result.get(OUT_OF_MEMORY)
if not out_of_memory:
refused = None if out_of_memory else _refusal(result)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, seems weird for refused to be dependent on oom status.

args.delay_split_train_data_by_dp = True


def _refusal(result) -> str | None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a test or two to document what the shape of the input is expected to be here?

raise ValueError("checkpoint topology does not match deployment")
if restore_optimizer and not metadata.get("has_optimizer"):
raise ValueError("checkpoint does not include optimizer state")
if metadata.get("miles_revision") != self.runtime.revision:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add some narrative here like "this checkpoint was saved with a different version of miles than the one it is being loaded with"

Also, do you think it's worth trying to track / prevent things from being loaded by versions which are older than they were generated with?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep we can warn users that they're loading a checkpoint from a newer Miles version.

worth trying to track / prevent things from being loaded by versions which are older than they were generated with?

It looks like Miles v0.2.0 already handles this case (ex). In fact, it looks like Miles v0.2.0 handles a lot of the versioning checks we added in the past few days

A commit mismatch now logs spindle_checkpoint_revision_mismatch instead of
rejecting the restore; format, layout, model, LoRA and topology checks still
gate it. A load that Miles refuses as a user error fails only that request
instead of stopping the trainer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…explain the mismatch warning

Keep the 0.1.7 restore examples on miles-v0.1.1-fdd808c.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@micahtyong
Micah Yong (micahtyong) force-pushed the micah/warn-checkpoint-revision branch from e18d4fe to ec3bc55 Compare November 18, 2026 20:13
@micahtyong
Micah Yong (micahtyong) merged commit 23f562b into main Nov 18, 2026
3 checks passed
@micahtyong
Micah Yong (micahtyong) deleted the micah/warn-checkpoint-revision branch November 18, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants