Repository navigation
Add a Beam BF16 LoRA recipe and a blog reproduction reference run - #252
Conversation
49a3a98 to
594edf2
Compare
Merge #252's current head. Its Miles v0.2.0 image already includes the Kimi K3 change, so the K3 recipe now uses trainer_image "miles-v0.2.0" and the K3-only trainer image and the fork_image() helper are gone. kimi_k3_image.py keeps only the sampler image. Kimi K3 trains with megatron_to_hf_mode "raw", which Spindle only passes to Miles, so miles-v0.2.0 no longer rejects it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
|
||
| def _gather_capture(self, written: Path, path: Path) -> None: | ||
| """Make every node's writes to a capture on the checkpoint volume visible here.""" | ||
| if not on_checkpoint_volume(path): |
There was a problem hiding this comment.
is this necessary to restore multi-node on 0.2.0 or why this change?
|
|
||
| image = image_at(MILES_COMMIT) | ||
| # Beam on the Megatron Bridge (modal-projects/miles#37). | ||
| beam_image = image_at("3280b7a5e3c4399c1ac18bed568859c9068852c3") |
There was a problem hiding this comment.
can we just call this image_ or something? ideally this is just a linear list of commits on our shared 0.2.0 fork branch. mb add a comment about this. is image_020_0001_sha mb better? ff to rename the existing one to be consistent
| revision="803bccbcb947d3041f5b57e11c986f8523a0cb56", | ||
| core_packages=CORE_SAMPLER_PACKAGES, | ||
| ).add_local_python_source("spindle", ignore=ignore_config_source) | ||
|
|
There was a problem hiding this comment.
same naming thing as above
| def on_checkpoint_volume(path: Path) -> bool: | ||
| """Whether ``path`` lives on the checkpoint volume, where nodes see only committed writes.""" | ||
| return ( | ||
| "SPINDLE_CHECKPOINT_VOLUME" in os.environ |
There was a problem hiding this comment.
how does this relate to the existing _checkpoint_volume_path function? can we do something cleaner?
| def run(args, batch_id, model, *batch_args, **kwargs): | ||
| rollout_data = batch_args[-1] | ||
| def run(args, batch_id, model, *slot_and_data, **kwargs): | ||
| # v0.2.0 passes adapter_slots before rollout_data; preserve both native arguments. |
There was a problem hiding this comment.
wait this is very scary - can you do something more explicit here? like actually check the version and branch on that potentially?
| self._bridge.save_slot(slot, path, include_optimizer=include_optimizer) | ||
| ) | ||
| # Outside _run: a bad capture fails this request, not the shared trainer. | ||
| self._gather_capture(written, Path(path)) |
There was a problem hiding this comment.
why are we adding this?
Reuse the stock Tinker workload with a pinned tokenizer and the existing TP2/CP8 H200 topology. Keep the response cap at 2048 tokens; this is not a 256K-context validation. Record no execution until a GPU run exists. Enable Miles v0.2.0 multi-node captures by committing each node's files before coordinator reload and sharing the checkpoint I/O lock for volume-backed captures, including their metadata writes. Local captures keep their independent persistence path. Adapt the generic backend changes from #252 commits 53f80f7, 594edf2 and 18054ed, with its owner's agreement. Leave Beam recipes and images out.
Reuse the stock Tinker workload with a pinned tokenizer and the existing TP2/CP8 H200 topology. Keep the response cap at 2048 tokens; this is not a 256K-context validation. Record no execution until a GPU run exists. Enable Miles v0.2.0 multi-node captures by committing each node's files before coordinator reload and sharing the checkpoint I/O lock for volume-backed captures, including their metadata writes. Local captures keep their independent persistence path. Adapt the generic backend changes from #252 commits 53f80f7, 594edf2 and 18054ed, with its owner's agreement. Leave Beam recipes and images out.
18054ed to
96ba5c4
Compare
c09c2f4 to
e36bfcc
Compare
6a3479d to
3996abc
Compare
f7ed75a to
b5140f9
Compare
19c32a6 to
67f1d07
Compare
b5140f9 to
84163b1
Compare
Micah Yong (micahtyong)
left a comment
There was a problem hiding this comment.
Looks like the PR body and some of the image names are a bit out of date with latest main, but otherwise LGTM
| name = "beam-501b-a23b-lora-5k" | ||
| model = "reflection/Beam-1.0-501B-A23B" | ||
| weights_revision = "12950ae640b48cbbe9b5bb7735bf197507d6383f" | ||
| max_context_length = 5120 |
There was a problem hiding this comment.
This is a very small context length. Can we serve up to 64k context? This can be a follow-up PR since this one is quite big now
84163b1 to
45b534e
Compare
Miles v0.1.1 and v0.2.0 put rollout_data at different positions in run_forward_backward, because v0.2.0 adds adapter_slots before it. The replay wrapper now binds each call to the wrapped function's own signature and reads rollout_data by name, so positional and keyword calls work on both versions. Installing the hooks fails at trainer startup when that function has no rollout_data parameter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
beam-501b-a23b-lora-5k trains reflection/Beam-1.0-501B-A23B with BF16 LoRA on two eight-H200 trainer nodes, with separate attention and MLP gate targets and routing replay. It trains on miles-v0.2.0-8c5de26 and samples on sglang-v0.5.23-e003cf9, which serves Beam LoRA. reference_runs/configs/beam_blog_repro.toml selects that recipe and scripts/beam_blog_repro.py, a stock-Tinker client that trains on DAPO-Math, evaluates on AIME25 and can resume from checkpoints. The index holds an earlier 42-update execution, converted to the catalog output format, and the digitized curve from the published Beam LoRA run, which records source instead of Spindle provenance. catalog.py now defines the output format every reference script writes (Record, Evaluation, Update and read_output), and tests check every indexed output and each script's output against it. A Spindle index entry needs its trainer image, Miles commit, Tinker SDK and hardware; an external entry records only its source. The Beam script and its tests are fully typed, without ANN ignores. AGENTS.md and the ignore list say that list only shrinks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test checked that /proc/PID/stat existed and then read it. When the killed descendant disappeared between the two calls, the read raised ProcessLookupError and the test failed, although the supervisor had done its job. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A fresh two-node Miles v0.2.0 worker reading the shared Triton and TorchInductor caches loaded a generated module filled with zeros and failed its first forward_backward. qwen38-27b-lora-256k already sets trainer-local caches for this; the Beam recipe now does the same. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The script ran training in a child process started from a fresh interpreter. Patches the parent had installed were lost, including the proxy headers that examples/shared-server/with_proxy_auth.py adds to every ServiceClient, so a Beam run against a proxy-protected server failed to authenticate. The worker is now forked and leads its own session, so it keeps those patches and the supervisor can still stop its whole process group at the deadline. The hidden --worker flag is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
45b534e to
03c28c5
Compare
Summary
Adds a bundled two-node recipe for BF16 LoRA on
reflection/Beam-1.0-501B-A23B, and a reference run that reproduces the published Beam LoRA training through the stock Tinker SDK.beam-501b-a23b-lora-5ktrains on two eight-H200 nodes and samples on one eight-B300 node. Attention and MLP gates are separate LoRA targets, and training uses routing replay. It trains onmiles-v0.2.0-8c5de26and samples onsglang-v0.5.23-e003cf9, which serves Beam LoRA. Trainers use local Triton and TorchInductor caches, because fresh multi-node workers reading the shared caches have loaded zero-filled generated modules.reference_runs/configs/beam_blog_repro.tomlselects the recipe andscripts/beam_blog_repro.py. The script trains on DAPO-Math with CISPO, one update of rollout prefetch and a 400-update cosine schedule, evaluates on AIME25, and resumes from checkpoints. The index holds an earlier 42-update execution and the digitized published curve.catalog.pydefines the output format every reference script writes (Record,Evaluation,Update,read_output), and tests check every indexed output and both scripts' outputs against it. An index entry for an execution outside Spindle recordssourceinstead of Spindle provenance. The format is described inreference_runs/README.md.rollout_databy name in Miles' ownrun_forward_backwardsignature, so it works whether a caller passes it by position or keyword, on both v0.1.1 and v0.2.0, and fails at trainer startup if the parameter is missing.examples/shared-server/with_proxy_auth.pyadds. A worker started from a fresh interpreter lost them and could not reach a proxy-protected server.AGENTS.mdand the comment on theANNignore list now say that list only shrinks.Testing
Pre-commit, the CPU suite (1,689 passed, 10 skipped) and all three CI jobs pass on
03c28c5, this PR rebased onto main after #382 and #290. The only conflict was inCHANGELOG.md. The GPU stages below ran on84163b1and45b534e, before #382 changed Miles checkpoint restore.End to end, the stock-Tinker reference client ran against a deployment of this PR through
with_proxy_auth.py, in three stages:84163b1(this PR before the rebase onto main; same Beam runtime code): the trainer started on two nodes, saved a step-0 checkpoint, published the adapter, ran the step-0 AIME25 evaluation and accepted updates 1 and 2. It stopped with a step-2 checkpoint.45b534e: fresh trainer containers restored the step-2 checkpoint, with optimizer state, and saved it again. All 16 tensor shards (43.5 GB) and both metadata files are bitwise identical to the original. The DCP index matches in all 1,873 entries and differs only instorage_meta(save path and save ID).45b534efrom the restored checkpoint: updates 3 to 11 were accepted, with AIME25 evaluations at 5 and 10 and checkpoints at 10 and 11.Updates 1–10 are the learning-rate warmup, so little change is expected yet.
The between-updates median for this PR leaves out the gap across the planned restart. Batch rewards for updates 1–11 track the earlier run within a few points.
Not validated: the full 100-update run and its learning comparison with the published curve, the launcher's automatic indexing of a completed Beam run, and Beam on any GPU type other than H200 trainers and B300 samplers.
🤖 Generated with Claude Code