Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.
Rust
refactor(vgr): rename tiers to efficient and capable (#1066)
GDRS2ca856c4af02
diff --git a/crates/libsy/src/algorithms/vgr.rs b/crates/libsy/src/algorithms/vgr.rsindex d2db4fa77..199546100 100644--- a/crates/libsy/src/algorithms/vgr.rs+++ b/crates/libsy/src/algorithms/vgr.rs@@ -4,7 +4,7 @@//! Verification-gated routing: fail-closed capability derivation.//!//! Capabilities are never client-declared. They come from the router's own-//! typing of the request, the attempt it produced locally, and its own reading+//! typing of the request, the attempt it produced on the efficient tier, and its own reading//! of the tool results in the conversation. No client-reachable input selects//! a weaker regime than the default one; unsupported content and missing//! evidence select [`Branch::Unknown`], which never commits.@@ -35,7 +35,7 @@ pub use safety::{BreakerConfig, KillSwitch};#[cfg(test)]mod tests;-/// A verification-gated route between a local and a capable tier.+/// A verification-gated route between an efficient and a capable tier.pub struct Vgr {route: FallThrough,classifier: Arc<runtime::VgrClassifier>,@@ -45,7 +45,7 @@ impl Vgr {/// Validates and constructs a verification-gated route.pub fn new(config: VgrConfig) -> Result<Self> {config.validate()?;- let mut affinity = AffinityRouter::new().with_latch_only([config.targets.cloud.clone()]);+ let mut affinity = AffinityRouter::new().with_latch_only([config.targets.capable.clone()]);let reason = if config.latch_escalation && config.mode != ServingMode::Shadow {"session_latched"} else {@@ -76,25 +76,25 @@ impl Algorithm for Vgr {}async fn route(self: Arc<Self>, driver: Driver, request: Request) -> Result<RoutingOutcome> {- // The handoff note is written for the cloud tier, so a local stand-in gets the request+ // The handoff note is written for the capable tier, so an efficient stand-in gets the request// as it arrived.let arrived = self.classifier- .local_may_stand_in(&request)+ .efficient_may_stand_in(&request).then(|| request.clone());let mut outcome = self.route.execute(driver, request).await?;- // Local answers are already buffered and have no fallback.+ // Efficient answers are already buffered and have no fallback.outcome.selected_model_ids.truncate(1);let config = &self.classifier.config;if let Some(arrived) = arrived&& outcome.response.is_none()- && outcome.selected_model_ids.first() == Some(&config.targets.cloud)- // The local tier may have failed while this request was routed.- && self.classifier.local_may_stand_in(&arrived)+ && outcome.selected_model_ids.first() == Some(&config.targets.capable)+ // The efficient tier may have failed while this request was routed.+ && self.classifier.efficient_may_stand_in(&arrived){outcome.selected_model_ids- .push(config.targets.local.clone());+ .push(config.targets.efficient.clone());outcome.fallback_request = Some(arrived);}Ok(outcome)diff --git a/crates/libsy/src/algorithms/vgr/compaction.rs b/crates/libsy/src/algorithms/vgr/compaction.rsindex 2329da797..de2308aa1 100644--- a/crates/libsy/src/algorithms/vgr/compaction.rs+++ b/crates/libsy/src/algorithms/vgr/compaction.rs@@ -1,7 +1,7 @@// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.// SPDX-License-Identifier: Apache-2.0-//! Condenses local history into a recorded handoff digest.+//! Condenses history from the efficient tier into a recorded handoff digest.//!//! Later requests reuse the digest only when their original history prefix//! matches. User updates and tool content are clipped, so the digest is lossy.@@ -45,7 +45,7 @@ const RECENT_USER_TEXTS: usize = 2;/// requests of this user turn can be rewritten identically.////// Returns `false`, leaving the request untouched, when there is no task-/// message with local work after it.+/// message followed by work from the efficient tier.pub(super) fn compact(request: &mut Request, state: &mut State, note: &str) -> bool {let messages = &request.llm_request.messages;let start = turn_start(request);@@ -339,11 +339,11 @@ mod tests {let mut state: State = serde_json::from_str(&saved).expect("restored routing state");let mut follow_up = session(12);- follow_up.llm_request.messages.push(call("cloud-1", "ls"));+ follow_up.llm_request.messages.push(call("capable-1", "ls"));follow_up.llm_request.messages- .push(result("cloud-1", "a b"));+ .push(result("capable-1", "a b"));reapply(&mut state, &mut follow_up).await;let messages = &follow_up.llm_request.messages;diff --git a/crates/libsy/src/algorithms/vgr/config.rs b/crates/libsy/src/algorithms/vgr/config.rsindex dd1228c85..c390e2102 100644--- a/crates/libsy/src/algorithms/vgr/config.rs+++ b/crates/libsy/src/algorithms/vgr/config.rs@@ -8,18 +8,18 @@ use switchyard_protocol::ModelId;use super::safety::{BreakerConfig, KillSwitch};use crate::{LibsyError, Result};-/// Required attestation for live local commits.+/// Required attestation for serving efficient-tier answers in production.pub const ACTIVE_APPROVAL: &str = "prospective-validation-and-canary-approved";/// Authority granted to VGR decisions.#[derive(Clone, Debug, Default, Eq, PartialEq)]pub enum ServingMode {- /// Always serves cloud without producing an attempt.+ /// Always serves the capable tier without producing an attempt.#[default]Off,/// Serves decisions, for isolated measurement.Evaluate,- /// Decides but always serves cloud.+ /// Decides but always serves the capable tier.Shadow,/// Serves decisions after operator approval.Active {@@ -32,13 +32,13 @@ pub enum ServingMode {#[derive(Clone, Debug)]pub struct Targets {/// Tier that produces the candidate attempt.- pub local: ModelId,+ pub efficient: ModelId,/// Tier used when the candidate is not licensed.- pub cloud: ModelId,- /// Local verifier, defaulting to `local`.+ pub capable: ModelId,+ /// Efficient verifier, defaulting to `efficient`.pub judge: Option<ModelId>,- /// Capable-tier verifier; unset removes the cloud confirmation rungs.- pub cloud_judge: Option<ModelId>,+ /// Capable-tier verifier; unset removes the capable confirmation rungs.+ pub capable_judge: Option<ModelId>,}/// VGR runtime configuration.@@ -52,48 +52,48 @@ pub struct VgrConfig {pub deadline: Duration,/// Optional live stop controlled by the operator.pub kill_switch: Option<KillSwitch>,- /// Local endpoint breaker tuning.+ /// Efficient endpoint breaker tuning.pub breaker: BreakerConfig,/// Whether a cheap typing call selects a verification regime.pub task_typing: bool,- /// Whether the local tier accepts image content.- pub local_supports_images: bool,+ /// Whether the efficient tier accepts image content.+ pub efficient_supports_images: bool,/// Lets a long agentic run with earlier tool errors commit on a capable-tier/// confirmation once it ends in this many consecutive clean tool results.pub confirmed_recovery_min_clean_tail: Option<u32>,/// Tells the capable tier, once per user turn, that it inherits unverified/// tool-using work.pub agentic_handoff: bool,- /// Condenses local history at handoff. Requires `agentic_handoff`.+ /// Condenses history from the efficient tier at handoff. Requires `agentic_handoff`.pub compact_handoff: bool,- /// Wall-clock budget for the local tier within one user turn, including the+ /// Wall-clock budget for the efficient tier within one user turn, including the/// client's tool execution.- pub local_turn_budget: Option<Duration>,+ pub efficient_turn_budget: Option<Duration>,/// Holds an escalated session on the capable tier past later user turns./// Shadow mode retains only the current turn's hold.pub latch_escalation: bool,}impl VgrConfig {- /// Creates an off-by-default route between local and capable tiers.- pub fn new(local: ModelId, cloud: ModelId) -> Self {+ /// Creates an off-by-default route between efficient and capable tiers.+ pub fn new(efficient: ModelId, capable: ModelId) -> Self {Self {targets: Targets {- local,- cloud,+ efficient,+ capable,judge: None,- cloud_judge: None,+ capable_judge: None,},mode: ServingMode::Off,deadline: Duration::from_secs(30),kill_switch: None,breaker: BreakerConfig::default(),task_typing: true,- local_supports_images: false,+ efficient_supports_images: false,confirmed_recovery_min_clean_tail: None,agentic_handoff: false,compact_handoff: false,- local_turn_budget: None,+ efficient_turn_budget: None,latch_escalation: false,}}@@ -104,9 +104,9 @@ impl VgrConfig {message: "compact_handoff requires agentic_handoff".into(),});}- if self.targets.local == self.targets.cloud {+ if self.targets.efficient == self.targets.capable {return Err(LibsyError::AlgorithmError {- message: "vgr requires distinct local and cloud model IDs".into(),+ message: "vgr requires distinct efficient and capable model IDs".into(),});}if self.deadline.is_zero() || self.breaker.threshold == 0 {@@ -127,7 +127,10 @@ impl VgrConfig {}pub(super) fn judge(&self) -> &ModelId {- self.targets.judge.as_ref().unwrap_or(&self.targets.local)+ self.targets+ .judge+ .as_ref()+ .unwrap_or(&self.targets.efficient)}pub(super) fn confirmed_min_clean_tail(&self) -> Option<i32> {@@ -142,7 +145,7 @@ mod tests {#[test]fn compaction_requires_handoff_for_direct_callers() {- let mut config = VgrConfig::new("local".into(), "cloud".into());+ let mut config = VgrConfig::new("efficient".into(), "capable".into());assert!(!config.compact_handoff);config.compact_handoff = true;assert!(super::super::Vgr::new(config.clone()).is_err());@@ -151,8 +154,10 @@ mod tests {}#[test]- fn direct_callers_must_use_distinct_local_and_cloud_ids() {+ fn direct_callers_must_use_distinct_efficient_and_capable_ids() {assert!(super::super::Vgr::new(VgrConfig::new("same".into(), "same".into())).is_err());- assert!(super::super::Vgr::new(VgrConfig::new("local".into(), "cloud".into())).is_ok());+ assert!(+ super::super::Vgr::new(VgrConfig::new("efficient".into(), "capable".into())).is_ok()+ );}}diff --git a/crates/libsy/src/algorithms/vgr/decide.rs b/crates/libsy/src/algorithms/vgr/decide.rsindex 11c05f22d..9f36a1012 100644--- a/crates/libsy/src/algorithms/vgr/decide.rs+++ b/crates/libsy/src/algorithms/vgr/decide.rs@@ -20,8 +20,8 @@ const SHORT_RUN_MAX_TOOL_RESULTS: i32 = 100;#[derive(Clone, Copy, Debug, Eq, PartialEq)]pub(super) enum Route {- Local,- Cloud,+ Efficient,+ Capable,}#[derive(Clone, Copy, Debug, Eq, PartialEq)]@@ -34,13 +34,13 @@ pub(super) enum Tri {/// Evidence gathered for one decision.#[derive(Default)]pub(super) struct Signals {- /// Local logprob score that the attempt is correct.+ /// Efficient logprob score that the attempt is correct.pub(super) readout: Option<f64>,- /// Local logprob score that the attempt is correct, read after a deliberation.+ /// Efficient logprob score that the attempt is correct, read after a deliberation.pub(super) deliberation: Option<f64>,/// Capable-tier evidence verdict.- pub(super) cloud_judge: Option<Tri>,- /// Capable-tier answer verdict after `cloud_judge` affirms.+ pub(super) capable_judge: Option<Tri>,+ /// Capable-tier answer verdict after `capable_judge` affirms.pub(super) evidence_confirm: Option<Tri>,/// Capable-tier verdicts on the answer branch.pub(super) answer_verifier: Option<Tri>,@@ -53,9 +53,9 @@ pub(super) enum AgenticRun {/// Earlier tool errors veto the commit; no rung can change it.Vetoed,Clean,- /// A bounded run that failed and ended clean: local rungs only.+ /// A bounded run that failed and ended clean: efficient rungs only.ShortRecovered,- /// A long run with a clean tail: local rungs, then the capable-tier judge.+ /// A long run with a clean tail: efficient rungs, then the capable-tier judge.ConfirmedRecovery,}@@ -95,13 +95,13 @@ fn affirms(verdict: Option<Tri>) -> bool {verdict == Some(Tri::Yes)}-/// The local rungs affirm: the readout at the branch dial, or deliberation.-pub(super) fn locally_verified(branch: Branch, signals: &Signals) -> bool {+/// The efficient rungs affirm: the readout at the branch dial, or deliberation.+pub(super) fn efficient_verified(branch: Branch, signals: &Signals) -> bool {let bar = dial(branch).map_or(READOUT, |dial| dial.min(READOUT));clears(signals.readout, bar) || clears(signals.deliberation, DELIBERATION)}-/// Commits the local attempt or escalates.+/// Commits the efficient attempt or escalates.////// Coding has no sandboxed checker here, so below a confident readout it commits/// only on the capable tier's affirmation.@@ -116,7 +116,7 @@ pub(super) fn decide(Branch::Unknown => false,Branch::Coding => {(clean && clears(signals.readout, CODING_CONFIDENT))- || (locally_verified(branch, signals) && affirms(signals.cloud_judge))+ || (efficient_verified(branch, signals) && affirms(signals.capable_judge))}Branch::Answer => {affirms(signals.answer_verifier)@@ -127,17 +127,21 @@ pub(super) fn decide(clean&& (clears(signals.deliberation, DELIBERATION)|| clears(signals.readout, 0.3)- || (affirms(signals.cloud_judge) && affirms(signals.evidence_confirm)))+ || (affirms(signals.capable_judge) && affirms(signals.evidence_confirm)))}Branch::Agentic => {- locally_verified(branch, signals)+ efficient_verified(branch, signals)&& match agentic_run(caps, confirmed_min_clean_tail) {AgenticRun::Clean | AgenticRun::ShortRecovered => true,- AgenticRun::ConfirmedRecovery => affirms(signals.cloud_judge),+ AgenticRun::ConfirmedRecovery => affirms(signals.capable_judge),AgenticRun::Vetoed => false,}}- Branch::DefaultVerified => clean && locally_verified(branch, signals),+ Branch::DefaultVerified => clean && efficient_verified(branch, signals),};- if commit { Route::Local } else { Route::Cloud }+ if commit {+ Route::Efficient+ } else {+ Route::Capable+ }}diff --git a/crates/libsy/src/algorithms/vgr/render.rs b/crates/libsy/src/algorithms/vgr/render.rsindex 81c24c10c..1e908cd98 100644--- a/crates/libsy/src/algorithms/vgr/render.rs+++ b/crates/libsy/src/algorithms/vgr/render.rs@@ -11,7 +11,7 @@ use switchyard_protocol::{ContentBlock, Request, Role};use super::text::{Turn, clip_mid, content_text, redact, tool_result_failed};const ASSISTANT_TURN_BUDGET: usize = 1200;-// Agent frameworks send system prompts of many thousand tokens; each local rung would re-read them.+// Agent frameworks send system prompts of many thousand tokens; each efficient rung would re-read them.const SYSTEM_TURN_BUDGET: usize = 1000;pub(super) const ATTEMPT_BUDGET: usize = 2200;const AGENTIC_TRAJECTORY_BUDGET: usize = 12_000;diff --git a/crates/libsy/src/algorithms/vgr/rungs.rs b/crates/libsy/src/algorithms/vgr/rungs.rsindex e6a7aaff6..917cce98e 100644--- a/crates/libsy/src/algorithms/vgr/rungs.rs+++ b/crates/libsy/src/algorithms/vgr/rungs.rs@@ -17,7 +17,7 @@ use super::text::{Turn, char_len, clip_mid, content_text, redact};use crate::algorithms::util::transcript::message_text;pub(super) const DELIBERATION_MAX_OUTPUT_TOKENS: u64 = 512;-const LOCAL_DELIBERATION_MAX_OUTPUT_TOKENS: u64 = 768;+const EFFICIENT_DELIBERATION_MAX_OUTPUT_TOKENS: u64 = 768;const TYPING_MAX_OUTPUT_TOKENS: u64 = 8;const TYPING_TASK_BUDGET: usize = 4000;@@ -101,7 +101,7 @@ pub(super) fn build_request(..OutputParams::default()},sampling: SamplingParams {- // Only these run locally; cloud reasoning modes can reject temperature.+ // Only these use the efficient verifier; cloud reasoning modes can reject temperature.temperature: matches!(question, Question::Typing | Question::Deliberation).then_some(0.0),..SamplingParams::default()@@ -129,7 +129,7 @@ pub(super) fn build_deliberation_request(judged_text: &str, metadata: Option<Metbuild_request(Question::Deliberation,judged_text,- LOCAL_DELIBERATION_MAX_OUTPUT_TOKENS,+ EFFICIENT_DELIBERATION_MAX_OUTPUT_TOKENS,metadata,)}@@ -340,7 +340,7 @@ fn verdict_text(response: &AggLlmResponse) -> Option<String> {assistant_text(output)}-/// The local attempt's text, however generation stopped.+/// The efficient attempt's text, however generation stopped.pub(super) fn response_text(response: &AggLlmResponse) -> Option<String> {assistant_text(response.first_output()?)}diff --git a/crates/libsy/src/algorithms/vgr/runtime.rs b/crates/libsy/src/algorithms/vgr/runtime.rsindex c8e350819..c5cdd6baf 100644--- a/crates/libsy/src/algorithms/vgr/runtime.rs+++ b/crates/libsy/src/algorithms/vgr/runtime.rs@@ -38,8 +38,8 @@ pub(super) const TURN_STREAK_KEY: &str = "vgr_turn_streak";const TURN_STARTED_KEY: &str = "vgr_turn_started";/// Set once the handoff note was sent in the current user turn.const HANDOFF_SENT_KEY: &str = "vgr_handoff_sent";-/// Set once the local tier served a response since the last handoff.-pub(super) const LOCAL_SERVED_KEY: &str = "vgr_local_served";+/// Set once the efficient tier served a response since the last handoff.+pub(super) const EFFICIENT_SERVED_KEY: &str = "vgr_local_served";fn count(state: &State, key: &str) -> Option<u32> {match state.extra.get(key) {@@ -96,7 +96,7 @@ impl Classifier for Held {) -> Result<Scored> {let scored = self.0.score(state, request, driver).await?;if matches!(&scored.0, Classification::Scores(scores) if !scores.is_empty()) {- log(driver, self.1, None, Route::Cloud);+ log(driver, self.1, None, Route::Capable);}Ok(scored)}@@ -111,7 +111,7 @@ impl Classifier for VgrClassifier {driver: &Driver,) -> Result<Scored> {let started = Instant::now();- let local = &self.config.targets.local;+ let efficient = &self.config.targets.efficient;let messages = &request.llm_request.messages;let (new_turn, answered) = match initiated_by_user(request) {Some(by_user) => (by_user, by_user),@@ -138,9 +138,9 @@ impl Classifier for VgrClassifier {} else if flag(state, TURN_LATCHED_KEY) || turn_streak(state) >= TURN_CONFIRMATIONS {Some("turn_verification_latched")} else if turn_budget_spent {- Some("local_turn_budget")- } else if !self.config.local_supports_images && request_has_image(request) {- Some("local_image_unsupported")+ Some("efficient_turn_budget")+ } else if !self.config.efficient_supports_images && request_has_image(request) {+ Some("efficient_image_unsupported")} else if text::newest_prompt_is_blank(request) {Some("empty_prompt")} else {@@ -151,16 +151,16 @@ impl Classifier for VgrClassifier {}let Some(budget) = self.remaining(started) else {- return Ok(self.escalate(driver, "local_timed_out", None, request, state, None));+ return Ok(self.escalate(driver, "efficient_timed_out", None, request, state, None));};let Some(trial) = self.breaker.attempt() else {return Ok(self.escalate(driver, "breaker_open", None, request, state, None));};let attempted = tokio::time::timeout(budget, async {let response = driver- .call_model_with_error_recovery(request.clone(), vec![local.clone()], true)+ .call_model_with_error_recovery(request.clone(), vec![efficient.clone()], true).await?;- buffer_response(local.as_str(), response).await+ buffer_response(efficient.as_str(), response).await}).await;let buffered = match attempted {@@ -175,11 +175,25 @@ impl Classifier for VgrClassifier {if !fallback_eligible(&error) {return Err(error);}- return Ok(self.escalate(driver, "local_unavailable", None, request, state, None));+ return Ok(self.escalate(+ driver,+ "efficient_unavailable",+ None,+ request,+ state,+ None,+ ));}Err(_) => {trial.failure();- return Ok(self.escalate(driver, "local_timed_out", None, request, state, None));+ return Ok(self.escalate(+ driver,+ "efficient_timed_out",+ None,+ request,+ state,+ None,+ ));}};@@ -219,9 +233,9 @@ impl Classifier for VgrClassifier {None,));}- log(driver, "turn_verification_complete", None, Route::Local);- set_flag(state, LOCAL_SERVED_KEY, true);- return Ok((decisive(local), Some(buffered.into_response())));+ log(driver, "turn_verification_complete", None, Route::Efficient);+ set_flag(state, EFFICIENT_SERVED_KEY, true);+ return Ok((decisive(efficient), Some(buffered.into_response())));}let attempt = rungs::response_text(&buffered.agg).unwrap_or_default();@@ -229,7 +243,7 @@ impl Classifier for VgrClassifier {let caps = derive_capabilities(request, &attempt, task_type);let signals = self.gather(&context, &caps).await;let route = decide::decide(&caps, &signals, self.config.confirmed_min_clean_tail());- if route == Route::Cloud || self.config.mode == ServingMode::Shadow {+ if route == Route::Capable || self.config.mode == ServingMode::Shadow {return Ok(self.escalate(driver,"decided",@@ -239,17 +253,17 @@ impl Classifier for VgrClassifier {Some(&attempt),));}- log(driver, "decided", Some(caps.branch), Route::Local);- set_flag(state, LOCAL_SERVED_KEY, true);- Ok((decisive(local), Some(buffered.into_response())))+ log(driver, "decided", Some(caps.branch), Route::Efficient);+ set_flag(state, EFFICIENT_SERVED_KEY, true);+ Ok((decisive(efficient), Some(buffered.into_response())))}}impl VgrClassifier {- /// Whether the local tier may answer `request` when the cloud tier fails it.+ /// Whether the efficient tier may answer `request` when the capable tier fails it.///- /// That answer is unverified, so it is offered only while local attempts are allowed.- pub(super) fn local_may_stand_in(&self, request: &Request) -> bool {+ /// That answer is unverified, so it is offered only while efficient attempts are allowed.+ pub(super) fn efficient_may_stand_in(&self, request: &Request) -> bool {matches!(self.config.mode, ServingMode::Active { .. })&& !self.config@@ -257,7 +271,7 @@ impl VgrClassifier {.as_ref().is_some_and(|switch| switch.is_engaged())&& !self.breaker.is_open()- && (self.config.local_supports_images || !request_has_image(request))+ && (self.config.efficient_supports_images || !request_has_image(request))}fn escalate(@@ -272,17 +286,17 @@ impl VgrClassifier {if reason != "mode_off" {self.hand_off(request, state, unverified_final);}- log(driver, reason, branch, Route::Cloud);- (decisive(&self.config.targets.cloud), None)+ log(driver, reason, branch, Route::Capable);+ (decisive(&self.config.targets.capable), None)}- /// Whether the current user turn has used up its local wall-clock budget.+ /// Whether the current user turn has used up its efficient wall-clock budget.////// The clock starts at the first request of the user turn and includes the/// client's tool execution, since that is the time the client's own limit/// is spending.fn turn_budget_spent(&self, state: &mut State) -> bool {- let Some(budget) = self.config.local_turn_budget else {+ let Some(budget) = self.config.efficient_turn_budget else {return false;};let now = unix_seconds();@@ -297,13 +311,13 @@ impl VgrClassifier {fn hand_off(&self, request: &mut Request, state: &mut State, unverified_final: Option<&str>) {if !self.config.agentic_handoff|| flag(state, HANDOFF_SENT_KEY)- || !flag(state, LOCAL_SERVED_KEY)+ || !flag(state, EFFICIENT_SERVED_KEY)|| !text::turn_has_tool_trajectory(request){return;}set_flag(state, HANDOFF_SENT_KEY, true);- set_flag(state, LOCAL_SERVED_KEY, false);+ set_flag(state, EFFICIENT_SERVED_KEY, false);let note = handoff_note(unverified_final);if !(self.config.compact_handoff && super::compaction::compact(request, state, ¬e)) {append_note(request, ¬e);@@ -327,9 +341,9 @@ impl VgrClassifier {let probability = match self.call(context, call, judge).await {None => return false,Some(Ok(agg)) => readout::p_yes(&agg),- // Verification fails open, unless the local endpoint itself is down.+ // Verification fails open, unless the efficient endpoint itself is down.Some(Err(error)) => {- if *judge == self.config.targets.local && endpoint_failure(&error) {+ if *judge == self.config.targets.efficient && endpoint_failure(&error) {self.breaker.failure();set_flag(state, TURN_LATCHED_KEY, true);return true;@@ -379,9 +393,10 @@ impl VgrClassifier {) else {return signals;};- let settled = |signals: &Signals| decide::decide(caps, signals, confirmed) == Route::Local;- let cloud_confirms = run == Some(AgenticRun::ConfirmedRecovery);- let local = self.config.judge();+ let settled =+ |signals: &Signals| decide::decide(caps, signals, confirmed) == Route::Efficient;+ let capable_confirms = run == Some(AgenticRun::ConfirmedRecovery);+ let efficient = self.config.judge();let ask = |target, question, max_output_tokens| {self.ask(context, target, question, judged, max_output_tokens)};@@ -393,52 +408,55 @@ impl VgrClassifier {};signals.readout = self.readout(context, judged, asked).await;if branch == Branch::Coding {- if let Some(cloud) = self.config.targets.cloud_judge.as_ref()- && decide::locally_verified(branch, &signals)+ if let Some(capable) = self.config.targets.capable_judge.as_ref()+ && decide::efficient_verified(branch, &signals)&& !settled(&signals){let tokens = rungs::DELIBERATION_MAX_OUTPUT_TOKENS;- signals.cloud_judge = Some(ask(cloud, asked, tokens).await);+ signals.capable_judge = Some(ask(capable, asked, tokens).await);}return signals;}if settled(&signals) {return signals;}- if !(cloud_confirms && decide::locally_verified(branch, &signals)) {+ if !(capable_confirms && decide::efficient_verified(branch, &signals)) {let metadata = || context.request.metadata.clone();let call = rungs::build_deliberation_request(judged, metadata());- if let Some(Ok(deliberation)) = self.call(context, call, local).await {+ if let Some(Ok(deliberation)) = self.call(context, call, efficient).await {let call = rungs::build_verdict_request(judged, &deliberation, metadata());- let verdict = self.call(context, call, local).await.and_then(Result::ok);+ let verdict = self+ .call(context, call, efficient)+ .await+ .and_then(Result::ok);signals.deliberation = verdict.and_then(|agg| readout::p_yes(&agg));}if settled(&signals) {return signals;}}- let Some(cloud) = self.config.targets.cloud_judge.as_ref() else {+ let Some(capable) = self.config.targets.capable_judge.as_ref() else {return signals;};- let cloud_ask = |question| ask(cloud, question, rungs::DELIBERATION_MAX_OUTPUT_TOKENS);- if cloud_confirms {- if decide::locally_verified(branch, &signals) {- signals.cloud_judge = Some(cloud_ask(Question::Evidence).await);+ let capable_ask = |question| ask(capable, question, rungs::DELIBERATION_MAX_OUTPUT_TOKENS);+ if capable_confirms {+ if decide::efficient_verified(branch, &signals) {+ signals.capable_judge = Some(capable_ask(Question::Evidence).await);}return signals;}match branch {Branch::Answer => {- signals.answer_verifier = Some(cloud_ask(Question::Answer).await);+ signals.answer_verifier = Some(capable_ask(Question::Answer).await);if !settled(&signals) {- signals.evidence_verifier = Some(cloud_ask(Question::Evidence).await);+ signals.evidence_verifier = Some(capable_ask(Question::Evidence).await);}}Branch::Chat => {- signals.cloud_judge = Some(cloud_ask(Question::Evidence).await);+ signals.capable_judge = Some(capable_ask(Question::Evidence).await);// Asked only once the first affirms, so a refutation costs one call.- if signals.cloud_judge == Some(Tri::Yes) {- signals.evidence_confirm = Some(cloud_ask(Question::Answer).await);+ if signals.capable_judge == Some(Tri::Yes) {+ signals.evidence_confirm = Some(capable_ask(Question::Answer).await);}}_ => {}@@ -556,7 +574,7 @@ fn log(driver: &Driver, reason: &'static str, branch: Option<Branch>, served: Rodriver.set_evidence(serde_json::json!({"source": "vgr","reason_code": reason,- "verdict": if served == Route::Local { "local" } else { "cloud" },+ "verdict": if served == Route::Efficient { "efficient" } else { "capable" },"branch": branch.map(|branch| format!("{branch:?}")),"policy_version": decide::POLICY_VERSION,}));diff --git a/crates/libsy/src/algorithms/vgr/runtime/tests.rs b/crates/libsy/src/algorithms/vgr/runtime/tests.rsindex 2708e65b5..83b63654d 100644--- a/crates/libsy/src/algorithms/vgr/runtime/tests.rs+++ b/crates/libsy/src/algorithms/vgr/runtime/tests.rs@@ -19,9 +19,9 @@ use crate::core::state::{State, StateValue};use crate::core::testing::{category_models, reply, test_drive_with_models};fn route(configure: impl FnOnce(&mut VgrConfig)) -> Result<Arc<dyn Algorithm>> {- let mut config = VgrConfig::new(ModelId::new("local"), ModelId::new("cloud"));+ let mut config = VgrConfig::new(ModelId::new("efficient"), ModelId::new("capable"));config.targets.judge = Some(ModelId::new("judge"));- config.targets.cloud_judge = Some(ModelId::new("cloud-judge"));+ config.targets.capable_judge = Some(ModelId::new("capable-judge"));config.mode = ServingMode::Active {approval: ACTIVE_APPROVAL.into(),};@@ -83,26 +83,26 @@ async fn drive(route: &Arc<dyn Algorithm>,request: Request,calls: Arc<Calls>,- local: fn() -> Response,+ efficient: fn() -> Response,judge_p: f64,) -> Result<String> {let (selected, _) = test_drive_with_models(Arc::clone(route),request,- category_models(Category::Any, &["local", "cloud"]),+ category_models(Category::Any, &["efficient", "capable"]),move |target: ModelId, _| {let calls = Arc::clone(&calls);async move {match target.as_str() {- "local" => calls.0.fetch_add(1, Ordering::Relaxed),- "cloud-judge" => calls.1.fetch_add(1, Ordering::Relaxed),+ "efficient" => calls.0.fetch_add(1, Ordering::Relaxed),+ "capable-judge" => calls.1.fetch_add(1, Ordering::Relaxed),_ => 0,};Ok(match target.as_str() {- "local" => local(),+ "efficient" => efficient(),"judge" => scored(judge_p),- "cloud-judge" => reply("yes"),- _ => reply("cloud answer"),+ "capable-judge" => reply("yes"),+ _ => reply("capable answer"),})}},@@ -123,17 +123,17 @@ async fn malformed_tool_calls_escalate_and_complete_ones_are_judged() -> Result<let task = || session(vec![Message::text(Role::User, "list files")]);assert_eq!(drive(&route, task(), calls.clone(), truncated, 0.0).await?,- "cloud"+ "capable");assert_eq!(drive(&route, task(), calls, complete_call, 0.1).await?,- "local"+ "efficient");Ok(())}#[tokio::test]-async fn a_truncated_local_attempt_is_judged_before_it_escalates() -> Result<()> {+async fn a_truncated_efficient_attempt_is_judged_before_it_escalates() -> Result<()> {let route = route(|config| config.targets.judge = None)?;let calls = Arc::new(Calls::default());let task = session(vec![Message::text(Role::User, "explain quicksort")]);@@ -145,7 +145,7 @@ async fn a_truncated_local_attempt_is_judged_before_it_escalates() -> Result<()>response};let selected = drive(&route, task, calls.clone(), cut_off, 0.0).await?;- assert_eq!(selected, "cloud");+ assert_eq!(selected, "capable");// Attempt, readout, deliberation and its verdict; read as absent, only the attempt runs.assert_eq!(calls.0.load(Ordering::Relaxed), 4);Ok(())@@ -158,18 +158,18 @@ async fn two_consecutive_escalation_votes_latch_the_session() -> Result<()> {let task = || session(vec![Message::text(Role::User, "fix the build")]);assert_eq!(drive(&route, task(), calls.clone(), complete_call, 0.9).await?,- "local"+ "efficient");assert_eq!(drive(&route, task(), calls.clone(), complete_call, 0.9).await?,- "cloud"+ "capable");assert_eq!(calls.0.load(Ordering::Relaxed), 2);- // Latched past the user turn: no further local attempt is produced.+ // Latched past the user turn: no further efficient attempt is produced.assert_eq!(drive(&route, task(), calls.clone(), complete_call, 0.0).await?,- "cloud"+ "capable");assert_eq!(calls.0.load(Ordering::Relaxed), 2);Ok(())@@ -189,11 +189,11 @@ async fn final_answers_commit_only_on_a_verified_clean_record() -> Result<()> {let clean = route(|_| {})?;assert_eq!(drive(&clean, run("ok"), calls.clone(), answer, 0.3).await?,- "local"+ "efficient");assert_eq!(drive(&clean, run("ok"), calls.clone(), answer, 0.1).await?,- "cloud"+ "capable");// A failure longer ago than the clean tail is forgiven only on the capable judge.@@ -205,39 +205,39 @@ async fn final_answers_commit_only_on_a_verified_clean_record() -> Result<()> {}assert_eq!(drive(&clean, session(long.clone()), calls.clone(), answer, 0.99).await?,- "cloud"+ "capable");assert_eq!(calls.1.load(Ordering::Relaxed), 0);let confirmed = route(|config| config.confirmed_recovery_min_clean_tail = Some(1))?;assert_eq!(drive(&confirmed, session(long), calls.clone(), answer, 0.99).await?,- "local"+ "efficient");assert_eq!(calls.1.load(Ordering::Relaxed), 1);Ok(())}#[tokio::test]-async fn an_unavailable_local_tier_escalates_and_other_failures_surface() -> Result<()> {+async fn an_unavailable_efficient_tier_escalates_and_other_failures_surface() -> Result<()> {let route = route(|_| {})?;for (status, escalates) in [(503, true), (400, false)] {let outcome = test_drive_with_models(Arc::clone(&route),session(vec![Message::text(Role::User, "task")]),- category_models(Category::Any, &["local", "cloud"]),+ category_models(Category::Any, &["efficient", "capable"]),move |target: ModelId, _| async move {match target.as_str() {- "local" => Err(LlmClientError::UpstreamHttp {+ "efficient" => Err(LlmClientError::UpstreamHttp {status: http::StatusCode::from_u16(status).unwrap_or_default(),body: String::new(),}),- _ => Ok(reply("cloud answer")),+ _ => Ok(reply("capable answer")),}},).await;assert_eq!(- outcome.is_ok_and(|(selected, _)| selected == "cloud"),+ outcome.is_ok_and(|(selected, _)| selected == "capable"),escalates);}@@ -245,7 +245,7 @@ async fn an_unavailable_local_tier_escalates_and_other_failures_surface() -> Res}fn recovering_classifier() -> super::VgrClassifier {- let mut config = VgrConfig::new(ModelId::new("local"), ModelId::new("cloud"));+ let mut config = VgrConfig::new(ModelId::new("efficient"), ModelId::new("capable"));config.mode = ServingMode::Evaluate;config.breaker.threshold = 1;config.breaker.cooldown = std::time::Duration::ZERO;@@ -263,7 +263,7 @@ async fn verifier_budget_exhaustion_is_not_an_endpoint_failure() -> Result<()> {use crate::core::algorithm::{Driver, RuntimeModels, Step};- let mut config = VgrConfig::new(ModelId::new("local"), ModelId::new("cloud"));+ let mut config = VgrConfig::new(ModelId::new("efficient"), ModelId::new("capable"));config.deadline = Duration::from_millis(100);config.breaker.threshold = 1;config.breaker.cooldown = Duration::from_secs(60);@@ -289,7 +289,7 @@ async fn verifier_budget_exhaustion_is_not_an_endpoint_failure() -> Result<()> {else {unreachable!();};- assert_eq!(pending_call.models, vec![ModelId::new("local")]);+ assert_eq!(pending_call.models, vec![ModelId::new("efficient")]);let escalates = judging.await;drop(pending_call);assert!(!escalates);@@ -344,7 +344,7 @@ async fn skipped_requests_leave_the_recovery_trial_available() -> Result<()> {}#[tokio::test]-async fn cancelling_local_generation_releases_the_recovery_trial() -> Result<()> {+async fn cancelling_efficient_generation_releases_the_recovery_trial() -> Result<()> {use crate::core::algorithm::{Driver, RuntimeModels};use crate::core::classifier::Classifier;@@ -361,24 +361,24 @@ async fn cancelling_local_generation_releases_the_recovery_trial() -> Result<()>}#[tokio::test]-async fn decisions_attach_the_reason_and_exclude_local_cloud_fallbacks() -> Result<()> {+async fn decisions_attach_the_reason_and_exclude_efficient_capable_fallbacks() -> Result<()> {use crate::core::algorithm::Call;use crate::core::testing::serve_decision;for (mode, reason, served) in [- (ServingMode::Off, "mode_off", "cloud"),- (ServingMode::Evaluate, "decided", "local"),- (ServingMode::Shadow, "decided", "cloud"),+ (ServingMode::Off, "mode_off", "capable"),+ (ServingMode::Evaluate, "decided", "efficient"),+ (ServingMode::Shadow, "decided", "capable"),] {let algorithm = route(|config| config.mode = mode)?;let outcome = crate::drive(algorithm,request(vec![Message::text(Role::User, "task")]),- Arc::new(category_models(Category::Any, &["local", "cloud"]).into()),+ Arc::new(category_models(Category::Any, &["efficient", "capable"]).into()),|call| async move {match call {Call::Model(call) => {- let response = if call.models[0] == ModelId::new("local") {+ let response = if call.models[0] == ModelId::new("efficient") {reply("done")} else {scored(0.9)@@ -407,8 +407,8 @@ async fn decisions_attach_the_reason_and_exclude_local_cloud_fallbacks() -> Resu}#[tokio::test]-async fn cloud_only_work_does_not_get_a_local_handoff_notice() -> Result<()> {- for scenario in ["shadow", "kill_switch", "local_turn_budget"] {+async fn capable_only_work_does_not_get_an_efficient_handoff_notice() -> Result<()> {+ for scenario in ["shadow", "kill_switch", "efficient_turn_budget"] {let route = route(|config| {config.agentic_handoff = true;match scenario {@@ -418,7 +418,7 @@ async fn cloud_only_work_does_not_get_a_local_handoff_notice() -> Result<()> {switch.engage();config.kill_switch = Some(switch);}- _ => config.local_turn_budget = Some(std::time::Duration::ZERO),+ _ => config.efficient_turn_budget = Some(std::time::Duration::ZERO),}})?;let task = session(vec![@@ -429,22 +429,22 @@ async fn cloud_only_work_does_not_get_a_local_handoff_notice() -> Result<()> {let (selected, _) = test_drive_with_models(route,task,- category_models(Category::Any, &["local", "cloud"]),+ category_models(Category::Any, &["efficient", "capable"]),move |target: ModelId, request: Request| async move {Ok(match target.as_str() {- "local" => complete_call(),+ "efficient" => complete_call(),"judge" => scored(0.0),_ => {let text = serde_json::to_string(&request.llm_request.messages).unwrap_or_default();assert!(!text.contains("Routing notice"), "{scenario}");- reply("cloud answer")+ reply("capable answer")}})},).await?;- assert_eq!(selected, "cloud");+ assert_eq!(selected, "capable");}Ok(())}@@ -461,7 +461,7 @@ async fn latched_sessions_do_not_repeat_the_handoff_on_later_user_turns() -> Res0.9,).await?,- "local"+ "efficient");let sent = Arc::new(parking_lot::Mutex::new(Vec::new()));for new_user_turn in [false, true] {@@ -477,26 +477,26 @@ async fn latched_sessions_do_not_repeat_the_handoff_on_later_user_turns() -> Reslet (selected, _) = test_drive_with_models(Arc::clone(&route),session(messages),- category_models(Category::Any, &["local", "cloud"]),+ category_models(Category::Any, &["efficient", "capable"]),move |target: ModelId, request: Request| {let sent = Arc::clone(&sent);async move {Ok(match target.as_str() {- "local" => complete_call(),+ "efficient" => complete_call(),"judge" => scored(0.9),_ => {sent.lock().push(serde_json::to_string(&request.llm_request.messages).unwrap_or_default(),);- reply("cloud answer")+ reply("capable answer")}})}},).await?;- assert_eq!(selected, "cloud");+ assert_eq!(selected, "capable");}let sent = sent.lock();assert_eq!(sent.len(), 2);@@ -506,7 +506,7 @@ async fn latched_sessions_do_not_repeat_the_handoff_on_later_user_turns() -> Res}#[tokio::test]-async fn compact_handoff_is_optional_and_replays_before_retained_cloud_routing() -> Result<()> {+async fn compact_handoff_is_optional_and_replays_before_retained_capable_routing() -> Result<()> {let previous = vec![Message::text(Role::User, "inspect the repository"),call("old"),@@ -535,10 +535,10 @@ async fn compact_handoff_is_optional_and_replays_before_retained_cloud_routing()0.0,).await?,- "local"+ "efficient");let sent = Arc::new(parking_lot::Mutex::new(Vec::new()));- let local_calls = Arc::new(AtomicUsize::new(0));+ let efficient_calls = Arc::new(AtomicUsize::new(0));for follow_up in [false, true] {let mut messages = previous.clone();messages.extend([@@ -547,27 +547,27 @@ async fn compact_handoff_is_optional_and_replays_before_retained_cloud_routing()result("c1", "ok"),]);if follow_up {- messages.extend([call("cloud-1"), result("cloud-1", "cloud output")]);+ messages.extend([call("capable-1"), result("capable-1", "capable output")]);}let sent = Arc::clone(&sent);- let local_calls = Arc::clone(&local_calls);+ let efficient_calls = Arc::clone(&efficient_calls);let (selected, _) = test_drive_with_models(Arc::clone(&route),session(messages),- category_models(Category::Any, &["local", "cloud"]),+ category_models(Category::Any, &["efficient", "capable"]),move |target: ModelId, request: Request| {let sent = Arc::clone(&sent);- let local_calls = Arc::clone(&local_calls);+ let efficient_calls = Arc::clone(&efficient_calls);async move {Ok(match target.as_str() {- "local" => {- local_calls.fetch_add(1, Ordering::Relaxed);+ "efficient" => {+ efficient_calls.fetch_add(1, Ordering::Relaxed);reply("the build passes")}"judge" => scored(0.0),- "cloud" => {+ "capable" => {sent.lock().push(request.llm_request.messages);- reply("cloud answer")+ reply("capable answer")}_ => reply("no"),})@@ -575,9 +575,9 @@ async fn compact_handoff_is_optional_and_replays_before_retained_cloud_routing()},).await?;- assert_eq!(selected, "cloud");+ assert_eq!(selected, "capable");}- assert_eq!(local_calls.load(Ordering::Relaxed), 1);+ assert_eq!(efficient_calls.load(Ordering::Relaxed), 1);let sent = sent.lock();assert_eq!(sent.len(), 2);if compact_handoff == Some(true) {@@ -590,8 +590,8 @@ async fn compact_handoff_is_optional_and_replays_before_retained_cloud_routing()assert!(digest.contains("<condensed_history>"));assert!(digest.contains("the build passes"));assert!(digest.contains("Routing notice"));- assert_eq!(sent[1][5], call("cloud-1"));- assert_eq!(sent[1][6], result("cloud-1", "cloud output"));+ assert_eq!(sent[1][5], call("capable-1"));+ assert_eq!(sent[1][6], result("capable-1", "capable output"));} else {let mut original = previous.clone();original.extend([@@ -608,7 +608,7 @@ async fn compact_handoff_is_optional_and_replays_before_retained_cloud_routing().contains("Routing notice"));let mut follow_up = original;- follow_up.extend([call("cloud-1"), result("cloud-1", "cloud output")]);+ follow_up.extend([call("capable-1"), result("capable-1", "capable output")]);assert_eq!(sent[1], follow_up);}}@@ -627,7 +627,7 @@ async fn an_escalated_agentic_run_hands_off_once_with_the_unverified_claim() ->0.0,).await?,- "local"+ "efficient");let sent = Arc::new(parking_lot::Mutex::new(Vec::new()));let task = || {@@ -642,18 +642,18 @@ async fn an_escalated_agentic_run_hands_off_once_with_the_unverified_claim() ->test_drive_with_models(Arc::clone(&route),task(),- category_models(Category::Any, &["local", "cloud"]),+ category_models(Category::Any, &["efficient", "capable"]),move |target: ModelId, request: Request| {let sent = Arc::clone(&sent);async move {Ok(match target.as_str() {- "local" => reply("the build passes"),+ "efficient" => reply("the build passes"),"judge" => scored(0.0),- "cloud" => {+ "capable" => {let text = serde_json::to_string(&request.llm_request.messages).unwrap_or_default();sent.lock().push(text);- reply("cloud answer")+ reply("capable answer")}_ => reply("no"),})@@ -673,13 +673,13 @@ async fn an_escalated_agentic_run_hands_off_once_with_the_unverified_claim() ->}#[tokio::test]-async fn a_spent_local_turn_budget_skips_the_local_attempt() -> Result<()> {- let route = route(|config| config.local_turn_budget = Some(std::time::Duration::ZERO))?;+async fn a_spent_efficient_turn_budget_skips_the_efficient_attempt() -> Result<()> {+ let route = route(|config| config.efficient_turn_budget = Some(std::time::Duration::ZERO))?;let calls = Arc::new(Calls::default());let task = session(vec![Message::text(Role::User, "fix the build")]);assert_eq!(drive(&route, task, calls.clone(), complete_call, 0.0).await?,- "cloud"+ "capable");assert_eq!(calls.0.load(Ordering::Relaxed), 0);Ok(())@@ -710,7 +710,7 @@ fn handoff_preserves_existing_messages_and_non_text_content() {}let original = task.llm_request.messages.clone();let mut state = State::default();- super::set_flag(&mut state, super::LOCAL_SERVED_KEY, true);+ super::set_flag(&mut state, super::EFFICIENT_SERVED_KEY, true);classifier.hand_off(&mut task, &mut state, Some("unchecked result"));// A notice may be appended, but all original content stays unchanged.let messages = &task.llm_request.messages;@@ -738,7 +738,7 @@ fn handoff_preserves_existing_messages_and_non_text_content() {}#[tokio::test]-async fn a_blank_prompt_escalates_without_a_local_attempt() -> Result<()> {+async fn a_blank_prompt_escalates_without_an_efficient_attempt() -> Result<()> {let continuing = route(|_| {})?;let route = route(|_| {})?;let calls = Arc::new(Calls::default());@@ -754,7 +754,7 @@ async fn a_blank_prompt_escalates_without_a_local_attempt() -> Result<()> {] {assert_eq!(drive(&route, session(messages), calls.clone(), complete_call, 0.0).await?,- "cloud"+ "capable");}assert_eq!(calls.0.load(Ordering::Relaxed), 0);@@ -773,7 +773,7 @@ async fn a_blank_prompt_escalates_without_a_local_attempt() -> Result<()> {}#[tokio::test]-async fn an_agent_marked_nudge_keeps_a_single_escalation_on_cloud() -> Result<()> {+async fn an_agent_marked_nudge_keeps_a_single_escalation_on_capable() -> Result<()> {let route = route(|_| {})?;let calls = Arc::new(Calls::default());let truncated = || tool_call(json!(r#"{"command":"l"#), StopReason::MaxTokens);@@ -787,7 +787,7 @@ async fn an_agent_marked_nudge_keeps_a_single_escalation_on_cloud() -> Result<()let nudge = initiated_by(session(nudge), "agent");assert_eq!(drive(&route, nudge, calls.clone(), complete_call, 0.0).await?,- "cloud"+ "capable");assert_eq!(calls.0.load(Ordering::Relaxed), 1);Ok(())@@ -808,7 +808,7 @@ async fn a_held_follow_up_records_the_latch_as_its_reason() -> Result<()> {use crate::core::testing::serve_decision;let algorithm = route(|config| config.mode = ServingMode::Shadow)?;- let models = Arc::new(category_models(Category::Any, &["local", "cloud"]).into());+ let models = Arc::new(category_models(Category::Any, &["efficient", "capable"]).into());let serve = |call| async move {match call {Call::Model(call) => call.respond(std::future::ready(Ok(reply("done")))).await,@@ -822,7 +822,7 @@ async fn a_held_follow_up_records_the_latch_as_its_reason() -> Result<()> {serve,).await?;- assert_eq!(escalated.selected_model_ids, vec![ModelId::new("cloud")]);+ assert_eq!(escalated.selected_model_ids, vec![ModelId::new("capable")]);let held = crate::drive(algorithm,@@ -835,14 +835,14 @@ async fn a_held_follow_up_records_the_latch_as_its_reason() -> Result<()> {serve,).await?;- assert_eq!(held.selected_model_ids, vec![ModelId::new("cloud")]);+ assert_eq!(held.selected_model_ids, vec![ModelId::new("capable")]);let evidence = held.metadata.and_then(|metadata| metadata.evidence).unwrap_or_default();assert_eq!(evidence["source"], "vgr");assert_eq!(evidence["reason_code"], "turn_verification_latched");- assert_eq!(evidence["verdict"], "cloud");+ assert_eq!(evidence["verdict"], "capable");Ok(())}@@ -863,7 +863,7 @@ async fn shadow_rechecks_new_user_turns_with_session_latching_enabled() -> Resul] {assert_eq!(drive(&route, session(messages), calls.clone(), complete_call, 0.0).await?,- "cloud"+ "capable");}assert_eq!(calls.0.load(Ordering::Relaxed), 2);@@ -878,7 +878,7 @@ async fn an_escalation_latch_holds_the_session_past_new_questions() -> Result<()let task = session(vec![Message::text(Role::User, "fix the build")]);assert_eq!(drive(&route, task, calls.clone(), truncated, 0.0).await?,- "cloud"+ "capable");let follow_up = session(vec![Message::text(Role::User, "fix the build"),@@ -887,7 +887,7 @@ async fn an_escalation_latch_holds_the_session_past_new_questions() -> Result<()]);assert_eq!(drive(&route, follow_up, calls.clone(), complete_call, 0.0).await?,- "cloud"+ "capable");assert_eq!(calls.0.load(Ordering::Relaxed), 1);Ok(())@@ -917,7 +917,7 @@ async fn an_initiator_header_decides_when_the_turn_latch_releases() -> Result<()0.0).await?,- "cloud"+ "capable");assert_eq!(calls.0.load(Ordering::Relaxed), 2);@@ -937,7 +937,7 @@ async fn an_initiator_header_decides_when_the_turn_latch_releases() -> Result<()0.0).await?,- "local"+ "efficient");assert_eq!(calls.0.load(Ordering::Relaxed), 3);Ok(())@@ -955,11 +955,11 @@ async fn tool_work_from_an_earlier_user_turn_is_not_handed_off() -> Result<()> {Message::text(Role::Assistant, "the build passes"),Message::text(Role::User, "What is 41 plus 42?"),]),- category_models(Category::Any, &["local", "cloud"]),+ category_models(Category::Any, &["efficient", "capable"]),|target: ModelId, request: Request| async move {Ok(match target.as_str() {- "local" => reply("83"),- "cloud" => {+ "efficient" => reply("83"),+ "capable" => {let text =serde_json::to_string(&request.llm_request.messages).unwrap_or_default();assert!(text.contains("41 plus 42"));@@ -971,12 +971,12 @@ async fn tool_work_from_an_earlier_user_turn_is_not_handed_off() -> Result<()> {},).await?;- assert_eq!(selected, "cloud");+ assert_eq!(selected, "capable");Ok(())}#[tokio::test]-async fn a_cloud_decision_falls_back_to_local_without_the_handoff_note() -> Result<()> {+async fn a_capable_decision_falls_back_to_efficient_without_the_handoff_note() -> Result<()> {use crate::core::algorithm::Call;use crate::core::testing::serve_decision;@@ -1011,12 +1011,12 @@ async fn a_cloud_decision_falls_back_to_local_without_the_handoff_note() -> Resulet outcome = crate::drive(algorithm,task(),- Arc::new(category_models(Category::Any, &["local", "cloud"]).into()),+ Arc::new(category_models(Category::Any, &["efficient", "capable"]).into()),|call| async move {match call {Call::Model(call) => {let response = match call.models[0].as_str() {- "local" => reply("the build passes"),+ "efficient" => reply("the build passes"),"judge" => scored(0.0),_ => reply("no"),};@@ -1029,14 +1029,16 @@ async fn a_cloud_decision_falls_back_to_local_without_the_handoff_note() -> Resu.await?;assert!(noted(&outcome.request));if killed {- assert_eq!(outcome.selected_model_ids, vec![ModelId::new("cloud")]);+ assert_eq!(outcome.selected_model_ids, vec![ModelId::new("capable")]);assert!(outcome.fallback_request.is_none());} else {assert_eq!(outcome.selected_model_ids,- vec![ModelId::new("cloud"), ModelId::new("local")]+ vec![ModelId::new("capable"), ModelId::new("efficient")]);- let fallback = outcome.fallback_request.expect("a local fallback request");+ let fallback = outcome+ .fallback_request+ .expect("an efficient fallback request");assert_eq!(fallback.llm_request.messages, task().llm_request.messages);}}diff --git a/crates/libsy/src/algorithms/vgr/safety.rs b/crates/libsy/src/algorithms/vgr/safety.rsindex 91a67d550..6c6bc72ad 100644--- a/crates/libsy/src/algorithms/vgr/safety.rs+++ b/crates/libsy/src/algorithms/vgr/safety.rs@@ -11,7 +11,7 @@ use switchyard_protocol::LlmClientError;use crate::LibsyError;-/// Operator-controlled stop for local attempts.+/// Operator-controlled stop for efficient attempts.#[derive(Clone, Debug, Default)]pub struct KillSwitch(Arc<AtomicBool>);@@ -21,17 +21,17 @@ impl KillSwitch {Self::default()}- /// Stops local attempts for subsequent requests.+ /// Stops efficient attempts for subsequent requests.pub fn engage(&self) {self.0.store(true, Ordering::Relaxed);}- /// Allows local attempts again.+ /// Allows efficient attempts again.pub fn release(&self) {self.0.store(false, Ordering::Relaxed);}- /// Reports whether local attempts are stopped.+ /// Reports whether efficient attempts are stopped.pub fn is_engaged(&self) -> bool {self.0.load(Ordering::Relaxed)}@@ -112,7 +112,7 @@ impl CircuitBreaker {}}-/// Releases a recovery trial if its local call is cancelled or abandoned.+/// Releases a recovery trial if its efficient call is cancelled or abandoned.pub(super) struct Attempt<'a> {breaker: &'a CircuitBreaker,recovery: bool,diff --git a/crates/libsy/src/algorithms/vgr/tests.rs b/crates/libsy/src/algorithms/vgr/tests.rsindex e42f90a90..f2fe35956 100644--- a/crates/libsy/src/algorithms/vgr/tests.rs+++ b/crates/libsy/src/algorithms/vgr/tests.rs@@ -110,7 +110,7 @@ fn router_typing_selects_the_verification_regime() {}#[test]-// Missing text and unsupported content cannot license a local answer.+// Missing text and unsupported content cannot license an efficient answer.fn missing_or_unrepresentable_evidence_fails_closed() {let task = request(vec![Message::text(Role::User, "task")]);assert_eq!(branch(&task, " ", None), Branch::Unknown);@@ -321,25 +321,28 @@ mod decide {#[test]fn agentic_runs_commit_only_on_a_clean_or_recovered_record() {- assert_eq!(decide(&agentic(0, 3, 3), &readout(0.2), None), Route::Local);+ assert_eq!(+ decide(&agentic(0, 3, 3), &readout(0.2), None),+ Route::Efficient+ );assert_eq!(decide(&agentic(0, 3, 3), &readout(0.19), None),- Route::Cloud+ Route::Capable);let short = agentic(2, 100, 1);assert_eq!(agentic_run(&short, None), AgenticRun::ShortRecovered);- assert_eq!(decide(&short, &readout(0.9), None), Route::Local);+ assert_eq!(decide(&short, &readout(0.9), None), Route::Efficient);let unrecovered = agentic(2, 100, 0);- assert_eq!(decide(&unrecovered, &readout(1.0), Some(1)), Route::Cloud);+ assert_eq!(decide(&unrecovered, &readout(1.0), Some(1)), Route::Capable);let long = agentic(2, 101, 1);assert_eq!(agentic_run(&long, None), AgenticRun::Vetoed);assert_eq!(agentic_run(&long, Some(1)), AgenticRun::ConfirmedRecovery);let mut confirmed = readout(0.9);- assert_eq!(decide(&long, &confirmed, Some(1)), Route::Cloud);- confirmed.cloud_judge = Some(Tri::Yes);- assert_eq!(decide(&long, &confirmed, Some(1)), Route::Local);+ assert_eq!(decide(&long, &confirmed, Some(1)), Route::Capable);+ confirmed.capable_judge = Some(Tri::Yes);+ assert_eq!(decide(&long, &confirmed, Some(1)), Route::Efficient);}#[test]@@ -347,22 +350,22 @@ mod decide {let mut chat = agentic(0, 0, 0);chat.branch = Branch::Chat;let mut signals = Signals {- cloud_judge: Some(Tri::Yes),+ capable_judge: Some(Tri::Yes),..Signals::default()};- assert_eq!(decide(&chat, &signals, None), Route::Cloud);+ assert_eq!(decide(&chat, &signals, None), Route::Capable);signals.evidence_confirm = Some(Tri::Unknown);- assert_eq!(decide(&chat, &signals, None), Route::Cloud);+ assert_eq!(decide(&chat, &signals, None), Route::Capable);signals.evidence_confirm = Some(Tri::Yes);- assert_eq!(decide(&chat, &signals, None), Route::Local);+ assert_eq!(decide(&chat, &signals, None), Route::Efficient);chat.tools = Some(ToolRecord {errors: 1,..ToolRecord::default()});- assert_eq!(decide(&chat, &signals, None), Route::Cloud);+ assert_eq!(decide(&chat, &signals, None), Route::Capable);chat.branch = Branch::Coding;- assert_eq!(decide(&chat, &readout(1.0), None), Route::Cloud);+ assert_eq!(decide(&chat, &readout(1.0), None), Route::Capable);}#[test]@@ -371,9 +374,9 @@ mod decide {let mut caps = agentic(0, 1, 1);caps.branch = branch;for (verdict, expected) in [- (Some(0.5), Route::Local),- (Some(0.49), Route::Cloud),- (None, Route::Cloud),+ (Some(0.5), Route::Efficient),+ (Some(0.49), Route::Capable),+ (None, Route::Capable),] {let signals = Signals {deliberation: verdict,@@ -393,14 +396,14 @@ mod decide {let mut coding = agentic(0, 0, 0);coding.branch = Branch::Coding;let mut signals = readout(0.2);- assert_eq!(decide(&coding, &signals, None), Route::Cloud);- signals.cloud_judge = Some(Tri::Unknown);- assert_eq!(decide(&coding, &signals, None), Route::Cloud);- signals.cloud_judge = Some(Tri::Yes);- assert_eq!(decide(&coding, &signals, None), Route::Local);+ assert_eq!(decide(&coding, &signals, None), Route::Capable);+ signals.capable_judge = Some(Tri::Unknown);+ assert_eq!(decide(&coding, &signals, None), Route::Capable);+ signals.capable_judge = Some(Tri::Yes);+ assert_eq!(decide(&coding, &signals, None), Route::Efficient);signals.readout = Some(0.19);- assert_eq!(decide(&coding, &signals, None), Route::Cloud);- assert_eq!(decide(&coding, &readout(0.6), None), Route::Local);- assert_eq!(decide(&coding, &readout(0.59), None), Route::Cloud);+ assert_eq!(decide(&coding, &signals, None), Route::Capable);+ assert_eq!(decide(&coding, &readout(0.6), None), Route::Efficient);+ assert_eq!(decide(&coding, &readout(0.59), None), Route::Capable);}}diff --git a/crates/libsy/src/algorithms/vgr/text.rs b/crates/libsy/src/algorithms/vgr/text.rsindex 16dfb8cfc..1638fff0e 100644--- a/crates/libsy/src/algorithms/vgr/text.rs+++ b/crates/libsy/src/algorithms/vgr/text.rs@@ -216,14 +216,14 @@ pub(super) fn clip_mid(text: &str, budget: usize, head_frac: f64) -> String {format!("{head_text}\n...[{omitted} chars omitted]...\n{tail_text}")}-/// Detects heuristic code/test markers in the local attempt.+/// Detects heuristic code/test markers in the efficient attempt.pub(super) fn observed_hardening(attempt: &str) -> bool {CODE_ACTIVITY.as_ref().is_some_and(|pattern| pattern.is_match(attempt))}-/// Detects tool transcript labels and JSON tool-call fields in the local attempt.+/// Detects tool transcript labels and JSON tool-call fields in the efficient attempt.pub(super) fn observed_tool_activity(attempt: &str) -> bool {TOOL_ACTIVITY.as_ref()diff --git a/crates/switchyard-runner/src/algorithm.rs b/crates/switchyard-runner/src/algorithm.rsindex a607081aa..378f1d11a 100644--- a/crates/switchyard-runner/src/algorithm.rs+++ b/crates/switchyard-runner/src/algorithm.rs@@ -524,13 +524,13 @@ pub enum AlgorithmSpec {#[derive(Clone, Debug, Deserialize)]#[serde(deny_unknown_fields)]pub struct VgrRouteConfig {- pub local_target: String,- pub cloud_target: String,- /// Defaults to `local_target`.+ pub efficient_target: String,+ pub capable_target: String,+ /// Defaults to `efficient_target`.#[serde(default)]pub judge_target: Option<String>,#[serde(default)]- pub cloud_judge_target: Option<String>,+ pub capable_judge_target: Option<String>,#[serde(default)]pub mode: VgrModeConfig,#[serde(default)]@@ -543,18 +543,18 @@ pub struct VgrRouteConfig {pub breaker_threshold: u32,#[serde(default = "default_vgr_breaker_cooldown")]pub breaker_cooldown_seconds: f64,- /// Clean trailing tool results that let a long run recover on the cloud judge.+ /// Clean trailing tool results that let a long run recover on the capable judge.#[serde(default)]pub confirmed_recovery_min_clean_tail: Option<u32>,/// Tells the capable tier it inherits unverified tool-using work.#[serde(default)]pub agentic_handoff: bool,- /// Condenses local history at handoff. Requires `agentic_handoff`.+ /// Condenses history from the efficient tier at handoff. Requires `agentic_handoff`.#[serde(default)]pub compact_handoff: bool,- /// Wall-clock budget for the local tier within one user turn.+ /// Wall-clock budget for the efficient tier within one user turn.#[serde(default)]- pub local_turn_budget_seconds: Option<f64>,+ pub efficient_turn_budget_seconds: Option<f64>,/// Holds escalations across later user turns.#[serde(default)]pub latch_escalation: bool,@@ -838,7 +838,10 @@ impl AlgorithmSpec {executor_target, ..} => vec![executor_target],Self::Vgr { config } => {- vec![config.local_target.as_str(), config.cloud_target.as_str()]+ vec![+ config.efficient_target.as_str(),+ config.capable_target.as_str(),+ ]}Self::PrefillRouter { targets, .. } => targets.iter().map(String::as_str).collect(),}@@ -878,7 +881,7 @@ impl AlgorithmSpec {Self::Advisor { advisor_target, .. } => names.push(advisor_target),Self::Vgr { config } => {names.extend(config.judge_target.as_deref());- names.extend(config.cloud_judge_target.as_deref());+ names.extend(config.capable_judge_target.as_deref());}_ => {}}@@ -974,17 +977,23 @@ impl AlgorithmSpec {(Category::Judge, vec![advisor_target.clone()]),]),Self::Vgr { config } => {- let judge = config.judge_target.as_ref().unwrap_or(&config.local_target);+ let judge = config+ .judge_target+ .as_ref()+ .unwrap_or(&config.efficient_target);let judges = std::iter::once(judge)- .chain(&config.cloud_judge_target)+ .chain(&config.capable_judge_target).cloned().collect();category_models([- (Category::Efficient, vec![config.local_target.clone()]),- (Category::Capable, vec![config.cloud_target.clone()]),+ (Category::Efficient, vec![config.efficient_target.clone()]),+ (Category::Capable, vec![config.capable_target.clone()]),(Category::Any,- vec![config.local_target.clone(), config.cloud_target.clone()],+ vec![+ config.efficient_target.clone(),+ config.capable_target.clone(),+ ],),(Category::Judge, judges),])@@ -1023,11 +1032,11 @@ impl AlgorithmSpec {..} => Some((executor_target, advisor_target)),Self::Vgr { config } => Some((- &config.local_target,+ &config.efficient_target,config.judge_target.as_deref()- .unwrap_or(&config.local_target),+ .unwrap_or(&config.efficient_target),)),Self::Noop { .. }| Self::Random { .. }@@ -1796,16 +1805,16 @@ fn build_vgr(config: &VgrRouteConfig,targets: &BTreeMap<String, ModelId>,) -> AlgorithmResult<Arc<dyn Algorithm>> {- let local = resolve_target_model_id(route_name, &config.local_target, targets)?;- let cloud = resolve_target_model_id(route_name, &config.cloud_target, targets)?;+ let efficient = resolve_target_model_id(route_name, &config.efficient_target, targets)?;+ let capable = resolve_target_model_id(route_name, &config.capable_target, targets)?;let optional = |name: &Option<String>| {name.as_deref().map(|name| resolve_target_model_id(route_name, name, targets)).transpose()};- let mut runtime = VgrConfig::new(local, cloud);+ let mut runtime = VgrConfig::new(efficient, capable);runtime.targets.judge = optional(&config.judge_target)?;- runtime.targets.cloud_judge = optional(&config.cloud_judge_target)?;+ runtime.targets.capable_judge = optional(&config.capable_judge_target)?;runtime.mode = match config.mode {VgrModeConfig::Off => libsy::ServingMode::Off,VgrModeConfig::Evaluate => libsy::ServingMode::Evaluate,@@ -1820,9 +1829,9 @@ fn build_vgr(runtime.agentic_handoff = config.agentic_handoff;runtime.compact_handoff = config.compact_handoff;runtime.latch_escalation = config.latch_escalation;- runtime.local_turn_budget = config- .local_turn_budget_seconds- .map(|seconds| vgr_duration(route_name, "local_turn_budget_seconds", seconds))+ runtime.efficient_turn_budget = config+ .efficient_turn_budget_seconds+ .map(|seconds| vgr_duration(route_name, "efficient_turn_budget_seconds", seconds)).transpose()?;runtime.breaker = BreakerConfig {threshold: config.breaker_threshold,diff --git a/crates/switchyard-runner/src/config.rs b/crates/switchyard-runner/src/config.rsindex 5d7b2c8fc..bbaad96c9 100644--- a/crates/switchyard-runner/src/config.rs+++ b/crates/switchyard-runner/src/config.rs@@ -303,7 +303,8 @@ impl DeploymentConfig {.build_with_runtime_models(route_name, &targets).map_err(|error| RunnerError::configuration_source(error.to_string(), error))?;if let AlgorithmSpec::Vgr { config: vgr } = &config.algorithm- && let Some(probe) = self.build_model_properties_probe(&vgr.local_target, &clients)+ && let Some(probe) =+ self.build_model_properties_probe(&vgr.efficient_target, &clients){model_properties_probes.insert(config.id.clone(), probe);}@@ -632,20 +633,20 @@ impl DeploymentConfig {fn build_model_properties_probe(&self,- local_target_name: &str,+ efficient_target_name: &str,clients: &BTreeMap<String, Arc<TranslatingLlmClient>>,) -> Option<ModelPropertiesProbe> {- let local_target = self.targets.get(local_target_name)?;- let client_config = self.llm_clients.get(&local_target.llm_client)?;+ let efficient_target = self.targets.get(efficient_target_name)?;+ let client_config = self.llm_clients.get(&efficient_target.llm_client)?;if !matches!(client_config.context_discovery,Some(ContextDiscovery::LlamaCpp)) {return None;}- let client = clients.get(&local_target.llm_client)?;+ let client = clients.get(&efficient_target.llm_client)?;Some(ModelPropertiesProbe {- model: local_target.id.clone(),+ model: efficient_target.id.clone(),format: client_config.format.wire_format(),client: Arc::clone(client),})@@ -744,7 +745,7 @@ impl<'de> Deserialize<'de> for HttpBaseUrl {struct LlmClientConfig {format: ClientFormat,base_url: HttpBaseUrl,- /// Opt-in context discovery for VGR's local target. Unset disables discovery.+ /// Opt-in context discovery for VGR's efficient target. Unset disables discovery.context_discovery: Option<ContextDiscovery>,api_key_env: Option<String>,#[serde(default)]@@ -1155,8 +1156,8 @@ target = "strong"[routes.vgr]id = "switchyard/vgr"type = "vgr"-local_target = "weak"-cloud_target = "strong"+efficient_target = "weak"+capable_target = "strong"judge_target = "classifier"mode = "active"active_approval = "prospective-validation-and-canary-approved"@@ -1193,16 +1194,20 @@ task_typing = false.is_some());- let identical_ids =- vgr_config().replace("local_target = \"weak\"", "local_target = \"strong\"");- assert!(error_message(&identical_ids).contains("distinct local and cloud model IDs"));+ let identical_ids = vgr_config().replace(+ "efficient_target = \"weak\"",+ "efficient_target = \"strong\"",+ );+ assert!(error_message(&identical_ids).contains("distinct efficient and capable model IDs"));let bad_approval =vgr_config().replace("prospective-validation-and-canary-approved", "approved");assert!(error_message(&bad_approval).contains("approval attestation"));- let missing_target =- vgr_config().replace("local_target = \"weak\"", "local_target = \"missing\"");+ let missing_target = vgr_config().replace(+ "efficient_target = \"weak\"",+ "efficient_target = \"missing\"",+ );assert!(error_message(&missing_target).contains("unknown target missing"));let zero_cooldown = format!("{}breaker_cooldown_seconds = 0\n", vgr_config());diff --git a/crates/switchyard-server/tests/server.rs b/crates/switchyard-server/tests/server.rsindex 445fde093..d8859296e 100644--- a/crates/switchyard-server/tests/server.rs+++ b/crates/switchyard-server/tests/server.rs@@ -1728,8 +1728,8 @@ async fn models_probes_routes_concurrently_and_caches_failed_discovery() -> Test[routes.vgr{index}]id = "switchyard/vgr{index}"type = "vgr"-local_target = "local"-cloud_target = "cloud"+efficient_target = "efficient"+capable_target = "capable""#)})@@ -1737,16 +1737,16 @@ cloud_target = "cloud"let app = build_switchyard_router(load_test_config(&format!(r#"schema_version = 1-[llm_clients.local]+[llm_clients.efficient]format = "openai_chat"base_url = "{}"context_discovery = "llama_cpp"-[targets.local]-id = "local"-llm_client = "local"-[targets.cloud]-id = "cloud"-llm_client = "local"+[targets.efficient]+id = "efficient"+llm_client = "efficient"+[targets.capable]+id = "capable"+llm_client = "efficient"{routes}"#,upstream.base_url@@ -1776,7 +1776,8 @@ llm_client = "local"}#[tokio::test]-async fn vgr_serves_verified_attempts_locally_and_escalates_rejected_ones() -> TestResult {+async fn vgr_serves_verified_attempts_on_efficient_tier_and_escalates_rejected_ones() -> TestResult+{let upstream = MockUpstream::start().await?;for (discovery, configured, expected_context, probes) in [("", "context_window = 32768", Some(32_768), false),@@ -1790,8 +1791,8 @@ async fn vgr_serves_verified_attempts_locally_and_escalates_rejected_ones() -> T),] {for (judge, served) in [- ("model/vgr-judge", "model/vgr-local"),- ("model/vgr-reject", "model/vgr-cloud"),+ ("model/vgr-judge", "model/vgr-efficient"),+ ("model/vgr-reject", "model/vgr-capable"),] {upstream.calls.lock().await.clear();let app = build_switchyard_router(load_test_config(&format!(@@ -1803,12 +1804,12 @@ format = "openai_chat"base_url = "{}"{discovery}-[targets.local]-id = "model/vgr-local"+[targets.efficient]+id = "model/vgr-efficient"llm_client = "primary"-[targets.cloud]-id = "model/vgr-cloud"+[targets.capable]+id = "model/vgr-capable"llm_client = "primary"[targets.judge]@@ -1819,8 +1820,8 @@ llm_client = "primary"id = "switchyard/vgr"type = "vgr"{configured}-local_target = "local"-cloud_target = "cloud"+efficient_target = "efficient"+capable_target = "capable"judge_target = "judge"mode = "active"active_approval = "prospective-validation-and-canary-approved"@@ -1862,7 +1863,7 @@ task_typing = false}#[tokio::test]-async fn vgr_escalates_while_the_local_endpoint_is_down() -> TestResult {+async fn vgr_escalates_while_the_efficient_endpoint_is_down() -> TestResult {let upstream = MockUpstream::start().await?;let closed = std::net::TcpListener::bind("127.0.0.1:0")?.local_addr()?;let app = build_switchyard_router(load_test_config(&format!(@@ -1877,19 +1878,19 @@ base_url = "{}"format = "openai_chat"base_url = "http://{closed}/v1"-[targets.local]-id = "model/vgr-local"+[targets.efficient]+id = "model/vgr-efficient"llm_client = "down"-[targets.cloud]-id = "model/vgr-cloud"+[targets.capable]+id = "model/vgr-capable"llm_client = "primary"[routes.vgr]id = "switchyard/vgr"type = "vgr"-local_target = "local"-cloud_target = "cloud"+efficient_target = "efficient"+capable_target = "capable"mode = "active"active_approval = "prospective-validation-and-canary-approved"task_typing = false@@ -1911,7 +1912,7 @@ task_typing = falseassert_eq!(response.status, StatusCode::OK, "{}", response.text()?);assert_eq!(response.headers.get("x-model-router-selected-model"),- Some(&HeaderValue::from_static("model/vgr-cloud"))+ Some(&HeaderValue::from_static("model/vgr-capable")));}Ok(())@@ -1928,14 +1929,14 @@ schema_version = 1format = "openai_chat"base_url = "{}"[targets]-local = {{ id = "model/vgr-local", llm_client = "primary" }}-cloud = {{ id = "model/vgr-cloud", llm_client = "primary" }}+efficient = {{ id = "model/vgr-efficient", llm_client = "primary" }}+capable = {{ id = "model/vgr-capable", llm_client = "primary" }}judge = {{ id = "model/vgr-judge", llm_client = "primary" }}[routes.vgr]id = "switchyard/vgr"type = "vgr"-local_target = "local"-cloud_target = "cloud"+efficient_target = "efficient"+capable_target = "capable"judge_target = "judge"mode = "evaluate"task_typing = false@@ -1949,13 +1950,13 @@ task_typing = false{"role": "user", "content": "Verify the answer before stopping."}]);for (session, initiator, messages, served) in [- ("a", Some("user"), &initial, "model/vgr-cloud"),- ("a", Some("agent"), &nudge, "model/vgr-cloud"),- ("b", Some("agent"), &nudge, "model/vgr-local"),- ("a", Some("user"), &nudge, "model/vgr-local"),- ("a", Some("agent"), &nudge, "model/vgr-local"),- ("c", None, &initial, "model/vgr-cloud"),- ("c", None, &nudge, "model/vgr-local"),+ ("a", Some("user"), &initial, "model/vgr-capable"),+ ("a", Some("agent"), &nudge, "model/vgr-capable"),+ ("b", Some("agent"), &nudge, "model/vgr-efficient"),+ ("a", Some("user"), &nudge, "model/vgr-efficient"),+ ("a", Some("agent"), &nudge, "model/vgr-efficient"),+ ("c", None, &initial, "model/vgr-capable"),+ ("c", None, &nudge, "model/vgr-efficient"),] {let mut headers = vec![(session_header, session)];if let Some(initiator) = initiator {diff --git a/docs/reference/toml_schema.md b/docs/reference/toml_schema.mdindex 9497adca6..7f62a4fb8 100644--- a/docs/reference/toml_schema.md+++ b/docs/reference/toml_schema.md@@ -50,7 +50,7 @@ route reaches no upstream. A file without a `[targets]` table is rejected with|---|:---:|---|---|| `format` | Yes | — | `openai_chat`, `openai_responses`, or `anthropic_messages`. || `base_url` | Yes | — | Upstream base URL. |-| `context_discovery` | No | unset | Set to `"llama_cpp"` to enable `/props` context discovery for VGR local targets. Disabled when unset. An explicit route `context_window` takes precedence. |+| `context_discovery` | No | unset | Set to `"llama_cpp"` to enable `/props` context discovery for VGR efficient targets. Disabled when unset. An explicit route `context_window` takes precedence. || `api_key_env` | No | unset | Name of the environment variable holding the key. Omit to send no authentication. || `forward_auth` | No | `false` | Forward the caller's provider credential and application headers. A route's forwarding clients must use one credential family unless they all use the same scheme, host, and port, such as one LLM gateway. || `extra_headers` | No | `{}` | Custom HTTP headers sent to the model server. Set credentials with `api_key_env` or `forward_auth`; the server rejects headers owned by the selected auth mode. Header names are case-insensitive. |diff --git a/docs/routing_algorithms/overview.md b/docs/routing_algorithms/overview.mdindex 2767579e5..fdde00f03 100644--- a/docs/routing_algorithms/overview.md+++ b/docs/routing_algorithms/overview.md@@ -40,7 +40,7 @@ quality, follow the [tuning loop](../tuning/index.md).| [Escalation](escalation_router_routing.md) | `llm_classifier`, `mode = "escalation"` | The weak model serves until a judge reports the same failure on consecutive turns. Then the session latches to the strong model. || [Custom](llm_classifier_routing.md#custom-multi-target-routing) | `llm_classifier`, `mode = "custom"` | Your own judge prompt and schema choose among any number of targets. || [Advisor Gate](advisor_gate_routing.md) | `advisor` | One executor serves every turn. A stronger advisor reviews its plans and "done" claims. |-| [Verification-Gated](vgr_routing.md) | `vgr` | A local model drafts. Verified answers stay local, and everything else goes to the cloud model. |+| [Verification-Gated](vgr_routing.md) | `vgr` | An efficient model drafts. Verified answers stay on the efficient tier, and everything else goes to the capable model. || [Prefill](prefill_routing.md) | `prefill_router` | A classifier you train on the prompt's hidden states picks the target. Experimental: Switchyard supplies no checkpoint, exporter, or encoder assets. || [Random](random_routing.md) | `random` | A fixed traffic split. || [Fixed](#direct-model-routes) | `passthrough` | One target, no decision. |@@ -58,7 +58,7 @@ quality, follow the [tuning loop](../tuning/index.md).| `composite` | A judge at each user turn, tool results in between | One judge call per user turn or session | Every request, with a per-user-turn default | Required, or `message_hash_fallback` | Last tier, else efficient | Not benchmarked | [Composite Routing](composite_routing.md#configuration) || `plan_execute` | The first edit or write tool call | None | Once per session | Recommended. Latches the handoff. | Stays on the planner | [DeepSWE results](../benchmarks.md#deepswe) with the [DeepSWE v1.1 profile](../../benchmark/routing-profiles/deepswe-v11-plan-execute-luna-sol.toml) | That profile || `advisor` | The executor's terminal turn | One advisor review per gated turn, up to `max_reviews` | Never. One executor serves. | Scopes the review budget | An unreadable verdict or a failed advisor call lets the buffered executor turn through (`fail_open`, default `true`). `fail_open = false` stops the request. | [DeepSWE results](../benchmarks.md#deepswe) with the [DeepSWE v1.1 profile](../../benchmark/routing-profiles/deepswe-v11-advisor-gate-luna-sol.toml) | That profile |-| `vgr` | Evidence about a local candidate | Verifier and judge calls | Per final answer | See [the page](vgr_routing.md) | Cloud tier | Not benchmarked. Planned for 0.4.0. | [`examples/vgr-local-servers.toml`](../../examples/vgr-local-servers.toml) |+| `vgr` | Evidence about an efficient candidate | Verifier and judge calls | Per final answer | See [the page](vgr_routing.md) | Capable tier | Not benchmarked. Planned for 0.4.0. | [`examples/vgr-local-servers.toml`](../../examples/vgr-local-servers.toml) || `prefill_router` | Hidden states of the prompt | Encoder inference, no provider call | Every request | Not required | Checkpoint output | Experimental. No checkpoint is supplied. | [Schema example](../reference/toml_schema.md#prefill_router) || `random` | Weights | None | Every request | Not required | Not applicable | Utility | [Random Routing](random_routing.md) || `passthrough` | Nothing | None | Never | Not required | Not applicable | Utility | [Schema](../reference/toml_schema.md#passthrough) |diff --git a/docs/routing_algorithms/vgr_routing.md b/docs/routing_algorithms/vgr_routing.mdindex e9e72de54..2dc9f792c 100644--- a/docs/routing_algorithms/vgr_routing.md+++ b/docs/routing_algorithms/vgr_routing.md@@ -1,28 +1,28 @@# Verification-Gated Routing-Verification-Gated Routing (VGR) generates a candidate on a local tier. For a+Verification-Gated Routing (VGR) generates a candidate on an efficient tier. For afinal answer, it gathers bounded evidence about that exact candidate and serves-it only when the policy allows it. All other final-answer outcomes use the cloud+it only when the policy allows it. All other final-answer outcomes use the capabletier. Missing context, unavailable verifiers, malformed verdicts, and expired-decision deadlines fail closed to cloud for final answers.+decision deadlines fail closed to the capable tier for final answers.-Tool-calling turns continue on the local tier unless the turn judge provides+Tool-calling turns continue on the efficient tier unless the turn judge providesevidence to escalate. An unavailable or inconclusive turn judge leaves the tool-turn on the local tier. A local endpoint failure triggers cloud fallback.+turn on the efficient tier. An efficient endpoint failure triggers capable fallback.## Configure a route-Declare local, cloud, and optional verifier targets using the normal deployment+Declare efficient, capable, and optional verifier targets using the normal deploymentschema, then reference their target names:```toml[routes.assistant]id = "assistant"type = "vgr"-local_target = "local"-cloud_target = "cloud"-judge_target = "local"-cloud_judge_target = "cloud"+efficient_target = "efficient"+capable_target = "capable"+judge_target = "efficient"+capable_judge_target = "capable"mode = "shadow"deadline_seconds = 30task_typing = true@@ -31,13 +31,13 @@ breaker_cooldown_seconds = 30confirmed_recovery_min_clean_tail = 1```-`judge_target` defaults to `local_target`. `cloud_judge_target` is optional.-The local and cloud targets must resolve to distinct model IDs. Set the route's+`judge_target` defaults to `efficient_target`. `capable_judge_target` is optional.+The efficient and capable targets must resolve to distinct model IDs. Set the route's`context_window` to advertise a configured limit through `/v1/models`; this workswith any supported local service and takes precedence over discovery.Context discovery is disabled by default. For llama.cpp, set-`context_discovery = "llama_cpp"` on the local target's `[llm_clients.<name>]`+`context_discovery = "llama_cpp"` on the efficient target's `[llm_clients.<name>]`entry and leave the route's `context_window` unset. Switchyard then reads theservice's `/props` response and advertises a positive context capacity whenavailable. Missing or invalid properties leave the capacity unknown; routing@@ -53,8 +53,8 @@ for one minute. Discovery probes run concurrently with a two-second total budgetper refresh. Completed discoveries are retained when that budget expires.`confirmed_recovery_min_clean_tail`, when set, lets an agentic-run that recovered from tool errors commit locally once that many trailing tool-results are clean and the cloud judge confirms the evidence.+run that recovered from tool errors commit on the efficient tier once that many trailing tool+results are clean and the capable judge confirms the evidence.## Agentic handoff@@ -62,17 +62,17 @@ These settings are off by default:```tomlagentic_handoff = true-local_turn_budget_seconds = 600+efficient_turn_budget_seconds = 600```-`agentic_handoff` tells the cloud tier when it takes over tool-using work that-the local tier previously served. The notice can include the local tier's+`agentic_handoff` tells the capable tier when it takes over tool-using work that+the efficient tier previously served. The notice can include the efficient tier'sunchecked final message. It is sent at most once per user turn, and only after-new local work has been served since the previous handoff. The handoff preserves-the conversation's existing messages and content. `local_turn_budget_seconds`-escalates a user turn once the local tier has spent that much wall-clock time on it.+new efficient work has been served since the previous handoff. The handoff preserves+the conversation's existing messages and content. `efficient_turn_budget_seconds`+escalates a user turn once the efficient tier has spent that much wall-clock time on it.-Optional experimental compaction condenses local history into a cached digest+Optional experimental compaction condenses history from the efficient tier into a cached digestwhen handing off. Enable it on the VGR route:```toml@@ -92,11 +92,11 @@ results become `[non-text content]`; non-text user updates, including images,are omitted without a marker. Cache savings and task-success effects have notbeen measured in a matched evaluation.-The notice covers the current request and asks the cloud tier to preserve earlier+The notice covers the current request and asks the capable tier to preserve earlierwork, inspect its effects, and repeat or undo steps only when needed.-Escalations release when a new user turn is decided locally. Set-`latch_escalation = true` to retain the cloud tier across later user turns instead.+Escalations release when a new user turn is decided on the efficient tier. Set+`latch_escalation = true` to retain the capable tier across later user turns instead.Shadow mode always releases the hold at the next user turn.All configured VGR durations must be positive.@@ -123,26 +123,26 @@ automatic continuations. Retries retain the original call's tag. Without arecognized tag, Switchyard uses the message shape to identify a user turn.`x-session-id` is also accepted as a session-header alias.-## Verification and cloud outages+## Verification and capable-tier outages-Coding without tool history can commit locally on a clean readout of at least-0.6, or a readout of at least 0.2 plus cloud-judge affirmation. Other final-answer-branches can use a separate scored verdict after local deliberation.+Coding without tool history can serve the efficient attempt with a clean readout of at least+0.6, or a readout of at least 0.2 plus capable-judge affirmation. Other final-answer+branches can use a separate scored verdict after efficient deliberation.-In `active` mode, an unavailable cloud tier can fall back to an unverified local-answer. That call receives the original request without the cloud handoff note.-Fallback is disabled by the kill switch, an open local circuit breaker, or an-image request the local tier cannot serve.+In `active` mode, an unavailable capable tier can fall back to an unverified efficient+answer. That call receives the original request without the capable handoff note.+Fallback is disabled by the kill switch, an open efficient circuit breaker, or an+image request the efficient tier cannot serve.## Serving modes-- `off` skips candidate generation and serves cloud. This is the default.-- `shadow` computes a decision but serves cloud.+- `off` skips candidate generation and serves the capable tier. This is the default.+- `shadow` computes a decision but serves the capable tier.- `evaluate` serves the policy decision for isolated evaluation.- `active` serves the policy decision in production and requires`active_approval = "prospective-validation-and-canary-approved"`.-VGR buffers a local candidate before releasing it. A streamed candidate that is+VGR buffers an efficient candidate before releasing it. A streamed candidate that islicensed is replayed as a stream; a rejected candidate is not sent to theclient.diff --git a/examples/vgr-local-servers.toml b/examples/vgr-local-servers.tomlindex dfa789cf7..82f9c6093 100644--- a/examples/vgr-local-servers.toml+++ b/examples/vgr-local-servers.toml@@ -5,7 +5,7 @@schema_version = 1# llama.cpp is active in this example. Discovery must be explicitly enabled.-[llm_clients.local]+[llm_clients.efficient]format = "openai_chat"base_url = "http://localhost:8080/v1"context_discovery = "llama_cpp"@@ -14,34 +14,34 @@ context_discovery = "llama_cpp"# Also set context_window in routes.assistant to match the running service.## Ollama:-# [llm_clients.local]+# [llm_clients.efficient]# format = "openai_chat"# base_url = "http://localhost:11434/v1"## vLLM:-# [llm_clients.local]+# [llm_clients.efficient]# format = "openai_chat"# base_url = "http://localhost:8000/v1"-[llm_clients.cloud]+[llm_clients.capable]format = "openai_chat"base_url = "https://api.openai.com/v1"# api_key_env = "OPENAI_API_KEY"-[targets.local]+[targets.efficient]# Use the llama.cpp alias, Ollama model tag, or vLLM served model name.-id = "local-model"-llm_client = "local"+id = "efficient-model"+llm_client = "efficient"-[targets.cloud]-id = "cloud-model"-llm_client = "cloud"+[targets.capable]+id = "capable-model"+llm_client = "capable"[routes.assistant]id = "switchyard/vgr"type = "vgr"-local_target = "local"-cloud_target = "cloud"+efficient_target = "efficient"+capable_target = "capable"mode = "shadow"# Explicit context_window takes precedence and skips discovery.# Set this for Ollama/vLLM, or to set a deliberate limit with llama.cpp.