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
- func AnswersAt(outputs []store.Output, stage string) []store.Output
- func Outcomes(a qualitygate.Answer, label string) (verdict, side string)
- func Routes(st *store.Store, log *slog.Logger) server.Routes
- type Answers
- type Arm
- type Band
- type ByConnector
- type ByModel
- type ByPromptVersion
- type Counts
- type Gate
- type Labels
- type Pair
- type Report
Constants ¶
const ( Agreed = "agreed" Disagreed = "disagreed" Unsure = "unsure" )
Outcomes of one comparison.
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
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.
Types ¶
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 ¶
Band is the comparisons whose answer's confidence lies from From up to To, To itself only in the top band.
type ByConnector ¶
ByConnector is the comparisons on the items that one connector sighted.
type ByPromptVersion ¶
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.