Nodes/DiffusionGemma Prompt Builder/DiffusionGemma CoT Generator
ComfyUI Node

DiffusionGemma CoT Generator

Where DiffusionGemma actually thinks — and why your first run takes two minutes

By exportAnything·Created 2 months ago·Updated 4 days ago· 44
DiffusionGemma CoT Generator
  • model_config
  • gemma_context
  • target_profile_config
  • grounding_guard_config
  • h3_reference_policy
  • final_json
  • reasoning_text
  • raw_response
  • metadata_json
  • grounding_status
  • grounding_report_json
temperature0.45
creativity_modeeditorial
creative_strength0.60
thinking_modeauto
max_new_tokens1024
director_cache_modereuse
grounding_guard_modeinherit
measured_audio_report_json

This is the heart of the pack, and it's the node that makes everything else worth installing. The CoT Generator is where DiffusionGemma - the full NVFP4 model, not a text encoder - runs a chain-of-thought pass over your Context Hub bundle and Target Profile contract, then hands back a structured JSON "prompt packet" ready to feed a real sampler. If you've seen the author's demo video of the LTX 2.3 character motion-transfer workflow, this is the node that produced the prompts in it.

Here's the patience-budgeting part up front: it's slow. The author's own numbers are an average of ~110 seconds to generate a prompt from an image or video with thinking enabled on 18 GB of VRAM (faster if you let it use more), and that's before the video model renders anything. Your first run also pays the cold-start cost of loading the 26B model. This node is the reason you're reading this article to get everything else wired right before you click queue.

How it works

The generator assembles a large master prompt - a "local ComfyUI prompt architect" system prompt, the target contract from your Target Profile, your context, and media grounding instructions - and sends it (with pixels, since the NVFP4 backend supports them) to the model. The response is expected to be JSON wrapped in explicit <|final_json|>…<|end_final_json|> delimiters.

Then the real engineering kicks in on the way back. The node splits any chain-of-thought reasoning out of the answer, extracts the delimited JSON, and parses it. If the model returns malformed JSON - which happens, it's a language model - it falls through a salvage path (labeled/plain-text recovery) and finally to a deterministic template packet rather than handing you a crash. Everything about that journey is exposed on the debug outputs, which is why this node is unusually fixable when it misbehaves.

The inputs that matter

It's all inputs, since it's fed entirely from upstream nodes - but the knobs worth touching:

  • temperature - generation randomness for this pass, default 0.45. The tooltip's the tell: it rewrites the sampling temp without changing the loader node. Nudge this up toward 0.6–0.8 for looser, more creative prompts; keep it low when you need the output to track your brief tightly.
  • creativity_mode - faithful, editorial (default), cinematic, concept_art, wild. This is how much art direction the model is allowed to invent on top of your brief. faithful adds almost nothing; wild pushes bold genre fusions. editorial is the safe middle.
  • creative_strength - 0.0–1.5, default 0.6. Scales how hard the chosen creativity mode pushes.
  • thinking_mode - auto (default), on, off. Whether the model does visible chain-of-thought reasoning before the final JSON. On = better planning, slower.
  • max_new_tokens - output budget, default 640. Lower is faster; the tooltip notes higher values help Ideogram JSON or dual-output prompts finish cleanly.

Outputs are the ones that make this node debug-friendly: final_json (the structured packet - wire it to the JSON Splitter), reasoning_text (the <think> content, great for seeing what the model inferred about your source), raw_response (the complete raw output, for when the JSON came back ugly), and metadata_json (timing, parse/salvage flags, and blocked_reasons).

Install

Same pack install as the rest: ComfyUI Manager (search DiffusionGemma Prompt Builder) or

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

restart, then make sure the NVFP4 model folder is in place and the proof gate passes before your first real run - a failed first generation after a cold model load is a two-minute lesson you don't need to repeat. Dependencies: transformers>=5.12.1, comfy-kitchen, accelerate, and a ComfyUI build with comfy.quant_ops for the NVFP4 bridge.

Common issues

  • It fails with a runtime_required error on first run - almost always a missing or misplaced model, or the processor failing to resolve a chat template from a partial download. Run proof_gates.py --model-path … first; it tells you which gate is red before you spend a generation finding out.
  • Slow. It's not stuck; a 26B MoE doing CoT on 18 GB takes a couple of minutes. If you want it snappier, drop max_new_tokens, set thinking_mode to off, or raise max_memory_gb if your card has headroom.
  • Output looks structured but wrong - check reasoning_text and raw_response before blaming the model. Nine times out of ten the CoT reveals it misread your brief or the media synthesis mode, and that's a Context Hub / Target Profile problem, not a generator one.
Categoryprompt/diffusiongemma

Inputs (13)

NameTypeDefaultDescription
model_configDG_MODEL_CONFIG
gemma_contextDG_CONTEXT
target_profile_configDG_TARGET_PROFILE_CONFIG
temperatureFLOAT0.450–2GGUF compatibility temperature. Rewrites GGUF --temp; guarded in-process DiffusionGemma uses its native 0.8-to-0.4 sampling profile instead.
creativity_modeCOMBOeditorialAll five modes apply to MiniMax H3 and LTX I2V/FLF. An explicit camera path or static/locked request always wins. For H3, non-faithful modes may author expressive, physically coherent per-shot choreography. For conditioned LTX, a frame anchor fixes only its anchored instant and the LTX Camera Capability still governs future-path ambition. This does not change sampling randomness, temperature, or seed.
creative_strengthFLOAT0.600–1.5Intensity inside the selected creativity mode: 0-0.05 faithful, up to 0.35 subtle, up to 0.8 moderate, up to 1.15 strong, then maximal. MiniMax H3 scales shot-appropriate camera ambition without inheriting LTX's Camera Capability. For LTX, camera ambition scales only with Advanced / controlled camera; Stable / base model overrides it. This does not randomize output or authorize extra cuts, actors, or unrelated actions.
thinking_modeCOMBOauto3 options: auto, on, off
max_new_tokensINT1024128–2048Output budget. Detailed MiniMax H3 storyboards and Ideogram JSON benefit from 1024 or more tokens.
director_cache_modeCOMBOreusereuse keeps an unchanged graph branch cached and can serve a verified disk result after restart; refresh recomputes and replaces an eligible disk result; off recomputes every queue without disk caching. Refresh does not randomize: identical inputs plus a fixed Director seed are intentionally reproducible. Select refresh for one retry only, queue once, then immediately return this control to reuse; leaving refresh selected reruns Director on every queue.
grounding_guard_modeoptCOMBOinheritDirect per-Director override. Inherit uses a connected Grounding Guard Settings node, or audit when that socket is disconnected. Choose off for fast iteration; audit/strict add visual evidence validation and may add model calls.
grounding_guard_configoptDG_GROUNDING_GUARD_CONFIG
measured_audio_report_jsonoptSTRINGConnect the compact report from Music Audition + QC after ACE-Step renders. Director will choreograph the LTX shot around the selected waveform's measured pulse, transient density, tonal stability, and excerpt timing instead of guessing from requested metadata.
h3_reference_policyoptDG_H3_REFERENCE_POLICY_CONFIGOptional H3 Reference Policy dropdown. A connected named policy overrides stale Context Hub manifest text. Leave disconnected for automatic role assignment from attached Ref2VA media.

Outputs (6)

NameTypeDescription
final_jsonSTRING
reasoning_textSTRING
raw_responseSTRING
metadata_jsonSTRING
grounding_statusSTRING
grounding_report_jsonSTRING