Nodes/comfyui-fvmtools/K2 Latent Pin (outside regions)
ComfyUI Node

K2 Latent Pin (outside regions)

The tool for when a regional LoRA just won't stay in its box

By ping1979ping·Created 6 months ago·Updated about a month ago· 0
K2 Latent Pin (outside regions)
  • regional
  • base
  • mask
  • latent
strength1.00
feather_tokens2

K2 Latent Pin is the "if you really need hard locality" node of the K2 Lab suite in comfyui-FVMtools, and it exists to close the one honest gap in regional LoRA routing. A token-gated regional LoRA stops its delta at the box edge - but image-to-image attention stays continuous on purpose, because cutting it entirely produces tile seams at the boundaries. The side effect is that a regional LoRA still nudges the trajectory outside its box a little. Usually that's harmless. When it's not, this node is the fix.

The technique is dead simple and the author spells it out: sample the same seed twice - once with your regional LoRAs and once without - and pin everything outside the region union to the clean run. The outside of your frame stays exactly as the no-LoRA trajectory produced it, while the regions keep their LoRA-driven content. Then blend the seam in latent space.

The inputs

  • regional - the result of the run with regional LoRAs.
  • base - the result of the same seed without them. This is the reference trajectory the outside gets pinned to.
  • mask - the region union mask from K2 Compose.
  • strength - 1.0 pins the outside completely to the base run; 0 returns the regional result unchanged. A value between is a partial pin, useful when the drift is mild.
  • feather_tokens - soft boundary width in latent cells (default 2). 0 is a hard cut. Keep a little feather so you don't trade a drift artifact for a visible seam.

Output: latent, ready for the sampler's next stage or VAE decode.

When to bother

Honestly, most of the time you won't need this. The residual drift from regional LoRAs is usually small, and the cost - running the whole thing twice - is real. Reach for it when a style LoRA's influence is visibly creeping past its box onto the neighboring character's clothing, or when you're doing precision multi-character work where the background character must not pick up the foreground character's LoRA. It's also the answer if you keep fighting seams at high inside_strength; pinning the outside is a different, often cleaner tool than cranking the router.

Install

Same as the whole pack:

cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools

Restart ComfyUI, find it under FVM Tools/K2. No extra dependencies.

One reminder on the two-run approach: the seed has to be identical, and so does everything except the LoRA assignments. If you change anything else between the runs, the pin is pinning against a different trajectory and the whole trick falls apart.

CategoryFVM Tools/K2

Inputs (5)

NameTypeDefaultDescription
regionalLATENTResult of the run WITH regional LoRAs.
baseLATENTResult of the same seed WITHOUT them.
maskMASKRegion union mask from K2 Compose.
strengthFLOAT1.000–11.0 pins the outside completely to the base run, 0 returns the regional result unchanged.
feather_tokensINT20–32Soft boundary width in latent cells.

Outputs (1)

NameTypeDescription
latentLATENT