llm-d-workload-variant-autoscaler

module
v0.9.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: Apache-2.0

README

Workload-Variant-Autoscaler (WVA)

Go Report Card License

The Workload Variant Autoscaler (WVA) is a Kubernetes-based global autoscaler for inference model servers serving LLMs. WVA works alongside the standard Kubernetes HPA and external autoscalers like KEDA to drive the scale subresource of inference deployments. The high-level details of the algorithms are documented here. It determines optimal replica counts for a given request traffic load by considering constraints such as GPU availability, energy budget, and performance budget (latency/throughput).

What is a Variant?

WVA introduces the concept of variants — multiple model servers in an InferencePool that all serve the same base model but differ in hardware configuration (e.g., GPU type), serving configuration (e.g., tensor parallelism, max batch size, quantization), or both.

Use cases include:

  • P/D disaggregation: prefill is one variant, decode is another — variant = role in a disaggregated pipeline.
  • batch-gateway: variants distinguish batch vs. interactive workloads sharing the same pool.
  • Autoscaler: a costed serving configuration the autoscaler chooses among.

Key Features

  • Intelligent Autoscaling: Optimizes replica count by observing the current state of the system
  • Cost Optimization: Minimizes infrastructure costs by picking the correct accelerator variant

Documentation

See the architecture and autoscaling design docs for high-level algorithm details.

See the docs directory for design docs, developer guide, and more.

How It Works

Prerequisites: deploy llm-d infrastructure (model servers) and create an HPA or KEDA object targeting each deployment.

WVA then:

  1. Continuously monitors request rates and server performance via Prometheus metrics
  2. Capacity model obtains KV cache utilization and queue depth to determine desired replica counts
  3. Actuator emits optimization metrics to Prometheus
  4. External autoscaler (HPA/KEDA) reads the metrics and scales the deployment accordingly

Example

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: llama-8b-autoscaler
  namespace: llm-inference
  annotations:
    llm-d.ai/managed: "true"  # Opt-in to WVA management
    llm-d.ai/variant-cost: "10.0"  # Optional, defaults to "10.0"
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: llama-8b
  # minReplicas: 0  # scale to zero - alpha feature
  maxReplicas: 2
  behavior:
    scaleUp:
      stabilizationWindowSeconds: 60
      policies:
      - type: Pods
        value: 10
        periodSeconds: 15
    scaleDown:
      stabilizationWindowSeconds: 60
      policies:
      - type: Pods
        value: 10
        periodSeconds: 15
  metrics:
  - type: External
    external:
      metric:
        name: wva_desired_replicas
        selector:
          matchLabels:
            variant_name: llama-8b
            exported_namespace: llm-inference
      target:
        type: AverageValue
        averageValue: "1"

More examples in config/samples/hpa/ and config/samples/keda/.

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Join the llm-d autoscaling community meetings to get involved.

License

Apache 2.0 - see LICENSE for details.

References

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the llmd v1alpha1 API group.
Package v1alpha1 contains API Schema definitions for the llmd v1alpha1 API group.
internal
annotations
Package annotations defines the WVA annotation schema used for annotation-based discovery on KEDA ScaledObjects and Kubernetes HPAs.
Package annotations defines the WVA annotation schema used for annotation-based discovery on KEDA ScaledObjects and Kubernetes HPAs.
collector
Package collector provides metrics collection functionality.
Package collector provides metrics collection functionality.
collector/registration
This file provides queueing model analyzer metrics collection using the source infrastructure with registered query templates.
This file provides queueing model analyzer metrics collection using the source infrastructure with registered query templates.
collector/source
Package source provides metrics collection functionality.
Package source provides metrics collection functionality.
collector/source/pod
Package pod provides the Pod scraping metrics source implementation.
Package pod provides the Pod scraping metrics source implementation.
collector/source/prometheus
Package prometheus provides the Prometheus metrics source implementation.
Package prometheus provides the Prometheus metrics source implementation.
constants
Package constants provides centralized constant definitions for the autoscaler.
Package constants provides centralized constant definitions for the autoscaler.
coordinator
Package coordinator hosts the Coordinator component: a leader-elected, periodic loop that computes the set of scale targets (HPAs and KEDA ScaledObjects) under Coordinator control and dispatches them to a registered set of plugins.
Package coordinator hosts the Coordinator component: a leader-elected, periodic loop that computes the set of scale targets (HPAs and KEDA ScaledObjects) under Coordinator control and dispatches them to a registered set of plugins.
engines/aggregation
Package aggregation provides pure helper functions for aggregating per-variant capacity data into model-level and per-role totals.
Package aggregation provides pure helper functions for aggregating per-variant capacity data into model-level and per-role totals.
engines/executor
Package executor provides task execution strategies.
Package executor provides task execution strategies.
engines/pipeline
Limiter interfaces for resource limiting algorithms.
Limiter interfaces for resource limiting algorithms.
pkg
test
e2e
e2e/fixtures
Package fixtures provides shared Kubernetes helpers for the consolidated e2e suite.
Package fixtures provides shared Kubernetes helpers for the consolidated e2e suite.
utils
Package utils provides test utilities for PodScrapingSource e2e tests.
Package utils provides test utilities for PodScrapingSource e2e tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL