Nodes/ComfyUI Model Bending/Add Scalar Module (Bending)
ComfyUI Node

Add Scalar Module (Bending)

Add a constant to a layer

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

    If bending is a box of levers, this is the one labeled "push hard." The Add Scalar Module adds a single constant to every element of a layer's activations. No weighting, no noise, no cleverness - just a DC offset slammed into the signal path. And because it's so dumb, it's often the cleanest way to see what a layer is for: you're shifting its entire output range, which is exactly the kind of abuse that separates "this layer does composition" from "this layer does texture."

    It produces a BENDING_MODULE, same as every module node in this pack: a recipe you inject into a model with Model Bending (custom path), Model Bending (SD Layers), or Model VAE Bending. Under the hood it's a tiny nn.Module whose bend() fills a tensor with your scalar (same shape, same device, same dtype as the input) and adds it. Zero is a no-op - which the default happens to be, so nothing surprises you until you touch the dial.

    Only one input matters: scalar, default 0, range −100 to 100. Negative values push the opposite direction. The effect scales with layer sensitivity: a scalar of 10 on a middle-block layer of SDXL visibly bends color and composition (the README's demo loop runs −10 to 30 on middle_block.2.out_layers and produces a wild animation); the same 10 on some late output layer might barely register.

    The README's own catalog is a great guide to how brutal this knob is: images sampled with activations multiplied by 0 (ablation), 0.5, 1, 1.5, and 2, sorted by layer. Multiplying is the sibling knob, but addition gives you the "everything shifts at once" distortion that makes for the most surreal results. A good first experiment: inject it into a middle block with a scalar around 15 and watch a portrait slide into something that isn't quite a portrait.

    Install: ComfyUI Manager → search "ComfyUI-Model-Bending" → install → restart and refresh. Manual:

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

    Pack dependencies are kornia and scikit-learn; Manager installs them, or pip install -r requirements.txt if you cloned by hand.

    The honest caution: this node will absolutely ruin an image faster than any other module in the pack, and there's no preview until you sample. Start at 5, look, then go bigger. And don't confuse it with Latent Operation (Add Scalar) - that one targets the latent/conditioning side via LATENT_OPERATION, this one bends activations inside the model. Different sockets, different game.

    Categorymodel_bending

    Inputs (1)

    NameTypeDefaultDescription
    scalarFLOAT0.00-100–100

    Outputs (1)

    NameTypeDescription
    BENDING_MODULEBENDING_MODULE