Nodes/raylight/ModelSamplingFlux (Ray)
ComfyUI Node

ModelSamplingFlux (Ray)

Shift the Schedule, Save Your Flux Runs

By komikndr·Created about a year ago·Updated 2 days ago· 409
ModelSamplingFlux (Ray)
  • ray_actors
  • ray_actors
max_shift1.15
base_shift0.50
width1024
height1024

Flux runs on a straight-line (flow matching) trajectory, and that's mostly great - fewer steps, no need for clever schedulers. But it introduces a new knob you don't have on SD: shift. Shift controls how sampling effort is distributed across the denoising trajectory - high shift spends more steps on structure and composition early, low shift favors the detail-end. Get it wrong and Flux either blows out early structure or never lands the fine texture. RayModelSamplingFlux is the Flux-specific shift patch, applied to the model on your Raylight workers.

The inputs are the ones you know from ComfyUI's own Flux sampling node:

  • max_shift (default 1.15) and base_shift (default 0.5) - the two ends of the shift curve. The model interpolates between them based on how many tokens you're feeding it.
  • width and height (default 1024 × 1024) - this is the part people forget. The shift is resolution-aware: bigger images have more tokens, so the schedule stretches. If your workflow generates at 768×512 and you leave width/height at 1024, the shift is computed for the wrong token count and the schedule is subtly off. Set them to match the actual generation resolution.

That last point is the one that burns people. The node has no idea what resolution your KSampler will use - it's a patch, not a watcher - so if you change resolution, change these numbers too. It's the distributed port of ModelSamplingFlux; everything that node does on a single GPU, this does on every Ray worker via the ray_actors stream.

Where it fits

Chain it right after Ray Init Actor and before your Ray KSampler, in any Flux workflow (dev, kontext, krea - all covered in the Raylight README's supported-models table). Flux runs at CFG 1 with its baked-in guidance, so don't pair this with a CFG-raising node expecting more adherence; it won't cooperate. If you're fighting undercooked or overcooked Flux generations on a single GPU, ComfyUI's built-in node is the same medicine without the Ray plumbing.

Install

Nothing special - this is part of raylight:

cd ComfyUI/custom_nodes
git clone https://github.com/komikndr/raylight
cd raylight
pip install -r requirements.txt

Restart, or install via ComfyUI Manager ("raylight").

Gotchas

The width/height trap is the whole story here. If your Flux output looks structurally off after you changed resolution, nine times out of ten it's the stale shift values. The defaults are tuned for 1024×1024 - which is also why they're the defaults. Change one, change the other. And remember: no Ray Init Actor upstream, no patch. This is a worker-side node; on a normal single-GPU graph it's the wrong tool entirely.

CategoryRaylight/extra

Inputs (5)

NameTypeDefaultDescription
ray_actorsRAY_ACTORS
max_shiftFLOAT1.150–100
base_shiftFLOAT0.500–100
widthINT102416–16384
heightINT102416–16384

Outputs (1)

NameTypeDescription
ray_actorsRAY_ACTORS