Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bed2a1a
refactor(router): move default worker selection into builtin plugin
ishandhanani Sep 14, 2026
cd1abdc
perf(router): simplify builtin selection and retain cache estimate maps
ishandhanani Sep 14, 2026
c95eaff
fix(router): update replay test map and KVBM lockfile
ishandhanani Sep 18, 2026
50af464
fix(bench): specify relay phase clock type
ishandhanani Sep 18, 2026
a054cb1
fix(router): distinguish builtin defaults from explicit policies
ishandhanani Sep 18, 2026
01badd3
refactor(router): split builtin policy scoring and picking
ishandhanani Sep 18, 2026
e2996bd
perf(router): remove default score-pick hot-loop overhead
ishandhanani Sep 18, 2026
c86d24a
fix(router): update queue snapshot cache map fixture
ishandhanani Sep 18, 2026
5c6cb09
fix(router): integrate builtin selection with unified plugins
ishandhanani Sep 19, 2026
d39fa9f
fix(router): update stacked plugin fixtures and feature gates
ishandhanani Sep 19, 2026
711bc88
refactor(router): resolve builtin policy at startup
ishandhanani Sep 21, 2026
79bab85
bench(router): compare scoring API shapes at scale
ishandhanani Sep 21, 2026
8da3f69
bench(router): prototype batch scoring with private preparation
ishandhanani Sep 21, 2026
c36b7aa
fix(router): gate request cache context by component inputs
ishandhanani Sep 21, 2026
0e37754
perf(router): reuse cache-gated filter context across workers
ishandhanani Sep 21, 2026
1dca837
refactor(router): scope plugin inputs through borrowed views
ishandhanani Sep 21, 2026
fdd12d1
fix(router): gate cache setup on worker inputs
ishandhanani Sep 21, 2026
be4c9d1
test(router): deduplicate builtin selection setup
ishandhanani Sep 21, 2026
7445237
test(router): simplify builtin batch scoring fixtures
ishandhanani Sep 22, 2026
71ae532
docs(router): fix plugin scoring and registry examples
ishandhanani Sep 22, 2026
c3c9fe9
docs(router): hide builtin policy setup behind host API
ishandhanani Sep 22, 2026
16d2c67
refactor(router): simplify batch scoring example
ishandhanani Sep 22, 2026
f137b68
docs(router): trim plugin guide to external contracts
ishandhanani Sep 22, 2026
3584802
refactor(router): expose cache facts through worker inputs
ishandhanani Sep 22, 2026
7101cca
fix(python): keep router input validation independent of Python
ishandhanani Sep 22, 2026
98d3c70
refactor(router): apply builtin policy review cleanups
ishandhanani Sep 22, 2026
feb8b34
perf(router): avoid copying costs for unseeded sampling
ishandhanani Sep 22, 2026
3bf711f
refactor(router): simplify seeded builtin picker
ishandhanani Sep 22, 2026
d83839c
fix(router): preserve builtin load-only cache requirements
ishandhanani Sep 22, 2026
e1360a1
docs(router): defer request classifier documentation
ishandhanani Sep 22, 2026
1084384
fix(router): version the builtin policy dependency
ishandhanani Sep 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pre-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ jobs:
working-directory: ${{ matrix.dir }}
run: |
# custom-policy is on by default; also lint it alongside the standalone selection
# service, and the build that links no worker-selection policies at all.
# service, and the build without the optional policy catalog.
cargo clippy --locked --no-deps --features custom-policy,select-service --all-targets -- -D warnings
cargo clippy --locked --no-deps --no-default-features --all-targets -- -D warnings
- name: Lint feature-gated benchmark entrypoints
Expand Down
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ repository = "https://github.com/ai-dynamo/dynamo.git"
keywords = ["llm", "genai", "inference", "nvidia", "distributed"]

[workspace.dependencies]
dynamo-custom-policy-builtin = { path = "lib/router-plugins/builtin", version = "1.6.0" }
# Published separately by https://github.com/ai-dynamo/aisimulate.
aisimulate-core = { version = "=0.12.0" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,12 @@ def add_arguments(self, parser) -> None:
default=False,
dest="load_aware",
help=(
"KV Router: Enable load-aware routing without cache-reuse signals. "
"KV Router: Enable the load-aware routing preset. "
"On the frontend, this implies --router-mode kv. "
"This preset sets overlap_score_credit=0, disables KV events and "
"KV-reuse assumptions, enables active-block "
"and prefill-token load tracking, and disables remote/shared cache indexers."
"and prefill-token load tracking, and disables remote/shared cache indexers. "
"The builtin policy does not request cache inputs in this mode."
),
)
add_argument(
Expand Down
1 change: 1 addition & 0 deletions deploy/inference-gateway/ext-proc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ name = "dynamo-ext-proc"
path = "src/bin/dynamo-ext-proc.rs"

[dependencies]
dynamo-custom-policy-builtin = { workspace = true }
async-trait = { workspace = true }
dynamo-kv-router = { workspace = true, features = [
"metrics",
Expand Down
6 changes: 2 additions & 4 deletions deploy/inference-gateway/ext-proc/src/peer_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,7 @@ mod tests {
use axum::{Json, Router};
use dynamo_kv_router::WorkerType;
use dynamo_kv_router::config::kv_router_config_from_dynamo_env;
use dynamo_kv_router::services::selection::{
SelectionServiceBuilder, WorkerSelectionPolicyRegistry,
};
use dynamo_kv_router::services::selection::SelectionServiceBuilder;
use kube::Config;
use tokio::net::TcpListener;
use tokio::sync::Notify;
Expand All @@ -285,7 +283,7 @@ mod tests {
SelectionServiceBuilder::new(
kv_router_config_from_dynamo_env(),
WorkerType::Aggregated,
WorkerSelectionPolicyRegistry::default(),
dynamo_custom_policy_builtin::default_registry(),
)
.indexer_threads(1)
.replica_sync(listener_port, Vec::new())
Expand Down
9 changes: 6 additions & 3 deletions deploy/inference-gateway/ext-proc/src/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ impl Selector {
.await?;
}

let mut builder =
SelectionServiceBuilder::new(kv_router_config, WorkerType::Aggregated, policy_registry)
.indexer_threads(cfg.selector_threads);
let mut builder = SelectionServiceBuilder::new(
kv_router_config,
WorkerType::Aggregated,
policy_registry.with_default_factory(dynamo_custom_policy_builtin::default_factory()),
)
.indexer_threads(cfg.selector_threads);
if let Some(peer_replication) = peer_replication {
builder = builder.replica_sync(peer_replication.sync_port, Vec::new());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ its configuration even if the endpoint is unchanged.

## Routing Behavior

- `--router-kv-overlap-score-credit`: Device-local prefix-overlap credit multiplier in the prefill cost calculation. It must be finite and nonnegative. Values greater than `1.0` give overlap extra credit, but the adjusted prefill contribution is clamped at zero. When set to `0`, the router ignores prefix caches and skips creating a local indexer. Defaults to `1.0`.
- `--router-kv-overlap-score-credit`: Device-local prefix-overlap credit multiplier in the prefill cost calculation. It must be finite and nonnegative. Values greater than `1.0` give overlap extra credit, but the adjusted prefill contribution is clamped at zero. When set to `0`, device-local overlap receives no score credit. Cache setup still follows the policy's `WorkerInputs::CACHE` declaration. Defaults to `1.0`.
- `--router-kv-overlap-score-credit-decay`: Decays device-local overlap credit for workers whose active prefill load exceeds the least-loaded eligible worker. `0` disables decay. Defaults to 0.
- `--router-prefill-load-scale`: Scale applied to adjusted prompt-side prefill load after device, lower-tier, and shared-cache credits are subtracted. Defaults to 1.
- `--router-decode-active-request-weight`: Experimental finite, nonnegative block-equivalent decode cost added for each active request on a candidate worker. Defaults to 0.
- `--router-host-cache-hit-weight`: Credit multiplier for host-pinned (CPU offload) prefix overlap, from 0.0 to 1.0. Symmetric to `--router-kv-overlap-score-credit` but applied to the host-pinned tier when a backend exposes CPU offload via a KV connector. Defaults to 0.75.
- `--router-disk-cache-hit-weight`: Credit multiplier for disk/lower-tier (e.g. NVMe-backed) prefix overlap, from 0.0 to 1.0. Defaults to 0.25.
- `--load-aware`: Preset for load-aware KV routing without cache-reuse signals. On the frontend, it implies `--router-mode kv`. It sets `overlap_score_credit=0`, disables KV events and KV reuse assumptions, enables active-block and prefill-token load tracking, disables remote/shared cache indexers, and preserves `--router-prefill-load-scale`, `--router-host-cache-hit-weight`, and `--router-disk-cache-hit-weight`.
- `--load-aware`: Preset for load-aware KV routing. On the frontend, it implies `--router-mode kv`. It sets `overlap_score_credit=0`, disables KV events and KV reuse assumptions, enables active-block and prefill-token load tracking, disables remote/shared cache indexers, and preserves `--router-prefill-load-scale`, `--router-host-cache-hit-weight`, and `--router-disk-cache-hit-weight`. The policy's `WorkerInputs::CACHE` declaration still controls local approximate indexing; the builtin default declares `CACHE`.
- `--router-temperature`: Controls worker selection randomness through softmax sampling of normalized router cost logits. A value of 0 (default) ensures deterministic selection of the lowest-cost worker, while higher values introduce more randomness.
- `--router-conditional-disagg`: **Experimental.** Enables conditional disaggregation in frontend-embedded disaggregated serving. Requires `--router-mode kv`, `--router-kv-events`, separate prefill/decode worker pools, and decode-worker KV event publishing. Use `--router-conditional-disagg-config` for policy settings. See [Conditional Disaggregation](../../../advanced-customizations/conditional-disaggregation.md) for backend requirements and policy tuning.
- `--router-track-prefill-tokens`: Enables prompt-side load accounting in the worker cost model. This should stay enabled if you want queue thresholds, `active_prefill_tokens`, and AIC prefill load decay to reflect prompt work.
Expand Down Expand Up @@ -445,7 +445,7 @@ Use `--router-kv-overlap-score-credit-decay` to reduce that device-local credit

Use `--load-aware` when you want the KV scheduler's active load model without prefix/cache reuse. This is equivalent to using KV mode with overlap credit set to 0, KV events disabled, KV reuse assumptions disabled, active load tracking enabled, and shared-cache routing disabled. `--router-prefill-load-scale` remains available to tune prompt-side load relative to decode blocks.

Deprecated: `--router-kv-overlap-score-weight`, `--kv-overlap-score-weight`, `DYN_ROUTER_KV_OVERLAP_SCORE_WEIGHT`, and `DYN_OVERLAP_SCORE_WEIGHT` are still accepted, but emit deprecation warnings. Nonzero legacy values map to `prefill_load_scale` to preserve existing behavior without changing overlap credit. A legacy value of 0 maps to both `prefill_load_scale=0` and `overlap_score_credit=0`, which preserves the old no-overlap/no-indexer behavior. If a deprecated overlap score weight is still present, it takes precedence over the newer prefill load scale field; a legacy value of 0 also takes precedence over the newer overlap credit field. When migrating to `--router-prefill-load-scale` or `DYN_ROUTER_PREFILL_LOAD_SCALE`, remove the deprecated flag, env var, or JSON field from the deployment config. Use `--router-kv-overlap-score-credit` or `DYN_ROUTER_KV_OVERLAP_SCORE_CREDIT` only when you mean to tune the cache-overlap credit itself.
Deprecated: `--router-kv-overlap-score-weight`, `--kv-overlap-score-weight`, `DYN_ROUTER_KV_OVERLAP_SCORE_WEIGHT`, and `DYN_OVERLAP_SCORE_WEIGHT` are still accepted, but emit deprecation warnings. Nonzero legacy values map to `prefill_load_scale` to preserve existing behavior without changing overlap credit. A legacy value of 0 maps to both `prefill_load_scale=0` and `overlap_score_credit=0`, which zeros those scoring weights. Indexer setup follows the policy's `WorkerInputs::CACHE` declaration independently of these values. If a deprecated overlap score weight is still present, it takes precedence over the newer prefill load scale field; a legacy value of 0 also takes precedence over the newer overlap credit field. When migrating to `--router-prefill-load-scale` or `DYN_ROUTER_PREFILL_LOAD_SCALE`, remove the deprecated flag, env var, or JSON field from the deployment config. Use `--router-kv-overlap-score-credit` or `DYN_ROUTER_KV_OVERLAP_SCORE_CREDIT` only when you mean to tune the cache-overlap credit itself.

When migrating the deprecated overlap score weight, use `--router-prefill-load-scale` to preserve its scaling role. Tune `--router-kv-overlap-score-credit` separately only when you intend to change device-local cache credit; values above `1.0` are supported, with adjusted prefill cost clamped at zero.

Expand Down
Loading
Loading