ComfyUI Node

Flow Matching Stage

The single-stage version of the flow-matching upscaler

By ttulttul·Created 10 months ago·Updated 7 months ago· 62
Flow Matching Stage
  • model
  • positive
  • negative
  • latent
  • latent
  • presampler_latent
  • next_seed
  • model
  • positive
  • negative
seed0
steps16
cfg4.5
sampler_name
scheduler
scale_factor1.00
noise_ratio0.00
skip_blend0.50
denoise1.00
upscale_methodbicubic
enable_dilated_samplingdisable
reduce_memory_useenable
dilated_downscale2.00
dilated_blend0.25
dilated_min_steps1
dilated_seed_modederive
dilated_denoise0.50

The Flow Matching Progressive Upscaler does everything in one node: upscale, re-noise, denoise, skip-blend, repeat. FlowMatchingStage is the same machine, but as a single stage you chain by hand - one node per doubling - and the reason that's worth doing is ComfyUI's caching. When you change the settings of a later stage, ComfyUI can short-circuit the unchanged earlier stages and skip straight to what you edited. Tuning your final upscale pass no longer means re-running the whole ladder.

It does exactly what one stage of the progressive upscaler does: takes a latent, applies scale_factor, injects flow-consistent re-noise (noise_ratio), runs the sampler, and blends the skip residual back in (skip_blend). The mechanism is the same "rewind the clock" logic - re-noise puts the latent back onto the flow trajectory so the model refines detail instead of inventing a new composition - just exposed per stage instead of baked into a loop.

Inputs that matter:

  • model, positive, negative, latent - standard sampler wiring.
  • seed - controls the re-noising for this stage (and typically the sampler noise).
  • steps (16), cfg (4.5), sampler_name, scheduler - the sampler for this stage. Flow models want the Euler family; this isn't the place for Karras.
  • scale_factor (1.0) - how much this stage resizes. 1.0 means no scaling, which is a legitimate choice for a pure refinement stage.
  • noise_ratio (0.0) - how much flow-noise to inject (0 = keep latent, 1 = pure noise). This is the knob that corresponds to "how far back on the trajectory."
  • skip_blend (0.5) - 0 = all denoised, 1 = all pre-sampler latent. High early, low late.
  • denoise (1.0) - strength supplied to the sampler.
  • upscale_method (bicubic) - resize kernel. Note lanczos is a trap: it falls back to bicubic because the PIL-based path damages latents.

Optional controls: enable_dilated_sampling (default disable here, unlike the progressive node) adds the dilated refinement lap, with dilated_downscale, dilated_blend (frequency-domain blend), dilated_min_steps (raise to 4+ for lightning models), dilated_seed_mode, and dilated_denoise. And reduce_memory_use (default enable) avoids extra tensor clones to save VRAM - worth knowing when you're stacking stages at 4K.

Outputs. latent is the refined result; presampler_latent is the latent before sampling, which you can route into ComfyUI's Custom Sampler nodes if you want to take over the sampler yourself; next_seed chains to the next stage's seed for deterministic runs; and model, positive, negative pass through.

Install. Same pack - ttulttul/ComfyUI-FlowMatching-Upscaler. ComfyUI Manager, search "ComfyUI-FlowMatching-Upscaler", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/ttulttul/ComfyUI-FlowMatching-Upscaler

No model downloads; deps are numpy, torch, einops, aiohttp - all already in ComfyUI. It registers under latent/upscaling.

Gotchas. The naming overlaps with the Progressive Upscaler on purpose, and the default enable_dilated_sampling is flipped to disable here - if you expect dilated refinement on by default, you'll silently skip it. Also remember this node keeps the LOW_VRAM fallback that the Prep/Merge pair deliberately drops, so if you're on tight memory, prefer chaining these over the modular custom-sampler path.

Categorylatent/upscaling

Inputs (21)

NameTypeDefaultDescription
modelMODELFlow-matching diffusion model to drive refinement.
positiveCONDITIONINGPositive conditioning for CFG.
negativeCONDITIONINGNegative conditioning for CFG.
latentLATENTLatent to upscale and refine in this single stage.
seedINT00–18446744073709550000Seed controlling re-noising for this stage (and typically the sampler noise).
stepsINT161–256Denoising steps for this stage.
cfgFLOAT4.50–20Classifier Free Guidance strength.
sampler_nameCOMBOSampler backend leveraged during refinement.
schedulerCOMBONoise schedule applied during denoising.
scale_factorFLOAT1.000.1–8Spatial scale factor applied to the latent grid for this stage.
noise_ratioFLOAT0.000–1Flow-style re-noise amount (0 = keep latent, 1 = replace with pure noise).
skip_blendFLOAT0.500–1Skip blend weight (0 = all denoised, 1 = all pre-sampler latent).
denoiseFLOAT1.000–1Denoising strength supplied to the sampler.
upscale_methodCOMBObicubicResampling kernel for spatial upscaling. NOTE: ComfyUI's `lanczos` path uses PIL and is unsafe for LATENT tensors; this node will fall back to `bicubic` if selected.
enable_dilated_samplingoptCOMBOdisableOptionally run a dilated refinement pass for global coherence (experimental).
reduce_memory_useoptCOMBOenableEnable to reduce VRAM use by avoiding extra tensor clones where possible.
dilated_downscaleoptFLOAT2.001–4Factor used when downscaling for the dilated pass (>=1.0).
dilated_blendoptFLOAT0.250–1Blend weight of the dilated refinement result (frequency-domain blend).
dilated_min_stepsoptINT11–256Minimum sampling steps for dilated refinement. Actual steps = max(min_steps, steps // 2). Increase for lightning models to ensure adequate sampling (e.g., 4).
dilated_seed_modeoptCOMBOderiveSeed mode for dilated sampling. 'derive' adds 10,000 to base seed, 'same' uses identical seed.
dilated_denoiseoptFLOAT0.500–1Denoising strength for dilated sampling. Lower values preserve more spatial structure from the original.

Outputs (6)

NameTypeDescription
latentLATENT
presampler_latentLATENT
next_seedINT
modelMODEL
positiveCONDITIONING
negativeCONDITIONING