Nodes/ComfyUi-Untwisting-RoPE/Unofficial Extensions
ComfyUI Node

Unofficial Extensions

The experimental knobs the Untwisting RoPE paper left out

By BigStationW·Created 3 months ago·Updated 2 months ago· 133
Unofficial Extensions
    • unofficial_extensions
    post_attention_adain_strength0.50
    axis0_rope_modematch_axes
    axis0_rope_scale1.00
    cosine_gated_v_injection0.00
    variance_gated_v_adain0.00
    key_subspace_alignment0.00

    These are the knobs that aren't in the paper. The author of this pack deliberately kept experimental toggles out of the main Untwisting RoPE node - the stuff they personally found useful across Z-Image, Flux.2, Anima, and Qwen-Image, but that no academic claimed. This node bundles them into one object you feed into the patcher's optional unofficial_extensions input.

    Here's the thing to understand immediately: by itself it does nothing. It takes no model, produces no image. It's a settings bag - wire the UNTWISTING_ROPE_EXTENSIONS output into the unofficial_extensions input on the UntwistingRoPE node, and only then do the toggles take effect. Leave the wire off and you're running the stock paper method.

    What each knob does

    • post_attention_adain_strength (default 0.5) - matches the target attention output's statistics to the reference's, after attention. Borrowed from ConsiStory's feature-injection idea, but simplified: no masks, no spatial correspondence maps, just a global AdaIN match. On by default out of the box.
    • axis0_rope_mode (default match_axes) - this is the interesting one. The paper recommended setting RoPE's axis 0 to a uniform value equal to low_scale, and the author's docs say for Flux.1 that's fine - but on Z-Image Turbo it "ends up amplifying the signal too much" and the results are disastrous. match_axes makes axis 0 follow the same frequency curve as the other axes (their finding: best results), and constant lets you set your own axis0_rope_scale. If your output looks overcooked, this mode is the first suspect.
    • cosine_gated_v_injection (default 0, off) - injects reference V into target V only where cosine similarity is positive. Gentler than a plain blend, fewer artifacts from pushing reference features into unrelated regions. A token-local gate inspired by CACTIF's similarity-filtered attention.
    • variance_gated_v_adain (default 0, off) - applies V AdaIN only on reference channels with high variance. The docs claim it makes output cleaner and strengthens the style transfer. No downside, allegedly.
    • key_subspace_alignment (default 0, off) - projects target keys onto reference keys so routing stays in the reference's key subspace. The docs are blunt about the sweet spot: "really effective at intensifying style transfer at low strength values (~0.1)." Start low; it compounds.

    Using it sensibly

    There's no right answer here, which is why they're unofficial. A sane first experiment: leave the defaults (post_attention_adain_strength 0.5, axis0_rope_mode match_axes, everything else 0), wire it in, and compare against an unwired run on the same seed. Then nudge key_subspace_alignment to 0.1 and see if the style bites harder without breaking the composition. Each knob is a 0–1 slider, so "off" is always available.

    Installation is identical to the rest of the pack - ComfyUI Manager → "ComfyUi-Untwisting-RoPE", or clone the repo into custom_nodes and restart. No dependencies, no model files. One honest warning: these settings are not part of the paper, which means they're the most likely things to shift or disappear across pack versions. Don't bake a critical workflow's look on a single unofficial knob without pinning the pack version - but do feel free to have fun with them.

    Categorymodel_patches/Untwisting RoPE

    Inputs (6)

    NameTypeDefaultDescription
    post_attention_adain_strengthFLOAT0.500–1Blend strength for matching the target attention output to the reference attention output.
    axis0_rope_modeCOMBOmatch_axesAxis-0 RoPE behavior. default -> Its values are equal to low_scale; match_axes -> makes axis 0 use the same curve as axes 1+; constant -> uses axis0_rope_scale.
    axis0_rope_scaleFLOAT1.000–8RoPE scale used only when axis0_rope_mode = constant.
    cosine_gated_v_injectionFLOAT0.000–1Only aligned target/reference V tokens receive reference injection.
    variance_gated_v_adainFLOAT0.000–1Applies V AdaIN only on high-reference-variance channels.
    key_subspace_alignmentFLOAT0.000–1Projects target keys onto reference keys to restrict routing towards the reference key subspace.

    Outputs (1)

    NameTypeDescription
    unofficial_extensionsUNTWISTING_ROPE_EXTENSIONS