ComfyUI Node

RALUSamplerCore

The three-stage mixed-resolution sampler, unpacked

By Milkyawaway·Created 3 months ago·Updated 3 months ago· 0
RALUSamplerCore
  • model
  • conditioning
  • latent
  • noise_state
  • negative_conditioning
  • vae
  • latent
  • upscaled_preview_latent
  • noised_preview_latent
  • debug_info
steps25
scheduler_modeplaceholder
sampler_nameplaceholder
familyflux
use_ralu_defaulttrue
level4
up_ratio0.30
N_json
e_json
debug_save_intermediatesfalse
cfg_scale1.00

This is the heart of the pack. RALUSamplerCore is the custom sampler that actually implements RALU - the training-free mixed-resolution latent upsampling idea from the 2025 research line that denoises diffusion models mostly at low resolution and only spends expensive high-res compute where the image needs it. RALU's pitch is speed without the quality cliff: most of a 1024×1024 image doesn't need full-res denoising for most of the schedule, so it doesn't get it.

It's a research sampler, so temper expectations: this is the author's standalone export of their FLUX/SD3 experiments, not a polished product. But if you want to see what RALU does under the hood, this node is the honest way to watch.

How the FLUX RALU path works

The ralu scheduler mode runs the three-stage flow (all of it is in ralu_flux_runtime / the family adapters):

  1. Stage 1 (coarse): the latent is downsampled 2× (a quarter of the tokens) and denoised with a shift-aware schedule built from the stage's parameters.
  2. Stage 2 (select & refine): the sampler scores which low-res tokens carry the most detail - if you wired a vae, it decodes the prediction and runs Canny edge detection to score patches; without one it falls back to a latent-space energy/gradient scorer - then upscales the top up_ratio fraction of tokens to full res, injects Cholesky-correlated noise, and denoises at mixed resolution.
  3. Stage 3 (finish): everything is upsampled to full res, more correlated noise is added, and the final denoise pass runs.

The level input picks the preset: 4 (default) uses N=[5,6,7] steps across the three stages with up_ratio 0.3 and is the closer-to-full-quality option; 7 uses N=[2,3,5] with up_ratio 0.1 for a faster, coarser pass. Only 4 and 7 exist - anything else raises an error.

The inputs that matter

  • family - must be flux or sd3. generic and sdxl look selectable but throw "not implemented yet" if you try to actually run them.
  • scheduler_mode - placeholder (auto-promotes to ralu when family=flux and the noise is correlated_ralu), normal (falls back to plain ComfyUI Euler sampling with your cfg_scale), or ralu (the real thing).
  • use_ralu_default - true locks you to the preset level parameters; false requires N_json and e_json (JSON arrays of 3 ints / 3 floats) and runs a scipy Jensen–Shannon optimizer to derive the schedule. The defaults are the ones to use until you know what you're doing.
  • noise_state - feed it RALUNoiseSource in correlated_ralu mode; that's what trips the RALU path.
  • cfg_scale - 1.0 by default (FLUX is guidance-free); only meaningful in normal mode with a negative_conditioning.

Outputs: latent (decode it with your VAE), upscaled_preview_latent and noised_preview_latent (mid-flow previews), and debug_info - a JSON string that tells you the effective stage counts, whether the node was actually implemented, and latent statistics. If you're not sure a run is really doing RALU, read that string.

Installing

cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/Milkyawaway/comfyui-ralu-sampling.git
cd /path/to/ComfyUI
python -m pip install opencv-python numpy typing-extensions
python main.py

ComfyUI Manager: search "comfyui-ralu-sampling", install, restart. You'll need the actual models in the standard folders - flux1-dev.safetensors plus clip_l, clip_g, t5xxl_fp16, and ae.safetensors for the FLUX examples, or sd3.5_large.safetensors for SD3.

Common issues

  • "Unknown RALU family" or "not implemented yet" - you picked a family that can't run. Stick to flux/sd3.
  • "Invalid level" - only 4 and 7 are defined.
  • N_json/e_json errors when use_ralu_default is off - they must be valid JSON arrays of exactly 3 values. And that path imports scipy; if the optimizer errors, pip install scipy (ComfyUI usually has it).
  • Nothing in the palette - the pack registers via the modern comfy_api.latest API; an outdated ComfyUI won't load it.

Honest recommendation: the RALUFluxWorkflowBridge is the friendlier entry point if you just want a working FLUX RALU run - it sets up the model, conditioning, latent, and noise for you. Use RALUSamplerCore when you want to control the pieces yourself, or you're poking at what the algorithm is actually doing.

Categorysampling/custom_sampling/ralu

Inputs (17)

NameTypeDefaultDescription
modelMODEL
conditioningCONDITIONING
latentLATENT
noise_stateNOISE
stepsINT251–10000
scheduler_modeCOMBOplaceholder3 options: placeholder, normal, ralu
sampler_nameCOMBOplaceholder3 options: placeholder, euler, custom
familyCOMBOflux4 options: generic, flux, sdxl, sd3
use_ralu_defaultBOOLEANtrue
levelINT44–7
up_ratioFLOAT0.300–1
N_jsonSTRING
e_jsonSTRING
debug_save_intermediatesBOOLEANfalse
cfg_scaleFLOAT1.000–100
negative_conditioningoptCONDITIONING
vaeoptVAE

Outputs (4)

NameTypeDescription
latentLATENT
upscaled_preview_latentLATENT
noised_preview_latentLATENT
debug_infoSTRING