Nodes/ComfyUI-DiffusionGemma/DiffusionGemma Denoise (KV Cache)
ComfyUI Node

DiffusionGemma Denoise (KV Cache)

Drives the denoising loop for one prompt, optionally conditioned on a KV-cache. Identical knob surface and six outputs to DGemmaSampler, plus one extra input: the optional kv_cache (from DGemmaEncode) — wire it to inject a known-provenance cache (IN-2); leave it unwired for an unconditioned run. prompt is the TURN, kv_cache is independent CONTEXT — they compose (ADR-CDG-024, issue #257): a non-empty prompt alongside a connected kv_cache is chat-templated and prefilled onto the cache before decoding begins (this is what the run crystallizes onto). Leave prompt empty alongside a connected kv_cache for pure injection — this deliberately does NOT anneal to coherent text. Two rejections to recognize: (1) gen_length > canvas_length with both prompt and kv_cache wired is blocked pending #263's multi-block splice fix — shrink gen_length to one canvas_length or clear prompt instead; (2) a kv_cache already grown by a prior composed run (e.g. a cached DGemmaEncode node output reused across runs) is rejected — re-run DGemmaEncode (#265). Outputs: text (decoded result), canvas_state (a resumable/validity save-state), canvas_trace (per-step analysis data — feeds DGemmaTrace/DGemmaTokenTrace), frames (one decoded string per captured step), images (those frames as a watchable batch), run_config (the run's header bundle — feeds DGemmaRunLogWriter). The <|think|> block-boundary KV output ("OUT-1") is deferred until the live mid-run stop point exists; a wired cache's provenance is already readable off canvas_trace.

By shanevcantwell·Created 2 months ago·Updated 11 days ago· 1
DiffusionGemma Denoise (KV Cache)
  • model
  • kv_cache
  • text
  • canvas_state
  • canvas_trace
  • frames
  • images
  • run_config
prompt
seed0
num_inference_steps48
t_min0.40
t_max0.80
entropy_bound0.100
confidence0.005
gen_length256
thinkingfalse
CategoryDiffusionGemma

Inputs (11)

NameTypeDefaultDescription
modelDGEMMA_MODELLoaded DiffusionGemma model (from DGemmaLoader).
promptSTRINGThe TURN: chat-templated (role markers + generation-prompt suffix) and, when kv_cache is connected, prefilled onto the cache before decoding — this is what generation crystallizes onto (ADR-CDG-024, issue #257). EMPTY prompt alongside a connected kv_cache is pure injection, which deliberately does NOT anneal to coherent text. Rejected if gen_length > canvas_length while both prompt and kv_cache are set — multi-block composed runs are blocked pending #263's splice-offset fix; single-block composed and multi-block pure injection remain allowed.
seedINT00–18446744073709550000RNG seed for the generator driving canvas initialization/renoise (a plain integer, not unit-bearing). Omit/leave unset for a nondeterministic run.
num_inference_stepsINT481–1024Requested denoising step budget N (a plain count, not a physical unit) — the schedule-position denominator: t = (N - step_idx)/N.
t_minFLOAT0.400–1Cold end of the temperature anneal (dimensionless, applied as the divisor T in softmax(z/T)). Despite the lowercase-t name this is a TEMPERATURE, not a schedule position — t bottoms out at 1/num_inference_steps, so t_min itself is a virtual endpoint no step actually reaches. T = t_min + (t_max - t_min) * t, t decreasing 1 -> 1/num_inference_steps across the run.
t_maxFLOAT0.800–1Hot end of the temperature anneal (dimensionless, same softmax(z/T) divisor as t_min) — the temperature applied at the very first step, where the schedule position t == 1.
entropy_boundFLOAT0.1000–1Per-step joint acceptance budget, in NATS (natural-log entropy, matching torch.distributions.Categorical.entropy() — not bits). A position commits this step only once its acceptance entropy clears this bound. Default 0.1 nats; for scale, the uniform-vocab noise draw's 18 bits/position is ~12.48 nats.
confidenceFLOAT0.0050–1Early-stop threshold: a dimensionless probability the pipeline's adaptive-stop check compares a candidate's confidence against.
gen_lengthINT2561–8192Canvas length in tokens (a token count) — how many positions the denoising loop allocates for the generated turn. This is split into blocks of DEFAULT_GEN_LENGTH (256) tokens each: gen_length is processed as ceil(gen_length / 256) blocks, each denoised over num_inference_steps substeps (e.g. gen_length 1024 -> 4 blocks, each denoised over num_inference_steps steps). Larger gen_length costs proportionally more block passes.
thinkingBOOLEANfalseEXPERIMENTAL boolean toggle: injects the <|think|> control token via a system turn. Structurally one token short of native enable_thinking=True (the chat template's `| trim` eats the newline after <|think|>) — see run_diffusion's own docstring for the honest gap. Behavioral impact unverified pending an E2E thinking-mode run on real weights.
kv_cacheoptDGEMMA_KV_CACHEOptional KV-cache from DGemmaEncode: independent CONTEXT (raw-encoded, no chat framing) that conditions this run as background — it cannot restrict output the way prompt does. Leave unwired for an unconditioned run. Composes with prompt (ADR-CDG-024, issue #257): a non-empty prompt is the current-turn text, chat-templated and prefilled onto this cache before decoding. Leave prompt empty for pure injection (no prefill — does not anneal to coherent text). Rejected if this cache was already grown by a prior composed run — e.g. a cached DGemmaEncode node output reused across runs; re-run DGemmaEncode to mint a fresh cache (#265). Also rejected together with a non-empty prompt when gen_length exceeds one canvas_length — multi-block composed runs are blocked pending #263's splice-offset fix.

Outputs (6)

NameTypeDescription
textSTRING
canvas_stateDGEMMA_CANVAS_STATE
canvas_traceDGEMMA_CANVAS_TRACE
framesSTRING
imagesIMAGE
run_configDGEMMA_RUN_CONFIG