Skip to content

Support per-adapter seeds in the v0.1.1 LoRA slot API - #42

Merged
frrad merged 1 commit into
spindle-milesfrom
codex/adapter-initialization-seed-v011
Nov 17, 2026
Merged

frrad merged 1 commit into
spindle-milesfrom
codex/adapter-initialization-seed-v011

Conversation

@kailash109

@kailash109 kailash109 commented Nov 17, 2026 •

Copy link
Copy Markdown

Summary

Allow callers of MilesBackend.load_slot to supply a per-adapter seed. Pass it through the trainer controller and actor to the existing adapter initializer, before constructing optimizer state. The adapter backend owns topology-specific RNG initialization and restoration, including replicated MLA projections.

Checkpoint restoration ignores the initialization seed. Omitted seeds preserve the existing behavior. This exposes the slot API; it does not change validation in Miles' own Tinker gateway.

Used by modal-labs/spindle#324.

Testing

  • Slot API regression tests: 2 passed, covering seed zero, repeated seeds across slots and slot reuse, different seeds, optimizer initialization, and checkpoint precedence.
  • Tests execute the production load-slot method bodies with CPU tensor initializers, without importing optional GPU runtimes (pytest --noconftest -q -o addopts='' tests/fast/backends/megatron_utils/test_lora_slot_seed.py).
  • Black, isort, and Ruff checked the changed files.
  • Real GPU validation through the stock SDK and Spindle HTTP path passed on Miles v0.1.1 and v0.2.0 with Qwen3-8B and the full DeepSeek-V2-Lite checkpoint, one H100, BF16, and three optimizer steps. Same-seed initial and trained weights were bit-identical across slots and reuse; maximum log-probability error was 0.0. Different seeds changed outputs, and unseeded training stayed finite. The MLA check fingerprinted all 187 adapter modules, including experts and 27 replicated projections.
  • Full MLA training equality required deterministic mode and kernels; seed alone only controls initialization. Settings and tested commits are recorded in Support seeded LoRA initialization through Miles modal-labs/spindle#324. This does not establish equality across hardware, topology, versions, or batching orders.
  • The v0.1.2 branch has CPU regression coverage only; GPU checks ran on the v0.1.1 and v0.2.0 branches.

@frrad
frrad marked this pull request as ready for review November 17, 2026 20:05
@frrad
frrad merged commit 52a7a99 into spindle-miles Nov 17, 2026
frrad added a commit to modal-labs/spindle that referenced this pull request Nov 17, 2026
The fork PRs for seeded LoRA initialization were squash-merged, so the
commits Spindle pinned are not on the spindle-miles* branches. Pin the
merged commits instead:

- miles-v0.1.1-52a7a99 (modal-projects/miles#42; same tree as ce494f0)
- miles-v0.1.2-99e1ebe-glm53 (modal-projects/miles#43; same tree as 612703a)
- miles-v0.2.0-8c5de26 (modal-projects/miles#44, after Beam LoRA support #37)

The DeepSeek-V4.1 seed commit fde5e9e was never merged. Its seed patch is
identical to the one #43 merged onto spindle-miles-v0.1.2, so the plain
v0.1.2 image uses that branch head, 99e1ebe, as miles-v0.1.2-99e1ebe. The
GLM-5.3 changes between f2f8447 and 99e1ebe only take effect in the glm53
build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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