Nodes/Eric Qwen-Edit & Qwen-Image Nodes/Eric Qwen Direction Inspect
ComfyUI Node

Eric Qwen Direction Inspect

The heatmap node for embedding deltas

By EricRollei·Created 6 months ago·Updated 4 months ago· 20
Eric Qwen Direction Inspect
  • direction
  • conditioning
  • original_image
  • heatmap
colormaphot
overlay_alpha0.35
cell_size32
image_token_offset0

The most satisfying node in the direction system to look at. Eric Qwen Direction Inspect takes a direction vector and renders it as a picture: a spatial heatmap showing which regions of the image carry the direction's energy, plus a bar chart of the instruction-text tokens. No GPU required - the docs note it's pure tensor math and PIL rendering.

Here's why that's useful. A direction is a delta_embeds tensor - the difference between two conditionings, where each token in the sequence maps to either a 28×28 region of the VL image or to an instruction word. Inspect computes each token's delta magnitude (L2 norm of its 3584-dim vector) and lays it out spatially. The result tells you, at a glance, what your direction is pointing at: the face region for expression edits, the whole frame for style shifts, or nothing in particular for a badly-built pair.

The inputs

  • direction - required, the only essential input.
  • conditioning - optional, and worth wiring in: it carries the grid dimensions metadata from the Encode that made the direction, so the heatmap layout is exact rather than estimated.
  • original_image - optional. Blends the heatmap over the source photo so you can see which face region the high-delta tokens correspond to.
  • colormap - hot (black→red→yellow→white, high contrast, good default for peaks), viridis, plasma, coolwarm (signed values), gray.
  • overlay_alpha - 0.0 pure heatmap, 1.0 pure original, 0.35 the default blend.
  • cell_size - pixel size of each grid cell; larger makes a bigger output image.
  • image_token_offset - number of template header tokens before the image block. 0 auto-detects (typically 3–6 for the Qwen2.5-VL chat template).

Output is a single heatmap IMAGE.

Reading the result

The console gives you the same story in numbers - signal split between image vs text tokens, and a top-tokens table with spatial coordinates. Match it to your direction type:

  • Expression direction (same image, different prompts): spatial grid near-zero, bright text-token bars. Signal is in the instruction.
  • Film emulation (different images, same prompt): bright grid across affected regions, near-zero text bars. Signal is in the image.
  • Averaged direction: diffuse, spread-out grid - the specific content cancelled, the shared axis remains.

The inspect-before-apply habit

The docs push one workflow: load a direction, branch it to both Inspect and Apply, and glance at the heatmap before committing to a render. It's a cheap sanity check that catches mislabeled files and bad pairs before you spend a full diffusion run on them.

Installing it

ComfyUI Manager → "Eric Qwen-Edit", or:

cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/Eric_Qwen_Edit_Experiments.git

Restart. Inspect itself needs no model - direction files are self-contained tensors. The rest of the graph needs a loaded Qwen-Image-Edit pipeline via the pack's loader (Qwen/Qwen-Image-Edit-2511, ~54 GB).

Gotchas

  • A blank, uniform heatmap isn't a bug. It's a near-zero direction - your pair didn't actually differ (same image, same prompt, or the edit didn't move the embedding). Go back to Direction Compute.
  • Connect the conditioning for exact layout. Without it, Inspect guesses the grid; with it, the metadata pins down image-token count and the spatial map aligns with what the Encode actually produced.
  • Heatmaps are per-token context, not per-pixel. Tokens pass through self-attention, so each one encodes its patch in context - the nose token carries the whole frame's lighting. Deltas are rarely perfectly localized, and that's expected, not an error.
CategoryEric Qwen-Edit/Conditioning/Directions

Inputs (7)

NameTypeDefaultDescription
directionQWEN_DIRECTIONDirection to inspect
conditioningoptQWEN_CONDITIONINGOptional - connects spatial layout metadata. Provides exact grid dimensions from the VL image size. Connect the conditioning used to compute this direction.
original_imageoptIMAGEOptional - the original image for overlay context. The heatmap is blended on top of the source image so you can see which face regions correspond to high-delta tokens.
colormapoptCOMBOhothot: black→red→yellow→white (high contrast, shows peaks clearly) viridis: dark blue→green→yellow (perceptually uniform) plasma: purple→pink→yellow (perceptually uniform, vivid) coolwarm: blue→white→red (good for signed values) gray: black→white (neutral)
overlay_alphaoptFLOAT0.350–1Original image blend when original_image is connected. 0.0 = pure heatmap, 1.0 = pure original, 0.35 = good default.
cell_sizeoptINT328–80Pixel size of each spatial grid cell. Larger = bigger output image.
image_token_offsetoptINT00–16Number of template header tokens before the image block. 0 = auto-detect (finds where significant signal starts). Typically 3-6 for Qwen2.5-VL chat template.

Outputs (1)

NameTypeDescription
heatmapIMAGE