Nodes/ComfyUI-Prediction/Combine Predictions
ComfyUI Node

Combine Predictions

Build your own guidance with prediction math

By redhottensors·Created 3 years ago·Updated 2 years ago· 15
Combine Predictions
  • prediction_A
  • prediction_B
  • prediction
operation

Combine Predictions is the arithmetic node for the pack's PREDICTION type. You feed it two predictions, pick an operation, and it applies that operation every denoising step. This is the Lego brick that turns ComfyUI-Prediction from "a few fixed guidance formulas" into "you can invent guidance." If you only ever use prebuilt nodes you may never touch it - but it's where the pack's real power lives.

The operations

You get eight, chosen from a dropdown:

A + B, A - B, A * B, A / B, A proj B, A oproj B, min(A, B), max(A, B)
  • + and − are the workhorses. Subtract two predictions and you get a difference - the raw direction CFG amplifies. positive - negative is literally the guidance vector inside a CFG node.
  • * and / are element-wise and can misbehave: dividing by a prediction near zero is how you get NaN explosions.
  • proj / oproj are vector projection and rejection (the README links the Wikipedia definition). They decompose one prediction into "parallel to" the other (proj) and "perpendicular to" the other (oproj). This is the machinery behind Perp-Neg and Avoid and Erase, and it's the operation you want when a guidance strategy is "go in this direction, but not the part that's also that direction."
  • min / max are element-wise and safe - useful for clamping one prediction's influence against another.

The formula shown in the README is simply prediction_A <operation> prediction_B.

Inputs and outputs

  • prediction_A, prediction_B (PREDICTION) - any two predictions, including other Combine Predictions, so you can nest arbitrarily deep.
  • operation (enum) - the eight choices above.

Output: one prediction, wired into the next node in your chain or straight into Sample Predictions' noise_prediction.

How it works

This node is a pure tensor operation - it does not itself run the model. Each step it asks both child predictions for their outputs (the pack caches per-step, so shared conditionings aren't re-evaluated) and applies the operation. That means the cost of a Combine chain is whatever its leaves cost, plus nothing. It's also how the pack stays honest: there's no hidden math, you're just composing denoising gradients.

Why you'd build rather than buy

Say you want "CFG against a difference of two negatives," or "positive plus 30% of a style vector," or a guidance term that only survives where both predictions agree (that's min(A, B)). None of those are prebuilt nodes. All of them are one Combine Predictions graph away. The README frames the primitives as the foundation - Conditioned Prediction, Combine, and Scale can express "all other predictions," just messier. Combine is the clean middle of that.

Installing it

Ships in the ComfyUI-Prediction pack by @RedHotTensors (Project RedRocket). ComfyUI Manager → search "ComfyUI-Prediction", or:

cd ComfyUI/custom_nodes
git clone https://github.com/redhottensors/ComfyUI-Prediction

Restart ComfyUI. No extra dependencies or model files. It's under Add Node > sampling > prediction.

Common issues

  • NaN / garbage with division. A / B divides by near-zero predictions at some step and blows up. Reach for a different combination or clamp with min/max.
  • Unexpected shapes. Both inputs must be PREDICTION tensors from this pack's graph - mixing in a raw conditioning or a latent will error at the wire, not silently.
  • ControlNet unsupported pack-wide - remember that limitation before you design a Combine-heavy workflow that needs it.
Categorysampling/prediction

Inputs (3)

NameTypeDefaultDescription
prediction_APREDICTION
prediction_BPREDICTION
operationCOMBO8 options: A + B, A - B, A * B, A / B, A proj B, A oproj B, +2

Outputs (1)

NameTypeDescription
predictionPREDICTION