MS-3 composes MS-1 (Target) + MS-2 (comparative chains + completeness) + the gate. generate/derivation/multistep.py: search_chain(problem_text, target=None). Shape-based, NOT blind enumeration: enumerates a small principled candidate set (product-of-all if a multiplicative cue is present; sum-of-all if an aggregation hint is present; each optionally + comparative scalars), each using all quantities, routed through select_self_verified (grounding ∧ cue ∧ unit ∧ completeness ∧ uniqueness). Bounded (MAX_QUANTITIES, refuse-on-overflow) + deterministic. Target supplies the aggregation cue + question quantities; target- UNIT matching is deferred (answer_unit=start.unit is wrong for cross-unit products -> a unit gate would over-refuse; documented). Honest practice measurement (sealed lane): 4 correct / 9 wrong / 37 refused (baseline 3/0/47). +1 flip is the unambiguous whole-problem product (0021); the 9 wrongs are product-of-all eliminations on multi-step problems (caught by gold, the learning signal). Whole-problem shapes add no coverage beyond the unambiguous product WITHOUT cue precision: when product and sum both self-verify they disagree -> uniqueness refuses (safe-but-low-coverage by design). The lever remains cue precision (the ADR-0175 learning loop). Microscope finding: 0003-class flips (48*24*0.75=864=gold) are blocked by a DECIMAL/currency grounding gap -- '$0.75' tokenizes to 0/75 so '0.75' is not grounded by the shared round-trip primitive. Not a search bug; deferred extraction-richness work (won't casually change the serving round-trip primitive). A test documents the current refusal so the fix is detectable. wrong=0: serving untouched (sealed); ambiguity + no-licensed-cue refuse; routes through the proven gate. 8 MS-3 tests; full derivation surface 77/77; ruff clean; smoke 67.
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""ADR-0175 Phase 3 — grounded derivation search + self-verification gate.
|
|
|
|
Phase 3a (this surface): the self-verification gate — grounded operands ∧
|
|
grounded operation cues ∧ unit consistency ∧ uniqueness. The wrong=0-critical
|
|
guard that keeps the (Phase 3b) bounded search honest.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from generate.derivation.comparatives import (
|
|
ComparativeScalar,
|
|
comparative_step,
|
|
extract_comparative_scalars,
|
|
)
|
|
from generate.derivation.extract import extract_quantities
|
|
from generate.derivation.model import GroundedDerivation, Quantity, Step, VALID_OPS
|
|
from generate.derivation.multistep import search_chain
|
|
from generate.derivation.search import MULTIPLICATIVE_CUES, search_multiplicative
|
|
from generate.derivation.target import Target, extract_target
|
|
from generate.derivation.verify import (
|
|
Resolution,
|
|
SelfVerification,
|
|
select_self_verified,
|
|
self_verifies,
|
|
)
|
|
|
|
__all__ = [
|
|
"ComparativeScalar",
|
|
"GroundedDerivation",
|
|
"MULTIPLICATIVE_CUES",
|
|
"Quantity",
|
|
"Resolution",
|
|
"SelfVerification",
|
|
"Step",
|
|
"Target",
|
|
"VALID_OPS",
|
|
"comparative_step",
|
|
"extract_comparative_scalars",
|
|
"extract_quantities",
|
|
"extract_target",
|
|
"search_chain",
|
|
"search_multiplicative",
|
|
"select_self_verified",
|
|
"self_verifies",
|
|
]
|