Nodes/RES4LYF/Latent Replace State Info
ComfyUI Node Runs on cloud

Latent Replace State Info

Selectively overwrite a chained sampler's hidden state

By ClownsharkBatwing·Created 2 years ago·Updated 22 days ago· 1,222
Latent Replace State Info
  • latent
  • raw_x
  • sigmas
  • latent
replace_start_stepfalse
replace_end_stepfalse
replace_raw_xfalse
replace_sigmasfalse
start_step0
end_step0

Flag this one honestly: it's advanced-workflow plumbing, not a node you reach for on a first project. Latent Replace State Info lets you overwrite specific pieces of the hidden generation state that RES4LYF's samplers attach to a latent - the step markers, the raw diffusion tensor, or the noise schedule - one at a time, with a boolean gate for each.

The reason this exists at all: RES4LYF's samplers support chaining, splitting your total steps across multiple sampler nodes in sequence (a real pattern people use for things like Wan 2.2's two-pass high-noise/low-noise setup). For that to work, the latent handed from one stage to the next carries more than the visible tensor - it carries where sampling left off. This node lets you reach in and swap out individual pieces of that instead of accepting whatever the previous stage produced.

How it works

Each of the four things this node can touch has its own boolean switch - replace_start_step, replace_end_step, replace_raw_x, replace_sigmas - plus a matching optional input carrying the new value (start_step, end_step, raw_x, sigmas). Flip a switch on and its matching input's value overwrites that piece of the latent's state; leave it off and that piece passes through untouched. This gives you fine-grained control instead of an all-or-nothing swap.

The inputs and outputs that matter

  • latent (required) - the latent whose state you're editing.
  • replace_start_step / replace_end_step (booleans) - gate whether the matching start_step/end_step inputs overwrite the latent's step markers.
  • replace_raw_x (boolean) - gates whether the optional raw_x (LATENT) input overwrites the raw diffusion tensor.
  • replace_sigmas (boolean) - gates whether the optional sigmas (SIGMAS) input overwrites the noise schedule attached to the state.
  • Output: latent - the same latent with whichever pieces you flagged now replaced.

How to install it

Via ComfyUI Manager: search "RES4LYF" and install. Manually, from ComfyUI/custom_nodes:

git clone https://github.com/ClownsharkBatwing/RES4LYF/
cd RES4LYF
pip install -r requirements.txt

Activate your venv first if you use one; on a portable install, swap pip for python_embedded\Scripts\pip.exe. Restart ComfyUI afterward.

Common issues & troubleshooting

Setting a value but nothing changes. Check the matching boolean is actually on - this node is opt-in per field by design, so plugging a new raw_x into the optional input does nothing unless replace_raw_x is also flipped true. It's an easy thing to miss on a first pass.

No documentation exists beyond the field names. This is genuinely obscure territory, even by this pack's standards - there's no written guide to when you'd want to replace steps versus raw_x versus sigmas, and no community discussion of it. You're far more likely to find this wired inside someone else's advanced chainsampler workflow than to build with it from scratch on your own reasoning.

You're not sure your latent has state to replace in the first place. This node (and its siblings, Latent-to-RawX and Latent-Transfer-State-Info) only make sense on latents that came out of a RES4LYF sampler - a plain Empty Latent Image or VAE-encoded image doesn't carry the step/raw_x/sigmas state this node edits.

Start from the pack's own examples. The "intro to clownsampling" workflow linked from the RES4LYF README is the clearest place to see state-info nodes like this one used for real, rather than guessing purely from the schema.

CategoryRES4LYF/latents

Inputs (9)

NameTypeDefaultDescription
latentLATENT
replace_start_stepBOOLEANfalse
replace_end_stepBOOLEANfalse
replace_raw_xBOOLEANfalse
replace_sigmasBOOLEANfalse
start_stepoptINT0-10000–10000
end_stepoptINT0-10000–10000
raw_xoptLATENT
sigmasoptSIGMAS

Outputs (1)

NameTypeDescription
latentLATENT