evals

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 13 Imported by: 1 module, 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 evals is the step-by-step layer under the benchmark suites.

A suite in bench/ plays a whole recording and scores the outcome. That is the end-to-end layer, and it answers "did the task work". It is slow, it is noisy at small n, and when it fails it does not say which decision went wrong - a task scored "no tool call" may have failed at perception, at the hand-off, at the reasoner, or at none of them.

A case here freezes everything up to one decision and asks only for the next observable action. It runs in milliseconds against one provider rather than minutes against a whole stack, so a change can be judged before it is shipped, and a failure names the boundary it happened at.

Two rules keep these honest, and both come from the same place: an evaluation that scores one canonical answer measures conformity rather than correctness.

  • A case declares an *acceptable set*, not an answer. Asking the user, handing the turn on, and refusing a dangerous action can all be right at the same boundary, and a case that admits one of them is testing a preference.
  • A case may declare *forbidden* actions, and those are vetoes. Claiming a result nobody supplied is not a low score, it is a failure whatever else the turn did well: the user acts on the claim.

Index

Constants

View Source
const (
	ActStaySilent   = Action(interaction.ActStaySilent)
	ActSpeakThrough = Action(interaction.ActSpeakThrough)
	ActAnswer       = Action(interaction.ActAnswer)
	ActInterrupt    = Action(interaction.ActInterrupt)
	ActActSilently  = Action(interaction.ActActSilently)
	ActKeepSpeaking = Action(interaction.ActKeepSpeaking)
	ActStopSpeaking = Action(interaction.ActStopSpeaking)
	ActUnparsed     = Action("unparsed")
)

The acts an interaction model may choose, derived from the runtime's own vocabulary rather than restated here. Restating them once already produced a silent divergence, and a scoring layer that disagrees with the thing it scores about what an answer means is worse than no scoring layer.

Variables

This section is empty.

Functions

func FormatTimelines

func FormatTimelines(outcomes []TimelineOutcome) string

FormatTimelines renders a set of replayed timelines, failures first.

func InteractionSituations

func InteractionSituations() map[string]interaction.Situation

InteractionSituations exposes the state behind each case by name, so a runner that needs the structure rather than the rendered block can recover it without the cases being declared twice.

Types

type Action

type Action string

Action is one observable thing a model did at a boundary.

const (
	ActionHandOn    Action = "hand-on"    // left the turn to the reasoning half
	ActionFinish    Action = "finish"     // declared the turn complete
	ActionAsk       Action = "ask"        // asked the user for something
	ActionDraft     Action = "draft"      // proposed a tool call
	ActionContinue  Action = "continuing" // judged the speaker unfinished
	ActionFinished  Action = "finished"   // judged the speaker done
	ActionFabricate Action = "fabricate"  // stated a result nobody supplied
	ActionWrongID   Action = "wrong-id"   // altered a user-supplied identifier
	ActionSilent    Action = "silent"     // produced nothing
	ActionOverclaim Action = "overclaim"  // said more than the tool result said

	ActionNoContinuer Action = "no-continuer" // stayed silent while they talked
	ActionAcknowledge Action = "acknowledge"  // said an ordinary continuer
	ActionAffirm      Action = "affirm"       // said a continuer that agrees

	ActionOverlapDirected    Action = "directed"    // read the overlap as taking the floor
	ActionOverlapBackchannel Action = "backchannel" // read it as showing they are listening
	ActionOverlapSide        Action = "side"        // read it as addressed to somebody else
	ActionOverlapAmbiguous   Action = "ambiguous"   // too little to read
)
const (
	ActNoPolicy        Action = "none"
	ActPinTurn         Action = "pin-turn"
	ActPinConversation Action = "pin-conversation"
	ActRevoke          Action = "revoke"
	ActUnrecognisedPin Action = "unrecognised"
)

Actions at the extraction boundary.

func ParseAct

func ParseAct(text string) Action

ParseAct reads an act out of whatever a model returned.

It is deliberately forgiving about surrounding text and deliberately strict about the vocabulary: an unrecognised answer becomes ActUnparsed rather than a guess, because a decision layer that silently invents an act when the model said something else is one that cannot be measured.

type BackchannelRunner

type BackchannelRunner struct {
	Policy interaction.Backchannel
	Label  string
	// contains filtered or unexported fields
}

BackchannelRunner asks the policy whether to say a continuer.

The counter matters. The policy refuses to answer twice about one revision, and refuses again inside its minimum interval - both are arithmetic the runtime wants and neither is what these cases measure. Handing every case the same revision and the same clock made the policy answer the first one and short-circuit the rest, which reads as a model that never speaks and is really a harness that never asked. Every case gets its own revision and a clock far enough on that the interval has passed.

func (*BackchannelRunner) Decision

func (runner *BackchannelRunner) Decision() Decision

func (*BackchannelRunner) Name

func (runner *BackchannelRunner) Name() string

func (*BackchannelRunner) Observe

func (runner *BackchannelRunner) Observe(ctx context.Context, item Case) Observation

type Case

type Case struct {
	Name     string
	Decision Decision
	// Context is what the model is given: the conversation so far, or the
	// partial transcript and the silence, depending on the boundary.
	Context string
	// Accept is the set of actions that are right here. Any one of them
	// passes; a case with a single-element Accept is asserting there is
	// genuinely one right answer, which is rare.
	Accept []Action
	// Forbid vetoes. A forbidden action fails the case whatever else happened.
	Forbid []Action
	// Note explains what the case is really testing, and appears in reports.
	Note string
}

Case is one frozen decision.

func BackchannelCases

func BackchannelCases() []Case

BackchannelCases freeze the decision to say "mm-hm" while somebody is talking.

It is a model-backed decision like the others and was the only one with no cases of its own, which is how it stayed unmeasured while everything around it was tuned. It deserves them for the same reason the interaction model does: it is the other way the agent can make a noise during somebody else's turn, and it is governed by nothing the interaction model decides.

Its two failures are not worth the same, and the asymmetry runs the opposite way to the interaction model's. A missing continuer costs a little warmth and nothing else - the speaker carries on, and nothing they said is lost. A continuer in the wrong place lands on top of somebody's sentence, and the worst placements are exactly the ones a helpful model reaches for: after a question, which needs an answer rather than a noise, and during a silence that was asked for. So restraint is the common answer here, and the cases are weighted that way deliberately.

func HandOffCases

func HandOffCases() []Case

HandOffCases freeze the boundary every tool call in the cascade depends on.

The voice is the only phase the user hears and the only one that cannot act, so a turn it declares finished is a turn where nothing happens. These cases ask what it does with one user utterance and nothing else.

The acceptable sets are wider than they look. Asking for a detail that is genuinely absent is a real answer, and so is handing on without asking; what is never right is finishing a turn that promised work, or stating a delivery status nobody supplied.

func IdentifierCases

func IdentifierCases() []Case

IdentifierCases freeze the reasoner at the moment it has to act on something a person spelled out loud.

A recogniser writes an identifier the way it was said, so "A-B-C-one-two- three" reaches the trajectory as "AB, C,1,2,3" or "a b c one two three". The separators are the recogniser's, the characters are the caller's, and the difference between removing the first and inventing the second is somebody else's order.

These are graded strictly on purpose. There is one right value here, unlike the hand-off boundary where several actions are reasonable: a lookup against the wrong record is not a partial success.

func InteractionCases

func InteractionCases() []Case

func OverlapCases

func OverlapCases() []Case

OverlapCases freeze the moment somebody talks over the agent.

The agent is mid-sentence and a second voice arrives. What that voice is doing decides whether the agent stops: a person taking the floor should be given it at once, and a person saying "mm-hm" should be talked straight through, because stopping for a continuer is how an agent becomes impossible to hold a conversation with. The barge-in policy makes that call; this is the evidence it makes it from, and it was the last model-backed decision in the system with no cases of its own.

The two failures cost differently and both are bad. Reading a real interruption as a continuer talks over somebody who wanted the floor, and they have to say it again louder. Reading a continuer as an interruption stops the agent for a noise that meant "go on", which is the failure that makes the whole arrangement feel broken - the agent that cannot finish a sentence. Neither is recoverable by a later layer, so the cases are weighted evenly and both directions are vetoed.

func ResultCases

func ResultCases() []Case

ResultCases freeze the voice at the moment a tool has come back.

This is where a caller is most likely to be misled and least likely to notice. The agent has genuinely done the work, so it sounds authoritative, and a result of {"status":"ok"} becomes "your order is on its way and scheduled for delivery" - a delivery claim, a routing claim and a schedule claim, none of which the tool said. The caller then plans their day around it.

The veto is not "did it invent a result" but "did it say more than the result said", which is the failure that actually happens: embellishment reads as helpfulness and passes every check that looks for a missing tool call.

func StandingInstructionCases

func StandingInstructionCases() []Case

StandingInstructionCases freeze the pass that decides what gets pinned.

Two distinctions carry the suite, and both are ones a careless pass gets wrong in a way nobody notices for weeks.

A task is not a policy. "Finish the report by Friday" and "stop me if I get a date wrong" have the same grammatical shape and nothing else in common: a pass that pins the first fills the policy list with entries that never apply and never expire, and every one of them is prompt the deciding model has to read on every tick forever.

Scope is not decoration. "Don't cut me off" governs a conversation and "wait, I have more to say" governs a few seconds. Give the second the lifetime of the first and the agent is permanently mute, months later, for reasons nobody will connect to the sentence that caused it.

type Decision

type Decision string

Decision is the boundary a case is frozen at. Each names one question the runtime asks a model, so a failing case says which question was answered wrongly rather than that a conversation went badly.

const (
	// DecisionHandOff is the voice deciding whether the turn needs the
	// reasoning half. Every tool call in the cascade depends on it.
	DecisionHandOff Decision = "hand-off"
	// DecisionProjection is the turn-projection model deciding whether a
	// person who has gone quiet has finished.
	DecisionProjection Decision = "projection"
	// DecisionIdentifier is the reasoner reassembling an identifier a
	// recogniser wrote down the way it was spoken.
	DecisionIdentifier Decision = "identifier"
	// DecisionInteraction is the model that decides what the agent does in an
	// instant rather than what it says. It is the only boundary here whose
	// correct answer usually is to do nothing, which is why its cases are
	// scored as two numbers rather than one.
	DecisionInteraction Decision = "interaction"
	// DecisionStandingInstruction is the pass that notices when someone has
	// set an interaction policy out loud - wait, let me finish; tell me the
	// moment it lands - and pins it where a truncated window cannot repeal it.
	DecisionStandingInstruction Decision = "standing-instruction"
	// DecisionResult is the voice reporting what a tool came back with. It is
	// where a caller is most likely to be misled and least likely to notice:
	// the work really was done, so the sentence sounds authoritative whatever
	// it says.
	DecisionResult Decision = "result"
	// DecisionBackchannel is the policy deciding whether to say "mm-hm" while
	// somebody is still talking. It is the other way the agent can make a
	// noise during another person's turn, and the interaction model governs
	// none of it.
	DecisionBackchannel Decision = "backchannel"
	// DecisionOverlap is the classifier that reads what a second voice
	// arriving over the agent is doing. It decides whether the agent gets to
	// finish its sentence.
	DecisionOverlap Decision = "overlap"
)

type HandOffRunner

type HandOffRunner struct {
	Provider continuation.Provider
	Store    *trajectory.Store
	Label    string
}

HandOffRunner asks one fast provider what it does with a turn.

func (HandOffRunner) Decision

func (runner HandOffRunner) Decision() Decision

func (HandOffRunner) Name

func (runner HandOffRunner) Name() string

func (HandOffRunner) Observe

func (runner HandOffRunner) Observe(ctx context.Context, item Case) Observation

Observe runs the real fast instruction through the real continuation runner, so what is measured is what ships rather than a reconstruction of it.

type IdentifierRunner

type IdentifierRunner struct {
	Provider continuation.Provider
	Label    string
}

IdentifierRunner asks one reasoner to act on a spoken identifier.

func (IdentifierRunner) Decision

func (runner IdentifierRunner) Decision() Decision

func (IdentifierRunner) Name

func (runner IdentifierRunner) Name() string

func (IdentifierRunner) Observe

func (runner IdentifierRunner) Observe(ctx context.Context, item Case) Observation

type InteractionRunner

type InteractionRunner struct {
	Provider continuation.Provider
	Label    string
}

InteractionRunner asks one model what the agent should do in an instant.

func (InteractionRunner) Decision

func (runner InteractionRunner) Decision() Decision

func (InteractionRunner) Name

func (runner InteractionRunner) Name() string

func (InteractionRunner) Observe

func (runner InteractionRunner) Observe(ctx context.Context, item Case) Observation

type Moment

type Moment struct {
	// AtMS is when this instant occurs, measured from the start of the case.
	AtMS  int
	State interaction.Situation
}

A timeline case scores when a decision happens, not only what it is.

A frozen instant cannot catch the failures that matter most about timing. A model that endpoints correctly but nine hundred milliseconds late scores full marks on every static case and produces a conversation nobody wants to have; one that answers during a mid-thought pause scores full marks on the instant after the pause ends. Both are visible only against a clock.

Timelines are replayed as a series of instants rather than in real time. The model is asked at each one and the answers are read as a sequence, which is what makes this cheap enough to run on every change: the wall clock is simulated, so a two-second pause costs two model calls rather than two seconds.

type Observation

type Observation struct {
	Actions []Action
	Text    string
	Elapsed time.Duration
	Err     error
}

Observation is what a runner saw the model do.

type Outcome

type Outcome struct {
	Case
	Observation
	Passed  bool
	Vetoed  bool
	Because string
}

Outcome is one case scored.

func Score

func Score(item Case, observed Observation) Outcome

Score applies the acceptable set and the vetoes.

type OverlapRunner

type OverlapRunner struct {
	Policy interaction.OverlapClassifier
	Label  string
	// contains filtered or unexported fields
}

OverlapRunner asks the classifier what the overlapping speech is.

func (*OverlapRunner) Decision

func (runner *OverlapRunner) Decision() Decision

func (*OverlapRunner) Name

func (runner *OverlapRunner) Name() string

func (*OverlapRunner) Observe

func (runner *OverlapRunner) Observe(ctx context.Context, item Case) Observation

type PolicyInteractionRunner

type PolicyInteractionRunner struct {
	Model *interaction.InteractionModel
	Label string
	// Situations recovers the state a case was built from. Cases carry their
	// rendered block so that what is asserted is what a model was shown, and
	// this runner needs the structure back to ask for the right act set.
	Situations map[string]interaction.Situation
}

PolicyInteractionRunner measures the decision the way the runtime takes it.

A boundary measured under different settings is a different boundary, and these two paths differ in ways that matter: the shipping path constrains decoding to the enumerated acts, sizes the output budget to the longest exact label, and turns reasoning off at the endpoint. Measuring free generation instead would score a prompt nobody runs.

func (PolicyInteractionRunner) Decision

func (runner PolicyInteractionRunner) Decision() Decision

func (PolicyInteractionRunner) Name

func (runner PolicyInteractionRunner) Name() string

func (PolicyInteractionRunner) Observe

func (runner PolicyInteractionRunner) Observe(ctx context.Context, item Case) Observation

type Report

type Report struct {
	Runner   string
	Decision Decision
	Outcomes []Outcome
}

Report is a run of one runner over a set of cases.

func Run

func Run(ctx context.Context, runner Runner, cases []Case) Report

Run scores every case, in order, and never stops at the first failure: the point of a step-by-step layer is to see the whole shape of a regression.

func (Report) Format

func (report Report) Format() string

Format renders a report for a terminal, failures first.

Failures first because a passing case is not what anybody reads a report for, and a format that buries the three broken ones under thirty green lines is a format that gets skimmed.

func (Report) Summary

func (report Report) Summary() Summary

type ResultRunner

type ResultRunner struct {
	Provider continuation.Provider
	Label    string
}

ResultRunner asks the voice to report one tool result.

func (ResultRunner) Decision

func (runner ResultRunner) Decision() Decision

func (ResultRunner) Name

func (runner ResultRunner) Name() string

func (ResultRunner) Observe

func (runner ResultRunner) Observe(ctx context.Context, item Case) Observation

type Runner

type Runner interface {
	Name() string
	Decision() Decision
	Observe(context.Context, Case) Observation
}

Runner drives one boundary against one provider.

type StandingInstructionRunner

type StandingInstructionRunner struct {
	Provider continuation.Provider
	Label    string
}

StandingInstructionRunner asks one model what should be pinned.

func (StandingInstructionRunner) Decision

func (runner StandingInstructionRunner) Decision() Decision

func (StandingInstructionRunner) Name

func (runner StandingInstructionRunner) Name() string

func (StandingInstructionRunner) Observe

func (runner StandingInstructionRunner) Observe(ctx context.Context, item Case) Observation

type Summary

type Summary struct {
	Total, Passed, Vetoed, Errored int
	Slowest                        time.Duration
	// Acting and Restraint split the cases by what the right answer was.
	//
	// A single pass rate hides the only failure mode that matters at a
	// boundary whose commonest correct answer is to do nothing: a model that
	// always acts and a model that never acts can post identical totals, and
	// they are opposite bugs needing opposite fixes. Measured separately they
	// are impossible to confuse, and the first two runs of the interaction
	// suite were exactly that pair.
	ActingTotal, ActingPassed       int
	RestraintTotal, RestraintPassed int
}

Summary counts what happened, with vetoes separated from ordinary failures because they mean something different: a veto is a turn that would have misled somebody.

type TimelineCase

type TimelineCase struct {
	Name    string
	Note    string
	Moments []Moment
	// Expect is the act that should appear, and the window it must appear in.
	// A zero Expect asserts only that nothing in Forbid ever happens.
	Expect      Action
	NotBeforeMS int
	NotAfterMS  int
	// Forbid names acts that must not appear, and ForbidUntilMS bounds when
	// the prohibition applies - zero meaning the whole timeline.
	//
	// The bound matters. A case that forbids answering during a mid-thought
	// pause has nothing to say about the moment after the speaker resumes and
	// completes their sentence; scoring that moment with the same rule marks a
	// model wrong for having waited correctly.
	Forbid        []Action
	ForbidUntilMS int
	// Monotone asserts that once Expect has appeared it never reverts to an
	// act in Forbid. Evidence only accumulates as a pause lengthens, so a
	// decision that flips back is one that was not reading the clock.
	Monotone bool
}

TimelineCase is one scripted stretch of conversation.

func TimelineCases

func TimelineCases() []TimelineCase

TimelineCases script the behaviour that only shows up against a clock.

type TimelineOutcome

type TimelineOutcome struct {
	TimelineCase
	Acts      []Action
	FirstAtMS int
	Passed    bool
	Because   string
}

TimelineOutcome is one timeline replayed.

func RunTimeline

func RunTimeline(ctx context.Context, runner Runner, item TimelineCase) TimelineOutcome

RunTimeline replays one case and scores when things happened.

Jump to

Keyboard shortcuts

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