#41892·sglang

[diffusion] LTX-2: overlap MP4 encode with VAE decode (follow-up to #41819)

Author: mickqianCreated Sep 30, 2026Updated Sep 30, 2026
Labelsdiffusion

Problem. On short LTX-2 clips, the MP4 (+audio) encode and save after the last pipeline stage takes 20–40% of client latency, and it runs serially. diffusion-bench on 2×B200 (2026-09-25): server compute was ~4.3 s and client latency 5.4–5.7 s. With the host CPU busy, the same config read 8.77 s with identical per-stage times and a 4 s save.

#41819 overlaps the encode with the decode for MiniMax-H3 and, through the generic DecodingStage, for Wan: finished frames go to the encoder as the VAE produces them, and the MP4 is byte-identical to the one-shot save. On 4×GB300, turning on only that overlap for H3 took the request from 7.634 s to 6.622 s (−1.01 s), and the overlap by itself accounted for the H3 latency gap to vLLM-Omni. LTX-2 is not covered. LTX2AVDecodingStage overrides forward, so LTX-2 still saves serially.

What looks possible. ltx_2_vae.py::_temporal_tiled_decode decodes the temporal tiles in one loop and blends them in a second. Each tile's kept frames are final once the tile has been blended with its predecessor. A single loop could pass those frames to the encoder in order, under the same on_frames contract as H3's decode_base.

Check first:

  • Does the default serving config decode LTX-2 through _temporal_tiled_decode, or in a single call? If it is a single call, overlap needs a different approach. Making temporal tiling the default would change the output, so it is not an option here.
  • Audio: ffmpeg needs the WAV when the encode starts. #41819 decodes H3's audio before the video for this reason.

Acceptance. The MP4 is byte-identical to the serial path. Latency is compared with an end-to-end A/B measured to the last response byte; for H3 in #41819, sub-segment timing underestimated the tail by 3–4×.