Deployment

Serving stacks, scaling patterns, and gateways for putting LLMs in production.

Deployment Topology

Production LLM systems typically split into layers:

Keeping orchestration stateless lets you scale app servers independently from GPU pools sized to token demand.

Serving Runtimes

GPU server frameworks

vLLM and TensorRT-LLM target high-throughput datacenter GPUs with continuous batching and optimized kernels. Text Generation Inference (TGI) offers Hugging Face ecosystem integration. Choose based on model support, quantization formats, and SLA requirements.

# Kubernetes deployment snippet — GPU node pool for inference
resources:
  limits:
    nvidia.com/gpu: 1
  requests:
    cpu: "4"
    memory: "16Gi"
readinessProbe:
  httpGet:
    path: /health
    port: 8000
  initialDelaySeconds: 120  # model load time

CPU and edge

llama.cpp and ONNX Runtime serve quantized small models on CPU, Apple Silicon, or embedded devices where GPUs are unavailable.

Managed APIs

OpenAI, Anthropic, Bedrock, and Azure OpenAI outsource serving entirely. You integrate HTTP APIs and manage quotas, fallbacks, and data policies.

Scaling Patterns

Cold start: Loading 70B weights can take minutes. Use warm pools, predictive scaling before traffic spikes, and readiness probes that verify model loaded, not just process alive.

API Gateways and Compatibility

Gateways unify access across multiple backends: OpenAI-compatible proxies (LiteLLM, Portkey), canary routing between model versions, API key management per tenant, and centralized budget caps. OpenAI-compatible APIs reduce vendor lock-in by letting clients swap base URLs.

Implement idempotency keys for paid operations, request IDs propagated through logs, and structured error codes for rate limits vs model errors vs timeouts.

Reliability and SLOs

Define SLOs for availability, p95 latency, and error rate. Patterns include:

GPU OOM from oversized contexts is operational reality. Enforce max input tokens at the gateway and return clear errors before saturating workers.

Security and Compliance

Deploy inside VPCs for sensitive data, encrypt traffic with TLS, rotate API keys, and audit which models process which data classes. For regulated industries, log retention policies must balance debuggability with privacy (PII redaction in logs).

Supply chain: verify model weight checksums, scan containers, and pin dependency versions on serving images.

Release Management

Ship model versions like microservices: shadow traffic, A/B tests, instant rollback to prior checkpoint, and compatibility tests against prompt templates and tool schemas. Document changelog per model (context length, tokenizer, fine-tune data cutoff) for support teams.