Nodes/ComfyUI-DAAM/DAAM Analyzer
ComfyUI Node

DAAM Analyzer

See Which Prompt Words Actually Painted Your Image

By nisaruj·Created about a year ago·Updated 11 months ago· 54
DAAM Analyzer
  • clip
  • tokens
  • heatmaps
  • images
  • IMAGE
attentions
captiontrue
alpha0.50

You've been there: the render comes out, the corgi is perfect, the skateboard underneath it never happened. "Why does the model do this?" is a hard question to answer from the outside - but this node is the closest thing to asking it directly. DAAM Analyzer takes the attention heatmaps your sampler recorded while denoising and paints them back onto the image, color-coded per prompt word. It answers, with actual pixels, which part of the image each word is responsible for.

It's the third link in a three-node chain from the ComfyUI-DAAM pack: CLIPTextEncodeWithTokensKSamplerDAAM → this node. The whole point of the pack is that the middle node secretly watches where the model's cross-attention is looking on every denoising step. This node is the payoff - it turns that log into something you can look at.

How it works

Type a word into the attentions box (comma-separated, multiline). The node re-tokenizes that word with the same CLIP model, finds its token indices inside the prompt you originally encoded, then averages the per-token attention heatmaps into one map. That's how it survives words that split into multiple tokens - "skateboard" is a few tokens, not one. The map gets upsampled from the 64×64 resolution attention lives at, colored with a matplotlib colormap (yes, that's why the pack's only Python dependency is matplotlib), and blended over the image at your chosen alpha.

A neat detail: matching is done against the tokenized prompt, not the string, so it handles weight syntax like (dog:1.2) - you can even search with the parenthesized form. But the word still has to actually be in the prompt. Search for "skateboard" in a prompt that never said it and you get nothing, silently.

The inputs that matter

  • attentions - the comma-separated words to analyze. The one field you'll actually fiddle with.
  • alpha - overlay opacity, default 0.5, 0 to 1. Crank it down when the colormap drowns the image.
  • caption - default on; draws the word on its own overlay so you can tell the maps apart.
  • The four wires: clip, tokens (from CLIPTextEncodeWithTokens), heatmaps (from KSamplerDAAM), and images - the VAE-decoded output image to overlay.

Output is a single IMAGE batch: one overlay per word per image. Three words on a batch of two = six images out. Wire it into Save Image, or into the pack's DAAMPreviewImage node if you want the interactive hover view instead.

The trap that wastes an afternoon

Everything comes back blank, and the cause is usually the sampler, not this node. KSamplerDAAM has a lazy optimization: if you haven't connected its pos_heatmaps output, it doesn't record positive heatmaps at all. No wire, no data, no overlay. Wire both heatmap outputs before you blame the analyzer. Also make sure the heatmaps, tokens, and image all come from the same sampling pass - mixing passes gives you heatmaps that match a different prompt, which is worse than nothing.

Install

Same as the rest of the pack - ComfyUI Manager (search ComfyUI-DAAM), or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/nisaruj/comfyui-daam.git
cd comfyui-daam
python3 -s -m pip install -r requirements.txt

Then restart ComfyUI. That's the whole install - one lightweight dependency, no model downloads. Find all four nodes under the daam-nodes category. It's a debugging instrument, not a daily-driver sampler - keep a debug copy of a workflow, run it when a prompt misbehaves, and you'll quickly learn which of your prompt words are actually doing the work.

Categorydaam-nodes

Inputs (7)

NameTypeDefaultDescription
clipCLIPThe CLIP model used for encoding the text.
tokensTOKENSThe tokens used to encode the prompt.
heatmapsHEATMAPThe heatmap data.
attentionsSTRINGAttention words to analyze (Comma separated).
captionBOOLEANtrueWhether to show the attention word as a caption.
alphaFLOAT0.500–1The alpha value for the overlay.
imagesIMAGEOutput Images

Outputs (1)

NameTypeDescription
IMAGEIMAGEThe heatmap image.