Nodes/ComfyUI/ModelSamplingFlux
ComfyUI Node Runs on cloud

ModelSamplingFlux

The node that keeps Flux working when you leave 1024×1024

By Comfy-Org·Created 4 years ago·Updated about 23 hours ago· 129,495
ModelSamplingFlux
  • model
  • MODEL
max_shift1.15
base_shift0.50
width1024
height1024

Flux is a rectified-flow model, and rectified flow has a knob the old SD models never had: a shift that decides how sampling effort is spread across the denoising trajectory. ModelSamplingFlux is how ComfyUI sets that knob - and the reason the default Flux workflow has it sitting between the model loader and the sampler is that Flux genuinely breaks at unusual resolutions without it.

Here's the actual mechanism, which is worth understanding because it tells you when to touch the dials. The node computes a shift from your width and height. In source: tokens = width × height ÷ (8×8×2×2) - that's the number of latent patches after the VAE. Then shift is linearly interpolated between base_shift at 256 tokens and max_shift at 4096 tokens. The defaults are 0.5 and 1.15, so a 1024×1024 image (4096 tokens) lands exactly on max_shift, and a 512×512 lands somewhere in between. Higher resolution → higher shift, and the schedule's flux_time_shift stretches denoising effort accordingly. That's the entire node, minus the glue.

The inputs that matter

Four required inputs, and honestly you only ever touch one:

  • width / height - set these to the resolution you're actually sampling at. This is where people get burned: if you're doing a latent upscale second pass at 1536×1536 but the node still says 1024, the shift is wrong for the resolution you're really drawing. The node does not read your latent; it trusts these numbers.
  • max_shift / base_shift - advanced, and the community values are the defaults. Flux's own training used shifts around 1.0–1.15; there's no tuning to win here for normal use.

Output is a patched MODEL that wires straight into the sampler, usually a Flux-guided sampler at guidance 3.5 - which is the other knob Flux has, and not this one. People conflate the two constantly.

Where it landed and what changed

The node appeared in August 2024, the same week Flux shipped, and took its resolution-aware form two days later. It's one of the older members of the model-sampling family, and it's still the one you'll see most - because it's in the template.

The honest advice

Leave it alone. The defaults are the right answer for Flux Dev and Schnell at any reasonable size, and the only field you should adjust is width/height to match your actual sampling resolution. If your Flux output looks off at higher resolutions, fix the width/height here first, then think about guidance - not the shift. And remember Flux doesn't want a negative prompt or real CFG; that's a separate conversation that this node won't fix.

Categorymodel/patch/flux

Inputs (5)

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

Outputs (1)

NameTypeDescription
MODELMODEL