ComfyUI Node

Scene Analyzer

The one node in Scene Compiler that's actually allowed to think

By kunail0804·Created 2 months ago·Updated 2 months ago· 0
Scene Analyzer
  • config
  • scene
  • warnings
  • errors
  • raw
natural_language

Every other node in this pack is a boring, trustworthy accountant. The Scene Analyzer is the one that's allowed to improvise - and it's the only node in the whole pipeline that talks to an AI at all. You type "a blonde girl wearing a white dress hugs a young man while walking in the rain," and it hands you a structured description of that scene. Nothing more, nothing less. That's the whole point: the Scene Compiler's philosophy is that the language model understands the scene and the compiler writes the prompt. This is the understanding step, and it's the only non-deterministic one in the chain.

Why would you bother? Because the classic natural-language-to-tags pipeline - ask an LLM to emit Danbooru tags directly - is a mess. Models invent clothing, poses, and lighting that were never described, they output tags that don't exist in the vocabulary, and they give you different garbage for identical input. Scene Compiler treats prompt generation as a compilation problem: the Analyzer extracts meaning once, and everything downstream is deterministic and traceable. If you're building an Illustrious workflow and want plain language in, valid tags out, this is the stage you start at.

How it works

The Analyzer sends your description to a local Ollama instance - http://localhost:11434, the default endpoint - and asks it to return structured Scene JSON. It's not asked for tags, ever. That separation is the whole design: the model's job is describing who, what, where, doing what, and the Resolver later looks every concept up in the shipped Knowledge Base, so a tag can never be invented. The model just needs to be good at understanding prose, and default settings push it toward consistency: temperature 0, llama3 by default, up to three retries if the answer doesn't parse.

Inputs and outputs that matter

There's exactly one input you'll touch:

  • natural_language - a multiline box. Describe the scene in plain language. The example sentence above is a good template: characters, clothing, interaction, environment.

config is optional. Wire the Configuration node here to set the model, temperature, retries, and timeout; without it, sensible defaults apply - including a generous 300-second timeout, because a local model cold-loads into VRAM on the first call and a short timeout will fail exactly when you need it to succeed.

The outputs are:

  • scene (SCENE) - the parsed, structured description. Wire this into the Scene Validator.
  • warnings / errors (STRING) - the compiler's own honesty system. Unknown concepts get reported, not silently dropped.
  • raw (STRING) - the model's actual raw text, so you can see what it returned rather than a re-serialization. Empty on a hard failure.

Installing and the gotchas

Same install as the rest of the pack, plus one extra requirement:

cd ComfyUI/custom_nodes
git clone https://github.com/kunail0804/ComfyUI-Scene-Compiler.git
# and the analyzer needs a local Ollama with a model pulled:
ollama pull llama3

Then restart ComfyUI. A ComfyUI Manager listing is planned but not published yet, so search Manager first and fall back to the clone if it isn't there.

The three ways people get burned, in order of likelihood: Ollama isn't running (you'll get a connection failure on the errors output), the model name in the Configuration node isn't pulled locally, and the first run times out because the model is still loading. All three are visible in errors and raw - connect a Debug Viewer or just read the outputs. If the first run dies at the timeout, bump analyzer_timeout in the Configuration node and run again; it's a cold-start problem, not a prompt problem.

CategoryScene Compiler

Inputs (2)

NameTypeDefaultDescription
natural_languageSTRINGDescribe your scene in plain language.
configoptCOMPILER_CONFIGOptional: connect a Configuration node to set the model and other options. Without it, sensible defaults are used.

Outputs (4)

NameTypeDescription
sceneSCENE
warningsSTRING
errorsSTRING
rawSTRING