TwinFlow Scheduler
The unglamorous node TwinFlow can't run without
- SIGMAS
Every sampler needs a schedule - the map of how much noise is left at each step - and TwinFlow's isn't in the standard set. The TwinFlow Scheduler produces the SIGMAS for TwinFlow's rectified-flow path, using a Kumaraswamy time transform and a "gap" that confines the steps to the slice of the flow where a distilled model actually does its work. On its own it does nothing visible; wired into SamplerCustom next to the TwinFlow Sampler, it's what makes 2-4 step generation come out right instead of as mush.
If the TwinFlow KSampler is the easy button, this node is the manual lever. Stock schedulers assume a full denoising trajectory; TwinFlow's few-step models want a schedule that spends its steps in the transport region and then jumps - and that part doesn't survive a stock scheduler. It's the least glamorous node in the pack and the one the whole thing quietly depends on.
How it works
Short chain of math on a grid of steps points:
- build a 0→1 linspace,
- rescale it into the window
[gap_start, 1 - gap_end], - push it through a Kumaraswamy transform -
(1 - (1 - t^a)^b)^c, withdist_ctrl_a/b/c- to redistribute the steps, - convert to sigma values (
1 - t) and append a trailing zero.
With all three dist_ctrl values at 1.0 the transform is identity, so you get a linear schedule. The defaults tell you where the design lives: gap_start 0.001, gap_end 0.6 - meaning the schedule covers only the first ~40% of normalized time, the noisy end, which is where the flow's transport happens. Move the gaps to shift where the steps land.
The inputs
- steps - how many sampling steps (default 2; the few-step regime lives at 2-4).
- dist_ctrl_a / dist_ctrl_b / dist_ctrl_c - Kumaraswamy shape controls; 1.0 = linear. Tune these when you want to push step density toward the start or end of the window.
- gap_start / gap_end - the flow boundaries; the defaults are what the author ships.
Output: a single SIGMAS, which feeds SamplerCustom alongside the TwinFlow Sampler:
TwinFlowScheduler (SIGMAS) ──▶ SamplerCustom
TwinFlowSampler (SAMPLER) ──▶ SamplerCustom
Installing it and what goes wrong
Same as every node in this pack - ComfyUI Manager, search "TwinFlow", or:
cd ComfyUI/custom_nodes
git clone https://github.com/mengqin/ComfyUI-TwinFlow.git
pip install -r requirements.txt
No extra models, no special dependencies beyond the pack's requirements. Restart ComfyUI and it appears under custom_sampling/schedulers.
The failure modes here are mostly about the chain around it:
- Stock scheduler instead of this one - a Karras or normal schedule on a 2-step TwinFlow run produces mush; the gap logic is load-bearing.
- Patcher missing upstream - the scheduler feeds sigmas, but the model still needs the patcher's restored embedder, or none of this means anything.
- Steps drifting up - this schedule is designed for the few/multi-step styles; cranking to 30 steps with the defaults isn't the point. Want more steps? Switch the TwinFlow Sampler's
sampling_styletoanyrather than fighting the defaults.
If you don't need to see the chain, the TwinFlow KSampler embeds this exact logic and spares you the wiring.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| steps | INT | 21–100 | — |
| dist_ctrl_a | FLOAT | 1.000.01–10 | — |
| dist_ctrl_b | FLOAT | 1.000.01–10 | — |
| dist_ctrl_c | FLOAT | 1.000.01–10 | — |
| gap_start | FLOAT | 0.0010–1 | — |
| gap_end | FLOAT | 0.6000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SIGMAS | SIGMAS | — |