Nodes/DiffusionGemma Prompt Builder/DiffusionGemma Generation Gate
ComfyUI Node

DiffusionGemma Generation Gate

The bouncer that stops DiffusionGemma's bad prompts from ever reaching your sampler

By exportAnything·Created 2 months ago·Updated a day ago· 44
DiffusionGemma Generation Gate
    • prompt
    prompt
    ready_for_generationfalse
    metadata_json
    validation_policystrict

    The name is doing honest work: this node is a gate, not a generator. DiffusionGemma - the NVIDIA model behind this pack - is an LLM that writes structured prompts for LTX, MiniMax H3, or Ideogram. LLMs also confidently ship garbage. DiffusionGemma Generation Gate sits between the model's JSON and your actual sampler, and it fails closed: if the prompt didn't validate, the workflow stops instead of quietly rendering a prompt that Director already knows is broken.

    Think of it as the fail-safe end of the Director pipeline. DiffusionGemma Director is a five-node core - Model Loader, Context Hub, one model-specific Target Profile, the CoT Generator that writes the final JSON, and the JSON Splitter that unpacks it - and the gate is the checkpoint where that JSON gets one last look before it becomes conditioning. In the README's recommended wiring, the JSON Splitter's ltx_prompt feeds this node's prompt, ready_for_generation feeds its boolean, and the gate's prompt output is what you actually connect to the LTX positive-prompt input.

    How it works

    It takes the splitter's verdict rather than re-running the model. ready_for_generation is a boolean the splitter computed from validation; metadata_json carries the machine-readable reasons (blocked validators, grounding-guard decisions, retry history). The gate then does its own hard checks on top:

    • If the Grounding Guard (a strict visual-evidence check from a Settings node upstream) blocked, it raises an error explaining which guard reasons fired.
    • If ready_for_generation is false, it raises with human-readable corrective sentences - the author deliberately writes out "fix these issues and queue again" style reasons instead of opaque validator IDs.
    • If the prompt text is empty, it blocks. An empty prompt reaching a sampler is worse than an error.

    There's one escape hatch: validation_policy. Default is strict, which blocks on everything. warn_and_continue permits a non-empty MiniMax-H3 candidate when the only remaining failures came from the MiniMax-H3 validator - but Grounding Guard and non-H3 failures still always block. That policy exists because the H3 validator is intentionally structural and people sometimes want a warning, not a hard stop, on an H3-only nit.

    Inputs that matter

    • prompt - the validated prompt text from the JSON Splitter.
    • ready_for_generation - the splitter's go/no-go boolean.
    • metadata_json (optional) - validation details; feed it and the errors get specific instead of generic.
    • validation_policy - strict or warn_and_continue.

    The single output, prompt, is the only thing you wire downstream. That's by design - it's the same value coming in, but now guaranteed.

    Use it in a comparison workflow? Use the other one

    This node raises a ValueError, which aborts the whole queue. If you're running two model branches side by side and one fails validation, you don't want it taking down the other - that's what DiffusionGemma Branch Generation Gate is for. It shares this gate's logic but blocks only its own branch with an ExecutionBlocker and exposes a diagnostic status output instead. One per generation branch.

    Installing it

    This is one of 55 nodes in the exportAnything/ComfyUI-DiffusionGemmaPromptBuilder pack, so you're installing the whole thing:

    cd ComfyUI/custom_nodes
    git clone https://github.com/exportAnything/ComfyUI-DiffusionGemmaPromptBuilder
    

    or search DiffusionGemma Prompt Builder in ComfyUI Manager and restart. The Python deps (transformers>=5.12.1, accelerate, comfy-kitchen, safetensors, …) install with it, but the model does not: download the whole nvidia/diffusiongemma-26B-A4B-it-NVFP4 repo folder from Hugging Face into ComfyUI/models/LLM/. The gate itself needs nothing heavy - the ~26B NVFP4 model and its ~110-second prompt runs are the CoT Generator's problem, upstream of this node.

    Common issues

    • "DiffusionGemma blocked generation because the prompt did not pass validation" - that's the gate doing its job. Read the reasons, fix the brief or media, queue again. This is a feature, not a bug: the whole point is that an invalid prompt is impossible to overlook.
    • Still blocked after you changed the brief? The CoT Generator caches by default (reuse). If inputs didn't actually change, an unchanged blocked result stays blocked. Select refresh once on the CoT Generator, queue, then put it back on reuse.
    • Remember what's not isolated: this gate guards prompt content. An uncaught CUDA or out-of-memory error downstream can still abort the queue, so for that kind of failure isolation you want separate Run Branch jobs, not this node.
    Categoryprompt/diffusiongemma

    Inputs (4)

    NameTypeDefaultDescription
    promptSTRING
    ready_for_generationBOOLEANfalse
    metadata_jsonoptSTRING
    validation_policyoptCOMBOstrictStrict blocks every validator failure. Warn and continue permits a non-empty MiniMax-H3 candidate when every remaining failure comes from the MiniMax-H3 validator; Grounding Guard and non-H3 failures always remain blocking.

    Outputs (1)

    NameTypeDescription
    promptSTRING