Nodes/comfyui-fvmtools/K2 Spatial Tuning
ComfyUI Node

K2 Spatial Tuning

Tuning for the K2 spatial attention router. Optional — K2 Compose uses these same defaults when nothing is connected. inside_strength binds regional text harder to its box. outside_penalty raises center-to-edge contrast and hard-blocks subject text outside its box. late_step_scale relaxes the binding in the last denoising steps so edges do not look pasted on.

By ping1979ping·Created 5 months ago·Updated 21 days 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
    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