@bijectionhq/library-evaluation, measures AI
behaviour for the app that places it. It is built on three owners: the
experiments library (offline comparison, holdout qualification and the arm
of a live item), the models library (a judge is a typed
task), and checks from @bijectionhq/library-checks
(release eligibility and live grades are verdicts). evaluations({...})
returns a subtree with its tables at <path>.tables.* and its functions at
<path>.runs.* and <path>.grades.*.
bijection/quality.ts
checks instance the library’s label: the library records its
verdicts in its own functions’ commits.
Definitions and reports
evaluation(definition, { metrics }) admits a definition and names it by
its digest. A definition is { name, revision, baseline, candidates, cases, repetitions, metrics, limits }. Each case has an input, a
population (training or holdout), optional lineage that clusters cases
and never crosses populations, and 1 to 32 assertions:
evaluate(observations) folds one observation per (candidate, case,
repetition) slot into a report. A slot is passed, failed or
unavailable; missing evidence is unavailable, never a pass.
fromTask(task.check(result)) turns a typed task’s result into an
observation’s state, output and costMicroUsd.
assessRelease(report, definition, policy) measures a release: paired
non-inferiority on the holdout over independent case clusters, every
safety assertion present and passing, and cost and latency bounds. Missing
evidence is insufficient.
Judges
judge(ai, { name, revision, model, instructions }) is a typed model task
answering { passed, reason } over { rubric, input, output, evidence }.
judge.submit(ctx, subject, { once, then }) sends it and
judge.judgment(result) decodes it: a failed call or a non-conforming
answer is never a pass. pairwiseJudge runs one round per order, and
pairwiseConsensus keeps a winner only when both orders agree.
calibrateJudge(labels, policy) bounds false-accept and false-reject rates
per slice, and eligibility(...) checks a judge against your calibration
record.
The library’s functions
The same operations are in-transaction helpers (
register, observe,
report, release, grade, gradeOf, summary) for your own functions,
such as the continuation of a candidate’s answer:
Offline comparison
plan({ trial, seed, alpha, grid }) on an admitted evaluation is the
experiments library’s offline registration for it. Your trial mutation
runs the candidate in a scenario branch and answers its score; the
experiments library’s plans.compare and plans.qualify decide. Judge
assertions are unavailable inside a trial, so judge-graded comparisons are
runs.