Nodes/ComfyUI-FastTool/SDXL ChordEdit (MODEL/CLIP/VAE)
ComfyUI Node

SDXL ChordEdit (MODEL/CLIP/VAE)

SDXL ChordEdit, actually explained

By Fengxiaoxiao-001·Created 4 months ago·Updated a day ago· 0
SDXL ChordEdit (MODEL/CLIP/VAE)
  • model
  • clip
  • vae
  • image
  • image
  • latent
source_prompta photo of a person
target_prompta watercolor painting of a person
seed42
noise_samples4
n_steps8
t_start0.85
t_end0.15
t_delta0.050
step_scale0.35
direction_gain2.0
cleanupfalse
width1024
height1024
center_croptrue
force_square_when_croppingtrue
unet_batch_size1
clear_cache_after_runfalse

ComfySDXLChordEdit (displayed as "SDXL ChordEdit (MODEL/CLIP/VAE)") is a text-driven image editor that replaces the usual img2img guessing game with one idea: whatever direction separates two prompts in the model's conditioning space is the direction your image should move. Feed it a photo, tell it the source prompt is "a photo of a person" and the target is "a watercolor painting of a person", and it walks the image's latent toward that change. No KSampler, no denoise slider, no separate Conditioning Set Area nodes - one node takes MODEL, CLIP, VAE, an image, and two sentences, and hands you the edited image plus the latent.

It's from the Fengxiaoxiao-001/ComfyUI-FastTool pack ("XiaoXiao" is the author's handle, and it's in the XiaoXiao/ChordEdit category). This is the research-y corner of an otherwise VRAM-focused toolkit, and it's honestly a niche tool. "ChordEdit" has essentially no community footprint on Reddit - this is a small author's take on the chord/direction-editing family of methods, not a household name like InstructPix2Pix. If you're comfortable tuning a KSampler you may not need it. But it is genuinely one-node-simple for prompt-consistent edits, which is rare.

How it actually works

The node encodes your image into SDXL latent space with proper crop conditioning, encodes both prompts, and computes the edit direction: the difference between the target and source conditioning (both cross-attention and pooled output). That's the chord - two prompt points, one direction.

The direction is noisy, so it estimates it the Monte Carlo way. It creates noise_samples random noises (seeded), and at each step from t_start (default 0.85) down to t_end (default 0.15) it runs the UNet on each noise at two nearby noise levels (t and t - t_delta), each under both the source and target prompts. That's four model inputs per noise per step - which is exactly what the unet_batch_size tooltip means by "each noise generates four sets of model inputs". The averaged difference gets scaled by direction_gain and step_scale, then added to the latent, step by step.

The inputs that matter

You will actually set most of these, but a few carry the tuning weight:

  • source_prompt / target_prompt - the two ends of the edit. Keep them structurally similar ("a photo of a person" → "a watercolor painting of a person"); if they're identical the node raises an error because there's no direction to walk.
  • noise_samples (default 4) - more samples = smoother, less noisy direction, but 4 UNet passes per sample per step. This is where the VRAM and time go.
  • direction_gain (default 2.0) - the tooltip is the author's own advice: 1.0 is the original formula, but SDXL works better from 2.0. Turn it up if the edit is too weak, down if it overshoots.
  • step_scale (default 0.35) - how far each step pushes along the direction.
  • n_steps, t_start, t_end, t_delta - the sampling window. The defaults (8 steps, 0.85→0.15) are a sane starting point.
  • width / height (default 1024×1024, SDXL native) with center_crop and force_square_when_cropping on by default - the latter forces a square target to match the original ChordEdit preprocessing, so leave it unless you have a reason not to.

Outputs are image (the edited result, decoded) and latent - wire the latent into a KSampler if you want to push the edit further, or just save the image.

Install

Install the pack once; that covers every node in it. ComfyUI Manager: search "FastTool". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Fengxiaoxiao-001/ComfyUI-FastTool.git

Then restart ComfyUI. No Python dependencies - pyproject.toml declares none; it builds on ComfyUI's own comfy.samplers, comfy.model_management, and SDXL VAE code.

Where people get burned

  • It's VRAM-heavy by construction. Four UNet inputs per noise per step adds up fast. If you OOM, drop unet_batch_size to 1 first, then noise_samples, then n_steps. There's also a clear_cache_after_run toggle (default off) that frees the cache when the node finishes.
  • It's SDXL-only. The conditioning uses SDXL's crop-coordinate encoding; don't feed it an SD1.5 or Flux setup and expect it to work.
  • Empty or near-identical prompts log a warning (or raise, if identical). Give both prompts real content - the edit direction is the difference between them.
  • The pack README describes more nodes than the current build registers (the VRAM CLIP Offloader it advertises is commented out in __init__.py). Trust what shows up in your node search, not the README.
CategoryXiaoXiao/ChordEdit

Inputs (21)

NameTypeDefaultDescription
modelMODEL
clipCLIP
vaeVAE
imageIMAGE
source_promptSTRINGa photo of a person
target_promptSTRINGa watercolor painting of a person
seedINT420–9223372036854776000
noise_samplesINT41–32
n_stepsINT81–100
t_startFLOAT0.850–1
t_endFLOAT0.150–1
t_deltaFLOAT0.0500–1
step_scaleFLOAT0.35-10–10
direction_gainFLOAT2.00–20放大 source/target 的编辑方向。1.0 为原始公式;SDXL 建议从 2.0 开始。
cleanupBOOLEANfalse
widthINT1024256–4096
heightINT1024256–4096
center_cropBOOLEANtrue
force_square_when_croppingBOOLEANtrue启用中心裁剪时,强制使用正方形目标尺寸,以匹配原始 ChordEdit 预处理。
unet_batch_sizeINT11–8一次批量处理多少个噪声样本。每个噪声会生成四组模型输入。
clear_cache_after_runBOOLEANfalse

Outputs (2)

NameTypeDescription
imageIMAGE
latentLATENT