Developing a machine learning model inside a local Jupyter Notebook is straightforward. Deploying that model into a high-availability production environment that handles thousands of concurrent requests with sub-100ms latency, automatic horizontal scaling, zero-downtime rolling updates, and continuous telemetry is the domain of MLOps (Machine Learning Operations).
Figure 45.1: The Production MLOps Lifecycle — Continuous Integration (CI), Continuous Delivery (CD), High-Throughput vLLM Serving, and Telemetry Monitoring.
Standard foundation models are trained in 16-bit floating point precision (FP16 / BF16), requiring 2 bytes of VRAM per parameter. A 70-billion parameter model requires ( 70 imes 2 = 140 ext{ GB} ) of GPU memory just to load its weights into VRAM! Quantization maps continuous 16-bit float weights into lower-precision integers (8-bit or 4-bit) with negligible perplexity degradation:
| Quantization Format | Bits Per Weight | Primary Hardware & Tool | Key Features |
|---|---|---|---|
| GGUF (formerly GGML) | 2-bit to 8-bit integer | CPU + GPU Offloading (llama.cpp, Ollama) | Single-file binary format. Allows split memory execution: offloads layers partially to GPU and leaves remainder in system CPU RAM! |
| AWQ (Activation-aware Weight Quantization) | 4-bit integer | High-End GPUs (vLLM, TensorRT-LLM) | Protects the 1% most salient outlier activation channels; achieves near-lossless FP16 accuracy at 3x inference speeds on datacenter GPUs. |
| GPTQ | 4-bit / 8-bit integer | GPU Inference (AutoGPTQ, ExLlamaV2) | Second-order Taylor approximation calibration; extremely fast token generation. |
Traditional naive serving frameworks process requests sequentially. If five users submit prompts simultaneously, user 5 waits in a queue until user 1's generation finishes. vLLM (UC Berkeley) revolutionized LLM serving through two architectural breakthroughs:
Production AI models require specific CUDA drivers, cuDNN libraries, and PyTorch builds. Containerizing with Docker guarantees identical execution across local development, testing, and production Kubernetes clusters:
# Use official lightweight Python CUDA runtime base image
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/*
# Install Python requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application source code
COPY . .
# Expose HTTP port
EXPOSE 8000
# Run FastAPI using production Uvicorn ASGI server with 4 worker processes
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
To spin up an enterprise high-throughput model server serving Llama 3 with full OpenAI API compatibility on your GPU server:
# Install vLLM
pip install vllm
# Launch high-throughput server with AWQ 4-bit quantization and multi-GPU tensor parallelism
python -m vllm.entrypoints.openai.api_server --model casperhansen/llama-3-70b-instruct-awq --quantization awq --tensor-parallel-size 2 --dtype float16 --port 8000 --max-model-len 8192
Broaden your foundational and advanced AI knowledge across our curriculum:
Serving custom API endpoints compatible with OpenAI client SDKs.
Serving dynamically swapped LoRA adapters at high throughput with vLLM.
Diagnosing GPU VRAM saturation, CUDA out-of-memory, and latency bottlenecks.
PagedAttention mechanics, continuous batching, and Docker containerization.