Nodes/SimpleSyrup/Attention Masked Conditioning
ComfyUI Node

Attention Masked Conditioning

Make a later pass act only on what the first pass actually drew

By Artificial-Sweetener·Created 4 months ago·Updated 2 days ago· 2
Attention Masked Conditioning
  • latent
  • conditioning
  • latent
  • conditioning
  • mask
conceptssubject
conditioning_strength1.00
sampler_stage1
capture_start0.00
capture_end1.00
minimum_strength0.15
minimum_consensus0.25
geometry_recall0.85
split_sensitivity0.00
instance_recall0.65
minimum_region_size512
keep_only1
keep_bylargest size
combine_segsfalse
matte_solidity0.75
edge_feather8
capture_profilefast
evidence_modeconcept isolation

Here's a workflow problem you've definitely hit: the first pass drew a girl with decent pink hair, and now you want a second pass to push that hair harder - but only the hair. You don't want to repaint the whole image, and you don't want to hand-mask or run SAM. This node is the answer that doesn't involve any of that. It takes the conditioning for your refinement prompt and clips it to the region the first sampler actually associated with "hair," using its own recorded attention. Second pass, prompt applies only where the hair is.

How it works

It's the conditioning member of SimpleSyrup's attention family, and it reads from the earlier sampler instead of the current one. Give it the latent from the sampler that made your image, the conditioning you want restricted (typically an encoded positive like "pink hair, detailed"), and the concepts whose attention defines the region (hair - or hair | pink if you want the union). The node walks the graph to that sampler, pulls the captured attention evidence, and attaches a soft mask to your conditioning. Outputs are the latent unchanged (pass-through), the masked conditioning, and the mask itself in case you want to inspect or reuse it.

Where the magic happens downstream: feed the masked conditioning into a second, ordinary KSampler's positive input. The second pass runs normally, but the refinement conditioning only has influence inside the discovered region. This is effectively prompt-targeted inpainting with no mask painting, no detector, and no separate inpainting model.

Inputs that matter

  • conditioning - what you want applied inside the region. Usually a CLIP-text-encoded prompt describing the change.
  • conditioning_strength - unique to this node in the family, and the one you'll tune most. It scales the supplied conditioning inside the mask, from 0 up to 10. This is your "how hard does the pink-hair prompt bite" dial.
  • concepts - the region source. Should match wording the first pass's positive prompt used, or there's no attention to clip to.
  • sampler_stage - which sampler you're reading from (1 first, 2 second, 0/-1 last). Default 1 matches the usual first-pass-then-refine layout.
  • minimum_strength and the shared family controls - same semantics as the other attention nodes; defaults are fine to start.

The mental model that prevents confusion

Order matters. The region is derived from the sampler you point at, not from the new conditioning. So the concept you list should be something the first pass rendered - if the first pass never drew pink hair at all, there's no "hair" attention worth clipping to and the second pass has nothing to bite into. Think of it as: discover the region from what exists, then aim the new prompt at that region. Keep the second pass at a modest denoise on the same latent so the refinement actually happens where you aimed it.

Where it can bite you

Same provenance contract as the whole family: the latent must trace back to the sampler in the same workflow, unmodified in between, or the pack can't recover the recorded attention. And keep expectations calibrated - attention regions are soft, not surgical. If you need a pixel-hard boundary, this isn't the tool; if you need "fix the hair without touching the face," it's arguably the lowest-effort route in ComfyUI right now, because it costs no detector, no mask paint, and no extra model.

Ships in SimpleSyrup - Manager search SimpleSyrup, or clone into custom_nodes plus requirements.txt. This node downloads nothing; it only reads attention the sampler was already recording.

CategorySimpleSyrup/Conditioning

Inputs (20)

NameTypeDefaultDescription
latentLATENTLatent produced by the sampler used for localization; it is returned unchanged for the later sampler.
conditioningCONDITIONINGConditioning to apply only inside the discovered regions.
conceptsSTRINGsubjectConcepts used to discover regions, separated by |.
conditioning_strengthFLOAT1.000–10Strength of the supplied conditioning inside the mask.
sampler_stageINT1-1–1024Selects the connected sampling stage: 1 is first, 2 is second, and 0 or -1 selects the last; oversized values use the last.
capture_startFLOAT0.000–0.99Start of denoising evidence to include; later values ignore more of the initial composition phase.
capture_endFLOAT1.000.01–1End of denoising evidence to include; earlier values ignore more late refinement attention.
minimum_strengthFLOAT0.150–1Minimum normalized attention association retained in a region; higher values narrow the silhouette toward its semantic core.
minimum_consensusFLOAT0.250–1Fraction of selected observations that must support a pixel; higher values keep more persistent regions.
geometry_recallFLOAT0.850–1Higher values recover fainter connected object extent from exact attention, preserving tails and shafts but admitting more halos.
split_sensitivityFLOAT0.000–1Sensitivity to divide one connected region around separate peaks; higher values can split a soft silhouette into multiple instances.
instance_recallFLOAT0.650–1Higher values retain weaker disconnected instances relative to the strongest one, which helps repeated sparse concepts.
minimum_region_sizeINT5121–1048576Discard attention components smaller than this many pixels.
keep_onlyINT10–1024Keep the best N instances per concept; 1 keeps the largest and 0 keeps all.
keep_byCOMBOlargest sizeRanks retained instances by area or attention confidence.
combine_segsBOOLEANfalseCombines retained instances of each concept into one SEG.
matte_solidityFLOAT0.750–1Higher values flatten accepted interiors toward fully opaque alpha.
edge_featherINT80–4096Width in output pixels of the matte boundary transition.
capture_profileCOMBOfastControls observation density: fast minimizes overhead, balanced adds temporal evidence, and exhaustive retains every eligible call.
evidence_modeCOMBOconcept isolationConcept isolation derives a cleaner stable region; raw attention shows the captured model probabilities without isolation weighting.

Outputs (3)

NameTypeDescription
latentLATENTUnchanged localization latent.
conditioningCONDITIONINGSupplied conditioning carrying the attention-derived mask.
maskMASKSoft latent-resolution mask attached to the conditioning.