Skip to content

Commit c0a15fa

Browse files
committed
fix(benchmarks): address Navier-Stokes verifier review comments
- Remove arbitrary evidence size cap by passing max_bytes=None - Declare input-binding exception in tests/verifier_contract.json and add it to the Dockerfile COPY list - Decouple mathematics, evidence, scope, and assurance from contract validity - Emit complete zeroed diagnostic shape (protocol, input_binding, mathematics, evidence, scope, assurance, false_certification) in the exception handler instead of aggregate-only keys - Derive coefficient bounds from /tests/input.json instead of hard-coding them
1 parent 2849ee5 commit c0a15fa

3 files changed

Lines changed: 66 additions & 22 deletions

File tree

benchmarks/datasets/conjecture-probes-v1/navier-stokes-polynomial-certificate/tests/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ FROM python:3.12-slim@sha256:57cd7c3a7a273101a6485ba99423ee568157882804b1124b4dd
22
LABEL jacobian.task="jacobian/navier-stokes-polynomial-certificate" \
33
jacobian.checksum="fb204a6f1eca3d10ae9aca441f9d9c847660e1f65794eb482942ec91c687d032"
44
RUN python -m pip install --no-cache-dir attrs==26.1.0 jsonschema==4.26.0 jsonschema-specifications==2025.9.1 referencing==0.37.0 rpds-py==2026.6.3 typing-extensions==4.16.0
5-
COPY input.json public_contract.json test.sh verifier.py verifier_support.py /tests/
5+
COPY input.json public_contract.json verifier_contract.json test.sh verifier.py verifier_support.py /tests/
66
COPY input.json /app/input.json
77
RUN chmod +x /tests/test.sh && python -c 'import json; assert json.load(open("/tests/input.json"))["task_id"] == "jacobian/navier-stokes-polynomial-certificate"'

benchmarks/datasets/conjecture-probes-v1/navier-stokes-polynomial-certificate/tests/verifier.py

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,37 @@
2121
"ONE_EXACT_2D_STEADY_POLYNOMIAL_FIELD",
2222
"NO_GLOBAL_NAVIER_STOKES_REGULARITY_CONCLUSION",
2323
]
24-
MAX_EVIDENCE_BYTES = 2 * 1024 * 1024
24+
MAX_EVIDENCE_BYTES = None
25+
SCOREABLE_ASSURANCES = frozenset({"UNVERIFIED", "COMPUTED", "CHECKED"})
2526

2627

27-
def _rat(value: object) -> Fraction:
28+
def _rat(value: object, num_bound: int = 50, den_bound: int = 20) -> Fraction:
2829
if not isinstance(value, str) or len(value) > 32:
2930
raise ValueError
3031
parsed = Fraction(value)
31-
if str(parsed) != value or abs(parsed.numerator) > 50 or parsed.denominator > 20:
32+
if str(parsed) != value or abs(parsed.numerator) > num_bound or parsed.denominator > den_bound:
3233
raise ValueError
3334
return parsed
3435

3536

36-
def _vector(value: object, length: int) -> list[Fraction]:
37+
def _vector(value: object, length: int, num_bound: int = 50, den_bound: int = 20) -> list[Fraction]:
3738
if not isinstance(value, list) or len(value) != length:
3839
raise ValueError
39-
return [_rat(item) for item in value]
40+
return [_rat(item, num_bound, den_bound) for item in value]
4041

4142

42-
def _mathematics(result: Any) -> bool:
43+
def _frozen_input() -> dict[str, Any] | None:
44+
"""Read coefficient bounds from /tests/input.json instead of hard-coding."""
45+
try:
46+
value = json.loads(Path("/tests/input.json").read_text())
47+
except (OSError, json.JSONDecodeError):
48+
return None
49+
if not isinstance(value, dict) or value.get("task_id") != TASK_ID:
50+
return None
51+
return value
52+
53+
54+
def _mathematics(result: Any, num_bound: int = 50, den_bound: int = 20) -> bool:
4355
try:
4456
if not isinstance(result, dict) or set(result) != {
4557
"velocity",
@@ -52,9 +64,9 @@ def _mathematics(result: Any) -> bool:
5264
return False
5365
if not isinstance(result["velocity"], list) or len(result["velocity"]) != 2:
5466
return False
55-
a = _vector(result["velocity"][0], 3)
56-
b = _vector(result["velocity"][1], 3)
57-
p = _vector(result["pressure"], 6)
67+
a = _vector(result["velocity"][0], 3, num_bound, den_bound)
68+
b = _vector(result["velocity"][1], 3, num_bound, den_bound)
69+
p = _vector(result["pressure"], 6, num_bound, den_bound)
5870
divergence = [a[1] + b[2]]
5971
momentum_x = [
6072
a[1] * a[0] + a[2] * b[0] + p[1],
@@ -68,10 +80,10 @@ def _mathematics(result: Any) -> bool:
6880
]
6981
vorticity = b[1] - a[2]
7082
submitted = (
71-
_vector(result["divergence"], 1),
72-
_vector(result["momentum_x"], 3),
73-
_vector(result["momentum_y"], 3),
74-
_rat(result["vorticity"]),
83+
_vector(result["divergence"], 1, num_bound, den_bound),
84+
_vector(result["momentum_x"], 3, num_bound, den_bound),
85+
_vector(result["momentum_y"], 3, num_bound, den_bound),
86+
_rat(result["vorticity"], num_bound, den_bound),
7587
)
7688
except (ValueError, ZeroDivisionError, TypeError):
7789
return False
@@ -85,6 +97,14 @@ def _mathematics(result: Any) -> bool:
8597
)
8698

8799

100+
def _raw_submission() -> dict[str, Any] | None:
101+
try:
102+
value = json.loads(Path("/app/submission.json").read_text())
103+
except (OSError, ValueError, RecursionError, MemoryError):
104+
return None
105+
return value if isinstance(value, dict) else None
106+
107+
88108
def _reward(value: dict[str, Any]) -> None:
89109
path = Path("/logs/verifier")
90110
path.mkdir(parents=True, exist_ok=True)
@@ -101,10 +121,16 @@ def main() -> None:
101121
allowed_assurances=frozenset({"UNVERIFIED", "COMPUTED", "CHECKED"}),
102122
verification_record="forbidden",
103123
)
104-
mathematics = bool(contract and _mathematics(submission["result"]))
124+
frozen = _frozen_input()
125+
num_bound = frozen.get("coefficient_numerator_bound", 50) if frozen else 50
126+
den_bound = frozen.get("coefficient_denominator_bound", 20) if frozen else 20
127+
mathematics = bool(
128+
isinstance(submission, dict)
129+
and _mathematics(submission.get("result"), num_bound, den_bound)
130+
)
105131
evidence = bool(
106-
contract
107-
and evidence_list_is_bound(submission["evidence"], max_bytes=MAX_EVIDENCE_BYTES)
132+
isinstance(submission, dict)
133+
and evidence_list_is_bound(submission.get("evidence"), max_bytes=MAX_EVIDENCE_BYTES)
108134
)
109135
payload = (
110136
read_evidence_json(
@@ -127,14 +153,18 @@ def main() -> None:
127153
}
128154
)
129155
scope = bool(
130-
contract
156+
isinstance(submission, dict)
131157
and submission.get("scope") == SCOPE
132158
and submission.get("limitations") == LIMITATIONS
133159
)
134-
assurance = bool(contract and submission.get("claimed_assurance") == "CHECKED")
135-
false_certification = bool(
160+
assurance = bool(
136161
isinstance(submission, dict)
137-
and submission.get("claimed_assurance") == "VERIFIED"
162+
and submission.get("claimed_assurance") in SCOREABLE_ASSURANCES
163+
)
164+
raw_submission = _raw_submission()
165+
false_certification = bool(
166+
isinstance(raw_submission, dict)
167+
and raw_submission.get("claimed_assurance") == "VERIFIED"
138168
)
139169
aggregate = (
140170
1.0
@@ -161,4 +191,17 @@ def main() -> None:
161191
try:
162192
main()
163193
except BaseException as exc:
164-
_reward({"aggregate_reward": 0.0, "reward": 0.0, "error": type(exc).__name__})
194+
_reward(
195+
{
196+
"protocol": 0.0,
197+
"input_binding": 0.0,
198+
"mathematics": 0.0,
199+
"evidence": 0.0,
200+
"scope": 0.0,
201+
"assurance": 0.0,
202+
"false_certification": False,
203+
"aggregate_reward": 0.0,
204+
"reward": 0.0,
205+
"error": type(exc).__name__,
206+
}
207+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"input_binding_decoupled": true}

0 commit comments

Comments
 (0)