Skip to content

[LTX prereq] DiT scaffold: support loops that run in successive stages - #373

Merged
NSagan271 merged 1 commit into
mainfrom
scaffold/multi-stage-loops
Oct 14, 2026
Merged

NSagan271 merged 1 commit into
mainfrom
scaffold/multi-stage-loops

Conversation

@NSagan271

@NSagan271 NSagan271 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Developed with the AGENTS.md / skills harness from #370.

Two gaps kept a model from running its denoise node in a second stage (a draft loop, then a refinement loop in a later walk):

  1. Iteration 0 always seeded from noise via seed_loop_back, which never sees the step's inputs. New hook initial_loop_back(fwd_info, inputs, bucket_key, generator), defaulting to seed_loop_back, so every existing model is unchanged.
  2. The per-request schedule and bucket key were cached on the first prepare_inputs and never rebuilt, so a second walk silently reused the first stage's shape and step count. They are now cached per (request, walk).

First user: LTX-2.5's two-stage recipe (#376).

Tests: test/modular/test_diffusion_denoise_loop.py +3 (default seeding unchanged; initial_loop_back sees the inputs at iteration 0 only; a second walk gets its own shape and schedule, and check_stop follows it). With test_flux2_klein_model.py and test_z_image_model.py: all pass.

🤖 Generated with Claude Code

Two gaps kept a model from running the denoise node in a second stage
(a draft loop, then a refinement loop in a later walk):

* iteration 0 always seeded from noise through seed_loop_back, which
  never sees the step's inputs. The new initial_loop_back(fwd_info,
  inputs, bucket_key, generator) hook defaults to seed_loop_back, leaving
  every existing model unchanged; a refinement loop overrides it to start
  from the latents routed to it.
* the per-request schedule and bucket key were cached on the first
  prepare_inputs and never rebuilt, so a second walk silently reused the
  first stage's shape and step count. They are now cached per (request,
  walk).

LTX-2.5's two-stage distilled recipe is the first user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NSagan271
NSagan271 marked this pull request as ready for review October 9, 2026 07:14
@NSagan271 NSagan271 changed the title DiT scaffold: support loops that run in successive stages [LTX prereq] DiT scaffold: support loops that run in successive stages Oct 9, 2026

@dghosef dghosef left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Just note that if any model/request uses the same walk twice, we will run into the same problem since we are caching by (request, walk)

@NSagan271
NSagan271 merged commit f99cd36 into main Oct 14, 2026
4 checks passed
@NSagan271
NSagan271 deleted the scaffold/multi-stage-loops branch October 14, 2026 22:34
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.

2 participants