Repository navigation
[request path] Send forward requests through the binary training transport - #153
Merged
Merged
Conversation
micahtyong
force-pushed
the
micah/perf-4b/O1-forward-binary
branch
from
October 28, 2026 16:28
40963a8 to
17a8df7
Compare
micahtyong
marked this pull request as ready for review
October 28, 2026 21:36
micahtyong
force-pushed
the
micah/perf-4b/O1-forward-binary
branch
from
October 28, 2026 21:43
17a8df7 to
0d60783
Compare
micahtyong
force-pushed
the
micah/perf-4b/O1-forward-binary
branch
from
October 28, 2026 21:48
0d60783 to
3291eae
Compare
micahtyong
force-pushed
the
micah/perf-4b/O1-forward-binary
branch
from
October 28, 2026 21:49
3291eae to
df48366
Compare
micahtyong
force-pushed
the
micah/perf-4b/O1-forward-binary
branch
2 times, most recently
from
October 28, 2026 21:54
f2d664b to
6680c76
Compare
Forward requests used the JSON executor path: the engine serialized every token and label to JSON for the backend, and the result came back as JSON through the engine and frontend before being re-encoded as protobuf. Route them through the same binary batch transport and protobuf results as forward_backward, and batch queued forward requests together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
micahtyong
force-pushed
the
micah/perf-4b/O1-forward-binary
branch
from
October 28, 2026 21:54
6680c76 to
dd28703
Compare
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
Spindle serves two kinds of training requests.
forward_backwardruns the model forward and backward and accumulates gradients.forward(Tinker'sforward_only=True) runs the model forward only, to score tokens without training. Both return the same payload: a log probability for every token and every candidate label in the batch.A request travels through three hops: the SDK sends it to the frontend, the frontend hands it to the engine, and the engine calls the trainer. The result comes back along the same path. In #42,
forward_backwardgot a binary transport for this trip, with results encoded as protobuf.forwardnever did. Its request went to the trainer as JSON, its result came back as JSON through the engine and the frontend, and only then did the frontend re-encode it as protobuf for the SDK. For a batch of 128 examples with 5 labels per position that result is about a million floats. As JSON, where every float is written out as text and parsed twice, that is about 20 MB per call. As protobuf it is 4 MB.This change gives
forwardthe same binary transport and protobuf results thatforward_backwardhas. Two smaller things come with it:forward_backward. The SDK splits a largeforwardinto chunks; those chunks now run as one trainer call instead of several. Forwards never share a call withforward_backward, because the two need different GPU work.E2E results
Same setup as #152: a 4B LoRA classifier on 4×H100; each step runs two
forwardcalls, oneforward_backward, thenoptim_step, one after another; 128 examples of about 1,631 tokens with 5 candidate labels per position; 16 steady-state steps. Step-0 log probabilities are bit-identical before and after.Before WandB / After WandB
forward: encode the result and send it trainer → engineforward: engine → frontend🤖 Generated with Claude Code