eval

package
v0.207.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package eval is the harness's code-based quality evaluation: replay a curated per-task gold set through the live cascade and score with deterministic graders (grounding for extract/summarize, label-match for classify/triage). It is the keystone the prompt/exemplar optimizers (Phases 3-4) replay against.

Index

Constants

View Source
const (
	ModeSuperiority    = "superiority"
	ModeNonInferiority = "non_inferiority"
)

Modes.

View Source
const (
	ClassUnitInterval = "unit_interval" // scores in [0,1]; default margin 0.05
	ClassJudge010     = "judge_0_10"    // scores in [0,10]; default margin 0.5
	ClassCustom       = "custom"        // any scale; non-inferiority must carry its own margin
)

Primary metric classes. The class fixes the score scale and the default margin.

View Source
const (
	EffTokens    = "tokens"
	EffMoney     = "money"
	EffMemoryGiB = "memory_gib"
)

Efficiency metric classes. Tokens, money and resident memory only: INV-5 keeps every wall-time term (seconds, latency, wall, duration, time) out of a pass rule, so no class names one and freeze refuses any other word.

View Source
const (
	DefaultMinPairs         = 16
	DefaultBootstrapB       = 10000
	DefaultSeed       int64 = 1
	// DefaultMaxExcludedShare is the share of attempts or declared tasks that may be unusable
	// before the run is INCONCLUSIVE (the usable-denominator rule).
	DefaultMaxExcludedShare = 0.20
	// Default margins for non-inferiority.
	DefaultMarginUnitInterval = 0.05
	DefaultMarginJudge010     = 0.5
)

Defaults filled by FreezeBaseline when the pre-registration leaves a field out.

View Source
const (
	MinBootstrapB = 2000
	MinMinPairs   = 16
)

Floors that validate enforces. min_pairs: the primary interval's false-ADOPT rate was measured from 16 tasks up (61 of the 63 null cells of the calibration grid, 16 to 80 tasks, are at most 3.6% against a nominal 2.5%; the other two, a strong incumbent with a handful of disagreeing tasks at 80 tasks, are 4.8% and 8.2%, and the same regime reaches 17.7% at 62 tasks for a candidate that loses 5% of the incumbent's passes; at most 4% is tested end to end on 16 to 24 tasks), so 16 is the smallest sample the gate makes a claim about. bootstrap_b: the paired bootstrap reads the efficiency metrics, and an interval read from a handful of resamples is mostly noise: on the cost nulls of the study at 16 tasks a metric falsely improved in 8% to 13% of runs at B = 10 and in 42% to 50% at B = 1, against 3.5% to 5.9% at B = 2000, which is the B the existing callers of BootstrapDeltaMean use. The figures are TestCalibrationStudy's and TestEfficiencyCalibrationStudy's (gate_sim_test.go).

View Source
const (
	VerdictAdopt        = "ADOPT"
	VerdictBlock        = "BLOCK"
	VerdictInconclusive = "INCONCLUSIVE"
)

Verdicts.

View Source
const GateVersion = "3"

GateVersion is the version of the rules this package implements. It rides in the baseline, in every result and in the era marker. Version 3: the primary is read on Tango's score interval for pass/fail pairs and on the score form of the t interval over a sample with two pseudo-pairs at each end of the range for every other pair of scores (interval.go), where version 2 read the score form of the t interval and the rule of three for a sample with no spread. Version 2: unusable candidate attempts enter at the worst score and an unfinished one's recorded cost is spent, the judge is frozen, bootstrap_b and min_pairs have floors, a declared efficiency metric that got worse vetoes (read from two resolved pairs), and the margin is bounded by the class width. A version 2 baseline is refused for its version, as a version 1 one is: its verdicts were read with another interval, so the pre-registration has to be written again.

Variables

View Source
var GateInputSchema []byte

GateInputSchema is the JSON Schema (draft 2020-12) of the gate input document, the contract the Claude Code adapter reads (`local-offload gate schema` prints it). Its `outcome` enum is pinned to AllOutcomes by a test, so the two cannot drift.

Functions

func AUGRC

func AUGRC(pts []RCPoint) float64

AUGRC is the area under the Generalized Risk-Coverage curve (Traub et al. 2024, "Overcoming Common Flaws in the Evaluation of Selective Classification Systems"). Unlike AURC (selective risk = cumLoss/k), the GENERALIZED risk at coverage rank k is the JOINT risk (cumLoss / N, NOT / k) — it does not blow up at low coverage, so it is more stable. pts are ranked by confidence DESC internally. Returns the mean generalized risk over all coverage levels k=1..N. Lower = better. Returns 0 for empty input.

func Aggregate

func Aggregate(outs []Outcome) map[string]Report

Aggregate rolls outcomes up per task. Correct-defer is a valuable failure: it is NOT counted as an error (the frontier model handles it); only an accepted-wrong result is a true failure.

func BaselineHash added in v0.206.0

func BaselineHash(raw []byte) string

BaselineHash is the hex SHA-256 of the baseline file's bytes.

func BootstrapDeltaAURC

func BootstrapDeltaAURC(incConf, headConf []float64, correct []bool, B int, seed int64) (delta, lo, hi float64)

BootstrapDeltaAURC resamples the N aligned (incConf, headConf, correct) tuples B times with replacement; each resample computes AURC(incumbent) - AURC(head) over the resampled set. Returns the mean delta and the [2.5, 97.5] percentile CI. Deterministic given seed (math/rand with the seed). delta>0 means the head has LOWER AURC (better). The adoption rule is lo > 0 (CI excludes zero). Requires len(incConf)==len(headConf)==len(correct); returns (0,0,0) if N<2 or B<1.

func BootstrapDeltaMean added in v0.6.1

func BootstrapDeltaMean(inc, cand []float64, B int, seed int64) (delta, lo, hi float64)

BootstrapDeltaMean is a PAIRED bootstrap of the mean difference (candidate − incumbent) over aligned per-item scores — the P6 flywheel's adoption metric for a candidate planner prompt (e.g. goal-reached 0/1 per trajectory). It returns the mean delta and its 95% CI. The SAME fail-closed rule as the AURC gate applies: ADOPT only when lo>0 (candidate strictly better), BLOCK on hi<0, else inconclusive. n<2 or B<1 => zeros (nothing to conclude).

Its results are pinned by a test: the measurement gate reads other percentiles of the same replicates through bootstrapReps, and this function must not move for its other callers.

func DeferralCurve

func DeferralCurve(points []OpPoint) (audc, qnc, peak float64)

DeferralCurve computes cascade cost-quality summaries over operating points (Jitkrittum et al. 2024, arXiv:2410.10347; Cost-Aware Contrastive Routing arXiv:2508.12491). Points sorted by cost; cost normalized to [0,1] over the observed range. AUDC = trapezoidal area under quality-vs-normalized-cost (higher = better quality per cost). Peak = max quality. QNC = smallest normalized cost at which peak quality is reached (lower = matches its best quality more cheaply).

func ECE added in v0.5.0

func ECE(pts []RCPoint, nBins int) float64

ECE computes Expected Calibration Error using nBins equal-width bins over the predicted probability range [0, 1]. For each bin b containing n_b points:

contribution = (n_b / N) * |mean_predicted_b - mean_correct_b|

ECE = sum over non-empty bins. Lower = better calibrated. Returns 0 for empty input. If nBins <= 0 it is clamped to 10. pts need not be sorted.

func Grade

func Grade(c Case, res core.Result) bool

Grade returns whether an ACCEPTED result is correct for the gold case. classify/triage: the model's chosen label/decision must equal Case.Expect. extract/summarize: graded by grounding against the source (no reference needed). Callers must only Grade accepted (res.OK && !res.Deferred) results.

func KFoldOOF

func KFoldOOF[M any](n, k int, seed int64, fit func(train []int) M, score func(m M, i int) float64) []float64

KFoldOOF returns an out-of-fold score for each of n items. Items are shuffled (seeded) then split into k folds; for each fold, fit() is called with the TRAINING indices (all items not in the fold) and returns a model M, then score(M, i) scores each held-out index i. Deterministic given seed. If k<2 it is set to 2; if k>n it is set to n.

func RiskCoverage

func RiskCoverage(pts []RCPoint) (coverage, risk []float64, aurc, eaurc float64)

RiskCoverage computes the discrete risk-coverage curve with AURC and E-AURC. Field-standard selective-prediction metric (Geifman & El-Yaniv 2017; discrete form Ding et al. 2020): sort by confidence DESC; selective risk at coverage k/N = mean 0/1 loss over the k most-confident predictions; AURC = mean selective risk over all k. E-AURC subtracts the oracle AURC (perfect ranking: all correct first), isolating the reducible part. Lower = better.

func SortedTasks

func SortedTasks(m map[string]Report) []string

SortedTasks returns the task keys of a report map in stable order.

Types

type Arm added in v0.206.0

type Arm struct {
	Stamps Stamps `json:"stamps"`
	Tasks  []Task `json:"tasks"`
}

Arm is one side of a comparison: the stamps of the run and its tasks.

type ArmCount added in v0.206.0

type ArmCount struct {
	Incumbent int `json:"incumbent"`
	Candidate int `json:"candidate"`
}

ArmCount is one integer per arm.

type Attempt added in v0.206.0

type Attempt struct {
	Outcome AttemptOutcome `json:"outcome"`
	// Score is required for pass and task_fail; a cheat enters at the primary's worst score
	// whatever it carries; ignored for every other class.
	Score *float64 `json:"score,omitempty"`
	// Metrics are efficiency values by declared metric name (tokens, money, memory in GiB):
	// finite and not negative. A nil value is unresolved.
	Metrics map[string]*float64 `json:"metrics,omitempty"`
}

Attempt is one attempt at one task.

Unresolved cost rule: a nil metric value stays nil end to end and is NEVER written as 0. It marshals as JSON null (the key stays, the value is null); a metric key that is absent means the same thing. A cost that was not measured is not a free run.

type AttemptCounts added in v0.206.0

type AttemptCounts struct {
	Incumbent OutcomeCounts `json:"incumbent"`
	Candidate OutcomeCounts `json:"candidate"`
}

AttemptCounts holds the per-arm outcome counts.

type AttemptOutcome added in v0.206.0

type AttemptOutcome string

AttemptOutcome is the closed taxonomy of what happened to ONE attempt at ONE task in a gate run. The gate scores only the attempts that reached a verdict on the task itself (pass, task_fail, cheat); every other class is infrastructure or judge noise that is counted and reported but never scored, so a flaky box cannot move a score in either direction.

Why not `Outcome`: this package already exports `Outcome`, the per-case result struct of the cascade eval (Run, Aggregate, the confhead A/B). The gate's enum is the string type below; the exported helpers are AllOutcomes and OutcomeFromRecord.

const (
	// OutcomePass: the attempt finished and the scorer gave it a score (any value in the
	// scale; a "pass" is not necessarily 1).
	OutcomePass AttemptOutcome = "pass"
	// OutcomeTaskFail: the attempt finished and the scorer gave it a score (typically low).
	OutcomeTaskFail AttemptOutcome = "task_fail"
	// OutcomeCheat: the attempt tried to game the scorer. It enters a task's mean at the worst
	// score of the primary whatever score it carries, and is counted separately per arm.
	OutcomeCheat AttemptOutcome = "cheat"
	// OutcomeInfraError: the run broke (engine crash, out of memory, transport). Not scored: the
	// candidate's enters at the worst score, the incumbent's is skipped.
	OutcomeInfraError AttemptOutcome = "infra_error"
	// OutcomeTimeout: the attempt hit its budget. Not scored: a timeout is a property of the
	// run, and the gate carries no wall-time term (INV-5). A candidate's enters at the worst
	// score, an incumbent's is skipped.
	OutcomeTimeout AttemptOutcome = "timeout"
	// OutcomeJudgeError: the judge could not score the attempt. Not scored.
	OutcomeJudgeError AttemptOutcome = "judge_error"
	// OutcomeNotRun: the attempt never ran (an external record's `not_checked` is this class).
	// Not scored.
	OutcomeNotRun AttemptOutcome = "not_run"
)

func AllOutcomes added in v0.206.0

func AllOutcomes() []AttemptOutcome

AllOutcomes returns the seven classes in their fixed order (a fresh slice each call).

func OutcomeFromRecord added in v0.206.0

func OutcomeFromRecord(s string) (AttemptOutcome, bool)

OutcomeFromRecord maps the outcome word of an external evaluation record to this taxonomy. The record shape it reads is one string: the outcome word the record's own check wrote. The six words it shares with the gate (pass, task_fail, cheat, infra_error, timeout, judge_error) map to themselves; the record's `not_checked` (the check never ran) is the gate's `not_run`. Any other word is unknown (false): a record the gate cannot place must be refused by the caller, never guessed into a class. Turning a record's runs into an arm is the adapter's job and the adapter is the trust boundary: the gate checks task ids against the declared list, not what a task contained.

func (AttemptOutcome) Scored added in v0.206.0

func (o AttemptOutcome) Scored() bool

Scored reports whether an attempt of this class enters a task's score on its own: pass, task_fail and cheat. (A cheat enters at the primary's worst score, and an unfinished candidate attempt is imputed at that score; see the scoring rule.)

func (AttemptOutcome) Valid added in v0.206.0

func (o AttemptOutcome) Valid() bool

Valid reports whether o is one of the seven classes.

type Baseline added in v0.206.0

type Baseline struct {
	GateVersion      string             `json:"gate_version"`
	Mode             string             `json:"mode"`
	Primary          Primary            `json:"primary"`
	Judge            Judge              `json:"judge"`
	Efficiency       []EfficiencyMetric `json:"efficiency"`
	MinPairs         int                `json:"min_pairs"`
	BootstrapB       int                `json:"bootstrap_b"`
	Seed             int64              `json:"seed"`
	MaxExcludedShare float64            `json:"max_excluded_share"`
	HeldOut          []string           `json:"held_out"`
	CorpusHash       string             `json:"corpus_hash"`
	// Tasks is the declared task list: the denominator of the excluded share.
	Tasks []string `json:"tasks"`
	// Incumbent is the frozen incumbent run (a baseline measurement of the current cascade freezes it here); optional.
	Incumbent *Arm `json:"incumbent,omitempty"`
}

Baseline is the frozen pre-registration. Field order is the canonical order.

func CheckBaseline added in v0.206.0

func CheckBaseline(raw []byte) (Baseline, string, error)

CheckBaseline parses a baseline file, re-marshals it canonically and refuses when the bytes differ from what it was given: the file is exactly what freeze wrote, or it is not a baseline. It also re-validates every rule freeze applies, so a hand-built file that happens to be canonical is still refused. It returns the baseline and the hash of the raw bytes.

The version is read first, before the document is decoded strictly or compared with its canonical form: a baseline of another version (one frozen by the version 1 gate has no judge key, so its bytes are not this gate's canonical form) is refused for its version, which is the thing the operator can act on.

func FreezeBaseline added in v0.206.0

func FreezeBaseline(p PreReg, corpus []byte, incumbent *Arm) (Baseline, []byte, string, error)

FreezeBaseline validates a pre-registration, fills its defaults, sorts the task lists and the incumbent's tasks, and returns the baseline, its canonical bytes and their hash. Freezing the same inputs twice returns identical bytes. The corpus is hashed, never stored: a corpus is harvested redacted, hash-stamped, machine-local and never committed, and freeze and check reproduce from the hash.

type Case

type Case struct {
	Task   string         `json:"task"`
	Input  string         `json:"input"`
	Params map[string]any `json:"params,omitempty"`
	Expect string         `json:"expect,omitempty"` // gold label/decision (classify/triage); optional for extract/summarize
}

Case is one gold-set instance with a defined success condition.

func LoadCases

func LoadCases(path string) ([]Case, error)

LoadCases reads a JSONL gold set; missing file => empty, no error. Empty and malformed (non-JSON / empty-Task) lines are skipped.

type EfficiencyMetric added in v0.206.0

type EfficiencyMetric struct {
	Name          string `json:"name"`
	Class         string `json:"class"`
	LowerIsBetter bool   `json:"lower_is_better"`
}

EfficiencyMetric is a cost a non-inferior candidate must improve to be adopted.

type EfficiencyResult added in v0.206.0

type EfficiencyResult struct {
	Name            string   `json:"name"`
	Class           string   `json:"class"`
	LowerIsBetter   bool     `json:"lower_is_better"`
	Delta           *float64 `json:"delta"`
	Lo              *float64 `json:"lo"`
	Hi              *float64 `json:"hi"`
	N               int      `json:"n"`
	UnresolvedPairs int      `json:"unresolved_pairs"`
	Improves        bool     `json:"improves"`
	// OverUnresolvedCap is true when UnresolvedPairs over the usable pairs is above
	// max_excluded_share: the metric was not measured on enough pairs, so it cannot improve.
	OverUnresolvedCap bool `json:"over_unresolved_cap"`
	// Regresses is true when the plain 95% interval lies wholly on the worse side. It is read
	// wherever the metric has an interval (two or more resolved pairs), not only from min_pairs.
	Regresses bool `json:"regresses"`
	// Level is the two-sided level of Lo and Hi: 0.95, or 1 - 0.05/k for k declared metrics.
	Level float64 `json:"level"`
}

EfficiencyResult is the paired-bootstrap read of one declared efficiency metric over the usable pairs that resolved it on both arms. Delta, Lo and Hi are null when fewer than two pairs resolved the metric (N < 2): there is no interval to read, and a 0 would say "no change" where the truth is "no data". A measured zero is a number.

With k declared metrics, Lo and Hi are the two-sided 1 - 0.05/k interval (Level), so that declaring k metrics does not multiply the chance of a false improvement by k; Improves reads that interval. Regresses reads the plain 95% interval.

type GateInput added in v0.206.0

type GateInput struct {
	BaselineHash string        `json:"baseline_hash"`
	Incumbent    *Arm          `json:"incumbent,omitempty"` // required unless the baseline froze one; if both, must be equal
	Candidate    Arm           `json:"candidate"`
	Judge        Judge         `json:"judge"`
	Receipt      *JudgeReceipt `json:"receipt,omitempty"`
}

GateInput is one comparison: a candidate arm against the incumbent arm under a frozen baseline.

type GateResult added in v0.206.0

type GateResult struct {
	Verdict       string        `json:"verdict"`
	Reason        string        `json:"reason"`
	KeepIncumbent bool          `json:"keep_incumbent"`
	Mode          string        `json:"mode"`
	Margin        float64       `json:"margin"`
	Delta         float64       `json:"delta"`
	Lo            float64       `json:"lo"`
	Hi            float64       `json:"hi"`
	NUsed         int           `json:"n_used"`
	NDeclared     int           `json:"n_declared"`
	ExcludedPairs int           `json:"excluded_pairs"`
	ExcludedShare float64       `json:"excluded_share"`
	AttemptCounts AttemptCounts `json:"attempt_counts"`
	Cheats        ArmCount      `json:"cheats"`
	// ImputedAttempts is the number of candidate attempts that entered a task's mean at the
	// worst score because they were timeout, infra_error, judge_error or not_run (a cheat stays
	// in Cheats). UnusableAttempts is, per arm, the count of timeout, infra_error, judge_error
	// and not_run attempts, the placeholders for missing tasks included.
	ImputedAttempts  int                `json:"imputed_attempts"`
	UnusableAttempts ArmCount           `json:"unusable_attempts"`
	Efficiency       []EfficiencyResult `json:"efficiency"`
	HeldOut          *HeldOutResult     `json:"held_out"`
	Power            PowerNote          `json:"power"`
	Stamps           ResultStamps       `json:"stamps"`
	Judge            Judge              `json:"judge"`
	EraMarker        string             `json:"era_marker"`
	GateVersion      string             `json:"gate_version"`
	CorpusHash       string             `json:"corpus_hash"`
	BaselineHash     string             `json:"baseline_hash"`
	BootstrapB       int                `json:"bootstrap_b"`
	Seed             int64              `json:"seed"`
	// GateBuildSHA256 is the hash of the binary that ran the gate, set by the verb (Gate itself
	// is pure). It is not part of the era marker. Absent means unknown.
	GateBuildSHA256 string `json:"gate_build_sha256,omitempty"`
}

GateResult is the gate's whole output. Field order is the struct's, and nothing in it is a timestamp: the same input twice gives byte-identical JSON.

func Gate added in v0.206.0

func Gate(b Baseline, baselineHash string, in GateInput) (GateResult, error)

Gate is the one measurement gate. It is pure: no I/O, no clock, no randomness beyond the baseline's seed. It returns a verdict or a refusal, never both.

The rules (docs/systems/measurement-gate.md has them in plain words, numbered the same):

R1  the statistic is the mean paired difference over TASKS, read on a 95% interval that is
    Tango's score interval when every pair is a tie, a win or a loss of the whole range, and
    the score form of the t interval over the sample with two pseudo-pairs at each end of the
    range otherwise (interval.go); the paired bootstrap reads the efficiency metrics
R2  superiority: ADOPT iff lo > 0, BLOCK iff hi < 0; non-inferiority with margin m: BLOCK iff
    hi < -m, ADOPT iff lo > -m and a declared efficiency metric improves and none got
    significantly worse or went unmeasured; else INCONCLUSIVE
R3  a candidate attempt that did not finish scores the worst score and still spends the cost
    it recorded (one that recorded none leaves its task's cost unresolved), an incumbent's is
    skipped (cost included), a cheat scores the worst score;
    excluded pairs and unusable attempts are counted
R4  the incumbent wins every tie and every INCONCLUSIVE; fewer than min_pairs usable pairs, or
    too large an excluded share, is INCONCLUSIVE (the remedy is more tasks, not more attempts)
R5  held-out pairs may veto an ADOPT, never rescue anything
R6  everything the verdict depends on, the judge included, was frozen before the first
    candidate run
R7  a model judge needs a passed self-test receipt for the same scorer
R8  the era marker pins the runs; results from different eras are never compared

type HeldOutResult added in v0.206.0

type HeldOutResult struct {
	N     int     `json:"n"`
	Delta float64 `json:"delta"`
	// Failed is true only when N > 0 and the held-out delta is below the threshold.
	Failed bool `json:"failed"`
	// Missing is true when no held-out pair is usable (N == 0): there is no evidence, so an
	// ADOPT is held back as INCONCLUSIVE rather than judged on nothing.
	Missing bool `json:"missing"`
}

HeldOutResult is the point-estimate check on the held-out pairs (rule R5).

type Judge added in v0.206.0

type Judge struct {
	Kind     string `json:"kind"`     // "deterministic" | "model"
	Identity string `json:"identity"` // scorer id, e.g. "acceptance-dsl" or a model id
}

Judge names the scorer that produced the scores. It is frozen in the baseline and the input must name the same one. A deterministic scorer (the acceptance DSL, a regex, an exact match) needs no receipt; a model judge needs a passed self-test receipt for the same scorer, or the gate refuses.

type JudgeReceipt added in v0.206.0

type JudgeReceipt struct {
	ScorerID  string `json:"scorer_id"`
	PairsHash string `json:"pairs_hash"`
	Passed    bool   `json:"passed"`
	BuildSHA  string `json:"build_sha256"`
}

JudgeReceipt is the self-test receipt `gate selftest` produces for a model judge. Data only here: the gate checks that the scorer matches and that both hashes are 64 lower-case hex characters, not what they hash.

type OpPoint

type OpPoint struct {
	Label   string
	Cost    float64 // avg cost per query (e.g. tokens-out)
	Quality float64 // accuracy in [0,1]
}

OpPoint is one cascade operating point: average cost and achieved quality.

type Outcome

type Outcome struct {
	Case        Case
	Accepted    bool
	Correct     bool // among accepted
	Deferred    bool
	TokensOut   int
	Margin      float64
	Escalations int
}

Outcome is the per-case eval result.

func Run

func Run(ctx context.Context, r Runner, cases []Case) []Outcome

Run replays each gold case through r and grades the accepted ones.

type OutcomeCounts added in v0.206.0

type OutcomeCounts map[string]int

OutcomeCounts is the number of attempts of each outcome class on one arm, every class present (a zero is a zero, not an absent key).

type PowerNote added in v0.206.0

type PowerNote struct {
	HalfWidth   float64   `json:"half_width"`
	Projected   Projected `json:"projected"`
	TasksNeeded TaskCount `json:"tasks_needed"`
	TasksToAdd  TaskCount `json:"tasks_to_add"`
}

PowerNote says how far the corpus is from a conclusive size. It adds no statistic: it is the half-width of the main interval read three ways (the power note of rule R4).

type PreReg added in v0.206.0

type PreReg struct {
	Mode             string             `json:"mode"`
	Primary          PreRegPrimary      `json:"primary"`
	Judge            Judge              `json:"judge"`
	Efficiency       []PreRegEfficiency `json:"efficiency"`
	MinPairs         int                `json:"min_pairs"`
	BootstrapB       int                `json:"bootstrap_b"`
	Seed             *int64             `json:"seed"`
	MaxExcludedShare *float64           `json:"max_excluded_share"`
	HeldOut          []string           `json:"held_out"`
	Tasks            []string           `json:"tasks"`
}

PreReg is what the operator writes before freezing. Optional fields are pointers (or zero) so that "left out" and "explicitly zero" differ: a left-out field takes its default, an explicit unsupported value is refused.

type PreRegEfficiency added in v0.206.0

type PreRegEfficiency struct {
	Name          string `json:"name"`
	Class         string `json:"class"`
	LowerIsBetter *bool  `json:"lower_is_better"`
}

PreRegEfficiency: LowerIsBetter left out is true.

type PreRegPrimary added in v0.206.0

type PreRegPrimary struct {
	Name           string    `json:"name"`
	Class          string    `json:"class"`
	Margin         *float64  `json:"margin"`
	HigherIsBetter *bool     `json:"higher_is_better"`
	Range          []float64 `json:"range,omitempty"`
}

PreRegPrimary: Margin left out takes the class default; HigherIsBetter left out is true (the only supported value for now).

type Primary added in v0.206.0

type Primary struct {
	Name  string `json:"name"`
	Class string `json:"class"`
	// Margin is the non-inferiority margin m (> 0); 0 in superiority mode, where it is ignored.
	Margin         float64 `json:"margin"`
	HigherIsBetter bool    `json:"higher_is_better"`
	// Range is [lo, hi], the closed score range of a custom primary class; required for it and
	// absent for the others, whose range the class fixes.
	Range []float64 `json:"range,omitempty"`
}

Primary is the metric the verdict is about.

type Projected added in v0.206.0

type Projected struct {
	N16  float64 `json:"16"`
	N24  float64 `json:"24"`
	N120 float64 `json:"120"`
}

Projected is the half-width of the main interval projected to 16, 24 and 120 usable tasks.

type RCPoint

type RCPoint struct {
	Confidence float64
	Correct    bool
}

RCPoint is one (confidence, correctness) observation for selective prediction.

type Refusal added in v0.206.0

type Refusal struct{ Reason string }

Refusal is the error type of every refusal in the gate: a freeze that would write a pre-registration the gate cannot honour, a baseline that is not the frozen bytes, an input the gate will not judge. A refusal never carries a verdict. The gate verb maps it to exit 2.

func (*Refusal) Error added in v0.206.0

func (r *Refusal) Error() string

type Report

type Report struct {
	Task             string  `json:"task"`
	N                int     `json:"n"`
	Accepted         int     `json:"accepted"`
	AcceptedCorrect  int     `json:"accepted_correct"`
	Deferred         int     `json:"deferred"`
	AccuracyAccepted float64 `json:"accuracy_accepted"` // correct / accepted
	DeferRate        float64 `json:"defer_rate"`
	TokensOut        int     `json:"tokens_out"`
	AccPer1kTok      float64 `json:"acc_per_1k_tok"` // correct / (tokensOut/1000)
}

Report aggregates outcomes for one task.

type ResultStamps added in v0.206.0

type ResultStamps struct {
	Incumbent Stamps `json:"incumbent"`
	Candidate Stamps `json:"candidate"`
}

ResultStamps are the stamps of the two runs.

type Runner

type Runner interface {
	Run(ctx context.Context, req core.Request) core.Result
}

Runner is satisfied by *pipeline.Pipeline (Run(ctx, req) core.Result).

type Stamps added in v0.206.0

type Stamps struct {
	HarnessBuildSHA256 string `json:"harness_build_sha256"`
	SeatConfigSHA256   string `json:"seat_config_sha256"`
	EngineBuild        string `json:"engine_build"`
}

Stamps pin the run that produced an arm's scores: results from different stamps are different eras and are never compared. They come from the arms, not from the gate binary.

type Task added in v0.206.0

type Task struct {
	ID       string    `json:"id"`
	Attempts []Attempt `json:"attempts"`
}

Task is one declared task and the attempts made at it on one arm.

type TaskCount added in v0.206.0

type TaskCount struct {
	N         int
	Unbounded bool
}

TaskCount is a number of tasks, or the word "unbounded" when no finite number follows from the interval (superiority with no observed effect, fewer than two pairs).

func (TaskCount) MarshalJSON added in v0.206.0

func (c TaskCount) MarshalJSON() ([]byte, error)

MarshalJSON writes the number, or the word "unbounded".

func (*TaskCount) UnmarshalJSON added in v0.206.0

func (c *TaskCount) UnmarshalJSON(b []byte) error

UnmarshalJSON reads what MarshalJSON writes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL