accuracy

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 11 Imported by: ? 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 accuracy measures how often the quality gate's and the side gate's answers agree with a person's placement. The label is a person's placement of an item that the gates sent to review first, as store.ReviewPlacement reads it from the item's decisions. A placement that no review came before labels nothing. Each done answer of the quality gate on a labeled item is one comparison, so an item that two prompt versions answered counts once under each.

An arm is the gate's prompt asked of another model, kept at its own stage. Each arm is reported by its model, beside the gate's answers to the same prompt on the same items, so two models compare over one set of labels.

A comparison reads the model's answer as it gave it, before any floor turns a drop or a guess into review, so the counts by confidence band show where a floor would sit. The quality gate's pass agrees with a placement on a side, and its drop with a person's drop. The side gate's guess agrees where it names the person's side, and a person's drop gives it nothing to compare. An unsure answer neither agrees nor disagrees.

Index

Constants

View Source
const (
	Agreed    = "agreed"
	Disagreed = "disagreed"
	Unsure    = "unsure"
)

Outcomes of one comparison.

View Source
const SchemaVersion = 2

SchemaVersion is the version of schemas/gate-agreement.schema.json that a report holds to.

Variables

This section is empty.

Functions

func AnswersAt added in v0.28.0

func AnswersAt(outputs []store.Output, stage string) []store.Output

AnswersAt is each done answer of the gate's prompt among outputs at stage, the quality gate's own or an arm's, that decodes.

func Outcomes added in v0.28.0

func Outcomes(a qualitygate.Answer, label string) (verdict, side string)

Outcomes compares the quality gate's answer a with a person's label: its verdict always, and its side guess only where the label is a side. side is "" where it compares nothing.

func Routes

func Routes(st *store.Store, log *slog.Logger) server.Routes

Routes is the route that reads the gates' agreement with every label.

Types

type Answers

type Answers struct {
	Quality Gate `json:"quality"`
	Side    Gate `json:"side"`
}

Answers is one set of answers measured as each gate reads them.

type Arm

type Arm struct {
	Model string `json:"model"`
	// Items counts the labeled items that the arm answered.
	Items int `json:"items"`
	// Arm is the arm's answers, and Gate the gate's answers to the same
	// prompt versions on the same items.
	Arm  Answers `json:"arm"`
	Gate Answers `json:"gate"`
}

Arm is one model's answers to the gate's prompt, beside the gate's own.

type Band

type Band struct {
	From float64 `json:"from"`
	To   float64 `json:"to"`
	Counts
}

Band is the comparisons whose answer's confidence lies from From up to To, To itself only in the top band.

type ByConnector

type ByConnector struct {
	Connector string `json:"connector"`
	Counts
}

ByConnector is the comparisons on the items that one connector sighted.

type ByModel

type ByModel struct {
	Model string `json:"model"`
	Counts
}

ByModel is the comparisons on one model's answers.

type ByPromptVersion

type ByPromptVersion struct {
	PromptVersion string `json:"prompt_version"`
	Counts
}

ByPromptVersion is the comparisons on one prompt version's answers.

type Counts

type Counts struct {
	Comparisons int `json:"comparisons"`
	Agreed      int `json:"agreed"`
	Disagreed   int `json:"disagreed"`
	Unsure      int `json:"unsure"`
	// Agreement is Agreed over Agreed and Disagreed, and nil where both are 0.
	Agreement *float64 `json:"agreement"`
	// Answers counts each pair of the model's answer and the person's
	// placement.
	Answers []Pair `json:"answers"`
}

Counts is how a set of comparisons came out.

type Gate

type Gate struct {
	// Floor is the confidence at or above which the gate acts on the answer
	// alone: the quality gate's drop, or the side gate's guess.
	Floor           float64           `json:"floor"`
	Overall         Counts            `json:"overall"`
	ByConfidence    []Band            `json:"by_confidence"`
	ByConnector     []ByConnector     `json:"by_connector"`
	ByModel         []ByModel         `json:"by_model"`
	ByPromptVersion []ByPromptVersion `json:"by_prompt_version"`
}

Gate is one gate's agreement overall and broken down.

type Labels

type Labels struct {
	Items    int `json:"items"`
	Personal int `json:"personal"`
	Fleet    int `json:"fleet"`
	Drop     int `json:"drop"`
}

Labels counts the labeled items, by where the person placed each.

type Pair

type Pair struct {
	Answer string `json:"answer"`
	Label  string `json:"label"`
	Count  int    `json:"count"`
}

Pair is how many comparisons paired one answer with one placement.

type Report

type Report struct {
	SchemaVersion int    `json:"schema_version"`
	Labels        Labels `json:"labels"`
	// Unanswered counts the labeled items that hold no done answer of the
	// quality gate, which a quality replay with placed_by person answers.
	Unanswered int  `json:"unanswered"`
	Quality    Gate `json:"quality"`
	Side       Gate `json:"side"`
	// Arms are each arm's answers by model, the first model first.
	Arms []Arm `json:"arms"`
}

Report is what GET /api/v1/gates/agreement answers: schemas/gate-agreement.schema.json.

func Measure

func Measure(records []store.ItemRecords) Report

Measure is the report over records, of which it counts each labeled item.

Jump to

Keyboard shortcuts

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