DiffusionGemma is a block-output model. One model invocation commits a complete 256-token canvas, not one autoregressive token. Its tt-metal adapter declares:
output_tokens_per_step=256supports_sample_on_device=Truesupports_async_decode=Falsesupports_prefix_caching=False
The adapter owns the Gumbel sampler and temperature schedule, prompt and canvas
KV state, denoise loop, and persistent Metal captures. vLLM schedules physical
canvases and trims the final canvas to the request's logical max_tokens.
The model capability reference describes how the
plugin consumes these declarations. DiffusionGemma's block-output path is
separate from generic speculative decoding:
TTPlatform.check_and_update_config rejects speculative_config when
output_tokens_per_step > 1.
Follow Environment Setup in the main README:
activate the tt-metal environment, then run source docs/install-vllm-tt.sh
to install the pinned vLLM 0.31.0 build and this plugin.
Run from the paired tt-metal checkout so the registered model target under
models.experimental.diffusion_gemma is importable.
export PYTHONPATH=/path/to/tt-metal
export MESH_DEVICE=P150x4
export DG_UPFRONT_COARSE_PREFILL_BUCKETS=1
export DG_UPFRONT_LAZY_PREFILL_RECAPTURE=1
export DG_PREFILL_FIXED_CHUNKS=1
export DG_PREFILL_RAGGED_CHUNK=1024
export DG_UPFRONT_PREFILL_WARMUP_LENS=32,64,96
export DG_TRACE_REGION_SIZE=3758096384
python -m vllm.entrypoints.openai.api_server \
--model google/diffusiongemma-26B-A4B-it \
--served-model-name diffusiongemma-26B-A4B-it \
--generation-config vllm \
--max-model-len 262144 \
--max-num-batched-tokens 262144 \
--max-num-seqs 1 \
--block-size 64 \
--no-enable-chunked-prefill \
--no-async-scheduling \
--reasoning-parser gemma4 \
--additional-config '{"tt":{"sample_on_device_mode":"all","enable_model_warmup":true,"trace_mode":"all","trace_region_size":3758096384}}'DiffusionGemma uses the gemma4 reasoning and tool parsers shipped by vLLM
0.31.0. The plugin does not override or alias upstream parser names. For tool
calling add --enable-auto-tool-choice --tool-call-parser gemma4.
--max-num-batched-tokens concerns scheduler prompt admission. It does not
disable DiffusionGemma's model-internal ragged and chunked prompt processing.
The DG_TRACE_REGION_SIZE environment value must match
tt.trace_region_size. The values above are the QB2 (MESH_DEVICE=P150x4)
release configuration validated by tt-shield; variables whose validated value
matches the tt-metal default are omitted, as is
VLLM_ENABLE_V1_MULTIPROCESSING=0, which the api_server never reads (its
AsyncLLM always runs the engine in a background process; the variable only
affects the offline LLM entrypoint). The
DG_UPFRONT_COARSE_PREFILL_BUCKETS, DG_UPFRONT_LAZY_PREFILL_RECAPTURE, and
DG_PREFILL_FIXED_CHUNKS gates (all default off) are required to serve
arbitrary prompt lengths; without them only prompts whose execution length is
in DG_UPFRONT_PREFILL_WARMUP_LENS are served, and any other prompt returns
an empty completion. If the expected aligned prompt lengths change, update
DG_UPFRONT_PREFILL_WARMUP_LENS accordingly. With
DG_UPFRONT_COARSE_PREFILL_BUCKETS=1, --max-model-len must be a power of
two no larger than 262144, as in the release configuration: the adapter
resolves each prefill to a power-of-two bucket capped at max_model_len, so
under a non-power-of-two limit an admitted prompt aligned past the largest
bucket has no servable execution shape and the failure is engine-fatal.
Current support is synchronous, DP=1, one active sequence, on-device sampling
for all model calls, and no scheduler chunked prefill; vLLM automatic prefix
caching is disabled by the platform. Async scheduling, host sampling, custom
logits processors, and non-uniproc executors are rejected at launch;
prompt_embeds inputs and streaming-input (resumable) sessions are rejected
per request; other unsupported per-request controls are listed below.
HTTP sampling controls are accepted for OpenAI-client compatibility but ignored:
temperature,top_p,top_k, andmin_pseed- presence, frequency, and repetition penalties
The model-owned denoise loop always uses its internal temperature schedule and
Gumbel sampler, so these fields do not alter generation. The plugin ignores
them and logs a one-time warning. Controls that would change the response
contract, such as n>1, logprobs, structured outputs, bad words, logit bias,
allowed token IDs, nonzero minimum tokens, and custom sampling extra_args,
are rejected.
Physical admission rounds the prompt to a TT tile, rounds the configured limit down to a TT tile, and rounds logical output up to complete canvases:
ceil(prompt_tokens / 32) * 32
+ ceil(max_tokens / 256) * 256
<= floor(max_model_len / 32) * 32
The historical /v1/completions default max_tokens=16 remains valid. It
runs one physical canvas and returns at most 16 logical tokens. Over the
OpenAI endpoints any output limit, omitted or explicit, is capped to the
largest whole-canvas capacity that fits; the formula rejects an oversized
max_tokens only for offline SamplingParams callers.
The rejections above happen in TTPlatform.validate_request, which vLLM's
InputProcessor calls for every request from the OpenAI server and the LLM
class. A prebuilt EngineCoreRequest passed to AsyncLLM.add_request or
LLMEngine.add_request (an API upstream deprecates), or sent through
EngineCoreClient, skips that check.
An exception while the engine admits a request stops the engine for every
client, so TTScheduler.add_request does not reject such a request. It
changes the request until the model can serve it, logs a warning for each
change, and the request then finishes normally. The caller is not told about
the change.
| Input | Change | Engine log |
|---|---|---|
| Multimodal features | Dropped; placeholder positions decode as ordinary tokens | ... with multimodal features a block-output model cannot encode; dropping them |
prompt_embeds only |
Replaced with placeholder tokens of the same length | ... with a prompt_embeds-only prompt the TT backend does not support; replacing with N placeholder tokens |
Mixed token ids and prompt_embeds |
Embeds dropped; placeholder ids decode as ordinary tokens | ... with mixed token/embeds prompt content the TT backend does not support; dropping the embeds ... |
| Empty prompt | Padded to one placeholder token | ... with an empty prompt; padding to one placeholder token |
| Prompt with no room for a whole canvas | Truncated to the longest tile-aligned prompt that leaves room for one canvas | ... with a N-token prompt that leaves no room for a whole K-token canvas within max_model_len; truncating to M tokens ... |
max_tokens above the canvas capacity |
Clamped to the largest whole-canvas budget that fits | Debug only: Clamping block-output max_tokens from ... to ... |
Structured outputs, resumable session, min_p, min_tokens, logit_bias, allowed_token_ids, bad words, penalties |
Removed or reset to neutral | ...; stripped controls unsupported by block-output models: ... |
| Further input for a session whose resumable flag was removed | Dropped; the running request finishes on its own | Dropping streaming-input continuation for request ... |
logprobs |
Ignored by the worker; no logprobs are returned | None |
In the log column, a leading ... stands for Request <id> bypassed frontend validation. VLLM_USE_RUST_FRONTEND=1 is refused at launch for this reason:
that frontend never calls validate_request, so every request would take this
path and be changed silently instead of rejected.
vLLM request metrics count logical output tokens after EOS, stop-token, and
max_tokens trimming. A stop string truncates only the returned text: the
full committed canvas still counts toward token metrics, up to 255 tokens
past the match. DiffusionGemma model telemetry is physical: one block is 256
committed tokens. Use the adapter's prefill_block0, decode_block,
block_ids, committed_tokens, denoise_steps, and block-latency events
for device performance. Report block throughput as:
physical tokens per block second = 256 / block_latency_seconds
Do not report autoregressive TPOT for this model.
- The serving constraints in Request Contract apply; speculative decoding and preemption overlap are additionally unsupported.
- A forced prefix-cache reset aborts running block requests instead of
resuming them: a half-generated canvas cannot resume, so the engine (a
background
EngineCoreProcfor the api_server and the default offlineLLMalike) finishes those requests with an abort before resetting. Only an in-process engine (VLLM_ENABLE_V1_MULTIPROCESSING=0) has no client stream to notify and refuses the reset with an error instead.pause_generation(mode="keep", clear_cache=True)is refused while a block request is live; pausing withoutclear_cacheworks. - Device server validation requires the paired tt-metal checkout and model artifacts. Host plugin tests do not prove model correctness or performance.