mesh: a cost model that gates must say where it was measured #92
Loading…
Reference in a new issue
No description provided.
Delete branch "mesh/cost-calibration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CostProfilefeeds a joule ceiling, and it had no way to say what operating point its constants came from. Per-token energy is not a property of a backend; it is a property of a backend at an occupancy — fixed per-step overheads amortise across fuller batches and decode's memory traffic is shared, so the same weights on the same silicon cost materially less per token at saturation. Published figures are almost always the saturated ones.At a ceiling, the direction of the error decides everything
A saturation fit applied at low concurrency under-estimates. That is the unsafe direction, and nothing in the type could see it coming.
So the profile records the point it was measured at, and
require_applicable_atrefuses exactly the two cases that under-estimate — an undeclared calibration, and one applied below its measurement point — while permitting the case that over-estimates.The asymmetry is the design. A guard refusing both directions would treat a conservative estimate as equally dangerous as an optimistic one, at a gate where only one of them can overspend. There is a test named for exactly that.
This ships no constants
Calibration.sourcenames the measurement rather than substituting for it — a harness run id, a receipt content-id, anything that resolves to the actual observation. Importing a published coefficient would put an unfalsified number inside a gate, and the only energy-calibration harness in this tree measures Apple silicon, so there is no honest cross-vendor figure to ship. The numbers stay the operator's to measure — the same reasonCostProfileshipped no default profile andBandingScaleships no canonical scale.Two deliberate limits, stated rather than papered over
The type records provenance and does not correct the estimate: scaling a fit across occupancy needs a law this tree has not measured, and inventing one would be the same failure in a new place. A test pins that adding provenance moves no estimate.
It also adds no memory-traffic term. The concurrency dependence is where the gate is actually exposed; a second unmeasured coefficient would not help.
One API break
CostProfilelosesCopy— an owned provenance string cannot beCopy. The alternative, a&'static str, would have locked out exactly the operators who load profiles from configuration. Every dependent is in-workspace (checked, not assumed) and the workspace compiles unchanged.calibrationisOption, andwire()appends only when declared, so a profile without one seals byte-identically to every receipt written before this field existed.Verification
20 test binaries green, 6 new. Includes a test that the existing saturating arithmetic still cannot wrap — a wrapped estimate would come back small, which is the admitting direction.
🤖 Generated with Claude Code