dagcert 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. dagcert-1.0.0/LICENSE +21 -0
  2. dagcert-1.0.0/PKG-INFO +347 -0
  3. dagcert-1.0.0/README.md +296 -0
  4. dagcert-1.0.0/dagcert/__init__.py +195 -0
  5. dagcert-1.0.0/dagcert/_core/__init__.py +1 -0
  6. dagcert-1.0.0/dagcert/_core/_interval_utils.py +136 -0
  7. dagcert-1.0.0/dagcert/_core/_samegame_engine.py +179 -0
  8. dagcert-1.0.0/dagcert/_core/_uct_families.py +79 -0
  9. dagcert-1.0.0/dagcert/_core/application_search.py +220 -0
  10. dagcert-1.0.0/dagcert/_core/backprop_problems.py +42 -0
  11. dagcert-1.0.0/dagcert/_core/batched_witness_cab.py +151 -0
  12. dagcert-1.0.0/dagcert/_core/benchmark.py +253 -0
  13. dagcert-1.0.0/dagcert/_core/certificate_batch.py +198 -0
  14. dagcert-1.0.0/dagcert/_core/certificates.py +275 -0
  15. dagcert-1.0.0/dagcert/_core/certified_uct.py +367 -0
  16. dagcert-1.0.0/dagcert/_core/compiled_retirement.py +191 -0
  17. dagcert-1.0.0/dagcert/_core/completion_accuracy.py +275 -0
  18. dagcert-1.0.0/dagcert/_core/demand_benchmark.py +196 -0
  19. dagcert-1.0.0/dagcert/_core/demand_bounds.py +511 -0
  20. dagcert-1.0.0/dagcert/_core/demand_threshold.py +147 -0
  21. dagcert-1.0.0/dagcert/_core/graph.py +145 -0
  22. dagcert-1.0.0/dagcert/_core/local_buckets.py +238 -0
  23. dagcert-1.0.0/dagcert/_core/maintenance_regimes.py +83 -0
  24. dagcert-1.0.0/dagcert/_core/maintenance_replay.py +223 -0
  25. dagcert-1.0.0/dagcert/_core/onpolicy_backup.py +131 -0
  26. dagcert-1.0.0/dagcert/_core/persistent_queries.py +94 -0
  27. dagcert-1.0.0/dagcert/_core/puct.py +393 -0
  28. dagcert-1.0.0/dagcert/_core/quotient_range.py +62 -0
  29. dagcert-1.0.0/dagcert/_core/retired_bounds.py +214 -0
  30. dagcert-1.0.0/dagcert/_core/root_flat_control.py +113 -0
  31. dagcert-1.0.0/dagcert/_core/routing.py +143 -0
  32. dagcert-1.0.0/dagcert/_core/search.py +307 -0
  33. dagcert-1.0.0/dagcert/_core/shared_backprop.py +274 -0
  34. dagcert-1.0.0/dagcert/_core/uct_problems.py +37 -0
  35. dagcert-1.0.0/dagcert/_core/v12_bed_acquisition.py +1338 -0
  36. dagcert-1.0.0/dagcert/_core/v2_benchmarks.py +352 -0
  37. dagcert-1.0.0/dagcert/_core/v2_monitors.py +1218 -0
  38. dagcert-1.0.0/dagcert/_core/v3_extensions.py +898 -0
  39. dagcert-1.0.0/dagcert/_core/v4_baselines.py +915 -0
  40. dagcert-1.0.0/dagcert/_core/v5_hybrid_and_os.py +451 -0
  41. dagcert-1.0.0/dagcert/_core/v6_bayesian_opt.py +1025 -0
  42. dagcert-1.0.0/dagcert/_core/v6_real_world.py +836 -0
  43. dagcert-1.0.0/dagcert/_core/v7_bayesian_ucd.py +2089 -0
  44. dagcert-1.0.0/dagcert/_core/v7_benchmarks.py +734 -0
  45. dagcert-1.0.0/dagcert/_core/v8_unified_experiments.py +1503 -0
  46. dagcert-1.0.0/dagcert/_core/v9_v34_tracker.py +2556 -0
  47. dagcert-1.0.0/dagcert/_core/witness_cab.py +239 -0
  48. dagcert-1.0.0/dagcert/_native/__init__.py +1 -0
  49. dagcert-1.0.0/dagcert/_native/_cpp_kernels.cpp +1026 -0
  50. dagcert-1.0.0/dagcert/_native/_cpp_samegame.cpp +265 -0
  51. dagcert-1.0.0/dagcert/_native/_cpp_v12_kg.cpp +328 -0
  52. dagcert-1.0.0/dagcert/_native/_cpp_v34_bnb.cpp +706 -0
  53. dagcert-1.0.0/dagcert/acquisition.py +625 -0
  54. dagcert-1.0.0/dagcert/benchmarks/__init__.py +119 -0
  55. dagcert-1.0.0/dagcert/benchmarks/data/gb1_wu2016_measured.npz +0 -0
  56. dagcert-1.0.0/dagcert/benchmarks/data/samegame/StandardTestset.txt +321 -0
  57. dagcert-1.0.0/dagcert/benchmarks/data/trpb_johnston2024_measured.npz +0 -0
  58. dagcert-1.0.0/dagcert/benchmarks/data/worfbench_qwen3_81x64.npz +0 -0
  59. dagcert-1.0.0/dagcert/benchmarks/data/worfbench_qwen3_test_81x32.npz +0 -0
  60. dagcert-1.0.0/dagcert/benchmarks/proteins.py +63 -0
  61. dagcert-1.0.0/dagcert/benchmarks/synthetic.py +86 -0
  62. dagcert-1.0.0/dagcert/benchmarks/workflows.py +22 -0
  63. dagcert-1.0.0/dagcert/certificates.py +182 -0
  64. dagcert-1.0.0/dagcert/graph.py +113 -0
  65. dagcert-1.0.0/dagcert/posteriors.py +189 -0
  66. dagcert-1.0.0/dagcert/search.py +52 -0
  67. dagcert-1.0.0/dagcert/tracking.py +94 -0
  68. dagcert-1.0.0/dagcert.egg-info/PKG-INFO +347 -0
  69. dagcert-1.0.0/dagcert.egg-info/SOURCES.txt +89 -0
  70. dagcert-1.0.0/dagcert.egg-info/dependency_links.txt +1 -0
  71. dagcert-1.0.0/dagcert.egg-info/requires.txt +28 -0
  72. dagcert-1.0.0/dagcert.egg-info/top_level.txt +1 -0
  73. dagcert-1.0.0/pyproject.toml +99 -0
  74. dagcert-1.0.0/setup.cfg +4 -0
  75. dagcert-1.0.0/tests/test_compiled_retirement.py +51 -0
  76. dagcert-1.0.0/tests/test_library_api.py +123 -0
  77. dagcert-1.0.0/tests/test_onpolicy_backup.py +72 -0
  78. dagcert-1.0.0/tests/test_retired_bounds.py +134 -0
  79. dagcert-1.0.0/tests/test_v10_strengthening.py +103 -0
  80. dagcert-1.0.0/tests/test_v11_audit.py +95 -0
  81. dagcert-1.0.0/tests/test_v12_bed_acquisition.py +217 -0
  82. dagcert-1.0.0/tests/test_v13_protein_bed_vs_kg.py +156 -0
  83. dagcert-1.0.0/tests/test_v14_protein_credible_ellipsoid.py +158 -0
  84. dagcert-1.0.0/tests/test_v2_extensions.py +216 -0
  85. dagcert-1.0.0/tests/test_v3_strengthening.py +151 -0
  86. dagcert-1.0.0/tests/test_v4_baselines.py +131 -0
  87. dagcert-1.0.0/tests/test_v5_hybrid_os.py +81 -0
  88. dagcert-1.0.0/tests/test_v6_real_world.py +285 -0
  89. dagcert-1.0.0/tests/test_v7_bayesian_ucd.py +297 -0
  90. dagcert-1.0.0/tests/test_v8_unified.py +152 -0
  91. dagcert-1.0.0/tests/test_v9_v34.py +167 -0
dagcert-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aurélien Pélissier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
dagcert-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,347 @@
1
+ Metadata-Version: 2.4
2
+ Name: dagcert
3
+ Version: 1.0.0
4
+ Summary: Certify the decision, not the outcome: joint root certification and decision-aware Bayesian experimental design on search graphs.
5
+ Author: Aurélien Pélissier
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/AI-MathPhys/dag-cert
8
+ Project-URL: Repository, https://github.com/AI-MathPhys/dag-cert
9
+ Project-URL: Issues, https://github.com/AI-MathPhys/dag-cert/issues
10
+ Project-URL: Paper, https://github.com/AI-MathPhys/dag-cert/blob/main/manuscript/Joint_cert_manuscript.pdf
11
+ Project-URL: Reproducibility, https://github.com/AI-MathPhys/dag-cert/blob/main/REPRODUCIBILITY.md
12
+ Keywords: bayesian-experimental-design,monte-carlo-tree-search,pure-exploration,best-arm-identification,directed-acyclic-graph,bayesian-optimization,protein-engineering
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: numpy>=1.24
28
+ Requires-Dist: scipy>=1.10
29
+ Provides-Extra: audit
30
+ Requires-Dist: cvxpy>=1.5; extra == "audit"
31
+ Requires-Dist: clarabel>=0.7; extra == "audit"
32
+ Requires-Dist: scs>=3.2; extra == "audit"
33
+ Provides-Extra: experiments
34
+ Requires-Dist: matplotlib>=3.7; extra == "experiments"
35
+ Requires-Dist: pandas>=2.1; extra == "experiments"
36
+ Requires-Dist: requests>=2.28; extra == "experiments"
37
+ Requires-Dist: networkx>=3.2; extra == "experiments"
38
+ Provides-Extra: llm
39
+ Requires-Dist: torch>=2.2; extra == "llm"
40
+ Requires-Dist: transformers>=4.45; extra == "llm"
41
+ Requires-Dist: huggingface-hub>=0.25; extra == "llm"
42
+ Requires-Dist: accelerate>=0.30; extra == "llm"
43
+ Requires-Dist: safetensors>=0.4; extra == "llm"
44
+ Provides-Extra: dev
45
+ Requires-Dist: pytest>=7.0; extra == "dev"
46
+ Requires-Dist: build>=1.2; extra == "dev"
47
+ Requires-Dist: twine>=5.0; extra == "dev"
48
+ Provides-Extra: all
49
+ Requires-Dist: dagcert[audit,dev,experiments,llm]; extra == "all"
50
+ Dynamic: license-file
51
+
52
+ # Certify the Decision, Not the Outcome: Bayesian Experimental Design on Search Graphs (`dagcert`)
53
+
54
+ [![PyPI](https://img.shields.io/pypi/v/dagcert.svg)](https://pypi.org/project/dagcert/)
55
+ [![CI](https://github.com/AI-MathPhys/dag-cert/actions/workflows/ci.yml/badge.svg)](https://github.com/AI-MathPhys/dag-cert/actions/workflows/ci.yml)
56
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/AI-MathPhys/dag-cert/blob/main/LICENSE)
57
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://github.com/AI-MathPhys/dag-cert/blob/main/pyproject.toml)
58
+ [![Manuscript](https://img.shields.io/badge/Manuscript-PDF-red.svg)](https://github.com/AI-MathPhys/dag-cert/blob/main/manuscript/Joint_cert_manuscript.pdf)
59
+ [![Lean 4](https://img.shields.io/badge/Formalization-Lean%204-purple.svg)](https://github.com/AI-MathPhys/dag-cert/tree/main/lean/)
60
+
61
+ Installable Python library (`dagcert`), full experimental suite (`experiment/`), bundled benchmark datasets, SHA-256-verified run archives (`results/`), Lean 4 formalizations (`lean/`), and complete reproduction scripts for **Certify the Decision, Not the Outcome: Bayesian Experimental Design on Search Graphs**.
62
+
63
+ - **Manuscript:** [`manuscript/Joint_cert_manuscript.pdf`](https://github.com/AI-MathPhys/dag-cert/blob/main/manuscript/Joint_cert_manuscript.pdf) (LaTeX source: [`manuscript/joint_cert_manuscript.tex`](https://github.com/AI-MathPhys/dag-cert/blob/main/manuscript/joint_cert_manuscript.tex))
64
+ - **Artifact-to-paper map:** [`REPRODUCIBILITY.md`](https://github.com/AI-MathPhys/dag-cert/blob/main/REPRODUCIBILITY.md) maps every table (Tables 1–69) and figure (Figures 1–14) to its archived logs and reproduction command — **100% coverage with zero missing experiments**.
65
+ - **Formal mathematics:** [`lean/`](https://github.com/AI-MathPhys/dag-cert/tree/main/lean/) contains a Lean 4 formalization of the paper's 62 numbered results (62 proved as written, 0 false as written with a counterexample, 0 partial, 0 open); see [`lean/README.md`](https://github.com/AI-MathPhys/dag-cert/blob/main/lean/README.md) for the status of each.
66
+
67
+ <p align="center">
68
+ <img src="https://raw.githubusercontent.com/AI-MathPhys/dag-cert/main/figures/fig1_concept_overview.png" width="94%" alt="Shared outcomes change what can invalidate a root decision"/>
69
+ </p>
70
+
71
+ *Shared outcomes change what can invalidate a root decision: a terminal that the chosen action can still reach cannot count against it, so only excluded outcomes matter.*
72
+
73
+ ---
74
+
75
+ ## Overview
76
+
77
+ In sequential decision-making, an initial commitment can be certified as $\varepsilon$-optimal long before its best full continuation is known. Many real search spaces — combinatorial protein design, agentic workflow configuration, routing, and puzzle lookahead — are **directed acyclic graphs (DAGs)** in which different action sequences reach overlapping terminal sets, and evidence about terminal outcomes is **statistically correlated**.
78
+
79
+ **Joint Root Certification** directly certifies that a root action $a$ retains access to an $\varepsilon$-optimal terminal outcome:
80
+
81
+ > A commitment can be invalidated only by an *excluded* terminal $z \notin S(a)$ that beats *every retained continuation* $y \in S(a)$ by more than $\varepsilon$ under the *same* plausible environment.
82
+
83
+ Key methodological contributions implemented in `dagcert`:
84
+
85
+ 1. **Structural sharing (exact outside-support regret):** Evaluating all outcomes under a single common environment cancels shared continuations, replacing loose marginal action-value bounds with exact outside-vs-inside certificates.
86
+ 2. **Statistical sharing (sparse ellipsoidal dual & CD-Joint):** Under correlated Gaussian or fixed-feature uncertainty sets, worst-case decision regret admits an exact sparse conic dual (supported on at most $d+1$ inside witnesses). **CD-Joint** (Contrast-Directed Joint acquisition) targets the variance of the active outside–inside contrast, exploiting even low-valued but informative off-witness proxies while safeguarding against inside-witness stalling.
87
+ 3. **Stopping-regime awareness:** The library supports matched Bayesian joint credible ellipsoids (with exact contrast rank $r = \operatorname{rank}(\text{contrast } \Sigma)$ and radius $\sqrt{\chi^2_{r,1-\delta}}$), direct posterior-risk stopping, anytime-valid fixed-feature ellipsoids, unknown-variance sparse-refresh tracking (V34) with native C++17 outward-certified branch-and-bound, calibrated EB+LOO GP stopping, and formal distribution-free (Hoeffding / Empirical Bernstein) confidence boxes.
88
+
89
+ ---
90
+
91
+ ## Installation & Python Library Quickstart
92
+
93
+ Requires Python 3.10 or newer. The core library depends only on NumPy and SciPy.
94
+
95
+ ### 1. Install `dagcert`
96
+
97
+ ```bash
98
+ pip install dagcert
99
+ ```
100
+
101
+ Optional extras:
102
+
103
+ ```bash
104
+ pip install "dagcert[audit]" # CVXPY/Clarabel reference solvers (solver="cvxpy_socp") and oracle audits
105
+ pip install "dagcert[experiments]" # matplotlib, pandas, requests, networkx: paper experiments and figures
106
+ pip install "dagcert[llm]" # PyTorch / Transformers for the live Qwen3-0.6B workflow suites
107
+ pip install "dagcert[all]" # everything, plus pytest, build and twine
108
+ ```
109
+
110
+ To reproduce the paper, install from source instead:
111
+
112
+ ```bash
113
+ git clone https://github.com/AI-MathPhys/dag-cert.git
114
+ cd dag-cert
115
+ python -m venv .venv
116
+ source .venv/bin/activate # Windows PowerShell: .\.venv\Scripts\Activate.ps1
117
+ python -m pip install -e ".[dev,audit,experiments]"
118
+ ```
119
+
120
+ > **Native C++17 accelerators (optional):** when `$CXX`, `g++` or `clang++` is available, `dagcert` compiles its four `-O3` C++17 kernels on first use and caches the shared libraries in the system temporary directory (exact correlated KG, outward-certified branch-and-bound for unknown-variance tracking, graph-maintenance kernels, and SameGame playouts). Exact correlated KG falls back to a pure-Python implementation with identical results; the other three are research accelerators that require a compiler, and their tests are skipped when none is found.
121
+
122
+ ### 2. Minimal Library Usage
123
+
124
+ ```python
125
+ import numpy as np
126
+ from dagcert import (
127
+ SearchDAG,
128
+ certify_root_action,
129
+ exact_rectangular_regret,
130
+ )
131
+
132
+ # 1. Exact shared-support rectangular certificate (Figure 1b)
133
+ # Root action 0 reaches {0, 1}; root action 1 reaches {1, 2}. Shared terminal 1 cancels!
134
+ dag = SearchDAG.from_supports([{0, 1}, {1, 2}])
135
+ lo = np.array([0.72, 0.40, 0.30])
136
+ hi = np.array([0.80, 0.95, 0.55])
137
+ best_a, min_reg, regrets = exact_rectangular_regret(dag, lo, hi)
138
+ print(f"Best root action: {best_a}, exact regrets: {regrets.tolist()}")
139
+ # -> Best root action: 0, exact regrets: [0.0, 0.4]
140
+
141
+ # 2. Decision-aware Bayesian experimental design (CD-Joint vs. GP-OS vs. Correlated KG)
142
+ rng = np.random.default_rng(7)
143
+ dag = SearchDAG.from_supports([{0, 1, 2, 3}, {2, 3, 4, 5}, {4, 5, 6, 7}])
144
+ features = rng.normal(size=(8, 4))
145
+ kernel = features @ features.T + 0.05 * np.eye(8)
146
+ true_means = np.array([0.78, 0.72, 0.55, 0.50, 0.48, 0.42, 0.40, 0.35])
147
+
148
+ for policy in ("cd_joint", "gp_os", "kg"):
149
+ noise = np.random.default_rng(123)
150
+ res = certify_root_action(
151
+ dag=dag,
152
+ observe_fn=lambda z, r=noise: float(true_means[z] + r.normal(0.0, 0.15)),
153
+ kernel=kernel,
154
+ prior_mean=0.5,
155
+ obs_std=0.15,
156
+ policy=policy,
157
+ stopping="credible_ellipsoid", # rank-corrected sqrt(chi2_{r, 1-delta})
158
+ epsilon=0.03,
159
+ delta=0.05,
160
+ max_evals=500,
161
+ )
162
+ print(f"{policy:9s} | certified={res.certified} | action={res.action} | evals={res.steps}")
163
+ ```
164
+
165
+ ### 3. Library Architecture (`dagcert/`)
166
+
167
+ | Module | Paper Concepts | Key Public Exports |
168
+ |---|---|---|
169
+ | [`dagcert/graph.py`](https://github.com/AI-MathPhys/dag-cert/blob/main/dagcert/graph.py) | Finite all-MAX search DAG, shared root supports, support overlap | `SearchDAG` (`.from_supports`, `.root_supports`, `.root_regrets`, `.support_overlap_matrix`), `DAG`, `Problem`, `SupportStructure` |
170
+ | [`dagcert/certificates.py`](https://github.com/AI-MathPhys/dag-cert/blob/main/dagcert/certificates.py) | Exact rectangular regret, conic ellipsoidal dual, dual witness covers, bounded residuals | `exact_rectangular_regret`, `JointEllipsoidCertifier`, `check_ellipsoid_stopping`, `DualWitnessCovers`, `CanonicalIntervals`, `NestedIntervals`, `RobustAwareJointCertifier` |
171
+ | [`dagcert/posteriors.py`](https://github.com/AI-MathPhys/dag-cert/blob/main/dagcert/posteriors.py) | Conjugate Gaussian posterior, contrast rank $r$, $\sqrt{\chi^2_{r,1-\delta}}$, valid anytime posterior-risk MC | `SharedGaussianPosterior`, `contrast_rank_of_kernel`, `chi2_credible_beta`, `contrast_ellipsoid_coverage`, `eval_direct_posterior_risk_valid` |
172
+ | [`dagcert/acquisition.py`](https://github.com/AI-MathPhys/dag-cert/blob/main/dagcert/acquisition.py) | Decision-aware BED & BO baselines under matched posteriors | `certify_root_action`, `MatchedModelBEDSession`, `CDJointPolicy`, `CorrelatedKGPolicy`, `GPOSPolicy`, `BayesianVOIPolicy`, `GPUCBPolicy`, `GPTSPolicy`, `NoisyGPEIPolicy` |
173
+ | [`dagcert/tracking.py`](https://github.com/AI-MathPhys/dag-cert/blob/main/dagcert/tracking.py) | Optimal information tracking ($T_*^\varepsilon$), unknown-variance sparse V34 tracker | `RegularizedInfoTrackerSession`, `run_v34_tracker`, `CppV34BnBRunner`, `compute_characteristic_rate`, `solve_action_design_certified` |
174
+ | [`dagcert/search.py`](https://github.com/AI-MathPhys/dag-cert/blob/main/dagcert/search.py) | Passive trajectory-coupled UCT/PUCT certification monitors | `TrajectoryCoupledUCT`, `RootPUCT`, `RecursivePUCT`, `CertifiedSearchSession`, `CppKernelRunner` |
175
+ | [`dagcert/benchmarks/`](https://github.com/AI-MathPhys/dag-cert/tree/main/dagcert/benchmarks/) | Bundled synthetic, GB1/TmTrpB protein, WorFBench workflow & SameGame DAG loaders | `OverlapCorrelationDAGProblem`, `OffWitnessProxyDAGProblem`, `GB1MutationCampaignProblem`, `TrpBMutationCampaignProblem`, `WorFBenchWorkflowProblem`, `load_standard_samegame_boards` |
176
+ | [`dagcert/_native/`](https://github.com/AI-MathPhys/dag-cert/tree/main/dagcert/_native/) | Optional auto-compiled `-O3` C++17 accelerators | `_cpp_v12_kg.cpp`, `_cpp_v34_bnb.cpp`, `_cpp_kernels.cpp`, `_cpp_samegame.cpp` |
177
+
178
+ Standalone runnable library examples live in [`examples/`](https://github.com/AI-MathPhys/dag-cert/tree/main/examples/):
179
+
180
+ ```bash
181
+ python examples/quickstart_cd_joint.py # Fig. 1b + CD-Joint vs. GP-OS vs. KG + distribution-free
182
+ python examples/correlated_proxy.py # Low-valued off-witness proxy allocation (Fig. 2e)
183
+ python examples/protein_dag_demo.py # GB1 combinatorial mutation DAG certification
184
+ python examples/certify.py # Trajectory-coupled passive UCT monitor parity
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Headline Paper Results (Complete Coverage)
190
+
191
+ Every main-paper and appendix result is backed by executable code in `experiment/` and SHA-256-verified logs in `results/`.
192
+
193
+ | Paper Location | Finding | Domain & Suite |
194
+ |---|---|---|
195
+ | §2.3, Table 1 | Lazy conic certificate updates scale from $0.70\text{ ms}$ ($M=64$) to $25.7\text{ ms}$ ($M=4{,}096$) | `simulated` (`e6`) |
196
+ | §3.1, Table 3; App. G.1 (Tables 7–9, Fig. 3) | Matched-model $M=64, K=8$ factorial: CD-Joint needs **$2{,}358$** vs. Correlated KG **$5{,}056$** capped evals (**$2.14\times$** reduction; $2.53\times$ with overlap + correlation); **$1.65\times$** under anytime-valid $d=8$ frequentist stopping | `simulated` (`v12`) |
197
+ | §3.1, Fig. 2d, Table 10 | Exact outside-support stopping needs **$0.054\times$** the queries of marginal stopping at $M=256$, overlap $.88$ (**$18.4\times$**) | `simulated` (`exp1`) |
198
+ | §3.1, Fig. 2e, Tables 11 & 13 | CD-Joint routes **$76.8\%$** of queries to a low-valued proxy vs. **$0.6\%$** for direct-witness sampling; up to **$48.5\times$** lower median cost | `simulated` (`e0`, `v8_3`) |
199
+ | §3.2, Fig. 2f–h, Table 4; App. H (Tables 24–26, Fig. 8) | 410 paired GB1 ($n=200$) & TmTrpB ($n=210$) campaigns: under rank-corrected $\sqrt{\chi^2_{r,.95}}$ ellipsoid, CD-Joint needs **$17{,}678$** [70%] / **$3{,}629$** [100%] assays vs. KG **$25{,}000^*$** [0%] / **$9{,}337$** [85.7%] (**$2.57\times$** on TmTrpB); ranking reverses under direct posterior risk (KG **$130$/$63$** vs. CD-Joint **$240$/$92$**) and independent-arm DF ($0\%$ for GP-only CD-Joint) | `protein_engineering` (`v14`, `v13`) |
200
+ | §3.2, Table 27 | Empirical-Bayes protein audit: simultaneous terminal coverage $91.5\%$ / $82.9\%$, yet **$100\%$** root-regret-bound coverage across 410 campaigns | `protein_engineering` (`v11_1`) |
201
+ | §3.3, Table 5 (offline), Table 35 | WorFBench offline ($3^4=81$ workflows): OS certifies **$100\%$** in **$1{,}937$** median evals ($0.95\text{ M}$ tokens) vs. Flat-LUCB **$8{,}486$** ($4.78\text{ M}$ tokens) at identical held-out $F_1 = 0.529$ | `agentic_workflows` (`exp12`) |
202
+ | §3.3, Table 5 (live), Table 37, Fig. 9 | 36 fresh uncached Qwen3-0.6B campaigns across 4 domains: formal DF stops **$0/36$** by 60 evals; model-based EB+LOO certifies **$36/36$** in median **$24$** evals (**$14{,}291$** tokens, held-out $F_1 = 0.4717$) | `agentic_workflows` (`v11_2`) |
203
+ | App. J.3, Table 43, Fig. 13a | Unknown-variance sparse-refresh + action-local IUT tracker (V34): **$50.4\times$** speedup at $K=64$, rank 2 ($34.0\text{ s} \to 0.675\text{ s}$) | `simulated` (`v9_1`) |
204
+ | App. L.5–L.6, Tables 68–69, Fig. 14 | Native C++17 outward-certified B&B achieves **$31$–$82\times$** end-to-end speedup; zero-shared-code independent numerical-oracle audit passes **$5/5$** checks | `simulated` (`v10_1`, `v11_3`) |
205
+
206
+ ---
207
+
208
+ ## Reproducing the Paper (`experiment/`)
209
+
210
+ All experiments rely directly on the installed `dagcert` package and are organized into three domain folders mirroring Section 3 of the paper, plus unified plotting (`experiment/plots/`) and CLI (`experiment/run_all.py`):
211
+
212
+ - [`experiment/simulated/`](https://github.com/AI-MathPhys/dag-cert/tree/main/experiment/simulated/) — Section 3.1 + Appendices G, J, L (27 suites + `passive_uct/` v1 archive)
213
+ - [`experiment/protein_engineering/`](https://github.com/AI-MathPhys/dag-cert/tree/main/experiment/protein_engineering/) — Section 3.2 + Appendix H (10 GB1 & TmTrpB suites)
214
+ - [`experiment/agentic_workflows/`](https://github.com/AI-MathPhys/dag-cert/tree/main/experiment/agentic_workflows/) — Section 3.3 + Appendix I (WorFBench offline & live Qwen3-0.6B suites)
215
+ - [`experiment/plots/`](https://github.com/AI-MathPhys/dag-cert/tree/main/experiment/plots/) — All manuscript data figures (Figures 2–14: `figures/fig*.pdf`, `figures/supp_*.pdf`) in one shared style, plus detailed suite figures
216
+
217
+ ### Fast Verification (~2 minutes, CPU only, offline)
218
+
219
+ ```bash
220
+ # 1. Check bundled datasets, optional Hugging Face cache, and C++17 compiler
221
+ python scripts/fetch_data.py --check
222
+
223
+ # 2. Cryptographically verify SHA-256 manifests for ALL archived suites (v1--v14, zero gaps)
224
+ python experiment/run_all.py verify
225
+
226
+ # 3. Run all 88 unit, parity, library-API, and independent-oracle tests
227
+ python experiment/run_all.py test
228
+
229
+ # 4. Regenerate all 14 manuscript data figures (Figures 2–14: `figures/fig*.pdf`, `figures/supp_*.pdf`)
230
+ python experiment/run_all.py figures
231
+ ```
232
+
233
+ ### Running Individual Domains or Suites
234
+
235
+ ```bash
236
+ # List all 41 suites grouped by domain
237
+ python experiment/run_all.py list
238
+
239
+ # Fast non-destructive smoke tests (writes only to OS tempdir, never modifies results/)
240
+ python experiment/run_all.py benchmark --only v12 --smoke
241
+ python experiment/run_all.py benchmark --only v14 --smoke
242
+ python experiment/run_all.py benchmark --only e4 --smoke
243
+
244
+ # Re-run a full suite (or regenerate its CSV summaries from archived JSONL logs)
245
+ python experiment/run_all.py summaries --only v14
246
+ python experiment/run_all.py benchmark --domain protein_engineering --only v14
247
+ ```
248
+
249
+ ### Paper Section to Suite Key Map
250
+
251
+ See [`REPRODUCIBILITY.md`](https://github.com/AI-MathPhys/dag-cert/blob/main/REPRODUCIBILITY.md) for the complete table-by-table mapping across Tables 1–69 and Figures 1–14.
252
+
253
+ | Paper Section | Tables / Figures | Domain | Suite Keys |
254
+ |---|---|---|---|
255
+ | §2.3, App. L.1 (conic update scaling & break-even) | Tables 1, 57, 58 | `simulated` | `e6`, `v8_4` |
256
+ | §3.1, App. G.1, App. L.1 (matched BED vs. KG/VOI/BO & $d=8$ anytime) | Table 3, Tables 7–9, 14, 59; Fig. 3 | `simulated` | `v12` |
257
+ | §3.1, App. G.2–G.3 (structural overlap & correlated proxy mechanisms) | Fig. 2d–e, Tables 10–13, 15; Figs. 4–5 | `simulated` | `exp1`, `e0`, `e1`, `e2`, `v8_3` |
258
+ | App. G.4–G.5 (DF baselines, witness ablations, SameGame & routing) | Tables 16–23; Figs. 6–7 | `simulated` | `exp5`, `exp6`, `exp8`–`exp11`, `v8_6` |
259
+ | §3.2, App. H.1–H.4 (matched GB1 & TmTrpB BED vs. KG & $\chi^2_{r,.95}$ audit) | Fig. 2f–h, Table 4, Tables 24–26; Fig. 8 | `protein_engineering` | `v14`, `v13` |
260
+ | §3.2, App. H.5–H.6 (calibration, validity ablation, extended GB1/TmTrpB) | Tables 27–34; Fig. 11 | `protein_engineering` | `v11_1`, `v8_1`, `exp12`–`exp14`, `e3` |
261
+ | §3.3, App. I (WorFBench offline & live uncached Qwen3-0.6B workflows) | Table 5, Tables 35–39; Figs. 9, 14c | `agentic_workflows` | `exp12`, `exp13`, `v11_2`, `v10_3`, `v8_5` |
262
+ | App. J.1–J.4 (info tracking, unknown variance V34, heteroscedastic bridge) | Tables 40–50; Figs. 10–13, 14b | `simulated` / `protein_engineering` | `v8_2`, `e5`, `v8_1`, `v9_1`–`v9_4`, `v10_2`, `v11_1` |
263
+ | App. J.5, L.2–L.4 (passive UCT/PUCT, C++ maintenance kernels, memory) | Tables 51–56, 60–67 | `simulated` | `passive_uct/`, `exp2`–`exp4`, `exp7` |
264
+ | App. L.5–L.6 (native C++17 B&B scaling, independent oracle audit) | Tables 68–69; Fig. 14a | `simulated` | `v10_1`, `v11_3` |
265
+
266
+ ---
267
+
268
+ ## External Data & Models (`scripts/fetch_data.py`)
269
+
270
+ Four compact preprocessed `.npz` archives (`dagcert/benchmarks/data/`, 1.7 MB) and the 20-board SameGame set are bundled in Git so installation, verification, unit tests, and all CPU experiments run offline. Every upstream source can also be downloaded and rebuilt from scratch:
271
+
272
+ | Dataset / Asset | Upstream Source | Bundled File | Rebuild Command |
273
+ |---|---|---|---|
274
+ | GB1 (149,361 four-site variants; Wu et al. 2016) | [FLIP](https://github.com/J-SNACKKB/FLIP) | `dagcert/benchmarks/data/gb1_wu2016_measured.npz` | `python scripts/fetch_data.py --proteins` |
275
+ | TmTrpB (159,129 four-site variants; Johnston et al. 2024) | [Zenodo 15203754](https://zenodo.org/records/15203754) | `dagcert/benchmarks/data/trpb_johnston2024_measured.npz` | `python scripts/fetch_data.py --proteins` |
276
+ | WorFBench raw trajectories (4 domains) | [zjunlp/WorfBench](https://github.com/zjunlp/WorfBench) | cached in `dagcert/benchmarks/data/worfbench_raw/` | `python scripts/fetch_data.py --worfbench-tasks` |
277
+ | `Qwen/Qwen3-0.6B` & `Qwen/Qwen3-Embedding-0.6B` | Hugging Face Hub | local Hugging Face cache | `python scripts/fetch_data.py --models` |
278
+ | WorFBench $81\times 64$ & $81\times 32$ score matrices | generated from above | `dagcert/benchmarks/data/worfbench_qwen3_*.npz` | `python scripts/fetch_data.py --rebuild-worfbench` |
279
+
280
+ Pass `--out-dir build/rebuilt_data` to rebuild alongside the bundled files for comparison, or `--all` to fetch everything. After caching models and trajectories, set `HF_HUB_OFFLINE=1` to run live LLM suites offline.
281
+
282
+ ---
283
+
284
+ ## Lean 4 Formalizations (`lean/`)
285
+
286
+ The [`lean/`](lean/) directory holds a Lean 4 + Mathlib formalization of the paper's numbered results, with no `sorry` and no added axioms. Of the 62 results, 62 are proved as written up to harmless differences, 0 are false as written, 0 are proved only in a corrected or reformulated form because the manuscript statement is not established as written, and 0 are open, according to independent clause-by-clause reviews. [`lean/README.md`](lean/README.md) gives, for every result, the Lean theorem names and exactly how the formal statement relates to the manuscript, a list of hypotheses the manuscript leaves implicit, and the limits of the formalization (for example: algorithms are specified by their selection rules, numerical oracles enter through the paper's contract, and running-time claims hold in an explicit step-counting model).
287
+
288
+ Build with `cd lean && lake exe cache get && lake build` (Lean toolchain pinned in [`lean/lean-toolchain`](lean/lean-toolchain)).
289
+
290
+ ---
291
+
292
+ ## Repository Structure
293
+
294
+ ```text
295
+ dag-cert/
296
+ ├── dagcert/ # Installable Python library (`pip install dagcert` / `-e .`)
297
+ │ ├── graph.py # SearchDAG, SupportStructure, regret & overlap utilities
298
+ │ ├── certificates.py # Rectangular, conic ellipsoidal, witness-cover & DF bounds
299
+ │ ├── posteriors.py # SharedGaussianPosterior, contrast rank, chi2 beta, post.-risk MC
300
+ │ ├── acquisition.py # certify_root_action, CD-Joint, Correlated KG, GP-OS, VOI, BO
301
+ │ ├── tracking.py # Info-tracking (T_*^eps) & V34 unknown-variance sparse tracker
302
+ │ ├── search.py # Trajectory-coupled passive UCT & PUCT certification
303
+ │ ├── benchmarks/ # Synthetic, GB1/TmTrpB, WorFBench & SameGame loaders + data/
304
+ │ ├── _native/ # Optional auto-compiled -O3 C++17 accelerators
305
+ │ └── _core/ # Verified low-level numerical engines
306
+ ├── experiment/ # Complete paper experiments organized by domain
307
+ │ ├── run_all.py # Unified CLI: list, verify, test, summaries, figures, benchmark
308
+ │ ├── simulated/ # §3.1 + App. G, J, L (27 suites + passive_uct/ v1 archive)
309
+ │ ├── protein_engineering/ # §3.2 + App. H (10 GB1 & TmTrpB suites)
310
+ │ ├── agentic_workflows/ # §3.3 + App. I (WorFBench offline & live Qwen3-0.6B suites)
311
+ │ └── plots/ # Generates manuscript Figures 2–14 + detailed suite plots
312
+ ├── examples/ # Standalone library quickstart & domain demos
313
+ ├── tests/ # 88 unit, parity, library-API & oracle tests (v1--v14)
314
+ ├── results/ # SHA-256-verified run archives, CSV summaries & manifests
315
+ ├── figures/ # README overview PNG + manuscript Figures 2–14 (vector PDF)
316
+ ├── scripts/fetch_data.py # Offline verifier & upstream data/model rebuild utility
317
+ ├── lean/ # Lean 4 + Mathlib formal proofs (status in lean/README.md)
318
+ ├── manuscript/ # Paper PDF & LaTeX source
319
+ ├── reference/tables/ # Reference LaTeX tables for passive UCT archive
320
+ ├── .github/workflows/ # CI (Linux and macOS) and PyPI release on version tags
321
+ ├── pyproject.toml # Package metadata and optional extras
322
+ ├── CITATION.cff # Machine-readable citation metadata
323
+ └── REPRODUCIBILITY.md # Complete Table 1--69 & Figure 1--14 artifact map
324
+ ```
325
+
326
+ ---
327
+
328
+ ## Statistical Scope & Notes
329
+
330
+ - **Validity depends on the stopping model.** Bounded-observation Hoeffding and Empirical Bernstein boxes are distribution-free; fixed-feature ellipsoids and unknown-variance nuisance-KL e-processes provide anytime frequentist coverage under their respective parametric assumptions; bounded-residual ellipsoids require a misspecification bound $|b|\le\xi$; Bayesian credible ellipsoids, direct posterior risk, and EB+LOO stopping are model-based and do not inherit distribution-free validity (Table 2 and Appendix C).
331
+ - **Protein & live-LLM experiments.** Protein benchmarks simulate noisy assays against published measured GB1 and TmTrpB landscapes (no new wet-lab experiments). Live workflow suites execute fresh, uncached `Qwen3-0.6B` inference on task pools strictly disjoint from calibration.
332
+ - **Determinism vs. timing.** Statistical trajectories, operation counts, and SHA-256 manifests are deterministic; wall-clock times and wall-capped rates depend on host hardware.
333
+
334
+ ---
335
+
336
+ ## Citation
337
+
338
+ If you use `dagcert` or this codebase in your research, please cite the accompanying manuscript (see also [`CITATION.cff`](https://github.com/AI-MathPhys/dag-cert/blob/main/CITATION.cff)):
339
+
340
+ ```bibtex
341
+ @misc{pelissier2026dagcert,
342
+ title = {Certify the Decision, Not the Outcome: Bayesian Experimental Design on Search Graphs},
343
+ author = {P{\'e}lissier, Aur{\'e}lien},
344
+ year = {2026},
345
+ url = {https://github.com/AI-MathPhys/dag-cert}
346
+ }
347
+ ```