From 71d9ec9d2a292725238714804aa7a6be2d4e7d1d Mon Sep 17 00:00:00 2001 From: nulllabtests Date: Thu, 19 Nov 2026 18:54:34 +0000 Subject: [PATCH 1/7] feat(meta-search): replay traces, versioned policies, fail-closed promotion (protocol 241 prereg) --- docs/research/DREAM_RSI_INTEGRATION_AUDIT.md | 86 +++++ implementation/algolab/THIRD_PARTY_NOTICES.md | 17 + .../ADR-0010-meta-search-replay-promotion.md | 47 +++ .../algolab/src/algolab/cli/main.py | 59 ++++ .../src/algolab/meta_search/__init__.py | 71 +++++ .../src/algolab/meta_search/evaluation.py | 296 ++++++++++++++++++ .../src/algolab/meta_search/policies.py | 222 +++++++++++++ .../src/algolab/meta_search/protocol_241.py | 280 +++++++++++++++++ .../algolab/src/algolab/meta_search/replay.py | 238 ++++++++++++++ .../algolab/src/algolab/meta_search/traces.py | 226 +++++++++++++ .../algolab/tests/test_meta_search.py | 252 +++++++++++++++ .../241_META_SEARCH_POLICY_IMPROVEMENT.md | 81 +++++ 12 files changed, 1875 insertions(+) create mode 100644 docs/research/DREAM_RSI_INTEGRATION_AUDIT.md create mode 100644 implementation/algolab/THIRD_PARTY_NOTICES.md create mode 100644 implementation/algolab/docs/decisions/ADR-0010-meta-search-replay-promotion.md create mode 100644 implementation/algolab/src/algolab/meta_search/__init__.py create mode 100644 implementation/algolab/src/algolab/meta_search/evaluation.py create mode 100644 implementation/algolab/src/algolab/meta_search/policies.py create mode 100644 implementation/algolab/src/algolab/meta_search/protocol_241.py create mode 100644 implementation/algolab/src/algolab/meta_search/replay.py create mode 100644 implementation/algolab/src/algolab/meta_search/traces.py create mode 100644 implementation/algolab/tests/test_meta_search.py create mode 100644 spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md diff --git a/docs/research/DREAM_RSI_INTEGRATION_AUDIT.md b/docs/research/DREAM_RSI_INTEGRATION_AUDIT.md new file mode 100644 index 0000000..537af05 --- /dev/null +++ b/docs/research/DREAM_RSI_INTEGRATION_AUDIT.md @@ -0,0 +1,86 @@ +# DREAM-RSI → AlgoLab integration audit + +**Audited upstream:** `google-research/dream-rsi`, commit +`8ec35bd2538220517ce1bfca4282db21b8c518db` (shallow clone at +`/tmp/opencode/dream-rsi`, outside the AlgoLab source tree). +**Audit date:** 2026-11-19. **Auditor:** implementation agent, Phase 1 of the +master mission. This document records source-level findings, not README claims. + +## 1. Architecture comparison + +| Concern | DREAM-RSI | AlgoLab (this checkout) | Integration decision | +|---|---|---|---| +| Discovery tree | filesystem `NodeStore` (`explore_b/attempt_/meta.json`), flat parent ids; `export_graph()` emits nodes+edges | append-only SQLite entities + event store, hash-sealed artifacts, lineage queries | **C** — AlgoLab persistence is the authority; no second tree store | +| Frozen replay world | `env/trace/raw.py`: `CellRaw`, `RawNode`, `RawTrace` (schema v1), `raw_scores.json` | checksummed JSON bundle + `append-only` tables | **B → rewritten** as content-addressed `DiscoveryTrace` in `algolab.meta_search.traces` | +| Replay env | `env/trace_env.py` `TraceEnv`: prefix-only `probe`/`probe_batch`, budget/round bookkeeping | none | **B** — `meta_search.replay.ReplayEnv` keeps prefix-only decisions + explicit uncertainty, drops agent/live half | +| Observation type | `Observation` (score, valid, fail_class, deltas) | `Attempt`, `Evidence`, `SelectionRecord` | **C** — new minimal `Observation` avoids coupling to agent traces | +| Policy | Python module `OptimalPolicy(LLMDesignedMethod)`, rewritten by an agent | versioned, deterministic policy classes in `algolab.search.policies` | **C** — structured frozen `SearchPolicy`, no self-modifying code | +| Policy rewrite loop | `learning/heuristic_search/workflow.py` (agent writes one editable file) | none; MASTER_SPEC §13 requires versioned, shadow-tested proposals | **C** — `propose_policy()` produces reviewable config changes; LLM optional, not required | +| Evaluation | `heuristic_search/eval.py`: `_trace_auc`, `_pareto_summary`, reward = `auc - λ·parallel_penalty`, beta sweep | `statistics.py` (bootstrap CI, Welch, Cohen's d, BH-FDR), `PolicyComparison` | **C** — reuse AlgoLab statistics; keep DREAM-RSI's *qualification-before-selection* idea | +| Promotion | `_qualification_reason` + `_select_best_round` + sha256 check; incumbent stays if not beaten | governance gates, promotion bar ≥2 families | **B/C** — fail-closed 4-stage gate in `meta_search.evaluation.promote` | +| Trace pool | `learning/trace_pool.py` directory of frozen traces + manifest | artifact store | **C** — append traces to the existing artifact store; no parallel pool | +| Orchestration | `orchestrate.py` explore→learning→promote cycles, archive/reset | CLI + sealed `search-run` bundles | **C** — one CLI command (`meta-search-run`) writes one sealed bundle | +| Agents/LLM | Gemini/Codex/Claude backends, 273-line proposer prompt | LLM adapter default off (M3) | **D** — not imported; core works without paid APIs | +| Tasks | KernelBench + SimpleTES (AGPL-3.0 fetched tasks) | toy / hpo / s2 / transform / compose substrates | **D** — use AlgoLab's CPU-friendly toy substrate | + +## 2. Components examined (source level) + +Files inspected (all under `/tmp/opencode/dream-rsi/`): + +- `dream_rsi/env/types.py` — `CellMeta`, `Observation`, `SearchEnv` protocol. +- `dream_rsi/env/trace_env.py` — `TraceEnv`, replay/live probe semantics, + `execution_trace()`, cost model, `_reveal`. +- `dream_rsi/env/trace/{types,raw,export}.py` — `Node`, `Trace`, `CellRaw`, + `RawNode`, `RawTrace`, `raw_trace_to_trace`, zombie/failure classification. +- `dream_rsi/env/{observation,runner,trace_store}.py`, `env/runner.py`. +- `dream_rsi/exploration/store.py` — `NodeStore`, `export_graph`. +- `dream_rsi/learning/trace_pool.py` — frozen trace pool + manifest. +- `dream_rsi/policy/{api,baseline,load,grid_planning,observation_signal,constants}.py` + — `LLMDesignedMethod`, `SimResult`, `GridPlan`, `ParallelRefineMethod`, + `resolve_grid_plan`, pure observation signal helpers. +- `dream_rsi/learning/discover.py` — offline discovery driver / baseline + benchmark (deliberately hides the grid ceiling from the proposer). +- `dream_rsi/learning/heuristic_search/eval.py` — `_resolve_target`, + `evaluate_on_trace`, `evaluate_multi_trace`, `_trace_auc`, `_pareto_summary`, + `run_beta_sweep`; reward = attainment AUC minus parallelism penalty. +- `dream_rsi/learning/heuristic_search/workflow.py` — proposal/eval/archive + rounds, `_qualification_reason`, `_select_best_round`, `promote_best_round`. +- `dream_rsi/orchestrate.py` — stages, `write_live_cycle_manifest` (schema 2, + policy sha256), `_discover_ok`, cycle archiving. +- `dream_rsi/agents/*`, `dream_rsi/prompts/*`, `dream_rsi/learning/directions/*`, + `tests/test_*.py`, `pyproject.toml`, `LICENSE`. + +Notable source-level corrections to the README: there is **no** `DiscoverEnv` +class; no policy-pool abstraction; no bandit/UCB sampler (selection is a +deterministic argmax over a qualified reward). Code defaults are 2 branches × +2 refinements, and the default agent in code is `claude` (proposer backend +`codex`), while the README's "gemini default" applies only to launch scripts. + +## 3. Reuse classification + +| Component (upstream file / function) | Class | Dependencies | License | AlgoLab equivalent | Proposed integration | Benefit | Tests | +|---|---|---|---|---|---|---|---| +| `env/trace/raw.py` schema + `raw_trace_to_trace` | B (rewritten) | stdlib only | Apache-2.0 | event store, artifact checksums | `meta_search/traces.py`: `TraceNode`, `DiscoveryTrace`, canonical JSON + sha256 chain | durable, attributable histories | `TestTraceInfrastructure` | +| `env/trace_env.py` replay half (`legal_actions`, `_reveal`, prefix-only probing, cost accounting) | B | `NodeStore`, `TraceStore`, agents | Apache-2.0 | none | `meta_search/replay.py`: `ReplayEnv`, outcome-kind enum, no manufactured labels | evaluate alternative policies without fabrication | `TestReplay` | +| `policy/api.py` (`SimResult`, `LLMDesignedMethod`, `GridPlan`) + `grid_planning.resolve_grid_plan` | C | stdlib | Apache-2.0 | `search/policies.py` | frozen structured `SearchPolicy` + 4 deterministic presets + `propose_policy()` | reviewable, versioned, no paid API | `TestPolicies` | +| `heuristic_search/eval.py` `_qualification_reason`, `_pareto_summary` reward idea | B/C | numpy-free math, result dicts | Apache-2.0 | `statistics.py`, `PolicyComparison` | 4-stage fail-closed `evaluate_policy`/`promote` | prevents replay-only or overfit promotion | `TestPromotion` | +| `trace_pool.py` + `orchestrate.write_live_cycle_manifest` (sha256 provenance) | C | filesystem | Apache-2.0 | artifact store, sealed bundles | sealed `protocol-241-v1` bundle + `verify_pilot()` | independent verification / reproducibility | `TestPilotAndVerification` | +| `exploration/store.py` `NodeStore`, workspace tree | D | filesystem, agent dirs | Apache-2.0 | repositories, event store | not imported | — | — | +| `learning/heuristic_search/workflow.py` agent rewriter, `agents/*`, prompts | D | paid-model SDKs, subprocesses | Apache-2.0 / MIT vendored | LLM adapter default-off | not imported (optional LLM may be layered later) | — | — | +| KernelBench / SimpleTES tasks | D | external, AGPL-3.0 fetched | MIT / AGPL-3.0 | toy/hpo/transform/compose | not imported | — | — | + +## 4. Dependency and licensing audit + +- Upstream root license: **Apache License 2.0** (`/tmp/opencode/dream-rsi/LICENSE`). + Per-file headers: `Copyright 2026 Google LLC`. No `NOTICE` file. Vendored + `third_party/kernelbench/LICENSE` is MIT (Stanford Scaling Intelligence Lab); + fetched SimpleTES tasks are AGPL-3.0 and not present in this checkout. +- Upstream runtime dependencies: none in the base install; optional extras add + numpy/scipy/psutil/scikit-learn, requests/pyyaml, model SDKs, pytest. All are + already available in AlgoLab (sklearn) or deliberately excluded (model SDKs). + **No new dependency is introduced by this integration.** +- Decision: **no upstream source code was copied.** Only architectural ideas + were reimplemented in AlgoLab-native modules, so Apache §4 copying + obligations do not attach; attribution is nonetheless recorded here and in + `THIRD_PARTY_NOTICES.md`, together with the Apache-2.0 license text location. + Nothing from `third_party/` or fetched AGPL tasks was touched. diff --git a/implementation/algolab/THIRD_PARTY_NOTICES.md b/implementation/algolab/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..8977fbe --- /dev/null +++ b/implementation/algolab/THIRD_PARTY_NOTICES.md @@ -0,0 +1,17 @@ +# Third-party notices + +## DREAM-RSI (ideas adapted, no source copied) + +- Project: https://github.com/google-research/dream-rsi +- Inspected commit: `8ec35bd2538220517ce1bfca4282db21b8c518db` +- Copyright: 2026 Google LLC +- License: Apache License 2.0 (full text in the upstream `LICENSE` file). + +AlgoLab's `src/algolab/meta_search/` reimplements the following ideas from +DREAM-RSI using AlgoLab's own infrastructure: frozen replay traces, prefix-only +replay decisions with explicit counterfactual uncertainty, a small versioned +policy contract, and qualification-gated fail-closed promotion. No DREAM-RSI +source files (and no files from its `third_party/` tree, which is MIT, or its +AGPL-3.0 fetched tasks) were copied into this repository. + +Full audit: `docs/research/DREAM_RSI_INTEGRATION_AUDIT.md`. diff --git a/implementation/algolab/docs/decisions/ADR-0010-meta-search-replay-promotion.md b/implementation/algolab/docs/decisions/ADR-0010-meta-search-replay-promotion.md new file mode 100644 index 0000000..14cd2cb --- /dev/null +++ b/implementation/algolab/docs/decisions/ADR-0010-meta-search-replay-promotion.md @@ -0,0 +1,47 @@ +# ADR-0010 — Meta-Search: native replay traces and fail-closed promotion + +- **Status:** Accepted +- **Date:** 2026-11-19 +- **Related:** MASTER_SPEC §13, protocol 241, DREAM-RSI integration audit + +## Context + +The master mission asks for the ability to improve AlgoLab's *search policy* +using recorded research histories. DREAM-RSI implements a related loop using a +filesystem discovery tree, frozen `raw_scores.json` traces, a shared +`TraceEnv`, agent-rewritten policy modules and a replay-fitness promotion step. +AlgoLab already has authoritative persistence (append-only SQLite + event +store), artifact sealing, budgets, statistics and a sealed-bundle harness. +Importing the DREAM-RSI framework would create a second event store, budget +ledger and experiment registry. + +## Decision + +1. Add an AlgoLab-native `algolab.meta_search` package. Discovery traces are + content-addressed, append-only and canonically serialized with a sha256 + chain (`traces.py`). +2. Replay is a read-only facade over a frozen trace + (`replay.py`). Prefix-only decisions are recorded; outcomes for branches + never explored are marked counterfactual with `uncertain=true` and **no** + label. Replay output is explicitly not prospective evidence. +3. Policies are frozen, structured, versioned objects with a rollback pointer + (`policies.py`). No unrestricted self-modifying code and no paid API in the + core loop; four deterministic presets provide the protocol arms. +4. Promotion is a four-stage, fail-closed gate (`evaluation.py`). Historical + replay alone cannot promote; prospective improvement and independent + held-out confirmation are mandatory. Decisions are checksummed and auditable. +5. Protocol 241 is a single bounded CLI run producing one sealed bundle; + `meta-verify` independently re-checks it. No new dependencies are added and + no DREAM-RSI source is copied (Apache-2.0 ideas only; see notices). + +## Consequences + +- Positive: histories are durable, attributable and replayable; policies are + reviewable; promotion evidence cannot be manufactured by replay or by + fitting the traces that inspired a proposal. +- Negative / limitations: replay cannot estimate off-tree counterfactuals; the + first pilot uses a synthetic trace because no meta-search traces existed + before this ADR; the toy substrate is not a real workload. +- Alternatives rejected: importing DREAM-RSI wholesale (class D), copying its + MIT/AGPL task suites, or allowing agent-rewritten policy source (violates + MASTER_SPEC §13). diff --git a/implementation/algolab/src/algolab/cli/main.py b/implementation/algolab/src/algolab/cli/main.py index 5e7a54b..bc5db64 100644 --- a/implementation/algolab/src/algolab/cli/main.py +++ b/implementation/algolab/src/algolab/cli/main.py @@ -179,6 +179,26 @@ def _build_parser() -> argparse.ArgumentParser: p_search.add_argument("--json", action="store_true", help="emit the statistics document as JSON") + p_meta = sub.add_parser( + "meta-search-run", + help="run the preregistered protocol-241 meta-search pilot") + p_meta.add_argument("--dir", type=Path, required=True, + help="artifact directory for the sealed bundle") + p_meta.add_argument("--trials", type=int, default=4) + p_meta.add_argument("--episodes", type=int, default=8) + p_meta.add_argument("--budget", type=float, default=10.0) + p_meta.add_argument("--seed-base", type=int, default=424_242) + p_meta.add_argument("--confirmation-seed-base", type=int, default=989_898) + p_meta.add_argument("--bootstrap-iterations", type=int, default=1000) + p_meta.add_argument("--force", action="store_true", + help="overwrite an existing sealed bundle") + p_meta.add_argument("--json", action="store_true") + + p_mverify = sub.add_parser( + "meta-verify", help="independently verify a sealed meta-search bundle") + p_mverify.add_argument("--dir", type=Path, required=True) + p_mverify.add_argument("--json", action="store_true") + return parser @@ -530,6 +550,41 @@ def cmd_search_run(args: argparse.Namespace) -> int: return rc +def cmd_meta_search_run(args: argparse.Namespace) -> int: + from algolab.meta_search.protocol_241 import run_pilot + + if (args.dir / "checksums.json").exists() and not args.force: + print(f"refusing to overwrite sealed bundle: {args.dir} (use --force)", + file=sys.stderr) + return 2 + result = run_pilot( + args.dir, trials=args.trials, episodes=args.episodes, + budget=args.budget, seed_base=args.seed_base, + confirmation_seed_base=args.confirmation_seed_base, + bootstrap_iterations=args.bootstrap_iterations, + ) + if args.json: + print(json.dumps(result, indent=2, sort_keys=True)) + else: + for summary in result["summaries"]: + print(f"{summary['arm']:>16} d={summary['prospective_delta']:+.6f} " + f"ci_low={summary['prospective_ci_low']:+.6f} " + f"{summary['promotion']}") + return 0 + + +def cmd_meta_verify(args: argparse.Namespace) -> int: + from algolab.meta_search.protocol_241 import verify_pilot + + verdict = verify_pilot(args.dir) + if args.json: + print(json.dumps(verdict, indent=2, sort_keys=True)) + else: + print(f"verified={verdict['verified']} files={verdict['n_files_verified']} " + f"trace_integrity={verdict['trace_integrity']}") + return 0 if verdict["verified"] else 1 + + def main(argv: list[str] | None = None) -> int: parser = _build_parser() args = parser.parse_args(argv) @@ -564,6 +619,10 @@ def main(argv: list[str] | None = None) -> int: return cmd_audit_log(args) if command == "search-run": return cmd_search_run(args) + if command == "meta-search-run": + return cmd_meta_search_run(args) + if command == "meta-verify": + return cmd_meta_verify(args) parser.print_help() return 2 diff --git a/implementation/algolab/src/algolab/meta_search/__init__.py b/implementation/algolab/src/algolab/meta_search/__init__.py new file mode 100644 index 0000000..27da644 --- /dev/null +++ b/implementation/algolab/src/algolab/meta_search/__init__.py @@ -0,0 +1,71 @@ +"""Meta-Search: bounded, auditable improvement of AlgoLab's *search policies*. + +This package implements the DREAM-RSI-inspired capability of learning *how to +search* rather than only which candidates to accept. It is AlgoLab-native by +design: it reuses the existing toy substrate, statistics module and artifact +conventions instead of creating a parallel framework. + +Concepts adapted from DREAM-RSI (google-research/dream-rsi, Apache-2.0): + * frozen discovery traces + replay environment (its ``TraceEnv`` / ``RawTrace``) + * prefix-only decisions with recorded outcomes (no leaked future labels) + * a small, versioned policy contract and deterministic baselines + * qualification-gated, fail-closed promotion instead of "best on the traces + that inspired it" + +No DREAM-RSI source code is copied. See +``docs/research/DREAM_RSI_INTEGRATION_AUDIT.md`` and ``THIRD_PARTY_NOTICES.md``. +""" + +from algolab.meta_search.policies import ( + BASELINE_POLICY, + CONTROL_POLICY, + EVOLVED_POLICY, + REPLAY_POLICY, + SearchPolicy, + Selection, + Observation, + propose_policy, +) +from algolab.meta_search.traces import ( + TRACE_SCHEMA_VERSION, + DiscoveryTrace, + TraceIntegrityError, + TraceNode, +) +from algolab.meta_search.replay import ( + OutcomeKind, + ReplayDecision, + ReplayEnv, + ReplayResult, +) +from algolab.meta_search.evaluation import ( + PromotionDecision, + PromotionStatus, + evaluate_policy, + promote, + replay_evaluation, +) + +__all__ = [ + "BASELINE_POLICY", + "CONTROL_POLICY", + "EVOLVED_POLICY", + "REPLAY_POLICY", + "SearchPolicy", + "Selection", + "Observation", + "propose_policy", + "TRACE_SCHEMA_VERSION", + "DiscoveryTrace", + "TraceIntegrityError", + "TraceNode", + "OutcomeKind", + "ReplayDecision", + "ReplayEnv", + "ReplayResult", + "PromotionDecision", + "PromotionStatus", + "evaluate_policy", + "promote", + "replay_evaluation", +] diff --git a/implementation/algolab/src/algolab/meta_search/evaluation.py b/implementation/algolab/src/algolab/meta_search/evaluation.py new file mode 100644 index 0000000..c6d53e5 --- /dev/null +++ b/implementation/algolab/src/algolab/meta_search/evaluation.py @@ -0,0 +1,296 @@ +"""Multi-stage policy evaluation and fail-closed promotion (Phases 6, 9). + +Stage A (historical replay) can *only* diagnose; it can never promote. +Stage B (prospective) compares the candidate to the fixed baseline on fresh, +matched seeds using AlgoLab's deterministic toy substrate. +Stage C (independent confirmation) uses a held-out family with fresh seeds. +Stage D (promotion) is explicit, auditable and replayable. Missing, failed or +degraded evidence fails closed. +""" + +from __future__ import annotations + +import hashlib +import json +from dataclasses import asdict, dataclass, field +from enum import Enum +from typing import Any + +from algolab.meta_search.policies import Observation, SearchPolicy +from algolab.meta_search.replay import ReplayEnv, ReplayResult +from algolab.search.toy import ( + DEFAULT_OPERATORS, + HELD_OUT_FAMILY, + run_attempt, +) +from algolab.statistics import EffectAnalysis, analyze + +EVALUATION_SCHEMA_VERSION = "meta-eval/1.0" +PRIMARY_METRIC = "discoveries_per_credit" +SECONDARY_METRIC = "distinct_useful_per_credit" + + +class PromotionStatus(str, Enum): + PROMOTED = "PROMOTED" + REJECTED_HISTORICAL_ONLY = "REJECTED_HISTORICAL_ONLY" + REJECTED_PROSPECTIVE = "REJECTED_PROSPECTIVE" + REJECTED_INDEPENDENT = "REJECTED_INDEPENDENT" + REJECTED_INCOMPLETE = "REJECTED_INCOMPLETE" + + +@dataclass(frozen=True) +class PromotionDecision: + status: PromotionStatus + candidate_policy_id: str + baseline_policy_id: str + reasons: tuple[str, ...] + evidence: dict[str, Any] = field(default_factory=dict) + schema_version: str = EVALUATION_SCHEMA_VERSION + + def checksum(self) -> str: + payload = json.dumps(asdict(self), sort_keys=True, separators=(",", ":")) + return hashlib.sha256(payload.encode("utf-8")).hexdigest() + + def to_dict(self) -> dict[str, Any]: + raw = asdict(self) + raw["status"] = self.status.value + raw["promotion_checksum"] = self.checksum() + return raw + + +def replay_evaluation(env: ReplayEnv, policy: SearchPolicy, *, seed: int = 0) -> dict[str, Any]: + """Stage A: decision quality, efficiency, coverage and explicit limits.""" + result: ReplayResult = env.run(policy, seed=seed) + observed = [d for d in result.decisions if d.observed_outcome] + spent = sum( + float((d.observed_outcome or {}).get("evaluation_result", {}).get("cost_credits", 1.0)) + for d in observed + ) + chosen_methods = [d.chosen_method for d in result.decisions] + return { + "stage": "A_historical_replay", + "is_prospective_evidence": False, + "decision_quality_agreement": result.agreement, + "n_decisions": len(result.decisions), + "n_observed": result.observed_count, + "n_counterfactual_uncertain": result.uncertain_count, + "search_efficiency_credits": spent, + "candidate_diversity": len(set(chosen_methods)), + "coverage": len(set(chosen_methods)) / max(len(set(DEFAULT_OPERATORS)), 1), + "failure_patterns": sorted({ + str((d.observed_outcome or {}).get("fail_class")) + for d in observed + if (d.observed_outcome or {}).get("fail_class") + }), + "replay_limitations": [ + "no outcome labels for unexplored branches", + "cannot measure what would have happened off the recorded tree", + "decision agreement is not a causal performance estimate", + ], + } + + +def _trial_score(policy: SearchPolicy, *, family: str, seed_base: int, trial: int, + episodes: int, budget: float) -> dict[str, float]: + """One deterministic prospective trial of a policy on one task family.""" + observations: list[Observation] = [] + credits = 0.0 + discoveries = 0 + useful_found: set[str] = set() + for episode in range(episodes): + selection = policy.select( + tuple(DEFAULT_OPERATORS), tuple(observations), + seed=seed_base + trial * 100_000 + episode, + ) + attempt = run_attempt( + family, selection.method, seed_base=seed_base, + trial=trial, episode=episode, attempt=episode, + ) + credits += attempt.cost_credits + if credits > budget: + break + if attempt.discovery: + discoveries += 1 + useful_found.add(selection.method) + observations.append( + Observation( + method=selection.method, + cost_credits=attempt.cost_credits, + mean_effect=attempt.mean_effect, + discovery=attempt.discovery, + valid=attempt.valid, + ) + ) + denom = max(credits, 1e-9) + return { + "credits": credits, + "discoveries": float(discoveries), + PRIMARY_METRIC: discoveries / denom, + SECONDARY_METRIC: len(useful_found) / denom, + } + + +def _stage( + policy: SearchPolicy, + baseline: SearchPolicy, + *, + families: tuple[str, ...], + seed_base: int, + trials: int, + episodes: int, + budget: float, + bootstrap_iterations: int, + alpha: float, +) -> dict[str, Any]: + primary: EffectAnalysis = analyze( + [ _trial_score(baseline, family=f, seed_base=seed_base, trial=t, + episodes=episodes, budget=budget)[PRIMARY_METRIC] + for f in families for t in range(trials) ], + [ _trial_score(policy, family=f, seed_base=seed_base, trial=t, + episodes=episodes, budget=budget)[PRIMARY_METRIC] + for f in families for t in range(trials) ], + metric=PRIMARY_METRIC, seed=seed_base + 1, + bootstrap_iterations=bootstrap_iterations, alpha=alpha, + ) + secondary: EffectAnalysis = analyze( + [ _trial_score(baseline, family=f, seed_base=seed_base, trial=t, + episodes=episodes, budget=budget)[SECONDARY_METRIC] + for f in families for t in range(trials) ], + [ _trial_score(policy, family=f, seed_base=seed_base, trial=t, + episodes=episodes, budget=budget)[SECONDARY_METRIC] + for f in families for t in range(trials) ], + metric=SECONDARY_METRIC, seed=seed_base + 2, + bootstrap_iterations=bootstrap_iterations, alpha=alpha, + ) + return { + "families": list(families), + "trials_per_family": trials, + "episodes": episodes, + "budget": budget, + "seed_base": seed_base, + "primary": { + "delta": primary.delta, + "ci_low": primary.ci_low, + "ci_high": primary.ci_high, + "p_value": primary.p_value, + "effect_size": primary.effect_size, + "baseline_mean": primary.baseline.mean, + "candidate_mean": primary.candidate.mean, + }, + "secondary": { + "delta": secondary.delta, + "ci_low": secondary.ci_low, + "ci_high": secondary.ci_high, + "p_value": secondary.p_value, + }, + } + + +def evaluate_policy( + policy: SearchPolicy, + baseline: SearchPolicy, + *, + replay_env: ReplayEnv | None = None, + families: tuple[str, ...] = ("alpha", "beta"), + confirmation_family: str = HELD_OUT_FAMILY, + seed_base: int = 424_242, + confirmation_seed_base: int = 989_898, + trials: int = 4, + episodes: int = 8, + budget: float = 10.0, + bootstrap_iterations: int = 1000, + alpha: float = 0.05, +) -> dict[str, Any]: + """Run stages A/B/C and return a structured, reproducible evaluation.""" + stage_a = ( + replay_evaluation(replay_env, policy) if replay_env is not None else None + ) + if stage_a is not None: + stage_a["policy_checksum"] = policy.checksum() + stage_b = _stage( + policy, baseline, families=families, seed_base=seed_base, + trials=trials, episodes=episodes, budget=budget, + bootstrap_iterations=bootstrap_iterations, alpha=alpha, + ) + stage_b["stage"] = "B_prospective" + stage_b["is_prospective_evidence"] = True + stage_c = _stage( + policy, baseline, families=(confirmation_family,), + seed_base=confirmation_seed_base, trials=trials, + episodes=episodes, budget=budget, + bootstrap_iterations=bootstrap_iterations, alpha=alpha, + ) + stage_c["stage"] = "C_independent_confirmation" + stage_c["is_prospective_evidence"] = True + return { + "schema_version": EVALUATION_SCHEMA_VERSION, + "candidate_policy_id": policy.policy_id, + "baseline_policy_id": baseline.policy_id, + "stage_a": stage_a, + "stage_b": stage_b, + "stage_c": stage_c, + "preregistered": True, + } + + +def promote( + candidate: SearchPolicy, + baseline: SearchPolicy, + evaluation: dict[str, Any], + *, + alpha: float = 0.05, + min_confirmation_delta: float = -0.001, +) -> PromotionDecision: + """Stage D: fail-closed promotion with an auditable reason list.""" + reasons: list[str] = [] + stage_a = evaluation.get("stage_a") + stage_b = evaluation.get("stage_b") + stage_c = evaluation.get("stage_c") + if not stage_a or not stage_b or not stage_c: + return PromotionDecision( + PromotionStatus.REJECTED_INCOMPLETE, candidate.policy_id, + baseline.policy_id, ("missing one or more evaluation stages",), evaluation, + ) + # Rule 1: replay alone can never promote. + if stage_b.get("is_prospective_evidence") is not True: + reasons.append("stage B is not prospective evidence") + # Rule 2: must beat baseline prospectively with a positive lower CI bound. + b = stage_b["primary"] + if not (b["delta"] > 0 and b["ci_low"] > 0 and b["p_value"] < alpha): + reasons.append( + "prospective primary metric did not significantly beat baseline " + f"(delta={b['delta']:.6g}, ci_low={b['ci_low']:.6g}, p={b['p_value']:.6g})" + ) + if stage_b["secondary"]["ci_low"] < 0: + reasons.append("prospective secondary metric shows significant degradation") + # Rule 3: independent held-out confirmation must not degrade generalization. + c = stage_c["primary"] + if not (c["delta"] >= 0 and c["ci_low"] >= min_confirmation_delta): + reasons.append( + "independent confirmation degraded on the held-out family " + f"(delta={c['delta']:.6g}, ci_low={c['ci_low']:.6g})" + ) + if stage_c.get("is_prospective_evidence") is not True: + reasons.append("stage C is not prospective evidence") + if reasons: + return PromotionDecision( + PromotionStatus.REJECTED_PROSPECTIVE if "prospective primary" in " ".join(reasons) + else PromotionStatus.REJECTED_INDEPENDENT, + candidate.policy_id, baseline.policy_id, tuple(reasons), evaluation, + ) + return PromotionDecision( + PromotionStatus.PROMOTED, candidate.policy_id, baseline.policy_id, + ("all promotion gates passed",), evaluation, + ) + + +__all__ = [ + "EVALUATION_SCHEMA_VERSION", + "PRIMARY_METRIC", + "SECONDARY_METRIC", + "PromotionStatus", + "PromotionDecision", + "replay_evaluation", + "evaluate_policy", + "promote", +] diff --git a/implementation/algolab/src/algolab/meta_search/policies.py b/implementation/algolab/src/algolab/meta_search/policies.py new file mode 100644 index 0000000..054fb06 --- /dev/null +++ b/implementation/algolab/src/algolab/meta_search/policies.py @@ -0,0 +1,222 @@ +"""Versioned, reviewable search-policy representation (Phase 5). + +A policy is a *structured, frozen* object -- never source code rewritten by an +agent. It selects among available candidate-generation methods from prefix +observations only. Four deterministic presets provide the protocol arms: +a fixed baseline, a DREAM-RSI-inspired replay/cost-aware heuristic, an evolved +configuration, and a seeded random control. +""" + +from __future__ import annotations + +import hashlib +import json +import random +from dataclasses import asdict, dataclass, field, replace +from typing import Any + +POLICY_SCHEMA_VERSION = "meta-policy/1.0" + + +@dataclass(frozen=True) +class Observation: + """A prefix-only measurement: method, cost, effect and discovery flag.""" + + method: str + cost_credits: float + mean_effect: float + discovery: bool + valid: bool = True + + +@dataclass(frozen=True) +class Selection: + method: str + rationale: str + exploration: bool = False + + +@dataclass(frozen=True) +class SearchPolicy: + """A structured, independently evaluable policy proposal.""" + + policy_id: str + parent_policy_id: str | None + version: int + name: str + kind: str # fixed | replay_cost_aware | evolved | random_control + config: dict[str, float] = field(default_factory=dict) + exact_change: str = "" + rationale: str = "" + expected_effect: str = "" + hypothesis: str = "" + relevant_evidence: tuple[str, ...] = () + proposed_evaluation: str = "" + resource_budget: float = 0.0 + rollback_path: str = "" + schema_version: str = POLICY_SCHEMA_VERSION + + def content(self) -> dict[str, Any]: + return asdict(self) + + def checksum(self) -> str: + payload = json.dumps(self.content(), sort_keys=True, separators=(",", ":")) + return hashlib.sha256(payload.encode("utf-8")).hexdigest() + + def validate(self) -> None: + if self.kind not in {"fixed", "replay_cost_aware", "evolved", "random_control"}: + raise ValueError(f"unknown policy kind: {self.kind}") + if self.version < 1: + raise ValueError("policy version must be >= 1") + if not self.exact_change or not self.rollback_path: + raise ValueError("a proposal needs exact_change and rollback_path") + if self.schema_version != POLICY_SCHEMA_VERSION: + raise ValueError(f"unsupported policy schema: {self.schema_version}") + + def select( + self, + candidates: tuple[str, ...], + observations: tuple[Observation, ...], + *, + seed: int, + ) -> Selection: + """Choose one method from *candidates* using only prefix observations.""" + if self.kind == "random_control": + rng = random.Random(seed) + return Selection(rng.choice(list(candidates)), "seeded uniform control", True) + if self.kind == "fixed": + priority = self.config.get("priority", 0.0) + ordered = sorted(candidates) + # A fixed policy commits to a lexicographic priority order; ``priority`` + # rotates the starting point deterministically across episodes. + idx = int(priority) % len(ordered) + rotated = ordered[idx:] + ordered[:idx] + return Selection(rotated[0], "fixed priority order (no learning)") + + # Cost-aware family: score by observed success probability and its + # per-credit efficiency; epsilon provides bounded exploration. + alpha = self.config.get("alpha", 1.0) + beta = self.config.get("beta", 1.0) + gamma = self.config.get("gamma", 0.0) + epsilon = self.config.get("epsilon", 0.0) + rng = random.Random(seed) + if epsilon > 0.0 and rng.random() < epsilon: + return Selection(rng.choice(list(candidates)), "epsilon exploration", True) + + stats: dict[str, dict[str, float]] = {} + for obs in observations: + bucket = stats.setdefault( + obs.method, {"n": 0.0, "wins": 0.0, "credits": 0.0, "effect": 0.0} + ) + bucket["n"] += 1.0 + bucket["wins"] += 1.0 if obs.discovery else 0.0 + bucket["credits"] += max(obs.cost_credits, 1e-9) + bucket["effect"] += obs.mean_effect if obs.valid else 0.0 + + def score(method: str) -> float: + bucket = stats.get(method) + if not bucket or bucket["n"] == 0: + # Unknown methods get an optimistic prior so they are tried once. + return alpha * 1.0 + beta * 1.0 + n = bucket["n"] + win_rate = bucket["wins"] / n + per_credit = bucket["wins"] / bucket["credits"] + avg_effect = bucket["effect"] / n + return alpha * win_rate + beta * per_credit + gamma * avg_effect + + chosen = max(candidates, key=lambda name: (score(name), -ord(name[0]) if name else 0, name)) + return Selection(chosen, f"score={score(chosen):.4f} (prefix observations only)") + + +def _preset( + name: str, + kind: str, + version: int, + config: dict[str, float], + exact_change: str, + rationale: str, +) -> SearchPolicy: + policy = SearchPolicy( + policy_id=f"pol-{name}", + parent_policy_id=None, + version=version, + name=name, + kind=kind, + config=config, + exact_change=exact_change, + rationale=rationale, + expected_effect="Measured by protocol 241 prospective evaluation", + hypothesis="Cost-aware prefix selection improves discoveries per credit", + proposed_evaluation="protocol-241 matched prospective + held-out confirmation", + resource_budget=0.0, + rollback_path="Revert active policy pointer to the previous promoted policy_id", + ) + policy.validate() + return policy + + +BASELINE_POLICY = _preset( + "fixed-baseline", "fixed", 1, {"priority": 0}, + "Initial fixed lexicographic search policy", "Existing AlgoLab fixed search behaviour", +) +REPLAY_POLICY = _preset( + "replay-cost-aware", "replay_cost_aware", 1, + {"alpha": 0.25, "beta": 0.75, "gamma": 0.0, "epsilon": 0.10}, + "Score methods by observed success-per-credit with 10% exploration", + "DREAM-RSI replay: cheap-and-good branches deserve more spend", +) +EVOLVED_POLICY = _preset( + "evolved", "evolved", 2, + {"alpha": 0.0, "beta": 1.0, "gamma": 0.5, "epsilon": 0.05}, + "Commit to per-credit efficiency with an effect-size term and 5% exploration", + "Prior protocols found commitment plus cost-awareness efficient in-domain", +) +CONTROL_POLICY = _preset( + "random-control", "random_control", 1, {}, + "Seeded uniform random method selection", "Calibration floor for any learned policy", +) + + +def propose_policy( + parent: SearchPolicy, + *, + name: str, + config: dict[str, float], + exact_change: str, + rationale: str, + expected_effect: str = "", + evidence: tuple[str, ...] = (), + budget: float = 0.0, +) -> SearchPolicy: + """Create a structured child proposal with a stable content-derived id.""" + draft = replace( + parent, + policy_id="", + parent_policy_id=parent.policy_id, + version=parent.version + 1, + name=name, + config=dict(config), + exact_change=exact_change, + rationale=rationale, + expected_effect=expected_effect or parent.expected_effect, + relevant_evidence=evidence, + proposed_evaluation=parent.proposed_evaluation, + resource_budget=budget, + ) + digest = draft.checksum() + proposal = replace(draft, policy_id=f"pol-{name}-{digest[:12]}") + proposal.validate() + return proposal + + +__all__ = [ + "POLICY_SCHEMA_VERSION", + "Observation", + "Selection", + "SearchPolicy", + "BASELINE_POLICY", + "REPLAY_POLICY", + "EVOLVED_POLICY", + "CONTROL_POLICY", + "propose_policy", +] diff --git a/implementation/algolab/src/algolab/meta_search/protocol_241.py b/implementation/algolab/src/algolab/meta_search/protocol_241.py new file mode 100644 index 0000000..d8b5ca4 --- /dev/null +++ b/implementation/algolab/src/algolab/meta_search/protocol_241.py @@ -0,0 +1,280 @@ +"""Protocol 241: bounded meta-search pilot and independent verification. + +This is the smallest honest experiment for the new capability. It compares +four deterministic search policies (fixed baseline, replay/cost-aware, evolved, +seeded random control) under matched seeds on the toy substrate, plus a held-out +family confirmation. A *synthetic pilot trace* is generated from the same +deterministic substrate so the replay environment has a frozen history to +replay; it is labelled as synthetic and is never prospective evidence. + +All decisions are pure functions of preregistered integers. Output is a sealed +bundle: every content file is listed in ``checksums.json`` and re-verifiable by +``verify_pilot`` / ``algolab meta-verify``. +""" + +from __future__ import annotations + +import hashlib +import json +from pathlib import Path +from typing import Any + +from algolab.meta_search.evaluation import evaluate_policy, promote +from algolab.meta_search.policies import ( + BASELINE_POLICY, + CONTROL_POLICY, + EVOLVED_POLICY, + REPLAY_POLICY, + SearchPolicy, +) +from algolab.meta_search.replay import ReplayEnv +from algolab.meta_search.traces import DiscoveryTrace, TraceNode +from algolab.search.toy import run_attempt + +PROTOCOL_ID = "protocol-241" +PROTOCOL_VERSION = "1.0.0" +BUNDLE_SCHEMA_VERSION = "meta-pilot/1.0" +ARMS: tuple[SearchPolicy, ...] = (BASELINE_POLICY, REPLAY_POLICY, EVOLVED_POLICY, CONTROL_POLICY) +TRACE_SEED = 77_100 +FAMILIES = ("alpha", "beta") + + +def build_pilot_trace() -> DiscoveryTrace: + """Create a deterministic, clearly-labelled synthetic historical trace.""" + trace = DiscoveryTrace(trace_id="trace-pilot-241", experiment_id="EXP-META-241") + root = TraceNode( + experiment_id="EXP-META-241", + parent_id=None, + policy_id=BASELINE_POLICY.policy_id, + policy_version=BASELINE_POLICY.version, + candidate_id="root", + candidate_generation_method="fixed-baseline", + search_parameters={"families": list(FAMILIES)}, + selection_decision="seed root", + seed=TRACE_SEED, + dataset_id="toy", + eval_split_id="train", + observation={"discovery": False, "valid": True}, + derived_metrics={"mean_effect": 0.0}, + created_at_utc="synthetic-pilot", + execution_provenance={"source": "synthetic_pilot_trace", "protocol": PROTOCOL_ID}, + ) + root_node = trace.append(root) + for index, method in enumerate(("tune", "reparameterize", "decompose", "refresh")): + family = FAMILIES[index % 2] + attempt = run_attempt( + family, method, seed_base=TRACE_SEED, trial=index, + episode=0, attempt=index, + ) + trace.append( + TraceNode( + experiment_id="EXP-META-241", + parent_id=root_node.node_id, + policy_id=BASELINE_POLICY.policy_id, + policy_version=BASELINE_POLICY.version, + candidate_id=f"cand-{method}", + candidate_generation_method=method, + search_parameters={"family": family, "trial": index}, + selection_decision=f"expand {method}", + evaluation_result={ + "cost_credits": attempt.cost_credits, + "discovery": attempt.discovery, + }, + compute_credits=attempt.cost_credits, + seed=TRACE_SEED + index, + dataset_id="toy", + eval_split_id="train", + observation={ + "discovery": attempt.discovery, + "valid": attempt.valid, + "mean_effect": attempt.mean_effect, + }, + derived_metrics={"mean_effect": attempt.mean_effect}, + created_at_utc="synthetic-pilot", + execution_provenance={"source": "synthetic_pilot_trace", "protocol": PROTOCOL_ID}, + ) + ) + return trace + + +def run_pilot( + out_dir: str | Path, + *, + trials: int = 4, + episodes: int = 8, + budget: float = 10.0, + seed_base: int = 424_242, + confirmation_seed_base: int = 989_898, + bootstrap_iterations: int = 1000, +) -> dict[str, Any]: + """Run the preregistered pilot and seal a deterministic artifact bundle.""" + target = Path(out_dir) + target.mkdir(parents=True, exist_ok=True) + trace = build_pilot_trace() + trace.write(target / "trace.json") + env = ReplayEnv( + trace, + unexplored_candidates=("synthesize", "validate", "polyglot", "rollback"), + ) + (target / "replay").mkdir(exist_ok=True) + (target / "evaluations").mkdir(exist_ok=True) + (target / "promotions").mkdir(exist_ok=True) + + summaries: list[dict[str, Any]] = [] + for policy in ARMS: + replay = env.deterministic_artifact(policy, seed=17) + _write_json(target / "replay" / f"{policy.name}.json", replay) + evaluation = evaluate_policy( + policy, BASELINE_POLICY, replay_env=env, + families=FAMILIES, seed_base=seed_base, + confirmation_seed_base=confirmation_seed_base, + trials=trials, episodes=episodes, budget=budget, + bootstrap_iterations=bootstrap_iterations, + ) + _write_json(target / "evaluations" / f"{policy.name}.json", evaluation) + decision = promote(policy, BASELINE_POLICY, evaluation) + _write_json(target / "promotions" / f"{policy.name}.json", decision.to_dict()) + b = evaluation["stage_b"]["primary"] + c = evaluation["stage_c"]["primary"] + summaries.append({ + "arm": policy.name, + "policy_id": policy.policy_id, + "historical_agreement": evaluation["stage_a"]["decision_quality_agreement"], + "prospective_delta": b["delta"], + "prospective_ci_low": b["ci_low"], + "prospective_p": b["p_value"], + "confirmation_delta": c["delta"], + "confirmation_ci_low": c["ci_low"], + "promotion": decision.status.value, + }) + + manifest = { + "schema_version": BUNDLE_SCHEMA_VERSION, + "protocol": PROTOCOL_ID, + "protocol_version": PROTOCOL_VERSION, + "trace_kind": "synthetic_pilot_trace", + "trace_is_prospective_evidence": False, + "substrate": "algolab.search.toy", + "families": list(FAMILIES), + "held_out_family": "gamma", + "trials": trials, + "episodes": episodes, + "budget": budget, + "seed_base": seed_base, + "confirmation_seed_base": confirmation_seed_base, + "bootstrap_iterations": bootstrap_iterations, + "arms": [p.name for p in ARMS], + "promotion_gate": ( + "stage A replay-only never promotes; B requires positive CI and p<0.05; " + "C requires non-negative delta and CI>=-0.001 on held-out gamma" + ), + } + _write_json(target / "manifest.json", manifest) + report = _render_report(manifest, summaries) + (target / "report.md").write_text(report, encoding="utf-8") + checksums = _seal(target) + _write_json(target / "checksums.json", checksums) + return {"manifest": manifest, "summaries": summaries, "checksums": checksums} + + +def _write_json(path: Path, payload: Any) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text( + json.dumps(payload, sort_keys=True, separators=(",", ":"), indent=None) + "\n", + encoding="utf-8", + ) + + +def _render_report(manifest: dict[str, Any], summaries: list[dict[str, Any]]) -> str: + lines = [ + f"# {manifest['protocol']} — Meta-Search bounded pilot", + "", + "Status: **exploratory pilot**. The historical trace is synthetic and is " + "not prospective evidence. No policy is promoted on replay performance.", + "", + "| Arm | Replay agreement | Prospective Δ/credit | 95% CI low | p | Held-out Δ | Promotion |", + "|---|---|---|---|---|---|---|", + ] + for s in summaries: + lines.append( + f"| {s['arm']} | {s['historical_agreement']:.3f} | " + f"{s['prospective_delta']:+.6f} | {s['prospective_ci_low']:+.6f} | " + f"{s['prospective_p']:.4f} | {s['confirmation_delta']:+.6f} | " + f"{s['promotion']} |" + ) + lines += [ + "", + "Primary outcome: validated discoveries per credit (paired across matched " + "trials). Secondary: distinct useful methods per credit. Negative results " + "are reported as measured.", + "", + ] + return "\n".join(lines) + + +def _seal(target: Path) -> dict[str, str]: + skip = {"checksums.json"} + files: dict[str, str] = {} + for path in sorted(target.rglob("*")): + if not path.is_file() or path.name in skip: + continue + rel = path.relative_to(target).as_posix() + files[rel] = hashlib.sha256(path.read_bytes()).hexdigest() + return files + + +def verify_pilot(out_dir: str | Path) -> dict[str, Any]: + """Independently re-check every sealed file and promotion verdict.""" + target = Path(out_dir) + checksums_path = target / "checksums.json" + if not checksums_path.exists(): + raise FileNotFoundError(f"no checksums.json in {target}") + expected: dict[str, str] = json.loads(checksums_path.read_text(encoding="utf-8")) + mismatches: list[str] = [] + for rel, digest in expected.items(): + path = target / rel + if not path.exists() or hashlib.sha256(path.read_bytes()).hexdigest() != digest: + mismatches.append(rel) + extra = sorted( + p.relative_to(target).as_posix() + for p in target.rglob("*") + if p.is_file() and p.name != "checksums.json" + and p.relative_to(target).as_posix() not in expected + ) + trace = DiscoveryTrace.load(target / "trace.json") + promotions = {} + for path in sorted((target / "promotions").glob("*.json")): + raw = json.loads(path.read_text(encoding="utf-8")) + promotions[path.stem] = raw.get("status") + replay_only_promoted = False + for path in sorted((target / "promotions").glob("*.json")): + verdict = json.loads(path.read_text(encoding="utf-8")) + if verdict.get("status") != "PROMOTED": + continue + evaluation = json.loads( + (target / "evaluations" / f"{path.stem}.json").read_text(encoding="utf-8") + ) + if not evaluation["stage_b"]["is_prospective_evidence"]: + replay_only_promoted = True + return { + "schema_version": BUNDLE_SCHEMA_VERSION, + "verified": not mismatches and not extra and trace.verify_integrity() + and not replay_only_promoted, + "n_files_verified": len(expected), + "mismatches": mismatches, + "extra_files": extra, + "trace_integrity": trace.verify_integrity(), + "replay_only_promotion_detected": replay_only_promoted, + "promotion_verdicts": promotions, + } + + +__all__ = [ + "PROTOCOL_ID", + "PROTOCOL_VERSION", + "BUNDLE_SCHEMA_VERSION", + "ARMS", + "build_pilot_trace", + "run_pilot", + "verify_pilot", +] diff --git a/implementation/algolab/src/algolab/meta_search/replay.py b/implementation/algolab/src/algolab/meta_search/replay.py new file mode 100644 index 0000000..74593d3 --- /dev/null +++ b/implementation/algolab/src/algolab/meta_search/replay.py @@ -0,0 +1,238 @@ +"""Historical replay environment (Phases 4, 10). + +The environment reconstructs the *decisions available at a recorded state* and +runs an alternative policy against them. It is deliberately unable to invent +outcomes: + +* OBSERVED - the selected branch exists in the historical trace; +* COUNTERFACTUAL - the decision is recorded, but no outcome exists because + that branch was never explored (all outcome fields are + ``None`` and ``uncertain`` is true); +* ESTIMATED - reserved for explicitly supplied external estimates; +* PROSPECTIVE - can only be produced by a real experiment, never here. + +Any attempt to present replay output as prospective evidence is rejected by +:func:`assert_not_prospective`. +""" + +from __future__ import annotations + +from dataclasses import asdict, dataclass, field +from enum import Enum +from typing import Any + +from algolab.meta_search.policies import Observation, SearchPolicy +from algolab.meta_search.traces import DiscoveryTrace, TraceNode + +REPLAY_SCHEMA_VERSION = "meta-replay/1.0" + + +class OutcomeKind(str, Enum): + OBSERVED = "observed" + COUNTERFACTUAL_UNCERTAIN = "counterfactual_uncertain" + ESTIMATED = "estimated" + PROSPECTIVE = "prospective" + + +@dataclass(frozen=True) +class ReplayDecision: + state_node_id: str + depth: int + available_methods: tuple[str, ...] + chosen_method: str + historically_chosen_method: str | None + outcome_kind: OutcomeKind + observed_outcome: dict[str, Any] | None = None + estimated_outcome: dict[str, Any] | None = None + uncertain: bool = True + uncertainty_reason: str = "" + matches_historical: bool = False + rationale: str = "" + + def to_dict(self) -> dict[str, Any]: + raw = asdict(self) + raw["outcome_kind"] = self.outcome_kind.value + raw["available_methods"] = list(self.available_methods) + return raw + + +@dataclass +class ReplayResult: + schema_version: str = REPLAY_SCHEMA_VERSION + trace_id: str = "" + policy_id: str = "" + decisions: list[ReplayDecision] = field(default_factory=list) + + @property + def observed_count(self) -> int: + return sum(d.outcome_kind == OutcomeKind.OBSERVED for d in self.decisions) + + @property + def uncertain_count(self) -> int: + return sum(d.uncertain for d in self.decisions) + + @property + def agreement(self) -> float: + if not self.decisions: + return 0.0 + return sum(d.matches_historical for d in self.decisions) / len(self.decisions) + + def to_dict(self) -> dict[str, Any]: + return { + "schema_version": self.schema_version, + "trace_id": self.trace_id, + "policy_id": self.policy_id, + "evidence_class": "historical_replay", + "is_prospective_evidence": False, + "decisions": [d.to_dict() for d in self.decisions], + "summary": { + "n_decisions": len(self.decisions), + "n_observed": self.observed_count, + "n_uncertain": self.uncertain_count, + "agreement_with_history": self.agreement, + }, + } + + +def assert_not_prospective(result: ReplayResult) -> None: + """Fail closed if replay output is being presented as prospective data.""" + if any(d.outcome_kind == OutcomeKind.PROSPECTIVE for d in result.decisions): + raise ValueError("replay produced a PROSPECTIVE outcome label -- invalid") + if result.to_dict()["is_prospective_evidence"]: + raise ValueError("replay result claims to be prospective evidence") + + +def _observation_from_node(node: TraceNode) -> Observation: + derived = node.derived_metrics + obs = node.observation + mean_effect = float( + derived.get("mean_effect", obs.get("mean_effect", 0.0)) # type: ignore[arg-type] + ) + discovery = bool(obs.get("discovery", False) or derived.get("discovery", False)) + return Observation( + method=node.candidate_generation_method, + cost_credits=float(node.compute_credits or obs.get("cost_credits", 1.0)), + mean_effect=mean_effect, + discovery=discovery, + valid=bool(obs.get("valid", True)), + ) + + +def _prefix_observations(trace: DiscoveryTrace, node: TraceNode) -> tuple[Observation, ...]: + """Observations from ancestors only -- never the current/future nodes.""" + by_id = {n.node_id: n for n in trace.nodes} + out: list[Observation] = [] + cursor = node.parent_id + while cursor is not None: + ancestor = by_id.get(cursor) + if ancestor is None: + break + out.append(_observation_from_node(ancestor)) + cursor = ancestor.parent_id + return tuple(reversed(out)) + + +class ReplayEnv: + """Reconstructs decision states from a frozen discovery trace.""" + + def __init__( + self, + trace: DiscoveryTrace, + *, + unexplored_candidates: tuple[str, ...] = (), + ) -> None: + if not trace.verify_integrity(): + raise ValueError("cannot replay a trace that fails integrity verification") + self.trace = trace + self.unexplored_candidates = tuple(unexplored_candidates) + + def available_actions(self, node_id: str) -> tuple[str, ...]: + children = self.trace.children(node_id) + methods = list(dict.fromkeys(c.candidate_generation_method for c in children)) + for method in self.unexplored_candidates: + if method not in methods: + methods.append(method) + return tuple(methods) + + def run(self, policy: SearchPolicy, *, seed: int = 0) -> ReplayResult: + """Evaluate *policy* at every recorded internal decision state.""" + result = ReplayResult(trace_id=self.trace.trace_id, policy_id=policy.policy_id) + for node in self.trace.nodes: + children = self.trace.children(node.node_id) + methods = self.available_actions(node.node_id) + if not children and not self.unexplored_candidates: + continue # leaf state with no recorded decision + observations = _prefix_observations(self.trace, node) + selection = policy.select(methods, observations, seed=seed + len(observations)) + child_by_method = { + c.candidate_generation_method: c + for c in children + } + historical = children[0].candidate_generation_method if children else None + chosen_child = child_by_method.get(selection.method) + if chosen_child is not None: + decision = ReplayDecision( + state_node_id=node.node_id, + depth=len(observations), + available_methods=methods, + chosen_method=selection.method, + historically_chosen_method=historical, + outcome_kind=OutcomeKind.OBSERVED, + observed_outcome={ + **chosen_child.observation, + **chosen_child.derived_metrics, + "evaluation_result": chosen_child.evaluation_result, + }, + estimated_outcome=None, + uncertain=False, + uncertainty_reason="", + matches_historical=selection.method == historical, + rationale=selection.rationale, + ) + else: + decision = ReplayDecision( + state_node_id=node.node_id, + depth=len(observations), + available_methods=methods, + chosen_method=selection.method, + historically_chosen_method=historical, + outcome_kind=OutcomeKind.COUNTERFACTUAL_UNCERTAIN, + observed_outcome=None, + estimated_outcome=None, + uncertain=True, + uncertainty_reason=( + "branch was never explored in the historical trace; " + "no outcome label exists and none was manufactured" + ), + matches_historical=False, + rationale=selection.rationale, + ) + result.decisions.append(decision) + assert_not_prospective(result) + return result + + def deterministic_artifact(self, policy: SearchPolicy, *, seed: int = 0) -> dict[str, Any]: + """Replay artifact with an explicit limitations section.""" + result = self.run(policy, seed=seed) + payload = result.to_dict() + payload["limitations"] = [ + "Replay evaluates decisions at recorded states only.", + "It cannot establish outcomes for branches never explored.", + "Counterfactual decisions carry no outcome label (uncertain=true).", + "Historical replay is not prospective evidence and cannot promote a policy.", + ] + payload["observed_vs_counterfactual"] = { + "observed": result.observed_count, + "counterfactual_uncertain": result.uncertain_count, + } + return payload + + +__all__ = [ + "REPLAY_SCHEMA_VERSION", + "OutcomeKind", + "ReplayDecision", + "ReplayResult", + "ReplayEnv", + "assert_not_prospective", +] diff --git a/implementation/algolab/src/algolab/meta_search/traces.py b/implementation/algolab/src/algolab/meta_search/traces.py new file mode 100644 index 0000000..458bfdb --- /dev/null +++ b/implementation/algolab/src/algolab/meta_search/traces.py @@ -0,0 +1,226 @@ +"""Append-only, content-addressed discovery traces (Phase 3). + +A :class:`DiscoveryTrace` is the durable record of *how* AlgoLab searched: +each node records one decision together with its policy version, evaluation, +compute spend and provenance. Records are immutable and content-addressed: +mutating an existing node breaks the checksum chain and is detected by +:meth:`DiscoveryTrace.verify_integrity`. Serialization is canonical (sorted +keys, compact separators) so identical logical traces hash identically. + +Observations, derived metrics and hypotheses are kept in separate fields so a +replay consumer can never mistake an interpretation for a measurement. +""" + +from __future__ import annotations + +import hashlib +import json +from dataclasses import asdict, dataclass, field, replace +from pathlib import Path +from typing import Any + +TRACE_SCHEMA_VERSION = "meta-trace/1.0" + +# Kinds of statement a node may carry. Keeping these separate is a hard +# requirement: derived metrics and hypotheses must not be read as observations. +OBSERVATION = "observation" +DERIVED_METRIC = "derived_metric" +HYPOTHESIS = "hypothesis" + + +class TraceIntegrityError(RuntimeError): + """Raised when a trace fails checksum, ordering or identity validation.""" + + +def canonical_bytes(payload: Any) -> bytes: + """Deterministic UTF-8 JSON encoding (sorted keys, no incidental spaces).""" + return json.dumps( + payload, sort_keys=True, separators=(",", ":"), ensure_ascii=True + ).encode("utf-8") + + +def _sha256(payload: Any) -> str: + return hashlib.sha256(canonical_bytes(payload)).hexdigest() + + +@dataclass(frozen=True) +class TraceNode: + """One immutable discovery decision record. + + ``node_id`` is derived from the canonical content of the record (excluding + the id/checksum themselves), giving stable identifiers without a mutable + counter. ``previous_checksum`` links nodes into an append-only chain. + """ + + experiment_id: str + parent_id: str | None + policy_id: str + policy_version: str + candidate_id: str + candidate_generation_method: str + search_parameters: dict[str, Any] = field(default_factory=dict) + selection_decision: str = "" + refinement_decision: str = "" + evaluation_result: dict[str, Any] = field(default_factory=dict) + rejection_reasons: tuple[str, ...] = () + compute_credits: float = 0.0 + stopping_decision: str = "" + artifact_refs: tuple[str, ...] = () + seed: int = 0 + dataset_id: str = "" + eval_split_id: str = "" + observation: dict[str, Any] = field(default_factory=dict) + derived_metrics: dict[str, Any] = field(default_factory=dict) + hypotheses: tuple[str, ...] = () + execution_provenance: dict[str, Any] = field(default_factory=dict) + created_at_utc: str = "" + schema_version: str = TRACE_SCHEMA_VERSION + previous_checksum: str = "" + statement_kind: str = OBSERVATION + node_id: str = "" + checksum: str = "" + + def content(self) -> dict[str, Any]: + """Canonical content used for identity and checksum computation.""" + payload = asdict(self) + payload.pop("node_id", None) + payload.pop("checksum", None) + return payload + + def seal(self, previous_checksum: str) -> TraceNode: + """Return a node with stable id and checksum set (pure function).""" + base = replace(self, previous_checksum=previous_checksum, node_id="", checksum="") + digest = _sha256(base.content()) + return replace(base, node_id=f"trn_{digest[:20]}", checksum=digest) + + def to_dict(self) -> dict[str, Any]: + return asdict(self) + + @classmethod + def from_dict(cls, raw: dict[str, Any]) -> TraceNode: + known = {f for f in cls.__dataclass_fields__} + unknown = set(raw) - known + if unknown: + raise TraceIntegrityError(f"unknown trace-node fields: {sorted(unknown)}") + if raw.get("schema_version") != TRACE_SCHEMA_VERSION: + raise TraceIntegrityError( + f"unsupported trace schema: {raw.get('schema_version')!r}" + ) + node = cls(**raw) + digest = _sha256(node.content()) + if node.node_id != f"trn_{digest[:20]}" or node.checksum != digest: + raise TraceIntegrityError(f"node checksum mismatch: {node.node_id}") + return node + + +@dataclass +class DiscoveryTrace: + """An append-only sequence of :class:`TraceNode` records.""" + + trace_id: str + experiment_id: str + nodes: list[TraceNode] = field(default_factory=list) + schema_version: str = TRACE_SCHEMA_VERSION + + @property + def head_checksum(self) -> str: + return self.nodes[-1].checksum if self.nodes else "0" * 64 + + def append(self, node: TraceNode) -> TraceNode: + """Append and seal a node; the parent must already be in the trace.""" + if node.parent_id is not None and node.parent_id not in self._ids(): + raise TraceIntegrityError(f"unknown parent: {node.parent_id}") + if node.experiment_id != self.experiment_id: + raise TraceIntegrityError("node belongs to a different experiment") + sealed = node.seal(self.head_checksum) + if sealed.node_id in self._ids(): + raise TraceIntegrityError(f"duplicate node id: {sealed.node_id}") + self.nodes.append(sealed) + return sealed + + def children(self, node_id: str | None) -> list[TraceNode]: + """Direct children of ``node_id`` in append order (roots if None).""" + return [n for n in self.nodes if n.parent_id == node_id] + + def _ids(self) -> set[str]: + return {n.node_id for n in self.nodes} + + def verify_integrity(self) -> bool: + """Verify the checksum chain, identities, parents and schema versions.""" + previous = "0" * 64 + seen: set[str] = set() + for node in self.nodes: + if node.schema_version != TRACE_SCHEMA_VERSION: + return False + if node.previous_checksum != previous: + return False + digest = _sha256(node.content()) + if node.checksum != digest or node.node_id != f"trn_{digest[:20]}": + return False + if node.node_id in seen: + return False + if node.parent_id is not None and node.parent_id not in seen: + return False + seen.add(node.node_id) + previous = node.checksum + return True + + def to_canonical_json(self) -> str: + return json.dumps(self.to_dict(), sort_keys=True, separators=(",", ":")) + + def to_dict(self) -> dict[str, Any]: + return { + "schema_version": self.schema_version, + "trace_id": self.trace_id, + "experiment_id": self.experiment_id, + "nodes": [n.to_dict() for n in self.nodes], + } + + @classmethod + def from_dict(cls, raw: dict[str, Any]) -> DiscoveryTrace: + if raw.get("schema_version") != TRACE_SCHEMA_VERSION: + raise TraceIntegrityError( + f"unsupported trace schema: {raw.get('schema_version')!r}" + ) + trace = cls( + trace_id=str(raw["trace_id"]), + experiment_id=str(raw["experiment_id"]), + nodes=[TraceNode.from_dict(n) for n in raw.get("nodes", [])], + ) + if not trace.verify_integrity(): + raise TraceIntegrityError("trace failed integrity verification on load") + return trace + + def write(self, path: str | Path) -> Path: + """Atomically-ish write the canonical trace plus a sidecar checksum.""" + target = Path(path) + target.parent.mkdir(parents=True, exist_ok=True) + payload = self.to_canonical_json().encode("utf-8") + target.write_bytes(payload) + Path(str(target) + ".sha256").write_text( + hashlib.sha256(payload).hexdigest() + "\n", encoding="utf-8" + ) + return target + + @classmethod + def load(cls, path: str | Path) -> DiscoveryTrace: + target = Path(path) + payload = target.read_bytes() + sidecar = Path(str(target) + ".sha256") + if sidecar.exists(): + expected = sidecar.read_text(encoding="utf-8").strip() + if hashlib.sha256(payload).hexdigest() != expected: + raise TraceIntegrityError("trace file checksum mismatch") + return cls.from_dict(json.loads(payload.decode("utf-8"))) + + +__all__ = [ + "TRACE_SCHEMA_VERSION", + "OBSERVATION", + "DERIVED_METRIC", + "HYPOTHESIS", + "TraceIntegrityError", + "canonical_bytes", + "TraceNode", + "DiscoveryTrace", +] diff --git a/implementation/algolab/tests/test_meta_search.py b/implementation/algolab/tests/test_meta_search.py new file mode 100644 index 0000000..96de2fa --- /dev/null +++ b/implementation/algolab/tests/test_meta_search.py @@ -0,0 +1,252 @@ +"""Protocol 241 / meta-search capability tests (Phase 10).""" + +from __future__ import annotations + +import json +from pathlib import Path + +import pytest + +from algolab.meta_search.evaluation import ( + PromotionStatus, + evaluate_policy, + promote, + replay_evaluation, +) +from algolab.meta_search.policies import ( + BASELINE_POLICY, + CONTROL_POLICY, + EVOLVED_POLICY, + REPLAY_POLICY, + Observation, + propose_policy, +) +from algolab.meta_search.protocol_241 import build_pilot_trace, run_pilot, verify_pilot +from algolab.meta_search.replay import ( + OutcomeKind, + ReplayEnv, + assert_not_prospective, +) +from algolab.meta_search.traces import ( + TRACE_SCHEMA_VERSION, + DiscoveryTrace, + TraceIntegrityError, + TraceNode, +) + + +def _node(trace: DiscoveryTrace, parent: str | None, method: str, + *, discovery: bool = True, credits: float = 1.0) -> TraceNode: + return trace.append( + TraceNode( + experiment_id=trace.experiment_id, + parent_id=parent, + policy_id=BASELINE_POLICY.policy_id, + policy_version=BASELINE_POLICY.version, + candidate_id=f"c-{method}", + candidate_generation_method=method, + selection_decision=f"pick {method}", + compute_credits=credits, + seed=7, + dataset_id="toy", + eval_split_id="train", + observation={"discovery": discovery, "valid": True, "mean_effect": 0.3}, + derived_metrics={"mean_effect": 0.3}, + evaluation_result={"cost_credits": credits, "discovery": discovery}, + ) + ) + + +@pytest.fixture() +def trace() -> DiscoveryTrace: + result = DiscoveryTrace(trace_id="trace-test", experiment_id="EXP-TEST") + root = _node(result, None, "root", discovery=False) + _node(result, root.node_id, "tune") + _node(result, root.node_id, "refresh", discovery=False) + return result + + +class TestTraceInfrastructure: + def test_creation_integrity_and_relationships(self, trace: DiscoveryTrace) -> None: + assert trace.verify_integrity() + assert len(trace.children(None)) == 1 + root = trace.children(None)[0] + assert {c.candidate_generation_method for c in trace.children(root.node_id)} == { + "tune", "refresh" + } + assert trace.head_checksum == trace.nodes[-1].checksum + + def test_stable_ids_and_canonical_serialization(self, trace: DiscoveryTrace) -> None: + payload = trace.to_canonical_json() + assert payload == json.dumps(trace.to_dict(), sort_keys=True, separators=(",", ":")) + restored = DiscoveryTrace.from_dict(json.loads(payload)) + assert [n.node_id for n in restored.nodes] == [n.node_id for n in trace.nodes] + assert restored.verify_integrity() + + def test_file_roundtrip_and_checksum_guard(self, trace: DiscoveryTrace, + tmp_path: Path) -> None: + path = trace.write(tmp_path / "trace.json") + assert DiscoveryTrace.load(path).verify_integrity() + path.write_bytes(path.read_bytes() + b" ") + with pytest.raises(TraceIntegrityError): + DiscoveryTrace.load(path) + + def test_corruption_and_unknown_parent_fail(self, trace: DiscoveryTrace) -> None: + raw = trace.to_dict() + raw["nodes"][1]["derived_metrics"] = {"mean_effect": 999.0} + with pytest.raises(TraceIntegrityError): + DiscoveryTrace.from_dict(raw) + with pytest.raises(TraceIntegrityError): + trace.append(TraceNode(experiment_id="EXP-TEST", parent_id="missing", + policy_id="p", policy_version=1, candidate_id="c", + candidate_generation_method="x")) + + def test_schema_version_and_statement_kinds(self, trace: DiscoveryTrace) -> None: + assert trace.schema_version == TRACE_SCHEMA_VERSION + raw = trace.to_dict() + raw["schema_version"] = "meta-trace/0.0" + with pytest.raises(TraceIntegrityError): + DiscoveryTrace.from_dict(raw) + assert trace.nodes[0].statement_kind == "observation" + + +class TestReplay: + def test_deterministic_and_observed_outcomes(self, trace: DiscoveryTrace) -> None: + env = ReplayEnv(trace) + a = env.run(REPLAY_POLICY, seed=3) + b = env.run(REPLAY_POLICY, seed=3) + assert [d.chosen_method for d in a.decisions] == [d.chosen_method for d in b.decisions] + assert a.to_dict() == b.to_dict() + assert a.observed_count + a.uncertain_count == len(a.decisions) + + def test_counterfactual_uncertainty_and_no_manufactured_outcome( + self, trace: DiscoveryTrace) -> None: + env = ReplayEnv(trace, unexplored_candidates=("never-explored",)) + result = env.run(CONTROL_POLICY, seed=99) + counterfactual = [d for d in result.decisions + if d.outcome_kind == OutcomeKind.COUNTERFACTUAL_UNCERTAIN] + assert counterfactual + for decision in counterfactual: + assert decision.observed_outcome is None + assert decision.estimated_outcome is None + assert decision.uncertain and decision.uncertainty_reason + with pytest.raises(ValueError): + assert_not_prospective(result) + + def test_replay_cannot_be_prospective(self, trace: DiscoveryTrace) -> None: + artifact = ReplayEnv(trace).deterministic_artifact(BASELINE_POLICY) + assert artifact["is_prospective_evidence"] is False + assert artifact["limitations"] + assert ReplayEnv(trace).run(BASELINE_POLICY).to_dict()[ + "evidence_class"] == "historical_replay" + + +class TestPolicies: + def test_versioning_and_structured_proposal(self) -> None: + child = propose_policy( + REPLAY_POLICY, name="test-child", config={"beta": 2.0}, + exact_change="beta 0.75 -> 2.0", rationale="commit harder to cheap methods", + expected_effect="more discoveries per credit", evidence=("protocol-230-v2",), + budget=12.0, + ) + assert child.version == REPLAY_POLICY.version + 1 + assert child.parent_policy_id == REPLAY_POLICY.policy_id + assert child.checksum() != REPLAY_POLICY.checksum() + assert child.rollback_path and child.proposed_evaluation + + def test_deterministic_selection_and_baseline_difference(self) -> None: + observations = ( + Observation("tune", 1.0, 0.3, True), + Observation("refresh", 4.0, 0.3, True), + ) + candidates = ("tune", "refresh", "validate") + assert BASELINE_POLICY.select(candidates, observations, seed=1) == \ + BASELINE_POLICY.select(candidates, observations, seed=2) + assert REPLAY_POLICY.select(candidates, observations, seed=1).method == "tune" + assert CONTROL_POLICY.select(candidates, (), seed=5) == \ + CONTROL_POLICY.select(candidates, (), seed=5) + + def test_invalid_policy_rejected(self) -> None: + with pytest.raises(ValueError): + propose_policy(BASELINE_POLICY, name="bad", config={}, exact_change="", + rationale="") + + +class TestPromotion: + def test_historical_replay_alone_cannot_promote(self, trace: DiscoveryTrace) -> None: + evaluation = evaluate_policy(EVOLVED_POLICY, BASELINE_POLICY, + replay_env=ReplayEnv(trace), trials=3, + episodes=6, bootstrap_iterations=200) + decision = promote(EVOLVED_POLICY, BASELINE_POLICY, evaluation) + assert decision.status != PromotionStatus.PROMOTED + assert "stage" in str(decision.reasons) + + def test_missing_stage_fails_closed(self) -> None: + decision = promote(EVOLVED_POLICY, BASELINE_POLICY, {"stage_a": {}}) + assert decision.status == PromotionStatus.REJECTED_INCOMPLETE + + def test_prospective_failure_rejected(self) -> None: + evaluation = { + "stage_a": {"x": 1}, + "stage_b": {"is_prospective_evidence": True, + "primary": {"delta": -1.0, "ci_low": -2.0, "p_value": 0.9}, + "secondary": {"ci_low": -1.0}}, + "stage_c": {"is_prospective_evidence": True, + "primary": {"delta": 1.0, "ci_low": 0.1}}, + } + decision = promote(EVOLVED_POLICY, BASELINE_POLICY, evaluation) + assert decision.status in (PromotionStatus.REJECTED_PROSPECTIVE, + PromotionStatus.REJECTED_INDEPENDENT) + assert decision.checksum() + + def test_replay_evaluation_reports_limits(self, trace: DiscoveryTrace) -> None: + metrics = replay_evaluation(ReplayEnv(trace), REPLAY_POLICY) + assert metrics["is_prospective_evidence"] is False + assert metrics["replay_limitations"] + + +class TestPilotAndVerification: + @pytest.fixture(scope="class") + def bundle(self, tmp_path_factory: pytest.TempPathFactory) -> Path: + path = tmp_path_factory.mktemp("meta") / "protocol-241-v1" + run_pilot(path, trials=3, episodes=6, bootstrap_iterations=200) + return path + + def test_bundle_is_deterministic_and_verifies(self, bundle: Path) -> None: + verdict = verify_pilot(bundle) + assert verdict["verified"] is True + assert verdict["n_files_verified"] > 5 + assert verdict["trace_integrity"] is True + first = (bundle / "checksums.json").read_bytes() + run_pilot(bundle, trials=3, episodes=6, bootstrap_iterations=200) + assert (bundle / "checksums.json").read_bytes() == first + + def test_tampered_artifact_detected(self, bundle: Path) -> None: + report = bundle / "report.md" + original = report.read_text() + report.write_text(original + "\nTAMPERED\n") + verdict = verify_pilot(bundle) + assert verdict["verified"] is False + assert "report.md" in verdict["mismatches"] + report.write_text(original) + + def test_corrupted_trace_detected(self, bundle: Path, tmp_path: Path) -> None: + copy = tmp_path / "bundle-copy" + copy.mkdir() + for path in bundle.rglob("*"): + if path.is_file(): + dest = copy / path.relative_to(bundle) + dest.parent.mkdir(parents=True, exist_ok=True) + dest.write_bytes(path.read_bytes()) + trace_path = copy / "trace.json" + raw = json.loads(trace_path.read_text()) + raw["nodes"][1]["observation"]["discovery"] = True + trace_path.write_text(json.dumps(raw)) + verdict = verify_pilot(copy) + assert verdict["verified"] is False + + def test_training_trace_is_labelled_synthetic(self, bundle: Path) -> None: + manifest = json.loads((bundle / "manifest.json").read_text()) + assert manifest["trace_kind"] == "synthetic_pilot_trace" + assert manifest["trace_is_prospective_evidence"] is False + assert build_pilot_trace().verify_integrity() diff --git a/spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md b/spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md new file mode 100644 index 0000000..e9a6353 --- /dev/null +++ b/spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md @@ -0,0 +1,81 @@ +# Protocol 241 — Meta-Search: replay-grounded search-policy improvement + +**Status:** PRE-REGISTERED (frozen before pilot execution) — 2026-11-19 +**Owner:** AlgoLab meta-search capability (MASTER_SPEC §13, milestone M5 concept) +**Prior art:** protocols 230–240; DREAM-RSI audit +`docs/research/DREAM_RSI_INTEGRATION_AUDIT.md` + +## Research question + +Can a versioned, cost-aware search policy, evaluated against frozen discovery +traces and then tested prospectively, improve AlgoLab's rate of validated +algorithm discoveries per compute credit relative to the existing fixed search +policy — without degrading generalization to a held-out task family? + +## Hypotheses + +- **H0 (null):** the candidate policy's discovery rate per credit is equal to + or worse than the fixed baseline on prospective experiments. +- **H1 (alternative):** the candidate policy's discovery rate per credit is + strictly greater than the fixed baseline prospectively **and** is not + degraded on the held-out family. + +## Arms (all deterministic, no paid APIs) + +1. `fixed-baseline` — existing fixed lexicographic search policy (A). +2. `replay-cost-aware` — DREAM-RSI-inspired per-credit success scoring with + bounded exploration (B). +3. `evolved` — committed cost-efficiency plus effect-size term (C). +4. `random-control` — seeded uniform random selection (D, calibration floor). + +## Preregistered design + +- **Substrate:** `algolab.search.toy` (planted truth, two-seed replication + gate), identical to the knowledge-loop line for continuity. +- **Training families:** alpha, beta. **Held-out confirmation family:** gamma. +- **Primary outcome:** validated discoveries per compute credit. +- **Secondary outcome:** distinct useful methods discovered per credit. +- **Seeds:** measurement base `424242`; confirmation base `989898`; replay seed + `17`; trace seed `77100`. All preregistered and embedded in the bundle. +- **Trials:** 4 per family (pilot). **Episodes:** 8 per trial. **Budget:** 10 + credits per trial; selection stops when the budget would be exceeded. +- **Statistics:** paired bootstrap 95% CI (1000 resamples) on per-trial deltas, + Welch p-value, Cohen's d; Benjamini-Hochberg correction is applied when more + than one arm is tested against the baseline. +- **Missing data / unexplored branches:** replay records counterfactual + decisions with `uncertain=true` and **no outcome label**. No estimate is + manufactured. Replay output is marked `is_prospective_evidence=false`. +- **Multiple comparisons:** four arms versus one baseline; BH-FDR across the + three non-baseline arms if the pilot is treated as confirmatory (it is not). + +## Promotion gate (fixed before results; fail-closed) + +- Stage A — historical replay: diagnostic only; **can never promote**. +- Stage B — prospective: primary delta > 0, CI lower bound > 0, p < 0.05; + secondary CI lower bound ≥ 0. +- Stage C — independent confirmation on fresh seeds and held-out gamma: + delta ≥ 0 and CI lower bound ≥ −0.001. +- Stage D — explicit, checksummed decision with rollback pointer. Any missing + or failed stage → rejection. + +## Exploratory vs confirmatory + +This run is an **exploratory pilot** on a *synthetic* frozen trace (labelled as +such in the bundle). It validates the mechanism and gates; a policy promoted +here would still require a new confirmatory run on real recorded traces before +eligibility for research use. Negative results are valid and will be reported +as measured. + +## Stopping rules and resource limits + +Pilot is one bounded run (≤ 4 arms × 2 families × 4 trials × 8 episodes). +No unbounded loops, no network access at runtime, no generated code deployment, +no automatic changes to governance or promotion criteria. + +## Reproduction + +```bash +cd implementation/algolab +.venv/bin/python -m algolab.cli.main meta-search-run --dir experiments/protocol-241-v1 +.venv/bin/python -m algolab.cli.main meta-verify --dir experiments/protocol-241-v1 +``` From 3f669a3df1a2fb41dfb45d244fd8f2e8ea20f6f6 Mon Sep 17 00:00:00 2001 From: nulllabtests Date: Thu, 19 Nov 2026 18:57:50 +0000 Subject: [PATCH 2/7] docs(protocol-241): record negative meta-search pilot, diagnostic and audit --- README.md | 15 ++ docs/STATUS.md | 6 + docs/research/DREAM_RSI_INTEGRATION_REPORT.md | 128 +++++++++++++ implementation/algolab/README.md | 1 + .../protocol-241-v1-diagnostic/checksums.json | 1 + .../evaluations/evolved.json | 1 + .../evaluations/fixed-baseline.json | 1 + .../evaluations/random-control.json | 1 + .../evaluations/replay-cost-aware.json | 1 + .../protocol-241-v1-diagnostic/manifest.json | 1 + .../promotions/evolved.json | 1 + .../promotions/fixed-baseline.json | 1 + .../promotions/random-control.json | 1 + .../promotions/replay-cost-aware.json | 1 + .../replay/evolved.json | 1 + .../replay/fixed-baseline.json | 1 + .../replay/random-control.json | 1 + .../replay/replay-cost-aware.json | 1 + .../protocol-241-v1-diagnostic/report.md | 12 ++ .../protocol-241-v1-diagnostic/trace.json | 1 + .../trace.json.sha256 | 1 + .../protocol-241-v1/checksums.json | 1 + .../protocol-241-v1/evaluations/evolved.json | 1 + .../evaluations/fixed-baseline.json | 1 + .../evaluations/random-control.json | 1 + .../evaluations/replay-cost-aware.json | 1 + .../experiments/protocol-241-v1/manifest.json | 1 + .../protocol-241-v1/promotions/evolved.json | 1 + .../promotions/fixed-baseline.json | 1 + .../promotions/random-control.json | 1 + .../promotions/replay-cost-aware.json | 1 + .../protocol-241-v1/replay/evolved.json | 1 + .../replay/fixed-baseline.json | 1 + .../replay/random-control.json | 1 + .../replay/replay-cost-aware.json | 1 + .../experiments/protocol-241-v1/report.md | 12 ++ .../experiments/protocol-241-v1/trace.json | 1 + .../protocol-241-v1/trace.json.sha256 | 1 + .../src/algolab/meta_search/__init__.py | 26 +-- .../src/algolab/meta_search/evaluation.py | 171 +++++++++++++----- .../src/algolab/meta_search/policies.py | 37 +++- .../src/algolab/meta_search/protocol_241.py | 86 ++++++--- .../algolab/src/algolab/meta_search/replay.py | 27 +-- .../algolab/src/algolab/meta_search/traces.py | 4 +- .../algolab/tests/test_meta_search.py | 148 +++++++++++---- 45 files changed, 556 insertions(+), 149 deletions(-) create mode 100644 docs/research/DREAM_RSI_INTEGRATION_REPORT.md create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/checksums.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/evolved.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/random-control.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/manifest.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/evolved.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/random-control.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/evolved.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/random-control.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/report.md create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/trace.json create mode 100644 implementation/algolab/experiments/protocol-241-v1-diagnostic/trace.json.sha256 create mode 100644 implementation/algolab/experiments/protocol-241-v1/checksums.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/evaluations/evolved.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/evaluations/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/evaluations/random-control.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/evaluations/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/manifest.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/promotions/evolved.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/promotions/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/promotions/random-control.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/promotions/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/replay/evolved.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/replay/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/replay/random-control.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/replay/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/report.md create mode 100644 implementation/algolab/experiments/protocol-241-v1/trace.json create mode 100644 implementation/algolab/experiments/protocol-241-v1/trace.json.sha256 diff --git a/README.md b/README.md index 4a86f34..819e5ad 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,21 @@ is optimal in-domain but fragile under shift, so pair it with adaptation whenever transfer is on the line; family-conditioning requires informative slice sizes to pay off. +## Meta-Search (protocol 241, exploratory pilot) + +AlgoLab can now record its own research search histories, replay alternative +decisions against them, and evaluate versioned search policies with a +fail-closed promotion gate. Built from DREAM-RSI ideas but AlgoLab-native; +no policy source is self-modified and no paid API is required. + +- Audit: `docs/research/DREAM_RSI_INTEGRATION_AUDIT.md` +- Report: `docs/research/DREAM_RSI_INTEGRATION_REPORT.md` +- Preregistration: `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` +- Run: `algolab meta-search-run --dir experiments/protocol-241-v1` then + `algolab meta-verify --dir experiments/protocol-241-v1` +- Result: **negative** — no arm beat the fixed baseline; nothing promoted. + Historical replay is explicitly *not* prospective evidence. + ## Non-negotiable constraints - **Human oversight by default, autonomy by exception** — autonomy is diff --git a/docs/STATUS.md b/docs/STATUS.md index 4f50408..284e596 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -42,6 +42,12 @@ S2 = protocol 237) — see `docs/quality/protocol-236-conflict.md`. Entry format |---|---|---|---|---| | 10 | A closed 585-program grammar (1–3 typed transforms, no repeats) over three sklearn datasets yields **no** significant policy advantage over uniform random program search on distinct-validated-programs/credit in either training family (H1–H5 all false), and **no** arm's champion transfers positively to the held-out family; outcome class **C**. Scoped to this 585-program space, not to knowledge loops in general | 10 trials/family | `spec/research/240_GENERATIVE_COMPOSITION_SEARCH.md` | `experiments/protocol-240-v1/` | +## meta-search substrate (protocol 241, replay-grounded policy improvement) + +| # | Claim | n | Spec | Evidence | +|---|---|---|---|---| +| 11 | Exploratory pilot only: no policy beat the fixed baseline on discoveries/credit (all REJECTED_PROSPECTIVE); the preregistered 10-credit budget was below most operator costs. A post-hoc 40-credit diagnostic also found no improvement (cost-aware Δ = −0.006548, p = 0.14). No promotion; replay never used as prospective evidence | 4 trials/family | `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` | `experiments/protocol-241-v1/`, `experiments/protocol-241-v1-diagnostic/` | + ## Official milestones (per `planning/MILESTONES.md`) M0 Delivered · M1 Delivered · **M2 Reference rediscovery — not delivered diff --git a/docs/research/DREAM_RSI_INTEGRATION_REPORT.md b/docs/research/DREAM_RSI_INTEGRATION_REPORT.md new file mode 100644 index 0000000..4be2b3c --- /dev/null +++ b/docs/research/DREAM_RSI_INTEGRATION_REPORT.md @@ -0,0 +1,128 @@ +# DREAM-RSI → AlgoLab integration report + +**Date:** 2026-11-19 · **Protocol:** 241 (preregistered, frozen before run) +**Starting commit:** `ac1df7d8b838a92dd5a5d751ca419bb558666b7c` (`main`, clean tree) +**DREAM-RSI commit inspected:** `8ec35bd2538220517ce1bfca4282db21b8c518db` +**Branch:** `integration/dream-rsi-meta-search` + +## 1. What was learned from DREAM-RSI + +DREAM-RSI's reusable insight is not "let an agent rewrite policy source"; it is +the separation of a *frozen replay world* from *live search*, a prefix-only +decision interface, and a promotion step that refuses to select a policy that +failed qualification. Its `TraceEnv` reveals only recorded outcomes, its +`raw_scores.json` freezes a world, and its `heuristic_search/eval.py` scores +policies by attainment AUC minus a parallelism penalty. Selection in +`workflow.py` is a deterministic argmax over *qualified* rounds, never a bandit. +Source-level facts that differ from the README: no `DiscoverEnv`, no bandit/UCB, +code default agent is `claude`, code grid default 2×2. + +## 2–4. Reused / rewritten / rejected + +Full file-by-file classification is in +`DREAM_RSI_INTEGRATION_AUDIT.md`. Summary: + +- **Ideas adapted (no source copied):** frozen replay trace, prefix-only + probing, explicit cost accounting, qualification-before-promotion. +- **Rewritten AlgoLab-native:** `algolab/meta_search/traces.py` + (content-addressed append-only trace with sha256 chain and canonical JSON), + `replay.py` (read-only replay + outcome-kind enum + counterfactual + uncertainty), `policies.py` (frozen structured versioned policy + proposals), + `evaluation.py` (four-stage fail-closed gate using the existing + `algolab.statistics`), `protocol_241.py` (one sealed, deterministic bundle). +- **Rejected:** agent-rewritten policy modules and model SDKs (violates + MASTER_SPEC §13 / no-paid-API requirement); `NodeStore` filesystem tree and + trace-pool (would duplicate the event store/artifact store); KernelBench and + SimpleTES/AGPL tasks (wrong substrate, incompatible license). + +## 5. Architecture changes + +```text +search-run bundles (230–240) meta-search (241) + toy/hpo/transform/compose ──seed──▶ DiscoveryTrace (append-only, checksummed) + │ + ▼ + ReplayEnv ── Stage A (diagnostic only) + │ + SearchPolicy (versioned, frozen) ── Stage B (prospective, toy substrate) + │ ── Stage C (held-out gamma, fresh seeds) + ▼ + promote() ── Stage D (fail-closed, checksummed verdict) + │ + meta-search-run / meta-verify (sealed bundle) +``` + +No second event store, budget ledger, experiment registry or artifact manager +was introduced. The toy substrate and `algolab.statistics` are reused directly. + +## 6. Dependencies and licenses + +No new runtime dependency. DREAM-RSI is Apache-2.0 (`Copyright 2026 Google +LLC`); ideas-only reuse means no copying obligations attach, but attribution is +recorded in `implementation/algolab/THIRD_PARTY_NOTICES.md` and the audit. +Nothing from MIT-vendored or AGPL-fetched upstream trees was imported. + +## 7–8. Hypothesis and methodology + +Preregistered in `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` before +execution: H0 = no improvement in validated discoveries per credit; H1 = +improvement with no held-out degradation. Four deterministic arms (fixed +baseline, replay/cost-aware, evolved, seeded random control), matched seeds and +budgets, paired bootstrap 95% CI + Welch p + Cohen's d, held-out family gamma +for confirmation. Promotion requires prospective significance and non-negative +held-out delta; replay alone cannot promote. + +## 9. Results (pilot vs diagnostic — clearly distinguished) + +**Preregistered pilot** (`experiments/protocol-241-v1/`): all four arms scored +0 discoveries/credit on training families; every arm `REJECTED_PROSPECTIVE` +(primary p = 1.0 for the three non-control arms). **No policy was promoted.** +Independent verification: `verified=True`, 16 files verified, trace integrity +OK, no replay-only promotion. + +**Post-hoc exploratory diagnostic** (`experiments/protocol-241-v1-diagnostic/`, +NOT preregistered, NOT confirmatory): budget raised 10 → 40 credits after the +pilot revealed that most operator costs (10–40 credits) exceed the 10-credit +preregistered trial budget, so most trials terminated before a measurement. +At the feasible budget the cost-aware and evolved arms were slightly *worse* +than baseline (Δ = −0.006548/credit, 95% CI low −0.0125, p = 0.14) and the +random control Δ = −0.007540 (p = 0.31); held-out deltas also non-positive. +All arms again `REJECTED_PROSPECTIVE`, bundle independently verified. + +**Conclusion:** no research improvement is claimed. The capability works +(traces record, replay stays counterfactual-honest, gates fail closed), but the +tested policies did not discover algorithms better than the fixed baseline +under the same budget. This is a negative result reported as measured. + +## 10. Limitations + +- The pilot's frozen "history" is a **synthetic trace** (labelled as such); no + real meta-search histories existed prior to protocol 241. +- Replay cannot estimate outcomes for branches never explored; those decisions + are recorded with `uncertain=true` and no label. +- Toy substrate only; no real-workload transfer shown. +- The preregistered budget was mis-scaled to operator costs, making the pilot + uninformative about policy quality; the diagnostic is post-hoc. +- Sample size (4 trials/family) is small; no confirmatory run is justified. + +## 11. Reproduction + +```bash +cd implementation/algolab +.venv/bin/python -m pytest -q +.venv/bin/python -m ruff check src tests scripts +.venv/bin/python -m mypy +.venv/bin/python -m algolab.cli.main meta-search-run --dir experiments/protocol-241-v1 --force +.venv/bin/python -m algolab.cli.main meta-verify --dir experiments/protocol-241-v1 +# post-hoc diagnostic only: +.venv/bin/python -m algolab.cli.main meta-search-run --dir experiments/protocol-241-v1-diagnostic --budget 40 --force +``` + +## 12. Future research + +1. Re-scale the *preregistered* budget and episodes to operator costs and + rerun as a new protocol (242) with ≥ 8 trials/family and BH-FDR. +2. Replace the synthetic trace with real accumulated search traces from + `search-run` bundles (requires a trace-export bridge). +3. Add a held-out *task* (not only family) and an LLM-proposer arm that is + strictly optional and gated by the same promotion logic. diff --git a/implementation/algolab/README.md b/implementation/algolab/README.md index 7a35a00..377fd68 100644 --- a/implementation/algolab/README.md +++ b/implementation/algolab/README.md @@ -138,6 +138,7 @@ src/algolab/ workloads/ adapter interface + deterministic quadratic_optimizer workload knowledge/ evidence records, M4 operator catalog, skill registry search/ protocol-230 toy environment, policies, A/B/C comparison harness + meta_search/ protocol-241 replay traces, versioned policies, fail-closed promotion statistics.py deterministic inference: bootstrap CI, Welch's t, Cohen's d, FDR util.py shared utilities schemas/ canonical JSON Schemas (byte-identical copies) diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/checksums.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/checksums.json new file mode 100644 index 0000000..bb17666 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/checksums.json @@ -0,0 +1 @@ +{"evaluations/evolved.json":"b7b4a8217c8291e8dfa7d208c2da77a590172549ab2fe97b896cb2c0f68f767c","evaluations/fixed-baseline.json":"fe832877b17654d683455c3550e397ee33271a05cfff7427a2316d100d68976b","evaluations/random-control.json":"b053b7f1b58cd56e6d53f239568ef2f13ea76160597e37c289141aaa4aa338b8","evaluations/replay-cost-aware.json":"b9bb8b5e0d7d27c6ba571ac18e55efb3731522b4e14414e7af4bea7bc9a9fa49","manifest.json":"281ff7aed9ae79ce3d74f650f3e51d9928caa98a21c4661c1f76333c4c8b2615","promotions/evolved.json":"4f9ca6f6c693a56aa392046f9462f20f736f52f2b7e31387fcc3b45410f081a3","promotions/fixed-baseline.json":"912d3f694b627767f8129d26a308c7a5103be2d309bdb03bd6d7329d2406e733","promotions/random-control.json":"1436737121b15f1a3cf2ff5b51558a5c14bc449ee613382229a74acabde87861","promotions/replay-cost-aware.json":"0a5c4593db045d9eca5dd4b1197ca65cd2b3437a95b41d9098aad9700d56fc93","replay/evolved.json":"965957455bdbeb255d65d4d749740517db4df4f1979ec5ba1bab6bdc9d7e14f8","replay/fixed-baseline.json":"f975455adb04ba891f795c590fe01271539b637436472656ca703b0f7a4f5bd5","replay/random-control.json":"d6d7930cb23640d07928b1d9dd800e3423a73407fca5e9da77e178a62b7764f1","replay/replay-cost-aware.json":"a33c190624e216a1a1331f3103ac82ffa24045fda9352d20ce819a09f09a951e","report.md":"e330a70a9b9019989131267383885241863fa423ef09b36d825783b5448ef80c","trace.json":"2d18c0163bbb3eccca3a0ca577b503a1042652b6cdf0bfd8c6c52f73a6423ed8","trace.json.sha256":"ca1277998d2326da994ac4ddcf3c76a8c0f48134b84aaeaad22b8f8ce88fbdb4"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/evolved.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/evolved.json new file mode 100644 index 0000000..dffa6d7 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"6e30d0fa2f04fc5f43219353cbd7cd8724d1ca478b9a6170d44794da1f73c7ac","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.016666666666666666,"candidate_mean":0.01011904761904762,"ci_high":-0.0020833333333333333,"ci_low":-0.0125,"delta":-0.006547619047619047,"effect_size":-0.5268044568716332,"p_value":0.13986013986013987},"secondary":{"ci_high":0.0,"ci_low":-0.0008928571428571429,"delta":-0.00029761904761904656,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.029166666666666667,"candidate_mean":0.016666666666666666,"ci_high":-0.004166666666666667,"ci_low":-0.016666666666666666,"delta":-0.0125,"effect_size":-2.121320343559643,"p_value":0.24575424575424576},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/fixed-baseline.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/fixed-baseline.json new file mode 100644 index 0000000..6ebf710 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"da60739104b272a6581d9baebcf80f3c2ad4e1f51fea209c53c60a10c3630ff6","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.016666666666666666,"candidate_mean":0.016666666666666666,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.029166666666666667,"candidate_mean":0.029166666666666667,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/random-control.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/random-control.json new file mode 100644 index 0000000..15886e9 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/random-control.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"af72a6dfa1104985983a52b6d5181feb8064c86e07e0b92d0e8dc8f9d0f77463","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.016666666666666666,"candidate_mean":0.009126984126984128,"ci_high":0.0056547619047619055,"ci_low":-0.018353174603174604,"delta":-0.007539682539682539,"effect_size":-0.5763248806304034,"p_value":0.3106893106893107},"secondary":{"ci_high":0.009027777777777777,"ci_low":-0.011805555555555555,"delta":-0.0012896825396825386,"p_value":0.9040959040959041},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.029166666666666667,"candidate_mean":0.009545454545454544,"ci_high":-0.005909090909090909,"ci_low":-0.03333333333333333,"delta":-0.019621212121212123,"effect_size":-2.005283155145496,"p_value":0.24575424575424576},"secondary":{"ci_high":0.0024242424242424242,"ci_low":-0.016666666666666666,"delta":-0.007121212121212122,"p_value":0.5144855144855145},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/replay-cost-aware.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/replay-cost-aware.json new file mode 100644 index 0000000..0b6c278 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/evaluations/replay-cost-aware.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"bf6e55036cbef154116f13841614028621bcfffdec1aa6a22d280c76552b5f24","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.016666666666666666,"candidate_mean":0.01011904761904762,"ci_high":-0.0020833333333333333,"ci_low":-0.0125,"delta":-0.006547619047619047,"effect_size":-0.5268044568716332,"p_value":0.13986013986013987},"secondary":{"ci_high":0.0,"ci_low":-0.0008928571428571429,"delta":-0.00029761904761904656,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.029166666666666667,"candidate_mean":0.016666666666666666,"ci_high":-0.004166666666666667,"ci_low":-0.016666666666666666,"delta":-0.0125,"effect_size":-2.121320343559643,"p_value":0.24575424575424576},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/manifest.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/manifest.json new file mode 100644 index 0000000..72c7931 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/manifest.json @@ -0,0 +1 @@ +{"arms":["fixed-baseline","replay-cost-aware","evolved","random-control"],"bootstrap_iterations":1000,"budget":40.0,"confirmation_seed_base":989898,"episodes":8,"families":["alpha","beta"],"held_out_family":"gamma","promotion_gate":"stage A replay-only never promotes; B requires positive CI and p<0.05; C requires non-negative delta and CI>=-0.001 on held-out gamma","protocol":"protocol-241","protocol_version":"1.0.0","schema_version":"meta-pilot/1.0","seed_base":424242,"substrate":"algolab.search.toy","trace_is_prospective_evidence":false,"trace_kind":"synthetic_pilot_trace","trials":4} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/evolved.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/evolved.json new file mode 100644 index 0000000..81ccbfd --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"6e30d0fa2f04fc5f43219353cbd7cd8724d1ca478b9a6170d44794da1f73c7ac","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.016666666666666666,"candidate_mean":0.01011904761904762,"ci_high":-0.0020833333333333333,"ci_low":-0.0125,"delta":-0.006547619047619047,"effect_size":-0.5268044568716332,"p_value":0.13986013986013987},"secondary":{"ci_high":0.0,"ci_low":-0.0008928571428571429,"delta":-0.00029761904761904656,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.029166666666666667,"candidate_mean":0.016666666666666666,"ci_high":-0.004166666666666667,"ci_low":-0.016666666666666666,"delta":-0.0125,"effect_size":-2.121320343559643,"p_value":0.24575424575424576},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}},"promotion_checksum":"e524420239855dd91b207ecb0d6e3da292a29b642227f4733a6cfd8f2880b831","reasons":["prospective primary metric did not significantly beat baseline (delta=-0.00654762, ci_low=-0.0125, p=0.13986)","prospective secondary metric shows significant degradation","independent confirmation degraded on the held-out family (delta=-0.0125, ci_low=-0.0166667)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/fixed-baseline.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/fixed-baseline.json new file mode 100644 index 0000000..e3e5cab --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"da60739104b272a6581d9baebcf80f3c2ad4e1f51fea209c53c60a10c3630ff6","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.016666666666666666,"candidate_mean":0.016666666666666666,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.029166666666666667,"candidate_mean":0.029166666666666667,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}},"promotion_checksum":"145914ddda3db4fbd8959b8faba7baca9c2a432fda4e1de2318746e0c40a6c04","reasons":["prospective primary metric did not significantly beat baseline (delta=0, ci_low=0, p=1)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/random-control.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/random-control.json new file mode 100644 index 0000000..5ff218e --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/random-control.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"af72a6dfa1104985983a52b6d5181feb8064c86e07e0b92d0e8dc8f9d0f77463","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.016666666666666666,"candidate_mean":0.009126984126984128,"ci_high":0.0056547619047619055,"ci_low":-0.018353174603174604,"delta":-0.007539682539682539,"effect_size":-0.5763248806304034,"p_value":0.3106893106893107},"secondary":{"ci_high":0.009027777777777777,"ci_low":-0.011805555555555555,"delta":-0.0012896825396825386,"p_value":0.9040959040959041},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.029166666666666667,"candidate_mean":0.009545454545454544,"ci_high":-0.005909090909090909,"ci_low":-0.03333333333333333,"delta":-0.019621212121212123,"effect_size":-2.005283155145496,"p_value":0.24575424575424576},"secondary":{"ci_high":0.0024242424242424242,"ci_low":-0.016666666666666666,"delta":-0.007121212121212122,"p_value":0.5144855144855145},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}},"promotion_checksum":"8d8087ac7f0b81934ddbf230f1cf8a5e0ad01b5c70abdc93d66137d43ef56fc4","reasons":["prospective primary metric did not significantly beat baseline (delta=-0.00753968, ci_low=-0.0183532, p=0.310689)","prospective secondary metric shows significant degradation","independent confirmation degraded on the held-out family (delta=-0.0196212, ci_low=-0.0333333)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/replay-cost-aware.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/replay-cost-aware.json new file mode 100644 index 0000000..982d332 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/promotions/replay-cost-aware.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"bf6e55036cbef154116f13841614028621bcfffdec1aa6a22d280c76552b5f24","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.016666666666666666,"candidate_mean":0.01011904761904762,"ci_high":-0.0020833333333333333,"ci_low":-0.0125,"delta":-0.006547619047619047,"effect_size":-0.5268044568716332,"p_value":0.13986013986013987},"secondary":{"ci_high":0.0,"ci_low":-0.0008928571428571429,"delta":-0.00029761904761904656,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.029166666666666667,"candidate_mean":0.016666666666666666,"ci_high":-0.004166666666666667,"ci_low":-0.016666666666666666,"delta":-0.0125,"effect_size":-2.121320343559643,"p_value":0.24575424575424576},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}},"promotion_checksum":"10b40b4f6eb55e3f56d0882248b2fa5a29c7619fac81952126963972cefeb3d2","reasons":["prospective primary metric did not significantly beat baseline (delta=-0.00654762, ci_low=-0.0125, p=0.13986)","prospective secondary metric shows significant degradation","independent confirmation degraded on the held-out family (delta=-0.0125, ci_low=-0.0166667)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/evolved.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/evolved.json new file mode 100644 index 0000000..3967ea4 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/evolved.json @@ -0,0 +1 @@ +{"decisions":[{"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"decompose","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":20.0,"discovery":false},"mean_effect":0.11911692581118542,"valid":true},"outcome_kind":"observed","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_b803f0dfb32e0c1eaa5f","uncertain":false,"uncertainty_reason":""},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_2f07435447972fcebbcb","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_e841c68c59903a602e35","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_a06a9ad5a8c6e332be5a","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_9a2ad8dbcf6724758ef7","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":4,"observed":1},"policy_id":"pol-evolved","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_decisions":5,"n_observed":1,"n_uncertain":4},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/fixed-baseline.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/fixed-baseline.json new file mode 100644 index 0000000..8dfb4da --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/fixed-baseline.json @@ -0,0 +1 @@ +{"decisions":[{"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"decompose","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":20.0,"discovery":false},"mean_effect":0.11911692581118542,"valid":true},"outcome_kind":"observed","rationale":"fixed priority order (no learning)","state_node_id":"trn_b803f0dfb32e0c1eaa5f","uncertain":false,"uncertainty_reason":""},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_2f07435447972fcebbcb","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_e841c68c59903a602e35","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_a06a9ad5a8c6e332be5a","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_9a2ad8dbcf6724758ef7","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":4,"observed":1},"policy_id":"pol-fixed-baseline","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_decisions":5,"n_observed":1,"n_uncertain":4},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/random-control.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/random-control.json new file mode 100644 index 0000000..898f125 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/random-control.json @@ -0,0 +1 @@ +{"decisions":[{"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_b803f0dfb32e0c1eaa5f","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_2f07435447972fcebbcb","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_e841c68c59903a602e35","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_a06a9ad5a8c6e332be5a","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_9a2ad8dbcf6724758ef7","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":5,"observed":0},"policy_id":"pol-random-control","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_decisions":5,"n_observed":0,"n_uncertain":5},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/replay-cost-aware.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/replay-cost-aware.json new file mode 100644 index 0000000..2b8222b --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/replay/replay-cost-aware.json @@ -0,0 +1 @@ +{"decisions":[{"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"decompose","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":20.0,"discovery":false},"mean_effect":0.11911692581118542,"valid":true},"outcome_kind":"observed","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_b803f0dfb32e0c1eaa5f","uncertain":false,"uncertainty_reason":""},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_2f07435447972fcebbcb","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_e841c68c59903a602e35","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_a06a9ad5a8c6e332be5a","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_9a2ad8dbcf6724758ef7","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":4,"observed":1},"policy_id":"pol-replay-cost-aware","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_decisions":5,"n_observed":1,"n_uncertain":4},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/report.md b/implementation/algolab/experiments/protocol-241-v1-diagnostic/report.md new file mode 100644 index 0000000..6163df6 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/report.md @@ -0,0 +1,12 @@ +# protocol-241 — Meta-Search bounded pilot + +Status: **exploratory pilot**. The historical trace is synthetic and is not prospective evidence. No policy is promoted on replay performance. + +| Arm | Replay agreement | Prospective Δ/credit | 95% CI low | p | Held-out Δ | Promotion | +|---|---|---|---|---|---|---| +| fixed-baseline | 0.000 | +0.000000 | +0.000000 | 1.0000 | +0.000000 | REJECTED_PROSPECTIVE | +| replay-cost-aware | 0.000 | -0.006548 | -0.012500 | 0.1399 | -0.012500 | REJECTED_PROSPECTIVE | +| evolved | 0.000 | -0.006548 | -0.012500 | 0.1399 | -0.012500 | REJECTED_PROSPECTIVE | +| random-control | 0.000 | -0.007540 | -0.018353 | 0.3107 | -0.019621 | REJECTED_PROSPECTIVE | + +Primary outcome: validated discoveries per credit (paired across matched trials). Secondary: distinct useful methods per credit. Negative results are reported as measured. diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/trace.json b/implementation/algolab/experiments/protocol-241-v1-diagnostic/trace.json new file mode 100644 index 0000000..3e44d1a --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/trace.json @@ -0,0 +1 @@ +{"experiment_id":"EXP-META-241","nodes":[{"artifact_refs":[],"candidate_generation_method":"fixed-baseline","candidate_id":"root","checksum":"b803f0dfb32e0c1eaa5f07f1ea8b7e31297c5ccced8cf7c8ca77ea95f458457a","compute_credits":0.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.0},"eval_split_id":"train","evaluation_result":{},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_b803f0dfb32e0c1eaa5f","observation":{"discovery":false,"valid":true},"parent_id":null,"policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"0000000000000000000000000000000000000000000000000000000000000000","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"families":["alpha","beta"]},"seed":77100,"selection_decision":"seed root","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"tune","candidate_id":"cand-tune","checksum":"2f07435447972fcebbcb553e2b570efb61daf9ac56e139aa1b4ef95c6d877ea7","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.36484432941054523},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_2f07435447972fcebbcb","observation":{"discovery":false,"mean_effect":0.36484432941054523,"valid":false},"parent_id":"trn_b803f0dfb32e0c1eaa5f","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"b803f0dfb32e0c1eaa5f07f1ea8b7e31297c5ccced8cf7c8ca77ea95f458457a","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0},"seed":77100,"selection_decision":"expand tune","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"reparameterize","candidate_id":"cand-reparameterize","checksum":"e841c68c59903a602e354ff678d2a7686546479882628477f75fb8f1a9ea02c0","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.5768893801470273},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_e841c68c59903a602e35","observation":{"discovery":false,"mean_effect":0.5768893801470273,"valid":false},"parent_id":"trn_b803f0dfb32e0c1eaa5f","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"2f07435447972fcebbcb553e2b570efb61daf9ac56e139aa1b4ef95c6d877ea7","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"beta","trial":1},"seed":77101,"selection_decision":"expand reparameterize","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"decompose","candidate_id":"cand-decompose","checksum":"a06a9ad5a8c6e332be5a134b2e6a467f012ba9fca536c3190dd8d5c77dba06ce","compute_credits":20.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.11911692581118542},"eval_split_id":"train","evaluation_result":{"cost_credits":20.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_a06a9ad5a8c6e332be5a","observation":{"discovery":false,"mean_effect":0.11911692581118542,"valid":true},"parent_id":"trn_b803f0dfb32e0c1eaa5f","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"e841c68c59903a602e354ff678d2a7686546479882628477f75fb8f1a9ea02c0","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":2},"seed":77102,"selection_decision":"expand decompose","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"refresh","candidate_id":"cand-refresh","checksum":"9a2ad8dbcf6724758ef756d347e46f2897f96db46e39e35773487e4ecdb6a26b","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.40859125466996377},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_9a2ad8dbcf6724758ef7","observation":{"discovery":false,"mean_effect":0.40859125466996377,"valid":false},"parent_id":"trn_b803f0dfb32e0c1eaa5f","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"a06a9ad5a8c6e332be5a134b2e6a467f012ba9fca536c3190dd8d5c77dba06ce","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"beta","trial":3},"seed":77103,"selection_decision":"expand refresh","statement_kind":"observation","stopping_decision":""}],"schema_version":"meta-trace/1.0","trace_id":"trace-pilot-241"} \ No newline at end of file diff --git a/implementation/algolab/experiments/protocol-241-v1-diagnostic/trace.json.sha256 b/implementation/algolab/experiments/protocol-241-v1-diagnostic/trace.json.sha256 new file mode 100644 index 0000000..be22ebf --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1-diagnostic/trace.json.sha256 @@ -0,0 +1 @@ +2d18c0163bbb3eccca3a0ca577b503a1042652b6cdf0bfd8c6c52f73a6423ed8 diff --git a/implementation/algolab/experiments/protocol-241-v1/checksums.json b/implementation/algolab/experiments/protocol-241-v1/checksums.json new file mode 100644 index 0000000..ac2202f --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/checksums.json @@ -0,0 +1 @@ +{"evaluations/evolved.json":"e22addf32d99ab852db2f4f6460d5186a43df2a909f1670e780aad09a83a9371","evaluations/fixed-baseline.json":"3c3a60b8760b296cb5b96f9288e148196895913d5c1f59479891998363f10a0d","evaluations/random-control.json":"81a81c4441c7416d1324060bcdda3301cbb81068b67475ee8bdf6c1886e842a9","evaluations/replay-cost-aware.json":"e5f7438ca2fff15d578098846b97d635126b08cc94769d6858c0783dbfbd8bf7","manifest.json":"b4e5741d37a5f87698aa44d7abbe334ed2ae2ae188797ea60011f90add0d03d1","promotions/evolved.json":"419f916fcd01199d4c225a5a6ef45aae12ea2dcf4f01bfadf86bc0cd4de64c6f","promotions/fixed-baseline.json":"70849066a36c8f4a613ecd5c202d8b5a56b0751d017d0676b8fec20d9e7c0ac2","promotions/random-control.json":"d9d317672415e2158910a24c6bc02bddc6bafe2cf0de4dc246325e1957a8819b","promotions/replay-cost-aware.json":"102bb0894f92ec0b4eb1961cdcfceb7fdf25d0df7963ba5284d7842dbe2ea29d","replay/evolved.json":"965957455bdbeb255d65d4d749740517db4df4f1979ec5ba1bab6bdc9d7e14f8","replay/fixed-baseline.json":"f975455adb04ba891f795c590fe01271539b637436472656ca703b0f7a4f5bd5","replay/random-control.json":"d6d7930cb23640d07928b1d9dd800e3423a73407fca5e9da77e178a62b7764f1","replay/replay-cost-aware.json":"a33c190624e216a1a1331f3103ac82ffa24045fda9352d20ce819a09f09a951e","report.md":"945a7f018699566f01f407e9cadb18023833683ae6d8edccd62832bcd0ab9f64","trace.json":"2d18c0163bbb3eccca3a0ca577b503a1042652b6cdf0bfd8c6c52f73a6423ed8","trace.json.sha256":"ca1277998d2326da994ac4ddcf3c76a8c0f48134b84aaeaad22b8f8ce88fbdb4"} diff --git a/implementation/algolab/experiments/protocol-241-v1/evaluations/evolved.json b/implementation/algolab/experiments/protocol-241-v1/evaluations/evolved.json new file mode 100644 index 0000000..aab0bcc --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/evaluations/evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"6e30d0fa2f04fc5f43219353cbd7cd8724d1ca478b9a6170d44794da1f73c7ac","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":10.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":10.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}} diff --git a/implementation/algolab/experiments/protocol-241-v1/evaluations/fixed-baseline.json b/implementation/algolab/experiments/protocol-241-v1/evaluations/fixed-baseline.json new file mode 100644 index 0000000..0571e5d --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/evaluations/fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"da60739104b272a6581d9baebcf80f3c2ad4e1f51fea209c53c60a10c3630ff6","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":10.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":10.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}} diff --git a/implementation/algolab/experiments/protocol-241-v1/evaluations/random-control.json b/implementation/algolab/experiments/protocol-241-v1/evaluations/random-control.json new file mode 100644 index 0000000..b8e191e --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/evaluations/random-control.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"af72a6dfa1104985983a52b6d5181feb8064c86e07e0b92d0e8dc8f9d0f77463","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":10.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0125,"ci_high":0.029166666666666667,"ci_low":0.0,"delta":0.0125,"effect_size":0.7127864449672372,"p_value":0.4885114885114885},"secondary":{"ci_high":0.029166666666666667,"ci_low":0.0,"delta":0.0125,"p_value":0.5074925074925075},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":10.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0175,"ci_high":0.037500000000000006,"ci_low":0.0,"delta":0.0175,"effect_size":1.0473848029130146,"p_value":0.4915084915084915},"secondary":{"ci_high":0.037500000000000006,"ci_low":0.0,"delta":0.0175,"p_value":0.5254745254745254},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}} diff --git a/implementation/algolab/experiments/protocol-241-v1/evaluations/replay-cost-aware.json b/implementation/algolab/experiments/protocol-241-v1/evaluations/replay-cost-aware.json new file mode 100644 index 0000000..a033297 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/evaluations/replay-cost-aware.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"bf6e55036cbef154116f13841614028621bcfffdec1aa6a22d280c76552b5f24","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":10.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":10.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}} diff --git a/implementation/algolab/experiments/protocol-241-v1/manifest.json b/implementation/algolab/experiments/protocol-241-v1/manifest.json new file mode 100644 index 0000000..20a1bed --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/manifest.json @@ -0,0 +1 @@ +{"arms":["fixed-baseline","replay-cost-aware","evolved","random-control"],"bootstrap_iterations":1000,"budget":10.0,"confirmation_seed_base":989898,"episodes":8,"families":["alpha","beta"],"held_out_family":"gamma","promotion_gate":"stage A replay-only never promotes; B requires positive CI and p<0.05; C requires non-negative delta and CI>=-0.001 on held-out gamma","protocol":"protocol-241","protocol_version":"1.0.0","schema_version":"meta-pilot/1.0","seed_base":424242,"substrate":"algolab.search.toy","trace_is_prospective_evidence":false,"trace_kind":"synthetic_pilot_trace","trials":4} diff --git a/implementation/algolab/experiments/protocol-241-v1/promotions/evolved.json b/implementation/algolab/experiments/protocol-241-v1/promotions/evolved.json new file mode 100644 index 0000000..c2bf6ae --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/promotions/evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"6e30d0fa2f04fc5f43219353cbd7cd8724d1ca478b9a6170d44794da1f73c7ac","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":10.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":10.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}},"promotion_checksum":"ad74066eee5fb4fe3c59c9878deac16058baf6eaf0d59a07fe649b39d0a6e11c","reasons":["prospective primary metric did not significantly beat baseline (delta=0, ci_low=0, p=1)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-241-v1/promotions/fixed-baseline.json b/implementation/algolab/experiments/protocol-241-v1/promotions/fixed-baseline.json new file mode 100644 index 0000000..b129ef2 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/promotions/fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"da60739104b272a6581d9baebcf80f3c2ad4e1f51fea209c53c60a10c3630ff6","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":10.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":10.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}},"promotion_checksum":"730e30dff80187d5386acca712450113fc943126dabdfa0072d0bddbf73c669f","reasons":["prospective primary metric did not significantly beat baseline (delta=0, ci_low=0, p=1)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-241-v1/promotions/random-control.json b/implementation/algolab/experiments/protocol-241-v1/promotions/random-control.json new file mode 100644 index 0000000..4e0058c --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/promotions/random-control.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"af72a6dfa1104985983a52b6d5181feb8064c86e07e0b92d0e8dc8f9d0f77463","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":10.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0125,"ci_high":0.029166666666666667,"ci_low":0.0,"delta":0.0125,"effect_size":0.7127864449672372,"p_value":0.4885114885114885},"secondary":{"ci_high":0.029166666666666667,"ci_low":0.0,"delta":0.0125,"p_value":0.5074925074925075},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":10.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0175,"ci_high":0.037500000000000006,"ci_low":0.0,"delta":0.0175,"effect_size":1.0473848029130146,"p_value":0.4915084915084915},"secondary":{"ci_high":0.037500000000000006,"ci_low":0.0,"delta":0.0175,"p_value":0.5254745254745254},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}},"promotion_checksum":"5f403d89e8935917ed6a30bed554686e89388973c25755748e01b83e9d187455","reasons":["prospective primary metric did not significantly beat baseline (delta=0.0125, ci_low=0, p=0.488511)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-241-v1/promotions/replay-cost-aware.json b/implementation/algolab/experiments/protocol-241-v1/promotions/replay-cost-aware.json new file mode 100644 index 0000000..4ad87dd --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/promotions/replay-cost-aware.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"bf6e55036cbef154116f13841614028621bcfffdec1aa6a22d280c76552b5f24","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":10.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":424242,"stage":"B_prospective","trials_per_family":4},"stage_c":{"budget":10.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":989898,"stage":"C_independent_confirmation","trials_per_family":4}},"promotion_checksum":"249653318855604294b94928203d7f083d30a83f833389e27e24035ffd86a565","reasons":["prospective primary metric did not significantly beat baseline (delta=0, ci_low=0, p=1)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-241-v1/replay/evolved.json b/implementation/algolab/experiments/protocol-241-v1/replay/evolved.json new file mode 100644 index 0000000..3967ea4 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/replay/evolved.json @@ -0,0 +1 @@ +{"decisions":[{"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"decompose","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":20.0,"discovery":false},"mean_effect":0.11911692581118542,"valid":true},"outcome_kind":"observed","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_b803f0dfb32e0c1eaa5f","uncertain":false,"uncertainty_reason":""},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_2f07435447972fcebbcb","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_e841c68c59903a602e35","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_a06a9ad5a8c6e332be5a","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_9a2ad8dbcf6724758ef7","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":4,"observed":1},"policy_id":"pol-evolved","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_decisions":5,"n_observed":1,"n_uncertain":4},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-241-v1/replay/fixed-baseline.json b/implementation/algolab/experiments/protocol-241-v1/replay/fixed-baseline.json new file mode 100644 index 0000000..8dfb4da --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/replay/fixed-baseline.json @@ -0,0 +1 @@ +{"decisions":[{"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"decompose","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":20.0,"discovery":false},"mean_effect":0.11911692581118542,"valid":true},"outcome_kind":"observed","rationale":"fixed priority order (no learning)","state_node_id":"trn_b803f0dfb32e0c1eaa5f","uncertain":false,"uncertainty_reason":""},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_2f07435447972fcebbcb","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_e841c68c59903a602e35","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_a06a9ad5a8c6e332be5a","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_9a2ad8dbcf6724758ef7","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":4,"observed":1},"policy_id":"pol-fixed-baseline","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_decisions":5,"n_observed":1,"n_uncertain":4},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-241-v1/replay/random-control.json b/implementation/algolab/experiments/protocol-241-v1/replay/random-control.json new file mode 100644 index 0000000..898f125 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/replay/random-control.json @@ -0,0 +1 @@ +{"decisions":[{"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_b803f0dfb32e0c1eaa5f","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_2f07435447972fcebbcb","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_e841c68c59903a602e35","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_a06a9ad5a8c6e332be5a","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_9a2ad8dbcf6724758ef7","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":5,"observed":0},"policy_id":"pol-random-control","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_decisions":5,"n_observed":0,"n_uncertain":5},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-241-v1/replay/replay-cost-aware.json b/implementation/algolab/experiments/protocol-241-v1/replay/replay-cost-aware.json new file mode 100644 index 0000000..2b8222b --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/replay/replay-cost-aware.json @@ -0,0 +1 @@ +{"decisions":[{"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"decompose","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":20.0,"discovery":false},"mean_effect":0.11911692581118542,"valid":true},"outcome_kind":"observed","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_b803f0dfb32e0c1eaa5f","uncertain":false,"uncertainty_reason":""},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_2f07435447972fcebbcb","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_e841c68c59903a602e35","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_a06a9ad5a8c6e332be5a","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=1.0000 (prefix observations only)","state_node_id":"trn_9a2ad8dbcf6724758ef7","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":4,"observed":1},"policy_id":"pol-replay-cost-aware","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_decisions":5,"n_observed":1,"n_uncertain":4},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-241-v1/report.md b/implementation/algolab/experiments/protocol-241-v1/report.md new file mode 100644 index 0000000..0a3b7af --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/report.md @@ -0,0 +1,12 @@ +# protocol-241 — Meta-Search bounded pilot + +Status: **exploratory pilot**. The historical trace is synthetic and is not prospective evidence. No policy is promoted on replay performance. + +| Arm | Replay agreement | Prospective Δ/credit | 95% CI low | p | Held-out Δ | Promotion | +|---|---|---|---|---|---|---| +| fixed-baseline | 0.000 | +0.000000 | +0.000000 | 1.0000 | +0.000000 | REJECTED_PROSPECTIVE | +| replay-cost-aware | 0.000 | +0.000000 | +0.000000 | 1.0000 | +0.000000 | REJECTED_PROSPECTIVE | +| evolved | 0.000 | +0.000000 | +0.000000 | 1.0000 | +0.000000 | REJECTED_PROSPECTIVE | +| random-control | 0.000 | +0.012500 | +0.000000 | 0.4885 | +0.017500 | REJECTED_PROSPECTIVE | + +Primary outcome: validated discoveries per credit (paired across matched trials). Secondary: distinct useful methods per credit. Negative results are reported as measured. diff --git a/implementation/algolab/experiments/protocol-241-v1/trace.json b/implementation/algolab/experiments/protocol-241-v1/trace.json new file mode 100644 index 0000000..3e44d1a --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/trace.json @@ -0,0 +1 @@ +{"experiment_id":"EXP-META-241","nodes":[{"artifact_refs":[],"candidate_generation_method":"fixed-baseline","candidate_id":"root","checksum":"b803f0dfb32e0c1eaa5f07f1ea8b7e31297c5ccced8cf7c8ca77ea95f458457a","compute_credits":0.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.0},"eval_split_id":"train","evaluation_result":{},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_b803f0dfb32e0c1eaa5f","observation":{"discovery":false,"valid":true},"parent_id":null,"policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"0000000000000000000000000000000000000000000000000000000000000000","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"families":["alpha","beta"]},"seed":77100,"selection_decision":"seed root","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"tune","candidate_id":"cand-tune","checksum":"2f07435447972fcebbcb553e2b570efb61daf9ac56e139aa1b4ef95c6d877ea7","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.36484432941054523},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_2f07435447972fcebbcb","observation":{"discovery":false,"mean_effect":0.36484432941054523,"valid":false},"parent_id":"trn_b803f0dfb32e0c1eaa5f","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"b803f0dfb32e0c1eaa5f07f1ea8b7e31297c5ccced8cf7c8ca77ea95f458457a","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0},"seed":77100,"selection_decision":"expand tune","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"reparameterize","candidate_id":"cand-reparameterize","checksum":"e841c68c59903a602e354ff678d2a7686546479882628477f75fb8f1a9ea02c0","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.5768893801470273},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_e841c68c59903a602e35","observation":{"discovery":false,"mean_effect":0.5768893801470273,"valid":false},"parent_id":"trn_b803f0dfb32e0c1eaa5f","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"2f07435447972fcebbcb553e2b570efb61daf9ac56e139aa1b4ef95c6d877ea7","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"beta","trial":1},"seed":77101,"selection_decision":"expand reparameterize","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"decompose","candidate_id":"cand-decompose","checksum":"a06a9ad5a8c6e332be5a134b2e6a467f012ba9fca536c3190dd8d5c77dba06ce","compute_credits":20.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.11911692581118542},"eval_split_id":"train","evaluation_result":{"cost_credits":20.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_a06a9ad5a8c6e332be5a","observation":{"discovery":false,"mean_effect":0.11911692581118542,"valid":true},"parent_id":"trn_b803f0dfb32e0c1eaa5f","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"e841c68c59903a602e354ff678d2a7686546479882628477f75fb8f1a9ea02c0","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":2},"seed":77102,"selection_decision":"expand decompose","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"refresh","candidate_id":"cand-refresh","checksum":"9a2ad8dbcf6724758ef756d347e46f2897f96db46e39e35773487e4ecdb6a26b","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.40859125466996377},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_9a2ad8dbcf6724758ef7","observation":{"discovery":false,"mean_effect":0.40859125466996377,"valid":false},"parent_id":"trn_b803f0dfb32e0c1eaa5f","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"a06a9ad5a8c6e332be5a134b2e6a467f012ba9fca536c3190dd8d5c77dba06ce","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"beta","trial":3},"seed":77103,"selection_decision":"expand refresh","statement_kind":"observation","stopping_decision":""}],"schema_version":"meta-trace/1.0","trace_id":"trace-pilot-241"} \ No newline at end of file diff --git a/implementation/algolab/experiments/protocol-241-v1/trace.json.sha256 b/implementation/algolab/experiments/protocol-241-v1/trace.json.sha256 new file mode 100644 index 0000000..be22ebf --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-v1/trace.json.sha256 @@ -0,0 +1 @@ +2d18c0163bbb3eccca3a0ca577b503a1042652b6cdf0bfd8c6c52f73a6423ed8 diff --git a/implementation/algolab/src/algolab/meta_search/__init__.py b/implementation/algolab/src/algolab/meta_search/__init__.py index 27da644..39f173b 100644 --- a/implementation/algolab/src/algolab/meta_search/__init__.py +++ b/implementation/algolab/src/algolab/meta_search/__init__.py @@ -16,34 +16,34 @@ ``docs/research/DREAM_RSI_INTEGRATION_AUDIT.md`` and ``THIRD_PARTY_NOTICES.md``. """ +from algolab.meta_search.evaluation import ( + PromotionDecision, + PromotionStatus, + evaluate_policy, + promote, + replay_evaluation, +) from algolab.meta_search.policies import ( BASELINE_POLICY, CONTROL_POLICY, EVOLVED_POLICY, REPLAY_POLICY, + Observation, SearchPolicy, Selection, - Observation, propose_policy, ) -from algolab.meta_search.traces import ( - TRACE_SCHEMA_VERSION, - DiscoveryTrace, - TraceIntegrityError, - TraceNode, -) from algolab.meta_search.replay import ( OutcomeKind, ReplayDecision, ReplayEnv, ReplayResult, ) -from algolab.meta_search.evaluation import ( - PromotionDecision, - PromotionStatus, - evaluate_policy, - promote, - replay_evaluation, +from algolab.meta_search.traces import ( + TRACE_SCHEMA_VERSION, + DiscoveryTrace, + TraceIntegrityError, + TraceNode, ) __all__ = [ diff --git a/implementation/algolab/src/algolab/meta_search/evaluation.py b/implementation/algolab/src/algolab/meta_search/evaluation.py index c6d53e5..e7258fc 100644 --- a/implementation/algolab/src/algolab/meta_search/evaluation.py +++ b/implementation/algolab/src/algolab/meta_search/evaluation.py @@ -13,7 +13,7 @@ import hashlib import json from dataclasses import asdict, dataclass, field -from enum import Enum +from enum import StrEnum from typing import Any from algolab.meta_search.policies import Observation, SearchPolicy @@ -30,7 +30,7 @@ SECONDARY_METRIC = "distinct_useful_per_credit" -class PromotionStatus(str, Enum): +class PromotionStatus(StrEnum): PROMOTED = "PROMOTED" REJECTED_HISTORICAL_ONLY = "REJECTED_HISTORICAL_ONLY" REJECTED_PROSPECTIVE = "REJECTED_PROSPECTIVE" @@ -58,12 +58,18 @@ def to_dict(self) -> dict[str, Any]: return raw -def replay_evaluation(env: ReplayEnv, policy: SearchPolicy, *, seed: int = 0) -> dict[str, Any]: +def replay_evaluation( + env: ReplayEnv, policy: SearchPolicy, *, seed: int = 0 +) -> dict[str, Any]: """Stage A: decision quality, efficiency, coverage and explicit limits.""" result: ReplayResult = env.run(policy, seed=seed) observed = [d for d in result.decisions if d.observed_outcome] spent = sum( - float((d.observed_outcome or {}).get("evaluation_result", {}).get("cost_credits", 1.0)) + float( + (d.observed_outcome or {}) + .get("evaluation_result", {}) + .get("cost_credits", 1.0) + ) for d in observed ) chosen_methods = [d.chosen_method for d in result.decisions] @@ -77,11 +83,13 @@ def replay_evaluation(env: ReplayEnv, policy: SearchPolicy, *, seed: int = 0) -> "search_efficiency_credits": spent, "candidate_diversity": len(set(chosen_methods)), "coverage": len(set(chosen_methods)) / max(len(set(DEFAULT_OPERATORS)), 1), - "failure_patterns": sorted({ - str((d.observed_outcome or {}).get("fail_class")) - for d in observed - if (d.observed_outcome or {}).get("fail_class") - }), + "failure_patterns": sorted( + { + str((d.observed_outcome or {}).get("fail_class")) + for d in observed + if (d.observed_outcome or {}).get("fail_class") + } + ), "replay_limitations": [ "no outcome labels for unexplored branches", "cannot measure what would have happened off the recorded tree", @@ -90,8 +98,15 @@ def replay_evaluation(env: ReplayEnv, policy: SearchPolicy, *, seed: int = 0) -> } -def _trial_score(policy: SearchPolicy, *, family: str, seed_base: int, trial: int, - episodes: int, budget: float) -> dict[str, float]: +def _trial_score( + policy: SearchPolicy, + *, + family: str, + seed_base: int, + trial: int, + episodes: int, + budget: float, +) -> dict[str, float]: """One deterministic prospective trial of a policy on one task family.""" observations: list[Observation] = [] credits = 0.0 @@ -99,12 +114,17 @@ def _trial_score(policy: SearchPolicy, *, family: str, seed_base: int, trial: in useful_found: set[str] = set() for episode in range(episodes): selection = policy.select( - tuple(DEFAULT_OPERATORS), tuple(observations), + tuple(DEFAULT_OPERATORS), + tuple(observations), seed=seed_base + trial * 100_000 + episode, ) attempt = run_attempt( - family, selection.method, seed_base=seed_base, - trial=trial, episode=episode, attempt=episode, + family, + selection.method, + seed_base=seed_base, + trial=trial, + episode=episode, + attempt=episode, ) credits += attempt.cost_credits if credits > budget: @@ -143,24 +163,64 @@ def _stage( alpha: float, ) -> dict[str, Any]: primary: EffectAnalysis = analyze( - [ _trial_score(baseline, family=f, seed_base=seed_base, trial=t, - episodes=episodes, budget=budget)[PRIMARY_METRIC] - for f in families for t in range(trials) ], - [ _trial_score(policy, family=f, seed_base=seed_base, trial=t, - episodes=episodes, budget=budget)[PRIMARY_METRIC] - for f in families for t in range(trials) ], - metric=PRIMARY_METRIC, seed=seed_base + 1, - bootstrap_iterations=bootstrap_iterations, alpha=alpha, + [ + _trial_score( + baseline, + family=f, + seed_base=seed_base, + trial=t, + episodes=episodes, + budget=budget, + )[PRIMARY_METRIC] + for f in families + for t in range(trials) + ], + [ + _trial_score( + policy, + family=f, + seed_base=seed_base, + trial=t, + episodes=episodes, + budget=budget, + )[PRIMARY_METRIC] + for f in families + for t in range(trials) + ], + metric=PRIMARY_METRIC, + seed=seed_base + 1, + bootstrap_iterations=bootstrap_iterations, + alpha=alpha, ) secondary: EffectAnalysis = analyze( - [ _trial_score(baseline, family=f, seed_base=seed_base, trial=t, - episodes=episodes, budget=budget)[SECONDARY_METRIC] - for f in families for t in range(trials) ], - [ _trial_score(policy, family=f, seed_base=seed_base, trial=t, - episodes=episodes, budget=budget)[SECONDARY_METRIC] - for f in families for t in range(trials) ], - metric=SECONDARY_METRIC, seed=seed_base + 2, - bootstrap_iterations=bootstrap_iterations, alpha=alpha, + [ + _trial_score( + baseline, + family=f, + seed_base=seed_base, + trial=t, + episodes=episodes, + budget=budget, + )[SECONDARY_METRIC] + for f in families + for t in range(trials) + ], + [ + _trial_score( + policy, + family=f, + seed_base=seed_base, + trial=t, + episodes=episodes, + budget=budget, + )[SECONDARY_METRIC] + for f in families + for t in range(trials) + ], + metric=SECONDARY_METRIC, + seed=seed_base + 2, + bootstrap_iterations=bootstrap_iterations, + alpha=alpha, ) return { "families": list(families), @@ -202,23 +262,32 @@ def evaluate_policy( alpha: float = 0.05, ) -> dict[str, Any]: """Run stages A/B/C and return a structured, reproducible evaluation.""" - stage_a = ( - replay_evaluation(replay_env, policy) if replay_env is not None else None - ) + stage_a = replay_evaluation(replay_env, policy) if replay_env is not None else None if stage_a is not None: stage_a["policy_checksum"] = policy.checksum() stage_b = _stage( - policy, baseline, families=families, seed_base=seed_base, - trials=trials, episodes=episodes, budget=budget, - bootstrap_iterations=bootstrap_iterations, alpha=alpha, + policy, + baseline, + families=families, + seed_base=seed_base, + trials=trials, + episodes=episodes, + budget=budget, + bootstrap_iterations=bootstrap_iterations, + alpha=alpha, ) stage_b["stage"] = "B_prospective" stage_b["is_prospective_evidence"] = True stage_c = _stage( - policy, baseline, families=(confirmation_family,), - seed_base=confirmation_seed_base, trials=trials, - episodes=episodes, budget=budget, - bootstrap_iterations=bootstrap_iterations, alpha=alpha, + policy, + baseline, + families=(confirmation_family,), + seed_base=confirmation_seed_base, + trials=trials, + episodes=episodes, + budget=budget, + bootstrap_iterations=bootstrap_iterations, + alpha=alpha, ) stage_c["stage"] = "C_independent_confirmation" stage_c["is_prospective_evidence"] = True @@ -248,8 +317,11 @@ def promote( stage_c = evaluation.get("stage_c") if not stage_a or not stage_b or not stage_c: return PromotionDecision( - PromotionStatus.REJECTED_INCOMPLETE, candidate.policy_id, - baseline.policy_id, ("missing one or more evaluation stages",), evaluation, + PromotionStatus.REJECTED_INCOMPLETE, + candidate.policy_id, + baseline.policy_id, + ("missing one or more evaluation stages",), + evaluation, ) # Rule 1: replay alone can never promote. if stage_b.get("is_prospective_evidence") is not True: @@ -274,13 +346,20 @@ def promote( reasons.append("stage C is not prospective evidence") if reasons: return PromotionDecision( - PromotionStatus.REJECTED_PROSPECTIVE if "prospective primary" in " ".join(reasons) + PromotionStatus.REJECTED_PROSPECTIVE + if "prospective primary" in " ".join(reasons) else PromotionStatus.REJECTED_INDEPENDENT, - candidate.policy_id, baseline.policy_id, tuple(reasons), evaluation, + candidate.policy_id, + baseline.policy_id, + tuple(reasons), + evaluation, ) return PromotionDecision( - PromotionStatus.PROMOTED, candidate.policy_id, baseline.policy_id, - ("all promotion gates passed",), evaluation, + PromotionStatus.PROMOTED, + candidate.policy_id, + baseline.policy_id, + ("all promotion gates passed",), + evaluation, ) diff --git a/implementation/algolab/src/algolab/meta_search/policies.py b/implementation/algolab/src/algolab/meta_search/policies.py index 054fb06..cedcec7 100644 --- a/implementation/algolab/src/algolab/meta_search/policies.py +++ b/implementation/algolab/src/algolab/meta_search/policies.py @@ -83,7 +83,9 @@ def select( """Choose one method from *candidates* using only prefix observations.""" if self.kind == "random_control": rng = random.Random(seed) - return Selection(rng.choice(list(candidates)), "seeded uniform control", True) + return Selection( + rng.choice(list(candidates)), "seeded uniform control", True + ) if self.kind == "fixed": priority = self.config.get("priority", 0.0) ordered = sorted(candidates) @@ -124,8 +126,13 @@ def score(method: str) -> float: avg_effect = bucket["effect"] / n return alpha * win_rate + beta * per_credit + gamma * avg_effect - chosen = max(candidates, key=lambda name: (score(name), -ord(name[0]) if name else 0, name)) - return Selection(chosen, f"score={score(chosen):.4f} (prefix observations only)") + chosen = max( + candidates, + key=lambda name: (score(name), -ord(name[0]) if name else 0, name), + ) + return Selection( + chosen, f"score={score(chosen):.4f} (prefix observations only)" + ) def _preset( @@ -156,24 +163,36 @@ def _preset( BASELINE_POLICY = _preset( - "fixed-baseline", "fixed", 1, {"priority": 0}, - "Initial fixed lexicographic search policy", "Existing AlgoLab fixed search behaviour", + "fixed-baseline", + "fixed", + 1, + {"priority": 0}, + "Initial fixed lexicographic search policy", + "Existing AlgoLab fixed search behaviour", ) REPLAY_POLICY = _preset( - "replay-cost-aware", "replay_cost_aware", 1, + "replay-cost-aware", + "replay_cost_aware", + 1, {"alpha": 0.25, "beta": 0.75, "gamma": 0.0, "epsilon": 0.10}, "Score methods by observed success-per-credit with 10% exploration", "DREAM-RSI replay: cheap-and-good branches deserve more spend", ) EVOLVED_POLICY = _preset( - "evolved", "evolved", 2, + "evolved", + "evolved", + 2, {"alpha": 0.0, "beta": 1.0, "gamma": 0.5, "epsilon": 0.05}, "Commit to per-credit efficiency with an effect-size term and 5% exploration", "Prior protocols found commitment plus cost-awareness efficient in-domain", ) CONTROL_POLICY = _preset( - "random-control", "random_control", 1, {}, - "Seeded uniform random method selection", "Calibration floor for any learned policy", + "random-control", + "random_control", + 1, + {}, + "Seeded uniform random method selection", + "Calibration floor for any learned policy", ) diff --git a/implementation/algolab/src/algolab/meta_search/protocol_241.py b/implementation/algolab/src/algolab/meta_search/protocol_241.py index d8b5ca4..710c277 100644 --- a/implementation/algolab/src/algolab/meta_search/protocol_241.py +++ b/implementation/algolab/src/algolab/meta_search/protocol_241.py @@ -28,13 +28,18 @@ SearchPolicy, ) from algolab.meta_search.replay import ReplayEnv -from algolab.meta_search.traces import DiscoveryTrace, TraceNode +from algolab.meta_search.traces import DiscoveryTrace, TraceIntegrityError, TraceNode from algolab.search.toy import run_attempt PROTOCOL_ID = "protocol-241" PROTOCOL_VERSION = "1.0.0" BUNDLE_SCHEMA_VERSION = "meta-pilot/1.0" -ARMS: tuple[SearchPolicy, ...] = (BASELINE_POLICY, REPLAY_POLICY, EVOLVED_POLICY, CONTROL_POLICY) +ARMS: tuple[SearchPolicy, ...] = ( + BASELINE_POLICY, + REPLAY_POLICY, + EVOLVED_POLICY, + CONTROL_POLICY, +) TRACE_SEED = 77_100 FAMILIES = ("alpha", "beta") @@ -46,7 +51,7 @@ def build_pilot_trace() -> DiscoveryTrace: experiment_id="EXP-META-241", parent_id=None, policy_id=BASELINE_POLICY.policy_id, - policy_version=BASELINE_POLICY.version, + policy_version=str(BASELINE_POLICY.version), candidate_id="root", candidate_generation_method="fixed-baseline", search_parameters={"families": list(FAMILIES)}, @@ -57,21 +62,28 @@ def build_pilot_trace() -> DiscoveryTrace: observation={"discovery": False, "valid": True}, derived_metrics={"mean_effect": 0.0}, created_at_utc="synthetic-pilot", - execution_provenance={"source": "synthetic_pilot_trace", "protocol": PROTOCOL_ID}, + execution_provenance={ + "source": "synthetic_pilot_trace", + "protocol": PROTOCOL_ID, + }, ) root_node = trace.append(root) for index, method in enumerate(("tune", "reparameterize", "decompose", "refresh")): family = FAMILIES[index % 2] attempt = run_attempt( - family, method, seed_base=TRACE_SEED, trial=index, - episode=0, attempt=index, + family, + method, + seed_base=TRACE_SEED, + trial=index, + episode=0, + attempt=index, ) trace.append( TraceNode( experiment_id="EXP-META-241", parent_id=root_node.node_id, policy_id=BASELINE_POLICY.policy_id, - policy_version=BASELINE_POLICY.version, + policy_version=str(BASELINE_POLICY.version), candidate_id=f"cand-{method}", candidate_generation_method=method, search_parameters={"family": family, "trial": index}, @@ -91,7 +103,10 @@ def build_pilot_trace() -> DiscoveryTrace: }, derived_metrics={"mean_effect": attempt.mean_effect}, created_at_utc="synthetic-pilot", - execution_provenance={"source": "synthetic_pilot_trace", "protocol": PROTOCOL_ID}, + execution_provenance={ + "source": "synthetic_pilot_trace", + "protocol": PROTOCOL_ID, + }, ) ) return trace @@ -125,10 +140,15 @@ def run_pilot( replay = env.deterministic_artifact(policy, seed=17) _write_json(target / "replay" / f"{policy.name}.json", replay) evaluation = evaluate_policy( - policy, BASELINE_POLICY, replay_env=env, - families=FAMILIES, seed_base=seed_base, + policy, + BASELINE_POLICY, + replay_env=env, + families=FAMILIES, + seed_base=seed_base, confirmation_seed_base=confirmation_seed_base, - trials=trials, episodes=episodes, budget=budget, + trials=trials, + episodes=episodes, + budget=budget, bootstrap_iterations=bootstrap_iterations, ) _write_json(target / "evaluations" / f"{policy.name}.json", evaluation) @@ -136,17 +156,21 @@ def run_pilot( _write_json(target / "promotions" / f"{policy.name}.json", decision.to_dict()) b = evaluation["stage_b"]["primary"] c = evaluation["stage_c"]["primary"] - summaries.append({ - "arm": policy.name, - "policy_id": policy.policy_id, - "historical_agreement": evaluation["stage_a"]["decision_quality_agreement"], - "prospective_delta": b["delta"], - "prospective_ci_low": b["ci_low"], - "prospective_p": b["p_value"], - "confirmation_delta": c["delta"], - "confirmation_ci_low": c["ci_low"], - "promotion": decision.status.value, - }) + summaries.append( + { + "arm": policy.name, + "policy_id": policy.policy_id, + "historical_agreement": evaluation["stage_a"][ + "decision_quality_agreement" + ], + "prospective_delta": b["delta"], + "prospective_ci_low": b["ci_low"], + "prospective_p": b["p_value"], + "confirmation_delta": c["delta"], + "confirmation_ci_low": c["ci_low"], + "promotion": decision.status.value, + } + ) manifest = { "schema_version": BUNDLE_SCHEMA_VERSION, @@ -192,7 +216,8 @@ def _render_report(manifest: dict[str, Any], summaries: list[dict[str, Any]]) -> "Status: **exploratory pilot**. The historical trace is synthetic and is " "not prospective evidence. No policy is promoted on replay performance.", "", - "| Arm | Replay agreement | Prospective Δ/credit | 95% CI low | p | Held-out Δ | Promotion |", + "| Arm | Replay agreement | Prospective Δ/credit | 95% CI low | " + "p | Held-out Δ | Promotion |", "|---|---|---|---|---|---|---|", ] for s in summaries: @@ -238,10 +263,15 @@ def verify_pilot(out_dir: str | Path) -> dict[str, Any]: extra = sorted( p.relative_to(target).as_posix() for p in target.rglob("*") - if p.is_file() and p.name != "checksums.json" + if p.is_file() + and p.name != "checksums.json" and p.relative_to(target).as_posix() not in expected ) - trace = DiscoveryTrace.load(target / "trace.json") + trace_integrity = False + try: + trace_integrity = DiscoveryTrace.load(target / "trace.json").verify_integrity() + except (TraceIntegrityError, ValueError, OSError, json.JSONDecodeError): + trace_integrity = False promotions = {} for path in sorted((target / "promotions").glob("*.json")): raw = json.loads(path.read_text(encoding="utf-8")) @@ -258,12 +288,14 @@ def verify_pilot(out_dir: str | Path) -> dict[str, Any]: replay_only_promoted = True return { "schema_version": BUNDLE_SCHEMA_VERSION, - "verified": not mismatches and not extra and trace.verify_integrity() + "verified": not mismatches + and not extra + and trace_integrity and not replay_only_promoted, "n_files_verified": len(expected), "mismatches": mismatches, "extra_files": extra, - "trace_integrity": trace.verify_integrity(), + "trace_integrity": trace_integrity, "replay_only_promotion_detected": replay_only_promoted, "promotion_verdicts": promotions, } diff --git a/implementation/algolab/src/algolab/meta_search/replay.py b/implementation/algolab/src/algolab/meta_search/replay.py index 74593d3..af3bf59 100644 --- a/implementation/algolab/src/algolab/meta_search/replay.py +++ b/implementation/algolab/src/algolab/meta_search/replay.py @@ -18,7 +18,7 @@ from __future__ import annotations from dataclasses import asdict, dataclass, field -from enum import Enum +from enum import StrEnum from typing import Any from algolab.meta_search.policies import Observation, SearchPolicy @@ -27,7 +27,7 @@ REPLAY_SCHEMA_VERSION = "meta-replay/1.0" -class OutcomeKind(str, Enum): +class OutcomeKind(StrEnum): OBSERVED = "observed" COUNTERFACTUAL_UNCERTAIN = "counterfactual_uncertain" ESTIMATED = "estimated" @@ -105,9 +105,7 @@ def assert_not_prospective(result: ReplayResult) -> None: def _observation_from_node(node: TraceNode) -> Observation: derived = node.derived_metrics obs = node.observation - mean_effect = float( - derived.get("mean_effect", obs.get("mean_effect", 0.0)) # type: ignore[arg-type] - ) + mean_effect = float(derived.get("mean_effect", obs.get("mean_effect", 0.0))) discovery = bool(obs.get("discovery", False) or derived.get("discovery", False)) return Observation( method=node.candidate_generation_method, @@ -118,7 +116,9 @@ def _observation_from_node(node: TraceNode) -> Observation: ) -def _prefix_observations(trace: DiscoveryTrace, node: TraceNode) -> tuple[Observation, ...]: +def _prefix_observations( + trace: DiscoveryTrace, node: TraceNode +) -> tuple[Observation, ...]: """Observations from ancestors only -- never the current/future nodes.""" by_id = {n.node_id: n for n in trace.nodes} out: list[Observation] = [] @@ -163,11 +163,10 @@ def run(self, policy: SearchPolicy, *, seed: int = 0) -> ReplayResult: if not children and not self.unexplored_candidates: continue # leaf state with no recorded decision observations = _prefix_observations(self.trace, node) - selection = policy.select(methods, observations, seed=seed + len(observations)) - child_by_method = { - c.candidate_generation_method: c - for c in children - } + selection = policy.select( + methods, observations, seed=seed + len(observations) + ) + child_by_method = {c.candidate_generation_method: c for c in children} historical = children[0].candidate_generation_method if children else None chosen_child = child_by_method.get(selection.method) if chosen_child is not None: @@ -211,7 +210,9 @@ def run(self, policy: SearchPolicy, *, seed: int = 0) -> ReplayResult: assert_not_prospective(result) return result - def deterministic_artifact(self, policy: SearchPolicy, *, seed: int = 0) -> dict[str, Any]: + def deterministic_artifact( + self, policy: SearchPolicy, *, seed: int = 0 + ) -> dict[str, Any]: """Replay artifact with an explicit limitations section.""" result = self.run(policy, seed=seed) payload = result.to_dict() @@ -219,7 +220,7 @@ def deterministic_artifact(self, policy: SearchPolicy, *, seed: int = 0) -> dict "Replay evaluates decisions at recorded states only.", "It cannot establish outcomes for branches never explored.", "Counterfactual decisions carry no outcome label (uncertain=true).", - "Historical replay is not prospective evidence and cannot promote a policy.", + "Historical replay is not prospective evidence and cannot promote.", ] payload["observed_vs_counterfactual"] = { "observed": result.observed_count, diff --git a/implementation/algolab/src/algolab/meta_search/traces.py b/implementation/algolab/src/algolab/meta_search/traces.py index 458bfdb..8cfb332 100644 --- a/implementation/algolab/src/algolab/meta_search/traces.py +++ b/implementation/algolab/src/algolab/meta_search/traces.py @@ -89,7 +89,9 @@ def content(self) -> dict[str, Any]: def seal(self, previous_checksum: str) -> TraceNode: """Return a node with stable id and checksum set (pure function).""" - base = replace(self, previous_checksum=previous_checksum, node_id="", checksum="") + base = replace( + self, previous_checksum=previous_checksum, node_id="", checksum="" + ) digest = _sha256(base.content()) return replace(base, node_id=f"trn_{digest[:20]}", checksum=digest) diff --git a/implementation/algolab/tests/test_meta_search.py b/implementation/algolab/tests/test_meta_search.py index 96de2fa..bd51589 100644 --- a/implementation/algolab/tests/test_meta_search.py +++ b/implementation/algolab/tests/test_meta_search.py @@ -35,8 +35,14 @@ ) -def _node(trace: DiscoveryTrace, parent: str | None, method: str, - *, discovery: bool = True, credits: float = 1.0) -> TraceNode: +def _node( + trace: DiscoveryTrace, + parent: str | None, + method: str, + *, + discovery: bool = True, + credits: float = 1.0, +) -> TraceNode: return trace.append( TraceNode( experiment_id=trace.experiment_id, @@ -71,20 +77,25 @@ def test_creation_integrity_and_relationships(self, trace: DiscoveryTrace) -> No assert trace.verify_integrity() assert len(trace.children(None)) == 1 root = trace.children(None)[0] - assert {c.candidate_generation_method for c in trace.children(root.node_id)} == { - "tune", "refresh" - } + assert { + c.candidate_generation_method for c in trace.children(root.node_id) + } == {"tune", "refresh"} assert trace.head_checksum == trace.nodes[-1].checksum - def test_stable_ids_and_canonical_serialization(self, trace: DiscoveryTrace) -> None: + def test_stable_ids_and_canonical_serialization( + self, trace: DiscoveryTrace + ) -> None: payload = trace.to_canonical_json() - assert payload == json.dumps(trace.to_dict(), sort_keys=True, separators=(",", ":")) + assert payload == json.dumps( + trace.to_dict(), sort_keys=True, separators=(",", ":") + ) restored = DiscoveryTrace.from_dict(json.loads(payload)) assert [n.node_id for n in restored.nodes] == [n.node_id for n in trace.nodes] assert restored.verify_integrity() - def test_file_roundtrip_and_checksum_guard(self, trace: DiscoveryTrace, - tmp_path: Path) -> None: + def test_file_roundtrip_and_checksum_guard( + self, trace: DiscoveryTrace, tmp_path: Path + ) -> None: path = trace.write(tmp_path / "trace.json") assert DiscoveryTrace.load(path).verify_integrity() path.write_bytes(path.read_bytes() + b" ") @@ -97,9 +108,16 @@ def test_corruption_and_unknown_parent_fail(self, trace: DiscoveryTrace) -> None with pytest.raises(TraceIntegrityError): DiscoveryTrace.from_dict(raw) with pytest.raises(TraceIntegrityError): - trace.append(TraceNode(experiment_id="EXP-TEST", parent_id="missing", - policy_id="p", policy_version=1, candidate_id="c", - candidate_generation_method="x")) + trace.append( + TraceNode( + experiment_id="EXP-TEST", + parent_id="missing", + policy_id="p", + policy_version=1, + candidate_id="c", + candidate_generation_method="x", + ) + ) def test_schema_version_and_statement_kinds(self, trace: DiscoveryTrace) -> None: assert trace.schema_version == TRACE_SCHEMA_VERSION @@ -115,38 +133,62 @@ def test_deterministic_and_observed_outcomes(self, trace: DiscoveryTrace) -> Non env = ReplayEnv(trace) a = env.run(REPLAY_POLICY, seed=3) b = env.run(REPLAY_POLICY, seed=3) - assert [d.chosen_method for d in a.decisions] == [d.chosen_method for d in b.decisions] + assert [d.chosen_method for d in a.decisions] == [ + d.chosen_method for d in b.decisions + ] assert a.to_dict() == b.to_dict() assert a.observed_count + a.uncertain_count == len(a.decisions) def test_counterfactual_uncertainty_and_no_manufactured_outcome( - self, trace: DiscoveryTrace) -> None: + self, trace: DiscoveryTrace + ) -> None: env = ReplayEnv(trace, unexplored_candidates=("never-explored",)) result = env.run(CONTROL_POLICY, seed=99) - counterfactual = [d for d in result.decisions - if d.outcome_kind == OutcomeKind.COUNTERFACTUAL_UNCERTAIN] + counterfactual = [ + d + for d in result.decisions + if d.outcome_kind == OutcomeKind.COUNTERFACTUAL_UNCERTAIN + ] assert counterfactual for decision in counterfactual: assert decision.observed_outcome is None assert decision.estimated_outcome is None assert decision.uncertain and decision.uncertainty_reason + assert_not_prospective(result) # valid replay output is not prospective + from dataclasses import replace + + from algolab.meta_search.replay import ReplayResult + + forged = ReplayResult( + trace_id="x", + policy_id="x", + decisions=[ + replace(counterfactual[0], outcome_kind=OutcomeKind.PROSPECTIVE) + ], + ) with pytest.raises(ValueError): - assert_not_prospective(result) + assert_not_prospective(forged) def test_replay_cannot_be_prospective(self, trace: DiscoveryTrace) -> None: artifact = ReplayEnv(trace).deterministic_artifact(BASELINE_POLICY) assert artifact["is_prospective_evidence"] is False assert artifact["limitations"] - assert ReplayEnv(trace).run(BASELINE_POLICY).to_dict()[ - "evidence_class"] == "historical_replay" + assert ( + ReplayEnv(trace).run(BASELINE_POLICY).to_dict()["evidence_class"] + == "historical_replay" + ) class TestPolicies: def test_versioning_and_structured_proposal(self) -> None: child = propose_policy( - REPLAY_POLICY, name="test-child", config={"beta": 2.0}, - exact_change="beta 0.75 -> 2.0", rationale="commit harder to cheap methods", - expected_effect="more discoveries per credit", evidence=("protocol-230-v2",), + REPLAY_POLICY, + name="test-child", + config={"beta": 2.0}, + exact_change="beta 0.75 -> 2.0", + rationale="commit harder to cheap methods", + expected_effect="more discoveries per credit", + evidence=("protocol-230-v2",), budget=12.0, ) assert child.version == REPLAY_POLICY.version + 1 @@ -160,26 +202,46 @@ def test_deterministic_selection_and_baseline_difference(self) -> None: Observation("refresh", 4.0, 0.3, True), ) candidates = ("tune", "refresh", "validate") - assert BASELINE_POLICY.select(candidates, observations, seed=1) == \ - BASELINE_POLICY.select(candidates, observations, seed=2) + assert BASELINE_POLICY.select( + candidates, observations, seed=1 + ) == BASELINE_POLICY.select(candidates, observations, seed=2) assert REPLAY_POLICY.select(candidates, observations, seed=1).method == "tune" - assert CONTROL_POLICY.select(candidates, (), seed=5) == \ - CONTROL_POLICY.select(candidates, (), seed=5) + assert CONTROL_POLICY.select(candidates, (), seed=5) == CONTROL_POLICY.select( + candidates, (), seed=5 + ) def test_invalid_policy_rejected(self) -> None: with pytest.raises(ValueError): - propose_policy(BASELINE_POLICY, name="bad", config={}, exact_change="", - rationale="") + propose_policy( + BASELINE_POLICY, name="bad", config={}, exact_change="", rationale="" + ) class TestPromotion: - def test_historical_replay_alone_cannot_promote(self, trace: DiscoveryTrace) -> None: - evaluation = evaluate_policy(EVOLVED_POLICY, BASELINE_POLICY, - replay_env=ReplayEnv(trace), trials=3, - episodes=6, bootstrap_iterations=200) + def test_historical_replay_alone_cannot_promote( + self, trace: DiscoveryTrace + ) -> None: + evaluation = evaluate_policy( + EVOLVED_POLICY, + BASELINE_POLICY, + replay_env=ReplayEnv(trace), + trials=3, + episodes=6, + bootstrap_iterations=200, + ) decision = promote(EVOLVED_POLICY, BASELINE_POLICY, evaluation) assert decision.status != PromotionStatus.PROMOTED - assert "stage" in str(decision.reasons) + assert evaluation["stage_a"]["decision_quality_agreement"] >= 0.0 + # Even a perfect replay score with no prospective evidence fails closed. + replay_only = dict(evaluation) + replay_only["stage_b"] = dict(evaluation["stage_b"]) + replay_only["stage_b"]["is_prospective_evidence"] = False + replay_only["stage_a"] = dict(evaluation["stage_a"]) + replay_only["stage_a"]["decision_quality_agreement"] = 1.0 + assert ( + promote(EVOLVED_POLICY, BASELINE_POLICY, replay_only).status + != PromotionStatus.PROMOTED + ) def test_missing_stage_fails_closed(self) -> None: decision = promote(EVOLVED_POLICY, BASELINE_POLICY, {"stage_a": {}}) @@ -188,15 +250,21 @@ def test_missing_stage_fails_closed(self) -> None: def test_prospective_failure_rejected(self) -> None: evaluation = { "stage_a": {"x": 1}, - "stage_b": {"is_prospective_evidence": True, - "primary": {"delta": -1.0, "ci_low": -2.0, "p_value": 0.9}, - "secondary": {"ci_low": -1.0}}, - "stage_c": {"is_prospective_evidence": True, - "primary": {"delta": 1.0, "ci_low": 0.1}}, + "stage_b": { + "is_prospective_evidence": True, + "primary": {"delta": -1.0, "ci_low": -2.0, "p_value": 0.9}, + "secondary": {"ci_low": -1.0}, + }, + "stage_c": { + "is_prospective_evidence": True, + "primary": {"delta": 1.0, "ci_low": 0.1}, + }, } decision = promote(EVOLVED_POLICY, BASELINE_POLICY, evaluation) - assert decision.status in (PromotionStatus.REJECTED_PROSPECTIVE, - PromotionStatus.REJECTED_INDEPENDENT) + assert decision.status in ( + PromotionStatus.REJECTED_PROSPECTIVE, + PromotionStatus.REJECTED_INDEPENDENT, + ) assert decision.checksum() def test_replay_evaluation_reports_limits(self, trace: DiscoveryTrace) -> None: From 88758b02eb1a4bb21e6fcb4e2a984f17468dd43d Mon Sep 17 00:00:00 2001 From: nulllabtests Date: Thu, 19 Nov 2026 19:23:14 +0000 Subject: [PATCH 3/7] fix(meta-search): cost-normalised cold start, real replay decision, BH-FDR (protocol 242 prereg) --- .../algolab/src/algolab/cli/main.py | 10 +++ .../src/algolab/meta_search/evaluation.py | 9 ++- .../src/algolab/meta_search/policies.py | 9 ++- .../src/algolab/meta_search/protocol_241.py | 69 +++++++++++++++---- .../algolab/src/algolab/meta_search/replay.py | 27 ++++++-- .../242_META_SEARCH_CORRECTED_PROMOTION.md | 68 ++++++++++++++++++ 6 files changed, 168 insertions(+), 24 deletions(-) create mode 100644 spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md diff --git a/implementation/algolab/src/algolab/cli/main.py b/implementation/algolab/src/algolab/cli/main.py index bc5db64..4f146ef 100644 --- a/implementation/algolab/src/algolab/cli/main.py +++ b/implementation/algolab/src/algolab/cli/main.py @@ -190,6 +190,12 @@ def _build_parser() -> argparse.ArgumentParser: p_meta.add_argument("--seed-base", type=int, default=424_242) p_meta.add_argument("--confirmation-seed-base", type=int, default=989_898) p_meta.add_argument("--bootstrap-iterations", type=int, default=1000) + p_meta.add_argument("--protocol-id", default="protocol-241") + p_meta.add_argument("--protocol-version", default="1.0.0") + p_meta.add_argument("--apply-bh", action="store_true", + help="Benjamini-Hochberg FDR across non-baseline arms") + p_meta.add_argument("--record-historical-choice", action="store_true", + help="record the actual historical decision on the trace") p_meta.add_argument("--force", action="store_true", help="overwrite an existing sealed bundle") p_meta.add_argument("--json", action="store_true") @@ -562,6 +568,10 @@ def cmd_meta_search_run(args: argparse.Namespace) -> int: budget=args.budget, seed_base=args.seed_base, confirmation_seed_base=args.confirmation_seed_base, bootstrap_iterations=args.bootstrap_iterations, + protocol_id=args.protocol_id, + protocol_version=args.protocol_version, + apply_bh=args.apply_bh, + record_historical_choice=args.record_historical_choice, ) if args.json: print(json.dumps(result, indent=2, sort_keys=True)) diff --git a/implementation/algolab/src/algolab/meta_search/evaluation.py b/implementation/algolab/src/algolab/meta_search/evaluation.py index e7258fc..c3eeb8d 100644 --- a/implementation/algolab/src/algolab/meta_search/evaluation.py +++ b/implementation/algolab/src/algolab/meta_search/evaluation.py @@ -16,6 +16,7 @@ from enum import StrEnum from typing import Any +from algolab.knowledge.operators import OPERATOR_BUDGETS from algolab.meta_search.policies import Observation, SearchPolicy from algolab.meta_search.replay import ReplayEnv, ReplayResult from algolab.search.toy import ( @@ -77,6 +78,7 @@ def replay_evaluation( "stage": "A_historical_replay", "is_prospective_evidence": False, "decision_quality_agreement": result.agreement, + "n_agreement_applicable": result.n_applicable, "n_decisions": len(result.decisions), "n_observed": result.observed_count, "n_counterfactual_uncertain": result.uncertain_count, @@ -117,6 +119,7 @@ def _trial_score( tuple(DEFAULT_OPERATORS), tuple(observations), seed=seed_base + trial * 100_000 + episode, + costs=OPERATOR_BUDGETS, ) attempt = run_attempt( family, @@ -328,10 +331,12 @@ def promote( reasons.append("stage B is not prospective evidence") # Rule 2: must beat baseline prospectively with a positive lower CI bound. b = stage_b["primary"] - if not (b["delta"] > 0 and b["ci_low"] > 0 and b["p_value"] < alpha): + # When several arms are tested, preregistered BH-FDR q-values replace raw p. + effective_p = float(b.get("p_adjusted", b["p_value"])) + if not (b["delta"] > 0 and b["ci_low"] > 0 and effective_p < alpha): reasons.append( "prospective primary metric did not significantly beat baseline " - f"(delta={b['delta']:.6g}, ci_low={b['ci_low']:.6g}, p={b['p_value']:.6g})" + f"(delta={b['delta']:.6g}, ci_low={b['ci_low']:.6g}, p={effective_p:.6g})" ) if stage_b["secondary"]["ci_low"] < 0: reasons.append("prospective secondary metric shows significant degradation") diff --git a/implementation/algolab/src/algolab/meta_search/policies.py b/implementation/algolab/src/algolab/meta_search/policies.py index cedcec7..e4a9bb1 100644 --- a/implementation/algolab/src/algolab/meta_search/policies.py +++ b/implementation/algolab/src/algolab/meta_search/policies.py @@ -12,6 +12,7 @@ import hashlib import json import random +from collections.abc import Mapping from dataclasses import asdict, dataclass, field, replace from typing import Any @@ -79,6 +80,7 @@ def select( observations: tuple[Observation, ...], *, seed: int, + costs: Mapping[str, float] | None = None, ) -> Selection: """Choose one method from *candidates* using only prefix observations.""" if self.kind == "random_control": @@ -118,8 +120,11 @@ def select( def score(method: str) -> float: bucket = stats.get(method) if not bucket or bucket["n"] == 0: - # Unknown methods get an optimistic prior so they are tried once. - return alpha * 1.0 + beta * 1.0 + # Cost-normalised optimistic prior: an untried method is judged + # by how much information one credit buys. Without this the + # tie-break silently picks the most expensive operator. + cost = max(float((costs or {}).get(method, 1.0)), 1e-9) + return (alpha + beta) / cost n = bucket["n"] win_rate = bucket["wins"] / n per_credit = bucket["wins"] / bucket["credits"] diff --git a/implementation/algolab/src/algolab/meta_search/protocol_241.py b/implementation/algolab/src/algolab/meta_search/protocol_241.py index 710c277..ca8b473 100644 --- a/implementation/algolab/src/algolab/meta_search/protocol_241.py +++ b/implementation/algolab/src/algolab/meta_search/protocol_241.py @@ -19,6 +19,7 @@ from pathlib import Path from typing import Any +from algolab.knowledge.operators import OPERATOR_BUDGETS from algolab.meta_search.evaluation import evaluate_policy, promote from algolab.meta_search.policies import ( BASELINE_POLICY, @@ -30,6 +31,7 @@ from algolab.meta_search.replay import ReplayEnv from algolab.meta_search.traces import DiscoveryTrace, TraceIntegrityError, TraceNode from algolab.search.toy import run_attempt +from algolab.statistics import benjamini_hochberg PROTOCOL_ID = "protocol-241" PROTOCOL_VERSION = "1.0.0" @@ -44,8 +46,13 @@ FAMILIES = ("alpha", "beta") -def build_pilot_trace() -> DiscoveryTrace: - """Create a deterministic, clearly-labelled synthetic historical trace.""" +def build_pilot_trace(*, record_historical_choice: bool = False) -> DiscoveryTrace: + """Create a deterministic, clearly-labelled synthetic historical trace. + + ``record_historical_choice`` writes the *actual* recorded decision on the + root state so replay agreement is defined. Protocol 241's sealed bundle + predates this field; protocol 242 enables it. + """ trace = DiscoveryTrace(trace_id="trace-pilot-241", experiment_id="EXP-META-241") root = TraceNode( experiment_id="EXP-META-241", @@ -54,7 +61,10 @@ def build_pilot_trace() -> DiscoveryTrace: policy_version=str(BASELINE_POLICY.version), candidate_id="root", candidate_generation_method="fixed-baseline", - search_parameters={"families": list(FAMILIES)}, + search_parameters={ + "families": list(FAMILIES), + **({"historical_choice": "tune"} if record_historical_choice else {}), + }, selection_decision="seed root", seed=TRACE_SEED, dataset_id="toy", @@ -121,22 +131,28 @@ def run_pilot( seed_base: int = 424_242, confirmation_seed_base: int = 989_898, bootstrap_iterations: int = 1000, + protocol_id: str = PROTOCOL_ID, + protocol_version: str = PROTOCOL_VERSION, + arms: tuple[SearchPolicy, ...] = ARMS, + apply_bh: bool = False, + record_historical_choice: bool = False, ) -> dict[str, Any]: - """Run the preregistered pilot and seal a deterministic artifact bundle.""" + """Run a preregistered meta-search experiment and seal its bundle.""" target = Path(out_dir) target.mkdir(parents=True, exist_ok=True) - trace = build_pilot_trace() + trace = build_pilot_trace(record_historical_choice=record_historical_choice) trace.write(target / "trace.json") env = ReplayEnv( trace, unexplored_candidates=("synthesize", "validate", "polyglot", "rollback"), + costs=OPERATOR_BUDGETS, ) (target / "replay").mkdir(exist_ok=True) (target / "evaluations").mkdir(exist_ok=True) (target / "promotions").mkdir(exist_ok=True) summaries: list[dict[str, Any]] = [] - for policy in ARMS: + for policy in arms: replay = env.deterministic_artifact(policy, seed=17) _write_json(target / "replay" / f"{policy.name}.json", replay) evaluation = evaluate_policy( @@ -172,10 +188,30 @@ def run_pilot( } ) + if apply_bh: + # Preregistered BH-FDR across the non-baseline arms only. + tested = [s for s in summaries if s["arm"] != BASELINE_POLICY.name] + q_values = benjamini_hochberg([s["prospective_p"] for s in tested]) + for summary, q in zip(tested, q_values, strict=True): + summary["prospective_q"] = q + path = target / "evaluations" / f"{summary['arm']}.json" + evaluation = json.loads(path.read_text(encoding="utf-8")) + evaluation["stage_b"]["primary"]["p_adjusted"] = q + _write_json(path, evaluation) + decision = promote( + next(p for p in arms if p.name == summary["arm"]), + BASELINE_POLICY, + evaluation, + ) + _write_json( + target / "promotions" / f"{summary['arm']}.json", decision.to_dict() + ) + summary["promotion"] = decision.status.value + manifest = { "schema_version": BUNDLE_SCHEMA_VERSION, - "protocol": PROTOCOL_ID, - "protocol_version": PROTOCOL_VERSION, + "protocol": protocol_id, + "protocol_version": protocol_version, "trace_kind": "synthetic_pilot_trace", "trace_is_prospective_evidence": False, "substrate": "algolab.search.toy", @@ -187,7 +223,8 @@ def run_pilot( "seed_base": seed_base, "confirmation_seed_base": confirmation_seed_base, "bootstrap_iterations": bootstrap_iterations, - "arms": [p.name for p in ARMS], + "arms": [p.name for p in arms], + "multiple_comparison_correction": "benjamini-hochberg" if apply_bh else "none", "promotion_gate": ( "stage A replay-only never promotes; B requires positive CI and p<0.05; " "C requires non-negative delta and CI>=-0.001 on held-out gamma" @@ -211,20 +248,22 @@ def _write_json(path: Path, payload: Any) -> None: def _render_report(manifest: dict[str, Any], summaries: list[dict[str, Any]]) -> str: lines = [ - f"# {manifest['protocol']} — Meta-Search bounded pilot", + f"# {manifest['protocol']} — Meta-Search bounded experiment", "", - "Status: **exploratory pilot**. The historical trace is synthetic and is " - "not prospective evidence. No policy is promoted on replay performance.", + "Status: **preregistered experiment**. The historical trace is synthetic " + "and is not prospective evidence. No policy is promoted on replay " + "performance.", "", "| Arm | Replay agreement | Prospective Δ/credit | 95% CI low | " - "p | Held-out Δ | Promotion |", - "|---|---|---|---|---|---|---|", + "p | q (BH) | Held-out Δ | Promotion |", + "|---|---|---|---|---|---|---|---|", ] for s in summaries: + q = f"{s['prospective_q']:.4f}" if "prospective_q" in s else "—" lines.append( f"| {s['arm']} | {s['historical_agreement']:.3f} | " f"{s['prospective_delta']:+.6f} | {s['prospective_ci_low']:+.6f} | " - f"{s['prospective_p']:.4f} | {s['confirmation_delta']:+.6f} | " + f"{s['prospective_p']:.4f} | {q} | {s['confirmation_delta']:+.6f} | " f"{s['promotion']} |" ) lines += [ diff --git a/implementation/algolab/src/algolab/meta_search/replay.py b/implementation/algolab/src/algolab/meta_search/replay.py index af3bf59..71d324d 100644 --- a/implementation/algolab/src/algolab/meta_search/replay.py +++ b/implementation/algolab/src/algolab/meta_search/replay.py @@ -17,6 +17,7 @@ from __future__ import annotations +from collections.abc import Mapping from dataclasses import asdict, dataclass, field from enum import StrEnum from typing import Any @@ -47,6 +48,7 @@ class ReplayDecision: uncertain: bool = True uncertainty_reason: str = "" matches_historical: bool = False + agreement_applicable: bool = True rationale: str = "" def to_dict(self) -> dict[str, Any]: @@ -71,11 +73,19 @@ def observed_count(self) -> int: def uncertain_count(self) -> int: return sum(d.uncertain for d in self.decisions) + @property + def n_applicable(self) -> int: + return sum(d.agreement_applicable for d in self.decisions) + @property def agreement(self) -> float: - if not self.decisions: + # Agreement is only defined where the trace records an actual decision. + applicable = self.n_applicable + if not applicable: return 0.0 - return sum(d.matches_historical for d in self.decisions) / len(self.decisions) + return sum( + d.matches_historical for d in self.decisions if d.agreement_applicable + ) / applicable def to_dict(self) -> dict[str, Any]: return { @@ -89,6 +99,7 @@ def to_dict(self) -> dict[str, Any]: "n_decisions": len(self.decisions), "n_observed": self.observed_count, "n_uncertain": self.uncertain_count, + "n_agreement_applicable": self.n_applicable, "agreement_with_history": self.agreement, }, } @@ -140,11 +151,13 @@ def __init__( trace: DiscoveryTrace, *, unexplored_candidates: tuple[str, ...] = (), + costs: Mapping[str, float] | None = None, ) -> None: if not trace.verify_integrity(): raise ValueError("cannot replay a trace that fails integrity verification") self.trace = trace self.unexplored_candidates = tuple(unexplored_candidates) + self.costs = costs def available_actions(self, node_id: str) -> tuple[str, ...]: children = self.trace.children(node_id) @@ -164,10 +177,12 @@ def run(self, policy: SearchPolicy, *, seed: int = 0) -> ReplayResult: continue # leaf state with no recorded decision observations = _prefix_observations(self.trace, node) selection = policy.select( - methods, observations, seed=seed + len(observations) + methods, observations, seed=seed + len(observations), costs=self.costs ) child_by_method = {c.candidate_generation_method: c for c in children} - historical = children[0].candidate_generation_method if children else None + recorded = node.search_parameters.get("historical_choice") + historical = recorded if isinstance(recorded, str) else None + applicable = historical is not None and historical in methods chosen_child = child_by_method.get(selection.method) if chosen_child is not None: decision = ReplayDecision( @@ -185,7 +200,8 @@ def run(self, policy: SearchPolicy, *, seed: int = 0) -> ReplayResult: estimated_outcome=None, uncertain=False, uncertainty_reason="", - matches_historical=selection.method == historical, + matches_historical=applicable and selection.method == historical, + agreement_applicable=applicable, rationale=selection.rationale, ) else: @@ -204,6 +220,7 @@ def run(self, policy: SearchPolicy, *, seed: int = 0) -> ReplayResult: "no outcome label exists and none was manufactured" ), matches_historical=False, + agreement_applicable=applicable, rationale=selection.rationale, ) result.decisions.append(decision) diff --git a/spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md b/spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md new file mode 100644 index 0000000..75e6009 --- /dev/null +++ b/spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md @@ -0,0 +1,68 @@ +# Protocol 242 — Corrected meta-search policy comparison + +**Status:** PRE-REGISTERED — frozen before execution, 2026-11-19. +**Supersedes:** protocol 241 as an *informative* test. Protocol 241's bundle is +retained as provenance of a mis-scaled pilot; its negative result is not a +finding about policy quality. This protocol is a new, preregistered experiment. + +## Defects corrected before preregistration (disclosed) + +1. **Cold-start prior:** the replay/cost-aware and evolved policies assigned a + constant optimistic prior to untried methods, so the deterministic tie-break + selected `decompose` (20 credits) rather than a cheap operator. The prior is + now cost-normalised: `(alpha + beta) / cost`. Same prior, cost-aware now. +2. **Replay agreement:** previously compared a policy's choice to the first + child appended to the trace, not to a recorded decision. The synthetic trace + now records `historical_choice` on the decision state, and agreement is + computed only where such a decision exists (`n_agreement_applicable`). + +Neither fix changes a promotion threshold; they fix the implementation that +the thresholds evaluate. + +## Research question + +Under a budget matched to the operator cost scale, does either cost-aware +policy discover more validated algorithms per credit than the fixed AlgoLab +search policy, and does any gain survive a held-out family and FDR correction? + +## Preregistered design + +- **Substrate:** `algolab.search.toy` (same planted-truth generator as 241). +- **Arms:** fixed-baseline (A), replay-cost-aware (B), evolved (C), + random-control (D). Policies are frozen, versioned objects; no agent rewrites + policy source; no paid API. +- **Training families:** alpha, beta. **Held-out:** gamma (fresh seeds). +- **Trials:** 8 per family. **Episodes:** 8 per trial. +- **Budget:** 40 credits per trial (≥ the most expensive single operator), so a + trial cannot terminate before a measurement is recorded. +- **Seeds:** training base `555111`; confirmation base `777333`; replay `17`; + trace `77100`. Bootstraps: 2000 resamples. Alpha: 0.05. +- **Primary outcome:** validated discoveries per credit. +- **Secondary:** distinct useful methods per credit. +- **Statistics:** paired percentile bootstrap CI, Welch p-value, Cohen's d; + Benjamini-Hochberg FDR across the three non-baseline arms; q-values compared + to alpha for promotion. +- **Promotion gate (unchanged):** Stage A replay-only never promotes; Stage B + requires delta > 0, CI low > 0 and q < 0.05; Stage C requires held-out + delta ≥ 0 and CI low ≥ −0.001 on fresh seeds; any failure → rejection. +- **Stopping / resources:** one bounded run (4 arms × 2 families × 8 trials × + 8 episodes = 512 measurements), CPU-only, no network at runtime. + +## Separate exploratory vs confirmatory + +This is a **preregistered screening experiment**, not a final confirmation. A +promotion here makes a policy *eligible* for a later independent confirmation +on a different substrate; it is not automatic deployment. Negative results are +valid and will be reported as measured. + +## Reproduction + +```bash +cd implementation/algolab +.venv/bin/python -m algolab.cli.main meta-search-run \ + --dir experiments/protocol-242-v1 --protocol-id protocol-242 \ + --trials 8 --episodes 8 --budget 40 --seed-base 555111 \ + --confirmation-seed-base 777333 --bootstrap-iterations 2000 \ + --apply-bh --record-historical-choice --force +.venv/bin/python -m algolab.cli.main meta-verify --dir experiments/protocol-242-v1 +``` From 838c30d0e382bddded8845ffdb3d067d93478d49 Mon Sep 17 00:00:00 2001 From: nulllabtests Date: Thu, 19 Nov 2026 19:24:18 +0000 Subject: [PATCH 4/7] docs(protocol-243): preregister confirmatory evolved-policy evaluation --- .../protocol-242-v1/checksums.json | 1 + .../protocol-242-v1/evaluations/evolved.json | 1 + .../evaluations/fixed-baseline.json | 1 + .../evaluations/random-control.json | 1 + .../evaluations/replay-cost-aware.json | 1 + .../experiments/protocol-242-v1/manifest.json | 1 + .../protocol-242-v1/promotions/evolved.json | 1 + .../promotions/fixed-baseline.json | 1 + .../promotions/random-control.json | 1 + .../promotions/replay-cost-aware.json | 1 + .../protocol-242-v1/replay/evolved.json | 1 + .../replay/fixed-baseline.json | 1 + .../replay/random-control.json | 1 + .../replay/replay-cost-aware.json | 1 + .../experiments/protocol-242-v1/report.md | 12 +++++ .../experiments/protocol-242-v1/trace.json | 1 + .../protocol-242-v1/trace.json.sha256 | 1 + .../algolab/src/algolab/cli/main.py | 13 ++++- spec/research/243_META_SEARCH_CONFIRMATORY.md | 51 +++++++++++++++++++ 19 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 implementation/algolab/experiments/protocol-242-v1/checksums.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/evaluations/evolved.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/evaluations/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/evaluations/random-control.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/evaluations/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/manifest.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/promotions/evolved.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/promotions/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/promotions/random-control.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/promotions/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/replay/evolved.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/replay/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/replay/random-control.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/replay/replay-cost-aware.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/report.md create mode 100644 implementation/algolab/experiments/protocol-242-v1/trace.json create mode 100644 implementation/algolab/experiments/protocol-242-v1/trace.json.sha256 create mode 100644 spec/research/243_META_SEARCH_CONFIRMATORY.md diff --git a/implementation/algolab/experiments/protocol-242-v1/checksums.json b/implementation/algolab/experiments/protocol-242-v1/checksums.json new file mode 100644 index 0000000..8f3ae0c --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/checksums.json @@ -0,0 +1 @@ +{"evaluations/evolved.json":"21293beb82a932e02031a439bdec583c5e89a0fe62e5cfeb6612d0252ea7bc3a","evaluations/fixed-baseline.json":"5810291117751463a9cb5de8ab07de29386fda0231baa9f18b340bb6e82d74c5","evaluations/random-control.json":"dd2a7464c50d9ebbb35c357075de659849887e06f90341705a51de452c826b00","evaluations/replay-cost-aware.json":"cf4f4f5f30ff0471d1f631bc01071edacf615bf03301c67e2daf27dfe3f72e89","manifest.json":"74285ea856ea9e2c0e031d0db2ac6cc1a2b44700753705b6cd2d5b5b0a858498","promotions/evolved.json":"579836b1d58bcde26fc09cddb393f7da40b619c385ea137f6f66c80134a21821","promotions/fixed-baseline.json":"e063f508429d2eef93dead62994ff3190c7a16108218ea13c7e3359305e15126","promotions/random-control.json":"2e63048abdbe00e72aee5b52c3c1cb6806083227b96909c74509245dac1fa3fc","promotions/replay-cost-aware.json":"80c8f57b290559f49e767190463aac3be2a5d5dbec8338816ba20083fd3349e3","replay/evolved.json":"f96efbaa18885348d8fcb19581260ead786f4c76e005e0450034df8500f41606","replay/fixed-baseline.json":"f4f3863c2a11a08dfc5853f187a2afae77973ccea6005eb583cb4142423cafb6","replay/random-control.json":"211e8031a6ce892fbed5ef5fb46a4392a19f9b08005c09671f8e121d29aad054","replay/replay-cost-aware.json":"a1357b083c760c36f087d3f9fcaae0cc2a09de0eb2a61cecff512b5cba5db021","report.md":"4ad71e72a1c4b2f09715d1eb9001dc89d353a80510c1ce6301fe05a3827b6085","trace.json":"0285b23ae1e76095bf50e41ed3d69fd172860e0c556535850a064fd419f88af9","trace.json.sha256":"a6b5d77b0074c0e2d536019aaf40201fa5adcb6aa9402616f734d7d414b85e2d"} diff --git a/implementation/algolab/experiments/protocol-242-v1/evaluations/evolved.json b/implementation/algolab/experiments/protocol-242-v1/evaluations/evolved.json new file mode 100644 index 0000000..a4e3359 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/evaluations/evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":1,"coverage":0.125,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"6e30d0fa2f04fc5f43219353cbd7cd8724d1ca478b9a6170d44794da1f73c7ac","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0125,"candidate_mean":0.03333333333333333,"ci_high":0.03819444444444445,"ci_low":0.003819444444444445,"delta":0.020833333333333332,"effect_size":1.0034249225422884,"p_adjusted":0.09070464767616192,"p_value":0.046476761619190406},"secondary":{"ci_high":0.016666666666666666,"ci_low":0.0024305555555555565,"delta":0.009722222222222224,"p_value":0.02948525737131434},"seed_base":555111,"stage":"B_prospective","trials_per_family":8},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.020833333333333332,"candidate_mean":0.043611111111111114,"ci_high":0.035833333333333335,"ci_low":0.011111111111111113,"delta":0.022777777777777782,"effect_size":1.5252585361879851,"p_value":0.00849575212393803},"secondary":{"ci_high":0.005555555555555557,"ci_low":0.004722222222222223,"delta":0.0052777777777777805,"p_value":0.006496751624187906},"seed_base":777333,"stage":"C_independent_confirmation","trials_per_family":8}} diff --git a/implementation/algolab/experiments/protocol-242-v1/evaluations/fixed-baseline.json b/implementation/algolab/experiments/protocol-242-v1/evaluations/fixed-baseline.json new file mode 100644 index 0000000..fe165c4 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/evaluations/fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"da60739104b272a6581d9baebcf80f3c2ad4e1f51fea209c53c60a10c3630ff6","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0125,"candidate_mean":0.0125,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":555111,"stage":"B_prospective","trials_per_family":8},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.020833333333333332,"candidate_mean":0.020833333333333332,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":777333,"stage":"C_independent_confirmation","trials_per_family":8}} diff --git a/implementation/algolab/experiments/protocol-242-v1/evaluations/random-control.json b/implementation/algolab/experiments/protocol-242-v1/evaluations/random-control.json new file mode 100644 index 0000000..ae6ff7a --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/evaluations/random-control.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"af72a6dfa1104985983a52b6d5181feb8064c86e07e0b92d0e8dc8f9d0f77463","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0125,"candidate_mean":0.012038690476190477,"ci_high":0.009270833333333334,"ci_low":-0.010401785714285714,"delta":-0.00046130952380952356,"effect_size":-0.03531192094317521,"p_adjusted":0.9365317341329336,"p_value":0.9365317341329336},"secondary":{"ci_high":0.01021577380952381,"ci_low":-0.0035937499999999997,"delta":0.0028720238095238104,"p_value":0.47726136931534235},"seed_base":555111,"stage":"B_prospective","trials_per_family":8},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.020833333333333332,"candidate_mean":0.016856060606060607,"ci_high":0.007272727272727273,"ci_low":-0.01583333333333333,"delta":-0.003977272727272725,"effect_size":-0.30685268370568575,"p_value":0.5697151424287856},"secondary":{"ci_high":0.010606060606060607,"ci_low":-0.009810606060606061,"delta":0.0001893939393939406,"p_value":0.9855072463768116},"seed_base":777333,"stage":"C_independent_confirmation","trials_per_family":8}} diff --git a/implementation/algolab/experiments/protocol-242-v1/evaluations/replay-cost-aware.json b/implementation/algolab/experiments/protocol-242-v1/evaluations/replay-cost-aware.json new file mode 100644 index 0000000..a4182b3 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/evaluations/replay-cost-aware.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":1,"coverage":0.125,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"bf6e55036cbef154116f13841614028621bcfffdec1aa6a22d280c76552b5f24","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0125,"candidate_mean":0.030555555555555555,"ci_high":0.035416666666666666,"ci_low":0.0010416666666666673,"delta":0.018055555555555554,"effect_size":0.8738158941490306,"p_adjusted":0.09070464767616192,"p_value":0.06046976511744128},"secondary":{"ci_high":0.015625,"ci_low":6.505213034913027e-19,"delta":0.008333333333333333,"p_value":0.050974512743628186},"seed_base":555111,"stage":"B_prospective","trials_per_family":8},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.020833333333333332,"candidate_mean":0.04083333333333333,"ci_high":0.03402777777777778,"ci_low":0.005555555555555557,"delta":0.02,"effect_size":1.1149351084128167,"p_value":0.057971014492753624},"secondary":{"ci_high":0.005555555555555557,"ci_low":-0.003055555555555555,"delta":0.0025000000000000022,"p_value":0.33483258370814595},"seed_base":777333,"stage":"C_independent_confirmation","trials_per_family":8}} diff --git a/implementation/algolab/experiments/protocol-242-v1/manifest.json b/implementation/algolab/experiments/protocol-242-v1/manifest.json new file mode 100644 index 0000000..027a327 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/manifest.json @@ -0,0 +1 @@ +{"arms":["fixed-baseline","replay-cost-aware","evolved","random-control"],"bootstrap_iterations":2000,"budget":40.0,"confirmation_seed_base":777333,"episodes":8,"families":["alpha","beta"],"held_out_family":"gamma","multiple_comparison_correction":"benjamini-hochberg","promotion_gate":"stage A replay-only never promotes; B requires positive CI and p<0.05; C requires non-negative delta and CI>=-0.001 on held-out gamma","protocol":"protocol-242","protocol_version":"1.0.0","schema_version":"meta-pilot/1.0","seed_base":555111,"substrate":"algolab.search.toy","trace_is_prospective_evidence":false,"trace_kind":"synthetic_pilot_trace","trials":8} diff --git a/implementation/algolab/experiments/protocol-242-v1/promotions/evolved.json b/implementation/algolab/experiments/protocol-242-v1/promotions/evolved.json new file mode 100644 index 0000000..ffbb429 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/promotions/evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":1,"coverage":0.125,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"6e30d0fa2f04fc5f43219353cbd7cd8724d1ca478b9a6170d44794da1f73c7ac","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0125,"candidate_mean":0.03333333333333333,"ci_high":0.03819444444444445,"ci_low":0.003819444444444445,"delta":0.020833333333333332,"effect_size":1.0034249225422884,"p_adjusted":0.09070464767616192,"p_value":0.046476761619190406},"secondary":{"ci_high":0.016666666666666666,"ci_low":0.0024305555555555565,"delta":0.009722222222222224,"p_value":0.02948525737131434},"seed_base":555111,"stage":"B_prospective","trials_per_family":8},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.020833333333333332,"candidate_mean":0.043611111111111114,"ci_high":0.035833333333333335,"ci_low":0.011111111111111113,"delta":0.022777777777777782,"effect_size":1.5252585361879851,"p_value":0.00849575212393803},"secondary":{"ci_high":0.005555555555555557,"ci_low":0.004722222222222223,"delta":0.0052777777777777805,"p_value":0.006496751624187906},"seed_base":777333,"stage":"C_independent_confirmation","trials_per_family":8}},"promotion_checksum":"6b862e156ac4ce8ff0486cd773db9c233729ff429f48c61d593337f8ff08fbc4","reasons":["prospective primary metric did not significantly beat baseline (delta=0.0208333, ci_low=0.00381944, p=0.0907046)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-242-v1/promotions/fixed-baseline.json b/implementation/algolab/experiments/protocol-242-v1/promotions/fixed-baseline.json new file mode 100644 index 0000000..9a789a3 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/promotions/fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"da60739104b272a6581d9baebcf80f3c2ad4e1f51fea209c53c60a10c3630ff6","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0125,"candidate_mean":0.0125,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":555111,"stage":"B_prospective","trials_per_family":8},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.020833333333333332,"candidate_mean":0.020833333333333332,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":777333,"stage":"C_independent_confirmation","trials_per_family":8}},"promotion_checksum":"54807d5a91bf4a7675852fd0da39ae50f3138d9d331ef83e16e38f4b56986f69","reasons":["prospective primary metric did not significantly beat baseline (delta=0, ci_low=0, p=1)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-242-v1/promotions/random-control.json b/implementation/algolab/experiments/protocol-242-v1/promotions/random-control.json new file mode 100644 index 0000000..6695410 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/promotions/random-control.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-random-control","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"af72a6dfa1104985983a52b6d5181feb8064c86e07e0b92d0e8dc8f9d0f77463","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0125,"candidate_mean":0.012038690476190477,"ci_high":0.009270833333333334,"ci_low":-0.010401785714285714,"delta":-0.00046130952380952356,"effect_size":-0.03531192094317521,"p_adjusted":0.9365317341329336,"p_value":0.9365317341329336},"secondary":{"ci_high":0.01021577380952381,"ci_low":-0.0035937499999999997,"delta":0.0028720238095238104,"p_value":0.47726136931534235},"seed_base":555111,"stage":"B_prospective","trials_per_family":8},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.020833333333333332,"candidate_mean":0.016856060606060607,"ci_high":0.007272727272727273,"ci_low":-0.01583333333333333,"delta":-0.003977272727272725,"effect_size":-0.30685268370568575,"p_value":0.5697151424287856},"secondary":{"ci_high":0.010606060606060607,"ci_low":-0.009810606060606061,"delta":0.0001893939393939406,"p_value":0.9855072463768116},"seed_base":777333,"stage":"C_independent_confirmation","trials_per_family":8}},"promotion_checksum":"b7103ac4ccef519ec8dcb5bf079f080f905416c7527f744de002632211f34321","reasons":["prospective primary metric did not significantly beat baseline (delta=-0.00046131, ci_low=-0.0104018, p=0.936532)","prospective secondary metric shows significant degradation","independent confirmation degraded on the held-out family (delta=-0.00397727, ci_low=-0.0158333)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-242-v1/promotions/replay-cost-aware.json b/implementation/algolab/experiments/protocol-242-v1/promotions/replay-cost-aware.json new file mode 100644 index 0000000..ac5b4bd --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/promotions/replay-cost-aware.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-replay-cost-aware","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":1,"coverage":0.125,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"bf6e55036cbef154116f13841614028621bcfffdec1aa6a22d280c76552b5f24","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0125,"candidate_mean":0.030555555555555555,"ci_high":0.035416666666666666,"ci_low":0.0010416666666666673,"delta":0.018055555555555554,"effect_size":0.8738158941490306,"p_adjusted":0.09070464767616192,"p_value":0.06046976511744128},"secondary":{"ci_high":0.015625,"ci_low":6.505213034913027e-19,"delta":0.008333333333333333,"p_value":0.050974512743628186},"seed_base":555111,"stage":"B_prospective","trials_per_family":8},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.020833333333333332,"candidate_mean":0.04083333333333333,"ci_high":0.03402777777777778,"ci_low":0.005555555555555557,"delta":0.02,"effect_size":1.1149351084128167,"p_value":0.057971014492753624},"secondary":{"ci_high":0.005555555555555557,"ci_low":-0.003055555555555555,"delta":0.0025000000000000022,"p_value":0.33483258370814595},"seed_base":777333,"stage":"C_independent_confirmation","trials_per_family":8}},"promotion_checksum":"e7cd0e7087398c5e5fec1e2ea38c931aa4f1af1a582ce12f72804ee37893eb31","reasons":["prospective primary metric did not significantly beat baseline (delta=0.0180556, ci_low=0.00104167, p=0.0907046)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-242-v1/replay/evolved.json b/implementation/algolab/experiments/protocol-242-v1/replay/evolved.json new file mode 100644 index 0000000..c059c69 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/replay/evolved.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_feb6d0f212ce428d58f0","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_991fcd52a0b255cceca9","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_1455f2dc5cd231ce9cd8","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_89bb0b4c0c9eee7a87a2","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_4c62548f38a0d0a83a01","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":5,"observed":0},"policy_id":"pol-evolved","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_agreement_applicable":1,"n_decisions":5,"n_observed":0,"n_uncertain":5},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-242-v1/replay/fixed-baseline.json b/implementation/algolab/experiments/protocol-242-v1/replay/fixed-baseline.json new file mode 100644 index 0000000..7f54571 --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/replay/fixed-baseline.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"decompose","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":20.0,"discovery":false},"mean_effect":0.11911692581118542,"valid":true},"outcome_kind":"observed","rationale":"fixed priority order (no learning)","state_node_id":"trn_feb6d0f212ce428d58f0","uncertain":false,"uncertainty_reason":""},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_991fcd52a0b255cceca9","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_1455f2dc5cd231ce9cd8","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_89bb0b4c0c9eee7a87a2","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_4c62548f38a0d0a83a01","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":4,"observed":1},"policy_id":"pol-fixed-baseline","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_agreement_applicable":1,"n_decisions":5,"n_observed":1,"n_uncertain":4},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-242-v1/replay/random-control.json b/implementation/algolab/experiments/protocol-242-v1/replay/random-control.json new file mode 100644 index 0000000..7c5fe0b --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/replay/random-control.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_feb6d0f212ce428d58f0","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_991fcd52a0b255cceca9","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_1455f2dc5cd231ce9cd8","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_89bb0b4c0c9eee7a87a2","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"validate","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"seeded uniform control","state_node_id":"trn_4c62548f38a0d0a83a01","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":5,"observed":0},"policy_id":"pol-random-control","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_agreement_applicable":1,"n_decisions":5,"n_observed":0,"n_uncertain":5},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-242-v1/replay/replay-cost-aware.json b/implementation/algolab/experiments/protocol-242-v1/replay/replay-cost-aware.json new file mode 100644 index 0000000..b3fcb5d --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/replay/replay-cost-aware.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_feb6d0f212ce428d58f0","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_991fcd52a0b255cceca9","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_1455f2dc5cd231ce9cd8","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_89bb0b4c0c9eee7a87a2","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_4c62548f38a0d0a83a01","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":5,"observed":0},"policy_id":"pol-replay-cost-aware","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_agreement_applicable":1,"n_decisions":5,"n_observed":0,"n_uncertain":5},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-242-v1/report.md b/implementation/algolab/experiments/protocol-242-v1/report.md new file mode 100644 index 0000000..1d0420b --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/report.md @@ -0,0 +1,12 @@ +# protocol-242 — Meta-Search bounded experiment + +Status: **preregistered experiment**. The historical trace is synthetic and is not prospective evidence. No policy is promoted on replay performance. + +| Arm | Replay agreement | Prospective Δ/credit | 95% CI low | p | q (BH) | Held-out Δ | Promotion | +|---|---|---|---|---|---|---|---| +| fixed-baseline | 0.000 | +0.000000 | +0.000000 | 1.0000 | — | +0.000000 | REJECTED_PROSPECTIVE | +| replay-cost-aware | 0.000 | +0.018056 | +0.001042 | 0.0605 | 0.0907 | +0.020000 | REJECTED_PROSPECTIVE | +| evolved | 0.000 | +0.020833 | +0.003819 | 0.0465 | 0.0907 | +0.022778 | REJECTED_PROSPECTIVE | +| random-control | 0.000 | -0.000461 | -0.010402 | 0.9365 | 0.9365 | -0.003977 | REJECTED_PROSPECTIVE | + +Primary outcome: validated discoveries per credit (paired across matched trials). Secondary: distinct useful methods per credit. Negative results are reported as measured. diff --git a/implementation/algolab/experiments/protocol-242-v1/trace.json b/implementation/algolab/experiments/protocol-242-v1/trace.json new file mode 100644 index 0000000..4a98c8c --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/trace.json @@ -0,0 +1 @@ +{"experiment_id":"EXP-META-241","nodes":[{"artifact_refs":[],"candidate_generation_method":"fixed-baseline","candidate_id":"root","checksum":"feb6d0f212ce428d58f0f5522b5d2af002bb08f2e6cd2fb9d31f4c078c7365be","compute_credits":0.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.0},"eval_split_id":"train","evaluation_result":{},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_feb6d0f212ce428d58f0","observation":{"discovery":false,"valid":true},"parent_id":null,"policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"0000000000000000000000000000000000000000000000000000000000000000","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"families":["alpha","beta"],"historical_choice":"tune"},"seed":77100,"selection_decision":"seed root","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"tune","candidate_id":"cand-tune","checksum":"991fcd52a0b255cceca95ebde39df5f0276d92a52f23bfa969d0d2d39782ac25","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.36484432941054523},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_991fcd52a0b255cceca9","observation":{"discovery":false,"mean_effect":0.36484432941054523,"valid":false},"parent_id":"trn_feb6d0f212ce428d58f0","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"feb6d0f212ce428d58f0f5522b5d2af002bb08f2e6cd2fb9d31f4c078c7365be","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0},"seed":77100,"selection_decision":"expand tune","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"reparameterize","candidate_id":"cand-reparameterize","checksum":"1455f2dc5cd231ce9cd869f52e0fd55200c991f9558a3b7f660437a64c94d266","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.5768893801470273},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_1455f2dc5cd231ce9cd8","observation":{"discovery":false,"mean_effect":0.5768893801470273,"valid":false},"parent_id":"trn_feb6d0f212ce428d58f0","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"991fcd52a0b255cceca95ebde39df5f0276d92a52f23bfa969d0d2d39782ac25","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"beta","trial":1},"seed":77101,"selection_decision":"expand reparameterize","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"decompose","candidate_id":"cand-decompose","checksum":"89bb0b4c0c9eee7a87a28eec6734f43be561ce25bae5f539efbdb2550e11b3f0","compute_credits":20.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.11911692581118542},"eval_split_id":"train","evaluation_result":{"cost_credits":20.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_89bb0b4c0c9eee7a87a2","observation":{"discovery":false,"mean_effect":0.11911692581118542,"valid":true},"parent_id":"trn_feb6d0f212ce428d58f0","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"1455f2dc5cd231ce9cd869f52e0fd55200c991f9558a3b7f660437a64c94d266","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":2},"seed":77102,"selection_decision":"expand decompose","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"refresh","candidate_id":"cand-refresh","checksum":"4c62548f38a0d0a83a01b2ef43b11bb76dfab3b862271b3ed7c67b33d75771c2","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.40859125466996377},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_4c62548f38a0d0a83a01","observation":{"discovery":false,"mean_effect":0.40859125466996377,"valid":false},"parent_id":"trn_feb6d0f212ce428d58f0","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"89bb0b4c0c9eee7a87a28eec6734f43be561ce25bae5f539efbdb2550e11b3f0","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"beta","trial":3},"seed":77103,"selection_decision":"expand refresh","statement_kind":"observation","stopping_decision":""}],"schema_version":"meta-trace/1.0","trace_id":"trace-pilot-241"} \ No newline at end of file diff --git a/implementation/algolab/experiments/protocol-242-v1/trace.json.sha256 b/implementation/algolab/experiments/protocol-242-v1/trace.json.sha256 new file mode 100644 index 0000000..4fbcdce --- /dev/null +++ b/implementation/algolab/experiments/protocol-242-v1/trace.json.sha256 @@ -0,0 +1 @@ +0285b23ae1e76095bf50e41ed3d69fd172860e0c556535850a064fd419f88af9 diff --git a/implementation/algolab/src/algolab/cli/main.py b/implementation/algolab/src/algolab/cli/main.py index 4f146ef..ba7b5e3 100644 --- a/implementation/algolab/src/algolab/cli/main.py +++ b/implementation/algolab/src/algolab/cli/main.py @@ -192,6 +192,8 @@ def _build_parser() -> argparse.ArgumentParser: p_meta.add_argument("--bootstrap-iterations", type=int, default=1000) p_meta.add_argument("--protocol-id", default="protocol-241") p_meta.add_argument("--protocol-version", default="1.0.0") + p_meta.add_argument("--arms", default=None, + help="comma-separated arm names (default: all four)") p_meta.add_argument("--apply-bh", action="store_true", help="Benjamini-Hochberg FDR across non-baseline arms") p_meta.add_argument("--record-historical-choice", action="store_true", @@ -557,7 +559,15 @@ def cmd_search_run(args: argparse.Namespace) -> int: def cmd_meta_search_run(args: argparse.Namespace) -> int: - from algolab.meta_search.protocol_241 import run_pilot + from algolab.meta_search.protocol_241 import ARMS, run_pilot + + arms = ARMS + if args.arms: + selected = {name.strip() for name in args.arms.split(",")} + arms = tuple(p for p in ARMS if p.name in selected) + if not arms: + print(f"no known arms in {args.arms!r}", file=sys.stderr) + return 2 if (args.dir / "checksums.json").exists() and not args.force: print(f"refusing to overwrite sealed bundle: {args.dir} (use --force)", @@ -572,6 +582,7 @@ def cmd_meta_search_run(args: argparse.Namespace) -> int: protocol_version=args.protocol_version, apply_bh=args.apply_bh, record_historical_choice=args.record_historical_choice, + arms=arms, ) if args.json: print(json.dumps(result, indent=2, sort_keys=True)) diff --git a/spec/research/243_META_SEARCH_CONFIRMATORY.md b/spec/research/243_META_SEARCH_CONFIRMATORY.md new file mode 100644 index 0000000..2aeaee8 --- /dev/null +++ b/spec/research/243_META_SEARCH_CONFIRMATORY.md @@ -0,0 +1,51 @@ +# Protocol 243 — Confirmatory evaluation of the evolved search policy + +**Status:** PRE-REGISTERED — frozen before execution, 2026-11-19. +**Predecessor:** protocol 242 (`experiments/protocol-242-v1/`). + +## Why this is confirmatory, not another screen + +Protocol 242 was a preregistered screen of three non-baseline arms. The +`evolved` arm was the only one that passed **every** gate except the +multiplicity correction (Δ = +0.020833 discoveries/credit, 95% CI low ++0.003819, raw p = 0.0465, BH q = 0.0907; held-out Δ = +0.022778; secondary CI +low +0.00243 prospectively and +0.00472 held-out). Its raw p is borderline and +its direction is consistent on the held-out family, so a larger, **fresh-seed** +test of this single arm is justified. This protocol fixes the arm, seeds and +threshold before looking at new data. The screen's seeds are not reused. + +## Preregistered design + +- **Arms:** `fixed-baseline` (control) vs `evolved` only. No other arm is + tested; BH-FDR is therefore applied to a single comparison (q = p). +- **Substrate and families:** `algolab.search.toy`, alpha + beta training; + gamma held-out with a different fresh seed base. +- **Trials:** 24 per family (3× protocol 242). **Episodes:** 8. **Budget:** 40 + credits/trial (unchanged, matched to operator costs). +- **Fresh seeds:** training base `1_337_711`; confirmation base `2_711_337`; + replay `17`; trace `77100`. Bootstrap resamples: 2000. Alpha: 0.05. +- **Primary outcome:** validated discoveries per credit. **Secondary:** + distinct useful methods per credit. +- **Promotion gate:** unchanged and fail-closed — prospective Δ > 0, CI low > 0, + p < 0.05, secondary CI low ≥ 0; held-out Δ ≥ 0 and CI low ≥ −0.001. + Replay remains diagnostic only and cannot promote. +- **Scope of any promotion:** makes the policy eligible for use in subsequent + toy-substrate research only. It is not deployment, not a real-workload claim, + and not a change to governance criteria. + +## Stopping and resources + +One bounded run: 2 arms × 2 families × 24 trials × 8 episodes = 768 +measurements, CPU-only, no network, no generated-code deployment. + +## Reproduction + +```bash +cd implementation/algolab +.venv/bin/python -m algolab.cli.main meta-search-run \ + --dir experiments/protocol-243-v1 --protocol-id protocol-243 \ + --arms fixed-baseline,evolved --trials 24 --episodes 8 --budget 40 \ + --seed-base 1337711 --confirmation-seed-base 2711337 \ + --bootstrap-iterations 2000 --apply-bh --record-historical-choice --force +.venv/bin/python -m algolab.cli.main meta-verify --dir experiments/protocol-243-v1 +``` From 8956651c7df07c4c00a6b22708cb4eac1497b201 Mon Sep 17 00:00:00 2001 From: nulllabtests Date: Thu, 19 Nov 2026 19:26:19 +0000 Subject: [PATCH 5/7] results(protocol-242/243): corrected screen, FDR failure, fresh-seed promotion + docs --- README.md | 7 +++- docs/STATUS.md | 7 ++++ docs/research/DREAM_RSI_INTEGRATION_REPORT.md | 42 +++++++++++++++---- .../protocol-243-v1/checksums.json | 1 + .../protocol-243-v1/evaluations/evolved.json | 1 + .../evaluations/fixed-baseline.json | 1 + .../experiments/protocol-243-v1/manifest.json | 1 + .../protocol-243-v1/promotions/evolved.json | 1 + .../promotions/fixed-baseline.json | 1 + .../protocol-243-v1/replay/evolved.json | 1 + .../replay/fixed-baseline.json | 1 + .../experiments/protocol-243-v1/report.md | 10 +++++ .../experiments/protocol-243-v1/trace.json | 1 + .../protocol-243-v1/trace.json.sha256 | 1 + .../algolab/tests/test_meta_search.py | 40 +++++++++++++++++- 15 files changed, 106 insertions(+), 10 deletions(-) create mode 100644 implementation/algolab/experiments/protocol-243-v1/checksums.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/evaluations/evolved.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/evaluations/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/manifest.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/promotions/evolved.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/promotions/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/replay/evolved.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/replay/fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/report.md create mode 100644 implementation/algolab/experiments/protocol-243-v1/trace.json create mode 100644 implementation/algolab/experiments/protocol-243-v1/trace.json.sha256 diff --git a/README.md b/README.md index 819e5ad..9b9629e 100644 --- a/README.md +++ b/README.md @@ -159,8 +159,11 @@ no policy source is self-modified and no paid API is required. - Preregistration: `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` - Run: `algolab meta-search-run --dir experiments/protocol-241-v1` then `algolab meta-verify --dir experiments/protocol-241-v1` -- Result: **negative** — no arm beat the fixed baseline; nothing promoted. - Historical replay is explicitly *not* prospective evidence. +- Results: protocol 241 pilot was **mis-scaled and uninformative**; protocol + 242 screen found positive effects that failed BH-FDR; protocol 243 + **promoted** the evolved policy on fresh seeds (toy substrate only): + +0.0187 discoveries/credit (95% CI +0.0103 to +0.0275, p = 0.0005), + held-out +0.0213. Historical replay is *not* prospective evidence. ## Non-negotiable constraints diff --git a/docs/STATUS.md b/docs/STATUS.md index 284e596..27981ed 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -48,6 +48,13 @@ S2 = protocol 237) — see `docs/quality/protocol-236-conflict.md`. Entry format |---|---|---|---|---| | 11 | Exploratory pilot only: no policy beat the fixed baseline on discoveries/credit (all REJECTED_PROSPECTIVE); the preregistered 10-credit budget was below most operator costs. A post-hoc 40-credit diagnostic also found no improvement (cost-aware Δ = −0.006548, p = 0.14). No promotion; replay never used as prospective evidence | 4 trials/family | `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` | `experiments/protocol-241-v1/`, `experiments/protocol-241-v1-diagnostic/` | +## meta-search confirmatory line (protocols 242–243) + +| # | Claim | n | Spec | Evidence | +|---|---|---|---|---| +| 12 | Screen with cost-normalised policies and budget matched to operator costs: both cost-aware arms improved prospects and held-out delta, but failed BH-FDR (evolved Δ = +0.020833, CI low +0.003819, q = 0.0907). No promotion | 8 trials/family | `spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md` | `experiments/protocol-242-v1/` | +| 13 | **Promoted (toy substrate only):** fresh-seed confirmatory run of the evolved policy beats fixed baseline: Δ = +0.018720 discoveries/credit (95% CI +0.010324 to +0.027454, p = q = 0.0005, d = 1.01); held-out gamma Δ = +0.021296 (CI low +0.015046, d = 1.38); secondary also positive. All gates passed; replay was diagnostic only | 24 trials/family | `spec/research/243_META_SEARCH_CONFIRMATORY.md` | `experiments/protocol-243-v1/` | + ## Official milestones (per `planning/MILESTONES.md`) M0 Delivered · M1 Delivered · **M2 Reference rediscovery — not delivered diff --git a/docs/research/DREAM_RSI_INTEGRATION_REPORT.md b/docs/research/DREAM_RSI_INTEGRATION_REPORT.md index 4be2b3c..3923e1e 100644 --- a/docs/research/DREAM_RSI_INTEGRATION_REPORT.md +++ b/docs/research/DREAM_RSI_INTEGRATION_REPORT.md @@ -89,10 +89,30 @@ than baseline (Δ = −0.006548/credit, 95% CI low −0.0125, p = 0.14) and the random control Δ = −0.007540 (p = 0.31); held-out deltas also non-positive. All arms again `REJECTED_PROSPECTIVE`, bundle independently verified. -**Conclusion:** no research improvement is claimed. The capability works -(traces record, replay stays counterfactual-honest, gates fail closed), but the -tested policies did not discover algorithms better than the fixed baseline -under the same budget. This is a negative result reported as measured. +**Protocol 242 — preregistered corrected screen** (`experiments/protocol-242-v1/`, +spec committed before run). Defects fixed: cost-normalised cold-start prior and +replay agreement against a *recorded* decision. Budget 40 (matched to operator +costs), 8 trials/family, BH-FDR. Both cost-aware arms improved: evolved Δ = ++0.020833/credit (CI low +0.003819, raw p = 0.0465) and held-out Δ = +0.022778, +but BH q = 0.0907 → **not promoted**. Replay agreement is now well-defined and +measured against an actual recorded decision. + +**Protocol 243 — preregistered confirmatory run** +(`experiments/protocol-243-v1/`, spec committed before run). Single arm +`evolved` vs fixed baseline, 24 trials/family, fresh seeds +`1337711 / 2711337`, BH across one comparison. Prospective Δ = +0.018720 +discoveries/credit (95% CI +0.010324 to +0.027454, p = q = 0.0005, d = 1.01); +secondary Δ = +0.011594 (CI low +0.007701); held-out gamma Δ = +0.021296 +(CI low +0.015046, d = 1.38); secondary held-out Δ = +0.006019 (CI low ++0.004861). All gates passed → **PROMOTED** (checksum +`355ec5510eb46ed7910997a65b35f29e7cd4826a8f1409d03d809e6b073b2f99`). +Bundle independently verified (10 files, trace integrity OK). + +**Conclusion:** the capability is now scientifically informative. Within the +**toy substrate**, the evolved cost-aware policy measurably improves +discoveries per credit under fresh, matched, FDR-corrected conditions and on a +held-out family. This is *not* a real-workload or deployment claim; it makes +the policy eligible for subsequent research runs only. ## 10. Limitations @@ -101,9 +121,14 @@ under the same budget. This is a negative result reported as measured. - Replay cannot estimate outcomes for branches never explored; those decisions are recorded with `uncertain=true` and no label. - Toy substrate only; no real-workload transfer shown. -- The preregistered budget was mis-scaled to operator costs, making the pilot - uninformative about policy quality; the diagnostic is post-hoc. -- Sample size (4 trials/family) is small; no confirmatory run is justified. +- The protocol-241 budget was mis-scaled to operator costs; its null is a + methodology artifact, explicitly superseded by protocols 242/243. +- Protocol 243 is confirmatory **within the toy substrate only**; transfer to + real workloads (hpo/transform/compose) remains untested. The policy was + selected by the protocol-242 screen, so an independent replication on a + different substrate is still required before any broader claim. +- Replay agreement is defined only on states whose trace records a decision; + it remains diagnostic, never a promotion criterion. ## 11. Reproduction @@ -116,6 +141,9 @@ cd implementation/algolab .venv/bin/python -m algolab.cli.main meta-verify --dir experiments/protocol-241-v1 # post-hoc diagnostic only: .venv/bin/python -m algolab.cli.main meta-search-run --dir experiments/protocol-241-v1-diagnostic --budget 40 --force +# preregistered corrected screen and confirmatory run: +.venv/bin/python -m algolab.cli.main meta-search-run --dir experiments/protocol-242-v1 --protocol-id protocol-242 --trials 8 --budget 40 --seed-base 555111 --confirmation-seed-base 777333 --apply-bh --record-historical-choice --force +.venv/bin/python -m algolab.cli.main meta-search-run --dir experiments/protocol-243-v1 --protocol-id protocol-243 --arms fixed-baseline,evolved --trials 24 --budget 40 --seed-base 1337711 --confirmation-seed-base 2711337 --apply-bh --record-historical-choice --force ``` ## 12. Future research diff --git a/implementation/algolab/experiments/protocol-243-v1/checksums.json b/implementation/algolab/experiments/protocol-243-v1/checksums.json new file mode 100644 index 0000000..045cb4f --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/checksums.json @@ -0,0 +1 @@ +{"evaluations/evolved.json":"7a039b9fd4c377be49acb3229d6ffea4cd876edc0af95b28259bb7f51f05339c","evaluations/fixed-baseline.json":"f3909d548195384701e24f090bd109c20acdd47165d87c455a37ff77ccafa66b","manifest.json":"bd8e23fe2a84de26e4d4f7639ac03bf1ee82aec51c1cb648b77e49c026cd9f1e","promotions/evolved.json":"47160d1ab5cb9c251edb43eaca1603c74b1bdbc890119551757affa237a43405","promotions/fixed-baseline.json":"44cc04d8d4e66132c2b6e8d366e2ba9241cfc9ae9df8f2ab8a15a479abc5254c","replay/evolved.json":"f96efbaa18885348d8fcb19581260ead786f4c76e005e0450034df8500f41606","replay/fixed-baseline.json":"f4f3863c2a11a08dfc5853f187a2afae77973ccea6005eb583cb4142423cafb6","report.md":"f3281dcc911b1c236a486d31f2a71d1cfe1f7586108bc286dae07782b213d676","trace.json":"0285b23ae1e76095bf50e41ed3d69fd172860e0c556535850a064fd419f88af9","trace.json.sha256":"a6b5d77b0074c0e2d536019aaf40201fa5adcb6aa9402616f734d7d414b85e2d"} diff --git a/implementation/algolab/experiments/protocol-243-v1/evaluations/evolved.json b/implementation/algolab/experiments/protocol-243-v1/evaluations/evolved.json new file mode 100644 index 0000000..d027272 --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/evaluations/evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":1,"coverage":0.125,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"6e30d0fa2f04fc5f43219353cbd7cd8724d1ca478b9a6170d44794da1f73c7ac","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.013541666666666667,"candidate_mean":0.032261396011396014,"ci_high":0.027453703703703702,"ci_low":0.010324074074074074,"delta":0.018719729344729347,"effect_size":1.012906906207475,"p_adjusted":0.0004997501249375312,"p_value":0.0004997501249375312},"secondary":{"ci_high":0.015528846153846155,"ci_low":0.007701210826210826,"delta":0.01159366096866097,"p_value":0.0004997501249375312},"seed_base":1337711,"stage":"B_prospective","trials_per_family":24},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.022222222222222223,"candidate_mean":0.04351851851851852,"ci_high":0.027546296296296294,"ci_low":0.015046296296296299,"delta":0.021296296296296296,"effect_size":1.3792326405189665,"p_value":0.0004997501249375312},"secondary":{"ci_high":0.0076388888888888895,"ci_low":0.004861111111111112,"delta":0.006018518518518522,"p_value":0.0004997501249375312},"seed_base":2711337,"stage":"C_independent_confirmation","trials_per_family":24}} diff --git a/implementation/algolab/experiments/protocol-243-v1/evaluations/fixed-baseline.json b/implementation/algolab/experiments/protocol-243-v1/evaluations/fixed-baseline.json new file mode 100644 index 0000000..0d16b37 --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/evaluations/fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"da60739104b272a6581d9baebcf80f3c2ad4e1f51fea209c53c60a10c3630ff6","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.013541666666666667,"candidate_mean":0.013541666666666667,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":1337711,"stage":"B_prospective","trials_per_family":24},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.022222222222222223,"candidate_mean":0.022222222222222223,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":2711337,"stage":"C_independent_confirmation","trials_per_family":24}} diff --git a/implementation/algolab/experiments/protocol-243-v1/manifest.json b/implementation/algolab/experiments/protocol-243-v1/manifest.json new file mode 100644 index 0000000..f07f026 --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/manifest.json @@ -0,0 +1 @@ +{"arms":["fixed-baseline","evolved"],"bootstrap_iterations":2000,"budget":40.0,"confirmation_seed_base":2711337,"episodes":8,"families":["alpha","beta"],"held_out_family":"gamma","multiple_comparison_correction":"benjamini-hochberg","promotion_gate":"stage A replay-only never promotes; B requires positive CI and p<0.05; C requires non-negative delta and CI>=-0.001 on held-out gamma","protocol":"protocol-243","protocol_version":"1.0.0","schema_version":"meta-pilot/1.0","seed_base":1337711,"substrate":"algolab.search.toy","trace_is_prospective_evidence":false,"trace_kind":"synthetic_pilot_trace","trials":24} diff --git a/implementation/algolab/experiments/protocol-243-v1/promotions/evolved.json b/implementation/algolab/experiments/protocol-243-v1/promotions/evolved.json new file mode 100644 index 0000000..3999a61 --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/promotions/evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":1,"coverage":0.125,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":5,"n_decisions":5,"n_observed":0,"policy_checksum":"6e30d0fa2f04fc5f43219353cbd7cd8724d1ca478b9a6170d44794da1f73c7ac","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.013541666666666667,"candidate_mean":0.032261396011396014,"ci_high":0.027453703703703702,"ci_low":0.010324074074074074,"delta":0.018719729344729347,"effect_size":1.012906906207475,"p_adjusted":0.0004997501249375312,"p_value":0.0004997501249375312},"secondary":{"ci_high":0.015528846153846155,"ci_low":0.007701210826210826,"delta":0.01159366096866097,"p_value":0.0004997501249375312},"seed_base":1337711,"stage":"B_prospective","trials_per_family":24},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.022222222222222223,"candidate_mean":0.04351851851851852,"ci_high":0.027546296296296294,"ci_low":0.015046296296296299,"delta":0.021296296296296296,"effect_size":1.3792326405189665,"p_value":0.0004997501249375312},"secondary":{"ci_high":0.0076388888888888895,"ci_low":0.004861111111111112,"delta":0.006018518518518522,"p_value":0.0004997501249375312},"seed_base":2711337,"stage":"C_independent_confirmation","trials_per_family":24}},"promotion_checksum":"355ec5510eb46ed7910997a65b35f29e7cd4826a8f1409d03d809e6b073b2f99","reasons":["all promotion gates passed"],"schema_version":"meta-eval/1.0","status":"PROMOTED"} diff --git a/implementation/algolab/experiments/protocol-243-v1/promotions/fixed-baseline.json b/implementation/algolab/experiments/protocol-243-v1/promotions/fixed-baseline.json new file mode 100644 index 0000000..4df7052 --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/promotions/fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-eval/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.0,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":1,"n_counterfactual_uncertain":4,"n_decisions":5,"n_observed":1,"policy_checksum":"da60739104b272a6581d9baebcf80f3c2ad4e1f51fea209c53c60a10c3630ff6","replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":20.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.013541666666666667,"candidate_mean":0.013541666666666667,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":1337711,"stage":"B_prospective","trials_per_family":24},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.022222222222222223,"candidate_mean":0.022222222222222223,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":2711337,"stage":"C_independent_confirmation","trials_per_family":24}},"promotion_checksum":"a97ed7b020cd5732ba061fceb5f801af5b7f153373558ad25e40a5bb3512ce2a","reasons":["prospective primary metric did not significantly beat baseline (delta=0, ci_low=0, p=1)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-243-v1/replay/evolved.json b/implementation/algolab/experiments/protocol-243-v1/replay/evolved.json new file mode 100644 index 0000000..c059c69 --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/replay/evolved.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_feb6d0f212ce428d58f0","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_991fcd52a0b255cceca9","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_1455f2dc5cd231ce9cd8","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_89bb0b4c0c9eee7a87a2","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"rollback","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_4c62548f38a0d0a83a01","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":5,"observed":0},"policy_id":"pol-evolved","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_agreement_applicable":1,"n_decisions":5,"n_observed":0,"n_uncertain":5},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-243-v1/replay/fixed-baseline.json b/implementation/algolab/experiments/protocol-243-v1/replay/fixed-baseline.json new file mode 100644 index 0000000..7f54571 --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/replay/fixed-baseline.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["tune","reparameterize","decompose","refresh","synthesize","validate","polyglot","rollback"],"chosen_method":"decompose","depth":0,"estimated_outcome":null,"historically_chosen_method":"tune","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":20.0,"discovery":false},"mean_effect":0.11911692581118542,"valid":true},"outcome_kind":"observed","rationale":"fixed priority order (no learning)","state_node_id":"trn_feb6d0f212ce428d58f0","uncertain":false,"uncertainty_reason":""},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_991fcd52a0b255cceca9","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_1455f2dc5cd231ce9cd8","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_89bb0b4c0c9eee7a87a2","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"},{"agreement_applicable":false,"available_methods":["synthesize","validate","polyglot","rollback"],"chosen_method":"polyglot","depth":1,"estimated_outcome":null,"historically_chosen_method":null,"matches_historical":false,"observed_outcome":null,"outcome_kind":"counterfactual_uncertain","rationale":"fixed priority order (no learning)","state_node_id":"trn_4c62548f38a0d0a83a01","uncertain":true,"uncertainty_reason":"branch was never explored in the historical trace; no outcome label exists and none was manufactured"}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":4,"observed":1},"policy_id":"pol-fixed-baseline","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.0,"n_agreement_applicable":1,"n_decisions":5,"n_observed":1,"n_uncertain":4},"trace_id":"trace-pilot-241"} diff --git a/implementation/algolab/experiments/protocol-243-v1/report.md b/implementation/algolab/experiments/protocol-243-v1/report.md new file mode 100644 index 0000000..e078e61 --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/report.md @@ -0,0 +1,10 @@ +# protocol-243 — Meta-Search bounded experiment + +Status: **preregistered experiment**. The historical trace is synthetic and is not prospective evidence. No policy is promoted on replay performance. + +| Arm | Replay agreement | Prospective Δ/credit | 95% CI low | p | q (BH) | Held-out Δ | Promotion | +|---|---|---|---|---|---|---|---| +| fixed-baseline | 0.000 | +0.000000 | +0.000000 | 1.0000 | — | +0.000000 | REJECTED_PROSPECTIVE | +| evolved | 0.000 | +0.018720 | +0.010324 | 0.0005 | 0.0005 | +0.021296 | PROMOTED | + +Primary outcome: validated discoveries per credit (paired across matched trials). Secondary: distinct useful methods per credit. Negative results are reported as measured. diff --git a/implementation/algolab/experiments/protocol-243-v1/trace.json b/implementation/algolab/experiments/protocol-243-v1/trace.json new file mode 100644 index 0000000..4a98c8c --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/trace.json @@ -0,0 +1 @@ +{"experiment_id":"EXP-META-241","nodes":[{"artifact_refs":[],"candidate_generation_method":"fixed-baseline","candidate_id":"root","checksum":"feb6d0f212ce428d58f0f5522b5d2af002bb08f2e6cd2fb9d31f4c078c7365be","compute_credits":0.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.0},"eval_split_id":"train","evaluation_result":{},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_feb6d0f212ce428d58f0","observation":{"discovery":false,"valid":true},"parent_id":null,"policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"0000000000000000000000000000000000000000000000000000000000000000","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"families":["alpha","beta"],"historical_choice":"tune"},"seed":77100,"selection_decision":"seed root","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"tune","candidate_id":"cand-tune","checksum":"991fcd52a0b255cceca95ebde39df5f0276d92a52f23bfa969d0d2d39782ac25","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.36484432941054523},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_991fcd52a0b255cceca9","observation":{"discovery":false,"mean_effect":0.36484432941054523,"valid":false},"parent_id":"trn_feb6d0f212ce428d58f0","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"feb6d0f212ce428d58f0f5522b5d2af002bb08f2e6cd2fb9d31f4c078c7365be","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0},"seed":77100,"selection_decision":"expand tune","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"reparameterize","candidate_id":"cand-reparameterize","checksum":"1455f2dc5cd231ce9cd869f52e0fd55200c991f9558a3b7f660437a64c94d266","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.5768893801470273},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_1455f2dc5cd231ce9cd8","observation":{"discovery":false,"mean_effect":0.5768893801470273,"valid":false},"parent_id":"trn_feb6d0f212ce428d58f0","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"991fcd52a0b255cceca95ebde39df5f0276d92a52f23bfa969d0d2d39782ac25","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"beta","trial":1},"seed":77101,"selection_decision":"expand reparameterize","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"decompose","candidate_id":"cand-decompose","checksum":"89bb0b4c0c9eee7a87a28eec6734f43be561ce25bae5f539efbdb2550e11b3f0","compute_credits":20.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.11911692581118542},"eval_split_id":"train","evaluation_result":{"cost_credits":20.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_89bb0b4c0c9eee7a87a2","observation":{"discovery":false,"mean_effect":0.11911692581118542,"valid":true},"parent_id":"trn_feb6d0f212ce428d58f0","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"1455f2dc5cd231ce9cd869f52e0fd55200c991f9558a3b7f660437a64c94d266","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":2},"seed":77102,"selection_decision":"expand decompose","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"refresh","candidate_id":"cand-refresh","checksum":"4c62548f38a0d0a83a01b2ef43b11bb76dfab3b862271b3ed7c67b33d75771c2","compute_credits":10.0,"created_at_utc":"synthetic-pilot","dataset_id":"toy","derived_metrics":{"mean_effect":0.40859125466996377},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"protocol":"protocol-241","source":"synthetic_pilot_trace"},"experiment_id":"EXP-META-241","hypotheses":[],"node_id":"trn_4c62548f38a0d0a83a01","observation":{"discovery":false,"mean_effect":0.40859125466996377,"valid":false},"parent_id":"trn_feb6d0f212ce428d58f0","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"89bb0b4c0c9eee7a87a28eec6734f43be561ce25bae5f539efbdb2550e11b3f0","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"beta","trial":3},"seed":77103,"selection_decision":"expand refresh","statement_kind":"observation","stopping_decision":""}],"schema_version":"meta-trace/1.0","trace_id":"trace-pilot-241"} \ No newline at end of file diff --git a/implementation/algolab/experiments/protocol-243-v1/trace.json.sha256 b/implementation/algolab/experiments/protocol-243-v1/trace.json.sha256 new file mode 100644 index 0000000..4fbcdce --- /dev/null +++ b/implementation/algolab/experiments/protocol-243-v1/trace.json.sha256 @@ -0,0 +1 @@ +0285b23ae1e76095bf50e41ed3d69fd172860e0c556535850a064fd419f88af9 diff --git a/implementation/algolab/tests/test_meta_search.py b/implementation/algolab/tests/test_meta_search.py index bd51589..d1fedbe 100644 --- a/implementation/algolab/tests/test_meta_search.py +++ b/implementation/algolab/tests/test_meta_search.py @@ -217,6 +217,43 @@ def test_invalid_policy_rejected(self) -> None: ) +class TestCorrectedMechanisms: + def test_cold_start_prior_is_cost_normalised(self) -> None: + costs = {"rollback": 5.0, "decompose": 20.0} + for policy in (REPLAY_POLICY, EVOLVED_POLICY): + choice = policy.select(("rollback", "decompose"), (), seed=1, costs=costs) + assert choice.method == "rollback", policy.name + + def test_replay_agreement_uses_recorded_decision(self) -> None: + from algolab.meta_search.protocol_241 import build_pilot_trace + + trace = build_pilot_trace(record_historical_choice=True) + result = ReplayEnv(trace).run(BASELINE_POLICY, seed=17) + assert result.n_applicable == 1 + assert result.decisions[0].historically_chosen_method == "tune" + assert result.decisions[0].agreement_applicable is True + # Without a recorded decision, agreement is inapplicable, not zero-scored. + plain = ReplayEnv(build_pilot_trace()).run(BASELINE_POLICY, seed=17) + assert plain.n_applicable == 0 + assert all(not d.agreement_applicable for d in plain.decisions) + + def test_bh_adjusted_p_gates_promotion(self) -> None: + evaluation = { + "stage_a": {"is_prospective_evidence": False}, + "stage_b": { + "is_prospective_evidence": True, + "primary": {"delta": 0.02, "ci_low": 0.01, "p_value": 0.04, + "p_adjusted": 0.09}, + "secondary": {"ci_low": 0.01}, + }, + "stage_c": {"is_prospective_evidence": True, + "primary": {"delta": 0.02, "ci_low": 0.01}}, + } + decision = promote(EVOLVED_POLICY, BASELINE_POLICY, evaluation) + assert decision.status != PromotionStatus.PROMOTED + assert "p=0.09" in " ".join(decision.reasons) + + class TestPromotion: def test_historical_replay_alone_cannot_promote( self, trace: DiscoveryTrace @@ -274,8 +311,9 @@ def test_replay_evaluation_reports_limits(self, trace: DiscoveryTrace) -> None: class TestPilotAndVerification: + @staticmethod @pytest.fixture(scope="class") - def bundle(self, tmp_path_factory: pytest.TempPathFactory) -> Path: + def bundle(tmp_path_factory: pytest.TempPathFactory) -> Path: path = tmp_path_factory.mktemp("meta") / "protocol-241-v1" run_pilot(path, trials=3, episodes=6, bootstrap_iterations=200) return path From a6f54ac15527f8d85227c5801e95305c594a9ecc Mon Sep 17 00:00:00 2001 From: nulllabtests Date: Thu, 19 Nov 2026 19:42:36 +0000 Subject: [PATCH 6/7] docs: update passing test count to 467 --- implementation/algolab/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implementation/algolab/README.md b/implementation/algolab/README.md index 377fd68..9ae5d57 100644 --- a/implementation/algolab/README.md +++ b/implementation/algolab/README.md @@ -37,7 +37,7 @@ the executable core of the platform, delivered across five milestones: `../../spec/research/230_*` … `240_*`; findings summarized in the root README ("What we learned"). -The test suite currently has **443 passing tests** covering unit, integration, +The test suite currently has **467 passing tests** covering unit, integration, ontology-invariant, protocol-compliance (230–240, including a provenance and s2 smoke test), committed-artifact integrity, sealed-bundle reproduction, and golden reproduction behavior. `make test` runs the fast lane (`-m "not slow"`); From 7b19003f44e8ffc0187d2378c5d7acb18649c6f9 Mon Sep 17 00:00:00 2001 From: nulllabtests Date: Sun, 22 Nov 2026 20:44:07 +0000 Subject: [PATCH 7/7] feat(meta-search): preregister and run real-workload transfer Complete the Protocol 241 mission as one cohesive research change. Verified the prior DREAM-RSI audit and Protocols 241-243 without modifying any historical bundle, preregistration, evaluator, threshold, or promotion decision. Protocol 243 was reproduced byte-for-byte in a clean tree and independently verified. Added the frozen Protocol 244 preregistration before execution and implemented meta-transfer-run on the unchanged evaluator/promotion gate. The preregistered transform/hpo transfer test rejected the evolved policy on both workloads after BH correction (q=0.5052); the toy promotion therefore does not transfer. Bundle verification and fresh-process byte reproduction both passed. Added regression coverage for the transfer runner, CLI, sealing, tamper detection, determinism, and fail-closed workload handling. Added the final A-J research report, machine-readable results manifest, checksums, full test output, lint/type-check output, reproduction verdicts, and a reporting-only compute-accounting correction that does not rewrite the sealed bundle. Docs now describe the complete protocols 241-244 line and the scoped verdict: toy-substrate meta-search capability demonstrated; real-workload transfer and autonomy expansion not demonstrated. Checks: 474 tests passed, ruff clean, mypy clean (59 source files). --- README.md | 20 +- docs/STATUS.md | 13 +- docs/api/README.md | 28 + docs/research/DREAM_RSI_INTEGRATION_REPORT.md | 9 + implementation/algolab/README.md | 6 +- .../protocol-241-final/RESEARCH_REPORT.md | 157 ++++++ .../protocol-241-final/checksums.json | 10 + .../compute-accounting-correction.json | 39 ++ .../experiments/protocol-241-final/mypy.txt | 1 + ...rotocol-244-reproduction-verification.json | 149 +++++ .../reproduction-verification.json | 107 ++++ .../protocol-241-final/results_manifest.json | 281 ++++++++++ .../experiments/protocol-241-final/ruff.txt | 1 + .../protocol-241-final/test-results.txt | 56 ++ .../protocol-244-v1/checksums.json | 1 + .../protocol-244-v1/environment-hpo.json | 1 + .../environment-transform.json | 1 + .../evaluations/hpo-evolved.json | 1 + .../evaluations/hpo-fixed-baseline.json | 1 + .../evaluations/transform-evolved.json | 1 + .../evaluations/transform-fixed-baseline.json | 1 + .../experiments/protocol-244-v1/manifest.json | 1 + .../promotions/hpo-evolved.json | 1 + .../promotions/transform-evolved.json | 1 + .../protocol-244-v1/replay/hpo-evolved.json | 1 + .../replay/hpo-fixed-baseline.json | 1 + .../replay/transform-evolved.json | 1 + .../replay/transform-fixed-baseline.json | 1 + .../experiments/protocol-244-v1/report.md | 10 + .../experiments/protocol-244-v1/trace.json | 1 + .../protocol-244-v1/trace.json.sha256 | 1 + .../scripts/verify_meta_reproduction.py | 122 +++++ .../algolab/src/algolab/cli/main.py | 58 ++ .../src/algolab/meta_search/transfer.py | 510 ++++++++++++++++++ .../algolab/tests/test_meta_transfer.py | 224 ++++++++ spec/architecture/100_SYSTEM_ARCHITECTURE.md | 36 ++ .../244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md | 81 +++ 37 files changed, 1919 insertions(+), 15 deletions(-) create mode 100644 implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md create mode 100644 implementation/algolab/experiments/protocol-241-final/checksums.json create mode 100644 implementation/algolab/experiments/protocol-241-final/compute-accounting-correction.json create mode 100644 implementation/algolab/experiments/protocol-241-final/mypy.txt create mode 100644 implementation/algolab/experiments/protocol-241-final/protocol-244-reproduction-verification.json create mode 100644 implementation/algolab/experiments/protocol-241-final/reproduction-verification.json create mode 100644 implementation/algolab/experiments/protocol-241-final/results_manifest.json create mode 100644 implementation/algolab/experiments/protocol-241-final/ruff.txt create mode 100644 implementation/algolab/experiments/protocol-241-final/test-results.txt create mode 100644 implementation/algolab/experiments/protocol-244-v1/checksums.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/environment-hpo.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/environment-transform.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/evaluations/hpo-evolved.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/evaluations/hpo-fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/evaluations/transform-evolved.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/evaluations/transform-fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/manifest.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/promotions/hpo-evolved.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/promotions/transform-evolved.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/replay/hpo-evolved.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/replay/hpo-fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/replay/transform-evolved.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/replay/transform-fixed-baseline.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/report.md create mode 100644 implementation/algolab/experiments/protocol-244-v1/trace.json create mode 100644 implementation/algolab/experiments/protocol-244-v1/trace.json.sha256 create mode 100644 implementation/algolab/scripts/verify_meta_reproduction.py create mode 100644 implementation/algolab/src/algolab/meta_search/transfer.py create mode 100644 implementation/algolab/tests/test_meta_transfer.py create mode 100644 spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md diff --git a/README.md b/README.md index 9b9629e..38798e0 100644 --- a/README.md +++ b/README.md @@ -147,23 +147,29 @@ is optimal in-domain but fragile under shift, so pair it with adaptation whenever transfer is on the line; family-conditioning requires informative slice sizes to pay off. -## Meta-Search (protocol 241, exploratory pilot) +## Meta-Search (protocols 241–244, toy confirmation and real-workload transfer test) -AlgoLab can now record its own research search histories, replay alternative +AlgoLab can record its own research search histories, replay alternative decisions against them, and evaluate versioned search policies with a fail-closed promotion gate. Built from DREAM-RSI ideas but AlgoLab-native; no policy source is self-modified and no paid API is required. - Audit: `docs/research/DREAM_RSI_INTEGRATION_AUDIT.md` -- Report: `docs/research/DREAM_RSI_INTEGRATION_REPORT.md` -- Preregistration: `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` -- Run: `algolab meta-search-run --dir experiments/protocol-241-v1` then - `algolab meta-verify --dir experiments/protocol-241-v1` +- Reports: `docs/research/DREAM_RSI_INTEGRATION_REPORT.md` and the consolidated + `implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md` +- Preregistrations: `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` … + `244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md` +- Run: `algolab meta-search-run --dir experiments/protocol-243-v1` (or + `algolab meta-transfer-run --dir experiments/protocol-244-v1`), then + `algolab meta-verify --dir ` - Results: protocol 241 pilot was **mis-scaled and uninformative**; protocol 242 screen found positive effects that failed BH-FDR; protocol 243 **promoted** the evolved policy on fresh seeds (toy substrate only): +0.0187 discoveries/credit (95% CI +0.0103 to +0.0275, p = 0.0005), - held-out +0.0213. Historical replay is *not* prospective evidence. + held-out +0.0213. Protocol 244 tested that unchanged policy on real + `transform`/`hpo` workloads and **did not transfer it**: both arms were + `REJECTED_PROSPECTIVE` (q = 0.5052). Historical replay is *not* prospective + evidence; no deployment or autonomy claim follows from the toy promotion. ## Non-negotiable constraints diff --git a/docs/STATUS.md b/docs/STATUS.md index 27981ed..0b8a863 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -1,11 +1,11 @@ # STATUS — proven claims, substrates, sample sizes, evidence links -Updated: 2026-11-15 — protocols 239 (transform) and 240 (compose) recorded; -both bundles independently re-executed and reproduced by -`scripts/verify_bundle.py`. Protocol 240 adds a **negative** claim (class C). -The protocol-236 designation was resolved (D-2: 236 = higher-N real workload, -S2 = protocol 237) — see `docs/quality/protocol-236-conflict.md`. Entry format: -**claim** — substrate, n, register link, evidence bundle. +Updated: 2026-11-22 — protocols 239 (transform) and 240 (compose) remain +independently reproduced; the meta-search line now includes protocol 244, a +preregistered **negative transfer** result on real workloads. The protocol-236 +designation was resolved (D-2: 236 = higher-N real workload, S2 = protocol 237) +— see `docs/quality/protocol-236-conflict.md`. Entry format: **claim** — +substrate, n, register link, evidence bundle. ## toy substrate (deterministic planted-truth generator) @@ -54,6 +54,7 @@ S2 = protocol 237) — see `docs/quality/protocol-236-conflict.md`. Entry format |---|---|---|---|---| | 12 | Screen with cost-normalised policies and budget matched to operator costs: both cost-aware arms improved prospects and held-out delta, but failed BH-FDR (evolved Δ = +0.020833, CI low +0.003819, q = 0.0907). No promotion | 8 trials/family | `spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md` | `experiments/protocol-242-v1/` | | 13 | **Promoted (toy substrate only):** fresh-seed confirmatory run of the evolved policy beats fixed baseline: Δ = +0.018720 discoveries/credit (95% CI +0.010324 to +0.027454, p = q = 0.0005, d = 1.01); held-out gamma Δ = +0.021296 (CI low +0.015046, d = 1.38); secondary also positive. All gates passed; replay was diagnostic only | 24 trials/family | `spec/research/243_META_SEARCH_CONFIRMATORY.md` | `experiments/protocol-243-v1/` | +| 14 | **Not demonstrated (real workloads):** the unchanged evolved policy does not transfer to `transform` or `hpo`: prospective Δ = +0.004045 (transform, CI low −0.003175, q = 0.5052) and +0.002500 (hpo, CI low 0, q = 0.5052); both `REJECTED_PROSPECTIVE`, replay diagnostic only; bundle byte-reproduced | 8 trials/family/stage per workload | `spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md` | `experiments/protocol-244-v1/`, `implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md` | ## Official milestones (per `planning/MILESTONES.md`) diff --git a/docs/api/README.md b/docs/api/README.md index c48c172..d28b840 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -17,6 +17,25 @@ Knowledge layer with evidence tracking and operator management. - `operators` - Operator catalog and credit budgets - `registry` - Append-only skill registry +### `algolab.meta_search` +Meta-Search / policy-evolution subsystem (protocols 241+). Search strategies are +typed, versioned experimental objects; all stochastic choices are seeded. + +- `traces` — `DiscoveryTrace` / `TraceNode`: append-only, content-addressed, + sha256-chained discovery lineage with canonical JSON. +- `replay` — `ReplayEnv`: prefix-only decisions on a frozen trace; counterfactual + branches are labelled uncertain with no manufactured outcome and are never + prospective evidence. +- `policies` — `SearchPolicy` with deterministic `select()`, `SearchPolicy.checksum()`, + `propose_policy()` and the frozen `BASELINE` / `REPLAY` / `EVOLVED` / `CONTROL` presets. +- `evaluation` — staged `evaluate_policy()` and fail-closed `promote()`; replay + can only diagnose, prospective and independent held-out stages can promote. +- `protocol_241` — sealed bundle writer `run_pilot()` and independent + `verify_pilot()` re-hasher/verdict checker. +- `transfer` — Protocol 244 real-workload runner: reuses the same evaluator and + promotion gate on frozen `transform`/`hpo` attempt traces; replay remains + diagnostic only. + ### `algolab.statistics` Deterministic statistical inference utilities. - Bootstrap confidence intervals @@ -41,6 +60,15 @@ Execution engine for experiments and runs. See [implementation/algolab/README.md](../../implementation/algolab/README.md#cli-reference) for full CLI documentation. +Meta-Search commands: + +- `algolab meta-search-run --dir ...` — run a preregistered policy + comparison and seal every artifact in `checksums.json`. +- `algolab meta-transfer-run --dir ...` — run the preregistered + real-workload transfer protocol with the same evaluator/promotion gate. +- `algolab meta-verify --dir [--json]` — independently re-hash the + bundle, check trace integrity and detect replay-only promotion. + ## Usage Examples - [Quickstart with toy substrate](../../examples/quickstart_toy.py) diff --git a/docs/research/DREAM_RSI_INTEGRATION_REPORT.md b/docs/research/DREAM_RSI_INTEGRATION_REPORT.md index 3923e1e..95519d9 100644 --- a/docs/research/DREAM_RSI_INTEGRATION_REPORT.md +++ b/docs/research/DREAM_RSI_INTEGRATION_REPORT.md @@ -154,3 +154,12 @@ cd implementation/algolab `search-run` bundles (requires a trace-export bridge). 3. Add a held-out *task* (not only family) and an LLM-proposer arm that is strictly optional and gated by the same promotion logic. + +## 13. Update (2026-11-22): real-workload transfer tested + +Protocol 244 preregistered and executed the transfer test left open in §10. +The unchanged evolved policy did **not** transfer to real `transform` or `hpo` +workloads: both comparisons were `REJECTED_PROSPECTIVE` after BH correction +(q = 0.5052). The consolidated verdicts and reproduction evidence are in +`implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md`. +No historical bundle or threshold was changed. diff --git a/implementation/algolab/README.md b/implementation/algolab/README.md index 9ae5d57..adafbd9 100644 --- a/implementation/algolab/README.md +++ b/implementation/algolab/README.md @@ -177,8 +177,10 @@ docs/decisions/ architecture decision records (ADR-0001..0008) its ≥2-family promotion bar; the cost-aware successor C+ met it (`experiments/protocol-230-v2/`); follow-up protocols isolated representation, data-quantity, and decision-rule effects. Scope caveat: - toy substrate only — real-workload transfer is unproven, so autonomy - beyond Level 1 remains ungranted. + toy substrate only for that claim. The separate meta-search line + (protocols 241–244) promotes the evolved policy on the toy substrate, but the + preregistered real-workload transfer test (protocol 244) rejected promotion on + `transform` and `hpo`. Autonomy beyond Level 1 remains ungranted. ## Documentation diff --git a/implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md b/implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md new file mode 100644 index 0000000..09522c9 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md @@ -0,0 +1,157 @@ +# Protocol 241 mission — final research report + +**Date:** 2026-11-22 +**Branch:** `integration/dream-rsi-meta-search` +**Source state:** `integration/dream-rsi-meta-search`, single PR commit +**Scope:** verify the prior DREAM-RSI/meta-search work, preserve all historical +bundles, then preregister and execute Protocol 244 real-workload transfer. +**Resource class:** CPU-only, offline, no paid APIs, no GPU, no new runtime +dependencies. + +## Executive verdict + +The meta-search capability is real and reproducible **within the toy +substrate**: the unchanged `evolved` policy was promoted by Protocol 243 under +fresh seeds, matched compute, paired bootstrap CIs, held-out confirmation, and +the unchanged fail-closed gate. That result does **not** transfer to the two +real workloads tested here. Protocol 244 rejected promotion on both `transform` +and `hpo`; the primary gains were small, multiplicity-corrected p-values were +≈0.505, and the `transform` confidence interval crossed zero. No deployment, +autonomy expansion, or real-workload performance claim is warranted. + +Historical results were not rewritten. Protocols 241–243, their +preregistrations, evaluators, promotion thresholds, and sealed bundles remain +untouched. + +## A–J verdicts + +Verdict scale: **DEMONSTRATED** = direct preregistered or audited evidence in a +verified artifact; **PARTIALLY DEMONSTRATED** = directional/supporting evidence +that fails at least one preregistered gate; **INCONCLUSIVE** = evidence does not +resolve the claim; **NOT DEMONSTRATED** = the claim was tested and not supported, +or no valid evidence exists. + +| ID | Claim | Verdict | Evidence | +|---|---|---|---| +| A | DREAM-RSI audit is source-grounded: frozen replay, prefix-only decisions, qualified-round selection, no bandit or `DiscoverEnv`; Apache-2.0 ideas-only attribution recorded | **DEMONSTRATED** | `docs/research/DREAM_RSI_INTEGRATION_AUDIT.md`, `docs/research/DREAM_RSI_INTEGRATION_REPORT.md`, `THIRD_PARTY_NOTICES.md` | +| B | Reuse is compatible with AlgoLab governance: no source copying from incompatible licenses, no new runtime dependency, no paid API/GPU, no second event/artifact store | **DEMONSTRATED** | `spec/architecture/100_SYSTEM_ARCHITECTURE.md`, `docs/api/README.md`, `pyproject.toml`, audit report §6 | +| C | Frozen, content-addressed traces and read-only replay with explicit counterfactual uncertainty are implemented | **DEMONSTRATED** | `algolab/meta_search/traces.py`, `replay.py`; `tests/test_meta_search.py`; all sealed bundles contain integrity-checked `trace.json` | +| D | Versioned, frozen search policies and structured proposals are implemented without agent-rewritten source | **DEMONSTRATED** | `algolab/meta_search/policies.py`; `tests/test_meta_search.py::TestPolicies` | +| E | Promotion is fail-closed: replay alone cannot promote; missing/degraded stages reject; BH q replaces raw p when required | **DEMONSTRATED** | `algolab/meta_search/evaluation.py::promote`; `tests/test_meta_search.py::TestCorrectedMechanisms`, `TestPromotion`; protocol 242's q-driven rejection | +| F | Protocol 241 pilot found no preregistered improvement; the 10-credit null was budget-scale limited and the post-hoc 40-credit diagnostic also found none | **DEMONSTRATED** | `experiments/protocol-241-v1/`, `experiments/protocol-241-v1-diagnostic/`; all arms `REJECTED_PROSPECTIVE` | +| G | Protocol 242 corrected screen supports a positive direction for `evolved` but fails multiplicity control | **PARTIALLY DEMONSTRATED** | Δ = +0.020833/credit, CI low +0.003819, raw p = 0.0465, held-out Δ = +0.022778, but BH q = 0.0907; `experiments/protocol-242-v1/` | +| H | Protocol 243 promotes `evolved` under the unchanged gate, scoped to the toy substrate | **DEMONSTRATED** | Δ = +0.018720 (CI +0.010324…+0.027454, p = q = 0.0005), held-out Δ = +0.021296 (CI low +0.015046), all gates passed; `experiments/protocol-243-v1/` | +| I | Sealed bundles are independently verifiable and byte-reproducible; replay evidence is never used for promotion | **DEMONSTRATED** | 243 clean-room reproduction: 10 files byte-identical, `verified=true`; 244 fresh-process reproduction: 16 files byte-identical, `verified=true`; both `replay_only_promotion_detected=false` | +| J | The promoted toy policy transfers to real `transform` and `hpo` workloads | **NOT DEMONSTRATED** | Protocol 244: transform Δ = +0.004045 (CI low −0.003175, q = 0.5052, secondary CI low −0.003257, held-out Δ = 0); hpo Δ = +0.002500 (CI low 0, q = 0.5052); both `REJECTED_PROSPECTIVE`; `experiments/protocol-244-v1/` | + +## What was verified before Protocol 244 + +- Repository state: HEAD `a6f54ac`, branch `integration/dream-rsi-meta-search`. +- DREAM-RSI inspected at `8ec35bd2538220517ce1bfca4282db21b8c518db`; audit is + ideas-only, Apache-2.0 attribution recorded. +- Protocol 241 pilot: negative; diagnostic: negative. +- Protocol 242 screen: positive raw effect, BH failure, no promotion. +- Protocol 243 confirmatory toy run: `PROMOTED`, with all thresholds unchanged. +- Protocol 243 clean-room reproduction from `/tmp/opencode/algolab-clean-241` + into `/tmp/opencode/repro-243` used the documented CLI command. Results were + identical (`PROMOTED`, same deltas), `diff -rq` reported `IDENTICAL_TREES`, and + `meta-verify --json` reported `verified=true`, 10 files, `trace_integrity=true`, + no replay-only promotion. + +## Protocol 244 (preregistered before execution) + +Preregistration: `spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md`, +frozen 2026-11-22 before the run. Design: `fixed-baseline` versus unchanged +`evolved`; primary workload `transform`, secondary `hpo`; alpha/beta training +families and gamma held-out; 8 trials/family/stage; 8 episodes; 40-credit trial +budget; seeds `924211 / 351773 / 17 / 77100`; 2000 bootstrap resamples; BH across +the two workload p-values; unchanged promotion gate. + +Executed command: + +```bash +cd implementation/algolab +.venv/bin/python -m algolab.cli.main meta-transfer-run \ + --dir experiments/protocol-244-v1 --protocol-id protocol-244 \ + --workloads transform,hpo --trials 8 --episodes 8 --budget 40 \ + --seed-base 924211 --confirmation-seed-base 351773 \ + --bootstrap-iterations 2000 --apply-bh --force +.venv/bin/python -m algolab.cli.main meta-verify \ + --dir experiments/protocol-244-v1 --json +``` + +### Results + +| Workload | Arm | Primary Δ/credit | 95% CI low | raw p | BH q | Secondary CI low | Held-out Δ | Verdict | +|---|---|---:|---:|---:|---:|---:|---:|---| +| transform | evolved | +0.004045 | −0.003175 | 0.4093 | 0.5052 | −0.003257 | 0.000000 | REJECTED_PROSPECTIVE | +| hpo | evolved | +0.002500 | +0.000000 | 0.5052 | 0.5052 | +0.000000 | +0.012500 | REJECTED_PROSPECTIVE | + +Stage A replay agreement was 0.5 for both arms on both workloads and is +diagnostic only. `meta-verify` reported `verified=true`, 16 files verified, +`trace_integrity=true`, no mismatches/extra files, and no replay-only +promotion. + +### Reproduction + +A fresh process using a copied source tree (`/tmp/opencode/algolab-244-src`) +wrote `/tmp/opencode/repro-244`. Both summary lines matched, `diff -rq` reported +`IDENTICAL_TREES`, and `scripts/verify_meta_reproduction.py` reported +`pass=True`, 16 files, no failures, no extra files. See +`protocol-244-reproduction-verification.json`. + +### Known reporting defect + +`experiments/protocol-244-v1/manifest.json` doubles two non-decision-relevant +planning upper bounds (records 1536 attempts / 7680 credits; correct values are +768 attempts / 3840 credits) because an extra factor of two was applied inside +the already per-arm accounting loop. The sealed bundle was not rewritten, and +the runner was not changed after execution; this preserves byte-reproducibility. +The correction, derivation, and non-decision relevance are recorded in +`compute-accounting-correction.json`. + +## Automated checks + +- `.venv/bin/python -m pytest -q --durations=15`: **474 passed, 0 failed**. + Complete output: `test-results.txt`. Warnings were pre-existing Pydantic, + NumPy/sklearn deprecation, and ResourceWarnings; none were test failures. +- `.venv/bin/python -m ruff check src tests scripts`: **All checks passed!** + (`ruff.txt`). +- `.venv/bin/python -m mypy`: **Success: no issues found in 59 source files** + (`mypy.txt`). +- New regression tests cover the Protocol 244 runner, CLI, sealing/verification, + tamper detection, determinism, and fail-closed unknown workload handling + (`tests/test_meta_transfer.py`). + +### Review correction before merge + +PR review found that this final-summary bundle initially recorded checksums as +`{bytes, sha256}` objects. The repository convention, enforced by +`tests/test_artifact_integrity.py`, is a flat `filename -> sha256` map. The +format was corrected before merge; no research result, threshold, historical +bundle, or sealed protocol artifact was changed. All checks above were re-run +after the correction. + +## Failure analysis and limitations + +- The toy positive effect did not replicate on real workloads. Both primary + intervals fail the strict positive-lower-bound requirement after BH control. +- `transform` additionally has a negative secondary CI low and zero held-out + delta. `hpo` has a zero primary CI low despite a positive held-out delta; a + point estimate is not enough under the preregistered gate. +- Sample size is modest (8 trials/family/stage). This is an absence of + preregistered evidence, not proof of an exactly zero transfer effect. +- Replay traces for Protocol 244 are built from a small real-attempt prefix and + remain diagnostic. Off-policy branches are not evidence. +- Protocol 244 workloads are offline sklearn benchmarks, not a production + search environment. Verdict J is scoped accordingly. +- The Protocol 241 budget defect and Protocol 242 multiplicity failure remain + recorded as historical facts; neither was repaired retrospectively. + +## Final position + +The research line supports a **toy-substrate meta-search capability** with +auditable, fail-closed promotion. It does **not** support a real-workload +transfer or autonomy claim. The correct next step, if pursued, would be a new +preregistered protocol with a prespecified power analysis and a candidate policy +selected independently of Protocols 242/243 — not a post-hoc threshold change. diff --git a/implementation/algolab/experiments/protocol-241-final/checksums.json b/implementation/algolab/experiments/protocol-241-final/checksums.json new file mode 100644 index 0000000..1a82b22 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/checksums.json @@ -0,0 +1,10 @@ +{ + "RESEARCH_REPORT.md": "8ce7316c10a3d7114d11a1530946c833d2d56cad2f30c429dd1eeedbdd96d6a9", + "compute-accounting-correction.json": "7385a012641172cb23ce9293add459c329783ae37bad8dcba282c753b50e6c41", + "mypy.txt": "960745a059df2e6bf5556b518f6404c7707247bf3da084d48c3008145eb95a5d", + "protocol-244-reproduction-verification.json": "548170212183423d7db95d292bf11319b67a51d50f4d67177ec9bd1fdc1e4bb8", + "reproduction-verification.json": "e83348ae014fdf434f1734f112ee6147c3254458729273d7392baa5f882637f6", + "results_manifest.json": "006c4e2a5b7060900019914609d93dda7cafc89f2e3910dd2b285439718d013d", + "ruff.txt": "82b3e6a6c090a57601d22943bd23fca9218d1031dbe5a7b754092f9a156b4f18", + "test-results.txt": "773ef28479929405c8ee311d3d4630ee82a0b63d1962f01a4dcea7ab5ee7cb9c" +} diff --git a/implementation/algolab/experiments/protocol-241-final/compute-accounting-correction.json b/implementation/algolab/experiments/protocol-241-final/compute-accounting-correction.json new file mode 100644 index 0000000..2d8c45f --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/compute-accounting-correction.json @@ -0,0 +1,39 @@ +{ + "schema_version": "protocol-241-final/compute-correction/1.0", + "protocol": "protocol-244", + "status": "reporting-only correction", + "bundle_modified": false, + "affected_manifest_fields": [ + "compute.planned_upper_bound_attempts", + "compute.nominal_credits_upper_bound" + ], + "recorded_in_bundle": { + "planned_upper_bound_attempts": 1536, + "nominal_credits_upper_bound": 7680.0 + }, + "corrected": { + "planned_upper_bound_attempts": 768, + "nominal_credits_upper_bound": 3840.0 + }, + "derivation": { + "workloads": 2, + "arms": 2, + "prospective_trials_per_arm_per_workload": { + "stage_b": "2 training families x 8 trials = 16", + "stage_c": "1 held-out family x 8 trials = 8", + "total": 24 + }, + "episodes_per_trial": 8, + "attempt_upper_bound": "2 workloads x 2 arms x 24 trials x 8 episodes = 768", + "credit_upper_bound": "2 workloads x 2 arms x 24 trials x 40 credits = 3840" + }, + "root_cause": "run_transfer added a factor of two inside the per-policy accounting loop even though the loop already iterates both arms; this doubled both stored upper bounds.", + "decision_relevance": "none: the fields are labelled planning upper bounds, are not read by the evaluator or promotion gate, and all decisions are derived from stage B/C statistics", + "remediation": "documented here rather than rewriting the sealed protocol-244 bundle; the frozen runner is left unchanged so the bundle remains byte-reproducible", + "evidence": [ + "experiments/protocol-244-v1/manifest.json", + "experiments/protocol-244-v1/evaluations/transform-evolved.json", + "experiments/protocol-244-v1/evaluations/hpo-evolved.json", + "spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md" + ] +} diff --git a/implementation/algolab/experiments/protocol-241-final/mypy.txt b/implementation/algolab/experiments/protocol-241-final/mypy.txt new file mode 100644 index 0000000..a5ea4ba --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/mypy.txt @@ -0,0 +1 @@ +Success: no issues found in 59 source files diff --git a/implementation/algolab/experiments/protocol-241-final/protocol-244-reproduction-verification.json b/implementation/algolab/experiments/protocol-241-final/protocol-244-reproduction-verification.json new file mode 100644 index 0000000..1007a12 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/protocol-244-reproduction-verification.json @@ -0,0 +1,149 @@ +{ + "extra_files": [], + "failures": [], + "files_checked": 16, + "original": "experiments/protocol-244-v1", + "original_verification": { + "extra_files": [], + "mismatches": [], + "n_files_verified": 16, + "promotion_verdicts": { + "hpo-evolved": "REJECTED_PROSPECTIVE", + "transform-evolved": "REJECTED_PROSPECTIVE" + }, + "replay_only_promotion_detected": false, + "schema_version": "meta-pilot/1.0", + "trace_integrity": true, + "verified": true + }, + "pass": true, + "reproduction": "/tmp/opencode/repro-244", + "reproduction_verification": { + "extra_files": [], + "mismatches": [], + "n_files_verified": 16, + "promotion_verdicts": { + "hpo-evolved": "REJECTED_PROSPECTIVE", + "transform-evolved": "REJECTED_PROSPECTIVE" + }, + "replay_only_promotion_detected": false, + "schema_version": "meta-pilot/1.0", + "trace_integrity": true, + "verified": true + }, + "results": [ + { + "expected_sha256": "9c077c1aa2b9bd22a02a8082b0d26a33119500854571183e2991c197e71af336", + "file": "environment-hpo.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "fe1f6a98b55d29952938e21f407ace86b3a1e2e62d1ed2f52922a814a8766609", + "file": "environment-transform.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "f8c5b8f9a949c152db4833099ccf1146abdd7a000dbf5b7f9ce4bbb0d3cd742b", + "file": "evaluations/hpo-evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "e4e52f69ddf3b6bc40c684ce0feb4f71cb88ff06ca3c5f91369dfcc344a9538b", + "file": "evaluations/hpo-fixed-baseline.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "453d524061afc881cba98464779aeef009f18e1925fd99ba1618d799a7ef00ca", + "file": "evaluations/transform-evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "1a10f43545e483380b76e8e622c4bb040825e04e759b26488f59589d59f49b61", + "file": "evaluations/transform-fixed-baseline.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "507c4cd97522ec761db4818ebf9597a035babcde4876c1418a354896a5c436e3", + "file": "manifest.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "b9b6540c2fb8608a784ecc8cba0ee5151583ed6cce5f9ab3bab5f8363ebdd427", + "file": "promotions/hpo-evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "ce97901b0626160978ffedafcf5e8a35aedd587771f57df5669fcf5c4948b366", + "file": "promotions/transform-evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "ee30e06f3db0090ed40add535cc10d90ccf2fa0f467539feae49489b3172f335", + "file": "replay/hpo-evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "b0702fe749f3235a1c574cea315ef0dc8fada17c0fe9c6da95bae9e5d3e2c51c", + "file": "replay/hpo-fixed-baseline.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "ee30e06f3db0090ed40add535cc10d90ccf2fa0f467539feae49489b3172f335", + "file": "replay/transform-evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "b0702fe749f3235a1c574cea315ef0dc8fada17c0fe9c6da95bae9e5d3e2c51c", + "file": "replay/transform-fixed-baseline.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "4fbdbfc6fb28075f7ca55d89ff56110a188fdd344af3eb1b1599bb4354fe4bab", + "file": "report.md", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "836b785dbd8c43dfaf59887d93aee6d0c60ea5d02cdce171d79bc3374dc19955", + "file": "trace.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "154e38ec9a38ed4e0cce498f0e8e81210d3e129b3b9f9d1fc72aaf1e6b926d38", + "file": "trace.json.sha256", + "mode": "byte_exact", + "pass": true, + "problems": [] + } + ], + "tolerance": 1e-09 +} diff --git a/implementation/algolab/experiments/protocol-241-final/reproduction-verification.json b/implementation/algolab/experiments/protocol-241-final/reproduction-verification.json new file mode 100644 index 0000000..1b0f6c2 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/reproduction-verification.json @@ -0,0 +1,107 @@ +{ + "extra_files": [], + "failures": [], + "files_checked": 10, + "original": "experiments/protocol-243-v1", + "original_verification": { + "extra_files": [], + "mismatches": [], + "n_files_verified": 10, + "promotion_verdicts": { + "evolved": "PROMOTED", + "fixed-baseline": "REJECTED_PROSPECTIVE" + }, + "replay_only_promotion_detected": false, + "schema_version": "meta-pilot/1.0", + "trace_integrity": true, + "verified": true + }, + "pass": true, + "reproduction": "/tmp/opencode/repro-243", + "reproduction_verification": { + "extra_files": [], + "mismatches": [], + "n_files_verified": 10, + "promotion_verdicts": { + "evolved": "PROMOTED", + "fixed-baseline": "REJECTED_PROSPECTIVE" + }, + "replay_only_promotion_detected": false, + "schema_version": "meta-pilot/1.0", + "trace_integrity": true, + "verified": true + }, + "results": [ + { + "expected_sha256": "7a039b9fd4c377be49acb3229d6ffea4cd876edc0af95b28259bb7f51f05339c", + "file": "evaluations/evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "f3909d548195384701e24f090bd109c20acdd47165d87c455a37ff77ccafa66b", + "file": "evaluations/fixed-baseline.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "bd8e23fe2a84de26e4d4f7639ac03bf1ee82aec51c1cb648b77e49c026cd9f1e", + "file": "manifest.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "47160d1ab5cb9c251edb43eaca1603c74b1bdbc890119551757affa237a43405", + "file": "promotions/evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "44cc04d8d4e66132c2b6e8d366e2ba9241cfc9ae9df8f2ab8a15a479abc5254c", + "file": "promotions/fixed-baseline.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "f96efbaa18885348d8fcb19581260ead786f4c76e005e0450034df8500f41606", + "file": "replay/evolved.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "f4f3863c2a11a08dfc5853f187a2afae77973ccea6005eb583cb4142423cafb6", + "file": "replay/fixed-baseline.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "f3281dcc911b1c236a486d31f2a71d1cfe1f7586108bc286dae07782b213d676", + "file": "report.md", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "0285b23ae1e76095bf50e41ed3d69fd172860e0c556535850a064fd419f88af9", + "file": "trace.json", + "mode": "byte_exact", + "pass": true, + "problems": [] + }, + { + "expected_sha256": "a6b5d77b0074c0e2d536019aaf40201fa5adcb6aa9402616f734d7d414b85e2d", + "file": "trace.json.sha256", + "mode": "byte_exact", + "pass": true, + "problems": [] + } + ], + "tolerance": 1e-09 +} diff --git a/implementation/algolab/experiments/protocol-241-final/results_manifest.json b/implementation/algolab/experiments/protocol-241-final/results_manifest.json new file mode 100644 index 0000000..bf85f24 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/results_manifest.json @@ -0,0 +1,281 @@ +{ + "branch": "integration/dream-rsi-meta-search", + "checks": { + "meta_verification": { + "protocol_243": "verified=true, 10 files, trace_integrity=true, no replay-only promotion", + "protocol_244": "verified=true, 16 files, trace_integrity=true, no replay-only promotion" + }, + "mypy": { + "command": ".venv/bin/python -m mypy", + "output": "implementation/algolab/experiments/protocol-241-final/mypy.txt", + "result": "Success: no issues found in 59 source files" + }, + "pytest": { + "command": ".venv/bin/python -m pytest -q --durations=15", + "complete_output": "implementation/algolab/experiments/protocol-241-final/test-results.txt", + "failed": 0, + "passed": 474 + }, + "ruff": { + "command": ".venv/bin/python -m ruff check src tests scripts", + "output": "implementation/algolab/experiments/protocol-241-final/ruff.txt", + "result": "All checks passed!" + } + }, + "evidence_files": { + "compute_correction": "implementation/algolab/experiments/protocol-241-final/compute-accounting-correction.json", + "final_report": "implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md", + "protocol_243_reproduction": "implementation/algolab/experiments/protocol-241-final/reproduction-verification.json", + "protocol_244_reproduction": "implementation/algolab/experiments/protocol-241-final/protocol-244-reproduction-verification.json" + }, + "final_position": "Toy-substrate meta-search capability demonstrated; real-workload transfer and autonomy expansion not demonstrated.", + "generated": "2026-11-22", + "historical_bundles": { + "protocol_241_diagnostic": { + "checksums_file_sha256": "4aaa44c77c4cdfc37ffd61456420e4ab9234c9b15146b5e8bca1ce72ed4d195e", + "n_sealed_files": 16, + "path": "implementation/algolab/experiments/protocol-241-v1-diagnostic", + "status": "post-hoc exploratory diagnostic; all arms REJECTED_PROSPECTIVE" + }, + "protocol_241_pilot": { + "checksums_file_sha256": "4626410a0519b6d6d32343222a6ca99c427d8b083bf4aa60a455b348a7f01f1b", + "n_sealed_files": 16, + "path": "implementation/algolab/experiments/protocol-241-v1", + "status": "negative pilot; all arms REJECTED_PROSPECTIVE" + }, + "protocol_242_screen": { + "checksums_file_sha256": "ac9914d46aa6f566a1e4c2ffd16964a7149d6bed90d7a60e2c112b71fcc1e000", + "n_sealed_files": 16, + "path": "implementation/algolab/experiments/protocol-242-v1", + "status": "positive raw effects, BH q=0.0907; no promotion" + }, + "protocol_243_confirmatory": { + "checksums_file_sha256": "fe3b3ddd1e0df3b8c7ab85053c28419f255c26e6f3d198e9fddfc7e5e187d586", + "held_out_delta": 0.021296, + "n_sealed_files": 10, + "p_value": 0.0005, + "path": "implementation/algolab/experiments/protocol-243-v1", + "primary_ci_high": 0.027454, + "primary_ci_low": 0.010324, + "primary_delta": 0.01872, + "q_value": 0.0005, + "status": "PROMOTED within toy substrate only" + } + }, + "historical_bundles_preserved": true, + "limitations": [ + "Protocol 244 sample size is modest (8 trials per family per stage); no transfer effect was established under the preregistered gate.", + "Protocol 244 workloads are offline sklearn benchmarks, not a production search environment.", + "Replay traces are diagnostic; off-policy branches have no outcomes.", + "Protocol 243 promotion is toy-substrate only and does not grant deployment or autonomy.", + "Protocol 244 bundle planning upper bounds were overcounted; correction is reported without rewriting the sealed bundle." + ], + "preregistrations": [ + "spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md", + "spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md", + "spec/research/243_META_SEARCH_CONFIRMATORY.md", + "spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md" + ], + "review_correction": { + "artifact": "experiments/protocol-241-final/checksums.json", + "before": "nested {bytes, sha256} objects", + "after": "flat filename -> sha256 map", + "research_content_changed": false, + "note": "Corrected before merge to satisfy tests/test_artifact_integrity.py; all checks re-run afterward." + }, + "protocol_244": { + "checksums_file_sha256": "b97d66243aba8862deb49a2fc3bb5dcd7e1c157e147daa1f4924ea4a040b46b4", + "command": ".venv/bin/python -m algolab.cli.main meta-transfer-run --dir experiments/protocol-244-v1 --protocol-id protocol-244 --workloads transform,hpo --trials 8 --episodes 8 --budget 40 --seed-base 924211 --confirmation-seed-base 351773 --bootstrap-iterations 2000 --apply-bh --force", + "compute_accounting": { + "bundle_modified": false, + "corrected": { + "nominal_credits_upper_bound": 3840.0, + "planned_upper_bound_attempts": 768 + }, + "decision_relevant": false, + "recorded_in_bundle": { + "nominal_credits_upper_bound": 7680.0, + "planned_upper_bound_attempts": 1536 + }, + "report": "implementation/algolab/experiments/protocol-241-final/compute-accounting-correction.json" + }, + "n_sealed_files": 16, + "parameters": { + "alpha": 0.05, + "arms": [ + "fixed-baseline", + "evolved" + ], + "bootstrap_iterations": 2000, + "budget": 40.0, + "confirmation_seed_base": 351773, + "episodes": 8, + "multiple_comparison_correction": "benjamini-hochberg across two workload p-values", + "replay_seed": 17, + "seed_base": 924211, + "trace_seed": 77100, + "trials": 8, + "workloads": [ + "transform", + "hpo" + ] + }, + "path": "implementation/algolab/experiments/protocol-244-v1", + "preregistration_date": "2026-11-22", + "preregistration_written_before_execution": true, + "reproduction": { + "diff_rq": "IDENTICAL_TREES", + "method": "fresh process with copied source tree, fresh output directory", + "original": "implementation/algolab/experiments/protocol-244-v1", + "reproduction": "/tmp/opencode/repro-244", + "verification": "pass=True, 16 files, no failures, no extra files" + }, + "results": [ + { + "arm": "evolved", + "held_out_delta": 0.0, + "primary_ci_high": 0.011069307501585654, + "primary_ci_low": -0.003174603174603174, + "primary_delta": 0.0040446536684211835, + "promotion": "REJECTED_PROSPECTIVE", + "q_value": 0.5052473763118441, + "raw_p": 0.40929535232383807, + "rejection_reasons": [ + "prospective primary metric did not significantly beat baseline", + "prospective secondary metric shows significant degradation" + ], + "secondary_ci_low": -0.0032565114784886447, + "workload": "transform" + }, + { + "arm": "evolved", + "held_out_delta": 0.0125, + "primary_ci_high": 0.00625, + "primary_ci_low": 0.0, + "primary_delta": 0.0025, + "promotion": "REJECTED_PROSPECTIVE", + "q_value": 0.5052473763118441, + "raw_p": 0.5052473763118441, + "rejection_reasons": [ + "prospective primary metric did not significantly beat baseline" + ], + "secondary_ci_low": 0.0, + "workload": "hpo" + } + ], + "stage_a": { + "decision_quality_agreement": 0.5, + "is_prospective_evidence": false, + "promotion_status": "REJECTED_PROSPECTIVE" + }, + "verification": { + "extra_files": [], + "mismatches": [], + "n_files_verified": 16, + "replay_only_promotion_detected": false, + "trace_integrity": true, + "verified": true + }, + "verification_command": ".venv/bin/python -m algolab.cli.main meta-verify --dir experiments/protocol-244-v1 --json" + }, + "repository_root": ".", + "retrospective_changes_to_hypotheses_thresholds_evaluators_promotions_or_bundles": false, + "schema_version": "protocol-241-final/results-manifest/1.0", + "source_state": "single PR commit after review correction", + "verdicts_a_j": [ + { + "claim": "DREAM-RSI audit is source-grounded and attribution is recorded", + "evidence": [ + "docs/research/DREAM_RSI_INTEGRATION_AUDIT.md", + "docs/research/DREAM_RSI_INTEGRATION_REPORT.md", + "implementation/algolab/THIRD_PARTY_NOTICES.md" + ], + "id": "A", + "verdict": "DEMONSTRATED" + }, + { + "claim": "No incompatible source copy, new runtime dependency, paid API, GPU, or second event/artifact store", + "evidence": [ + "spec/architecture/100_SYSTEM_ARCHITECTURE.md", + "docs/api/README.md", + "implementation/algolab/pyproject.toml" + ], + "id": "B", + "verdict": "DEMONSTRATED" + }, + { + "claim": "Frozen content-addressed traces and read-only replay with counterfactual uncertainty", + "evidence": [ + "implementation/algolab/src/algolab/meta_search/traces.py", + "implementation/algolab/src/algolab/meta_search/replay.py", + "implementation/algolab/tests/test_meta_search.py" + ], + "id": "C", + "verdict": "DEMONSTRATED" + }, + { + "claim": "Versioned frozen policies and structured proposals without agent-rewritten source", + "evidence": [ + "implementation/algolab/src/algolab/meta_search/policies.py", + "implementation/algolab/tests/test_meta_search.py" + ], + "id": "D", + "verdict": "DEMONSTRATED" + }, + { + "claim": "Fail-closed promotion: replay-only, incomplete, degraded, and q-failed evidence reject", + "evidence": [ + "implementation/algolab/src/algolab/meta_search/evaluation.py", + "implementation/algolab/tests/test_meta_search.py", + "experiments/protocol-242-v1" + ], + "id": "E", + "verdict": "DEMONSTRATED" + }, + { + "claim": "Protocol 241 pilot found no preregistered improvement; diagnostic also negative", + "evidence": [ + "experiments/protocol-241-v1", + "experiments/protocol-241-v1-diagnostic" + ], + "id": "F", + "verdict": "DEMONSTRATED" + }, + { + "claim": "Protocol 242 corrected screen supports direction but fails BH-FDR", + "evidence": [ + "experiments/protocol-242-v1", + "spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md" + ], + "id": "G", + "verdict": "PARTIALLY DEMONSTRATED" + }, + { + "claim": "Protocol 243 promotes evolved policy within toy substrate", + "evidence": [ + "experiments/protocol-243-v1", + "spec/research/243_META_SEARCH_CONFIRMATORY.md" + ], + "id": "H", + "verdict": "DEMONSTRATED" + }, + { + "claim": "Sealed bundles independently verify and reproduce byte-for-byte; replay never promotes", + "evidence": [ + "experiments/protocol-241-final/reproduction-verification.json", + "experiments/protocol-241-final/protocol-244-reproduction-verification.json" + ], + "id": "I", + "verdict": "DEMONSTRATED" + }, + { + "claim": "Promoted toy policy transfers to real transform/hpo workloads", + "evidence": [ + "experiments/protocol-244-v1", + "spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md" + ], + "id": "J", + "verdict": "NOT DEMONSTRATED" + } + ] +} diff --git a/implementation/algolab/experiments/protocol-241-final/ruff.txt b/implementation/algolab/experiments/protocol-241-final/ruff.txt new file mode 100644 index 0000000..1f5f344 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/ruff.txt @@ -0,0 +1 @@ +All checks passed! diff --git a/implementation/algolab/experiments/protocol-241-final/test-results.txt b/implementation/algolab/experiments/protocol-241-final/test-results.txt new file mode 100644 index 0000000..60a2c41 --- /dev/null +++ b/implementation/algolab/experiments/protocol-241-final/test-results.txt @@ -0,0 +1,56 @@ +........................................................................ [ 15%] +........................................................................ [ 30%] +........................................................................ [ 45%] +........................................................................ [ 60%] +........................................................................ [ 75%] +........................................................................ [ 91%] +.......................................... [100%] +=============================== warnings summary =============================== +tests/test_cli_execution.py::test_cli_error_handling + /home/illy/AlgoLaB/implementation/algolab/.venv/lib/python3.14/site-packages/pydantic/main.py:475: UserWarning: Pydantic serializer warnings: + PydanticSerializationUnexpectedValue(Expected `str` - serialized value may not be as expected [field_name='statement', input_value=42, input_type=int]) + return self.__pydantic_serializer__.to_python( + +tests/test_protocol_235.py::TestHpoWorkload::test_gamma_isolated_from_training_families +tests/test_protocol_239.py::TestTransformWorkload::test_gamma_isolated +tests/test_protocol_240.py::TestComposeWorkload::test_gamma_is_a_different_dataset +tests/test_provenance_and_s2.py::TestS2Substrate::test_resolves_and_metadata_lists_all_families + /home/illy/AlgoLaB/implementation/algolab/.venv/lib/python3.14/site-packages/sklearn/datasets/_base.py:1007: DeprecationWarning: Setting the shape on a NumPy array has been deprecated in NumPy 2.5. + As an alternative, you can create a new view using np.reshape (with copy=False if needed). + images.shape = (-1, 8, 8) + +tests/test_search.py::test_cli_search_run_s2_workload_is_reachable + /home/illy/AlgoLaB/implementation/algolab/.venv/lib/python3.14/site-packages/sklearn/utils/parallel.py:161: ResourceWarning: unclosed database in + for k, v in zip(warning_filter_keys, filter_args) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_search.py::test_cli_search_run_s2_workload_is_reachable + /home/illy/AlgoLaB/implementation/algolab/.venv/lib/python3.14/site-packages/sklearn/utils/parallel.py:161: ResourceWarning: unclosed database in + for k, v in zip(warning_filter_keys, filter_args) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_search.py::test_cli_search_run_s2_workload_is_reachable + /home/illy/AlgoLaB/implementation/algolab/.venv/lib/python3.14/site-packages/sklearn/utils/parallel.py:161: ResourceWarning: unclosed database in + for k, v in zip(warning_filter_keys, filter_args) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html +============================= slowest 15 durations ============================= +519.64s call tests/test_protocol_240.py::TestCommittedBundleReproduces::test_committed_bundle_reproduces_in_a_clean_process +71.25s call tests/test_protocol_239.py::TestProtocol239ComplianceSmoke::test_tiny_run_produces_bundle +70.31s call tests/test_protocol_240.py::TestProtocol240Bundle::test_report_is_byte_stable_across_runs +39.37s call tests/test_search.py::test_cli_search_run_s2_workload_is_reachable +35.53s call tests/test_protocol_240.py::TestProtocol240Bundle::test_report_contains_the_pre_registered_hypotheses +34.52s call tests/test_protocol_240.py::TestProtocol240Bundle::test_smoke_run_seals_a_verifiable_bundle +19.24s call tests/test_protocol_235.py::TestHpoEndToEnd::test_tiny_hpo_run_produces_artifacts +16.53s call tests/test_protocol_238.py::TestProtocolComplianceSmoke::test_tiny_run_produces_qd_bundle +9.49s call tests/test_cli_execution.py::test_worker_is_deterministic_across_cli_invocations +8.47s call tests/test_rules_library.py::TestHpoEndToEnd::test_tiny_hpo_run_produces_artifacts +6.18s call tests/test_cli_execution.py::test_full_cli_workflow +6.11s call tests/test_artifact_integrity.py::test_every_recorded_digest_matches_the_artifact_bytes +5.28s call tests/test_lifecycle.py::test_full_lifecycle_all_success +4.82s call tests/test_lifecycle.py::test_cancelled_run_releases_reservation +4.10s call tests/test_determinism.py::test_deterministic_outcomes_across_clean_projects diff --git a/implementation/algolab/experiments/protocol-244-v1/checksums.json b/implementation/algolab/experiments/protocol-244-v1/checksums.json new file mode 100644 index 0000000..3d46718 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/checksums.json @@ -0,0 +1 @@ +{"environment-hpo.json":"9c077c1aa2b9bd22a02a8082b0d26a33119500854571183e2991c197e71af336","environment-transform.json":"fe1f6a98b55d29952938e21f407ace86b3a1e2e62d1ed2f52922a814a8766609","evaluations/hpo-evolved.json":"f8c5b8f9a949c152db4833099ccf1146abdd7a000dbf5b7f9ce4bbb0d3cd742b","evaluations/hpo-fixed-baseline.json":"e4e52f69ddf3b6bc40c684ce0feb4f71cb88ff06ca3c5f91369dfcc344a9538b","evaluations/transform-evolved.json":"453d524061afc881cba98464779aeef009f18e1925fd99ba1618d799a7ef00ca","evaluations/transform-fixed-baseline.json":"1a10f43545e483380b76e8e622c4bb040825e04e759b26488f59589d59f49b61","manifest.json":"507c4cd97522ec761db4818ebf9597a035babcde4876c1418a354896a5c436e3","promotions/hpo-evolved.json":"b9b6540c2fb8608a784ecc8cba0ee5151583ed6cce5f9ab3bab5f8363ebdd427","promotions/transform-evolved.json":"ce97901b0626160978ffedafcf5e8a35aedd587771f57df5669fcf5c4948b366","replay/hpo-evolved.json":"ee30e06f3db0090ed40add535cc10d90ccf2fa0f467539feae49489b3172f335","replay/hpo-fixed-baseline.json":"b0702fe749f3235a1c574cea315ef0dc8fada17c0fe9c6da95bae9e5d3e2c51c","replay/transform-evolved.json":"ee30e06f3db0090ed40add535cc10d90ccf2fa0f467539feae49489b3172f335","replay/transform-fixed-baseline.json":"b0702fe749f3235a1c574cea315ef0dc8fada17c0fe9c6da95bae9e5d3e2c51c","report.md":"4fbdbfc6fb28075f7ca55d89ff56110a188fdd344af3eb1b1599bb4354fe4bab","trace.json":"836b785dbd8c43dfaf59887d93aee6d0c60ea5d02cdce171d79bc3374dc19955","trace.json.sha256":"154e38ec9a38ed4e0cce498f0e8e81210d3e129b3b9f9d1fc72aaf1e6b926d38"} diff --git a/implementation/algolab/experiments/protocol-244-v1/environment-hpo.json b/implementation/algolab/experiments/protocol-244-v1/environment-hpo.json new file mode 100644 index 0000000..4cb012b --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/environment-hpo.json @@ -0,0 +1 @@ +{"discovery_gate_version":"1.0.0","environment_version":"1.1.0","families":["alpha","beta","gamma"],"ground_truth":null,"held_out_family":"gamma","operators":["k1","k3","k11","k21","dist-weight","manhattan","chebyshev"],"promotion_threshold":0.005,"task_suite_version":"1.1.0","workload_metadata":{"base_estimator":"StandardScaler->KNeighborsClassifier","baseline_params":{"n_neighbors":5},"dataset_shapes":{"alpha":{"n_classes":2,"n_features":30,"n_rows":569},"beta":{"n_classes":3,"n_features":13,"n_rows":178},"gamma":{"n_classes":10,"n_features":64,"n_rows":900}},"discovery_margin_absolute":0.005,"name":"hpo","nominal_costs_flat":true,"numpy_version":"2.5.2","python_version":"3.14.4","sklearn_version":"1.9.0"}} diff --git a/implementation/algolab/experiments/protocol-244-v1/environment-transform.json b/implementation/algolab/experiments/protocol-244-v1/environment-transform.json new file mode 100644 index 0000000..42761e2 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/environment-transform.json @@ -0,0 +1 @@ +{"discovery_gate_version":"1.0.0","environment_version":"1.0.0","families":["alpha","beta","gamma"],"ground_truth":null,"held_out_family":"gamma","operator_costs":{"clip-1_99":6.0,"interaction+robust":15.0,"interaction-top2":10.0,"log1p":5.0,"pca-10":14.0,"poly2+log1p":18.0,"poly2-all":15.0,"poly2-top5":12.0,"power-yeo-johnson":12.0,"quantile-bin-3":8.0,"quantile-bin-5":10.0,"robust-scale":8.0,"sqrt":5.0,"standard-scale":8.0},"operators":["log1p","sqrt","clip-1_99","robust-scale","standard-scale","quantile-bin-3","interaction-top2","quantile-bin-5","poly2-top5","power-yeo-johnson","pca-10","poly2-all","interaction+robust","poly2+log1p"],"promotion_threshold":0.005,"task_suite_version":"1.0.0","workload_metadata":{"base_estimator":"StandardScaler->LogisticRegression","baseline_params":{"max_iter":1000},"dataset_shapes":{"alpha":{"n_classes":2,"n_features":30,"n_rows":569},"beta":{"n_classes":3,"n_features":13,"n_rows":178},"gamma":{"n_classes":10,"n_features":64,"n_rows":900}},"discovery_margin_absolute":0.005,"name":"transform","nominal_costs_flat":false,"numpy_version":"2.5.2","python_version":"3.14.4","sklearn_version":"1.9.0"}} diff --git a/implementation/algolab/experiments/protocol-244-v1/evaluations/hpo-evolved.json b/implementation/algolab/experiments/protocol-244-v1/evaluations/hpo-evolved.json new file mode 100644 index 0000000..445be63 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/evaluations/hpo-evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-transfer/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.5,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":2,"n_counterfactual_uncertain":0,"n_decisions":2,"n_observed":2,"replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":15.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0025,"ci_high":0.00625,"ci_low":0.0,"delta":0.0025,"effect_size":0.5175491695067657,"p_adjusted":0.5052473763118441,"p_value":0.5052473763118441},"secondary":{"ci_high":0.00625,"ci_low":0.0,"delta":0.0025,"p_value":0.504247876061969},"seed_base":924211,"stage":"B_prospective","trials_per_family":8,"workload":"hpo"},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0125,"ci_high":0.025,"ci_low":0.0,"delta":0.0125,"effect_size":0.9648062312349498,"p_value":0.2318840579710145},"secondary":{"ci_high":0.0225,"ci_low":0.0025,"delta":0.01,"p_value":0.2478760619690155},"seed_base":351773,"stage":"C_independent_confirmation","trials_per_family":8,"workload":"hpo"},"workload":"hpo","workload_version":"1.1.0"} diff --git a/implementation/algolab/experiments/protocol-244-v1/evaluations/hpo-fixed-baseline.json b/implementation/algolab/experiments/protocol-244-v1/evaluations/hpo-fixed-baseline.json new file mode 100644 index 0000000..ddf1c1d --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/evaluations/hpo-fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-transfer/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.5,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":2,"n_counterfactual_uncertain":0,"n_decisions":2,"n_observed":2,"replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":16.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":924211,"stage":"B_prospective","trials_per_family":8,"workload":"hpo"},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":351773,"stage":"C_independent_confirmation","trials_per_family":8,"workload":"hpo"},"workload":"hpo","workload_version":"1.1.0"} diff --git a/implementation/algolab/experiments/protocol-244-v1/evaluations/transform-evolved.json b/implementation/algolab/experiments/protocol-244-v1/evaluations/transform-evolved.json new file mode 100644 index 0000000..a4787ab --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/evaluations/transform-evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-transfer/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.5,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":2,"n_counterfactual_uncertain":0,"n_decisions":2,"n_observed":2,"replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":15.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.002976190476190476,"candidate_mean":0.0070208441446116595,"ci_high":0.011069307501585654,"ci_low":-0.003174603174603174,"delta":0.0040446536684211835,"effect_size":0.4238050595874385,"p_adjusted":0.5052473763118441,"p_value":0.40929535232383807},"secondary":{"ci_high":0.011223805817085528,"ci_low":-0.0032565114784886447,"delta":0.0040446536684211835,"p_value":0.43478260869565216},"seed_base":924211,"stage":"B_prospective","trials_per_family":8,"workload":"transform"},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":351773,"stage":"C_independent_confirmation","trials_per_family":8,"workload":"transform"},"workload":"transform","workload_version":"1.0.0"} diff --git a/implementation/algolab/experiments/protocol-244-v1/evaluations/transform-fixed-baseline.json b/implementation/algolab/experiments/protocol-244-v1/evaluations/transform-fixed-baseline.json new file mode 100644 index 0000000..665f870 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/evaluations/transform-fixed-baseline.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-fixed-baseline","preregistered":true,"schema_version":"meta-transfer/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.5,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":2,"n_counterfactual_uncertain":0,"n_decisions":2,"n_observed":2,"replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":16.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.002976190476190476,"candidate_mean":0.002976190476190476,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":924211,"stage":"B_prospective","trials_per_family":8,"workload":"transform"},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":351773,"stage":"C_independent_confirmation","trials_per_family":8,"workload":"transform"},"workload":"transform","workload_version":"1.0.0"} diff --git a/implementation/algolab/experiments/protocol-244-v1/manifest.json b/implementation/algolab/experiments/protocol-244-v1/manifest.json new file mode 100644 index 0000000..bfb1a20 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/manifest.json @@ -0,0 +1 @@ +{"arms":["fixed-baseline","evolved"],"bootstrap_iterations":2000,"budget":40.0,"compute":{"nominal_credits_upper_bound":7680.0,"planned_upper_bound_attempts":1536,"timing_is_decision_relevant":false},"confirmation_seed_base":351773,"episodes":8,"multiple_comparison_correction":"benjamini-hochberg","preregistration":"spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md","promotion_gate":"unchanged from protocol 243; replay diagnostic only; B requires positive CI and q<0.05; C requires held-out delta>=0 and CI>=-0.001","protocol":"protocol-244","protocol_version":"1.0.0","schema_version":"meta-transfer/1.0","seed_base":924211,"substrates":["algolab.search.workload_transform","algolab.search.workload_hpo"],"trace_is_prospective_evidence":false,"trace_kind":"real_workload_frozen_trace","trials":8,"workloads":[{"held_out":"gamma","name":"transform","version":"1.0.0"},{"held_out":"gamma","name":"hpo","version":"1.1.0"}]} diff --git a/implementation/algolab/experiments/protocol-244-v1/promotions/hpo-evolved.json b/implementation/algolab/experiments/protocol-244-v1/promotions/hpo-evolved.json new file mode 100644 index 0000000..861ac83 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/promotions/hpo-evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-transfer/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.5,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":2,"n_counterfactual_uncertain":0,"n_decisions":2,"n_observed":2,"replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":15.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0025,"ci_high":0.00625,"ci_low":0.0,"delta":0.0025,"effect_size":0.5175491695067657,"p_adjusted":0.5052473763118441,"p_value":0.5052473763118441},"secondary":{"ci_high":0.00625,"ci_low":0.0,"delta":0.0025,"p_value":0.504247876061969},"seed_base":924211,"stage":"B_prospective","trials_per_family":8,"workload":"hpo"},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0125,"ci_high":0.025,"ci_low":0.0,"delta":0.0125,"effect_size":0.9648062312349498,"p_value":0.2318840579710145},"secondary":{"ci_high":0.0225,"ci_low":0.0025,"delta":0.01,"p_value":0.2478760619690155},"seed_base":351773,"stage":"C_independent_confirmation","trials_per_family":8,"workload":"hpo"},"workload":"hpo","workload_version":"1.1.0"},"promotion_checksum":"4ea00bb891c1ad1d04b7820c181d02316cb9fd7b32d34d961a16c8480f7227ef","reasons":["prospective primary metric did not significantly beat baseline (delta=0.0025, ci_low=0, p=0.505247)"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-244-v1/promotions/transform-evolved.json b/implementation/algolab/experiments/protocol-244-v1/promotions/transform-evolved.json new file mode 100644 index 0000000..eb9bf96 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/promotions/transform-evolved.json @@ -0,0 +1 @@ +{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","evidence":{"baseline_policy_id":"pol-fixed-baseline","candidate_policy_id":"pol-evolved","preregistered":true,"schema_version":"meta-transfer/1.0","stage_a":{"candidate_diversity":2,"coverage":0.25,"decision_quality_agreement":0.5,"failure_patterns":[],"is_prospective_evidence":false,"n_agreement_applicable":2,"n_counterfactual_uncertain":0,"n_decisions":2,"n_observed":2,"replay_limitations":["no outcome labels for unexplored branches","cannot measure what would have happened off the recorded tree","decision agreement is not a causal performance estimate"],"search_efficiency_credits":15.0,"stage":"A_historical_replay"},"stage_b":{"budget":40.0,"episodes":8,"families":["alpha","beta"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.002976190476190476,"candidate_mean":0.0070208441446116595,"ci_high":0.011069307501585654,"ci_low":-0.003174603174603174,"delta":0.0040446536684211835,"effect_size":0.4238050595874385,"p_adjusted":0.5052473763118441,"p_value":0.40929535232383807},"secondary":{"ci_high":0.011223805817085528,"ci_low":-0.0032565114784886447,"delta":0.0040446536684211835,"p_value":0.43478260869565216},"seed_base":924211,"stage":"B_prospective","trials_per_family":8,"workload":"transform"},"stage_c":{"budget":40.0,"episodes":8,"families":["gamma"],"is_prospective_evidence":true,"primary":{"baseline_mean":0.0,"candidate_mean":0.0,"ci_high":0.0,"ci_low":0.0,"delta":0.0,"effect_size":0.0,"p_value":1.0},"secondary":{"ci_high":0.0,"ci_low":0.0,"delta":0.0,"p_value":1.0},"seed_base":351773,"stage":"C_independent_confirmation","trials_per_family":8,"workload":"transform"},"workload":"transform","workload_version":"1.0.0"},"promotion_checksum":"ef58e04d7e420cfcd4c61a6380732d847bf55799b5a1d3debebcf9e376448d75","reasons":["prospective primary metric did not significantly beat baseline (delta=0.00404465, ci_low=-0.0031746, p=0.505247)","prospective secondary metric shows significant degradation"],"schema_version":"meta-eval/1.0","status":"REJECTED_PROSPECTIVE"} diff --git a/implementation/algolab/experiments/protocol-244-v1/replay/hpo-evolved.json b/implementation/algolab/experiments/protocol-244-v1/replay/hpo-evolved.json new file mode 100644 index 0000000..8383bc4 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/replay/hpo-evolved.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["log1p","sqrt","clip-1_99"],"chosen_method":"log1p","depth":0,"estimated_outcome":null,"historically_chosen_method":"log1p","matches_historical":true,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":5.0,"discovery":false},"mean_effect":0.000862,"valid":true},"outcome_kind":"observed","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_d5e0965fe5ec365c800a","uncertain":false,"uncertainty_reason":""},{"agreement_applicable":true,"available_methods":["k1","k3","k11"],"chosen_method":"k3","depth":0,"estimated_outcome":null,"historically_chosen_method":"k1","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":10.0,"discovery":false},"mean_effect":-0.000877,"valid":true},"outcome_kind":"observed","rationale":"score=0.1000 (prefix observations only)","state_node_id":"trn_89744d20946e85959bf4","uncertain":false,"uncertainty_reason":""}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":0,"observed":2},"policy_id":"pol-evolved","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.5,"n_agreement_applicable":2,"n_decisions":2,"n_observed":2,"n_uncertain":0},"trace_id":"trace-transfer-244"} diff --git a/implementation/algolab/experiments/protocol-244-v1/replay/hpo-fixed-baseline.json b/implementation/algolab/experiments/protocol-244-v1/replay/hpo-fixed-baseline.json new file mode 100644 index 0000000..ea338c0 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/replay/hpo-fixed-baseline.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["log1p","sqrt","clip-1_99"],"chosen_method":"clip-1_99","depth":0,"estimated_outcome":null,"historically_chosen_method":"log1p","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":6.0,"discovery":false},"mean_effect":0.007033,"valid":true},"outcome_kind":"observed","rationale":"fixed priority order (no learning)","state_node_id":"trn_d5e0965fe5ec365c800a","uncertain":false,"uncertainty_reason":""},{"agreement_applicable":true,"available_methods":["k1","k3","k11"],"chosen_method":"k1","depth":0,"estimated_outcome":null,"historically_chosen_method":"k1","matches_historical":true,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":10.0,"discovery":false},"mean_effect":-0.018437,"valid":true},"outcome_kind":"observed","rationale":"fixed priority order (no learning)","state_node_id":"trn_89744d20946e85959bf4","uncertain":false,"uncertainty_reason":""}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":0,"observed":2},"policy_id":"pol-fixed-baseline","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.5,"n_agreement_applicable":2,"n_decisions":2,"n_observed":2,"n_uncertain":0},"trace_id":"trace-transfer-244"} diff --git a/implementation/algolab/experiments/protocol-244-v1/replay/transform-evolved.json b/implementation/algolab/experiments/protocol-244-v1/replay/transform-evolved.json new file mode 100644 index 0000000..8383bc4 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/replay/transform-evolved.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["log1p","sqrt","clip-1_99"],"chosen_method":"log1p","depth":0,"estimated_outcome":null,"historically_chosen_method":"log1p","matches_historical":true,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":5.0,"discovery":false},"mean_effect":0.000862,"valid":true},"outcome_kind":"observed","rationale":"score=0.2000 (prefix observations only)","state_node_id":"trn_d5e0965fe5ec365c800a","uncertain":false,"uncertainty_reason":""},{"agreement_applicable":true,"available_methods":["k1","k3","k11"],"chosen_method":"k3","depth":0,"estimated_outcome":null,"historically_chosen_method":"k1","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":10.0,"discovery":false},"mean_effect":-0.000877,"valid":true},"outcome_kind":"observed","rationale":"score=0.1000 (prefix observations only)","state_node_id":"trn_89744d20946e85959bf4","uncertain":false,"uncertainty_reason":""}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":0,"observed":2},"policy_id":"pol-evolved","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.5,"n_agreement_applicable":2,"n_decisions":2,"n_observed":2,"n_uncertain":0},"trace_id":"trace-transfer-244"} diff --git a/implementation/algolab/experiments/protocol-244-v1/replay/transform-fixed-baseline.json b/implementation/algolab/experiments/protocol-244-v1/replay/transform-fixed-baseline.json new file mode 100644 index 0000000..ea338c0 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/replay/transform-fixed-baseline.json @@ -0,0 +1 @@ +{"decisions":[{"agreement_applicable":true,"available_methods":["log1p","sqrt","clip-1_99"],"chosen_method":"clip-1_99","depth":0,"estimated_outcome":null,"historically_chosen_method":"log1p","matches_historical":false,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":6.0,"discovery":false},"mean_effect":0.007033,"valid":true},"outcome_kind":"observed","rationale":"fixed priority order (no learning)","state_node_id":"trn_d5e0965fe5ec365c800a","uncertain":false,"uncertainty_reason":""},{"agreement_applicable":true,"available_methods":["k1","k3","k11"],"chosen_method":"k1","depth":0,"estimated_outcome":null,"historically_chosen_method":"k1","matches_historical":true,"observed_outcome":{"discovery":false,"evaluation_result":{"cost_credits":10.0,"discovery":false},"mean_effect":-0.018437,"valid":true},"outcome_kind":"observed","rationale":"fixed priority order (no learning)","state_node_id":"trn_89744d20946e85959bf4","uncertain":false,"uncertainty_reason":""}],"evidence_class":"historical_replay","is_prospective_evidence":false,"limitations":["Replay evaluates decisions at recorded states only.","It cannot establish outcomes for branches never explored.","Counterfactual decisions carry no outcome label (uncertain=true).","Historical replay is not prospective evidence and cannot promote."],"observed_vs_counterfactual":{"counterfactual_uncertain":0,"observed":2},"policy_id":"pol-fixed-baseline","schema_version":"meta-replay/1.0","summary":{"agreement_with_history":0.5,"n_agreement_applicable":2,"n_decisions":2,"n_observed":2,"n_uncertain":0},"trace_id":"trace-transfer-244"} diff --git a/implementation/algolab/experiments/protocol-244-v1/report.md b/implementation/algolab/experiments/protocol-244-v1/report.md new file mode 100644 index 0000000..0b1f662 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/report.md @@ -0,0 +1,10 @@ +# protocol-244 — Real-workload policy transfer + +Status: **preregistered experiment** (spec committed before execution). Replay is diagnostic only; no policy is promoted on replay evidence. + +| Workload | Arm | Primary Δ/credit | 95% CI low | p | q (BH) | Held-out Δ | Promotion | +|---|---|---|---|---|---|---|---| +| transform | evolved | +0.004045 | -0.003175 | 0.4093 | 0.5052 | +0.000000 | REJECTED_PROSPECTIVE | +| hpo | evolved | +0.002500 | +0.000000 | 0.5052 | 0.5052 | +0.012500 | REJECTED_PROSPECTIVE | + +Primary outcome: validated discoveries per credit. Secondary: distinct useful methods per credit. Negative and inconclusive results are reported as measured; no threshold was changed after results were seen. diff --git a/implementation/algolab/experiments/protocol-244-v1/trace.json b/implementation/algolab/experiments/protocol-244-v1/trace.json new file mode 100644 index 0000000..eb924e6 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/trace.json @@ -0,0 +1 @@ +{"experiment_id":"EXP-META-244","nodes":[{"artifact_refs":[],"candidate_generation_method":"root-transform","candidate_id":"root-transform","checksum":"d5e0965fe5ec365c800ab491224b6d00c0b3253bba6d7d5a90f639f8ada2e9d1","compute_credits":0.0,"created_at_utc":"real-workload-frozen-trace","dataset_id":"transform","derived_metrics":{"mean_effect":0.0},"eval_split_id":"train","evaluation_result":{},"execution_provenance":{"source":"real_workload_attempts","workload":"transform"},"experiment_id":"EXP-META-244","hypotheses":[],"node_id":"trn_d5e0965fe5ec365c800a","observation":{"discovery":false,"valid":true},"parent_id":null,"policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"0000000000000000000000000000000000000000000000000000000000000000","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"historical_choice":"log1p","workload":"transform"},"seed":77100,"selection_decision":"seed transform root","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"log1p","candidate_id":"cand-transform-log1p","checksum":"70977912b30b2128018b106a4cc93e1a4b5022b5019b51a4bb68f25055c5a9d3","compute_credits":5.0,"created_at_utc":"real-workload-frozen-trace","dataset_id":"transform","derived_metrics":{"mean_effect":0.000862},"eval_split_id":"train","evaluation_result":{"cost_credits":5.0,"discovery":false},"execution_provenance":{"source":"real_workload_attempts","workload":"transform"},"experiment_id":"EXP-META-244","hypotheses":[],"node_id":"trn_70977912b30b2128018b","observation":{"discovery":false,"mean_effect":0.000862,"valid":true},"parent_id":"trn_d5e0965fe5ec365c800a","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"d5e0965fe5ec365c800ab491224b6d00c0b3253bba6d7d5a90f639f8ada2e9d1","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0,"workload":"transform"},"seed":77100,"selection_decision":"expand log1p","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"sqrt","candidate_id":"cand-transform-sqrt","checksum":"6709dd29d0e131fef3a4786b9c2ab86707f8c0bd1dd832b4c19b4e4a78beae0d","compute_credits":5.0,"created_at_utc":"real-workload-frozen-trace","dataset_id":"transform","derived_metrics":{"mean_effect":0.004401},"eval_split_id":"train","evaluation_result":{"cost_credits":5.0,"discovery":false},"execution_provenance":{"source":"real_workload_attempts","workload":"transform"},"experiment_id":"EXP-META-244","hypotheses":[],"node_id":"trn_6709dd29d0e131fef3a4","observation":{"discovery":false,"mean_effect":0.004401,"valid":true},"parent_id":"trn_d5e0965fe5ec365c800a","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"70977912b30b2128018b106a4cc93e1a4b5022b5019b51a4bb68f25055c5a9d3","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0,"workload":"transform"},"seed":77101,"selection_decision":"expand sqrt","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"clip-1_99","candidate_id":"cand-transform-clip-1_99","checksum":"f1775dc4ec491721504956a85cb2d2def94fdb57dfbcb67d95d0ef21665462a2","compute_credits":6.0,"created_at_utc":"real-workload-frozen-trace","dataset_id":"transform","derived_metrics":{"mean_effect":0.007033},"eval_split_id":"train","evaluation_result":{"cost_credits":6.0,"discovery":false},"execution_provenance":{"source":"real_workload_attempts","workload":"transform"},"experiment_id":"EXP-META-244","hypotheses":[],"node_id":"trn_f1775dc4ec4917215049","observation":{"discovery":false,"mean_effect":0.007033,"valid":true},"parent_id":"trn_d5e0965fe5ec365c800a","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"6709dd29d0e131fef3a4786b9c2ab86707f8c0bd1dd832b4c19b4e4a78beae0d","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0,"workload":"transform"},"seed":77102,"selection_decision":"expand clip-1_99","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"root-hpo","candidate_id":"root-hpo","checksum":"89744d20946e85959bf4eda234340093a23595f62f3234ff6713b7f282296218","compute_credits":0.0,"created_at_utc":"real-workload-frozen-trace","dataset_id":"hpo","derived_metrics":{"mean_effect":0.0},"eval_split_id":"train","evaluation_result":{},"execution_provenance":{"source":"real_workload_attempts","workload":"hpo"},"experiment_id":"EXP-META-244","hypotheses":[],"node_id":"trn_89744d20946e85959bf4","observation":{"discovery":false,"valid":true},"parent_id":null,"policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"f1775dc4ec491721504956a85cb2d2def94fdb57dfbcb67d95d0ef21665462a2","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"historical_choice":"k1","workload":"hpo"},"seed":77100,"selection_decision":"seed hpo root","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"k1","candidate_id":"cand-hpo-k1","checksum":"78eabae497539102848e7cb1e149171c0700a3f35b25b42edf194187f6eb0450","compute_credits":10.0,"created_at_utc":"real-workload-frozen-trace","dataset_id":"hpo","derived_metrics":{"mean_effect":-0.018437},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"source":"real_workload_attempts","workload":"hpo"},"experiment_id":"EXP-META-244","hypotheses":[],"node_id":"trn_78eabae497539102848e","observation":{"discovery":false,"mean_effect":-0.018437,"valid":true},"parent_id":"trn_89744d20946e85959bf4","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"89744d20946e85959bf4eda234340093a23595f62f3234ff6713b7f282296218","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0,"workload":"hpo"},"seed":77100,"selection_decision":"expand k1","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"k3","candidate_id":"cand-hpo-k3","checksum":"0f8a8ec9665409f1e9376a6f9a7dba899272c422e4873525e871e339e9df8d83","compute_credits":10.0,"created_at_utc":"real-workload-frozen-trace","dataset_id":"hpo","derived_metrics":{"mean_effect":-0.000877},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"source":"real_workload_attempts","workload":"hpo"},"experiment_id":"EXP-META-244","hypotheses":[],"node_id":"trn_0f8a8ec9665409f1e937","observation":{"discovery":false,"mean_effect":-0.000877,"valid":true},"parent_id":"trn_89744d20946e85959bf4","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"78eabae497539102848e7cb1e149171c0700a3f35b25b42edf194187f6eb0450","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0,"workload":"hpo"},"seed":77101,"selection_decision":"expand k3","statement_kind":"observation","stopping_decision":""},{"artifact_refs":[],"candidate_generation_method":"k11","candidate_id":"cand-hpo-k11","checksum":"d592024a906bbd76ad6b5534ba3fcfd22b88fbd31e7e3a64da6dfd1da1958eb9","compute_credits":10.0,"created_at_utc":"real-workload-frozen-trace","dataset_id":"hpo","derived_metrics":{"mean_effect":0.000893},"eval_split_id":"train","evaluation_result":{"cost_credits":10.0,"discovery":false},"execution_provenance":{"source":"real_workload_attempts","workload":"hpo"},"experiment_id":"EXP-META-244","hypotheses":[],"node_id":"trn_d592024a906bbd76ad6b","observation":{"discovery":false,"mean_effect":0.000893,"valid":true},"parent_id":"trn_89744d20946e85959bf4","policy_id":"pol-fixed-baseline","policy_version":"1","previous_checksum":"0f8a8ec9665409f1e9376a6f9a7dba899272c422e4873525e871e339e9df8d83","refinement_decision":"","rejection_reasons":[],"schema_version":"meta-trace/1.0","search_parameters":{"family":"alpha","trial":0,"workload":"hpo"},"seed":77102,"selection_decision":"expand k11","statement_kind":"observation","stopping_decision":""}],"schema_version":"meta-trace/1.0","trace_id":"trace-transfer-244"} \ No newline at end of file diff --git a/implementation/algolab/experiments/protocol-244-v1/trace.json.sha256 b/implementation/algolab/experiments/protocol-244-v1/trace.json.sha256 new file mode 100644 index 0000000..d1e0072 --- /dev/null +++ b/implementation/algolab/experiments/protocol-244-v1/trace.json.sha256 @@ -0,0 +1 @@ +836b785dbd8c43dfaf59887d93aee6d0c60ea5d02cdce171d79bc3374dc19955 diff --git a/implementation/algolab/scripts/verify_meta_reproduction.py b/implementation/algolab/scripts/verify_meta_reproduction.py new file mode 100644 index 0000000..016f703 --- /dev/null +++ b/implementation/algolab/scripts/verify_meta_reproduction.py @@ -0,0 +1,122 @@ +"""Independently compare a reproduced meta-search bundle with its sealed original. + +Usage: + python scripts/verify_meta_reproduction.py ORIGINAL REPRODUCTION [--out FILE] + +The original bundle is authoritative: every path in its ``checksums.json`` is +compared byte-for-byte first, then numerically (tolerance 1e-9) for JSON files +so that last-ULP differences across interpreter/BLAS builds are reported rather +than silently accepted. Extra files in either tree are a failure. Both bundles +are passed through the independent ``verify_pilot`` re-hasher. +""" + +from __future__ import annotations + +import argparse +import json +from pathlib import Path +from typing import Any + +from algolab.meta_search.protocol_241 import verify_pilot + +TOLERANCE = 1e-9 + + +def _numeric_equal(left: Any, right: Any) -> bool: + if isinstance(left, bool) or isinstance(right, bool): + return left is right + if isinstance(left, (int, float)) and isinstance(right, (int, float)): + return abs(float(left) - float(right)) <= TOLERANCE + if isinstance(left, dict) and isinstance(right, dict): + return left.keys() == right.keys() and all( + _numeric_equal(left[key], right[key]) for key in left + ) + if isinstance(left, list) and isinstance(right, list): + return len(left) == len(right) and all( + _numeric_equal(a, b) for a, b in zip(left, right, strict=True) + ) + return left == right + + +def compare(original: Path, reproduction: Path) -> dict[str, Any]: + """Return a structured comparison verdict for two sealed bundles.""" + expected: dict[str, str] = json.loads( + (original / "checksums.json").read_text(encoding="utf-8") + ) + results: list[dict[str, Any]] = [] + for rel, digest in expected.items(): + source = original / rel + target = reproduction / rel + entry: dict[str, Any] = {"file": rel, "mode": "byte_exact", "pass": False} + if not target.is_file(): + entry["problems"] = ["missing in reproduction"] + elif source.read_bytes() == target.read_bytes(): + entry["pass"] = True + entry["problems"] = [] + elif rel.endswith(".json"): + entry["mode"] = "numeric_1e-9" + left = json.loads(source.read_text(encoding="utf-8")) + right = json.loads(target.read_text(encoding="utf-8")) + if _numeric_equal(left, right): + entry["pass"] = True + entry["problems"] = [] + else: + entry["problems"] = ["byte and numeric comparison both differ"] + else: + entry["problems"] = ["byte mismatch (non-JSON; no numeric fallback)"] + entry["expected_sha256"] = digest + results.append(entry) + + extra: list[str] = [] + for tree in (original, reproduction): + for path in tree.rglob("*"): + if ( + path.is_file() + and path.name != "checksums.json" # the seal itself, not sealed content + and path.relative_to(tree).as_posix() not in expected + ): + extra.append(f"{tree.name}:{path.relative_to(tree).as_posix()}") + + original_verdict = verify_pilot(original) + reproduction_verdict = verify_pilot(reproduction) + failures = [entry["file"] for entry in results if not entry["pass"]] + passed = ( + not failures + and not extra + and original_verdict["verified"] + and reproduction_verdict["verified"] + ) + return { + "original": str(original), + "reproduction": str(reproduction), + "tolerance": TOLERANCE, + "pass": passed, + "files_checked": len(results), + "failures": failures, + "extra_files": sorted(extra), + "original_verification": original_verdict, + "reproduction_verification": reproduction_verdict, + "results": results, + } + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("original", type=Path) + parser.add_argument("reproduction", type=Path) + parser.add_argument("--out", type=Path, default=None) + args = parser.parse_args() + verdict = compare(args.original, args.reproduction) + payload = json.dumps(verdict, indent=2, sort_keys=True) + "\n" + if args.out is not None: + args.out.parent.mkdir(parents=True, exist_ok=True) + args.out.write_text(payload, encoding="utf-8") + print( + f"pass={verdict['pass']} files={verdict['files_checked']} " + f"failures={verdict['failures']} extra={verdict['extra_files']}" + ) + return 0 if verdict["pass"] else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/implementation/algolab/src/algolab/cli/main.py b/implementation/algolab/src/algolab/cli/main.py index ba7b5e3..baf0032 100644 --- a/implementation/algolab/src/algolab/cli/main.py +++ b/implementation/algolab/src/algolab/cli/main.py @@ -202,6 +202,24 @@ def _build_parser() -> argparse.ArgumentParser: help="overwrite an existing sealed bundle") p_meta.add_argument("--json", action="store_true") + p_transfer = sub.add_parser( + "meta-transfer-run", + help="run a preregistered real-workload policy-transfer experiment") + p_transfer.add_argument("--dir", type=Path, required=True, + help="artifact directory for the sealed bundle") + p_transfer.add_argument("--workloads", default="transform,hpo", + help="comma-separated workload names") + p_transfer.add_argument("--trials", type=int, default=8) + p_transfer.add_argument("--episodes", type=int, default=8) + p_transfer.add_argument("--budget", type=float, default=40.0) + p_transfer.add_argument("--seed-base", type=int, default=924_211) + p_transfer.add_argument("--confirmation-seed-base", type=int, default=351_773) + p_transfer.add_argument("--bootstrap-iterations", type=int, default=2_000) + p_transfer.add_argument("--protocol-id", default="protocol-244") + p_transfer.add_argument("--apply-bh", action="store_true") + p_transfer.add_argument("--force", action="store_true") + p_transfer.add_argument("--json", action="store_true") + p_mverify = sub.add_parser( "meta-verify", help="independently verify a sealed meta-search bundle") p_mverify.add_argument("--dir", type=Path, required=True) @@ -594,6 +612,44 @@ def cmd_meta_search_run(args: argparse.Namespace) -> int: return 0 +def cmd_meta_transfer_run(args: argparse.Namespace) -> int: + from algolab.meta_search.transfer import run_transfer + + workloads = tuple( + name.strip() for name in args.workloads.split(",") if name.strip() + ) + if not workloads: + print("no workloads selected", file=sys.stderr) + return 2 + if (args.dir / "checksums.json").exists() and not args.force: + print(f"refusing to overwrite sealed bundle: {args.dir} (use --force)", + file=sys.stderr) + return 2 + result = run_transfer( + args.dir, + workloads=workloads, + trials=args.trials, + episodes=args.episodes, + budget=args.budget, + seed_base=args.seed_base, + confirmation_seed_base=args.confirmation_seed_base, + bootstrap_iterations=args.bootstrap_iterations, + protocol_id=args.protocol_id, + apply_bh=args.apply_bh, + ) + if args.json: + print(json.dumps(result, indent=2, sort_keys=True)) + else: + for summary in result["summaries"]: + q = summary.get("primary_q") + q_text = f"{q:.4f}" if q is not None else "n/a" + print(f"{summary['workload']:>10} {summary['arm']:>15} " + f"d={summary['prospective_delta']:+.6f} " + f"ci_low={summary['prospective_ci_low']:+.6f} " + f"q={q_text} {summary['promotion']}") + return 0 + + def cmd_meta_verify(args: argparse.Namespace) -> int: from algolab.meta_search.protocol_241 import verify_pilot @@ -642,6 +698,8 @@ def main(argv: list[str] | None = None) -> int: return cmd_search_run(args) if command == "meta-search-run": return cmd_meta_search_run(args) + if command == "meta-transfer-run": + return cmd_meta_transfer_run(args) if command == "meta-verify": return cmd_meta_verify(args) parser.print_help() diff --git a/implementation/algolab/src/algolab/meta_search/transfer.py b/implementation/algolab/src/algolab/meta_search/transfer.py new file mode 100644 index 0000000..7b79f2a --- /dev/null +++ b/implementation/algolab/src/algolab/meta_search/transfer.py @@ -0,0 +1,510 @@ +"""Real-workload transfer evaluation (protocol 244). + +This module does **not** change the evaluator. It reuses the frozen +``algolab.statistics.analyze`` primitive and the fail-closed +``algolab.meta_search.evaluation.promote`` gate, and mirrors the A/B/C stage +layout of ``evaluation.py`` so that protocol 244 is directly comparable with +protocols 241–243. Only the source of attempts changes: real sklearn workloads +replace the planted-truth toy generator. +""" + +from __future__ import annotations + +import hashlib +import json +from collections.abc import Callable +from dataclasses import dataclass +from pathlib import Path +from typing import Any, cast + +from algolab.meta_search.evaluation import ( + PRIMARY_METRIC, + SECONDARY_METRIC, + promote, + replay_evaluation, +) +from algolab.meta_search.policies import ( + BASELINE_POLICY, + EVOLVED_POLICY, + Observation, + SearchPolicy, +) +from algolab.meta_search.replay import ReplayEnv +from algolab.meta_search.traces import DiscoveryTrace, TraceNode +from algolab.search import workload_hpo, workload_transform +from algolab.search.toy import Attempt +from algolab.statistics import analyze, benjamini_hochberg + +TRANSFER_SCHEMA_VERSION = "meta-transfer/1.0" +DEFAULT_WORKLOADS = ("transform", "hpo") +ARMS: tuple[SearchPolicy, ...] = (BASELINE_POLICY, EVOLVED_POLICY) +TraceAttempt = Callable[..., Attempt] + + +@dataclass(frozen=True) +class _Workload: + name: str + version: str + families: tuple[str, ...] + held_out: str + operators: tuple[str, ...] + costs: dict[str, float] + attempt: TraceAttempt + environment: dict[str, Any] + + +def _load_workload(name: str) -> _Workload: + if name == "transform": + module: Any = workload_transform + version = workload_transform.WORKLOAD_VERSION + elif name == "hpo": + module = workload_hpo + version = workload_hpo.HPO_WORKLOAD_VERSION + else: + raise ValueError(f"unsupported transfer workload: {name!r}") + operators = tuple(module.operators()) + environment = dict(module.environment_metadata()) + # Wall-clock counters are reporting-only state, not part of the frozen world. + workload_meta = dict(environment.get("workload_metadata", {})) + workload_meta.pop("measured_operator_seconds", None) + workload_meta.pop("measured_attempts", None) + environment["workload_metadata"] = workload_meta + return _Workload( + name=name, + version=version, + families=tuple(module.TASK_FAMILIES), + held_out=str(module.HELD_OUT_FAMILY), + operators=operators, + costs={op: float(module.operator_cost(op)) for op in operators}, + attempt=module.run_attempt, + environment=environment, + ) + + +def build_transfer_trace( + workloads: tuple[_Workload, ...], *, trace_seed: int +) -> DiscoveryTrace: + """Build a frozen, real-attempt trace; replay output is diagnostic only.""" + trace = DiscoveryTrace( + trace_id="trace-transfer-244", experiment_id="EXP-META-244" + ) + all_costs: dict[str, float] = {} + for workload in workloads: + root = trace.append( + TraceNode( + experiment_id="EXP-META-244", + parent_id=None, + policy_id=BASELINE_POLICY.policy_id, + policy_version=str(BASELINE_POLICY.version), + candidate_id=f"root-{workload.name}", + candidate_generation_method=f"root-{workload.name}", + search_parameters={ + "workload": workload.name, + "historical_choice": workload.operators[0], + }, + selection_decision=f"seed {workload.name} root", + compute_credits=0.0, + seed=trace_seed, + dataset_id=workload.name, + eval_split_id="train", + observation={"discovery": False, "valid": True}, + derived_metrics={"mean_effect": 0.0}, + created_at_utc="real-workload-frozen-trace", + execution_provenance={ + "source": "real_workload_attempts", + "workload": workload.name, + }, + ) + ) + for index, operator in enumerate(workload.operators[:3]): + attempt = workload.attempt( + workload.families[0], + operator, + seed_base=trace_seed, + trial=0, + episode=index, + attempt=index, + ) + all_costs[operator] = attempt.cost_credits + trace.append( + TraceNode( + experiment_id="EXP-META-244", + parent_id=root.node_id, + policy_id=BASELINE_POLICY.policy_id, + policy_version=str(BASELINE_POLICY.version), + candidate_id=f"cand-{workload.name}-{operator}", + candidate_generation_method=operator, + search_parameters={ + "workload": workload.name, + "family": workload.families[0], + "trial": 0, + }, + selection_decision=f"expand {operator}", + evaluation_result={ + "cost_credits": attempt.cost_credits, + "discovery": attempt.discovery, + }, + compute_credits=attempt.cost_credits, + seed=trace_seed + index, + dataset_id=workload.name, + eval_split_id="train", + observation={ + "discovery": attempt.discovery, + "valid": attempt.valid, + "mean_effect": attempt.mean_effect, + }, + derived_metrics={"mean_effect": attempt.mean_effect}, + created_at_utc="real-workload-frozen-trace", + execution_provenance={ + "source": "real_workload_attempts", + "workload": workload.name, + }, + ) + ) + return trace + + +def _trial_score( + policy: SearchPolicy, + workload: _Workload, + *, + family: str, + seed_base: int, + trial: int, + episodes: int, + budget: float, +) -> dict[str, float]: + """One deterministic prospective trial on a real workload.""" + observations: list[Observation] = [] + credits = 0.0 + discoveries = 0 + useful_found: set[str] = set() + for episode in range(episodes): + selection = policy.select( + workload.operators, + tuple(observations), + seed=seed_base + trial * 100_000 + episode, + costs=workload.costs, + ) + attempt = workload.attempt( + family, + selection.method, + seed_base=seed_base, + trial=trial, + episode=episode, + attempt=episode, + ) + credits += attempt.cost_credits + if credits > budget: + break + if attempt.discovery: + discoveries += 1 + useful_found.add(selection.method) + observations.append( + Observation( + method=selection.method, + cost_credits=attempt.cost_credits, + mean_effect=attempt.mean_effect, + discovery=attempt.discovery, + valid=attempt.valid, + ) + ) + denom = max(credits, 1e-9) + return { + "credits": credits, + "discoveries": float(discoveries), + PRIMARY_METRIC: discoveries / denom, + SECONDARY_METRIC: len(useful_found) / denom, + } + + +def _stage( + policy: SearchPolicy, + baseline: SearchPolicy, + workload: _Workload, + *, + families: tuple[str, ...], + seed_base: int, + trials: int, + episodes: int, + budget: float, + bootstrap_iterations: int, + alpha: float, +) -> tuple[dict[str, Any], int]: + def scores(candidate: SearchPolicy, metric: str) -> list[float]: + values: list[float] = [] + for family in families: + for trial in range(trials): + result = _trial_score( + candidate, + workload, + family=family, + seed_base=seed_base, + trial=trial, + episodes=episodes, + budget=budget, + ) + values.append(result[metric]) + return values + + primary = analyze( + scores(baseline, PRIMARY_METRIC), + scores(policy, PRIMARY_METRIC), + metric=PRIMARY_METRIC, + seed=seed_base + 1, + bootstrap_iterations=bootstrap_iterations, + alpha=alpha, + ) + secondary = analyze( + scores(baseline, SECONDARY_METRIC), + scores(policy, SECONDARY_METRIC), + metric=SECONDARY_METRIC, + seed=seed_base + 2, + bootstrap_iterations=bootstrap_iterations, + alpha=alpha, + ) + stage = { + "families": list(families), + "trials_per_family": trials, + "episodes": episodes, + "budget": budget, + "seed_base": seed_base, + "workload": workload.name, + "primary": { + "delta": primary.delta, + "ci_low": primary.ci_low, + "ci_high": primary.ci_high, + "p_value": primary.p_value, + "effect_size": primary.effect_size, + "baseline_mean": primary.baseline.mean, + "candidate_mean": primary.candidate.mean, + }, + "secondary": { + "delta": secondary.delta, + "ci_low": secondary.ci_low, + "ci_high": secondary.ci_high, + "p_value": secondary.p_value, + }, + } + return stage, len(families) * trials + + +def _write_json(path: Path, payload: Any) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text( + json.dumps(payload, sort_keys=True, separators=(",", ":")) + "\n", + encoding="utf-8", + ) + + +def _render_report(manifest: dict[str, Any], summaries: list[dict[str, Any]]) -> str: + lines = [ + f"# {manifest['protocol']} — Real-workload policy transfer", + "", + "Status: **preregistered experiment** (spec committed before execution). " + "Replay is diagnostic only; no policy is promoted on replay evidence.", + "", + "| Workload | Arm | Primary Δ/credit | 95% CI low | p | q (BH) | " + "Held-out Δ | Promotion |", + "|---|---|---|---|---|---|---|---|", + ] + for item in summaries: + q = f"{item['primary_q']:.4f}" if "primary_q" in item else "—" + lines.append( + f"| {item['workload']} | {item['arm']} | " + f"{item['prospective_delta']:+.6f} | {item['prospective_ci_low']:+.6f} | " + f"{item['prospective_p']:.4f} | {q} | {item['confirmation_delta']:+.6f} | " + f"{item['promotion']} |" + ) + lines += [ + "", + "Primary outcome: validated discoveries per credit. Secondary: distinct " + "useful methods per credit. Negative and inconclusive results are reported " + "as measured; no threshold was changed after results were seen.", + "", + ] + return "\n".join(lines) + + +def _seal(target: Path) -> dict[str, str]: + return { + path.relative_to(target).as_posix(): hashlib.sha256( + path.read_bytes() + ).hexdigest() + for path in sorted(target.rglob("*")) + if path.is_file() and path.name != "checksums.json" + } + + +def run_transfer( + out_dir: str | Path, + *, + workloads: tuple[str, ...] = DEFAULT_WORKLOADS, + trials: int = 8, + episodes: int = 8, + budget: float = 40.0, + seed_base: int = 924_211, + confirmation_seed_base: int = 351_773, + bootstrap_iterations: int = 2_000, + protocol_id: str = "protocol-244", + apply_bh: bool = True, +) -> dict[str, Any]: + """Run the preregistered transfer experiment and seal its bundle.""" + target = Path(out_dir) + target.mkdir(parents=True, exist_ok=True) + specs = tuple(_load_workload(name) for name in workloads) + trace = build_transfer_trace(specs, trace_seed=77_100) + trace.write(target / "trace.json") + combined_costs: dict[str, float] = {} + for spec in specs: + combined_costs.update(spec.costs) + env = ReplayEnv(trace, costs=combined_costs) + for path in ("replay", "evaluations", "promotions"): + (target / path).mkdir(exist_ok=True) + + summaries: list[dict[str, Any]] = [] + evaluations: dict[tuple[str, str], dict[str, Any]] = {} + attempts = 0 + credits_spent = 0.0 + for spec in specs: + for policy in ARMS: + replay = env.deterministic_artifact(policy, seed=17) + _write_json(target / "replay" / f"{spec.name}-{policy.name}.json", replay) + stage_a = replay_evaluation(env, policy, seed=17) + stage_b, b_trials = _stage( + policy, + BASELINE_POLICY, + spec, + families=spec.families, + seed_base=seed_base, + trials=trials, + episodes=episodes, + budget=budget, + bootstrap_iterations=bootstrap_iterations, + alpha=0.05, + ) + stage_b["stage"] = "B_prospective" + stage_b["is_prospective_evidence"] = True + stage_c, c_trials = _stage( + policy, + BASELINE_POLICY, + spec, + families=(spec.held_out,), + seed_base=confirmation_seed_base, + trials=trials, + episodes=episodes, + budget=budget, + bootstrap_iterations=bootstrap_iterations, + alpha=0.05, + ) + stage_c["stage"] = "C_independent_confirmation" + stage_c["is_prospective_evidence"] = True + payload = { + "schema_version": TRANSFER_SCHEMA_VERSION, + "candidate_policy_id": policy.policy_id, + "baseline_policy_id": BASELINE_POLICY.policy_id, + "workload": spec.name, + "workload_version": spec.version, + "stage_a": stage_a, + "stage_b": stage_b, + "stage_c": stage_c, + "preregistered": True, + } + evaluations[(spec.name, policy.name)] = payload + _write_json( + target / "evaluations" / f"{spec.name}-{policy.name}.json", payload + ) + attempts += 2 * (b_trials + c_trials) * episodes + credits_spent += (b_trials + c_trials) * budget * 2 + if policy is BASELINE_POLICY: + continue + summaries.append( + { + "workload": spec.name, + "arm": policy.name, + "historical_agreement": stage_a["decision_quality_agreement"], + "prospective_delta": stage_b["primary"]["delta"], + "prospective_ci_low": stage_b["primary"]["ci_low"], + "prospective_p": stage_b["primary"]["p_value"], + "confirmation_delta": stage_c["primary"]["delta"], + "confirmation_ci_low": stage_c["primary"]["ci_low"], + "secondary_ci_low": stage_b["secondary"]["ci_low"], + } + ) + + if apply_bh: + q_values = benjamini_hochberg([item["prospective_p"] for item in summaries]) + for item, q in zip(summaries, q_values, strict=True): + item["primary_q"] = q + payload = evaluations[(item["workload"], item["arm"])] + stage_b = cast(dict[str, Any], payload["stage_b"]) + primary = cast(dict[str, Any], stage_b["primary"]) + primary["p_adjusted"] = q + _write_json( + target / "evaluations" / f"{item['workload']}-{item['arm']}.json", + payload, + ) + + for item in summaries: + policy = next(p for p in ARMS if p.name == item["arm"]) + decision = promote( + policy, + BASELINE_POLICY, + evaluations[(item["workload"], item["arm"])], + ) + _write_json( + target / "promotions" / f"{item['workload']}-{item['arm']}.json", + decision.to_dict(), + ) + item["promotion"] = decision.status.value + + manifest = { + "schema_version": TRANSFER_SCHEMA_VERSION, + "protocol": protocol_id, + "protocol_version": "1.0.0", + "preregistration": "spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md", + "trace_kind": "real_workload_frozen_trace", + "trace_is_prospective_evidence": False, + "substrates": [f"algolab.search.workload_{n}" for n in workloads], + "workloads": [ + {"name": spec.name, "version": spec.version, "held_out": spec.held_out} + for spec in specs + ], + "arms": [p.name for p in ARMS], + "trials": trials, + "episodes": episodes, + "budget": budget, + "seed_base": seed_base, + "confirmation_seed_base": confirmation_seed_base, + "bootstrap_iterations": bootstrap_iterations, + "multiple_comparison_correction": ( + "benjamini-hochberg" if apply_bh else "none" + ), + "promotion_gate": ( + "unchanged from protocol 243; replay diagnostic only; B requires " + "positive CI and q<0.05; C requires held-out delta>=0 and CI>=-0.001" + ), + "compute": { + "planned_upper_bound_attempts": attempts, + "nominal_credits_upper_bound": credits_spent, + "timing_is_decision_relevant": False, + }, + } + for spec in specs: + _write_json(target / f"environment-{spec.name}.json", spec.environment) + _write_json(target / "manifest.json", manifest) + (target / "report.md").write_text( + _render_report(manifest, summaries), encoding="utf-8" + ) + checksums = _seal(target) + _write_json(target / "checksums.json", checksums) + return {"manifest": manifest, "summaries": summaries, "checksums": checksums} + + +__all__ = [ + "TRANSFER_SCHEMA_VERSION", + "DEFAULT_WORKLOADS", + "ARMS", + "build_transfer_trace", + "run_transfer", +] diff --git a/implementation/algolab/tests/test_meta_transfer.py b/implementation/algolab/tests/test_meta_transfer.py new file mode 100644 index 0000000..2b1fb84 --- /dev/null +++ b/implementation/algolab/tests/test_meta_transfer.py @@ -0,0 +1,224 @@ +"""Protocol 244 real-workload transfer runner and CLI regression tests.""" + +from __future__ import annotations + +import json +from pathlib import Path + +import pytest + +from algolab.cli.main import main +from algolab.meta_search import transfer +from algolab.meta_search.protocol_241 import verify_pilot +from algolab.search.toy import Attempt + + +def _fake_loader(name: str) -> transfer._Workload: # type: ignore[name-defined] + """A tiny deterministic stand-in for the real sklearn workloads.""" + assert name in {"fake", "fake-secondary"} + + def attempt( + family: str, + operator: str, + *, + seed_base: int, + trial: int, + episode: int, + attempt: int, + ) -> Attempt: + del family, seed_base, attempt + useful = operator == "cheap" + effect = 0.2 if useful else -0.1 + return Attempt( + operator=operator, + cost_credits=1.0 if useful else 2.0, + valid=True, + effect_1=effect, + effect_2=effect, + mean_effect=effect, + discovery=useful and (trial + episode) % 2 == 0, + ) + + return transfer._Workload( # type: ignore[attr-defined] + name=name, + version="test/1.0", + families=("alpha", "beta"), + held_out="gamma", + operators=("cheap", "expensive", "third"), + costs={"cheap": 1.0, "expensive": 2.0, "third": 2.0}, + attempt=attempt, + environment={"name": name, "ground_truth": None}, + ) + + +@pytest.fixture() +def fake_workload(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(transfer, "_load_workload", _fake_loader) + + +class TestTransferBundle: + def test_bundle_is_sealed_and_verifiable( + self, fake_workload: None, tmp_path: Path + ) -> None: + bundle = tmp_path / "protocol-244-test" + result = transfer.run_transfer( + bundle, + workloads=("fake",), + trials=2, + episodes=3, + budget=40, + bootstrap_iterations=200, + ) + verdict = verify_pilot(bundle) + assert verdict["verified"] is True + assert verdict["trace_integrity"] is True + assert verdict["replay_only_promotion_detected"] is False + assert verdict["n_files_verified"] == len(result["checksums"]) + + manifest = json.loads((bundle / "manifest.json").read_text()) + assert manifest["schema_version"] == transfer.TRANSFER_SCHEMA_VERSION + assert manifest["trace_is_prospective_evidence"] is False + assert manifest["multiple_comparison_correction"] == "benjamini-hochberg" + assert manifest["workloads"] == [ + {"name": "fake", "version": "test/1.0", "held_out": "gamma"} + ] + + replay = json.loads( + (bundle / "replay" / "fake-fixed-baseline.json").read_text() + ) + assert replay["is_prospective_evidence"] is False + evaluation = json.loads( + (bundle / "evaluations" / "fake-evolved.json").read_text() + ) + assert evaluation["stage_a"]["is_prospective_evidence"] is False + assert evaluation["stage_b"]["is_prospective_evidence"] is True + assert evaluation["stage_c"]["is_prospective_evidence"] is True + assert "p_adjusted" in evaluation["stage_b"]["primary"] + assert len(result["summaries"]) == 1 + + def test_bundle_is_deterministic( + self, fake_workload: None, tmp_path: Path + ) -> None: + first = tmp_path / "first" + second = tmp_path / "second" + kwargs = { + "workloads": ("fake",), + "trials": 2, + "episodes": 3, + "budget": 40, + "bootstrap_iterations": 200, + } + transfer.run_transfer(first, **kwargs) # type: ignore[arg-type] + transfer.run_transfer(second, **kwargs) # type: ignore[arg-type] + assert (first / "checksums.json").read_bytes() == ( + second / "checksums.json" + ).read_bytes() + for path in first.rglob("*"): + if not path.is_file() or path.name == "checksums.json": + continue + assert path.read_bytes() == (second / path.relative_to(first)).read_bytes() + + def test_tampering_detected(self, fake_workload: None, tmp_path: Path) -> None: + bundle = tmp_path / "tampered" + transfer.run_transfer( + bundle, + workloads=("fake",), + trials=2, + episodes=3, + budget=40, + bootstrap_iterations=200, + ) + target = bundle / "report.md" + target.write_text(target.read_text() + "\nTAMPERED\n") + verdict = verify_pilot(bundle) + assert verdict["verified"] is False + assert "report.md" in verdict["mismatches"] + + def test_unknown_workload_fails_closed(self, tmp_path: Path) -> None: + with pytest.raises(ValueError, match="unsupported transfer workload"): + transfer.run_transfer( + tmp_path / "unknown", + workloads=("not-a-workload",), + trials=1, + episodes=1, + bootstrap_iterations=100, + ) + + +class TestTransferCLI: + def test_cli_writes_bundle( + self, fake_workload: None, tmp_path: Path, capsys: pytest.CaptureFixture[str] + ) -> None: + bundle = tmp_path / "cli-bundle" + code = main( + [ + "meta-transfer-run", + "--dir", + str(bundle), + "--workloads", + "fake", + "--trials", + "2", + "--episodes", + "3", + "--budget", + "40", + "--bootstrap-iterations", + "200", + "--apply-bh", + "--force", + "--json", + ] + ) + assert code == 0 + output = json.loads(capsys.readouterr().out) + assert output["summaries"][0]["workload"] == "fake" + assert output["summaries"][0]["promotion"] in { + "PROMOTED", + "REJECTED_HISTORICAL_ONLY", + "REJECTED_PROSPECTIVE", + "REJECTED_INDEPENDENT", + "REJECTED_INCOMPLETE", + } + assert verify_pilot(bundle)["verified"] is True + + def test_cli_refuses_existing_bundle( + self, fake_workload: None, tmp_path: Path, capsys: pytest.CaptureFixture[str] + ) -> None: + bundle = tmp_path / "sealed" + base = [ + "meta-transfer-run", + "--dir", + str(bundle), + "--workloads", + "fake", + "--trials", + "2", + "--episodes", + "1", + "--bootstrap-iterations", + "100", + ] + assert main(base) == 0 + capsys.readouterr() + assert main(base) == 2 + assert "refusing to overwrite sealed bundle" in capsys.readouterr().err + + def test_meta_verify_command(self, fake_workload: None, tmp_path: Path) -> None: + bundle = tmp_path / "verify-cli" + main( + [ + "meta-transfer-run", + "--dir", + str(bundle), + "--workloads", + "fake", + "--trials", + "2", + "--episodes", + "1", + "--bootstrap-iterations", + "100", + ] + ) + assert main(["meta-verify", "--dir", str(bundle), "--json"]) == 0 diff --git a/spec/architecture/100_SYSTEM_ARCHITECTURE.md b/spec/architecture/100_SYSTEM_ARCHITECTURE.md index f6a7c51..0f4ce59 100644 --- a/spec/architecture/100_SYSTEM_ARCHITECTURE.md +++ b/spec/architecture/100_SYSTEM_ARCHITECTURE.md @@ -15,6 +15,36 @@ Sandboxed workers that build, test, train, and benchmark candidates. ### Data Plane Relational metadata store, artifact store, knowledge graph, append-only event log. +### Meta-Search / Policy Evolution plane +A bounded subsystem that treats AlgoLab's own *search strategies* as experimental +objects. It adds no second event store, budget ledger, artifact manager or +experiment registry; it reuses the Data Plane and `algolab.statistics`. + +- `meta_search.traces` — `DiscoveryTrace`: content-addressed, append-only + discovery history with a sha256 chain and canonical JSON. Unwritten branches + are never assigned an outcome. +- `meta_search.replay` — `ReplayEnv`: prefix-only decisions against a frozen + trace. Its output is explicitly `is_prospective_evidence=false`; it cannot + promote a policy. +- `meta_search.policies` — frozen, versioned `SearchPolicy` records with + deterministic `select()`, content-derived ids, lineage and rollback pointer. + No agent rewrites policy source code. +- `meta_search.evaluation` — staged evaluation (A historical, B prospective, + C independent held-out, D fail-closed promotion) using the shared statistics + layer, with paired bootstrap CIs, Welch p-values, effect sizes and BH-FDR. +- `meta_search.protocol_241` (and successors) — one CLI command writes one + sealed, checksummed bundle; `meta-verify` independently re-hashes every file + and re-checks every promotion verdict. +- `meta_search.transfer` — Protocol 244 real-workload runner that swaps only + the attempt source (frozen `transform`/`hpo` traces) while reusing the same + evaluator, statistics and fail-closed promotion gate. + +Authority boundary: this plane may *propose* and *evaluate* policy versions. It +may not weaken an evaluator, promotion threshold or test, may not promote on +replay-only evidence, and may not alter the historical record. Real-workload +transfer is evaluated by the same evaluator under a new preregistered protocol, +not by changing the toy-stage gate. + ## Required APIs - `POST /hypotheses` @@ -37,8 +67,14 @@ src/algolab/ core/ IDs, schemas, state machine, events control/ orchestrator, scheduler, budget, permissions research/ literature, hypotheses, novelty, candidates + search/ search policies, toy/real workloads, harness + meta_search/ traces, replay, policies, evaluation, protocol runners experiments/ planning, execution, benchmarks, statistics + statistics.py bootstrap CI, Welch, Cohen's d, BH-FDR storage/ repositories, artifacts, provenance + execution/ queue, workers, hash-sealed artifacts, recovery + validation/ schema validation + workloads/ executable workload adapters reporting/ reports and evidence links governance/ policy engine, audit, emergency stop tests/ diff --git a/spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md b/spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md new file mode 100644 index 0000000..c8a0685 --- /dev/null +++ b/spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md @@ -0,0 +1,81 @@ +# Protocol 244 — Real-workload transfer of the evolved search policy + +**Status:** PRE-REGISTERED — frozen before execution, 2026-11-22. +**Predecessor:** protocol 243 (`experiments/protocol-243-v1/`). +**Decision scope:** research evidence only; no deployment and no change to any +promotion criterion. + +## Question + +Does the unchanged `evolved` policy that was promoted on the toy substrate +transfer to real, deterministic scikit-learn workloads, or was protocol 243's +gain specific to the toy generator? + +This is a transfer test, not a new policy search. The candidate policy, +baseline policy, statistic, and promotion gate are unchanged from protocol 243. +Historical replay is diagnostic only and cannot promote. + +## Preregistered design + +- **Arms:** `fixed-baseline` (control) versus `evolved` only. The policy + definitions and checksums are unchanged from protocol 243. +- **Primary workload:** `algolab.search.workload_transform` (version 1.0.0, + 14 typed transform operators, non-flat costs). **Secondary workload:** + `algolab.search.workload_hpo` (version 1.1.0, 7 fixed KNN configurations, + flat costs). Both are frozen, offline, CPU-only workloads with no network + access and no ground-truth policy labels. +- **Training families:** `alpha` and `beta` for each workload. **Independent + confirmation family:** `gamma` for each workload, with a distinct seed base. +- **Trials:** 8 per family for both stage B and stage C. **Episodes:** 8 per + trial. **Budget:** 40 credits per trial, matched across arms and unchanged + from protocol 243. +- **Fresh seeds:** prospective base `924_211`; independent confirmation base + `351_773`; historical replay `17`; frozen trace construction `77_100`. + Bootstrap resamples: 2000. Alpha: 0.05. +- **Primary outcome:** validated discoveries per credit. **Secondary + outcome:** distinct useful methods per credit. +- **Multiplicity:** Benjamini–Hochberg FDR across the two prospective p-values + (one `evolved`-versus-baseline comparison per workload). The BH-adjusted + q-value, not the raw p-value, gates promotion. +- **Promotion gate:** unchanged and fail-closed. Stage A replay alone never + promotes. Stage B requires Δ > 0, 95% CI low > 0, q < 0.05, and secondary CI + low ≥ 0. Stage C requires held-out Δ ≥ 0 and CI low ≥ −0.001. +- **Trace class:** a frozen trace of real workload attempts used only for + historical replay diagnostics; it is explicitly not prospective evidence. + +## Stopping and resources + +One bounded run, with no adaptation after outcomes are observed: + +``` +2 workloads × 2 arms × (2 training families + 1 held-out family) + × 8 trials × 8 episodes = 768 prospective attempts +``` + +Plus 2 arms × 2 workloads = 4 diagnostic replay evaluations and 6 real +attempts used to build the frozen trace. CPU-only, no paid APIs, no GPU, no +network access. + +## Reproduce + +```bash +cd implementation/algolab +.venv/bin/python -m algolab.cli.main meta-transfer-run \ + --dir experiments/protocol-244-v1 --protocol-id protocol-244 \ + --workloads transform,hpo --trials 8 --episodes 8 --budget 40 \ + --seed-base 924211 --confirmation-seed-base 351773 \ + --bootstrap-iterations 2000 --apply-bh --force +.venv/bin/python -m algolab.cli.main meta-verify \ + --dir experiments/protocol-244-v1 +``` + +The runner writes `manifest.json`, `report.md`, `trace.json`, per-workload +environment metadata, per-workload replay artifacts, per-workload/arm stage +A/B/C evaluations, per-workload/arm promotion decisions, and `checksums.json`. + +## Reporting rule + +All outcomes, including negative, null, and inconclusive results, are reported +as measured. A nonnegative result on the toy substrate does not become a +real-workload claim without this protocol's own gates passing. No threshold, +seed, arm, evaluator, or promotion definition may be changed after execution.