Nodes/Anima-coceptattention-survey-for-comfyui/Anima Concept Survey Model Patch
ComfyUI Node

Anima Concept Survey Model Patch

See what Anima is actually looking at when you prompt it

By Shiba-2-shiba·Created 3 months ago·Updated 3 months ago· 2
Anima Concept Survey Model Patch
  • model
  • clip
  • model
modeobserve
capture_leveltokens
prompt_text
concept_terms
target_call_indicesall
diagnostic_call_indicesall
branch_modeboth
max_tokens16
max_steps0
jsonl_pathanima_concept_survey/logs/survey.jsonl
save_heatmapsfalse
heatmap_diranima_concept_survey/heatmaps
heatmap_outputconcepts_only
max_logits_mib1024
fail_modefallback

The pitch for Anima (Circlestone's 2B anime model on a Cosmos-Predict2 backbone) is that it actually listens to your words. Multi-character scenes, spatial relations, attribute binding - stuff SDXL tags could never express. But "listens" is a black box: which words, at which step, get paid attention to? That's what Anima Concept Survey Model Patch exists to answer. It's an observe-only cross-attention surveyor that watches what the model is attending to while it generates, and writes it all to JSONL, CSVs, and heatmap PNGs. It doesn't edit a thing - you get a pass-through model and a pile of forensic data. If you've ever wondered whether a LoRA or a prompt phrase is actually doing work, this is your microscope.

What it does, mechanically

The node installs an attention override. On every eligible attention call it runs the original backend, returns the output untouched, and separately records which text tokens (keys) the image-latent query positions leaned on. Per step, per call, per CFG branch. If a call can't be observed, fail_mode=fallback just returns the original attention silently - it never edits the result. That's the whole design: observe, don't touch.

To turn token indices into words, it needs your CLIP and the exact prompt_text, and it uses clip.tokenize() to rebuild token_id / token_text / token_source labels. Feed it Anima's Qwen3 text encoder and the phrase "big breasts" becomes a contiguous token sequence it can hunt for. Without CLIP/prompt it degrades to <token:ID> placeholders - workable, but much less fun.

The inputs that matter

  • model / clip - your Anima (or Cosmos-family) model and its text encoder. This is the catch: if the model isn't Anima-like (the node checks for the Anima class or an llm_adapter + blocks layout), it raises a hard error. No SDXL, no Illustrious, no Flux.
  • mode - observe records, off passes through. There is no "edit" mode; the survey is read-only.
  • capture_level - summarytokensheatmap. Go straight to heatmap; that's the good stuff.
  • prompt_text - paste the exact generation prompt.
  • concept_terms - phrases one per line, e.g. red hair, or source-scoped like qwen3_06b:big breasts to avoid ambiguous matches. This is what produces per-phrase heatmaps.
  • max_tokens - how many top-token heatmaps get saved. It does not sharpen concept heatmaps, which are built from the matched phrase tokens' attention mass. The README is blunt about this.
  • branch_mode - positive_only is the recommended start; negative CFG branch heatmaps tend to be near-uniform and fool you.
  • jsonl_path, save_heatmaps, heatmap_dir, heatmap_output - where things land.

Output is a single MODEL that slots between your Anima loader and the sampler. Nothing else leaves the node.

Installing it

ComfyUI Manager (search "Anima-coceptattention-survey-for-comfyui") or the old-fashioned way:

cd ComfyUI/custom_nodes
git clone https://github.com/Shiba-2-shiba/Anima-coceptattention-survey-for-comfyui

Restart ComfyUI and you'll find it under model_patches/anima. No model downloads, no requirements.txt, nothing beyond torch and the ComfyUI API - the README even shows a PowerShell symlink into custom_nodes for local dev. This is a tiny experimental pack from an individual maintainer, so expect rough edges, not a polished product.

Reading the results without fooling yourself

After a run, aggregate the JSONL:

python scripts/summarize_survey.py path/to/survey.jsonl \
  --out-dir path/to/report --latest-run

You get survey_by_concept.csv, survey_by_token.csv, and the star of the show, recommended_lora_targets.csv - the tokens a LoRA should target if you want to reinforce a concept. But the preview PNGs are per-file min-max normalized, so colors are not comparable across runs or branches. Judge localization from the .npy arrays and the manifest stats (heatmap_max_over_mean under 1.05 means near-uniform - the concept isn't localizing, it's everywhere). Where people get burned: assuming the negative branch means anything from preview color, and mixing multiple runs into one append-only JSONL - the summarizer flatly refuses to aggregate mixed runs until you pick one with --run-id or --latest-run.

It's also an MVP: only square image-query grids, and it can't coexist with an existing optimized_attention_override. Anima is slow to begin with, so survey with a fixed seed and a short run, and confirm your output image matches a no-node baseline. If it does - you now know exactly what your prompt was doing in there.

Categorymodel_patches/anima

Inputs (17)

NameTypeDefaultDescription
modelMODEL
clipCLIP
modeCOMBOobserve2 options: observe, off
capture_levelCOMBOtokens3 options: summary, tokens, heatmap
prompt_textSTRINGPrompt text used to restore token text labels with the connected CLIP.
concept_termsSTRINGOptional phrases to export as combined phrase heatmaps, one per line. Example: big breasts
target_call_indicesSTRINGall
diagnostic_call_indicesSTRINGall
branch_modeCOMBOboth3 options: both, positive_only, negative_only
max_tokensINT161–512
max_stepsINT00–10000
jsonl_pathSTRINGanima_concept_survey/logs/survey.jsonlAbsolute .jsonl file, or relative .jsonl file under ComfyUI output directory. Empty disables JSONL output.
save_heatmapsBOOLEANfalse
heatmap_dirSTRINGanima_concept_survey/heatmapsAbsolute directory, or relative directory under ComfyUI output directory.
heatmap_outputCOMBOconcepts_onlyChoose concepts_only for concept_terms phrase maps without unrelated top-token heatmaps.
max_logits_mibFLOAT10241–65536
fail_modeCOMBOfallback2 options: fallback, raise

Outputs (1)

NameTypeDescription
modelMODEL