Nodes/Advanced Latent Control/TSampler (Latent Control)
ComfyUI Node

TSampler (Latent Control)

Edit the latent mid-sampling, not after it's done

By kuschanow·Created 2 years ago·Updated 14 days ago· 23
TSampler (Latent Control)
  • model
  • positive
  • negative
  • latent_image
  • transform_optional
  • LATENT
seed0
steps20
cfg8.0
sampler_name
scheduler
denoise1.00

TSampler (Latent Control) is the flagship node of RomanKuschanow's Advanced Latent Control pack, and the one you'll actually reach for. It's a KSampler with one extra socket that lets you reach into the denoising process and warp the latent every few steps - mirror it, shift it, multiply it, or blend another latent into it - while it's still being refined. That's a different beast from editing the latent before or after sampling. The whole pack's "transform" concept runs through this node.

What it actually is

Strip away the branding and TransformSampler is ComfyUI's stock KSampler subclassed, with one optional input added: transform_optional, which takes a TRANSFORM type. That's the output of nodes like Shift transform, Mirror transform, Multiply transform, Latent add transform, or Combine transforms. Feed one in and the node patches your model, so all the usual KSampler inputs stay exactly the same: model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise. Output is a plain LATENT that goes into VAE Decode like any other sampler.

No transform connected? It's just a KSampler wearing a different label. The magic only starts when you plug one in.

How the transforms work

The pack hooks into sampling through ComfyUI's post-CFG callback (set_model_sampler_post_cfg_function). Each step, after classifier-free guidance runs, the callback grabs the model's denoised prediction - the "clean" latent x0 - and hands it to your transform. The transform only fires on steps inside its own window: start_at and stop_at are fractions of the total step count (0 to 1), and if you also attached an offset pattern, the step has to pass that gate too. When it fires, it returns a modified x0, which the sampler re-noises into the next step's latent. So the edit isn't pasted on top afterwards - it steers the trajectory while it's being drawn.

That's why it's so much more powerful than a pixel-space tweak: mirror the latent during the first 20% of steps and you've reshaped composition while the model still has freedom to fill in the rest, which is how people get clean mirrored or symmetrical results instead of a hard flip visible at the seams.

The inputs that matter

Most of the KSampler fields behave exactly as you know them. The two you'll fiddle with first:

  • cfg - transforms interact with CFG, so if your edit looks weak, don't stack multipliers; check this first.
  • transform_optional - your TRANSFORM output. Leave it empty to test a "vanilla" pass.

And the one thing everyone trips on: transform nodes default to start_at: 0, stop_at: 0, and with both at zero the window condition can never be true, so nothing ever fires. If your transform does nothing at all, you almost certainly never raised stop_at above zero. Set start_at: 0, stop_at: 0.3 for the early-steps-only behavior, or 0.7, 1 to hit just the refinement phase.

How to install it

The pack ships as Advanced Latent Control. Easiest route is ComfyUI Manager - search "Advanced Latent Control", install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/RomanKuschanow/ComfyUI-Advanced-Latent-Control

Then restart ComfyUI. There are no model downloads and no pip dependencies beyond what ComfyUI already ships (it's pure PyTorch), so this is one of the cleaner installs you'll do.

Gotchas

  • Transform effects land after CFG and then get re-noised. Ancestral samplers (Euler a, DPM++ SDE) inject extra noise per step, which visibly dilutes a small edit. Converging samplers like Euler or DPM++ 2M hold the edit better.
  • combine mode on transforms blends the transformed and original latent ((new + old) / 2) instead of replacing it - gentler, and usually what you want when you're still learning.
  • The pack is low-key but maintained (active through 2026, registered on the Comfy Registry), and the transforms don't need any extra models or API keys. No hidden cost.

Start with a Multiply or Mirror transform at start_at 0 / stop_at 0.2, plug it into transform_optional, and compare against an identical workflow without it. That's the fastest way to feel what step-local latent editing buys you.

Categorymodel/sampling

Inputs (11)

NameTypeDefaultDescription
modelMODELThe model used for denoising the input latent.
seedINT00–18446744073709550000The random seed used for creating the noise.
stepsINT201–10000The number of steps used in the denoising process.
cfgFLOAT8.00–100The Classifier-Free Guidance scale balances creativity and adherence to the prompt. Higher values result in images more closely matching the prompt however too high values will negatively impact quality.
sampler_nameCOMBOThe algorithm used when sampling, this can affect the quality, speed, and style of the generated output.
schedulerCOMBOThe scheduler controls how noise is gradually removed to form the image.
positiveCONDITIONINGThe conditioning describing the attributes you want to include in the image.
negativeCONDITIONINGThe conditioning describing the attributes you want to exclude from the image.
latent_imageLATENTThe latent image to denoise.
denoiseFLOAT1.000–1The amount of denoising applied, lower values will maintain the structure of the initial image allowing for image to image sampling.
transform_optionaloptTRANSFORM

Outputs (1)

NameTypeDescription
LATENTLATENTThe denoised latent.