perf: yield between SSE events - #1
Closed
daanishkhazi wants to merge 3 commits into
Closed
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Author
|
Closing in favor of #2 rebased directly on v1.2.9. The controlled APEX ablation supports only the dedicated managed sampling loop; the parser-yield change is not required. |
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
bytearray, clearing it before yielding each completed chunk.This is intentionally narrow: it improves fairness between complete SSE events. It does not preempt parsing inside one giant individual JSON event.
Test plan
PYTHONPATH=src python -m pytest -q src/fireworks/training/sdk/tests/test_sampling.py src/fireworks/training/sdk/tests/test_deployment.py— 140 passedgit diff --check— passedThe single added regression splits inside the first SSE event, then delivers both completed events together in the second raw chunk. It proves the cooperative checkpoint runs between event decodes—not once per event—and preserves text, completion IDs, logprobs, routing metadata, performance metrics, and response closure. The same regression fails against unmodified v1.2.9.
Real rollout evidence
Braintrust: sdk-proof-1786752192-cd5fe5b5
A bounded deployment-only proof used this exact SDK head plus the Cookbook streaming transport with two DeepSeek rollout replicas and 128 authentic APEX episodes. Across 1,506 / 1,506 successful sampling calls, the SDK processed 1.27M SSE events / 1.90 GB and took 24,486 cooperative parser yields. Event-loop lag was p50 13 ms, p95 150 ms, and p99 228 ms, with no steady-state sampling, sandbox, MCP, or PTY failures.
The run was deliberately stopped after 481 seconds before any full long episode completed; it validates response-processing fairness, not a complete training step. All Fireworks and Modal resources were deleted.