Anima Concept Survey Model Patch
See what Anima is actually looking at when you prompt it
- model
- clip
- model
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
Animaclass or anllm_adapter+blockslayout), it raises a hard error. No SDXL, no Illustrious, no Flux. - mode -
observerecords,offpasses through. There is no "edit" mode; the survey is read-only. - capture_level -
summary→tokens→heatmap. Go straight toheatmap; 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 likeqwen3_06b:big breaststo 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_onlyis 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.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| clip | CLIP | — | |
| mode | COMBO | observe | 2 options: observe, off |
| capture_level | COMBO | tokens | 3 options: summary, tokens, heatmap |
| prompt_text | STRING | Prompt text used to restore token text labels with the connected CLIP. | |
| concept_terms | STRING | Optional phrases to export as combined phrase heatmaps, one per line. Example: big breasts | |
| target_call_indices | STRING | all | — |
| diagnostic_call_indices | STRING | all | — |
| branch_mode | COMBO | both | 3 options: both, positive_only, negative_only |
| max_tokens | INT | 161–512 | — |
| max_steps | INT | 00–10000 | — |
| jsonl_path | STRING | anima_concept_survey/logs/survey.jsonl | Absolute .jsonl file, or relative .jsonl file under ComfyUI output directory. Empty disables JSONL output. |
| save_heatmaps | BOOLEAN | false | — |
| heatmap_dir | STRING | anima_concept_survey/heatmaps | Absolute directory, or relative directory under ComfyUI output directory. |
| heatmap_output | COMBO | concepts_only | Choose concepts_only for concept_terms phrase maps without unrelated top-token heatmaps. |
| max_logits_mib | FLOAT | 10241–65536 | — |
| fail_mode | COMBO | fallback | 2 options: fallback, raise |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |