Repository navigation
Keep Miles LoRA trainers serving while a profiled step's trace is written - #359
Merged
Micah Yong (micahtyong) merged 3 commits intoNov 18, 2026
Merged
Conversation
… serving Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Micah Yong (micahtyong)
requested a review
from Kailash Ranganathan (kailash109)
as a code owner
November 17, 2026 23:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Micah Yong (micahtyong)
deleted the
micah/trainer-profile-async-export
branch
November 18, 2026 00:46
This was referenced Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After a profiled step, a Miles LoRA trainer stopped serving every client while it wrote the trace: 34 s on a 2B model, minutes on large ones.
Now the trainer stops the profiler on its own thread, then a forked child process writes the trace and table, so the trainer takes the next request right away. A background thread doesn't work, because building the table holds Python's global lock. Multi-node trainers still write in place, since forking a process that uses RDMA hasn't been verified. Tensor shapes and memory are no longer recorded by default (
SPINDLE_TORCH_PROFILE_SHAPES=1/SPINDLE_TORCH_PROFILE_MEMORY=1turn them on).Testing
Qwen3.5-2B LoRA, one H100, two stock Tinker SDK clients on one trainer, profiling step 3:
forward_backwardA normal
forward_backwardwith two clients sharing the trainer takes 1.3–2.9 s. With this PR the files land 18 s after the stop. Writing from a background thread instead made the trainer's nextforward_backwardtake 25 s (A).Not run: multi-GPU and multi-node trainers, all ranks, large models, and a shutdown while files are still being written.