Managing Model Cold Starts and Scaling in KServe
Learn how to handle cold-start latency in KServe by balancing Knative autoscaling settings and decoupling model artifacts from serving images.
12 Aug 2025, 09:34 UTC

The Cost of Scaling to Zero
The primary appeal of serverless inference in KServe is the ability to scale to zero. When no requests are hitting your model, Kubernetes releases the compute resources, saving significant costs—especially when using expensive GPU nodes. However, this introduces a critical engineering problem: cold-start latency.
A cold start occurs when a request arrives at an inactive endpoint. KServe must trigger Knative to spin up a new pod, the storage initializer must pull the model artifacts from an external bucket (S3, GCS, or Azure Blob), and the runtime (TensorFlow, PyTorch, etc.) must load the model into memory. For large models, this delay can range from several seconds to minutes, which is unacceptable for real-time user applications.
Decoupling Artifacts from Images
KServe solves the deployment bottleneck by separating the serving runtime from the model artifacts. Instead of baking a 5GB model into a Docker image, you use a generic runtime image and point the InferenceService to a storage URI.
This architecture uses a Storage Initializer—a lightweight container that runs before the predictor starts. It handles the authentication and downloading of the model files. This means you can update your model version by simply changing a URI in your YAML without rebuilding your entire container image.
Implementing a Balanced Scaling Strategy
To mitigate cold starts while maintaining efficiency, you must tune the InferenceService annotations. The decision usually falls between absolute cost savings (scale to 0) and guaranteed responsiveness (min scale 1).
Example: Configuring an InferenceService for Low Latency
Below is a configuration for a Scikit-learn model. In this example, we set minScale: 1 to eliminate cold starts for a production endpoint, while allowing it to scale up to 10 replicas based on request concurrency.
# Run this on a cluster with KServe and Knative installed
# Required permissions: Cluster Admin or namespace-level edit access
apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
name: sklearn-iris
annotations:
# Prevents scaling to zero to avoid cold starts
serving.knative.dev/minScale: "1"
# Maximum number of pods to spawn
serving.knative.dev/maxScale: "10"
# Target concurrency per pod before scaling up
serving.knative.dev/target: "100"
spec:
predictor:
model:
modelFormat:
name: sklearn
storageUri: "gs://kfserving-examples/models/sklearn/iris"
Verification Steps:
- Apply the manifest:
kubectl apply -f iris.yaml - Monitor the rollout:
kubectl get inferenceservices -w - Verify the pod is active without a request:
kubectl get pods(you should see one pod running due tominScale: 1). - Test the V2 protocol endpoint:
curl -v -H "Content-Type: application/json" -d '{"inputs": [...]}' [ENDPOINT]/v2/models/sklearn-iris/infer
Trade-offs: Memory vs. Availability
While minScale: 1 solves the latency issue, it introduces a risk of OOMKilled (Out of Memory) errors. Because the model is loaded into memory during the initialization phase, the pod's memory limit must be significantly higher than the model's disk size to account for the runtime overhead.
| Strategy | Pros | Cons | Best Use Case |
|---|---|---|---|
| Scale to 0 | Zero cost when idle | High first-request latency | Internal batch tools, Dev environments |
| Min Scale 1 | Instant response | Constant resource cost | Customer-facing APIs |
Critical Limitations
KServe relies heavily on the underlying networking layer (Istio or Kourier). If the networking mesh is misconfigured, the InferenceService may report a Ready status, but the endpoint will return 404 or 503 errors. Always verify that your service account has the necessary IAM roles to access the storageUri; otherwise, the storage initializer will fail, and the pod will enter a CrashLoopBackOff.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.