Nodes/ComfyUI Model Bending/Latent Operation (Add Scalar)
ComfyUI Node

Latent Operation (Add Scalar)

Latent Operation (Add Scalar)

By abuzreq·Created about a year ago·Updated 3 months ago· 21
Latent Operation (Add Scalar)
    • LATENT_OPERATION
    scalar0.00

    The simplest of the pack's operation builders, and a good place to learn what LATENT_OPERATION actually is. This node returns a callable that adds a single constant to every element of whatever latent tensor it's handed. It doesn't do anything until you feed it to a consumer node - ConditioningApplyOperation, LatentApplyOperationCFGToStep, or Latent Operation To Module - which is where the shift actually happens.

    Why would you want to flat-shift a latent? Because a constant offset isn't "a bit of brightness" - in the compressed latent space the model works in, adding a constant to an embedding or intermediate latent biases the whole representation in one direction, which the model interprets in its own way. The pack's framing is "move conditionings in semantic latent space," and add-scalar is the bluntest way to do exactly that: no texture, no randomness, just a DC offset that pushes the interpretation of the whole tensor.

    One input: scalar, default 0. Zero is a no-op, so the node is harmless until you move the dial. Positive shifts push one way; negative pull the other. Where you wire it decides the scale of the effect: applied to a conditioning via ConditioningApplyOperation it's a subtle semantic nudge; applied to the mid-denoise latents via LatentApplyOperationCFGToStep at a big value it can swing an image's whole character at that step.

    Note the family resemblance: the pack also ships Add Scalar Module (Bending), which adds a scalar to a model's activations at a chosen layer and produces a BENDING_MODULE. This node instead produces a LATENT_OPERATION for the latent/conditioning side. Same math, different socket - and mixing the two up is the classic wiring mistake. If your operation won't connect to a sampler, that's why: it only plugs into the pack's own consumers.

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

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

    Dependencies: kornia and scikit-learn (Manager handles them).

    Realistic expectations: as a standalone node it's nearly invisible - the value only appears in the context of the node that consumes it. So don't judge it in isolation; build the small chain (operation → LatentApplyOperationCFGToStep at step 0) and sweep the scalar. It's the gentlest operation in the kit, which makes it the one you reach for when you want a nudge you can actually reason about.

    Categorymodel_bending

    Inputs (1)

    NameTypeDefaultDescription
    scalarFLOAT0.00

    Outputs (1)

    NameTypeDescription
    LATENT_OPERATIONLATENT_OPERATION