Running large language models in production requires more than a GPU and a Docker container. Engineering teams must solve three interconnected problems: scaling inference capacity to match stochastic request patterns, keeping time-to-first-token and inter-token latency within human-perceptible thresholds, and limiting data center power draw so that compute budgets do not spiral out of control. This guide examines the architecture, auto-scaling mechanics, and serving optimizations required to deploy LLMs on cloud infrastructure, then explains when a managed platform like Oxlo.ai is the more efficient path.
The Deployment Triangle: Auto-Scaling, Latency, and Power
Self-hosted LLM inference forces a three-way tradeoff. Aggressive auto-scaling improves availability but increases cold-start latency and idle power consumption. Low-latency optimizations such as speculative decoding or large continuous batching windows raise GPU utilization but complicate scaling signals. Power capping extends hardware life and reduces carbon footprint, yet it can throttle throughput during traffic spikes. A sustainable deployment requires balancing all three.
Architecture Patterns for Self-Hosted LLMs
Most production deployments rely on Kubernetes clusters with GPU node pools. The serving layer is typically an engine such as vLLM, TensorRT-LLM, or Hugging Face TGI. A minimal production stack includes:
- A Kubernetes cluster with GPU-enabled nodes (NVIDIA A100, H100, or L4).
- A model server exposing an OpenAI-compatible HTTP interface.
- A reverse proxy or ingress controller for load balancing and TLS termination.
- A caching layer, either Redis or an in-process prefix cache, to store KV blocks for repeated prompts.
- A metrics pipeline (Prometheus and Grafana) exporting GPU memory, utilization, queue depth, and TTFT.
A basic vLLM deployment manifest looks like this:
apiVersion: apps/v1
kind: Deployment
metadata:
name: vllm-llama
spec:
replicas: 1
selector:
matchLabels:
app: vllm-llama
template:
metadata:
labels:
app: vllm-llama
spec:
containers:
- name: vllm
image: vllm/vllm-openai:latest
args:
- --model
- meta-llama/Llama-3.3-70B-Instruct
- --tensor-parallel-size
- "2"
- --max-num-seqs
- "256"
resources:
limits:
nvidia.com/gpu: "2"
ports:
- containerPort: 8000
This gives you a single replica on two GPUs. The hard part is making it elastic.
Auto-Scaling GPU Workloads
Standard Horizontal Pod Autoscaler based on CPU or memory is useless for LLMs. You need custom metrics that reflect inference pressure. Effective scaling signals include:
- Request queue depth: When the model server's internal queue exceeds a threshold, new pods must spin up.
- GPU memory utilization: KV cache growth is roughly linear with context length. If memory crosses 85%, scale out before out-of-memory kills occur.
- Time-to-first-token (TTFT): If TTFT degrades above a service-level objective, traffic should shift to a new replica.
KEDA can scale deployments based on Prometheus queries. The following ScaledObject watches queue depth:
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: vllm-keda
spec:
scaleTargetRef:
name: vllm-llama
minReplicaCount: 1
maxReplicaCount: 10
triggers:
- type: prometheus
metadata:
serverAddress: http://prometheus:9090
metricName: vllm_queue_depth
threshold: "8"
query: sum(vllm_request_queue_length)
Cluster Autoscaler must also be configured with GPU node groups so that new nodes provision when pod capacity is exhausted. Be aware that GPU node boot times are measured in minutes, not seconds, so reactive scaling alone will cause timeouts. A warm pool of standby nodes or over-provisioned replicas is usually necessary.
Latency Optimization at the Serving Layer
Once replicas are running, the serving engine determines how efficiently tokens are generated. Key techniques include:
- Continuous batching: vLLM and TGI dynamically batch incoming requests at the iteration level, improving throughput without increasing individual latency proportionally.
- Chunked prefill: Splitting long prefills into smaller chunks prevents a single long-context request from blocking the entire batch.
- Quantization: FP8 or INT8 weight quantization reduces memory bandwidth pressure, which is often the bottleneck for decode phases.
- Speculative decoding: A smaller draft model generates candidate tokens that the target model verifies in parallel, reducing the number of forward passes required.
- Prefix caching: Reusing KV caches for system prompts or few-shot examples eliminates redundant computation.
Implementing all of these correctly requires profiling your specific model, batch size, and context length distribution. There is no universal configuration.
Power Consumption and Efficiency
Power is often treated as an afterthought, yet GPU power draw can dominate total cost of ownership. Strategies to keep consumption in check include:
- Mixture-of-Experts (MoE) architectures: Models such as DeepSeek R1 671B MoE, DeepSeek V4 Flash, and GLM 5 activate only a subset of parameters per token. This reduces FLOPs and energy per request compared to dense models of equivalent capability.
- Right-sizing GPUs: Do not default to H100s. A quantized 70B model can often run on A100s or L4s with acceptable latency, cutting power per request significantly.
- Dynamic batching: Higher throughput per watt is achieved when GPUs run at high utilization rather than sporadic single-request bursts.
- Time-of-day scaling: Scale to a minimal warm pool during off-peak hours. If your serving engine supports it, power-cap GPUs via NVIDIA management tools to limit idle draw.
Even with these optimizations, idle capacity for peak traffic remains an inherent source of waste in self-hosted systems.
The Operational Overhead of Self-Hosting
Maintaining the stack described above demands dedicated SRE time. You will patch CUDA drivers, tune Kubernetes scheduling for GPU topology, debug OOM kills during context window spikes, and rebalance node pools as model sizes change. For many teams, the engineering hours consumed by cluster management exceed the infrastructure savings, especially when workloads are variable or experimental.
The Managed Alternative: Oxlo.ai
If self-hosting is not your core competency, Oxlo.ai offers a developer-first inference platform that eliminates cluster management entirely. Oxlo.ai provides request-based pricing with one flat cost per API request regardless of prompt length. Unlike token-based providers, cost does not scale with input length, so Oxlo.ai is significantly cheaper for long-context and agentic workloads.
The platform hosts 45+ open-source and proprietary models across seven categories, including MoE architectures like DeepSeek V4 Flash and DeepSeek R1 671B MoE, as well as dense flagships such as Llama 3.3 70B, Qwen 3 32B, and Kimi K2.6. There are no cold starts on popular models, and the API is fully OpenAI SDK compatible.
Switching from a self-hosted endpoint to Oxlo.ai requires changing a single environment variable:
import openai
client = openai.OpenAI(
base_url="https://api.oxlo.ai/v1",
api_key="YOUR_OXLO_API_KEY"
)
response = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Explain chunked prefill in three sentences."}],
stream=True
)
for chunk in response:
print(chunk.choices[0].delta.content, end="")
Because Oxlo.ai charges per request rather than per token, unpredictable prompt lengths do not inflate your bill. You also avoid idle GPU power draw, auto-scaling logic, and capacity planning. Detailed plan information is available at https://oxlo.ai/pricing.
Beyond chat, Oxlo.ai exposes standard endpoints for embeddings, image generation, audio transcription, and text-to-speech, with support for streaming, function calling, JSON mode, vision inputs, and multi-turn conversations.
Conclusion
Deploying LLMs on cloud infrastructure demands rigorous attention to auto-scaling signals, serving-layer latency, and per-request energy efficiency. If your organization has predictable traffic, deep SRE expertise, and strict data residency requirements, self-hosting with vLLM or TensorRT-LLM on Kubernetes provides maximum control. If your priority is shipping features without managing GPU clusters, Oxlo.ai provides a flat-per-request alternative with no cold starts, broad model coverage, and full OpenAI SDK compatibility. Match your infrastructure strategy to your team's operational capacity, and let your inference stack accelerate development instead of consuming it.
Top comments (0)