Nodes/ComfyUI-DiffusionGemma/DiffusionGemma Sampler
ComfyUI Node

DiffusionGemma Sampler

Drives the denoising loop for one prompt. Six outputs: text, canvas_state, canvas_trace, frames, images, run_config (wire the last four into DGemmaRunLogWriter for a run log, or canvas_trace into DGemmaTrace/DGemmaTokenTrace for analysis). Use DGemmaDenoise instead if you need to condition on a KV-cache.

By shanevcantwell·Created 2 months ago·Updated 11 days ago· 1
DiffusionGemma Sampler
  • model
  • 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 (10)

NameTypeDefaultDescription
modelDGEMMA_MODELLoaded DiffusionGemma model (from DGemmaLoader).
promptSTRINGThe user turn to generate a response to.
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.

Outputs (6)

NameTypeDescription
textSTRING
canvas_stateDGEMMA_CANVAS_STATE
canvas_traceDGEMMA_CANVAS_TRACE
framesSTRING
imagesIMAGE
run_configDGEMMA_RUN_CONFIG