mixle.experimental.typed_runtime.benchmark module¶
Time-to-target traces and negative-control failure receipts.
- class BenchmarkPoint(step, objective, elapsed_seconds, operation_count=0, model_evaluations=0, bytes_read=0, bytes_written=0, collective_bytes=0, peak_memory_bytes=0, maximum_staleness_steps=0, accepted_updates=0, rejected_updates=0, work_counter_semantics=CounterSemantics.CUMULATIVE, peak_memory_semantics=CounterSemantics.HIGH_WATER_MARK, staleness_semantics=CounterSemantics.HIGH_WATER_MARK)[source]
Bases:
objectOne cumulative quality/work observation from an actual run.
- Parameters:
step (int)
objective (float)
elapsed_seconds (float)
operation_count (int)
model_evaluations (int)
bytes_read (int)
bytes_written (int)
collective_bytes (int)
peak_memory_bytes (int)
maximum_staleness_steps (int)
accepted_updates (int)
rejected_updates (int)
work_counter_semantics (CounterSemantics)
peak_memory_semantics (CounterSemantics)
staleness_semantics (CounterSemantics)
- class FailureKind(*values)[source]
Bases:
StrEnumFailure families used by Stage-0 negative controls.
- class FailureLedger(receipts=())[source]
Bases:
objectAppend-only in-memory ledger for benchmark failure oracles.
Append-only in fact, not only in the docstring (MXR-080-1905).
receiptswas a public list on a dataclass, so a ledger holding one failed oracle answeredall_oracles_passed: Falseuntilledger.receipts.clear(), after which it answeredTrue– the negative control it was recording had been erased through the very attribute that reports it, and the duplicate-case check inrecord()was bypassable the same way.receiptsis a detached tuple now.- Parameters:
receipts (Sequence[FailureReceipt])
- property receipts: tuple[FailureReceipt, ...]
Every recorded failure-oracle receipt, in the order recorded.
- record(receipt)[source]
Record one uniquely identified case.
- Parameters:
receipt (FailureReceipt)
- Return type:
None
- property failed_oracles: tuple[FailureReceipt, ...]
Expected failures missed or clean controls falsely flagged.
- class FailureReceipt(benchmark_id, case_id, kind, oracle, expected_failure, detected, observed, details=<factory>)[source]
Bases:
objectOutcome of one expected or naturally occurring failure case.
- Parameters:
- property oracle_passed: bool
Whether the detector behaved as expected for this case.
- class ObjectiveTarget(name, direction, threshold, tolerance=0.0)[source]
Bases:
objectExplicit quality threshold for a time-to-target benchmark.
- reached(value)[source]
Whether
valuereaches this target within tolerance.
- class TargetDirection(*values)[source]
Bases:
StrEnumWhether reaching a target requires increasing or decreasing a metric.
- class TimeToTargetTrace(benchmark_id, strategy, target, points=())[source]
Bases:
objectMonotone cumulative work trace for one strategy and one target.
Not a dataclass any more (MXR-080-1905):
pointswas a public list, so the chronology and cumulative-counter contract thatrecord()enforces could be walked straight past –trace.points.append(BenchmarkPoint(0, 0.95, 0.0))after a step-1 point produced a trace whose steps ran 1, 0 and whose elapsed times ran 1.0, 0.0, andachievedthen reported True from that out-of-order point.pointsis a read-only view now andrecord()is the only way in. The constructor signature is unchanged.- Parameters:
- property points: tuple[BenchmarkPoint, ...]
The recorded observations, oldest first, as a detached tuple.
- record(point)[source]
Append a cumulative point after checking chronology and counters.
- Parameters:
point (BenchmarkPoint)
- Return type:
None
- property first_target_point: BenchmarkPoint | None
First observed point that reaches the declared quality target.
- property achieved: bool
Whether this trace reaches its declared target.