Attention Masked Conditioning
Make a later pass act only on what the first pass actually drew
- latent
- conditioning
- latent
- conditioning
- mask
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 (1first,2second,0/-1last). Default1matches the usual first-pass-then-refine layout.minimum_strengthand 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.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | Latent produced by the sampler used for localization; it is returned unchanged for the later sampler. | |
| conditioning | CONDITIONING | Conditioning to apply only inside the discovered regions. | |
| concepts | STRING | subject | Concepts used to discover regions, separated by |. |
| conditioning_strength | FLOAT | 1.000–10 | Strength of the supplied conditioning inside the mask. |
| sampler_stage | INT | 1-1–1024 | Selects the connected sampling stage: 1 is first, 2 is second, and 0 or -1 selects the last; oversized values use the last. |
| capture_start | FLOAT | 0.000–0.99 | Start of denoising evidence to include; later values ignore more of the initial composition phase. |
| capture_end | FLOAT | 1.000.01–1 | End of denoising evidence to include; earlier values ignore more late refinement attention. |
| minimum_strength | FLOAT | 0.150–1 | Minimum normalized attention association retained in a region; higher values narrow the silhouette toward its semantic core. |
| minimum_consensus | FLOAT | 0.250–1 | Fraction of selected observations that must support a pixel; higher values keep more persistent regions. |
| geometry_recall | FLOAT | 0.850–1 | Higher values recover fainter connected object extent from exact attention, preserving tails and shafts but admitting more halos. |
| split_sensitivity | FLOAT | 0.000–1 | Sensitivity to divide one connected region around separate peaks; higher values can split a soft silhouette into multiple instances. |
| instance_recall | FLOAT | 0.650–1 | Higher values retain weaker disconnected instances relative to the strongest one, which helps repeated sparse concepts. |
| minimum_region_size | INT | 5121–1048576 | Discard attention components smaller than this many pixels. |
| keep_only | INT | 10–1024 | Keep the best N instances per concept; 1 keeps the largest and 0 keeps all. |
| keep_by | COMBO | largest size | Ranks retained instances by area or attention confidence. |
| combine_segs | BOOLEAN | false | Combines retained instances of each concept into one SEG. |
| matte_solidity | FLOAT | 0.750–1 | Higher values flatten accepted interiors toward fully opaque alpha. |
| edge_feather | INT | 80–4096 | Width in output pixels of the matte boundary transition. |
| capture_profile | COMBO | fast | Controls observation density: fast minimizes overhead, balanced adds temporal evidence, and exhaustive retains every eligible call. |
| evidence_mode | COMBO | concept isolation | Concept isolation derives a cleaner stable region; raw attention shows the captured model probabilities without isolation weighting. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | Unchanged localization latent. |
| conditioning | CONDITIONING | Supplied conditioning carrying the attention-derived mask. |
| mask | MASK | Soft latent-resolution mask attached to the conditioning. |