Inferensys

Glossary

Cold Start

The latency penalty incurred when a model serving instance is initialized for the first time or after a period of inactivity, requiring weights to be loaded into memory before inference can begin.
MLOps engineer reviewing model serving infrastructure on laptop, container orchestration visible, technical workspace.
LATENCY-OPTIMIZED MODEL SERVING

What is Cold Start?

Cold start refers to the latency penalty incurred when a model serving instance is initialized for the first time or after a period of inactivity, requiring weights to be loaded into memory before inference can begin.

Cold start is the elevated prediction latency experienced when a model server container or function initializes without pre-loaded parameters. This delay occurs because the runtime must deserialize and transfer the model's weights from disk or object storage into accelerator memory—a process that can take seconds to minutes for large models, violating the strict Service Level Objective (SLO) thresholds required for real-time personalization.

Mitigation strategies include maintaining a pool of pre-warmed instances, using Readiness Probes to prevent traffic routing to uninitialized replicas, and employing model serialization formats like TensorRT engines that optimize load times. In serverless inference architectures, cold start latency is a critical design constraint, often addressed through provisioned concurrency or lightweight stub models that serve fallback predictions while the primary model initializes.

THE INITIALIZATION PENALTY

Key Characteristics of Cold Start Latency

Cold start latency is the delay incurred when a model instance initializes, loading weights from disk or object storage into accelerator memory before it can serve its first inference request. This phenomenon directly impacts autoscaling responsiveness and disaster recovery time objectives.

01

Weight Loading Bottleneck

The primary source of cold start latency is the time required to read model weights from persistent storage into GPU or CPU memory. For large language models, this can involve transferring hundreds of gigabytes over network or disk interfaces.

  • Model Size Impact: A 70B parameter model in FP16 requires ~140GB of memory, taking minutes to load even on high-bandwidth NVMe storage
  • Disk I/O Constraints: Traditional block storage may only sustain 1-2 GB/s read throughput, creating a hard floor on initialization time
  • Network-Attached Storage: Loading from cloud object stores like S3 adds network latency and throughput variability, often making this the slowest path
  • Memory Mapping: Techniques like mmap can defer page faults to first access, reducing apparent startup time but shifting latency to the first real inference request
02

Container Startup Overhead

In Kubernetes-orchestrated environments, cold start latency includes the full container lifecycle: image pulling, pod scheduling, and resource allocation before the model process even begins loading weights.

  • Image Pull Time: Large container images containing CUDA runtimes and framework dependencies can take 30-60 seconds to pull on a cold node
  • Node Autoscaling Delay: If no GPU node is available, the cluster autoscaler must provision a new VM, adding 2-5 minutes before pod scheduling begins
  • Init Container Execution: Pre-loading steps like downloading model artifacts or setting up shared memory segments add sequential delays
  • Health Check Gating: Readiness probes must pass before traffic is routed, meaning the model must be fully loaded and responsive before serving begins
03

GPU Kernel Compilation

When a model runs on a GPU for the first time, the CUDA or TensorRT runtime must just-in-time compile optimized kernels for the specific operations and tensor shapes in the model graph. This one-time compilation adds significant latency to the first inference.

  • CUDA JIT Compilation: PyTorch's CUDA graphs and custom kernels are compiled on first execution, adding seconds to the initial forward pass
  • TensorRT Build Phase: Converting an ONNX model to a TensorRT engine requires layer fusion, kernel selection, and precision calibration, which can take minutes
  • Shape Polymorphism: Dynamic input shapes prevent full ahead-of-time compilation, forcing recompilation when new batch sizes or sequence lengths are encountered
  • Cache Persistence: Compiled kernels can be serialized to disk and reloaded on subsequent starts, eliminating this overhead for repeat deployments
04

KV Cache Initialization

For generative transformer models, the key-value cache must be allocated in GPU memory before autoregressive decoding can begin. This allocation and zeroing of large memory buffers contributes to cold start latency.

  • Memory Allocation: Allocating contiguous GPU memory for the KV cache across all transformer layers requires significant time for large context windows
  • PagedAttention Pre-allocation: Systems like vLLM pre-allocate KV cache blocks to enable efficient memory management, but this upfront allocation extends startup time
  • Context Length Scaling: A model configured for 128K token contexts requires proportionally larger KV cache buffers, increasing initialization time linearly
  • NUMA-Aware Placement: Ensuring KV cache memory is allocated on the NUMA node local to the GPU minimizes access latency but requires careful orchestration during startup
05

Warm-Up Strategies

Production systems employ several techniques to eliminate or hide cold start latency from end users, ensuring that autoscaling events do not degrade the customer experience.

  • Pre-Warming: Sending synthetic 'dummy' inference requests to newly started instances forces weight loading, kernel compilation, and cache allocation before real traffic arrives
  • Over-Provisioning: Maintaining a buffer of idle, fully-loaded instances ready to absorb traffic spikes eliminates cold starts at the cost of higher baseline infrastructure spend
  • Lazy Loading with Fallback: Routing initial requests to a fast but less accurate fallback model while the primary model loads, then seamlessly switching over
  • Snapshot Restoration: Serializing the fully-initialized model state (weights + compiled kernels + KV cache) to disk and restoring it via direct memory copy, reducing startup from minutes to seconds
06

Impact on Autoscaling Responsiveness

Cold start latency directly determines how quickly a model serving system can react to traffic surges. The total scale-out latency is the sum of detection time, infrastructure provisioning, and model initialization.

  • Scale-Out Lag: A 3-minute cold start means the system is under-provisioned for 3 minutes during a traffic spike, causing request queuing and P99 latency spikes
  • HPA Synchronization: The Horizontal Pod Autoscaler's default 15-second metric polling window adds detection delay on top of cold start time
  • Thrashing Risk: If cold start time exceeds the scale-down cooldown period, instances may be terminated before they finish initializing, creating a destructive cycle
  • Predictive Scaling: Time-series forecasting of traffic patterns can trigger pre-emptive scaling before demand materializes, hiding cold start latency entirely from users
COLD START LATENCY

Frequently Asked Questions

Clear, technical answers to the most common questions about the initialization latency penalty in production machine learning systems.

A cold start is the latency penalty incurred when a model serving instance is initialized for the first time or after a period of inactivity, requiring model weights to be loaded from disk or object storage into accelerator memory before inference can begin. This initialization phase involves deserializing the model graph, allocating tensors on the GPU or CPU, and potentially warming up optimized kernels. Unlike a warm start where weights are already resident in memory, a cold start can add seconds to minutes of delay to the first prediction request. This is distinct from the cold start problem in recommender systems, which refers to the challenge of making predictions for new users or items with no historical interaction data. In the serving context, cold starts directly violate the Service Level Objective (SLO) for real-time applications where P99 latency must remain under a strict threshold, making them a critical concern for infrastructure engineers managing auto-scaling environments.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.