Flow Matching Stage
The single-stage version of the flow-matching upscaler
- model
- positive
- negative
- latent
- latent
- presampler_latent
- next_seed
- model
- positive
- negative
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. Notelanczosis a trap: it falls back tobicubicbecause 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.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Flow-matching diffusion model to drive refinement. | |
| positive | CONDITIONING | Positive conditioning for CFG. | |
| negative | CONDITIONING | Negative conditioning for CFG. | |
| latent | LATENT | Latent to upscale and refine in this single stage. | |
| seed | INT | 00–18446744073709550000 | Seed controlling re-noising for this stage (and typically the sampler noise). |
| steps | INT | 161–256 | Denoising steps for this stage. |
| cfg | FLOAT | 4.50–20 | Classifier Free Guidance strength. |
| sampler_name | COMBO | Sampler backend leveraged during refinement. | |
| scheduler | COMBO | Noise schedule applied during denoising. | |
| scale_factor | FLOAT | 1.000.1–8 | Spatial scale factor applied to the latent grid for this stage. |
| noise_ratio | FLOAT | 0.000–1 | Flow-style re-noise amount (0 = keep latent, 1 = replace with pure noise). |
| skip_blend | FLOAT | 0.500–1 | Skip blend weight (0 = all denoised, 1 = all pre-sampler latent). |
| denoise | FLOAT | 1.000–1 | Denoising strength supplied to the sampler. |
| upscale_method | COMBO | bicubic | Resampling 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_samplingopt | COMBO | disable | Optionally run a dilated refinement pass for global coherence (experimental). |
| reduce_memory_useopt | COMBO | enable | Enable to reduce VRAM use by avoiding extra tensor clones where possible. |
| dilated_downscaleopt | FLOAT | 2.001–4 | Factor used when downscaling for the dilated pass (>=1.0). |
| dilated_blendopt | FLOAT | 0.250–1 | Blend weight of the dilated refinement result (frequency-domain blend). |
| dilated_min_stepsopt | INT | 11–256 | Minimum 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_modeopt | COMBO | derive | Seed mode for dilated sampling. 'derive' adds 10,000 to base seed, 'same' uses identical seed. |
| dilated_denoiseopt | FLOAT | 0.500–1 | Denoising strength for dilated sampling. Lower values preserve more spatial structure from the original. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| presampler_latent | LATENT | — |
| next_seed | INT | — |
| model | MODEL | — |
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |