evalrx 0.1.2__py3-none-any.whl
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.
- evalrx/__init__.py +139 -0
- evalrx/agent_assets/__init__.py +2 -0
- evalrx/agent_assets/skills/README.md +28 -0
- evalrx/agent_assets/skills/eval-chart-style/SKILL.md +172 -0
- evalrx/agent_assets/skills/evalrx-report-ui/SKILL.md +116 -0
- evalrx/agent_assets/skills/nature-figure/LICENSE +201 -0
- evalrx/agent_assets/skills/nature-figure/README.md +412 -0
- evalrx/agent_assets/skills/nature-figure/SKILL.md +60 -0
- evalrx/agent_assets/skills/nature-figure/manifest.yaml +59 -0
- evalrx/agent_assets/skills/nature-figure/references/api.md +436 -0
- evalrx/agent_assets/skills/nature-figure/references/backend-selection.md +100 -0
- evalrx/agent_assets/skills/nature-figure/references/chart-types.md +281 -0
- evalrx/agent_assets/skills/nature-figure/references/common-patterns.md +350 -0
- evalrx/agent_assets/skills/nature-figure/references/demos.md +65 -0
- evalrx/agent_assets/skills/nature-figure/references/design-theory.md +439 -0
- evalrx/agent_assets/skills/nature-figure/references/figure-contract.md +93 -0
- evalrx/agent_assets/skills/nature-figure/references/figure-legend-conventions.md +71 -0
- evalrx/agent_assets/skills/nature-figure/references/nature-2026-observations.md +112 -0
- evalrx/agent_assets/skills/nature-figure/references/qa-contract.md +119 -0
- evalrx/agent_assets/skills/nature-figure/references/r-template-index.md +66 -0
- evalrx/agent_assets/skills/nature-figure/references/r-workflow.md +161 -0
- evalrx/agent_assets/skills/nature-figure/references/tutorials.md +251 -0
- evalrx/agent_assets/skills/nature-figure/static/core/contract.md +29 -0
- evalrx/agent_assets/skills/nature-figure/static/core/stance.md +37 -0
- evalrx/agent_assets/skills/nature-figure/static/fragments/backend/python.md +37 -0
- evalrx/agent_assets/skills/nature-figure/static/fragments/backend/r.md +44 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/SKILL.md +213 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/assets/analysis_report_template.md +53 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/references/model_selection.md +72 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/scripts/explanatory_var_eda.R +130 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/scripts/explanatory_var_eda.py +150 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/scripts/fit_outcome_model.R +181 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/scripts/fit_outcome_model.py +186 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/scripts/univariate_eda.R +149 -0
- evalrx/agent_assets/skills/outcome-driver-analysis/scripts/univariate_eda.py +177 -0
- evalrx/agent_assets/skills.py +27 -0
- evalrx/agent_runtime/__init__.py +78 -0
- evalrx/agent_runtime/_docker_runner.py +89 -0
- evalrx/agent_runtime/cli_runtime.py +103 -0
- evalrx/agent_runtime/cli_transcript.py +138 -0
- evalrx/agent_runtime/cli_types.py +68 -0
- evalrx/agent_runtime/codegen/__init__.py +5 -0
- evalrx/agent_runtime/codegen/runner.py +94 -0
- evalrx/agent_runtime/experiment_harness.py +117 -0
- evalrx/agent_runtime/factory.py +102 -0
- evalrx/agent_runtime/json_shape.py +44 -0
- evalrx/agent_runtime/judges/__init__.py +28 -0
- evalrx/agent_runtime/judges/agy.py +179 -0
- evalrx/agent_runtime/judges/autodetect.py +135 -0
- evalrx/agent_runtime/judges/claude.py +159 -0
- evalrx/agent_runtime/judges/codex.py +120 -0
- evalrx/agent_runtime/providers/__init__.py +21 -0
- evalrx/agent_runtime/providers/antigravity.py +31 -0
- evalrx/agent_runtime/providers/base.py +145 -0
- evalrx/agent_runtime/providers/claude_code.py +49 -0
- evalrx/agent_runtime/providers/codex.py +37 -0
- evalrx/agent_runtime/providers/gemini_cli.py +26 -0
- evalrx/agent_runtime/providers/kimi_cli.py +27 -0
- evalrx/agent_runtime/providers/opencode.py +27 -0
- evalrx/agent_runtime/providers/registry.py +58 -0
- evalrx/agent_runtime/sandbox.py +517 -0
- evalrx/agent_runtime/skill_audit.py +143 -0
- evalrx/agent_runtime/skills/__init__.py +19 -0
- evalrx/agent_runtime/skills/installer.py +68 -0
- evalrx/agent_runtime/skills/prompt_policy.py +86 -0
- evalrx/agent_runtime/skills/resolver.py +19 -0
- evalrx/analysis/__init__.py +132 -0
- evalrx/analysis/adjudicate.py +154 -0
- evalrx/analysis/analysis_module.py +361 -0
- evalrx/analysis/api.py +171 -0
- evalrx/analysis/case_studio.py +651 -0
- evalrx/analysis/cli.py +114 -0
- evalrx/analysis/dashboard.py +350 -0
- evalrx/analysis/eval_case_matrix.py +118 -0
- evalrx/analysis/eval_viz_theme.py +833 -0
- evalrx/analysis/explore_run.py +333 -0
- evalrx/analysis/explorer.py +1276 -0
- evalrx/analysis/failure_modes.py +607 -0
- evalrx/analysis/fused_pipeline.py +489 -0
- evalrx/analysis/holdout.py +300 -0
- evalrx/analysis/hypothesis_agent.py +230 -0
- evalrx/analysis/narration.py +177 -0
- evalrx/analysis/operationalize.py +442 -0
- evalrx/analysis/plain_language.py +42 -0
- evalrx/analysis/planner.py +283 -0
- evalrx/analysis/probe_search.py +203 -0
- evalrx/analysis/profile.py +268 -0
- evalrx/analysis/prompts/__init__.py +0 -0
- evalrx/analysis/prompts/explorer.py +417 -0
- evalrx/analysis/prompts/failure_modes.py +33 -0
- evalrx/analysis/prompts/holdout.py +27 -0
- evalrx/analysis/prompts/hypothesis_agent.py +78 -0
- evalrx/analysis/prompts/run_codebase.py +47 -0
- evalrx/analysis/prompts/stats_agent.py +72 -0
- evalrx/analysis/prompts/stats_tool_generator.py +43 -0
- evalrx/analysis/result_marker.py +47 -0
- evalrx/analysis/run_codebase.py +242 -0
- evalrx/analysis/run_view.py +205 -0
- evalrx/analysis/stage_views.py +93 -0
- evalrx/analysis/stats_agent.py +944 -0
- evalrx/analysis/stats_tool_agent.py +261 -0
- evalrx/analysis/stats_tool_generator.py +415 -0
- evalrx/analysis/stats_tools.py +1153 -0
- evalrx/analysis/trajectory_records.py +193 -0
- evalrx/analysis/workbench.py +431 -0
- evalrx/analyzers/__init__.py +42 -0
- evalrx/analyzers/agent/__init__.py +25 -0
- evalrx/analyzers/agent/counterfactual.py +84 -0
- evalrx/analyzers/agent/first_error_judge.py +96 -0
- evalrx/analyzers/agent/ignored_obs.py +81 -0
- evalrx/analyzers/agent/loop_detect.py +79 -0
- evalrx/analyzers/agent/reliability.py +165 -0
- evalrx/analyzers/agent/tool_shap.py +225 -0
- evalrx/analyzers/agent/trajectory_rubric.py +168 -0
- evalrx/analyzers/attention/__init__.py +19 -0
- evalrx/analyzers/attention/relative_attn.py +610 -0
- evalrx/analyzers/attention/rollout.py +73 -0
- evalrx/analyzers/attention/sink.py +56 -0
- evalrx/analyzers/attention/summary.py +190 -0
- evalrx/analyzers/attribution/__init__.py +6 -0
- evalrx/analyzers/attribution/generic_attn.py +31 -0
- evalrx/analyzers/attribution/gradcam.py +30 -0
- evalrx/analyzers/base.py +12 -0
- evalrx/analyzers/geometry/__init__.py +6 -0
- evalrx/analyzers/geometry/cka.py +70 -0
- evalrx/analyzers/geometry/linear_probe.py +157 -0
- evalrx/analyzers/hallucination/__init__.py +9 -0
- evalrx/analyzers/hallucination/chair.py +78 -0
- evalrx/analyzers/hallucination/opera.py +29 -0
- evalrx/analyzers/hallucination/pope.py +119 -0
- evalrx/analyzers/hallucination/selfcheck.py +155 -0
- evalrx/analyzers/hallucination/vcd.py +29 -0
- evalrx/analyzers/lens/__init__.py +7 -0
- evalrx/analyzers/lens/layer_contrast.py +133 -0
- evalrx/analyzers/lens/logit_lens.py +138 -0
- evalrx/analyzers/lens/tuned_lens.py +30 -0
- evalrx/analyzers/patching/__init__.py +5 -0
- evalrx/analyzers/patching/causal_trace.py +30 -0
- evalrx/analyzers/perturbation/__init__.py +23 -0
- evalrx/analyzers/perturbation/_shapley.py +54 -0
- evalrx/analyzers/perturbation/context_shap.py +174 -0
- evalrx/analyzers/perturbation/cot_faithfulness.py +239 -0
- evalrx/analyzers/perturbation/format_sensitivity.py +237 -0
- evalrx/analyzers/perturbation/mm_shap.py +146 -0
- evalrx/analyzers/perturbation/modality_ablation.py +196 -0
- evalrx/analyzers/perturbation/perturbation_battery.py +274 -0
- evalrx/analyzers/perturbation/prompt_contrast.py +265 -0
- evalrx/analyzers/perturbation/rise.py +94 -0
- evalrx/analyzers/perturbation/vl_shap.py +102 -0
- evalrx/analyzers/reasoning/__init__.py +33 -0
- evalrx/analyzers/reasoning/_text.py +328 -0
- evalrx/analyzers/reasoning/answer_extraction_audit.py +327 -0
- evalrx/analyzers/reasoning/arith_audit.py +226 -0
- evalrx/analyzers/reasoning/contamination.py +214 -0
- evalrx/analyzers/reasoning/knowledge_split.py +253 -0
- evalrx/analyzers/reasoning/self_repair.py +246 -0
- evalrx/analyzers/reasoning/step_rollout_value.py +216 -0
- evalrx/analyzers/reasoning/termination_audit.py +258 -0
- evalrx/analyzers/uncertainty/__init__.py +18 -0
- evalrx/analyzers/uncertainty/calibration.py +174 -0
- evalrx/analyzers/uncertainty/coverage_gap.py +199 -0
- evalrx/analyzers/uncertainty/entropy.py +90 -0
- evalrx/analyzers/uncertainty/logprob_entropy.py +69 -0
- evalrx/analyzers/uncertainty/self_consistency.py +204 -0
- evalrx/analyzers/uncertainty/verbalized_conf.py +64 -0
- evalrx/cli.py +411 -0
- evalrx/config.py +77 -0
- evalrx/contract/__init__.py +179 -0
- evalrx/contract/common.py +452 -0
- evalrx/contract/emit.py +948 -0
- evalrx/contract/export.py +237 -0
- evalrx/contract/m1.py +325 -0
- evalrx/contract/m2.py +317 -0
- evalrx/contract/m3.py +165 -0
- evalrx/contract/m4.py +130 -0
- evalrx/contract/m5.py +292 -0
- evalrx/contract/methodology.py +76 -0
- evalrx/contract/pre_m1.py +58 -0
- evalrx/contract/typescript.py +140 -0
- evalrx/core/__init__.py +85 -0
- evalrx/core/analyzer.py +174 -0
- evalrx/core/capability.py +54 -0
- evalrx/core/case.py +443 -0
- evalrx/core/experiment.py +106 -0
- evalrx/core/model.py +198 -0
- evalrx/core/pipeline.py +42 -0
- evalrx/core/registry.py +142 -0
- evalrx/core/result.py +64 -0
- evalrx/core/spec.py +173 -0
- evalrx/core/tokentype.py +165 -0
- evalrx/core/tool.py +92 -0
- evalrx/datasets/__init__.py +41 -0
- evalrx/datasets/base.py +68 -0
- evalrx/datasets/gui_os.py +52 -0
- evalrx/datasets/llm_qa.py +57 -0
- evalrx/datasets/pure_qa.py +12 -0
- evalrx/datasets/vlm_qa.py +695 -0
- evalrx/datasets/web_search_qa.py +52 -0
- evalrx/eval_agent/__init__.py +341 -0
- evalrx/eval_agent/_tools.py +81 -0
- evalrx/eval_agent/ab_runner.py +50 -0
- evalrx/eval_agent/agentic/__init__.py +43 -0
- evalrx/eval_agent/agentic/actions.py +216 -0
- evalrx/eval_agent/agentic/board.py +107 -0
- evalrx/eval_agent/agentic/loop.py +190 -0
- evalrx/eval_agent/agentic/tools.py +538 -0
- evalrx/eval_agent/checkpoint.py +57 -0
- evalrx/eval_agent/cli_agent.py +59 -0
- evalrx/eval_agent/cli_skills.py +5 -0
- evalrx/eval_agent/evolution.py +396 -0
- evalrx/eval_agent/git_manager.py +215 -0
- evalrx/eval_agent/hypothesis.py +172 -0
- evalrx/eval_agent/label_quarantine.py +209 -0
- evalrx/eval_agent/legacy.py +530 -0
- evalrx/eval_agent/log_schema.py +497 -0
- evalrx/eval_agent/loop.py +2159 -0
- evalrx/eval_agent/loop_reports.py +116 -0
- evalrx/eval_agent/model_instrumentation.py +282 -0
- evalrx/eval_agent/narration.py +193 -0
- evalrx/eval_agent/nl_runner.py +460 -0
- evalrx/eval_agent/orchestrator.py +61 -0
- evalrx/eval_agent/preregister.py +93 -0
- evalrx/eval_agent/prompts/__init__.py +1 -0
- evalrx/eval_agent/prompts/agentic.py +46 -0
- evalrx/eval_agent/prompts/case_discovery.py +25 -0
- evalrx/eval_agent/prompts/diagnosis.py +125 -0
- evalrx/eval_agent/prompts/experiment_writer.py +265 -0
- evalrx/eval_agent/prompts/explore_step.py +37 -0
- evalrx/eval_agent/prompts/fix_agent.py +257 -0
- evalrx/eval_agent/prompts/hypothesis_tester.py +15 -0
- evalrx/eval_agent/prompts/nl_runner.py +38 -0
- evalrx/eval_agent/prompts/probe_agent.py +25 -0
- evalrx/eval_agent/prompts/probe_candidate_generator.py +14 -0
- evalrx/eval_agent/prompts/probe_generator.py +35 -0
- evalrx/eval_agent/prompts/whitebox_probe_generator.py +38 -0
- evalrx/eval_agent/report.py +58 -0
- evalrx/eval_agent/run_context.py +354 -0
- evalrx/eval_agent/run_log.schema.json +1215 -0
- evalrx/eval_agent/run_logger_v2.py +1764 -0
- evalrx/eval_agent/run_metadata.py +208 -0
- evalrx/eval_agent/stages/__init__.py +56 -0
- evalrx/eval_agent/stages/case_discovery.py +293 -0
- evalrx/eval_agent/stages/diagnosis.py +1017 -0
- evalrx/eval_agent/stages/experiment_writer.py +1634 -0
- evalrx/eval_agent/stages/fix_agent.py +3916 -0
- evalrx/eval_agent/stages/fix_internals.py +499 -0
- evalrx/eval_agent/stages/fix_pipeline.py +725 -0
- evalrx/eval_agent/stages/fix_tiers.py +187 -0
- evalrx/eval_agent/stages/fix_tools.py +1034 -0
- evalrx/eval_agent/stages/hypothesis_tester.py +1014 -0
- evalrx/eval_agent/stages/probe.py +439 -0
- evalrx/eval_agent/stages/probe_agent.py +1079 -0
- evalrx/eval_agent/stages/probe_candidate_generator.py +128 -0
- evalrx/eval_agent/stages/probe_generator.py +326 -0
- evalrx/eval_agent/stages/probe_search_agent.py +106 -0
- evalrx/eval_agent/stages/protocol.py +112 -0
- evalrx/eval_agent/stages/repair_catalog.py +273 -0
- evalrx/eval_agent/stages/surgery.py +524 -0
- evalrx/eval_agent/stages/whitebox_probe_generator.py +351 -0
- evalrx/eval_agent/store.py +231 -0
- evalrx/logging_utils.py +112 -0
- evalrx/models/__init__.py +161 -0
- evalrx/models/_discover.py +101 -0
- evalrx/models/agent.py +380 -0
- evalrx/models/backends/__init__.py +58 -0
- evalrx/models/backends/api.py +169 -0
- evalrx/models/backends/base.py +57 -0
- evalrx/models/backends/gemini_compat.py +579 -0
- evalrx/models/backends/hf_local.py +2074 -0
- evalrx/models/backends/openai_compat.py +301 -0
- evalrx/models/backends/vllm_offline.py +116 -0
- evalrx/models/base.py +24 -0
- evalrx/models/blackbox/__init__.py +4 -0
- evalrx/models/blackbox/agent.py +31 -0
- evalrx/models/blackbox/base.py +29 -0
- evalrx/models/blackbox/gemini.py +279 -0
- evalrx/models/blackbox/llm_api.py +17 -0
- evalrx/models/blackbox/vlm_api.py +17 -0
- evalrx/models/compose.py +66 -0
- evalrx/models/inference.py +88 -0
- evalrx/models/paper_methods/__init__.py +8 -0
- evalrx/models/paper_methods/aad.py +53 -0
- evalrx/models/paper_methods/ifcd.py +204 -0
- evalrx/models/paper_methods/pai.py +164 -0
- evalrx/models/paper_methods/tcd.py +202 -0
- evalrx/models/paper_methods/vcd.py +45 -0
- evalrx/models/paper_methods/vicrop.py +137 -0
- evalrx/models/toolcodec.py +143 -0
- evalrx/models/tools/__init__.py +20 -0
- evalrx/models/tools/perception.py +300 -0
- evalrx/models/tools/visual.py +174 -0
- evalrx/models/whitebox/__init__.py +26 -0
- evalrx/models/whitebox/agent.py +31 -0
- evalrx/models/whitebox/base.py +24 -0
- evalrx/models/whitebox/qwen.py +61 -0
- evalrx/models/whitebox/qwen2_5_omni.py +29 -0
- evalrx/models/whitebox/qwen2_audio.py +25 -0
- evalrx/models/whitebox/qwen_omni.py +53 -0
- evalrx/models/whitebox/qwen_vl.py +62 -0
- evalrx/observability/__init__.py +21 -0
- evalrx/observability/envelope.py +122 -0
- evalrx/observability/outbox.py +111 -0
- evalrx/observability/tracer.py +882 -0
- evalrx/reporting/__init__.py +28 -0
- evalrx/reporting/case_study.py +947 -0
- evalrx/reporting/compiler.py +587 -0
- evalrx/reporting/dynamic.py +1882 -0
- evalrx/reporting/html_report.py +2225 -0
- evalrx/reporting/langfuse_exporter.py +38 -0
- evalrx/reporting/langfuse_source.py +155 -0
- evalrx/reporting/model.py +151 -0
- evalrx/reporting/run_events.py +184 -0
- evalrx/reporting/server.py +557 -0
- evalrx/reporting/stages.py +58 -0
- evalrx/reporting/static_export.py +142 -0
- evalrx/reporting/web_dist/index.html +146 -0
- evalrx/specs.py +727 -0
- evalrx/stats/__init__.py +47 -0
- evalrx/stats/api.py +192 -0
- evalrx/stats/bootstrap.py +86 -0
- evalrx/stats/ebh.py +27 -0
- evalrx/stats/evalue.py +98 -0
- evalrx/stats/friedman.py +138 -0
- evalrx/stats/mcnemar.py +40 -0
- evalrx/stats/multiplicity.py +159 -0
- evalrx/stats/subset_sampling.py +55 -0
- evalrx/term_links.py +43 -0
- evalrx/viz/__init__.py +7 -0
- evalrx/viz/labels.py +77 -0
- evalrx/viz/prompts.py +39 -0
- evalrx/viz/renderer.py +590 -0
- evalrx/viz/schema.py +36 -0
- evalrx/viz/style.py +134 -0
- evalrx-0.1.2.dist-info/METADATA +532 -0
- evalrx-0.1.2.dist-info/RECORD +339 -0
- evalrx-0.1.2.dist-info/WHEEL +5 -0
- evalrx-0.1.2.dist-info/entry_points.txt +3 -0
- evalrx-0.1.2.dist-info/licenses/LICENSE +121 -0
- evalrx-0.1.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Web-search-augmented QA loader → CaseBatch (multi-hop / retrieval-dependent QA).
|
|
2
|
+
|
|
3
|
+
Same shape as PureQA, but records may carry a ``context`` (retrieved passages) and
|
|
4
|
+
a ``requires_retrieval`` flag; cases are tagged ``web_search`` so analyzers /
|
|
5
|
+
A/B strategies can condition on them. Records / JSONL / built-in sample.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from evalrx.core.case import CaseBatch
|
|
11
|
+
from evalrx.datasets.base import Dataset, cases_from_records, read_jsonl
|
|
12
|
+
|
|
13
|
+
_SAMPLE = [
|
|
14
|
+
{"question": "In what year did the author of 'The Origin of Species' publish it?",
|
|
15
|
+
"answer": "1859", "requires_retrieval": True, "hops": 2},
|
|
16
|
+
{"question": "What is the population of the capital of Japan?",
|
|
17
|
+
"answer": "Tokyo", "requires_retrieval": True, "hops": 2},
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class WebSearchQADataset(Dataset):
|
|
22
|
+
"""QA with (optional) retrieved web context."""
|
|
23
|
+
|
|
24
|
+
def __init__(
|
|
25
|
+
self,
|
|
26
|
+
records: list[dict] | None = None,
|
|
27
|
+
path: str | None = None,
|
|
28
|
+
*,
|
|
29
|
+
prompt_key: str = "question",
|
|
30
|
+
answer_key: str = "answer",
|
|
31
|
+
) -> None:
|
|
32
|
+
self._records = records
|
|
33
|
+
self._path = path
|
|
34
|
+
self._keys = dict(prompt_key=prompt_key, answer_key=answer_key)
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_records(cls, records: list[dict], **keys) -> "WebSearchQADataset":
|
|
38
|
+
return cls(records=records, **keys)
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def from_jsonl(cls, path: str, **keys) -> "WebSearchQADataset":
|
|
42
|
+
return cls(path=path, **keys)
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def sample(cls) -> "WebSearchQADataset":
|
|
46
|
+
return cls(records=_SAMPLE)
|
|
47
|
+
|
|
48
|
+
def load(self) -> CaseBatch:
|
|
49
|
+
records = self._records if self._records is not None else (
|
|
50
|
+
read_jsonl(self._path) if self._path else _SAMPLE
|
|
51
|
+
)
|
|
52
|
+
return cases_from_records(records, tags={"web_search"}, **self._keys)
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"""Self-evolving evaluation agent — automated failure discovery and diagnosis.
|
|
2
|
+
|
|
3
|
+
Two loops are available:
|
|
4
|
+
|
|
5
|
+
AutoDiagnoseLoop M1 → M2 → M3 → M5 (legacy, four-stage sweep)
|
|
6
|
+
VLDiagnoseLoop M1 → M2 → M3 → M4 inner loop, M5 called post-loop (Plan A)
|
|
7
|
+
Stops when M4 finds a statistically supported,
|
|
8
|
+
protocol-consistent hypothesis.
|
|
9
|
+
|
|
10
|
+
Stage modules live in ``stages/``; shared infrastructure stays at the top level.
|
|
11
|
+
The CLI-agent runtime (sandboxing, code generation, providers, judge models,
|
|
12
|
+
skills) lives in ``evalrx.agent_runtime`` — shared with ``evalrx.analysis``
|
|
13
|
+
so neither package depends on the other. ``cli_agent.py`` / ``cli_skills.py``
|
|
14
|
+
remain here as compatibility facades over that runtime.
|
|
15
|
+
|
|
16
|
+
Top-level (shared / orchestration):
|
|
17
|
+
loop.py AutoDiagnoseLoop, VLDiagnoseLoop, SelfEvolveLoop
|
|
18
|
+
run_logger_v2.py RunLoggerV2 — run.json + per-stage M<n>/log.json event log
|
|
19
|
+
hypothesis.py Hypothesis, HypothesisStatus, serialization helpers
|
|
20
|
+
cli_agent.py compatibility facade over agent_runtime CLI providers/judges
|
|
21
|
+
cli_skills.py compatibility facade over agent_runtime.skills.installer
|
|
22
|
+
store.py Store / InMemoryStore / JsonlStore — persistent memory
|
|
23
|
+
orchestrator.py thin facade over the loop (pre-registered A/B)
|
|
24
|
+
ab_runner.py A/B execution across prompting strategies
|
|
25
|
+
report.py DiagnosticReport — final diagnostic conclusions
|
|
26
|
+
evolution.py EvolutionStore — JSONL lesson store, 30-day half-life decay
|
|
27
|
+
preregister.py pre-registration helpers (DataSplit, PreregisteredHypothesis)
|
|
28
|
+
git_manager.py git-native experiment versioning (eval/{run_id} branches)
|
|
29
|
+
|
|
30
|
+
evalrx.agent_runtime (shared CLI-agent runtime, imports neither analysis nor eval_agent):
|
|
31
|
+
cli_types.py CliAgentConfig / CliAgentResult
|
|
32
|
+
cli_runtime.py SubprocessRunner, ProcessRun, collect_py_files
|
|
33
|
+
sandbox.py ExperimentSandbox, SandboxProtocol
|
|
34
|
+
experiment_harness.py immutable evaluation harness injected into projects
|
|
35
|
+
factory.py sandbox factory (subprocess / docker backends)
|
|
36
|
+
providers/ CLI coding-provider adapters and registry
|
|
37
|
+
judges/ CLI-backed judge model wrappers (agy / Claude Code)
|
|
38
|
+
codegen/ shared code-generation runner used by stages
|
|
39
|
+
skills/ skill resolution, installation, and prompt policy
|
|
40
|
+
|
|
41
|
+
stages/ (M1–M4 implementation):
|
|
42
|
+
probe.py M1 — StrategyProbe: model-kind detection + analyzer ranking
|
|
43
|
+
probe_agent.py M1 — ProbeAgent: execute ranked analyzers (direct or Docker);
|
|
44
|
+
protocol-guided via ExperimentProtocol.probe_hints();
|
|
45
|
+
tier(b) generates a bespoke probe when no analyzer fits
|
|
46
|
+
probe_generator.py M1 tier(b) — ProbeGenerator: host collects model outputs,
|
|
47
|
+
an LLM/CLI writes a probe over them, run in a sandbox,
|
|
48
|
+
parse PROBE_RESULT_JSON into a Result (per_case findings)
|
|
49
|
+
protocol.py M1 — ExperimentProtocol (NL description → probe hints);
|
|
50
|
+
ProbingSchema (records M1 selection rationale)
|
|
51
|
+
analysis.py M2 — AnalysisModule: threshold rules → AnalysisReport
|
|
52
|
+
stats_agent.py M2 — StatsAnalysisAgent: extends AnalysisModule with a
|
|
53
|
+
statistical-tool layer (select tools from the catalog,
|
|
54
|
+
run them, e-BH FDR-correct, plot) + LLM-guided
|
|
55
|
+
conclusion/evidence chain (StatsAnalysisReport)
|
|
56
|
+
stats_tools.py M2 — statistical tool catalog wrapping evalrx.stats
|
|
57
|
+
(signal/label association, McNemar+e-value, Friedman,
|
|
58
|
+
single-rate e-value, rank corr) + StatsInput/fdr_correct
|
|
59
|
+
stats_tool_agent.py M2 — legacy deterministic exploratory stats tools
|
|
60
|
+
stats_tool_generator.py M2 tier(b) — StatsToolGenerator: LLM/CLI writes a new
|
|
61
|
+
stats script, runs it in a sandbox, parses a
|
|
62
|
+
STATS_RESULT_JSON contract (never mutates repo source)
|
|
63
|
+
diagnosis.py M3 — DiagnosisAgent: judge reads report → Hypothesis list
|
|
64
|
+
case_discovery.py Data — run candidate prompts and label PASS/FAIL cases
|
|
65
|
+
surgery.py M5 — SurgeryAgent: correlate / param-sweep / ExperimentWriter
|
|
66
|
+
→ InterventionResult (SUPPORTED / REFUTED / INCONCLUSIVE)
|
|
67
|
+
experiment_writer.py M5 — multi-phase LLM/CLI agent writes + executes fix scripts
|
|
68
|
+
fix_tiers.py Fix — FixTier intervention-space ladder (L0 runtime /
|
|
69
|
+
L1 prompt / L2 scaffold / L3a read / L3b write /
|
|
70
|
+
L4 params)
|
|
71
|
+
+ hypothesis -> minimum-tier routing
|
|
72
|
+
fix_tools.py Fix — L2 tool catalog (zoom/contrast/equalize/upscale)
|
|
73
|
+
+ PipelineSpec executor around the unchanged model
|
|
74
|
+
fix_agent.py Fix — FixAgent: tiered candidates -> paired McNemar
|
|
75
|
+
validation -> FixOutcome (+ tier recommendation)
|
|
76
|
+
fix_pipeline.py Fix — L2 coded pipelines: sandboxed agent code with
|
|
77
|
+
bridged model access (model_generate/model_attend)
|
|
78
|
+
fix_internals.py Fix — L3a attention-guided crop, L3b intervention
|
|
79
|
+
primitives (visual embedding boost); L4
|
|
80
|
+
FinetuneSpec + run_lora_repair (v1: LoRA on
|
|
81
|
+
target="llm" only, trained on a caller-supplied
|
|
82
|
+
finetune_pool; other recipe shapes recorded only)
|
|
83
|
+
hypothesis_tester.py M4 — HypothesisTester: statistical test + protocol consistency;
|
|
84
|
+
stopping_criteria_met() drives the VLDiagnoseLoop exit
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
from evalrx.agent_runtime.cli_types import CliAgentConfig, CliAgentResult
|
|
88
|
+
from evalrx.agent_runtime.factory import SandboxConfig, SandboxFactoryConfig, create_sandbox
|
|
89
|
+
from evalrx.agent_runtime.judges import AgyModel, ClaudeModel, CodexModel
|
|
90
|
+
from evalrx.agent_runtime.providers import create_cli_agent
|
|
91
|
+
from evalrx.agent_runtime.sandbox import (
|
|
92
|
+
ExperimentSandbox,
|
|
93
|
+
SandboxProtocol,
|
|
94
|
+
SandboxResult,
|
|
95
|
+
parse_metrics,
|
|
96
|
+
validate_entry_point,
|
|
97
|
+
validate_entry_point_resolved,
|
|
98
|
+
)
|
|
99
|
+
from evalrx.analysis.analysis_module import AnalysisModule, AnalysisReport
|
|
100
|
+
from evalrx.analysis.planner import AnalysisPlanItem, plan_stats_input, ranked_signal_names
|
|
101
|
+
from evalrx.analysis.profile import (
|
|
102
|
+
ColumnProfile,
|
|
103
|
+
DatasetProfile,
|
|
104
|
+
describe_outcome,
|
|
105
|
+
profile_records,
|
|
106
|
+
profile_stats_input,
|
|
107
|
+
)
|
|
108
|
+
from evalrx.analysis.stats_agent import StatsAnalysisAgent, StatsAnalysisReport
|
|
109
|
+
from evalrx.analysis.stats_tool_agent import StatsToolAgent
|
|
110
|
+
from evalrx.analysis.stats_tool_generator import (
|
|
111
|
+
GeneratedStatsTool,
|
|
112
|
+
StatsToolGenerator,
|
|
113
|
+
)
|
|
114
|
+
from evalrx.analysis.stats_tools import (
|
|
115
|
+
STATS_TOOL_CATALOG,
|
|
116
|
+
EvidenceResult,
|
|
117
|
+
StatsInput,
|
|
118
|
+
StatsToolResult,
|
|
119
|
+
build_stats_input,
|
|
120
|
+
build_stats_input_from_records,
|
|
121
|
+
default_plan,
|
|
122
|
+
fdr_correct,
|
|
123
|
+
run_stats_tool,
|
|
124
|
+
)
|
|
125
|
+
from evalrx.eval_agent.ab_runner import ABResult, ABRunner
|
|
126
|
+
from evalrx.eval_agent.agentic import (
|
|
127
|
+
AgenticDiagnoseLoop,
|
|
128
|
+
ToolOutcome,
|
|
129
|
+
ToolRegistry,
|
|
130
|
+
ToolSpec,
|
|
131
|
+
)
|
|
132
|
+
from evalrx.eval_agent.evolution import EvolutionStore, LessonEntry, extract_lessons
|
|
133
|
+
from evalrx.eval_agent.git_manager import ExperimentGitManager
|
|
134
|
+
from evalrx.eval_agent.hypothesis import (
|
|
135
|
+
Hypothesis,
|
|
136
|
+
HypothesisGenerator,
|
|
137
|
+
HypothesisStatus,
|
|
138
|
+
ManualHypothesisGenerator,
|
|
139
|
+
hypothesis_from_dict,
|
|
140
|
+
hypothesis_to_dict,
|
|
141
|
+
)
|
|
142
|
+
from evalrx.eval_agent.legacy import AutoDiagnoseLoop, SelfEvolveLoop
|
|
143
|
+
from evalrx.eval_agent.log_schema import (
|
|
144
|
+
RUN_LOG_SCHEMA_VERSION,
|
|
145
|
+
SCHEMA_PATH,
|
|
146
|
+
build_schema,
|
|
147
|
+
iter_log_errors,
|
|
148
|
+
load_schema,
|
|
149
|
+
validate_event,
|
|
150
|
+
)
|
|
151
|
+
from evalrx.eval_agent.loop import VLDiagnoseLoop
|
|
152
|
+
from evalrx.eval_agent.loop_reports import AutoDiagnoseReport, VLDiagnoseReport
|
|
153
|
+
from evalrx.eval_agent.nl_runner import scaffold_from_description
|
|
154
|
+
from evalrx.eval_agent.orchestrator import EvalOrchestrator
|
|
155
|
+
from evalrx.eval_agent.preregister import (
|
|
156
|
+
DataSplit,
|
|
157
|
+
PreregisteredHypothesis,
|
|
158
|
+
PreregistrationLog,
|
|
159
|
+
Split,
|
|
160
|
+
)
|
|
161
|
+
from evalrx.eval_agent.report import DiagnosticReport
|
|
162
|
+
from evalrx.eval_agent.run_context import RunContext
|
|
163
|
+
from evalrx.eval_agent.run_logger_v2 import RunLoggerV2
|
|
164
|
+
from evalrx.eval_agent.stages.case_discovery import (
|
|
165
|
+
CaseDiscoveryAgent,
|
|
166
|
+
CaseDiscoveryReport,
|
|
167
|
+
)
|
|
168
|
+
from evalrx.eval_agent.stages.diagnosis import DiagnosisAgent, DiagnosisResult
|
|
169
|
+
from evalrx.eval_agent.stages.experiment_writer import (
|
|
170
|
+
ExperimentWriter,
|
|
171
|
+
ExperimentWriterConfig,
|
|
172
|
+
ExperimentWriterResult,
|
|
173
|
+
SolutionNode,
|
|
174
|
+
build_model_context,
|
|
175
|
+
)
|
|
176
|
+
from evalrx.eval_agent.stages.fix_agent import (
|
|
177
|
+
FixAgent,
|
|
178
|
+
FixCandidate,
|
|
179
|
+
FixOutcome,
|
|
180
|
+
FixValidation,
|
|
181
|
+
)
|
|
182
|
+
from evalrx.eval_agent.stages.fix_internals import (
|
|
183
|
+
INTERNALS_PRIMITIVES,
|
|
184
|
+
FinetuneSpec,
|
|
185
|
+
InternalsPrimitive,
|
|
186
|
+
)
|
|
187
|
+
from evalrx.eval_agent.stages.fix_tiers import FixTier, parse_tier, route_min_tier
|
|
188
|
+
from evalrx.eval_agent.stages.fix_tools import PipelineSpec
|
|
189
|
+
from evalrx.eval_agent.stages.hypothesis_tester import HypothesisTester, HypothesisTestResult
|
|
190
|
+
from evalrx.eval_agent.stages.probe import ModelKind, StrategyProbe
|
|
191
|
+
from evalrx.eval_agent.stages.probe_agent import ProbeAgent
|
|
192
|
+
from evalrx.eval_agent.stages.probe_candidate_generator import VLMProbeCandidateGenerator
|
|
193
|
+
from evalrx.eval_agent.stages.probe_generator import GeneratedProbe, ProbeGenerator
|
|
194
|
+
from evalrx.eval_agent.stages.probe_search_agent import ProbeSearchAgent
|
|
195
|
+
from evalrx.eval_agent.stages.protocol import ExperimentProtocol, ProbingSchema
|
|
196
|
+
from evalrx.eval_agent.stages.surgery import InterventionResult, SurgeryAgent
|
|
197
|
+
from evalrx.eval_agent.stages.whitebox_probe_generator import (
|
|
198
|
+
GeneratedWhiteboxProbe,
|
|
199
|
+
WhiteboxProbeGenerator,
|
|
200
|
+
)
|
|
201
|
+
from evalrx.eval_agent.store import InMemoryStore, JsonlStore, Store
|
|
202
|
+
|
|
203
|
+
__all__ = [
|
|
204
|
+
# Judge
|
|
205
|
+
"AgyModel",
|
|
206
|
+
"ClaudeModel",
|
|
207
|
+
"CodexModel",
|
|
208
|
+
# M1
|
|
209
|
+
"ProbeAgent",
|
|
210
|
+
"StrategyProbe",
|
|
211
|
+
"ModelKind",
|
|
212
|
+
# M1 tier (b) probe generation
|
|
213
|
+
"ProbeGenerator",
|
|
214
|
+
"GeneratedProbe",
|
|
215
|
+
"WhiteboxProbeGenerator",
|
|
216
|
+
"GeneratedWhiteboxProbe",
|
|
217
|
+
# ProbeLLM-style hierarchical MCTS probe search
|
|
218
|
+
"ProbeSearchAgent",
|
|
219
|
+
"VLMProbeCandidateGenerator",
|
|
220
|
+
# Fix module (post-loop tiered repair)
|
|
221
|
+
"FixAgent",
|
|
222
|
+
"FixCandidate",
|
|
223
|
+
"FixOutcome",
|
|
224
|
+
"FixValidation",
|
|
225
|
+
"FixTier",
|
|
226
|
+
"parse_tier",
|
|
227
|
+
"route_min_tier",
|
|
228
|
+
"PipelineSpec",
|
|
229
|
+
"INTERNALS_PRIMITIVES",
|
|
230
|
+
"InternalsPrimitive",
|
|
231
|
+
"FinetuneSpec",
|
|
232
|
+
# M2
|
|
233
|
+
"AnalysisModule",
|
|
234
|
+
"AnalysisReport",
|
|
235
|
+
# M3
|
|
236
|
+
"DiagnosisAgent",
|
|
237
|
+
"DiagnosisResult",
|
|
238
|
+
# Case discovery / labeling
|
|
239
|
+
"CaseDiscoveryAgent",
|
|
240
|
+
"CaseDiscoveryReport",
|
|
241
|
+
# M5
|
|
242
|
+
"SurgeryAgent",
|
|
243
|
+
"InterventionResult",
|
|
244
|
+
# Loop
|
|
245
|
+
"AutoDiagnoseLoop",
|
|
246
|
+
"AutoDiagnoseReport",
|
|
247
|
+
"SelfEvolveLoop",
|
|
248
|
+
"VLDiagnoseLoop",
|
|
249
|
+
"VLDiagnoseReport",
|
|
250
|
+
# Agentic loop (judge-decided M1-M4, alternative to VLDiagnoseLoop's fixed cycle)
|
|
251
|
+
"AgenticDiagnoseLoop",
|
|
252
|
+
"ToolSpec",
|
|
253
|
+
"ToolOutcome",
|
|
254
|
+
"ToolRegistry",
|
|
255
|
+
# Protocol
|
|
256
|
+
"ExperimentProtocol",
|
|
257
|
+
"ProbingSchema",
|
|
258
|
+
# M2 stats agent
|
|
259
|
+
"StatsAnalysisAgent",
|
|
260
|
+
"StatsAnalysisReport",
|
|
261
|
+
"StatsToolAgent",
|
|
262
|
+
# M2 stats tools
|
|
263
|
+
"StatsInput",
|
|
264
|
+
"StatsToolResult",
|
|
265
|
+
"EvidenceResult",
|
|
266
|
+
"STATS_TOOL_CATALOG",
|
|
267
|
+
"build_stats_input",
|
|
268
|
+
"build_stats_input_from_records",
|
|
269
|
+
"default_plan",
|
|
270
|
+
"fdr_correct",
|
|
271
|
+
"run_stats_tool",
|
|
272
|
+
"ColumnProfile",
|
|
273
|
+
"DatasetProfile",
|
|
274
|
+
"describe_outcome",
|
|
275
|
+
"profile_records",
|
|
276
|
+
"profile_stats_input",
|
|
277
|
+
"AnalysisPlanItem",
|
|
278
|
+
"ranked_signal_names",
|
|
279
|
+
"plan_stats_input",
|
|
280
|
+
# M2 tier (b) code generation
|
|
281
|
+
"StatsToolGenerator",
|
|
282
|
+
"GeneratedStatsTool",
|
|
283
|
+
# M4 hypothesis tester
|
|
284
|
+
"HypothesisTester",
|
|
285
|
+
"HypothesisTestResult",
|
|
286
|
+
# Shared
|
|
287
|
+
"EvalOrchestrator",
|
|
288
|
+
"Hypothesis",
|
|
289
|
+
"HypothesisGenerator",
|
|
290
|
+
"ManualHypothesisGenerator",
|
|
291
|
+
"HypothesisStatus",
|
|
292
|
+
"hypothesis_to_dict",
|
|
293
|
+
"hypothesis_from_dict",
|
|
294
|
+
"Store",
|
|
295
|
+
"InMemoryStore",
|
|
296
|
+
"JsonlStore",
|
|
297
|
+
"ABRunner",
|
|
298
|
+
"ABResult",
|
|
299
|
+
"DataSplit",
|
|
300
|
+
"Split",
|
|
301
|
+
"PreregisteredHypothesis",
|
|
302
|
+
"PreregistrationLog",
|
|
303
|
+
"DiagnosticReport",
|
|
304
|
+
"RunContext",
|
|
305
|
+
"RunLoggerV2",
|
|
306
|
+
# Published event schema
|
|
307
|
+
"RUN_LOG_SCHEMA_VERSION",
|
|
308
|
+
"build_schema",
|
|
309
|
+
"load_schema",
|
|
310
|
+
"validate_event",
|
|
311
|
+
"iter_log_errors",
|
|
312
|
+
"SCHEMA_PATH",
|
|
313
|
+
# Experiment execution
|
|
314
|
+
"ExperimentWriter",
|
|
315
|
+
"ExperimentWriterConfig",
|
|
316
|
+
"ExperimentWriterResult",
|
|
317
|
+
"SolutionNode",
|
|
318
|
+
"build_model_context",
|
|
319
|
+
"ExperimentSandbox",
|
|
320
|
+
"SandboxResult",
|
|
321
|
+
"SandboxProtocol",
|
|
322
|
+
"parse_metrics",
|
|
323
|
+
"validate_entry_point",
|
|
324
|
+
"validate_entry_point_resolved",
|
|
325
|
+
# Sandbox factory
|
|
326
|
+
"SandboxConfig",
|
|
327
|
+
"SandboxFactoryConfig",
|
|
328
|
+
"create_sandbox",
|
|
329
|
+
# NL scaffold
|
|
330
|
+
"scaffold_from_description",
|
|
331
|
+
# Git versioning
|
|
332
|
+
"ExperimentGitManager",
|
|
333
|
+
# Evolution store
|
|
334
|
+
"EvolutionStore",
|
|
335
|
+
"LessonEntry",
|
|
336
|
+
"extract_lessons",
|
|
337
|
+
# CLI agents
|
|
338
|
+
"CliAgentConfig",
|
|
339
|
+
"CliAgentResult",
|
|
340
|
+
"create_cli_agent",
|
|
341
|
+
]
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""The agent's action space over the EvalRX package.
|
|
2
|
+
|
|
3
|
+
The self-evolving agent doesn't reach into internals — it acts through this
|
|
4
|
+
thin tool layer, which wraps the registry, the analyzer/run machinery, and the
|
|
5
|
+
store. Each function is one "skill" the agent can call. Functions that only
|
|
6
|
+
forward to the core are implemented now; the ones needing the Stage-2 store or
|
|
7
|
+
case-generation raise ``NotImplementedError`` but already have their final
|
|
8
|
+
signatures, so the loop can be wired against them.
|
|
9
|
+
|
|
10
|
+
Design intent: this module *is* the contract between the agent and the package.
|
|
11
|
+
Keeping it small and uniform is what makes the agent able to drive the package
|
|
12
|
+
without bespoke glue.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from typing import TYPE_CHECKING, Any
|
|
18
|
+
|
|
19
|
+
from evalrx.core.registry import registry
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from evalrx.core.case import CaseBatch
|
|
23
|
+
from evalrx.core.model import Model
|
|
24
|
+
from evalrx.core.result import Result
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# ----------------------------------------------------------------------
|
|
28
|
+
# Discovery — "what can I do?" (implemented: pure registry reads)
|
|
29
|
+
# ----------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
def list_models() -> list[str]:
|
|
32
|
+
"""All known model spec keys (the agent's model-selection surface)."""
|
|
33
|
+
from evalrx.specs import list_specs
|
|
34
|
+
|
|
35
|
+
return list_specs()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def list_analyses() -> list[str]:
|
|
39
|
+
"""All registered analyzer names."""
|
|
40
|
+
return registry.analyzers.list()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def compatible_analyses(model: "Model") -> list[str]:
|
|
44
|
+
"""Analyzer names whose capability requirements *model* satisfies.
|
|
45
|
+
|
|
46
|
+
This is the agent's key planning primitive: given a model, what analyses
|
|
47
|
+
are even runnable on it?
|
|
48
|
+
"""
|
|
49
|
+
return registry.analyzers.names_compatible_with(model)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# ----------------------------------------------------------------------
|
|
53
|
+
# Action — "run an analysis" (implemented: forwards to the analyzer)
|
|
54
|
+
# ----------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
def run_analysis(model: "Model", analysis: str, data: Any, **params) -> "Result":
|
|
57
|
+
"""Instantiate analyzer *analysis* with *params* and run it on *model*/*data*."""
|
|
58
|
+
analyzer_cls = registry.analyzers.get(analysis)
|
|
59
|
+
return analyzer_cls(**params).run(model, data)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# ----------------------------------------------------------------------
|
|
63
|
+
# Case construction & memory (Stage 2 — needs generators + store)
|
|
64
|
+
# ----------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
def make_cases(spec: Any) -> "CaseBatch":
|
|
67
|
+
"""Construct/sample a batch of candidate failure cases from a spec.
|
|
68
|
+
|
|
69
|
+
Stage 2: backed by dataset samplers and agent-driven case synthesis.
|
|
70
|
+
"""
|
|
71
|
+
raise NotImplementedError("make_cases is planned for Stage 2.")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def record(result: "Result") -> None:
|
|
75
|
+
"""Persist a result (and its cases) into the store for self-evolution."""
|
|
76
|
+
raise NotImplementedError("record is planned for Stage 2 (needs Store).")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def query_store(query: Any) -> Any:
|
|
80
|
+
"""Query accumulated cases/results/hypotheses from the store."""
|
|
81
|
+
raise NotImplementedError("query_store is planned for Stage 2 (needs Store).")
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""A/B execution across two strategies, with statistics done right.
|
|
2
|
+
|
|
3
|
+
A *strategy* is a callable ``FailureCase -> bool`` (did this strategy succeed on
|
|
4
|
+
this case) — typically wrapping a model + a prompt transform + a verifier. The
|
|
5
|
+
runner produces paired per-example success vectors and hands them to
|
|
6
|
+
``stats.compare`` (McNemar + e-value + clustered bootstrap CI), so you get an
|
|
7
|
+
effect size + corrected decision, never a bare p.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from dataclasses import dataclass
|
|
13
|
+
from typing import Callable, Optional
|
|
14
|
+
|
|
15
|
+
from evalrx.stats import StatResult, compare
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class ABResult:
|
|
20
|
+
success_a: list
|
|
21
|
+
success_b: list
|
|
22
|
+
stat: StatResult
|
|
23
|
+
n: int
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ABRunner:
|
|
27
|
+
"""Run two strategies over a CaseBatch and compare them statistically."""
|
|
28
|
+
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
strategy_a: Callable,
|
|
32
|
+
strategy_b: Callable,
|
|
33
|
+
*,
|
|
34
|
+
cluster_fn: Optional[Callable] = None, # case -> cluster id (e.g. task); default per-example
|
|
35
|
+
label_a: str = "A",
|
|
36
|
+
label_b: str = "B",
|
|
37
|
+
) -> None:
|
|
38
|
+
self.strategy_a = strategy_a
|
|
39
|
+
self.strategy_b = strategy_b
|
|
40
|
+
self.cluster_fn = cluster_fn
|
|
41
|
+
self.label_a = label_a
|
|
42
|
+
self.label_b = label_b
|
|
43
|
+
|
|
44
|
+
def run(self, cases, *, paired: bool = True, alpha: float = 0.05, min_effect: float = 0.0) -> ABResult:
|
|
45
|
+
cases = list(cases)
|
|
46
|
+
sa = [bool(self.strategy_a(c)) for c in cases]
|
|
47
|
+
sb = [bool(self.strategy_b(c)) for c in cases]
|
|
48
|
+
clusters = [self.cluster_fn(c) for c in cases] if self.cluster_fn else None
|
|
49
|
+
stat = compare(sa, sb, paired=paired, alpha=alpha, min_effect=min_effect, cluster_by=clusters)
|
|
50
|
+
return ABResult(success_a=sa, success_b=sb, stat=stat, n=len(cases))
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Agentic diagnosis loop — a judge-decided alternative to VLDiagnoseLoop's
|
|
2
|
+
fixed M1->M2->M3->M4 cycle. See ``loop.py`` for the full picture.
|
|
3
|
+
|
|
4
|
+
actions.py Action, parse_action, decide — judge output -> validated action
|
|
5
|
+
board.py EvidenceBoard, BudgetState — what the judge sees each turn
|
|
6
|
+
tools.py ToolSpec, ToolRegistry, build_default_registry — the M1-M4 tools
|
|
7
|
+
loop.py AgenticDiagnoseLoop
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from evalrx.eval_agent.agentic.actions import (
|
|
13
|
+
ACTION_SCHEMA,
|
|
14
|
+
Action,
|
|
15
|
+
ActionParseError,
|
|
16
|
+
decide,
|
|
17
|
+
parse_action,
|
|
18
|
+
validate_json_shape,
|
|
19
|
+
)
|
|
20
|
+
from evalrx.eval_agent.agentic.board import BudgetState, EvidenceBoard
|
|
21
|
+
from evalrx.eval_agent.agentic.loop import AgenticDiagnoseLoop
|
|
22
|
+
from evalrx.eval_agent.agentic.tools import (
|
|
23
|
+
ToolOutcome,
|
|
24
|
+
ToolRegistry,
|
|
25
|
+
ToolSpec,
|
|
26
|
+
build_default_registry,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
"AgenticDiagnoseLoop",
|
|
31
|
+
"Action",
|
|
32
|
+
"ActionParseError",
|
|
33
|
+
"ACTION_SCHEMA",
|
|
34
|
+
"parse_action",
|
|
35
|
+
"decide",
|
|
36
|
+
"validate_json_shape",
|
|
37
|
+
"EvidenceBoard",
|
|
38
|
+
"BudgetState",
|
|
39
|
+
"ToolSpec",
|
|
40
|
+
"ToolOutcome",
|
|
41
|
+
"ToolRegistry",
|
|
42
|
+
"build_default_registry",
|
|
43
|
+
]
|