The direct answer

The cheapest GPU inference setup is not the one with the highest utilization target. It is the one that keeps enough capacity ready for the traffic your product actually creates, while preventing both idle GPUs and queues that damage the customer experience.

For a developer entrepreneur, that means treating autoscaling as a product decision rather than a cluster setting. You need to decide four things:

  1. Which workload signal should trigger more capacity?
  2. How much capacity should remain warm?
  3. How quickly should capacity disappear after demand falls?
  4. What happens when demand exceeds the budget you have approved?

A sensible starting architecture is a small warm pool for interactive inference, autoscaling for the rest, an explicit request queue, and hard limits at the application and billing layers. Kubernetes can implement much of this, but it does not decide your acceptable latency, utilization floor or commercial risk tolerance.

Start with the unit economics of idle time

GPU capacity is indivisible from the customer’s perspective. A partially used accelerator still consumes the GPU allocation attached to the pod. If one inference pod holds a whole GPU while handling only a small share of the workload, the remaining capacity is not automatically available to another pod.

This is why a conventional utilization target can be misleading. A high target may reduce the number of running pods, but it can also create a queue just before the autoscaler reacts. A low target leaves more headroom and improves the chance of immediate service, but increases idle spend.

Start with a simple hourly comparison:

Hourly inference capacity cost = running GPU count × hourly cost per GPU

That figure is only the beginning. The useful operating question is:

Cost per useful inference hour = total GPU cost ÷ GPU hours that produced accepted output

An idle GPU inflates the denominator’s cost without producing useful output. A queued request may not increase GPU cost directly, but it can reduce revenue or increase support burden if customers abandon the interaction.

Do not set a utilization target until you can separate three states:

  • Useful work: requests completed within the latency objective.
  • Headroom: capacity deliberately held ready for bursts.
  • Waste: capacity that neither serves the current queue nor belongs to the warm pool.

The third category is what autoscaling should shrink. The second is what you are paying to remove latency risk.

Choose the signal that reflects saturation

Kubernetes Horizontal Pod Autoscaling (HPA) updates the replica count of a workload such as a Deployment to match demand. The standard resource metrics pipeline provides CPU and memory metrics through the Metrics API. For a richer signal, a custom or external metrics pipeline can expose application-level measurements to autoscaling.

For GPU-backed inference, CPU utilization is usually a poor proxy for GPU saturation. An inference process may wait on data, model loading or network calls while holding a GPU, or it may use the GPU intensely while CPU use looks modest. A GPU utilization metric can be better, but it still does not reveal whether the service is about to miss its latency target.

A stronger signal is usually a combination of:

  • Requests waiting in the inference queue.
  • The age of the oldest queued request.
  • Active or in-flight inference requests.
  • Token or batch work queued, if that reflects customer work accurately.
  • GPU utilization as a capacity diagnostic, not the sole demand signal.

The key distinction is between utilization and saturation. Utilization tells you how occupied a resource is. Saturation tells you whether demand is waiting because capacity has run out. Queue depth and queue age map more directly to the second condition.

A practical decision rule is:

  • Scale up on queue depth or queue age when waiting work threatens the latency objective.
  • Scale down when both the queue and a minimum activity threshold have stayed low for a sustained period.
  • Use GPU utilization to detect inefficient placement, oversized models or poor batching—not as a substitute for customer-facing demand.

For custom metrics, Kubernetes supports custom.metrics.k8s.io and external.metrics.k8s.io. Those interfaces can carry application signals into an autoscaler, but your metrics pipeline still needs to collect and expose those signals reliably.

Set the utilization target as a guardrail

Once you have a meaningful demand metric, use the utilization target to prevent obvious underuse. It should not be the only control.

Start conservatively. Choose a target that leaves room for traffic variation, model startup and imperfect metric freshness. Then test it against real request bursts. If every additional pod creates enough queue pressure to trigger another pod, the target is too high or the scaling reaction is too late.

For custom metrics, the interpretation depends on the metric you publish. A queue-depth metric expressed as “average pending requests per worker” can be scaled against a target such as the amount of pending work each worker should handle. An age metric can be scaled against the remaining latency budget. Do not copy a CPU-style percentage to a queue metric and expect it to behave the same way.

Also account for stabilization. Rapid scale-up followed by immediate scale-down is expensive and can produce an oscillating fleet. A scale-up stabilization window can prevent repeated additions from being reversed too quickly. Conversely, an intentionally slow scale-down window protects a warm pool from disappearing between closely spaced bursts.

The practical goal is not smooth replica counts. It is smooth customer latency at an acceptable spend level.

Separate the warm pool from burst capacity

A warm pool is capacity you keep running to remove startup or acquisition delay. For GPU inference, it may mean one or more already-loaded model replicas, or it may simply mean a minimum number of pods that the autoscaler never scales below.

Both create idle-cost exposure, but they are not identical:

  • A minimum-replica warm pod is simple and usually gives the quickest response. Its cost continues through quiet periods.
  • A separate warm serving tier can protect interactive traffic from background work. It adds routing, capacity and operational complexity.

Start with the minimum-replica approach unless workload isolation has a concrete business need. If customer-facing inference and asynchronous generation share the same autoscaler, background bursts can consume the headroom needed for interactive requests. In that case, separate queues, concurrency limits or pools are usually more valuable than a clever utilization target. The companion guide on isolating synchronous, asynchronous, and agent-driven AI workloads explains those queue boundaries.

The warm pool is worth its cost when the expected value of an immediate response exceeds the carrying cost of reserved capacity. That includes customer-facing features where latency affects conversion, retention or support volume. It is harder to justify for delayed batch work that can tolerate a controlled wait.

Do not confuse a warm pod with a pod whose model is loaded. Kubernetes can keep a pod running while the application still loads a model, downloads weights or initializes a runtime. If startup is slow, verify readiness reflects actual service capability rather than merely a running process.

Make scale-down behavior deliberate

Scale-down is where idle GPU cost usually accumulates. HPA can reduce replicas when load falls and the replica count is above the configured minimum, but the safe behavior depends on the workload.

For interactive inference, use a slow, deliberate scale-down. A long stabilization window and a minimum replica count can prevent repeated cold starts. Accept that some capacity will remain intentionally idle.

For asynchronous inference, use a more aggressive scale-down if delayed completion is acceptable. A job queue can retain work while the fleet shrinks, then start pods when enough work accumulates to justify them. This trades completion latency for lower carry cost. For a deeper framework on controlling asynchronous inference queues and concurrency, see the asynchronous workload cost-control guide.

Avoid using a single scale-down policy for both categories. The right delay for a customer chat completion may be unacceptable for a nightly document-processing job.

A sound scale-down decision requires several conditions, not one:

  1. The request queue is empty or below a low threshold.
  2. No jobs are close to completion on pods you are about to remove.
  3. The oldest pending request is still within the acceptable wait.
  4. The replica count will remain at or above the chosen warm floor.
  5. The cloud or infrastructure layer will not incur a larger termination or idle-charge penalty than the short-term saving.

The last condition matters with many GPU clouds: the hourly cost of a GPU is not always the whole cost of removing it. Verify the provider’s billing and commitment rules before optimizing around apparent hourly savings.

Put queueing in front of the autoscaler

An autoscaler cannot create capacity faster than the GPU nodes can be provisioned, drivers initialized, containers started, models downloaded and models loaded. Queueing is therefore part of the design, not a failure to hide.

Use a queue to make overload behavior explicit. It should expose:

  • The current queue depth.
  • The age of the oldest request.
  • Expected wait time, if your model is calibrated enough to support it.
  • A clear cancellation path where the product permits it.
  • Tenant or workload priority where commercial commitments justify it.

Without a queue, excess requests can pile up inside serving processes or time out at the edge. That hides saturation and makes the autoscaler’s input less meaningful.

Choose queue behavior by workload:

  • Interactive requests: bounded queues, short deadlines and explicit overload responses are preferable to unbounded waiting.
  • Background jobs: deeper queues are often appropriate, provided the application can show progress and persist work across restarts.
  • Best-effort work: drop, sample or defer it before it threatens paid, latency-sensitive work.

The queue should feed the autoscaler. Queue depth and queue age are often more useful signals than total traffic because they reveal work that has not yet received service.

Enforce spend limits at more than one layer

Autoscaling controls replica count; it does not enforce a cloud budget. Add explicit limits so a faulty metric, traffic loop or runaway agent cannot turn into an unbounded GPU bill.

Use at least four guardrails:

  1. A hard maximum replica count. This caps the fleet size, though it does not cap the hourly rate of a very expensive accelerator.
  2. A queue or concurrency cap. This limits how much work can be accepted at once and prevents the autoscaler from reacting to an unbounded backlog.
  3. An application-level spend or token budget. Stop admitting work when the product-level budget is exhausted, allocate capacity across tenants and reject or defer lower-priority jobs.
  4. A cloud budget or quota alert. Notify operators before the infrastructure bill crosses a chosen threshold. A notification is not a hard stop, so pair it with one of the earlier controls.

Also prevent autoscaling feedback loops. If scaling adds capacity, that capacity accepts more work, and the resulting queue growth triggers additional scale-up, the autoscaler may chase its own tail. Admission control and a fixed maximum help break the loop.

Set limits per tenant when your customers can create unpredictable workloads. A global maximum protects the total bill; per-tenant limits protect fairness and stop one account from consuming the entire warm pool.

A Kubernetes configuration that establishes the right boundaries

The following example deliberately uses conservative settings as a starting point. It does not prove that 70% is the correct utilization target for your model. Replace it with a target derived from queue age, latency objectives and observed workload behavior.

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: gpu-inference
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: gpu-inference
  minReplicas: 2
  maxReplicas: 20
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70
  behavior:
    scaleUp:
      stabilizationWindowSeconds: 30
      policies:
        - type: Percent
          value: 100
          periodSeconds: 60
    scaleDown:
      stabilizationWindowSeconds: 600
      policies:
        - type: Percent
          value: 25
          periodSeconds: 120

This manifest creates useful boundaries: two warm replicas, a hard fleet maximum, faster scale-up and slower scale-down. But it still scales on CPU. For production inference, expose a queue-depth or queue-age metric and configure it as a custom or external metric instead. The custom metric must be available through the appropriate metrics API for the cluster.

GPU allocation belongs in the pod’s resource limits. Kubernetes GPU support is provided through device plugins, which expose vendor GPUs as schedulable resources such as nvidia.com/gpu. GPU resources are specified as limits; if requests are also specified, the values must match.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: gpu-inference
spec:
  replicas: 2
  selector:
    matchLabels:
      app: gpu-inference
  template:
    metadata:
      labels:
        app: gpu-inference
    spec:
      containers:
        - name: inference
          image: registry.example.com/inference:1.0
          resources:
            limits:
              nvidia.com/gpu: 1

The exact resource name depends on the device plugin in your cluster. The Deployment also needs the readiness, liveness, model-loading and queue controls described above; an HPA manifest alone is not a complete inference service.

Test the policy with four controlled scenarios

Do not wait for a customer spike to discover that the autoscaler is misconfigured. Test the system under controlled load and watch four outcomes together: latency, queue age, GPU utilization and spend.

1. Baseline traffic

Confirm that the warm pool handles normal demand without unnecessary replicas. Check whether any pod is idle while queued work waits elsewhere.

2. Sudden burst

Send a short burst larger than the warm pool. Observe the delay before new capacity becomes ready, whether requests wait gracefully and whether the scale-up rule overshoots.

3. Sustained load

Run enough traffic to reach the maximum replica count. Verify that the queue cap or application budget stops unbounded work from expanding the bill further.

4. Traffic drop

Remove the load and watch the scale-down window. Confirm that pending work is drained, warm capacity remains where required and scale-down does not oscillate.

Change one variable at a time. If you alter the target, stabilization window and maximum together, you will not know which change caused the latency or cost result.

Keep a policy record with each version. Record the workload shape, model, request deadline, warm floor, scaling metric, target, maximum replicas, queue limits and spend cap. GPU inference economics change with model size, batching, quantization and traffic. The configuration is not a universal preset.

A founder’s rollout checklist

Before putting this policy into production, confirm that you can answer these questions:

  • What is the customer-facing latency objective, and how much of it may be consumed while a request waits?
  • Which metric proves that more GPU capacity is needed?
  • How much capacity remains warm during quiet hours?
  • Which workloads are allowed to use that warm capacity?
  • How long does scale-down wait before removing a pod?
  • What is the maximum number of replicas and the maximum accepted queue depth?
  • Which layer enforces the product budget when the cluster is already at its maximum?
  • How will you distinguish intentional warm headroom from accidental idle capacity?
  • What happens when the autoscaler cannot add capacity because the cluster has no eligible GPU nodes?

The last question exposes another boundary. A replica maximum does not guarantee that new pods can run. GPU nodes may lack capacity, and nodes with different accelerator types may not satisfy the same pod specification. Label nodes by accelerator type and use node selectors when the workload requires a particular device class. Observe pending pods, scheduling events and device health rather than assuming HPA replicas equal available inference capacity.

Frequently asked questions

Should GPU utilization be the HPA target?\n

Usually not by itself. GPU utilization can identify occupied or inefficiently provisioned workers, but queue depth and queue age reveal unmet demand more directly. Use utilization as a diagnostic or guardrail and scale on the signal closest to the customer deadline.

Is a high GPU utilization target always cheaper?\n

No. It may reduce replica count, but it can also leave little time and capacity to absorb a burst. If the autoscaler reacts after requests begin waiting, the apparent saving can come with worse latency or abandoned work. Evaluate cost together with accepted requests and queue age.

Should background jobs use the same warm pool as customer requests?\n

Not if background bursts can consume capacity needed for interactive work. Separate pools or workload classes make priority and capacity reservation explicit. If they share one pool, enforce concurrency and priority at the queue layer.

Does Kubernetes enforce the GPU bill?

No. HPA changes replica counts, while the cloud provider bills the underlying capacity. Enforce product budgets through admission control, concurrency or token limits, and use a hard maximum replica count as a separate fleet bound. Add cloud budget alerts for visibility and response.

The operating principle

The right GPU autoscaling policy is the cheapest one that preserves the service promise under realistic bursts. Keep a deliberately small warm floor, scale on saturation rather than activity alone, drain work before scale-down, cap admissions and spend at multiple layers, and document the assumptions behind every target.

That approach will not minimize the number of GPUs visible in a dashboard every hour. It is designed to improve the more important business metric: useful work delivered per dollar without avoidable latency spikes.


Sources