LTX Perturbed Attention (Ray)
Guidance that uses a broken attention to make things better
- ray_actors
- ray_actors
LTX Perturbed Attention (Ray) is the raylight port of the perturbed-attention guidance family - PAG and SEG - which are a genuinely clever idea: you deliberately degrade the attention inside the model, and then use the difference between the degraded and normal output as a guidance signal that pushes the generation toward structure and coherence. It sounds backwards. It works.
Here's the mental model. Normal CFG guides toward your prompt. Perturbed-attention guidance guides toward structure itself - it compares the model's output with an attention that was sabotaged (losing cross-attention information), and steers away from the sabotage. The result is output with stronger subject definition and layout coherence, often with less prompt dependency than CFG needs. On LTX, whose weakness is precisely weak structure and drifting composition, that's valuable. There's a mode dropdown because there are two flavors:
- PAG (Perturbed Attention Guidance, default) - perturbs the attention by degrading the query path (in this implementation, by collapsing attention toward the value), then guides against the degraded reference.
- SEG (Self-Energy Guidance) - perturbs by blurring the query with a Gaussian (kernel size derived from
scale), then runs attention on the blurred query. SEG is generally the gentler, more stable flavor on video.
The inputs
- mode -
PAGorSEG. Start with PAG (the default); drop to SEG if you get artifacts. - scale - default 2.0. Strength of the perturbation. This is the main sharpness/structure knob.
- rescale - default 0.5. How much to rescale the final result after guidance - dampens the side effects of strong guidance.
- cfg - default 3.0. The CFG value the perturbed-attention guidance interacts with. Note it's a parameter for the patch, not necessarily the guider's own CFG - the two work together.
- block_indices - default
14, which blocks the patch applies to. Same comma-separated convention as the other LTXV patch nodes, and it merges with existing transformer options, so it stacks withLTXV Apply STG (Ray)and the Feta enhancer.
The practical dial
There's a real skill curve here, and it's the interaction between scale and rescale. Cranking scale alone gives you crisper structure but invites over-processed, "guidance artifacts" (that waxy, over-defined look). The rescale exists to buy back some of that. A sane pattern: bump scale a little, then raise rescale to compensate, and only raise cfg when the patch alone can't hold the subject together. If output starts looking crunchy or the motion gets rigid, back scale off before touching anything else.
Worth knowing
- PAG/SEG are additional guidance on top of whatever guider your workflow uses. If you're on a distilled LTX model running CFG 1, perturbed attention is a way to get structure guidance without turning CFG back on.
- It runs inside the Ray workers (the "Ray" suffix is doing real work), so the patch applies to every rank. If you see the patch "not working," check that
ray_actorsactually flows through this node to the sampler - a bypassed chain is the usual culprit.
Install: ComfyUI Manager → "raylight", or clone + pip install -r requirements.txt. No model downloads.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| ray_actors | RAY_ACTORS | — | |
| scale | FLOAT | 2.000–100 | — |
| rescale | FLOAT | 0.500–100 | — |
| cfg | FLOAT | 3.000–100 | — |
| mode | COMBO | PAG | 2 options: PAG, SEG |
| block_indicesopt | STRING | 14 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| ray_actors | RAY_ACTORS | — |