Documentation
¶
Overview ¶
Package experiment defines the portable contract, arm, sample, and receipt types shared by the mlxperf optimization arena and its measurement harnesses.
A Receipt is the canonical result of one measured experiment. It binds a Workload identity, the raw Sample records in execution order, every typed Refusal raised while measuring or analyzing, and a final verdict. Receipts are sealed with a SHA-256 digest over their canonical JSON form so a receipt cannot be edited after the fact without detection.
The zero value of every type here is not meaningful; construct receipts by measuring an experiment (see github.com/tmc/apple/x/armbench) or by decoding a sealed receipt with ParseReceipt, which verifies the digest.
Index ¶
Constants ¶
const ( // VerdictFaster means the candidate beat the baseline beyond the noise // measured by the duplicate control. VerdictFaster = "faster" // VerdictSlower means the candidate lost to the baseline. VerdictSlower = "slower" // VerdictNoWinner means no performance conclusion is possible: the // claimed delta does not exceed the control gap. VerdictNoWinner = "no-winner" // VerdictRefused means a gate refused the experiment; there is no score. VerdictRefused = "refused" )
Receipt verdicts.
const ( RefusalUnequalWork = "unequal-work" RefusalCorrectnessFailed = "correctness-failed" RefusalMissingControl = "missing-duplicate-control" RefusalImpossibleByteRate = "impossible-byte-rate" RefusalContaminatedHost = "contaminated-host" RefusalIdenticalArms = "identical-arms" RefusalInsufficientSamples = "insufficient-samples" RefusalIdentityDrift = "identity-drift" )
Refusal reasons. These are contract, not prose: analysis code switches on them.
const Schema = "mlxperf.receipt/v1"
Schema is the receipt schema identifier written into every receipt.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArmKind ¶
type ArmKind string
ArmKind classifies an arm's role in an experiment.
const ( // ArmBaseline is the immutable reference arm. ArmBaseline ArmKind = "baseline" // ArmCandidate is the arm under test. ArmCandidate ArmKind = "candidate" // ArmDuplicate is an identical duplicate control used to estimate // harness noise. An experiment without one may not conclude performance. ArmDuplicate ArmKind = "duplicate" )
type Receipt ¶
type Receipt struct {
Schema string `json:"schema"`
CreatedAt time.Time `json:"created_at"`
Workload Workload `json:"workload"`
Label string `json:"label,omitempty"`
Samples []Sample `json:"samples"`
Refusals []Refusal `json:"refusals,omitempty"`
Verdict string `json:"verdict"`
Winner string `json:"winner,omitempty"`
Digest string `json:"digest"`
}
Receipt is the canonical result of one measured experiment.
func ParseReceipt ¶
ParseReceipt decodes a JSON-encoded receipt and verifies its schema and digest. A receipt that fails verification is returned alongside the error so callers can retain the tampered evidence.
func (*Receipt) HasRefusal ¶
HasRefusal reports whether a refusal with the given reason was recorded.
type Refusal ¶
Refusal is a typed reason the arena declined to rank or promote. A refusal replaces a score; it never annotates one.
type Sample ¶
type Sample struct {
Arm string `json:"arm"`
Kind ArmKind `json:"kind"`
Round int `json:"round"`
Order int `json:"order"`
Elapsed time.Duration `json:"elapsed"`
WorkUnits int64 `json:"work_units"`
Bytes map[string]int64 `json:"bytes,omitempty"`
Output string `json:"output,omitempty"`
Verdict Verdict `json:"verdict"`
Note string `json:"note,omitempty"`
}
Sample is one measured arm execution with its order and environment observations.
type Workload ¶
type Workload struct {
ID string `json:"id"`
WorkUnits int64 `json:"work_units"`
Bytes map[string]int64 `json:"bytes,omitempty"`
}
Workload identifies what was measured. Any change to identity, work units, or byte accounting creates a new workload; receipts for different workloads are never comparable.