GitHubBook a demoStart routing
Browse docs

Gate routing on a proven quality floor

Add a min_quality_lcb floor to a routing selector so a cheaper tier is eligible only while its calibrated lower confidence bound clears the floor — candidacy gated on proof, absence and below-floor kept as different, disclosed facts.

Last updated

On this page

Spend an active calibration as a routing constraint: a cheaper tier becomes eligible only while its calibrated quality lower bound clears a floor. The floor is a selector parameter, min_quality_lcb, and it gates candidacy, not rank — a tier below the floor is not a cheap option, it is not an option.

Prerequisites

1. Add the floor to a selector

min_quality_lcb lives in a select node’s by.params, beside the quality_metric it reads under. This admits the cheapest tier whose calibrated lower bound clears 0.98 on output_nonempty, and sends everything else to the frontier when none qualifies:

routing:
  default_tier: frontier
  policy:
    version: 1
    root:
      rules:
        - id: extraction-floor
          to:
            select:
              from: { tiers: all }
              by:
                selector: cheapest_meeting
                params:
                  min_quality_lcb: 0.98        # a bound on a pass rate, in [0,1]
                  quality_metric: output_nonempty
              # A candidate that cannot meet the floor is not an option.
              # When none can, traffic goes here.
              on_empty: { tier: frontier }
      default: { tier: frontier }

2. Validate and reload

Validate strictly, then reload the config — the router reads calibration off an immutable snapshot published off the request path, so the floor takes effect on the next reload, not mid-request:

$ tokentriage validate --config tokentriage.yaml

3. Verify on a real decision

Send traffic and read a decision back. When the chosen candidate’s quality was actually consulted, the row records a QualityConsult and a decision.predicted.* block (the metric, the tier, the calibration version, and the fact):

$ tokentriage policy explain --req-id <req-id> --log ~/.tokentriage/decisions.jsonl

The selector’s score table carries every candidate’s quality verdict, not only the admitted ones — because once the floor gates candidacy, the admitted-arm count is what an off-policy propensity is computed over.

4. Read the two exclusion terms

Absence and below-floor are different facts that call for different operator actions, and the score table keeps them apart:

  • quality_below_min_lcb — the tier was measured, admitted to the comparison, and its calibrated bound fell below the floor. It carries the numbers.
  • quality_absent:<reason> — the tier’s quality could not be read at all, with the reason riding the term name (e.g. quality_absent:segment_uncalibrated, quality_absent:below_min_n). The floor never scores an absent tier as if it had failed.