Nodes/comfyui-fvmtools/K2 Spatial Tuning
ComfyUI Node

K2 Spatial Tuning

A dozen knobs for the Krea 2 router, and the defaults are fine

By ping1979ping·Created 6 months ago·Updated about a month ago· 0
K2 Spatial Tuning
    • tuning
    spatial_enabledtrue
    strict_isolationtrue
    inside_strength1.00
    outside_penalty1.00
    falloff_pixels128
    late_step_scale0.35
    subject_competitiontrue
    subject_filltrue
    spatial_instructionstrue
    lora_delta_adaptationfalse
    lora_adaptation_gain0.35
    fuse_global_lorastrue

    K2 Spatial Tuning is the least exciting node in the K2 Lab, and that's fine - it's a settings bag. It outputs a single K2_TUNING object you feed into K2 Compose, and it is entirely optional: Compose uses these exact same defaults when nothing is connected. You only reach for this node when a regional render misbehaves, which is how a tuning node should work.

    The knobs tune the spatial attention router, the thing that makes regional prompting possible on Krea 2 at all. Krea 2 is a single-stream model - text and image tokens share one sequence - so there's no second conditioning branch to attach a second character to. The router works at the attention-logit level instead, biasing each region's text tokens toward the image tokens inside its box. This node dials that bias.

    The three knobs that matter

    • inside_strength - how hard regional text binds to its box. Larger values bind harder; very large values flatten the image. If a subject's attributes are drifting into the background, nudge this up.
    • outside_penalty - center-to-edge contrast, and how hard subject text is blocked outside its box. Background regions use a quarter of it.
    • late_step_scale - how much spatial strength survives the last denoising steps. Relaxation starts after 55% progress, and this is what stops region edges from looking pasted on. Note it needs the K2 Regional Sampler; a plain KSampler won't drive it.

    Then there's strict_isolation, the one boolean that changes the router's character. On (default), subject-owned text tokens are private to their subject and unreachable for image tokens outside the box. Off, it degrades to a soft bias and attributes bleed between subjects. Turning it off is the first thing to try when the hard partition makes two overlapping people look disembodied or stiff.

    The rule that's easy to break

    spatial_enabled off disables the router completely - which sounds harmless until you remember the router is what keeps regional LoRAs local. If a regional LoRA is active and you switch the router off, its text delta becomes shared scene conditioning and leaks into every region. The node won't let you do it, and for good reason.

    Output and wiring

    One output, tuning, into K2 Compose. That's the whole wiring story.

    Measured advice, if you're going further

    The K2 Lab docs are unusually honest about the multi-region ceiling: two to three subjects sit reliably, and at four the model starts staggering people into depth instead of sizing them evenly. The measured help is a landscape aspect, inside_strength around 2.6 with outside_penalty around 2.0, and "shown full length" in every region prompt. The included four-region example workflow ships with exactly those values.

    Installing it

    Same as the pack: git clone https://github.com/ping1979ping/comfyui-FVMtools into custom_nodes, restart ComfyUI. Zero extra dependencies - this node is pure configuration on top of the K2 runtime.

    CategoryFVM Tools/K2

    Inputs (12)

    NameTypeDefaultDescription
    spatial_enabledBOOLEANtrueOff disables the router completely. Not allowed while a regional LoRA is active — its text delta would become shared scene conditioning.
    strict_isolationBOOLEANtrueHard partition: subject-owned text tokens are private to their subject and unreachable for image tokens outside its box. Off = soft bias only (attributes can bleed between subjects).
    inside_strengthFLOAT1.000.05–10Positive attention bias inside each region. Larger values bind regional text harder to its box; very large values can flatten the image.
    outside_penaltyFLOAT1.000–10Background regions use one quarter of this value.
    falloff_pixelsFLOAT1280–2048Soft edge width beyond a background box. Subject text stays hard-confined.
    late_step_scaleFLOAT0.350–1Fraction of spatial strength kept at the last step. Relaxation starts after 55% progress. Needs K2 Sampler.
    subject_competitionBOOLEANtrueOverlapping subjects share tokens by squared field strength instead of both claiming them fully (prevents merged people).
    subject_fillBOOLEANtrueKeeps the field strong towards box edges so subjects fill their area.
    spatial_instructionsBOOLEANtrueAdds the generated location sentences to the prompt. Off = attention-only routing (shorter prompt, weaker placement).
    lora_delta_adaptationBOOLEANfalseRebalances each region's spatial scale from the observed regional LoRA delta energy. Needs K2 Sampler.
    lora_adaptation_gainFLOAT0.350–1Maximum correction gain for LoRA-delta adaptation. 0 measures without correcting.
    fuse_global_lorasBOOLEANtrueGlobal LoRAs as normal fused patches (faster). Off routes them through the same unfused path as regional LoRAs.

    Outputs (1)

    NameTypeDescription
    tuningK2_TUNING