WanVideo Vector Arithmetic
Add, weight, multiply, and normalize up to four prompts at once
- base_embeds
- operand_1
- operand_2
- operand_3
- result_embeds
The vector difference node does one arithmetic trick: subtraction. This one does the whole spreadsheet. WanVideoVectorArithmetic takes a base embedding, up to three more operands, and lets you combine them with add / weighted sum / multiply / normalize - which covers most of the "prompt engineering as math" moves you'd actually want to make on Wan embeddings.
Here's the workflow it's built for. In the WanVideoVectorDifference article I described extracting a "painterly" direction as oil painting − photo. This node is where you apply it: base = "a fox in a forest", operand_1 = your extracted direction with weight_1 around 0.5, operation add - and the result is a WANVIDEOTEXTEMBEDS that's your subject nudged toward painting. You can stack up to three adjustments in one node (four inputs total: base + three operands), each with its own weight from −10 to 10. Negative weights subtract, which is how you push away from a concept.
The four operations
- add - base + weighted operands. The bread and butter.
- weighted_sum - same but weights are normalized first, so the result's scale stays in the ballpark of the inputs. The "don't blow up the magnitude" option.
- multiply - element-wise multiplication of the weighted embeddings. Weirder, more unpredictable; it's the "see what happens" button.
- normalize - sums the weighted terms, then unit-normalizes the result. Good when you want a pure direction regardless of magnitude.
Inputs: base_embeds (required), operation (required), and optional operand_1..3 with their weight_1..3. Output: result_embeds.
The honest caveats
Same shape-mismatch warnings as the other vector nodes - it pads/truncates to the largest shape, and mixing raw (4096) and projected (5120) embeddings across operands produces mushy results. Keep everything at the same stage. And the "calculator" framing is doing a lot of work: embedding-space math is heuristic, not algebra. Addition often works for style/concept combinations, and every once in a while it produces something genuinely surprising - which is the entire reason to have a four-operand embedding calculator in the first place.
There's also a nice paper-trail touch: the node records the operation and its operands into the pack's DuckDB database (WanVideoEmbeddingDatabase node can show you the operation history with timings and memory), which matters if you're running the community "map the block space" experiments and want your vector ops to be reproducible.
Install
Same pack, WanVideoWrapper first:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper # required first
git clone https://github.com/fblissjr/ComfyUI-WanActivationEditor
cd ComfyUI-WanActivationEditor && pip install -r requirements.txt
Restart ComfyUI (ComfyUI Manager: search "ComfyUI-WanActivationEditor"). Deps: torch, numpy, duckdb, zstandard. Start with add and small weights (0.3–0.7); only wander into multiply when you're ready for the weird stuff.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| base_embeds | WANVIDEOTEXTEMBEDS | — | |
| operation | COMBO | add | 4 options: add, weighted_sum, multiply, normalize |
| operand_1opt | WANVIDEOTEXTEMBEDS | — | |
| weight_1opt | FLOAT | 1.0-10–10 | — |
| operand_2opt | WANVIDEOTEXTEMBEDS | — | |
| weight_2opt | FLOAT | 1.0-10–10 | — |
| operand_3opt | WANVIDEOTEXTEMBEDS | — | |
| weight_3opt | FLOAT | 1.0-10–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result_embeds | WANVIDEOTEXTEMBEDS | — |