Nodes/ComfyUI-DiffAid-Patches/WAN Diff-Aid Sparse Patch
ComfyUI Node

WAN Diff-Aid Sparse Patch

WAN video that finally lets the text get a word in

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

Text-to-video is where prompts go to get half-ignored. WAN 2.1 and 2.2 are the open video base almost everything runs on, and they follow the same pattern as image models: your prompt's influence dilutes as the context tensor passes through the transformer, and every block treats it the same way. This node is the WAN port of the Diff-Aid idea - modulate the text conditioning selectively at a few blocks instead of cranking one global knob. It shares a pack with the better-known Flux and SDXL siblings, and it's the most experimental of the three.

Read that last sentence carefully, because the author does. The Diff-Aid paper (arXiv:2602.13585) evaluates FLUX and SD 3.5 text-to-image, and explicitly lists video as future work. So this node is not paper-validated, and nobody claims it is. It's a best-effort architectural port of the same principle: context' = context + context × α, applied at selected WAN blocks.

How it works

WAN models don't expose Flux-style double_blocks / single_blocks. They expose one flat blocks list, and ComfyUI's native WAN path already uses patches_replace["dit"][("double_block", i)] replacement hooks inside its block loop. This node rides exactly that convention: it installs replacement patches on the selected WAN blocks and modulates the context tensor before each one receives it.

The one WAN-specific wrinkle is image conditioning. In image-to-video / TI2V workflows the context tensor has an image-prefix region that represents the start frame, not your prompt. preserve_image_context_prefix (default True) detects that prefix at runtime and modulates only the remaining text tokens, leaving the frame conditioning alone. That's the difference between "nudge the prompt" and "warp your start frame", so leave it on.

The inputs that matter

  • block_preset - paper_sparse_flux_remapped (default) takes the paper's FLUX sparse list 1,15,36,41,48 and remaps it onto whatever WAN block count you loaded: a 30-block WAN maps to 1,8,19,22,25, a 40-block one to 1,11,25,29,34. Or pick custom_block_indices and type your own into block_indices.
  • strength - default 0.35. This is not the place for heroics; moderate strength first, verify motion/detail stability, then creep up.
  • preserve_image_context_prefix and cond_only - both default on, both the safe choice.
  • sigma_start / sigma_end - same normalized window as the Flux node; try 0.55 / 1.0 if you only want the early, structure-setting phase.

Outputs: a patched MODEL and a summary STRING listing exactly which blocks got mapped and whether the image prefix was preserved.

Install

Same as the rest of the pack - no pip deps, no model files, nothing extra to download. ComfyUI Manager has it as ComfyUI-DiffAid-Patches, or:

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

Restart ComfyUI. It needs a current build with DiT patch-replacement hooks.

Where people get burned

Scope, mostly. This node targets native ComfyUI WAN model objects that expose the single blocks list - it will not work through Kijai/WanVideoWrapper internals unless they happen to expose the same native path. If another WAN patcher also installs block replacement hooks, order can matter, though the node preserves an already-installed patch for the same block and calls it after applying its own modulation. And temper expectations: this is an experimental text-conditioning port on a model the paper never touched, so results will be workflow- and seed-dependent. It's a "try it and see whether your WAN listens better" node, not a quality guarantee.

Categorymodel_patches/diffaid

Inputs (12)

NameTypeDefaultDescription
modelMODEL
enabledBOOLEANtrue
block_presetCOMBOpaper_sparse_flux_remapped2 options: paper_sparse_flux_remapped, custom_block_indices
block_indicesSTRING1,15,36,41,48
strengthFLOAT0.35-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
preserve_image_context_prefixBOOLEANtrue
cond_onlyBOOLEANtrue

Outputs (2)

NameTypeDescription
modelMODEL
summarySTRING