llm-d-router

module
v0.9.2 Latest Latest
Warning

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

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

README

Go Report Card Go Reference License Join Slack

llm-d Router

[!IMPORTANT] Terminology Change: The Inference Scheduler has been renamed to llm-d Router; see Terminology.

[!IMPORTANT] API & Code Consolidation: Core Endpoint Picker (EPP) code and the InferenceObjective and InferenceModelRewrite APIs have been merged into this repository from Gateway API Inference Extension (GIE). The GIE repository now exclusively hosts the InferencePool API—an extension of the Kubernetes Gateway API—and defines the Endpoint Picker Protocol.

The llm-d Router is the intelligent entry point for inference traffic, delivering LLM load and prefix-cache aware routing, request prioritization, and advanced flow control across diverse request formats to fulfill complex serving objectives. It supports a flexible deployment model: it can run in Standalone Mode (where a self-managed Envoy proxy runs alongside the EPP in the same pod) or integrate with L7 load balancers—including self-managed instances (e.g., Istio, AgentGateway) and cloud-managed services (e.g., Google Cloud's Application Load Balancer)—via the Kubernetes Gateway API.

The router achieves its intelligence through an Endpoint Picker (EPP) that integrates with production-grade proxies (such as Envoy) via the ext-proc protocol, injecting real-time signals into the data plane to optimize request placement.

llm-d Router Architecture

Core Components and APIs

This repository hosts the following core components:

  • Endpoint Picker (EPP): The intelligent routing engine that serves as the "brain" of the router. It evaluates incoming requests against the current state of the InferencePool, considering factors like KV-cache locality, current load, and priority to make optimal placement decisions. It integrates with L7 proxies via the ext-proc protocol.
  • Request Management APIs: These resources directly influence the EPP's request handling behavior:
    • InferenceObjective: Configures the EPP's scheduling goals for specific requests, including priority levels and performance targets.
    • InferenceModelRewrite: Directs the EPP to perform model name rewriting, enabling flexible traffic management for A/B testing and canary rollouts.
  • Disaggregation Sidecar: A coordination component deployed alongside model servers (typically as a sidecar to the decode worker). It orchestrates complex multi-stage inference lifecycles, such as P/D (Prefill/Decode) and E/P/D (Encode/Prefill/Decode), by communicating with specialized encode and prefill workers to manage KV-cache and embedding transfers. For more details, see the Disaggregation Documentation.

Modes of Operation

The llm-d Router supports two primary deployment modes as specified in the Kubernetes Gateway API Inference Extensions:

1. Standalone Mode

A lightweight deployment where a self-managed Envoy proxy runs alongside the EPP in the same pod. This mode is ideal for clusters without Gateway API infrastructure or for basic testing and local evaluations.

2. Gateway Mode (Inference Gateway)

The recommended mode for production environments, leveraging the official Gateway API. In this mode, the EPP acts as a backend for an InferencePool, which is referenced by an HTTPRoute on a shared Gateway. This enables advanced traffic management, multi-cluster load balancing, and shared infrastructure for both inference and traditional workloads.

For more details on the router architecture, routing logic, and different plugins (filters and scorers), see the Architecture Documentation.


[!NOTE] The project provides tools for automatic Envoy installation. However, if you install or configure it yourself, please note that the only supported request_body_mode and response_body_mode is FULL_DUPLEX_STREAMED

Terminology

To ensure clarity across the project, we use the following standard terminology:

  • llm-d Router: The complete intelligent entry point, comprising both the Proxy (e.g., Envoy) and the Endpoint Picker (EPP). This term replaces "Inference Scheduler" in all contexts.
  • llm-d Endpoint Picker (EPP): The specific component that implements the routing intelligence and scoring logic. Use this term when referring to capabilities or configurations specific to the EPP itself, rather than the request routing system as a whole.
  • Inference Gateway: A synonym for the llm-d Router when operating in Gateway Mode.
  • Request Scheduler: A sub-component within the EPP responsible for the queuing and dispatching of requests.

Contributing

Start with the llm-d organization contributing guide for project-wide guidelines, code of conduct, and community resources.

Our community meeting is bi-weekly at Wednesday 10AM PDT (Google Meet, Meeting Notes).

We currently utilize the #sig-router channel in llm-d Slack workspace for communications.

For large changes please create an issue first describing the change so the maintainers can do an assessment, and work on the details with you. See DEVELOPMENT.md for details on how to work with the codebase.

Contributions are welcome!

Directories

Path Synopsis
apix
config/v1alpha1
Package v1alpha1 contains API Schema definitions for the llm-d.ai API group.
Package v1alpha1 contains API Schema definitions for the llm-d.ai API group.
v1alpha2
Package v1alpha2 contains API Schema definitions for the llm-d.ai API group.
Package v1alpha2 contains API Schema definitions for the llm-d.ai API group.
client-go
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/apix/v1alpha2
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/apix/v1alpha2/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
cmd
epp command
Package main contains the "Endpoint Picker (EPP)" program for scheduling inference requests.
Package main contains the "Endpoint Picker (EPP)" program for scheduling inference requests.
pd-sidecar command
internal
tls
pkg
common
Package common defines structs for referring to fully qualified k8s resources.
Package common defines structs for referring to fully qualified k8s resources.
common/routing
Package routing contains routing constants and utilities shared between the EPP/Inference-Scheduler and the Routing Sidecar.
Package routing contains routing constants and utilities shared between the EPP/Inference-Scheduler and the Routing Sidecar.
epp/flowcontrol/benchmark
Package benchmark implements a synchronous steady-state pipeline for load-testing the Flow Control layer.
Package benchmark implements a synchronous steady-state pipeline for load-testing the Flow Control layer.
epp/flowcontrol/contracts
Package contracts defines the boundaries and service interfaces for the Flow Control system.
Package contracts defines the boundaries and service interfaces for the Flow Control system.
epp/flowcontrol/contracts/mocks
Package mocks provides mocks for the interfaces defined in the `contracts` package.
Package mocks provides mocks for the interfaces defined in the `contracts` package.
epp/flowcontrol/controller
Package controller contains the implementation of the FlowController engine.
Package controller contains the implementation of the FlowController engine.
epp/flowcontrol/controller/internal
Package internal provides the core worker implementation for the controller.FlowController.
Package internal provides the core worker implementation for the controller.FlowController.
epp/flowcontrol/framework/plugins/queue
Package queue provides the factory and registration mechanism for all SafeQueue implementations.
Package queue provides the factory and registration mechanism for all SafeQueue implementations.
epp/flowcontrol/registry
Package registry provides the concrete implementation of the `contracts.FlowRegistry` interface.
Package registry provides the concrete implementation of the `contracts.FlowRegistry` interface.
epp/flowcontrol/types
Package types defines the fundamental data structures, interfaces, and errors that form the vocabulary of the Flow Control system.
Package types defines the fundamental data structures, interfaces, and errors that form the vocabulary of the Flow Control system.
epp/framework/interface/flowcontrol
Package flowcontrol defines the core plugin interfaces for extending the Flow Control layer.
Package flowcontrol defines the core plugin interfaces for extending the Flow Control layer.
epp/framework/plugins/datalayer/attribute/session
Package session declares the SessionID attribute that carries per-request session identity for affinity scoring and filtering.
Package session declares the SessionID attribute that carries per-request session identity for affinity scoring and filtering.
epp/framework/plugins/datalayer/discovery/file
Package file provides a file-based EndpointDiscovery implementation that reads a YAML (or JSON) file listing inference endpoints.
Package file provides a file-based EndpointDiscovery implementation that reads a YAML (or JSON) file listing inference endpoints.
epp/framework/plugins/datalayer/source/http/httptest
Package httptest provides test helpers for HTTPDataSource parser implementations.
Package httptest provides test helpers for HTTPDataSource parser implementations.
epp/framework/plugins/flowcontrol/eviction/filtering
Package filtering provides built-in EvictionFilterPolicy implementations.
Package filtering provides built-in EvictionFilterPolicy implementations.
epp/framework/plugins/flowcontrol/fairness
Package fairness provides the standard implementations of the FairnessPolicy interface.
Package fairness provides the standard implementations of the FairnessPolicy interface.
epp/framework/plugins/flowcontrol/fairness/globalstrict
Package globalstrict implements a greedy fairness policy that enforces a strict global ordering across all flows within a priority band, ignoring flow boundaries.
Package globalstrict implements a greedy fairness policy that enforces a strict global ordering across all flows within a priority band, ignoring flow boundaries.
epp/framework/plugins/flowcontrol/fairness/program-aware
Package programaware implements a flow-control fairness policy that schedules per-program queues using a swappable scoring strategy.
Package programaware implements a flow-control fairness policy that schedules per-program queues using a swappable scoring strategy.
epp/framework/plugins/flowcontrol/fairness/roundrobin
Package roundrobin implements a fairness policy that selects queues from a priority band using a round-robin strategy, cycling through active flows one by one to guarantee that no single flow can starve others.
Package roundrobin implements a fairness policy that selects queues from a priority band using a round-robin strategy, cycling through active flows one by one to guarantee that no single flow can starve others.
epp/framework/plugins/flowcontrol/ordering
Package ordering provides the standard implementations of the OrderingPolicy interface.
Package ordering provides the standard implementations of the OrderingPolicy interface.
epp/framework/plugins/flowcontrol/ordering/edf
Package edf implements an ordering policy that selects requests based on their absolute deadlines (Earliest Deadline First).
Package edf implements an ordering policy that selects requests based on their absolute deadlines (Earliest Deadline First).
epp/framework/plugins/flowcontrol/ordering/fcfs
Package fcfs implements an ordering policy that selects requests based on their arrival order at the Flow Control layer (First-Come, First-Served).
Package fcfs implements an ordering policy that selects requests based on their arrival order at the Flow Control layer (First-Come, First-Served).
epp/framework/plugins/flowcontrol/ordering/slodeadline
Package slodeadline implements an ordering policy that selects requests based on an SLO-based deadline derived from request headers.
Package slodeadline implements an ordering policy that selects requests based on an SLO-based deadline derived from request headers.
epp/framework/plugins/requestcontrol
Package requestcontrol holds definitions shared by all requestcontrol framework plugins.
Package requestcontrol holds definitions shared by all requestcontrol framework plugins.
epp/framework/plugins/requestcontrol/admitter/probabilisticadmitter
Package probabilisticadmitter implements a binary-tier probabilistic admission control plugin.
Package probabilisticadmitter implements a binary-tier probabilistic admission control plugin.
epp/framework/plugins/requestcontrol/dataproducer/multimodal
Package multimodal provides a data producer for multimodal encoder-cache affinity.
Package multimodal provides a data producer for multimodal encoder-cache affinity.
epp/framework/plugins/requestcontrol/dataproducer/preciseprefixcache
Package preciseprefixcache hashes TokenizedPrompt into KV-block keys, looks them up in the index, and writes per-endpoint PrefixCacheMatchInfo.
Package preciseprefixcache hashes TokenizedPrompt into KV-block keys, looks them up in the index, and writes per-endpoint PrefixCacheMatchInfo.
epp/framework/plugins/requestcontrol/dataproducer/predictedlatency
Package requestcontrol contains helpers to decouple latency-predictor logic.
Package requestcontrol contains helpers to decouple latency-predictor logic.
epp/framework/plugins/requestcontrol/dataproducer/sessionid
Package sessionid provides a DataProducer that extracts a session identifier from a configured request header or named cookie and publishes it as a SessionID attribute on the InferenceRequest attribute store, so that affinity-aware scorers and filters can read it without knowing how the session was carried on the wire.
Package sessionid provides a DataProducer that extracts a session identifier from a configured request header or named cookie and publishes it as a SessionID attribute on the InferenceRequest attribute store, so that affinity-aware scorers and filters can read it without knowing how the session was carried on the wire.
epp/framework/plugins/requestcontrol/dataproducer/tokenizer
Package tokenizer provides a DataProducer plugin that tokenizes the request prompt and publishes the result on InferenceRequestBody.TokenizedPrompt for downstream consumers (scorers, filters, other data producers).
Package tokenizer provides a DataProducer plugin that tokenizes the request prompt and publishes the result on InferenceRequestBody.TokenizedPrompt for downstream consumers (scorers, filters, other data producers).
epp/framework/plugins/requestcontrol/preadmitter/agentidentity
Package agentidentity provides a PreAdmitter plugin that resolves agent identity from provider-specific headers into the FairnessID field.
Package agentidentity provides a PreAdmitter plugin that resolves agent identity from provider-specific headers into the FairnessID field.
epp/framework/plugins/requesthandling/parsers/vllmhttp
Package vllmhttp provides a request parser for vLLM HTTP endpoints that are not part of the OpenAI-compatible API surface — specifically /inference/v1/generate.
Package vllmhttp provides a request parser for vLLM HTTP endpoints that are not part of the OpenAI-compatible API surface — specifically /inference/v1/generate.
epp/framework/plugins/scheduling
Package scheduling holds definitions shared by all scheduling framework plugins.
Package scheduling holds definitions shared by all scheduling framework plugins.
epp/framework/plugins/scheduling/filter/bylabel
Package bylabel provides filter plugins for the epp.
Package bylabel provides filter plugins for the epp.
epp/framework/plugins/scheduling/filter/prefixcacheaffinity
Package prefixcacheaffinity provides a probabilistic filter that narrows candidates to "sticky" endpoints (those with high prefix cache scores).
Package prefixcacheaffinity provides a probabilistic filter that narrows candidates to "sticky" endpoints (those with high prefix cache scores).
epp/framework/plugins/scheduling/filter/sessionaffinity
Package sessionaffinity provides a session affinity filter plugin for the epp.
Package sessionaffinity provides a session affinity filter plugin for the epp.
epp/framework/plugins/scheduling/filter/sloheadroomtier
Package headroomtier provides a probabilistic filter that selects endpoints based on predicted latency headroom (SLO - predicted).
Package headroomtier provides a probabilistic filter that selects endpoints based on predicted latency headroom (SLO - predicted).
epp/framework/plugins/scheduling/picker
Package picker provides the standard implementations of the Picker interface for the scheduling framework.
Package picker provides the standard implementations of the Picker interface for the scheduling framework.
epp/framework/plugins/scheduling/picker/maxscore
Package maxscore implements a scheduling picker that selects the endpoint(s) with the highest score calculated during the scoring phase.
Package maxscore implements a scheduling picker that selects the endpoint(s) with the highest score calculated during the scoring phase.
epp/framework/plugins/scheduling/picker/random
Package random implements a scheduling picker that selects endpoints uniformly at random, ignoring any scores calculated by scorer plugins.
Package random implements a scheduling picker that selects endpoints uniformly at random, ignoring any scores calculated by scorer plugins.
epp/framework/plugins/scheduling/picker/weightedrandom
Package weightedrandom implements a scheduling picker that selects endpoints randomly, where the probability of an endpoint being selected is proportional to its score.
Package weightedrandom implements a scheduling picker that selects endpoints randomly, where the probability of an endpoint being selected is proportional to its score.
epp/framework/plugins/scheduling/profilehandler/dataparallel
Package dataparallel provides a data-parallel profile handler plugin for the epp.
Package dataparallel provides a data-parallel profile handler plugin for the epp.
epp/framework/plugins/scheduling/profilehandler/disagg
Package disagg provides profile handler plugins for the epp.
Package disagg provides profile handler plugins for the epp.
epp/framework/plugins/scheduling/scorer/activerequest
Package activerequest provides an active request scorer plugin for the epp.
Package activerequest provides an active request scorer plugin for the epp.
epp/framework/plugins/scheduling/scorer/contextlengthaware
Package contextlengthaware provides plugins that implement multiple extension points (e.g., both Filter and Scorer interfaces).
Package contextlengthaware provides plugins that implement multiple extension points (e.g., both Filter and Scorer interfaces).
epp/framework/plugins/scheduling/scorer/latency
Package latency provides a scorer that scores endpoints based on predicted latency headroom.
Package latency provides a scorer that scores endpoints based on predicted latency headroom.
epp/framework/plugins/scheduling/scorer/loadaware
Package loadaware provides a load-aware scorer plugin for the epp.
Package loadaware provides a load-aware scorer plugin for the epp.
epp/framework/plugins/scheduling/scorer/mmcacheaffinity
Package mmcacheaffinity scores endpoints from multimodal encoder-cache match info produced by the request-control multimodal data producer.
Package mmcacheaffinity scores endpoints from multimodal encoder-cache match info produced by the request-control multimodal data producer.
epp/framework/plugins/scheduling/scorer/nohitlru
Package nohitlru provides a no-hit LRU scorer plugin for the epp.
Package nohitlru provides a no-hit LRU scorer plugin for the epp.
epp/framework/plugins/scheduling/scorer/preciseprefixcache
Package preciseprefixcache provides a precise prefix cache scorer plugin for the epp.
Package preciseprefixcache provides a precise prefix cache scorer plugin for the epp.
epp/framework/plugins/scheduling/scorer/sessionaffinity
Package sessionaffinity provides a session affinity scorer plugin for the epp.
Package sessionaffinity provides a session affinity scorer plugin for the epp.
epp/framework/plugins/scheduling/util/sessionaffinity
Package sessionaffinity provides the session header helpers shared by the session-affinity scorer and filter plugins.
Package sessionaffinity provides the session header helpers shared by the session-affinity scorer and filter plugins.
epp/requestcontrol
Package requestcontrol defines the Director component responsible for orchestrating request processing after initial parsing.
Package requestcontrol defines the Director component responsible for orchestrating request processing after initial parsing.
epp/scheduling
Package scheduling implements request scheduling algorithms.
Package scheduling implements request scheduling algorithms.
generator command
sidecar/proxy
Package proxy contains the disaggregated prefilling routing proxy implementation
Package proxy contains the disaggregated prefilling routing proxy implementation
sidecar/version
Package version contains build version information
Package version contains build version information
test
integration
Package integration provides shared utilities, request builders, and assertions for the hermetic integration test suites of the Gateway API Inference Extension.
Package integration provides shared utilities, request builders, and assertions for the hermetic integration test suites of the Gateway API Inference Extension.
sidecar/mock
Package mock offers a mock CompletionHandler for tests
Package mock offers a mock CompletionHandler for tests
sidecar/utils
Package utils provides various utilities
Package utils provides various utilities
utils
Package utils contains utilities for testing
Package utils contains utilities for testing

Jump to

Keyboard shortcuts

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