Nodes/ComfyUI-DiffAid-Patches/Flux-family Diff-Aid Sparse Patch
ComfyUI Node

Flux-family Diff-Aid Sparse Patch

Patch five Flux blocks, leave the other 52 alone — the prompt-following nudge

By xmarre·Created 5 months ago·Updated 23 days ago· 17
Flux-family Diff-Aid Sparse Patch
  • model
  • model
  • summary
enabledtrue
block_presetpaper_sparse_flux_double_only_safe
block_indices1,15,36,41,48
strength0.50
sigma_start0.000
sigma_end1.000
sigma_ramp0.000
token_weight_modenone
token_tail0.35
apply_single_streamfalse
cond_onlytrue

Every diffusion model quietly ignores part of your prompt. Flux follows along better than most, but its text conditioning still gets diluted as it flows through the whole transformer stack, and every block gets the same treatment whether it's setting composition or rendering an eyelash. The 2026 Diff-Aid paper (arXiv:2602.13585) takes a different stance: instead of one global guidance knob, modulate text features selectively - per block, per timestep, per token. This node is the weights-free, ComfyUI-shaped approximation of that idea for Flux-family models, and it's refreshingly honest about what it is and isn't.

The name gives it away: sparse. It doesn't touch the whole model. Based on the paper's appendix, which showed that boosting a small subset of FLUX blocks recovers a chunk of the benefit of the full trained method, the node only patches a handful of transformer blocks. You drop it in the MODEL chain like any patcher - load → patch → sampler - and it modulates the text conditioning on just those blocks.

How it works

The math is tiny: c' = c + c × α, where α = strength × time gain × branch gain × token gain. Each term is something you control rather than something learned - there are no trained Aid weights here, and the author says so plainly. The strength term is the base magnitude. The time gain comes from a normalized sigma window: the wrapper watches the sampler's sigma sequence and maps 1.0 to the first/high-noise call, 0.0 to the low-noise end, so you can confine the effect to early denoising where prompt structure gets set. Branch gain is the cond_only switch (leave the negative/unconditional rows alone). Token gain is how later text tokens get weighted.

Mechanically, it installs ComfyUI model_patch_replace hooks on the selected double_block / single_block entries. In double blocks it modulates the txt tensor directly; in single blocks it modulates only the text-prefix region of the merged stream, using the img_slice metadata - image latents and any reference latents stay untouched.

The inputs that matter

  • block_preset - the one you'll actually set. paper_sparse_flux_double_only_safe is the default for a reason: it remaps the paper's sparse set (combined indices 1,15,36,41,48, which on canonical FLUX.1 means double blocks 0 and 14) onto whatever Flux-family model you loaded. paper_sparse_flux_full adds the single-stream half, and custom_combined_indices lets you type your own list into block_indices.
  • strength - how hard to push. Default 0.5; the author's own tests ran up to 1.0 with exponential token weighting.
  • sigma_start / sigma_end - the normalized window. Leave at 0.0 / 1.0 for uniform, or taper early/high-sigma only with something like 0.55 / 1.0.
  • apply_single_stream - off by default and keep it off until you're deliberately testing; single-stream patching is the sensitive path.

Outputs are a patched MODEL and a summary STRING that tells you exactly which blocks got mapped and activated - read it once, since Flux.2-style reduced layouts remap heuristically.

Install

No extra dependencies, no model files. ComfyUI Manager has it as ComfyUI-DiffAid-Patches, or:

cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-DiffAid-Patches

Then restart ComfyUI. You need a reasonably current ComfyUI build - it relies on patch-replacement hooks and model function wrappers.

Where people get burned

Community verdict is genuinely mixed, which is the honest read. In the author's r/StableDiffusion release thread, some reported better prompt adherence (especially on multi-subject prompts); others saw nothing, or worse images. The two concrete tips worth stealing: one tester on Chroma and Klein 9B had to drop sigma_end from 1.0 to 0.95 to stop composition drift - a full-strength window changes composition "like a different seed". And don't stack several nodes that install model_function_wrapper; this node composes with one existing wrapper, not five. It'll also refuse to run on anything that isn't a Flux-family model exposing double_blocks/single_blocks - that error message is your cue to grab the SDXL sibling node instead.

Start at the safe preset, strength 0.5, full window, token_weight_mode none. If you see nothing, push strength and try exponential weighting before you blame the sampler.

Categorymodel_patches/diffaid

Inputs (12)

NameTypeDefaultDescription
modelMODEL
enabledBOOLEANtrue
block_presetCOMBOpaper_sparse_flux_double_only_safe3 options: paper_sparse_flux_double_only_safe, paper_sparse_flux_full, custom_combined_indices
block_indicesSTRING1,15,36,41,48
strengthFLOAT0.50-1–1
sigma_startFLOAT0.0000–1
sigma_endFLOAT1.0000–1
sigma_rampFLOAT0.0000–0.5
token_weight_modeCOMBOnone3 options: none, linear, exponential
token_tailFLOAT0.350–1
apply_single_streamBOOLEANfalse
cond_onlyBOOLEANtrue

Outputs (2)

NameTypeDescription
modelMODEL
summarySTRING