vLLM Multimodal
This page describes multimodal inference with the Dynamo vLLM backend.
Security Requirement: All multimodal workers require the
--enable-multimodal flag to be explicitly set at startup. This prevents
unintended processing of multimodal data from untrusted sources. Media requests
are rejected when the flag is absent, and workers configured with a multimodal
role fail at startup. This flag is analogous to --enable-mm-embeds in vLLM
serve but also extends it to all multimodal content (URL, embeddings, and
base64 data).
Embedding workers are the exception. A vLLM --embedding-worker accepts
image, video, and audio in chat-style messages without
--enable-multimodal, and cannot be combined with it. See
Embedding.
Support Matrix
Video codec support depends on where decoding runs:
- Backend decoding: shipped CUDA images use NVDEC for H.264 and H.265.
This requires a GPU with a video decode engine and the container’s
videodriver capability. See Video Decode GPU Requirements. - Rust frontend decoding: aggregated workers with
--frontend-decodingcan receive VP8/VP9 frames decoded on the CPU by the in-tree FFmpeg. The shipped FFmpeg build does not decode H.264, H.265, or AV1. Installing Python decoder packages does not extend this path; additional codecs require a different FFmpeg build.
Backend software decoding can support additional codecs without rebuilding
Dynamo. Explicitly install the backend’s Python decoder packages using
Additional Media Decoders.
The installer extends backend decoding only, not Rust frontend decoding.
These paths depend on the deployed image and configuration; an older pinned
image may not provide the frontend decoder. Local file:// reads additionally
require DYN_MM_LOCAL_PATH.
Supported URL Formats
Inline data: media is forwarded once on the request plane in multi_modal_data.
The frontend strips the inline payload from extra_args.messages so the worker
frame is not doubled. A serialized frame that still exceeds
DYN_TCP_MAX_MESSAGE_SIZE (32 MiB by default) returns HTTP 400. See
Frontend Configuration.
Media URLs are validated against a default-deny policy. https:// and data: sources
pass; plain http:// and hostnames that resolve to private or loopback addresses are
refused. Two settings change this:
DYN_MM_ALLOW_INTERNAL=1, on the worker that loads the media, allowshttp://and internal hosts.DYN_MM_ALLOW_REMOTE_URLS=0, on the frontend and the workers, refuses every remote media URL and takes precedence overDYN_MM_ALLOW_INTERNAL. See Runtime Configuration.
Deployment Patterns
The main multimodal vLLM launchers in this repo are:
Custom Vision Encoders
The aggregated vLLM worker can load an author-provided vision tower in process, batch images across concurrent requests, and adapt the ordered results into decoder-compatible prompt input. See Custom Vision Encoders for the backend contract, launch instructions, batch sizing guidance, and current limitations.
Multimodal KV Routing
vLLM supports two multimodal KV-routing paths. Both give the router and vLLM the same media identity so requests can be placed on workers that already cache the image or video’s KV blocks.
Video inference, backend prefix-cache reuse, and media-aware worker selection are separate capabilities. A successful video response or a backend cache hit does not prove that video identity influenced routing. Exact video affinity also requires KV-aware routing, matching worker KV events, and an eligible request on one of the paths below.
Choose a Routing Path
Start with the default path when the model is in Dynamo’s Rust registry. It avoids running the full Hugging Face processor in the frontend and does not require a processed-input transfer channel.
Use the Python chat processor when the Rust registry does not recognize the model, when processor behavior must exactly match vLLM, or when moving preprocessing off workers is worth the added frontend CPU, memory, and transfer cost. Use shared memory for same-node deployments and NIXL for cross-node deployments.
Default Rust Frontend
The default path keeps multimodal processing on the worker:
- The frontend computes an
mm_hashfor each supported media object. - A model-specific processor specification resolves the media placeholder and calculates its expanded token layout.
- The frontend expands the placeholder in a routing-only token view and builds per-block multimodal metadata.
- The KV router credits that overlap in its combined prefill-and-decode cost and selects the lowest-cost eligible worker.
- The frontend forwards image hashes through
mm_hashesand grouped image/video hashes throughmm_hashes_by_modality. The worker passes them to vLLM asmulti_modal_uuids.
By default, the frontend hashes the exact full URI: the complete data: URI string or the HTTP URL including its query string. Set --frontend-decoding on the worker to register frontend media decoding and use decoded image content as the hash input. Content-addressed hashing lets different URLs for identical image bytes share a routing key.
Exact video routing on this path requires --frontend-decoding. The frontend hashes sampled RGB frames and their model-visible metadata, then uses a model adapter to reproduce the worker’s prompt expansion. Supported adapters cover Qwen3-VL, Qwen3.5, and Nemotron 3 Nano Omni. See Multimodal KV Routing for setup, verification, and fallback behavior.
Launch the default path:
Key settings:
Python Chat Processor
Use the Python path when the model is supported by vLLM but not by the Rust model registry, or when the frontend should preprocess media:
This launcher sets --dyn-chat-processor vllm. The frontend runs vLLM’s Hugging Face processor, extracts hashes and expanded multimodal inputs for images and videos, builds routing metadata, and transfers processed mm_kwargs to the selected worker. This path supports models handled by vLLM’s multimodal processor.
DYNAMO_MM_TRANSFER selects the transfer mechanism:
shm(default) uses shared memory for same-node frontend and worker deployments. The frontend and worker must share/dev/shm, as processes on one host do. Separate Kubernetes pods do not share it even on the same node; when the worker cannot read the segment, it serves the request without its media.nixluses NIXL for cross-node transfer.DYNAMO_DISABLE_NIXL_MM=1disables processed-input transfer and makes the worker process the original media.
If a client supplies opaque multimodal UUIDs, Dynamo cannot derive a matching content hash. Those requests use text-prefix routing.
For the user-facing workflow, see Multimodal KV Routing.
Image/Video Serving
Dynamo supports multimodal image and video requests for Vision Language Models (VLMs). Qwen/Qwen3-VL-2B-Instruct is a good example because the same model can handle both image_url and video_url requests through the standard OpenAI chat endpoint.
The vLLM worker pastes a transparent image on a white background, as vLLM does. A separate encode worker and the Python chat processor do the same.
Aggregated Serving
Use the single-worker aggregated launcher for the simplest image/video setup:
Image request:
Video request:
Reuse vLLM multimodal processor cache entries
vLLM can cache processed multimodal inputs under a client-provided opaque UUID. Dynamo forwards UUIDs with URL-backed image, video, and audio inputs. The extension is specific to vLLM; it is not part of the OpenAI Chat Completions API and is not supported by Dynamo’s other backends. Dynamo’s SGLang and TensorRT-LLM backends reject cache UUIDs rather than silently ignoring them.
To enable the cache, pass a nonzero --mm-processor-cache-gb value to the vLLM
worker.
For an aggregated worker, enable Dynamo’s CPU embedding cache alongside the vLLM processor cache:
The caches store different data. The vLLM processor cache retains the processed media metadata required to resolve a UUID-only request. Dynamo’s embedding cache retains encoder output and can restore it after eviction from vLLM’s GPU encoder cache. Keep both caches enabled; the embedding cache alone cannot reconstruct a UUID-only input. Both caches are local to one vLLM engine, so the fill and reuse requests must reach the same aggregated worker.
With the Python vLLM chat processor, requests that include client UUIDs defer multimodal processing to the worker so the same local vLLM cache handles both population and reuse. With the default Rust frontend, URL-backed media can still be decoded by the frontend when frontend decoding is enabled; Dynamo forwards the aligned UUIDs with the decoded media. UUID-only image slots reach the vLLM worker for cache resolution.
Populate an entry by adding uuid beside the media field:
The same shape works for video and audio. For example, a video URL with a UUID provides a stable identity for the corresponding vLLM cache entry:
Reuse that entry in a later request by setting the media field to null and
sending the same top-level UUID:
UUID-only cache reuse is currently limited to images in Dynamo. Audio and video parts must include a URL even when they also provide a UUID.
UUIDs are opaque nonempty strings and must use the top-level field shown above. A UUID-only request fails on a cache miss because it has no image to process. The error asks the client to resend the request with the image URL or inline image data and the same UUID.
Cache entries are local to each worker:
- Every worker that processes the image needs its own entry. In disaggregated serving, both prefill and decode look up the image. Qwen-VL models using Dynamo’s embedding handoff are the exception: only prefill looks up the image, and decode reuses prefill’s image embeddings.
- Resending the image can populate the workers that handle that request, not other replicas.
- Eviction, a worker restart, or routing to different workers can require another resend.
A cache miss on a request that includes the URL is handled automatically: the worker fetches the image if needed, without a client resend.
Dynamo also rejects a media content part that has neither a URL nor a UUID.
When KV-aware routing is enabled, requests with client UUIDs use text-prefix routing. Dynamo cannot convert an opaque client key into its content-derived multimodal routing hash without risking different cache identities at the router and worker.
P/D Serving
Use the P/D launcher to separate prefill and decode without deploying a dedicated multimodal encoder.
In --single-gpu mode, each worker defaults to the first entry of CUDA_VISIBLE_DEVICES. Set it to the assigned GPU, for example CUDA_VISIBLE_DEVICES=1. Explicit DYN_PREFILL_WORKER_GPU and DYN_DECODE_WORKER_GPU values take precedence for their respective workers. If any worker needs the inherited default, an unset or empty first entry is an error.
For Qwen-VL images, prefill sends grid and embedding-shape metadata so decode can construct schema-valid placeholder embeddings and initialize mRoPE. Other model families use the expanded prompt token IDs produced during prefill.
The P/D handoff does not carry video embeddings. Video and audio inputs are loaded again on the decode worker. This preserves current behavior but adds media download and processing work. Mixed image-and-video P/D requests retain the same model-specific limitations as the aggregated vLLM path.
E/PD Serving (Encode + PD)
Use disagg_multimodal_e_pd.sh when you want a separate encode worker and a combined prefill/decode worker. This path is primarily useful for image-centric workloads and embedding-cache experiments.
In --single-gpu mode, each worker defaults to the first entry of CUDA_VISIBLE_DEVICES. Set it to the assigned GPU, for example CUDA_VISIBLE_DEVICES=1. Explicit DYN_ENCODE_WORKER_GPU and DYN_PD_WORKER_GPU values take precedence for their respective workers. If any worker needs the inherited default, an unset or empty first entry is an error.
When a separate encode worker is deployed with the current vLLM path, only image_url inputs are routed to it. video_url inputs are still processed on the combined PD worker.
E/P/D Serving (Full Disaggregation)
Use disagg_multimodal_epd.sh when you want separate encode, prefill, and decode workers for multimodal workloads.
In --single-gpu mode, each worker defaults to the first entry of CUDA_VISIBLE_DEVICES. Set it to the assigned GPU, for example CUDA_VISIBLE_DEVICES=1. Explicit DYN_ENCODE_WORKER_GPU, DYN_PREFILL_WORKER_GPU, and DYN_DECODE_WORKER_GPU values take precedence for their respective workers. If any worker needs the inherited default, an unset or empty first entry is an error.
In the current vLLM implementation, the separate encode worker is only used for image_url inputs. video_url inputs are still processed on the prefill worker, not on the encode worker.
Audio Serving
Dynamo supports audio_url requests for audio-capable models. Audio is loaded via vLLM’s AudioMediaIO at native sample rate, and vLLM resamples it to the rate the model’s feature extractor expects before extracting features. Omni models can handle image_url, video_url, and audio_url in the same request.
Resampling needs PyAV, which the Dynamo runtime images do not ship. To accept audio at a rate other than the model’s, see Audio Sample Rates.
Aggregated Serving
Use the same aggregated multimodal launcher with an audio-capable model:
Audio request:
Speech Recognition (ASR)
Qwen3-ASR checkpoints such as Qwen/Qwen3-ASR-1.7B and Qwen/Qwen3-ASR-0.6B transcribe speech sent as an audio_url content part to /v1/chat/completions. These checkpoints ship vocab.json and merges.txt but no tokenizer.json, which the default Rust frontend needs, so run the frontend with the Python chat processor (--dyn-chat-processor vllm). The agg_asr.sh launcher does this and serves Qwen/Qwen3-ASR-1.7B by default:
Pass --model Qwen/Qwen3-ASR-0.6B to serve the smaller checkpoint. The launcher passes any other arguments to the worker.
Qwen/Qwen3-ASR-1.7B-hf, the Hugging Face Transformers-format checkpoint, ships a tokenizer.json and also runs behind the default Rust frontend, which forwards the audio to the worker:
Transcription request:
The request names the default checkpoint. If you serve another checkpoint, such as Qwen/Qwen3-ASR-0.6B or Qwen/Qwen3-ASR-1.7B-hf, set model to that checkpoint’s name.
The response names the detected language before an <asr_text> tag, followed by the transcript:
Strip the text up to and including <asr_text> to keep only the transcript. With "stream": true, the prefix arrives in the first chunks.
Dynamo does not serve /v1/audio/transcriptions. Send audio through /v1/chat/completions or stream it through /v1/realtime.
Audio Sample Rates
The Dynamo runtime images accept audio at the model’s 16 kHz rate. Audio at any other rate fails with HTTP 500, and the frontend or worker log shows ImportError: Please install vllm[audio] for audio support, because vLLM resamples through PyAV, which the images do not ship. To accept other rates, run the bundled installer where the worker runs. With the Python chat processor, the frontend also resamples audio, so run it where the frontend runs too:
Alternatively, convert audio to 16 kHz before you send it. See Additional Media Decoders for what the installer changes.
Streaming Transcription
vLLM serves streaming transcription for Qwen3-ASR through its Qwen3ASRRealtimeGeneration architecture on /v1/realtime. The launcher does not pick an architecture from the model name, so select it with --hf-overrides. The realtime path does not tokenize in the frontend, so it runs with the default Rust frontend:
Stream a sample clip from a second terminal:
The session accepts 24 kHz PCM16 input, which the worker resamples to 16 kHz with scipy. The Dynamo vLLM runtime images do not include scipy, and without it the session returns an empty transcript while the worker log shows ModuleNotFoundError: No module named 'scipy'. For a local run, install it in the worker’s environment:
The model transcribes each 5-second segment as it arrives. Each segment’s text starts on a new line with its own language <Language><asr_text> prefix, and a very short final segment can repeat the previous segment’s text.
Kubernetes Deployment
To deploy transcription or streaming transcription as a DynamoGraphDeployment, see Speech Recognition on Kubernetes.
Embedding Cache
Dynamo supports embedding cache in both aggregated and disaggregated settings:
Aggregated Worker
A single vLLM instance caches encoded embeddings on CPU so repeated images skip encoding entirely. Supported natively with vLLM 0.17+.
Launch with Dynamo:
dynamo.vllm automatically configures
ec_both mode with DynamoMultimodalEmbeddingCacheConnector when capacity is
greater than zero. A capacity of zero disables the CPU cache. Frontend-provided
multimodal hashes are reused as cache identities so routing and embedding-cache
lookups agree.
Launch with vllm serve (standalone, no Dynamo):
The multimodal_embedding_cache_capacity_gb parameter controls the CPU-side LRU cache size in GB (0 = disabled). Requires vLLM 0.17+.
Disaggregated Encoder (Embedding Cache in Prefill Worker)
In the disaggregated setting, the Prefill Worker (P) owns a CPU-side LRU embedding cache (EmbeddingCacheManager). On each request P checks the cache first — on a hit, the Encode Worker is skipped entirely. On a miss, P routes to the Encode Worker (E), receives embeddings via NIXL, saves them to the cache, and then feeds the embeddings along with the request into the vLLM Instance for prefill.
Launch:
Client: Use the same image_url request format shown in Aggregated Serving.
LoRA Adapters on Multimodal Workers
Multimodal workers support dynamic loading and unloading of LoRA adapters at runtime via the management API. This enables serving fine-tuned multimodal models alongside the base model.
Loading a LoRA Adapter
Load an adapter on a running multimodal worker via the load_lora endpoint:
Sending Requests with a LoRA
Set the model field in the request to the LoRA adapter name:
Requests without a LoRA name (or with the base model name) will use the base model.
Unloading a LoRA Adapter
Listing Loaded Adapters
Disaggregated Mode
In disaggregated (prefill/decode) deployments, the same LoRA adapter must be loaded on both the prefill and decode workers. The LoRA identity (model field) is automatically propagated from the prefill worker to the decode worker in the forwarded request.
If a LoRA is loaded on the prefill worker but not on the decode worker, the decode worker will fall back to the base model for that request.
Supported Models
For a list of multimodal models supported by vLLM, see vLLM Supported Multimodal Models. Models listed there should generally work with aggregated serving, though they may not all be explicitly tested in this repo.