KSampler (Attention Coupling + Contextual Diffusion)
The sampler that keeps a big edit from becoming a dozen little lies
- model
- positive
- negative
- region_masks
- latent_image
- segs
- latent
- contexts_segs
This is the flagship, and the pack's own README tells the story that made it. The author was editing a 2160×3072 source with FLUX.2 Klein 4B. Downscaling made the edit coherent but defeated the point of starting high-res. Ordinary tiled diffusion kept the detail - and then he looked at the whole image. One tile had found a figure, another had invented a second figure, and the cathedral had become two different buildings. The overlaps were smooth. The scene was nonsense.
That's the failure Contextual Diffusion exists to fix, and this node fuses it with the pack's regional attention coupling: regional prompts that apply in every local tile and in the reduced whole-image view. It's for large-canvas edits where the tiles have to see the whole composition or they'll each improvise their own.
How Contextual Diffusion works
The mechanism is worth understanding because it's the whole pitch. Every early step runs the tiled local prediction and one smaller, aspect-preserving view of the entire image. The clever part is how the two combine - the author subtracts the low-frequency interpretation already present in the tiled prediction and adds only the difference from the whole-image view:
prediction = local + scheduled_weight × (global_upsampled − local_low_frequency)
Blending the whole-image prediction straight into the tiles makes things blurry; leaving it on too long smears detail. Subtracting the tiles' own low-frequency component first means the global view only supplies what the tiles lost - composition - without wrecking their texture. (The author notes the result is mathematically related to Upsample Guidance from early 2024, which he says he developed independently; either way the practical behavior is: early steps lock the scene, then it hands off to the tiles for detail.)
Inputs that matter
It's the Contextual variant of KSampler (Attention Coupling), so you get the full coupling contract - global-first conditioning batch in positive/negative, optional region_masks, regional_prompt_weight, region_mask_feather - plus the diffusion stack:
diffusion_mode- MultiDiffusion (average) or Mixture of Diffusers (center-weighted), for tile fusion.latent_context_size/latent_context_overlap/latent_context_batch_size- tile geometry, default96size with32overlap.global_weight- how authoritative the whole-image view is (1= authoritative, default).global_steps- how many initial steps use the global context. Default1. This is the knob that matters most.global_decay- multiplier on whole-image strength after each global step (default0.5); lower hands control to the tiles faster.segs(optional) - SEGS that replace the regular grid with region-guided contexts, so the local windows fall where you want instead of on a plain grid.
There are two outputs: the latent, and contexts_segs - the rectangular windows actually evaluated during sampling. Its SEGS masks are only created when that output is connected, so leave it unplugged unless you want to inspect what the sampler looked at.
When to reach for it - and when not to
The README is refreshingly honest about scope. Contextual Diffusion is for edits the model already knows how to make at normal resolution: clothing, materials, color, jewelry, expression, local lighting - changes that keep the source pose and composition. If you need a brand-new pose, camera, or environment, establish that at a normal working resolution first and refine afterward; don't fight the big canvas from step one. And it's slower than plain tiled diffusion, by construction: a tiled prediction per step plus a whole-image evaluation for each corrected step. Distilled models that finish in a handful of steps change the math - with a 4-step model, one corrected step is already a quarter of the entire denoising.
The base Contextual sampler historically rejects sampling paths and extra conditioning whose spatial behavior isn't validated across both context sizes (UniPC, ControlNet, GLIGEN, and so on). This node exists because attention coupling was validated in both views - it runs in every local and reduced-global context on supported Anima and standard SD/SDXL models, and unsupported combinations fail before sampling with a clear error rather than silently producing nonsense.
Install and expectations
It's in SimpleSyrup: ComfyUI Manager search, or clone into custom_nodes plus requirements.txt, and keep ComfyUI current for the V3 node API. No model downloads for the sampler itself. Don't expect a hundred tutorials for this yet - the pack is young and this method is its own research, so a few small test crops will teach you more than any guide. Start with one edit, one mask, global_steps at 1, and look at the whole image before you trust the seams.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Supported Anima or standard SD/SDXL model used for one shared denoiser trajectory; apply global model LoRAs before connecting it. | |
| seed | INT | 00–18446744073709550000 | Seed used to create sampling noise. Reusing it with matching settings makes results repeatable. |
| steps | INT | 201–10000 | Number of denoising steps. More steps can add refinement but take longer. |
| cfg | FLOAT | 8.00–100 | Prompt guidance strength. Higher values follow the positive prompt more strongly but can look overcooked. |
| sampler_name | COMBO | Sampling algorithm. It affects the image's look, speed, and stability. | |
| scheduler | COMBO | Noise schedule used during sampling. It changes how quickly structure and detail form. | |
| positive | CONDITIONING,CONDITIONING_BATCH | Global-first positive conditioning: entry 0 is global and later entries pair with masks. Regional Prompt Control WeightHooks may contain ordered full-rank Anima LoRA stacks with independent schedules; standard SD/SDXL rejects regional model-side hooks. | |
| negative | CONDITIONING,CONDITIONING_BATCH | Global-first negative conditioning aligned to the same masks; Anima regional LoRA hooks retain their negative-branch ownership and independent schedules. | |
| region_masks | MASK | Optional ordered masks paired with conditioning entries 1 onward. Leave disconnected with ordinary conditioning to bypass Attention Coupling. In overlaps, prompt contributions are normalized while Anima regional LoRA deltas add in declared adapter and region order. | |
| regional_prompt_weight | FLOAT | 1.000–1 | Balances regional cross-attention against the global prompt from 0 (global only) to 1 (regional only inside solid masks); regional Anima LoRA strength remains controlled by each hook. |
| region_mask_feather | INT | 00–512 | Softens Attention Coupling and Anima regional LoRA boundaries by this many image pixels; 0 preserves authored mask values. |
| latent_image | LATENT | Latent input whose samples will be denoised. | |
| denoise | FLOAT | 1.000–1 | Sampling strength. Lower values preserve the input more; higher values allow larger changes. |
| diffusion_mode | COMBO | multidiffusion | Tile overlap blend. MultiDiffusion averages predictions; Mixture of Diffusers gives tile centers more influence. |
| latent_context_size | INT | 9616–512 | Maximum side of each model context in latent pixels. Larger contexts preserve more relationships but use more memory. |
| latent_context_overlap | INT | 320–256 | Overlap between local latent contexts in latent pixels. Larger overlaps reduce seams but increase sampling work. |
| latent_context_batch_size | INT | 41–8 | Number of equal-sized latent contexts sampled together. Higher values can be faster but use more memory. |
| global_weight | FLOAT | 1.000–2 | Strength of whole-image low-frequency guidance. 1 makes the global context authoritative; lower values allow more tile interpretation. |
| global_steps | INT | 10–10000 | Number of initial denoising steps that use the global context. Fewer steps leave more late sampling for local detail. |
| global_decay | FLOAT | 0.500–1 | Multiplier applied to whole-image strength after each global step. Lower values hand control to local contexts faster. |
| segsopt | SEGS | Optional regions that replace the regular grid with SEGS-guided contexts. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | Denoised latent for VAE decode or more latent processing. |
| contexts_segs | SEGS | Rectangular non-global contexts actually evaluated during sampling. Their SEGS masks are created only when this output is connected. |