Skip to content

Experiment (not for merge): forward compressed training requests to the engine - #155

Closed
micahtyong wants to merge 4 commits into
mainfrom
micah/perf-4b/O3-forward-compressed
Closed

micahtyong wants to merge 4 commits into
mainfrom
micah/perf-4b/O3-forward-compressed

Conversation

@micahtyong

@micahtyong micahtyong commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Experiment (not for merge).

Summary

The frontend decompresses each zstd forward_backward body so it can read the model id, then sends the uncompressed bytes on to the engine. For 128 examples with [seq, 5] labels that is 4.2 MB instead of 0.6 MB. This change sends the client's compressed body and lets the engine decompress it.

It made no measurable difference with the frontend and trainer in the same region, so it is kept as a draft. It may help when a trainer runs in a different region from the frontend.

E2E results

Same setup as #152; 16 steady steps.

Before WandB / After WandB

Median per step Before After
Time outside the trainer 2.88 s 3.04 s
Frontend handling of one forward_backward submit 0.24 s 0.24 s

🤖 Generated with Claude Code

micahtyong and others added 4 commits October 27, 2026 18:22
The frontend server set only a routing region, so Modal could start its
containers in any region. Each training request makes several Modal Dict and
function-call round trips and an engine call, so a frontend on another
continent added seconds per training step. Run it in the configured region,
or us-east when none is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Densify CSR tensors and reshape labels with numpy instead of per-element
Python loops, and pause cyclic GC while the nested label rows are built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The frontend decompressed each zstd forward_backward body to read its model id
and then sent the uncompressed bytes to the engine, about 7x more data on the
frontend-to-engine hop. Send the client's compressed body instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@micahtyong
micahtyong force-pushed the micah/perf-4b/O2-vectorize-rows branch 8 times, most recently from 011c7f0 to 8a31b44 Compare October 28, 2026 21:57
Base automatically changed from micah/perf-4b/O2-vectorize-rows to main October 28, 2026 22:40
@micahtyong micahtyong closed this Oct 28, 2026
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.

1 participant