model server
Model serving infrastructure hosts machine learning models for inference, handling request batching, scaling, API management, and optimization to deliver low-latency predictions at scale. Popular frameworks: (1) vLLM (optimized LLM serving—PagedAttention, continuous batching, high throughput), (2) TGI (Text Generation Inference by Hugging Face—streaming, quantization, tensor parallelism), (3) Triton Inference Server (NVIDIA—multi-framework, dynamic batching, model ensemble), (4) TorchServe (PyTorch—model management, metrics, multi-model), (5) TensorFlow Serving (production-grade, versioning, batching). Key features: (1) batching (group requests for GPU efficiency—dynamic or continuous batching), (2) model optimization (quantization, compilation, kernel fusion), (3) scaling (horizontal—multiple replicas, vertical—larger instances), (4) API (REST, gRPC endpoints), (5) monitoring (latency, throughput, error rates), (6) model management (versioning, A/B testing, canary deployment). Batching strategies: (1) static batching (wait for fixed batch size or timeout), (2) dynamic batching (form batches from arriving requests), (3) continuous batching (for LLMs—add new requests as sequences complete). Optimization techniques: (1) quantization (INT8, FP16—reduce memory and latency), (2) compilation (TensorRT, ONNX Runtime—optimize computation graph), (3) kernel fusion (combine operations), (4) KV cache management (for LLMs—efficient memory usage). Deployment patterns: (1) single model (one model per server), (2) multi-model (multiple models on same server—resource sharing), (3) model ensemble (combine multiple models), (4) pipeline (chain models—preprocessing → inference → postprocessing). Scaling considerations: (1) GPU utilization (batch size, concurrent requests), (2) memory management (model size, KV cache, batch size), (3) latency requirements (real-time vs. batch), (4) cost optimization (instance type, spot instances, autoscaling). Monitoring: (1) request latency (time to first token, total latency), (2) throughput (requests/second, tokens/second), (3) GPU metrics (utilization, memory), (4) queue depth (backlog of pending requests). Model serving infrastructure is critical for production ML, bridging the gap between trained models and user-facing applications.