ComfyUI Flow Matching Inverter Nodes
Custom nodes for ComfyUI that target rectified-flow models (for example, Qwen). The nodes cover three core tasks:
- integrate the model's velocity field to produce a partially inverted latent,
- add noise using the same schedule as the sampler, and
- perform small latent-domain cleanups or conditioning perturbations.
Each node is available on its own, and the hybrid node chains them together for a single-drop workflow.
Node overview
Qwen Rectified Flow Inverter
Runs the rectified-flow ODE backwards to re-noise an encoded latent. Supports deterministic amplification, seeded stochastic perturbation, optional output normalisation, and shares the same interface as the sampler (steps, conditioning, etc.).
Latent Gaussian Blur
Applies a Gaussian blur directly in latent space. Spatial Only blurs each channel independently; Spatial and Channel performs a joint 3D blur across channels for stronger smoothing.
Add Latent Noise (Seeded)
Adds seeded Gaussian noise scaled by the input latent's standard deviation. Useful whenever a latent needs a controlled bump in noise without touching the schedule.
Conditioning (Add Noise)
Adds seeded Gaussian noise to the CLIP conditioning embeddings (and pooled output when present). Great for introducing gentle prompt variation without rewriting text.
Conditioning (Gaussian Blur)
Smooths the token embeddings with a Gaussian kernel along the prompt sequence, softening sharp emphasis changes while preserving the overall prompt content.
Conditioning (Scale)
Multiplies the conditioning embeddings and pooled outputs by a user-defined factor so you can mute (0.0), keep (1.0), or amplify (>1.0) prompt influence without editing text.
Forward Diffusion (Add Scheduled Noise)
Uses the model's noise schedule (via KSampler) to add the amount of noise that corresponds to a given progress value. This is the "anchor" latent that samplers expect when starting from a given denoise level.
Latent Hybrid Inverter (Qwen)
Convenience node that calls the inverter and forward diffusion nodes internally, then blends their outputs using spherical interpolation. It keeps separate seeds for the creative and anchor paths and exposes the blend weight so you can bias towards either latent.
Creative play
Image exploration rarely means chasing a single "correct" answer. These nodes are designed to be mixed and layered so you can steer a latent in different, often surprising, directions:
- Lead with
Latent Hybrid Inverterto recover structure, then nudge that structure by addingConditioning (Add Noise)at a subtle strength (≈0.05–0.15). The latent stays coherent while the prompt wanders just enough to spark new ideas. - Follow the noise with
Conditioning (Gaussian Blur)to soften abrupt emphasis changes or to merge multi-prompt blends into a single vibe. Blurring after noise often produces dreamlike, painterly shifts instead of chaotic drift. - Use
Conditioning (Scale)as a volume knob while iterating: dial the factor down to 0.3–0.5 when you want the image to respond mostly to the recovered latent, then crank it above 1.5 when the textual guidance should take the lead. - Pair
Latent Gaussian BlurwithConditioning (Gaussian Blur)for holistic smoothing—latent blur calms texture while conditioning blur calms prompt pacing. Reintroduce energy by sprinkling inAdd Latent Noiseor ramping the conditioning scale afterwards. - Swap seeds between the inverter, forward diffusion, and noise nodes as you iterate. Small tweaks here can shift the interplay between latent detail and prompt guidance, rewarding playful experimentation.
Treat each slider as a brushstroke: push a setting until it breaks, back off to the sweet spot, and capture the happy accidents along the way.
Example workflows
Manual composition
- Encode an image to a latent.
- Feed the latent into
Qwen Rectified Flow Inverter(pick strength/amplification/perturbation). - Feed the clean latent into
Forward Diffusionwith the same strength but a different seed. - Optionally clean either latent with
Latent Gaussian BlurorAdd Latent Noise. - Blend the creative and anchor latents (e.g.
Latent Slerp) and sample withdenoiseequal to the chosen strength.
Hybrid node quickstart
- Encode an image to a latent.
- Run the latent through
Latent Hybrid Inverterwith your preferred strength and blend factor. - Sample the result with
denoisematching the passed strength.
Installation
- Clone or download this repository into
ComfyUI/custom_nodes/. - Restart ComfyUI to load the nodes (look under
Qwen/SamplingandLatent).