Install with NVIDIA Dynamo
This guide provides step-by-step instructions for integrating vLLM Semantic Router with NVIDIA Dynamo.
About NVIDIA Dynamo
NVIDIA Dynamo is a high-performance distributed inference platform designed for large language model serving. Dynamo provides advanced features for optimizing GPU utilization and reducing inference latency through intelligent routing and caching mechanisms.
Key Features
- Disaggregated Serving: Separate Prefill and Decode workers for optimal GPU utilization
- KV-Aware Routing: Routes requests to workers with relevant KV cache for prefix cache optimization
- Dynamic Scaling: Planner component handles auto-scaling based on workload
- Multi-Tier KV Cache: GPU HBM → System Memory → NVMe for efficient cache management
- Worker Coordination: etcd and NATS for distributed worker registration and message queuing
- Backend Agnostic: Supports vLLM, SGLang, and TensorRT-LLM backends
Integration Benefits
Integrating vLLM Semantic Router with NVIDIA Dynamo provides several advantages:
-
Dual-Layer Intelligence: Semantic Router provides request-level intelligence (model selection, classification) while Dynamo optimizes infrastructure-level efficiency (worker selection, KV cache reuse)
-
Intelligent Model Selection: Semantic Router analyzes incoming requests and routes them to the most appropriate model based on content understanding, while Dynamo's KV-aware router efficiently selects optimal workers
-
Dual-Layer Caching: Semantic cache (request-level, Milvus-backed) combined with KV cache (token-level, Dynamo-managed) for maximum latency reduction
-
Enhanced Security: PII detection and jailbreak prevention filter requests before reaching inference workers
-
Disaggregated Architecture: Separate prefill and decode workers with KV-aware routing for reduced latency and better throughput
Architecture
This deployment uses the Disaggregated Router Deployment pattern with KV cache enabled, featuring separate prefill and decode workers for optimal GPU utilization.
┌─────────────────────────────────────────────────────────────────┐
│ CLIENT │
│ curl -X POST http://localhost:8080/v1/chat/completions │
│ -d '{"model": "MoM", "messages": [...]}' │
└──────────────────────────────────────────────────────── ─────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ ENVOY GATEWAY │
│ • Routes traffic, applies ExtProc filter │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ SEMANTIC ROUTER (ExtProc Filter) │
│ • Classifies query → selects category (e.g., "math") │
│ • Selects model → rewrites request │
│ • Injects domain-specific system prompt │
│ • PII/Jailbreak detection │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ DYNAMO FRONTEND (KV-Aware Routing) │
│ • Receives enriched request with selected model │
│ • Routes to optimal worker based on KV cache state │
│ • Coordinates workers via etcd/NATS │
└─────────────────────────────────────────────────────────────────┘
│ │
▼ ▼
┌───────────────────────────┐ ┌───────────────────────────┐
│ PREFILL WORKER (GPU 1) │ │ DECODE WORKER (GPU 2) │
│ prefillworker0 │──▶ decodeworker1 │
│ --worker-type prefill │ │ --worker-type decode │
└───────────────────────────┘ └───────────────────────────┘
Deployment Modes
This guide deploys the Disaggregated Router Deployment pattern with KV cache enabled (frontend.routerMode=kv). This is the recommended configuration for optimal performance, as it enables KV-aware routing to reuse computed attention tensors across requests. Separate prefill and decode workers maximize GPU utilization.
Based on NVIDIA Dynamo deployment patterns, the Helm chart supports two deployment modes:
Aggregated Mode (Default)
Workers handle both prefill and decode phases. Simpler setup, fewer GPUs required.
# No workerType specified = defaults to "both"
helm install dynamo-vllm ./deploy/kubernetes/dynamo/helm-chart \
--namespace dynamo-system \
--set workers[0].model.path=Qwen/Qwen2-0.5B-Instruct \
--set workers[1].model.path=Qwen/Qwen2-0.5B-Instruct
- Workers register as
backendcomponent in ETCD - No
--is-prefill-workerflag - Each worker can handle complete inference requests
Disaggregated Mode (High Performance)
Separate prefill and decode workers for optimal GPU utilization.
# Explicit workerType = disaggregated mode
helm install dynamo-vllm ./deploy/kubernetes/dynamo/helm-chart \
--namespace dynamo-system \
--set workers[0].model.path=Qwen/Qwen2-0.5B-Instruct \
--set workers[0].workerType=prefill \
--set workers[1].model.path=Qwen/Qwen2-0.5B-Instruct \
--set workers[1].workerType=decode
| Worker | Flag | ETCD Component | Role |
|---|---|---|---|
| Prefill | --is-prefill-worker | prefill | Processes input tokens, generates KV cache |
| Decode | (no special flag) | backend | Generates output tokens, receives decode requests only |
In disaggregated mode, only prefill workers use the --is-prefill-worker flag. Decode workers use the default vLLM behavior (no special flag). The KV-aware frontend routes prefill requests to prefill workers and decode requests to backend workers.
Prerequisites
GPU Requirements
This deployment requires a machine with at least 3 GPUs:
| Component | GPU | Description |
|---|---|---|
| Frontend | GPU 0 | Dynamo Frontend with KV-aware routing (--router-mode kv) |
| Prefill Worker | GPU 1 | Handles prefill phase of inference (--worker-type prefill) |
| Decode Worker | GPU 2 | Handles decode phase of inference (--worker-type decode) |
Required Tools
Before starting, ensure you have the following tools installed:
NVIDIA Runtime Configuration (One-Time Setup)
Configure Docker to use the NVIDIA runtime as the default:
# Configure NVIDIA runtime as default
sudo nvidia-ctk runtime configure --runtime=docker --set-as-default
# Restart Docker
sudo systemctl restart docker
# Verify configuration
docker info | grep -i "default runtime"
# Expected output: Default Runtime: nvidia
Step 1: Create Kind Cluster with GPU Support
Create a local Kubernetes cluster with GPU support. Choose one of the following options:
Option 1: Quick Setup (External Documentation)
For a quick setup, follow the official Kind GPU documentation:
kind create cluster --name semantic-router-dynamo
# Verify cluster is ready
kubectl wait --for=condition=Ready nodes --all --timeout=300s
For GPU support, see the Kind GPU documentation for details on configuring extra mounts and deploying the NVIDIA device plugin.
Option 2: Full GPU Setup (E2E Procedure)
This is the procedure used in our E2E tests. It includes all the steps needed to set up GPU support in Kind.