跳到导航

Reference Guide

Configuration, arguments, and operational details for the vLLM backend

Overview

The vLLM backend in Dynamo integrates vLLM engines into Dynamo’s distributed runtime, enabling disaggregated serving, KV-aware routing, and request cancellation. Dynamo leverages vLLM’s native KV cache events, NIXL-based transfer mechanisms, and metric reporting.

Dynamo vLLM uses vLLM’s native argument parser — all vLLM engine arguments are passed through directly. Dynamo adds its own arguments for disaggregation mode, KV transfer, and prompt embeddings.

Argument Reference

The vLLM backend accepts all upstream vLLM engine arguments plus Dynamo-specific arguments. The authoritative source is always the CLI:

python -m dynamo.vllm --help

The --help output is organized into the following groups:

  • Dynamo Runtime Options — Namespace, discovery backend, request/event plane, endpoint types, tool/reasoning parsers, and custom chat templates. These are common across all Dynamo backends and use DYN_* env vars. See Runtime Configuration for the full field reference.
  • Dynamo vLLM Options — Disaggregation mode, tokenizer selection, sleep mode, multimodal flags, vLLM-Omni pipeline configuration, headless mode, and ModelExpress. These use DYN_VLLM_* env vars. See vLLM Configuration for the full field reference.
  • vLLM Engine Options — All native vLLM arguments (--model, --tensor-parallel-size, --kv-transfer-config, --kv-events-config, --enable-prefix-caching, etc.). See the vLLM serve args documentation.

Tool and Reasoning Parsers

Use --dyn-tool-call-parser and --dyn-reasoning-parser to match the model’s output format when the model emits tool calls and/or reasoning content. The current supported values are documented in Tool Call Parsing (Dynamo) and Reasoning Parsing (Dynamo).

To set the thinking mode used when a request omits an explicit control, pass --dyn-default-thinking-mode enabled|disabled or set DYN_DEFAULT_THINKING_MODE. Request-level thinking controls, including adaptive thinking, take precedence. See Deployment-Level Thinking Default.

Set chat template defaults with --default-chat-template-kwargs on the frontend, not on the worker. The frontend renders the chat template for workers and sidecars, so the worker refuses the vLLM flag at startup. A vllm-rs serve engine behind the vLLM sidecar applies its own flag only to its own HTTP server, and the sidecar cannot detect it.

For reasoning models with structured output (response_format, JSON schema, or required/named tool choice), configure both reasoning parsers on the worker:

python -m dynamo.vllm --model <model> \
--reasoning-parser <vllm-parser> \
--dyn-reasoning-parser <dynamo-parser>

The vLLM parser delays grammar enforcement until reasoning ends; the Dynamo parser populates reasoning_content. Parser names can differ between registries.

Priority Scheduling

vLLM engine-level request priority is controlled by the upstream vLLM --scheduling-policy priority argument.

python -m dynamo.vllm \
--model <model> \
--scheduling-policy priority

Clients still send the Dynamo API value directly: nvext.agent_hints.priority. Higher values mean higher priority at the Dynamo API layer. Dynamo converts that value before passing it to vLLM, which uses a different native priority polarity internally.

Do not negate nvext.agent_hints.priority in the client for vLLM. If you are also using the router queue, configure the frontend-side --router-queue-threshold separately; vLLM engine scheduling only applies after a request reaches the worker.

For the cross-layer behavior, see Priority Scheduling. For the upstream flag definition, see the vLLM serve args documentation.

Prompt Embeddings

Dynamo supports vLLM prompt embeddings — pre-computed embeddings bypass tokenization in the Rust frontend and are decoded to tensors in the worker.

  • Enable with --enable-prompt-embeds (disabled by default)
  • Embeddings are sent as base64-encoded PyTorch tensors via the prompt_embeds field in the Completions API
  • NATS must be configured with a 15MB max payload for large embeddings (already set in default deployments)

Custom JSON Content

Experimental, unreleased. Aggregated Python vLLM token workers started with --enable-multimodal accept explicit custom parts in user and tool messages.

Custom content requires the Rust frontend preprocessing path (--dyn-chat-processor dynamo, the default). The Python frontend processor (--dyn-chat-processor vllm) and worker-side tokenization (--use-vllm-tokenizer) are unsupported. Keep tokenization in the Rust frontend when sending custom content.

The example combines projected chemistry soft tokens with a standard image URL. The model must support both the registered chemistry modality and image inputs. The payload names and encoding inside fields are application-defined:

{
"model": "chemistry-vision-model",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Does this structure "},
{"type": "custom", "kind": "chemistry", "fields": {
"projected_soft_tokens": {
"dtype": "float32", "shape": [2, 4096], "data_base64": "..."
},
"revision": 1
}},
{"type": "text", "text": " match the reaction diagram?"},
{"type": "image_url", "image_url": {"url": "https://example.org/reaction-diagram.png"}}
]
}],
"max_tokens": 64
}

The model name, tensor dimensions, encoded bytes, and image URL are illustrative. kind is a non-empty string. The built-in wire names text, image_url, video_url, audio_url, and input_audio are reserved and rejected as custom kinds, including when mixed with typed media. fields is a JSON object whose values may be any JSON, including arrays and null. Dynamo passes the complete fields object as multi_modal_data[kind]; the example processor receives both projected_soft_tokens and revision under the chemistry modality. Dynamo does not select fields[kind] or decode the base64 bytes. Repeated parts of one kind become an ordered list of fields objects. Built-in image, video and audio parts retain their existing typed schema and validation. They may share requests with custom parts when their engine modality names do not collide.

The model plugin owns domain validation and interpretation. Install or mount it in the worker environment. For the existing model-specific chat template, Dynamo preserves each custom part in place as {"type":"custom","kind":"chemistry"}; fields is absent. The template handles that part and renders the marker its registered processor expects. Clients do not also insert a literal marker in a text part. Dynamo neither derives a universal marker from kind nor changes the model’s template. Auxiliary messages retain the same payload-free custom parts, role metadata, and ordering; payloads travel only in multi_modal_data.

For an already rendered prompt, nvext.token_data supplies token IDs directly. Clients using it remain responsible for the complete model-specific token sequence.

The frontend sends custom content only to workers that advertise custom_json_v1 and returns 400 when none does. Custom P/D, encoder disaggregation, speculative prefill, custom caching, SGLang, TensorRT-LLM, and native vLLM sidecars are unsupported. Extending these paths requires a separate qualification of plugin payload identity and lifecycle.

Hashing Consistency for KV Events

When using KV-aware routing, ensure deterministic hashing across processes to avoid radix tree mismatches. Choose one of the following:

  • Set PYTHONHASHSEED=0 for all vLLM processes when relying on Python’s built-in hashing for prefix caching.
  • If your vLLM version supports it, configure a deterministic prefix caching algorithm:
vllm serve ... --enable-prefix-caching --prefix-caching-algo sha256

See the high-level notes in Router Design on deterministic event IDs.

Graceful Shutdown

vLLM workers use Dynamo’s graceful shutdown mechanism. When a SIGTERM or SIGINT is received:

  1. Discovery unregister: The worker is removed from service discovery so no new requests are routed to it
  2. Grace period: In-flight requests are allowed to complete (configurable via DYN_GRACEFUL_SHUTDOWN_GRACE_PERIOD_SECS, default 5s)
  3. Resource cleanup: Engine resources and temporary files (Prometheus dirs, LoRA adapters) are released

All vLLM endpoints use graceful_shutdown=True, meaning they wait for in-flight requests to finish before exiting. An internal VllmEngineMonitor also checks engine health every 2 seconds and initiates shutdown if the engine becomes unresponsive.

For more details, see Graceful Shutdown.

Health Checks

Each worker type registers a health check with the Dynamo runtime. Set DYN_HEALTH_CHECK_ENABLED=true to enable active checks.

Worker TypeHealth Check Strategy
Decode / AggregatedShort generation request (max_tokens=1) using the model’s BOS token
PrefillSame payload structure as decode, adapted for prefill request format
vLLM-Omni (aggregated)Native engine health check; see vLLM-Omni Health Checks for defaults and custom inference checks
vLLM-Omni (stage worker)Short generation request using the model’s BOS token

An aggregated Omni worker serves the complete model pipeline through one Dynamo endpoint. A stage worker runs a single stage in a disaggregated pipeline.

The runtime’s HTTP health endpoints expose the resulting status to Kubernetes probes. Override the payload with DYN_HEALTH_CHECK_PAYLOAD. See the Health Check Reference for configuration and Observability Architecture for the active health-check design.

Request Cancellation

When a user cancels a request (e.g., by disconnecting from the frontend), the request is automatically cancelled across all workers, freeing compute resources.

PrefillDecode
Aggregated✅✅
Disaggregated✅✅

For more details, see the Request Cancellation Architecture documentation.

Request Migration

Dynamo supports request migration to handle worker failures gracefully. When enabled, requests can be automatically migrated to healthy workers if a worker fails mid-generation. See the Request Migration Architecture documentation for configuration details.

See Also