Repository navigation
Replies: 1 comment
|
We hit this same eligibility-versus-preference problem building a gateway on top of Approach. Before an algorithm runs, we build a per-request
What we found while doing it.
Where we fall short of what you describe. Ours is static labels on targets plus a small budget/health policy, not a general predicate over request attributes (cost ceiling, region, capability). And we don't have your multi-turn case: a restricted turn 3 doesn't limit where turn 8 can be promoted. Strictness is per route, so a request can't escalate out of a strict route, but nothing latches from content. That seems like the hard part and a reason this belongs in libsy rather than in every host. Design notes: https://github.com/gschaetz/humpyard/blob/main/docs/adr/0017-strict-routes-exclude-disallowed-classes-before-routing.md Happy to answer questions or help prototype. |
Uh oh!
There was an error while loading. Please reload this page.
Pre-Routing Target Filtering: Eligibility vs. Preference in Route Selection
Repo: NVIDIA NeMo Switchyard
Type: Design discussion / feature proposal
Context: Validating the pre-dispatch abstraction before proposing implementation changes to libsy and the algorithm dispatch path.
Question
Is there an existing or planned mechanism for applying hard eligibility rules to candidate targets before a routing algorithm executes, rather than requiring those rules to be implemented within individual routing algorithms?
Today, the primary extension point in Switchyard is the routing algorithm layer, such as the LLM classifier, stage router, escalation router, or custom implementations conforming to the routing dispatch interface.
That layer is well suited to express preference: which target is best for a given turn. However, it is an awkward place to express eligibility: which targets are legally, structurally, or operationally allowed to be considered at all.
Preference and Eligibility Are Different Concerns
Consider a standard enterprise policy constraint:
Requests containing EU user data may only be dispatched to targets hosted in eu-west.
If the intended path is to implement a custom routing algorithm, that works mechanically, but it couples hard filtering with soft heuristic ranking.
• Re-implementation overhead: A team wanting the tier promotion logic of stage router or escalation must wrap or duplicate the scoring algorithm simply to bolt a candidate filter in front of it, inheriting maintenance risk from upstream algorithm changes.
• Distinct failure modes: Preference is heuristic, tunable, and tolerates probabilistic variance while optimizing for latency, cost, or output quality. Eligibility is invariant enforcement. A routing failure here represents a compliance, licensing, or execution defect.
• Operational ownership: Changes to ranking heuristics belong to ML/product teams tuning cost versus quality. Changes to data residency, licensing, or compliance boundaries belong to security and legal stakeholders. Keeping these concerns distinct makes both easier to reason about, audit, and review in isolation.
• Target-aware boundary: Coarse network filtering can live in an ingress API gateway, but fine-grained routing constraints require route-level awareness of target properties, such as target-specific token cost ceilings, hardware quantization capabilities, or dynamic endpoint health states. An upstream gateway lacks that context, and individual routing algorithms should not need to re-implement it.
Use Cases
These operational requirements all share the same structural pattern:
Common Shape Abstraction
All of the above reduce to a single invariant predicate executed over the request context and candidate target set.
Rust: individual target evaluation predicate
Candidate set filtering
Proposed Pipeline Flow
Declarative Example Sketch
Composition Semantics
Monotonically Subtract Only
Constraints can only eliminate candidates from the route pool. They can never introduce or re-add candidates. This ensures determinism and avoids order-dependent resolution loops.
Fail Closed on Empty Sets
If constraint filtering eliminates all candidates, Switchyard should return an explicit routing error, such as RouteExhaustedError, rather than falling back to an unconstrained target. Bypassing constraints should require explicit opt-in policy.
Interaction with Escalation and Multi-Turn Latching
In Switchyard escalation routing, the escalation router and LlmTaskClassifier in escalation mode track session progression and latch target affinity once escalation thresholds, such as consecutive task-failure signals, are crossed.
Because Switchyard’s internal session state manages target affinity and execution signals rather than content compliance history, a subtle multi-turn edge case emerges when requests forward conversational context, such as full OpenAI or Anthropic messages arrays.
If eligibility constraints evaluate only against the active turn’s immediate payload delta, Turn 8 evaluates as compliant and dispatches the accumulated transcript to an ineligible target.
Proposed Session Constraint Model: Monotonic Join Lattice
Rust trait sketch
• Session-scoped constraints: Track a monotonic state that can narrow the candidate set over the session lifecycle, but never widen it.
• Stateless turn-scoped constraints: Evaluate per turn for transient conditions, such as target health or payload token limits.
Questions for Maintainers
I would be happy to put together an initial RFC and prototype against libsy if this direction aligns with the repository’s design goals.
All reactions