Nodes/ComfyUI-WanActivationEditor/WanVideo Vector Difference
ComfyUI Node

WanVideo Vector Difference

Extract the 'style' by subtracting one embedding from another

By fblissjr·Created about a year ago·Updated about a year ago· 9
WanVideo Vector Difference
  • text_embeds_a
  • text_embeds_b
  • difference_vector
normalizefalse
scale1.0

If you've been around the image side of things, you know prompt arithmetic: "king − man + woman" and the cultural baggage that came with it. This node brings that idea to Wan embeddings in the most literal form possible. WanVideoVectorDifference computes A − B on two WANVIDEOTEXTEMBEDS and hands you the difference vector - the "direction" in embedding space that separates concept A from concept B.

The canonical use is style extraction. The pack's own example: encode("oil painting") − encode("photo") gives you a vector that roughly points along the "painterly" axis. Once you have that direction, you can add it back onto other prompts (that's where WanVideoVectorArithmetic comes in) to push unrelated subjects toward oil-painting territory. For the block-injection crowd, a difference vector also makes a spicy injection embedding - feed it into WanVideoActivationEditor's injection_embeds and you're injecting "the difference between oil painting and photo" into your chosen blocks, which is a more abstract concept than any single prompt.

The inputs that matter

  • text_embeds_a and text_embeds_b - both required. Order matters: A − B is not B − A.
  • normalize (default off) - unit-normalizes the difference vector. On by default it'd be a pure direction; off, the magnitude encodes how far apart the two concepts are, which is information.
  • scale (−10 to 10, default 1) - multiply the result. Negative scale flips the direction, which is how you'd move away from a concept.

Single output: difference_vector, a WANVIDEOTEXTEMBEDS.

The honest caveats

Two things can bite. First, shape mismatches: if one embedding is raw 4096-dim T5 and the other is projected 5120-dim, the node pads or truncates to align them and warns about it. That's not a silent failure, but it's also not a good idea - keep both sides at the same stage. Second, this is naive vector math on a transformer's text space, not a learned concept direction. It often works because embedding spaces are genuinely structured, and it sometimes produces garbage. The README's framing - "For better or worse" - is the right energy. Treat every difference vector as a hypothesis to test, not a discovered law.

It also auto-stores the result in the pack's DuckDB database (the WanVideoEmbeddingDatabase node), so your experiments leave a paper trail.

Install

Same pack, WanVideoWrapper required 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. If you get a shape-mismatch warning in the console, that's your cue to check which stage your embeddings are at - align them before computing, not after.

CategoryWanVideoWrapper/VectorOps

Inputs (4)

NameTypeDefaultDescription
text_embeds_aWANVIDEOTEXTEMBEDS
text_embeds_bWANVIDEOTEXTEMBEDS
normalizeBOOLEANfalse
scaleFLOAT1.0-10–10

Outputs (1)

NameTypeDescription
difference_vectorWANVIDEOTEXTEMBEDS