Distributed Inference with llm-d and vLLM
Estimated reading time: 20 minutes.
- Objective
-
Understand why llm-d is required for MaaS deployments to optimize disaggregated serving and prefix cache aware routing. Review how vLLM manages GPU memory via page attention.
| Not started yet. |
The Need for Distributed Inference
Large language models often exceed the memory capacity of a single GPU. Distributed inference enables:
-
Serving models larger than single-GPU memory
-
Higher throughput through parallel processing
-
Better resource utilization across GPU clusters
-
Prefix cache sharing across inference requests
llm-d: The Distributed Inference Orchestrator
llm-d is the control plane for distributed LLM inference in MaaS:
Key Capabilities:
-
Intelligent Inference Scheduling
-
Cache-aware routing based on request prefixes
-
Load balancing across worker pods
-
Queue depth monitoring
-
-
Disaggregated Serving
-
Separates Prefill (prompt processing) from Decode (token generation)
-
Optimizes GPU utilization by phase
-
Different GPU types for different phases
-
-
Wide Expert-Parallelism
-
Distributes model experts across multiple nodes
-
Enables trillion-parameter model serving
-
Uses NVSHMEM for high-speed inter-GPU communication
-
-
Tiered KV Prefix Caching
-
GPU VRAM (fastest, limited capacity)
-
CPU RAM (medium speed, larger capacity)
-
NVMe storage (slower, massive capacity)
-
Remote object storage (slowest, unlimited)
-
-
Workload Autoscaling
-
Scales based on queue depth
-
KV cache utilization monitoring
-
Dynamic worker pod management
-
vLLM: The Execution Engine
vLLM runs in worker pods and performs the actual inference:
PagedAttention Memory Management:
Traditional inference engines allocate contiguous memory for KV cache, leading to:
-
Memory fragmentation
-
Wasted capacity
-
Fixed batch sizes
vLLM’s PagedAttention:
-
Allocates KV cache in non-contiguous pages
-
Eliminates fragmentation
-
Enables dynamic batching
-
Increases GPU memory utilization by 2-4x
Example:
Traditional: 40% memory utilization (fragmentation waste)
vLLM PagedAttention: 80-90% memory utilization
Architecture: Control Plane vs. Execution Plane
Control Plane (llm-d):
-
Request routing and scheduling
-
Cache affinity decisions
-
Health monitoring
-
Metrics aggregation
-
Autoscaling decisions
Execution Plane (vLLM workers):
-
Actual model inference
-
GPU memory management
-
Token generation
-
KV cache management
-
Metrics reporting
Why llm-d is Required for MaaS
MaaS deployments use llm-d because:
-
Cache-Aware Routing: Routes requests with similar prefixes to the same worker to maximize cache hits
-
Multi-Tenant Isolation: Ensures fair scheduling across service tiers
-
Centralized Metrics: Aggregates metrics for chargeback and monitoring
-
Prefix Cache Sharing: Shares common prompt prefixes across requests
-
Production Hardening: Includes health checks, retries, and failover
Request Lifecycle
-
Request arrives at Gateway API
-
llm-d scheduler receives request
-
Cache affinity check: Does any worker have this prefix cached?
-
Worker selection: Choose worker with best cache match or lowest queue depth
-
vLLM execution: Worker processes request using PagedAttention
-
Response returned through Gateway API
Performance Comparison
| Configuration | Throughput (tokens/sec) | Memory Efficiency | |---------------|------------------------|-------------------| | Single vLLM (no llm-d) | 1000 | 60% | | llm-d + vLLM (2 workers) | 2500 | 85% | | llm-d + vLLM (4 workers) | 4800 | 88% |
Cache-aware routing can improve throughput by 40-60% for workloads with shared prefixes.