Nodes/ComfyUI Model Bending/Threshold Module (Bending)
ComfyUI Node

Threshold Module (Bending)

Silence every weak activation

By abuzreq·Created about a year ago·Updated 3 months ago· 21
Threshold Module (Bending)
    • BENDING_MODULE
    threshold0.00

    The BENDING_MODULE version of the threshold operation: pick a threshold, and every activation in your target layer whose absolute value sits below it gets zeroed out. Weak signal dies, strong signal survives, and the layer's output becomes a sparse skeleton of its former self - which the next layer has to make sense of. It's the module to reach for when you want a layer to "focus on the loud stuff" instead of being amplified or spun.

    It's one of the (Bending) module factories in ComfyUI-Model-Bending: one number in, a BENDING_MODULE out, consumed by Model Bending, the SD Blocks/Layers variants, Model VAE Bending, or LoRA Bending. The same threshold math exists in latent form as Latent Operation (Threshold) - this node is the version that bends model layers, not latents.

    The one input

    • threshold (FLOAT, default 0) - the cutoff; any value with abs(v) < threshold becomes 0.

    The default 0 is a no-op, since every value's absolute magnitude is ≥ 0. So the node does nothing until you raise the knob - that's the pass-through you'd expect, not a bug. The operation is the pack's hard threshold: values at or above the cutoff are kept as-is, everything else is zeroed. (There's a separate soft_threshold in the underlying library that shrinks values instead of zeroing them, but this module is the hard one.)

    How to use it

    Thresholding is a sparsifying bend, and sparsity reads as structure. On a mid-UNet layer it makes the composition hold onto its strongest features while dropping the fine detail the model was going to fill in - which is why it's a reliable lever for "stylized" looks: the image keeps its bones and loses its polish. A useful ramp: put it on a layer you've already ablation-mapped (Multiply Scalar at 0 to learn what the layer does), then sweep the threshold from a small value up. Layers carrying color or texture thresholds out fast and the output washes; layers carrying composition hold longer and get cleaner.

    It also plays well as a LoRA probe: thresholding a LoRA's weights (via LoRA Bending (list)) and keeping only the strongest components is a crude but effective "what's essential in this LoRA" test.

    Installing

    Ships in the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/abuzreq/ComfyUI-Model-Bending
    

    Restart ComfyUI and refresh your browser, or search ComfyUI-Model-Bending in ComfyUI Manager. Deps are kornia + scikit-learn, no model downloads. Name the clone folder ComfyUI-Model-Bending - the README's ComfyUI-Web-Bend-Demo folder name is stale copy-paste.

    Where people get tripped up

    Two things catch beginners. First, the threshold is compared against absolute value, so negative activations of large magnitude survive too - you're keeping "strong," not "positive." Second, this is applied every step by default, so the sparsification compounds: a threshold that looks mild on step one can hollow the image out by step thirty. If you want it at one step only, remember the step controls live on the custom-path Model Bending node (steps_to_bend_str), not here. And if nothing happens at all - default 0, you've been warned.

    Categorymodel_bending

    Inputs (1)

    NameTypeDefaultDescription
    thresholdFLOAT0.00

    Outputs (1)

    NameTypeDescription
    BENDING_MODULEBENDING_MODULE