summaryrefslogtreecommitdiff
path: root/src/gap_pipeline/e2e.py
diff options
context:
space:
mode:
authorOscar Wan <oscarwan@stanford.edu>2026-07-24 20:45:42 -0700
committerOscar Wan <oscarwan@stanford.edu>2026-07-24 20:45:42 -0700
commit15efc30e9e7179accd30375d3edb2e34a3b4dc5f (patch)
treeba1c49eb128e7906ba451141723d763e1dcda53a /src/gap_pipeline/e2e.py
parent708f2af9c6985e9cb5cd53e434a7d3b8dfa2b4ac (diff)
updated generation process
Diffstat (limited to 'src/gap_pipeline/e2e.py')
-rw-r--r--src/gap_pipeline/e2e.py104
1 files changed, 86 insertions, 18 deletions
diff --git a/src/gap_pipeline/e2e.py b/src/gap_pipeline/e2e.py
index ded1381..66101e7 100644
--- a/src/gap_pipeline/e2e.py
+++ b/src/gap_pipeline/e2e.py
@@ -11,7 +11,7 @@ from typing import Any
from .clients import OpenAIJsonClient, ScriptedClient
from .models import CanonicalItem
from .offline import load_dataset
-from .pipeline import KernelPipeline, PipelineConfig
+from .paper_pipeline import PaperKernelPipeline, PaperPipelineConfig
from .release import export_release
from .store import RunStore
from .surface import SurfacePipeline
@@ -25,7 +25,8 @@ def _ensure_fresh(path: Path) -> None:
def _review_accept() -> dict[str, str]:
return {
"verdict": "accept",
- "step_by_step_check": "n1 passes; n2 passes",
+ "step_by_step_check": "n1 passes; n2 passes; n3 passes",
+ "replacement_check": "s1 satisfies its positivity guard",
"blocking_issues": "",
"patch_suggestion": "",
}
@@ -84,8 +85,8 @@ async def run_live_item(
surface_store,
).run_all(item)
- config = PipelineConfig(proposer_model=model, judge_model=model)
- kernel = await KernelPipeline(
+ config = PaperPipelineConfig(proposer_model=model, judge_model=model)
+ kernel = await PaperKernelPipeline(
proposer=OpenAIJsonClient(model, api_key=api_key),
judges=[OpenAIJsonClient(model, api_key=api_key) for _ in range(5)],
store=RunStore(kernel_root, item.item_id),
@@ -164,24 +165,91 @@ async def run_offline_smoke(work_root: Path) -> dict[str, Any]:
proposer = ScriptedClient(
{
- f"{item_id}.plan": {
- "core_steps": [
- "use nonnegativity of a square",
- "expand and divide by a positive quantity",
+ f"{item_id}.stage1.dag": {
+ "nodes": [
+ {
+ "node_id": "n1",
+ "claim": "(a-1)^2 >= 0",
+ "dependencies": [],
+ },
+ {
+ "node_id": "n2",
+ "claim": "a^2-2a+1 >= 0",
+ "dependencies": ["n1"],
+ },
+ {
+ "node_id": "n3",
+ "claim": "a+1/a >= 2",
+ "dependencies": ["n2"],
+ },
],
- "mutable_slots": {
- "slot1": {
- "description": "the positive reference value",
- "original": "1",
+ "terminal_node_id": "n3",
+ },
+ f"{item_id}.stage2.methods": {
+ "nodes": [
+ {
+ "node_id": "n1",
+ "method_label": "use nonnegativity of a square",
+ },
+ {
+ "node_id": "n2",
+ "method_label": "expand the square",
+ },
+ {
+ "node_id": "n3",
+ "method_label": "divide by a positive quantity",
+ },
+ ]
+ },
+ f"{item_id}.stage3.replacement": {
+ "changes": [
+ {
+ "slot_id": "s1",
+ "source_node_id": "n1",
+ "description": "positive square root at equality",
+ "original_value": "1",
+ "replacement_value": "2",
+ "guard_condition": "replacement is positive",
+ "guard_justification": "2 is positive",
}
- },
+ ],
+ "closure_statement": "The equality value is the only change.",
+ },
+ f"{item_id}.stage4.diffusion": {
+ "nodes": [
+ {
+ "node_id": "n1",
+ "dependencies": [],
+ "method_label": "use nonnegativity of a square",
+ "instantiated_claim": "(x-2)^2 >= 0",
+ "justification": "squares are nonnegative",
+ },
+ {
+ "node_id": "n2",
+ "dependencies": ["n1"],
+ "method_label": "expand the square",
+ "instantiated_claim": "x^2-4x+4 >= 0",
+ "justification": "expand n1",
+ },
+ {
+ "node_id": "n3",
+ "dependencies": ["n2"],
+ "method_label": "divide by a positive quantity",
+ "instantiated_claim": "x+4/x >= 4",
+ "justification": "divide n2 by x>0",
+ },
+ ],
+ "terminal_node_id": "n3",
+ "terminal_answer": "4",
},
- f"{item_id}.candidate": {
+ f"{item_id}.stage5.render": {
"question": "Let x>0. Prove that x+4/x >= 4.",
"solution": (
- "Since (x-2)^2 >= 0, expansion and division by x>0 "
- "give x+4/x >= 4."
+ "[n1] Since (x-2)^2 >= 0. [n2] Expanding gives "
+ "x^2-4x+4 >= 0. [n3] Divide by x>0 to get x+4/x >= 4."
),
+ "node_order": ["n1", "n2", "n3"],
+ "terminal_answer": "4",
},
}
)
@@ -191,11 +259,11 @@ async def run_offline_smoke(work_root: Path) -> dict[str, Any]:
)
for _ in range(5)
]
- kernel = await KernelPipeline(
+ kernel = await PaperKernelPipeline(
proposer=proposer,
judges=judges,
store=RunStore(kernel_root, item_id),
- config=PipelineConfig(
+ config=PaperPipelineConfig(
proposer_model="scripted",
judge_model="scripted",
),