Nodes/ComfyUI QwenScope/Feature Heatmap
ComfyUI Node

Feature Heatmap

Feature Heatmap — the prettiest way to watch features fire across tokens

By Nynxz·Created 4 months ago·Updated 4 months ago· 0
Feature Heatmap
  • features
  • heatmap
top_k32
cell_w28
cell_h22

Feature Heatmap turns the dense output of an SAE capture into the image you always wanted: a grid of rows (top features) and columns (tokens), colored by how hard each feature fired. If you've analyzed a prompt and asked "okay, but which features lit up where?" - this node is the answer, rendered as a proper IMAGE you can drop into any image output or save.

It's the node that makes the abstract machinery tangible. Analyze Prompt gives you a feature bundle; Feature Heatmap gives you the picture. Run a sentence through, and you'll see the same handful of features glowing across related words - that's the model's features behaving like a shared vocabulary, and it's genuinely cool the first time you watch it happen.

How it works

The node reads the QSCOPE_FEATURES bundle (tokens, per-token activations, layer, SAE label), computes the mean activation of every feature across tokens, keeps the top top_k, and renders each feature as a row of cells - one per token - colored by that feature's activation at that token. The title baked into the image records the SAE pack, layer, and token count, so your output stays self-documenting. Rows are sorted by how strongly each feature fired overall, which is exactly the ordering you want when scanning for the heavy hitters.

The inputs

  • features - the QSCOPE_FEATURES output from Analyze Prompt (SAE) or Analyze CLIP (SAE). Nothing else works; this socket type only comes from those two nodes.
  • top_k - how many feature rows to render (default 32, up to 256). 32 is a good scan view; go higher when you want the long tail.
  • cell_w / cell_h - the pixel size of each token cell (defaults 28×22). Tune cell_w up for long prompts so token text stays legible; cell_h controls row height.

Output: a single heatmap IMAGE. There's no info string and no other output - it's a terminal visualization node, so wire it into a Preview / Save Image and call it done.

Installing it

Same pack, same install: ComfyUI Manager → search "ComfyUI QwenScope", or

cd ComfyUI/custom_nodes
git clone https://github.com/Nynxz/ComfyUI-QwenScope

restart. Dependencies (transformers, huggingface_hub, safetensors, Pillow, numpy) are the usual pack set. Rendering happens on CPU via Pillow, so this node is cheap - no GPU cost beyond what Analyze already spent.

Common issues

The most common stumble is wiring a non-QwenScope tensor into it - the QSCOPE_FEATURES socket type only accepts the Analyze nodes' output, so a missing wire usually means you bypassed Analyze. And if the heatmap looks like one solid block of color, check top_k on the analyze side: top_k=0 (ReLU mode) makes activations dense enough that the top rows wash out the picture. Keep analyze at a reasonable top_k (the 64 default) and the heatmap will have actual structure to show.

CategoryQwenScope/Inspect

Inputs (4)

NameTypeDefaultDescription
featuresQSCOPE_FEATURES
top_kINT321–256
cell_wINT2812–80
cell_hINT2210–60

Outputs (1)

NameTypeDescription
heatmapIMAGE