llm-wiki wiki · sources 2026-06-12

llm-d/llm-d-router 是 llm-d 的智能入口。它通过 Envoy/ext-proc 或 Gateway API Inference Extension 接入流量,核心 EPP 用 filters、scorers、scrapers 和 scheduling profiles 对 InferencePool pods 做过滤/打分/选择;同时包含 disaggregation sidecar,协调 encode/prefill/decode 多阶段推理。

核心架构图

┌──────────────────────────── proxy / gateway ────────────────────────────────┐
│ Envoy FULL_DUPLEX_STREAMED ext-proc · Gateway API · standalone mode           │
└───────────────────────────────┬───────────────────────────────────────────────┘
                                │
┌───────────────────────────────▼───────────────────────────────────────────────┐
│ Endpoint Picker (EPP)                                                         │
│ request parser · filters · scorers · scrapers · scheduling profiles           │
└───────────────┬───────────────────────────────┬───────────────────────────────┘
                │                               │
┌───────────────▼──────────────┐  ┌─────────────▼──────────────────────────────┐
│ K8s discovery/data layer      │  │ request management APIs                     │
│ InferencePool · endpoints     │  │ InferenceObjective · InferenceModelRewrite  │
└───────────────┬──────────────┘  └─────────────┬──────────────────────────────┘
                │                               │
┌───────────────▼───────────────────────────────▼──────────────────────────────┐
│ selected model server pod / P-D-E sidecar orchestration                       │
└───────────────────────────────────────────────────────────────────────────────┘

模块分层

层/目录 责任
cmd/epp, pkg/epp/server/** EPP server 和 controller manager。
pkg/epp/config, pkg/epp/framework/plugins/** EndpointPickerConfig、plugins、scheduling profiles。
pkg/epp/datalayer/** K8s binding、InferencePool endpoint graph、runtime state。
pkg/common/envoy/** Envoy request/response/header/metadata/chunking 辅助。

关键数据流

  1. proxy 收到请求后把 headers/body stream 给 EPP ext-proc。
  2. EPP 解析请求模型/priority/profile,加载 EndpointPickerConfig,按 filters 排除不合适 endpoints。
  3. scorers 访问 scrapers/datastore 中的 load、KV、metrics 等信号,按权重打分;picker 选择最高分 pod。

设计决策

对比定位

和 AIBrix gateway plugins 相比,llm-d-router 更聚焦标准 Router/EPP;和 agentgateway 相比,它面向 model server pod placement,而不是 MCP/A2A/LLM access governance;和 RouteLLM/semantic-router 相比,它更 K8s/runtime metrics 驱动。

相关链接