Skip to content

[sglang-miles] [Diffusion] Return each sample's decoded audio in the rollout response - #46544

Draft
zhihengy wants to merge 1 commit into
sgl-project:sglang-milesfrom
zhihengy:dmd2/rollout-return-audio
Draft

zhihengy wants to merge 1 commit into
sgl-project:sglang-milesfrom
zhihengy:dmd2/rollout-return-audio

Conversation

@zhihengy

@zhihengy zhihengy commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

miles-diffusion judges a MiniMax H3 t2va distillation run by its eval renders (radixark/miles_diffusion#343), which need sound. H3 decodes audio together with the video (OutputBatch.audio, [1, C, L], and audio_sample_rate), but the rollout response carries only generated_output, so the trainer side receives silent videos. The OpenAI entrypoint already returns result.audio / result.audio_sample_rate.

Modifications

  • RolloutResponse: two optional fields, generated_audio (this sample's waveform) and audio_sample_rate, both None by default.
  • _build_response: picks each sample's waveform with the existing select_output_audio, the helper save_outputs uses for the same per-sample split, and fills both fields in rollout and eval responses. Pipelines that decode no audio return None, so their responses are unchanged.

Accuracy Tests

MiniMax-H3 (t2va, 2×B200 TP2, 768p 16:9 4 s = 1344×768 / 107 frames, 4 steps, ode, seed 1234, rollout_video_dtype=uint8), on a tree with this commit and #46545 (skip the VAE decode) on top of sglang-miles 2a2fb73; the two touch separate response fields:

request generated_output generated_audio audio_sample_rate
rollout (rollout=True) [3, 107, 768, 1344] [2, 142400] (4.45 s) 32000
eval (rollout=False) [3, 107, 768, 1344] [2, 142400] 32000

Repeated requests return bitwise-equal video and audio. Against sglang-miles 2a2fb73 on the same requests, the decoded video (rollout and eval), dit_trajectory, denoising_env and rollout_log_probs are bitwise equal; the rollout response grows by 1,139,373 bytes, the 1,139,200-byte waveform plus its keys.

Tests

  • test_rollout_api.py::TestBuildResponse::test_each_sample_carries_its_own_audio: in a 2-sample batch, each response carries its own sample's waveform and the sample rate, for rollout and eval; a pipeline without audio returns None for both. It fails without the change.
  • test_rollout_api.py: 41 passed. pre-commit run on the changed files is clean.
  • While testing, one of 15 decoded H3 responses on a tree with this change stopped after the 200 header (server idle, client waiting for the rest of the body); it did not reproduce over the next 13 requests. The response encoding and streaming code is not touched here.

CI States

Latest PR Test (Base): ❌ Run #42722280038
Latest PR Test (Extra): ❌ Run #42722279841
Latest PR Test (AMD ROCm 10): ❌ Run #42722279657

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

@Rockdu
Rockdu force-pushed the dmd2/rollout-return-audio branch from 6f04c06 to 3bd643c Compare November 9, 2026 23:39

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant