Specification: simplify Performance Evaluation without breaking Consumers¶
Historical PRF-1 requirements record. The package organization and compact API described here now exist; the status and baseline below record the original planning review. See the descriptive specification for current behavior.
Revision PRF-1. Status: In review; implementation-ready technical detail, not self-approved.
Decision owner: Pierre-Luc Delisle. Implementation owner: assigned Telemetry maintainer or agent.
Source baseline: commit 46e388e2985cc8bb6e206be3e472a0f17a169caa, inspected 2026-09-21.
Delivery: existing Linear issue PL-220; retain its existing project, parent, priority, and relations.
The companion PRF-1 refactoring plan owns the exact source inventory and delivery surfaces; the
PRF-1 verification catalog owns test names, fixture locations, controls, and commands.
Problem Statement¶
A Consumer or maintainer must navigate 41 modules and 354 root exports to understand a package whose ordinary purpose is to evaluate an Algorithm Candidate, compare it with a baseline, assess the evidence, and save an Evaluation Report. The evaluation implementation alone has 3,864 physical lines and combines contracts, execution, reports, comparison, policy, serialization, and persistence. Related responsibilities are spread across other modules that sometimes erase domain types to Any or dynamically import the evaluator's module to avoid cycles.
The package includes valuable but specialized capabilities: paired statistical inference, slices, asynchronous and batch execution, serving-load generation, framework adapters, resource sampling, LLM observations and judges, checkpointing, history, and export. Presenting all of these as one flat interface obscures the ordinary workflow. Simply reducing file count would not resolve the ownership problem, and deleting capabilities could break unknown Consumers.
Solution¶
Provide a small recommended interface for ordinary Performance Evaluation, backed by coherent, acyclic modules that each own a meaningful implementation decision. Preserve the installed public interface and all current behavior through compatibility re-exports. Make advanced capabilities discoverable through explicit execution, analysis, serving, integration, and tooling namespaces.
Do not change the Consumer's evaluation meaning, return contracts, statistics, serialization, lifecycle, privacy guarantees, or optional dependency behavior. Thoroughness still comes from the Consumer's Evaluation Cases, Measurements, statistical design, workload, and Assessment Rules; this change does not claim that every capability is required for every ML system.
Normative requirements and acceptance examples¶
| ID | Requirement | Observable acceptance example |
|---|---|---|
| REQ-01 | Preserve current root exports, direct public module imports, signatures, defaults, class/enum identity, and valid input behavior | An existing Consumer runs unchanged; objects imported through old and canonical routes are identical |
| REQ-02 | Add a documented 22-name recommended interface using existing implementations | A new Consumer performs evaluate, compare, assess, save/load without importing specialist execution or provider interfaces |
| REQ-03 | Give contracts, report codecs, execution, analysis, and effects one owner and enforce an acyclic graph | Pure report parsing does not depend on the evaluator, optional integrations, persistence, or telemetry |
| REQ-04 | Remove dynamic internal domain-type resolution and erased known domain aliases | Compatibility and paired evidence validate the actual canonical EvaluationReport type without importing the legacy evaluation facade |
| REQ-05 | Preserve all supported evidence versions, canonical bytes, digests, validation, and size ceilings | A reviewed v1/v2 report fixture re-encodes identically; its comparison/assessment links and history digest remain valid |
| REQ-06 | Preserve execution order, timing scopes, lifecycle, seed derivations, cleanup, and failure precedence | A reset failure and later teardown failure retain the original primary failure and teardown count |
| REQ-07 | Preserve statistical estimands, paired evidence restrictions, compatibility policies, and assessment outcomes | Repeated-trial evidence cannot satisfy a paired-population confidence gate; undefined relative evidence cannot pass |
| REQ-08 | Preserve slices and every advanced execution mode without inventing a universal result | Missing paired cases remain missing, async retains private outputs, and batch reports whole-batch latency |
| REQ-09 | Preserve payload privacy, finite values, bounded resources, explicit effects, and no-op semantics | Hostile payload/exception markers never appear in serialized evidence, CLI output, or telemetry |
| REQ-10 | Keep optional packages and host/provider work behind explicit calls | Base import and the ordinary workflow succeed while optional package imports and host probes are denied |
| REQ-11 | Preserve persistence, history, checkpoint, rendering, CLI, and export contracts | Existing module/console commands retain stdout, stderr, exit status, atomic writes, and explicit pruning behavior |
| REQ-12 | Keep algorithm evaluation, serving-load evidence, and telemetry capacity distinct | Moving serving code does not let its results satisfy a Collector capacity or model-quality inference contract |
| REQ-13 | Preserve distribution, extras, supported Python range, installed typing and source-independent operation | An installed wheel imports old and new routes and runs a custom Measurement without the source checkout |
| REQ-14 | Supply deterministic, requirement-traced evidence and truthful documentation | Every requirement maps to a verification case; documentation describes only implemented ownership after each slice |
| REQ-15 | Limit this work to architecture and discoverability | No new metric, execution mode, report version, automatic export, feature deletion, or dependency upgrade is introduced |
User Stories¶
- As a Consumer, I want to evaluate an ordinary callable through a small interface, so that I can begin without learning specialized execution machinery.
- As a Consumer, I want my existing imports to keep working, so that upgrading does not require an unrelated migration.
- As a Consumer, I want old and new import routes to expose identical objects, so that type checks and exception handling remain reliable.
- As a Consumer, I want existing constructor and method signatures preserved, so that my call sites remain valid.
- As a Consumer, I want custom structural Measurements to remain supported, so that I retain ownership of evaluation meaning.
- As a Consumer, I want cases, labels, and outputs to remain private, so that published evidence is safe to exchange.
- As a Consumer, I want deterministic ordering and seed handoff preserved, so that comparisons remain reproducible.
- As a Consumer, I want warmup and measured work to remain distinct, so that timing retains its meaning.
- As a Consumer, I want setup, reset, and teardown behavior preserved, so that stateful candidates remain correctly managed.
- As a Consumer, I want partial execution to remain visible, so that missing hard cases cannot make a candidate appear acceptable.
- As a Consumer, I want dataset, candidate, and Measurement identities preserved, so that comparison compatibility is explainable.
- As a Consumer, I want legacy reports to remain readable, so that retained evaluation history stays useful.
- As a Consumer, I want canonical evidence digests preserved, so that report links and pinned baselines stay valid.
- As a Consumer, I want paired comparisons to require real paired observations, so that aggregate reports cannot fabricate uncertainty.
- As a Consumer, I want trial variability distinguished from population uncertainty, so that repeated runs do not exaggerate evidence.
- As a Consumer, I want group-aware resampling preserved, so that correlated cases retain their declared independent units.
- As a Consumer, I want declared slices and their denominators preserved, so that subgroup failures remain visible.
- As a Consumer, I want insufficient evidence classified explicitly, so that absence of evidence never becomes a pass.
- As a Consumer, I want async admission, queue, and invocation timings distinguished, so that concurrency measurements stay interpretable.
- As a Consumer, I want cancellation to clean up owned resources, so that interrupted evaluations do not leave work running unexpectedly.
- As a Consumer, I want batch execution to preserve alignment and whole-batch latency, so that batching does not produce invented per-case timing.
- As a Consumer, I want replay to validate a checkpoint before candidate construction, so that invalid evidence causes no candidate side effect.
- As a Consumer, I want isolated evaluation to preserve bounded JSON IPC and child cleanup, so that failure containment remains predictable.
- As a Consumer, I want optional frameworks loaded only when selected, so that ordinary evaluation remains dependency-free.
- As a Consumer, I want resource and streaming tools described accurately, so that I do not assume they automatically integrate into the evaluator.
- As a Consumer, I want serving-load tools separate from quality evaluation, so that I can choose the evidence appropriate to my deployment question.
- As a Consumer, I want LLM judge decisions to stay private while aggregate evidence remains available, so that evaluations do not leak content.
- As a Consumer, I want report export to remain explicit and bounded, so that evaluation does not unexpectedly contact a provider.
- As a Consumer, I want local history and pruning behavior preserved, so that the refactor cannot delete my baselines.
- As an operator, I want CLI arguments, output, and exit classes preserved, so that automation keeps working.
- As a maintainer, I want records to be independent of candidate execution, so that schema changes do not create runtime import cycles.
- As a maintainer, I want one comparison and one assessment policy owner, so that compatibility and acceptance logic cannot drift between implementations.
- As a maintainer, I want dependency rules checked mechanically, so that future features cannot quietly recreate the current cycles.
- As a maintainer, I want tests to exercise public behavior, so that moving implementation does not require rewriting every test.
- As a maintainer, I want reviewed legacy fixtures and installed-wheel checks, so that apparent source-tree success cannot hide distribution regressions.
- As a reviewer, I want ordered, reversible implementation slices with requirement traceability, so that I can assess each change and stop a regression early.
Implementation Decisions¶
Public interface and migration policy¶
- Keep one telemetry distribution. Preserve all 354 existing root exports, their ordering, and existing documented/direct public import routes. Capture the exact surface before moving code. Include direct framework and ranking exports that are not root exports. Exclude accidentally imported standard-library names and private underscore helpers from the new compatibility promise.
- Introduce the recommended
telemetry.performance.apiinterface containing exactly: EvaluationCase, EvaluationPlan, PerformanceEvaluator, EvaluationReport, EvaluationStatus, Measurement, MeasurementGoal, CaseMeasurement, CorpusMeasurement, latency_measurement, DatasetIdentity, CandidateIdentity, MeasurementIdentity, RandomnessPlan, SliceSpec, ThresholdRule, RegressionRule, Assessment, compare_reports, assess, load_report, and write_report. - Root and recommended imports return the identical canonical objects. Do not introduce alias subclasses, competing enums, wrappers around public functions, or duplicate validators. Canonical modules own class qualified names; retain dataclass field order, defaults, frozen semantics, and existing enum values.
- Remove old implementation imports once source, tests, scripts, and examples use canonical routes. The root package export list remains the supported public surface.
- Update maintained Consumer examples to demonstrate the recommended workflow and explicit advanced namespaces. Delete dedicated compatibility tests and representative legacy examples using old routes. No new universal runner, plugin registry, or all-purpose result type is introduced.
Ownership and dependency contracts¶
- The pure core owns immutable contracts, Measurements, identity and timing declarations, trial records, report models/codecs, slice declarations/planning, uncertainty mechanics, paired private evidence, and checkpoint records/codecs. It imports no evaluator, policy, file store, telemetry runtime, framework, host collector, or provider client.
- Co-locate EvaluationReport validation with its deterministic in-memory encoder/decoder. Preserve to_dict and to_json methods. This avoids a report-model/codec import cycle while giving version dispatch one owner. Filesystem access remains outside that owner.
- Separate identities from collection mechanisms. Environment/provenance records and collection result types are pure; reading host state, distribution metadata, Git, and lock contents remains in explicitly invoked integration collectors. The evaluator can normalize a supplied collection result without importing its collector.
- Contract types do not depend on reports or paired evidence. Reports depend on contract/identity/ slice records. Private paired evidence depends on reports, never the reverse. Checkpoints retain their existing narrow structural report interface and never import candidate orchestration.
- The execution namespace owns adapters and lifecycle, ordinary and paired trial orchestration, replay, async/batch/isolation, resources, and streaming primitives. Merge the small lifecycle wrapper with its adapter owner. Keep a typed private trial-invocation seam; do not add inheritance, dependency containers, or a general execution registry.
- The analysis namespace owns compatibility, comparison, slice inference, and assessment in that dependency order. Compatibility reads reports. Comparison consumes compatibility and private paired evidence. Slice inference consumes comparison. Assessment consumes their validated results. None imports or runs an Algorithm Candidate.
- Put base and advanced Assessment Rules, AssessmentContext, the structural rule contract, aggregate outcomes, AssessmentDocument, and assess under the same assessment owner. Preserve separate descriptive report comparison and paired inference functions under the comparison owner.
- Consolidate slice declaration/membership/capacity planning and summary records under one core owner. Consolidate slice inference/sufficiency/comparison under one analysis owner. Keep numerical resampling and quantile algorithms separate where their mathematical invariants justify it.
- Serving owns its scheduler, conservation counts, and sweeps independently. Tooling owns file persistence, report history, presentation, and CLI composition. Integrations own framework and task adapters, explicit collection, curation handoff, telemetry mapping, and MLflow delivery.
- Implementation modules import canonical owners directly. They never import the root export facade, recommended facade, or legacy forwarding modules. Namespace initializers do not eagerly aggregate unrelated integrations. The optional-package registry remains a standard-library-only leaf; resource/sketch execution may use it. MLflow may read history; history never imports MLflow.
- Replace known domain aliases erased to Any with actual canonical types and generic parameters. Private Consumer payloads remain arbitrary as their existing contracts require. Do not replace deliberate runtime exact-type checks with permissive structural acceptance.
- Extend architecture checks to detect literal dynamic internal imports as well as ordinary and relative imports. Reject internal dynamic type-resolution workarounds and forbidden layer edges. Preserve explicit optional-package loading and trusted Consumer-factory imports. Include typed imports in the acyclic static dependency contract. Test both the checker and the actual package.
Behavior and evidence invariants¶
- All evaluator entry points preserve signatures, validation-before-effects, bounded work, seed streams, callback count/order, failure isolation, fail-fast behavior, timestamps, and timing scopes. An ordinary callable does not acquire adapter lifecycle or controlled-determinism claims.
- Preserve the difference between per-invocation adapter sessions and the lifecycle evaluator's one warmed session. Setup success controls teardown ownership; reset occurs once per trial; teardown never masks the original failure. Preserve the current async per-item lifecycle and cooperative cancellation contract without silently changing it to a shared warmed session.
- Preserve paired alignment, seeded candidate ordering, peer invocation despite failure, and incomplete/unsupported evidence states. Preserve batch collate/predict/split and mask/cardinality checks. Async, batch, resources, and streaming remain their existing standalone contracts; no implicit conversion to a complete EvaluationReport or new scorer integration is added.
- Preserve the default headline median of trial scores and deterministic bootstrap of trial variability. Paired population intervals require complete aligned private evidence, shared resamples, Consumer aggregation, and declared independent units. Preserve group integrity, oriented effects, resampled relative ratios, undefined denominators, and uncertainty provenance.
- Preserve compatibility diagnostic ordering, reason codes, severity, legacy exception precedence, strict-identity/provenance options, and quality versus timing profiles. Unknown evidence remains unknown. Inclusive thresholds, evidence links, non-inferiority tolerance, and pass/fail/inconclusive semantics do not change. Partial or failed required execution cannot pass.
- Preserve report-v1 and report-v2, every implemented nested evidence variant, comparison-v1, assessment-v1, checkpoint-v1, and existing standalone serving/LLM documents. No schema identifier, capability flag, omission rule, deterministic JSON encoding, or digest input changes. A fixed valid document must retain canonical bytes, not merely equivalent parsed values.
- Preserve all finite-number, enum, label, count, timestamp, private-data, and byte-bound validation. Report/comparison documents remain capped at 16 MiB; checkpoint/assessment documents at 1 MiB. Unknown fields/versions and unsupported inference capabilities retain existing rejection behavior. Do not unify validators whose accepted values or rejection categories differ.
- Filesystem wrappers delegate schema decisions to the owning codec and preserve existing atomic replacement, cleanup, directory creation, newline, exception, and return-value behavior. The history store keeps digest-derived paths, verified reads, quotas, pinning, and explicit pruning. Preview never mutates; export never silently deletes or updates a baseline.
- Replay checks identity/counts before invoking the factory, skips completed trials, restarts only absent trials from their declared seed including warmups, and retains current private-slice restrictions. A completed checkpoint does not invoke the factory. Spawned isolation keeps bounded JSON IPC, deadline cleanup, and the distinction between containment and a security sandbox.
- Optional imports, host collection, threads, processes, candidate work, filesystem writes, network calls, provider lookup, and telemetry runtime construction remain absent at import time. Disabled telemetry adapters remain no-ops. LLM private decisions/payloads and provider errors remain private; judge reservations, limits, retries, and stream cancellation retain their current contracts.
- MLflow continues to export only its closed metadata projection through an injected client, with bounded attempts/deadline and truthful indeterminate acknowledgements. No report upload or automatic remote retry beyond current semantics is introduced.
- Preserve CLI console and module invocation, subcommands, flags, factory contract, machine JSON, bounded safe stderr, and exit classifications. Loading report/history/policy data never executes report-controlled imports. Preserve escaped Markdown and standalone semantic HTML presentation.
Delivery order and completion criteria¶
- Execute nine slices in order: characterize the existing interface/evidence; extract pure core; consolidate paired/comparison/assessment ownership; extract evaluator/trial orchestration; group advanced execution and serving; group optional integrations; consolidate persistence and tooling; introduce the recommended interface and enforce the final graph; qualify the installed wheel and synchronize documentation. Each slice depends on the previous slice and removes superseded root routes after their callers move. Exact surfaces and exit evidence are in the companion plan.
- Preserve current package name, mandatory dependency count of zero, extras and version ranges, supported Python 3.12–3.14 range, inline typing marker, and canonical CLI entry-point contract. Increment the Consumer Integration contract once when the additive public interface lands, from inspected 34 to 35 if still current, or to the next value if concurrent approved work advanced it. No unrelated platform, report, dependency, or Collector version change.
- No stored-data migration is required. Roll back a failing slice with a normal reviewed revert; keep evidence and baselines. Coordinate Consumer changes before any rollback. No automatic deletion or publication.
- Completion requires passing applicable focused, static, unit, integration, build and clean-wheel smoke checks, supported-matrix CI evidence when available, all removed root imports absent, type-erasure/cycle removal, and updated authoritative inventory. Report missing checks explicitly. Do not turn local checks into claims about hosted providers, real accelerators, or production capacity.
Testing Decisions¶
- Prefer the existing public evaluate → compare → assess → save/load workflow as the primary behavioral seam. Complement it with public execution/lifecycle, import/typing, installed CLI, and serialized evidence seams where the primary workflow cannot prove the contract. These proposed seams were presented to the user; no confirmation is claimed in PRF-1.
- A good test proves an independently specified outcome or forbidden effect, using deterministic synthetic cases and real pure collaborators. Do not assert private helper names or reproduce the implementation's algorithm as the expected result. Architecture/import checks intentionally inspect structure because that structure is an explicit acceptance requirement.
- Preserve and reuse existing custom Measurement, failure isolation, report round-trip, paired difference, resampling, slice, compatibility, assessment-status, lifecycle, resume, async, serving, resource, framework, privacy, presentation, CLI, and installed-package tests as prior art.
- Capture a reviewed legacy export/signature/enum/dataclass manifest and safe fixed-version JSON fixtures before relocation. Fixtures include v1; minimal v2; supported provenance, execution-v1, execution-v2 and slice variants; incomplete evidence; comparison and assessment links; checkpoints. Use literals and fixed timestamps; do not regenerate expected bytes during the test.
- Prove object identity across import routes and type-check a custom structural Measurement and Assessment Rule against the installed public annotations. Invalid typed examples must fail for the intended reason; mere package-wide mypy success does not prove the Consumer typing contract.
- Characterize exact callback order/count, warmup exclusion, peer invocation on failure, private alignment, seeded ordering, and completed-checkpoint factory avoidance. Control clocks, random seeds, and concurrency at real input/OS/adapter seams; do not add sleep-based cancellation tests.
- Validate paired numerical outcomes with hand-computable or reviewed independent oracles. Reject fake pairing from reports, trial/population relabeling, split resampling groups, dropped hard cases, wrong units, incompatible evidence links, and favorable substitutes for unavailable values.
- Test import effects in a fresh process with optional framework/provider imports and collection effects forbidden. Exercise both the old and recommended interfaces. Keep independent installed-wheel tests with the source checkout unavailable; do not infer this from source-tree imports.
- Exercise adversarial values through public readers and adapters: unknown keys/versions, non-finite values, byte/count bounds, hostile private strings, malformed counts, and mismatched capability flags. Check emitted bytes, safe diagnostics, reports, and telemetry for absence of private markers.
- Inject filesystem replacement failure and verify the previous artifact survives. Exercise history digest verification, pinning/prune preview, replay preflight, failed export acknowledgement, and async cancellation/teardown as distinct observable state transitions.
- Add graph-checker fixtures for valid dependencies and forbidden backedges, relative imports, literal dynamic imports, alias forms, and the allowed registry/CLI exceptions. Ensure a deliberately introduced forbidden dependency actually fails validation.
- Characterization tests are expected green before extraction. New recommended-interface tests are expected red before that interface exists. Architecture restrictions are introduced in their enforcement slice after their expected current violations have been recorded. Do not weaken behavior assertions or update golden files simply to make relocation pass.
- Required local gates are focused tests per slice, test-static, test-unit, test-integration, build, and clean installed-wheel smoke. Optional integration cells and the supported Python matrix use existing CI qualification. Docker remains conditional on Collector changes, which are out of scope.
Out of Scope¶
- Deleting existing capabilities, removing old imports, changing package distribution, or upgrading dependencies.
- A universal execution/result model, new Measurement registry, new streaming evaluator, or automatic integration of batch/async/resource results into reports.
- New statistics, metrics, test-set design, training/CV automation, model selection, drift detection, fairness policy, or new LLM judge/provider behavior.
- Altering acceptance thresholds, timeouts, queue/work quotas, schema versions, uncertainty claims, or evidence defaults.
- Fixing unrelated defects or the historical compatibility regression mentioned by the original issue without reproducing and separately scoping it.
- Changes to Collector assets, capacity methodology, runtime/SDK semantics, production deployments, signing, or publication.
- Claims of hardware/provider qualification, population generalization, or production capacity from local refactor tests.
Further Notes¶
Implementation companions published with PL-220:
- PRF-1 refactoring plan: complete source disposition, canonical owners, contracts, migration order, rollback and handoff.
- PRF-1 verification catalog: test cases, fixtures, independent oracles, traceability and required gates.
The original evaluation-versus-capacity architectural decision remains in force. Consumer meaning remains outside the platform. The source and executable contracts outrank older narrative descriptions. The inspected compatibility tuple is Consumer Integration contract 34 even though an older overview still describes an earlier value; implementation must use the tuple as authority.
The initial planning baseline is green for the architecture checker and all 11 core evaluation tests on Python 3.14.7. Full unit/integration/static/build/matrix evidence has not been claimed for this documentation task. A complete baseline is the first implementation slice.
The specification is sufficiently concrete to hand to an implementation agent, but this status is not an approval assertion or a request to begin implementation. The ready-for-agent triage label describes specification completeness; it does not alter the issue's existing Backlog status or grant release authority.