core/docs/decisions/ADR-0136.S3-compound-initial-mutation.md
Shay e705f27d2e
docs(ADR-0164,0165): incremental comprehension reader + regex scope rule (#317)
Replace the regex sentence-template front-end of the math admissibility
layer with an incremental compositional reader. Lock the architectural
boundary that regex is permitted only at the lexeme level, never as
sentence-structure templates.

ADR-0164 (Proposed) — Incremental Comprehension Reader. Word-by-word
state accumulation over a closed set of semantic categories, with the
operational lexicon living as a pack-shaped data artifact under
language_packs/data/en_core_math_v1/. Reader output type matches the
existing regex parser's output, so the binding-graph admissibility
(ADR-0132/0133/0134/0135), the solver (ADR-0116), and the verifier
(ADR-0117) stay unchanged. wrong=0 is preserved by construction —
the reader produces inputs to the existing admissibility gate, not a
bypass around it. Phased coexistence with the regex layer during
transition; regex sentence templates removed in Phase 3.

ADR-0165 (Proposed) — Regex Scope Rule. Structural invariant: regex
matches one piece of orthographic material with a closed rule
(currency literal, fraction literal, percentage, time-amount, closed
unit-noun sets), never a sentence shape. Lexeme-primitive registry is
closed and grown through the same contemplation -> proposal -> HITL
review corridor that grows vocabulary (ADR-0150 / 0152 / 0155 / 0161).
The engine acquires new recognition tools through reviewed teaching,
not through operator edits to parser code.

ADR-0163's diagnosis (front-end is the bottleneck) is reaffirmed.
Its Phase B-E prescription (regex DerivedRecognizers via
recognizer_match.py) is partially superseded by ADR-0164. ADR-0136
and its S-family (S.1 / S.2 / S.3 / S.4) have the same disposition:
regex sentence-template prescription superseded; empirical refusal
taxonomies and closed-set vocabulary preserved as lexicon seed.
The HITL corridor architecture is preserved; what flows through it
changes from regex recognizers to lexicon entries, categories, and
lexeme primitives.

Session log SESSION-2026-05-26-comprehension-reader.md captures the
narrative of how this decision emerged from the post-D.2 train-sample
baseline review (correct=3 refused=47 wrong=0, 34/47 refusals at the
question gate).

No runtime code changes. ADRs only.
2026-05-26 19:23:05 -07:00

108 lines
4.4 KiB
Markdown

# ADR-0136.S.3 — Compound Initial-Mutation Extractor
**Status:** Accepted — *regex patterns scheduled for removal under [ADR-0164](./ADR-0164-incremental-comprehension-reader.md) Phase 3; closed-set vocabulary preserved as lexicon seed*
**Parent:** ADR-0136 (Statement Layer Corridor) — see [ADR-0136 §Amendment 2026-05-26](./ADR-0136-statement-layer-corridor.md)
**Date:** 2026-05-23
## Context
The v2 refusal taxonomy (ADR-0136.S.2) identified 6 cases with `compound_statement`
as primary barrier. These cases contain two operations fused into a single sentence.
S.3 targets exactly one canonical shape — the initial-mutation form:
```
<Entity> had <N> <unit> [initially], but [then] <verb> <M>.
```
This is the simplest compound shape: a single derived `InitialPossession(entity, N ± M, unit)`
candidate, same topology as `_CONJ_EMBEDDED_RE`'s SUM-emission pattern. Other compound
shapes (fraction-of-remainder, percentage-of, age-multiplier, verb-conjunction) are
structurally different and out of scope.
## Decision
### One shape, not "all of compound_statement"
The 6 compound_statement cases represent at least 5 distinct structural shapes. S.3
ships one extractor for the initial-mutation form only. Bundling multiple shapes
would conflate distinct parser risks and violate the one-shape-per-PR discipline.
### Closed verb sets
Past-tense only (the "had N, but then verb M" form requires past tense):
**Subtract:** lost, gave, gave away, used, spent, ate, dropped, sold
**Add:** gained, got, received, found, earned, picked up, bought
No wildcards. Verbs not in either set cause the sentence to refuse (not wrong).
### No short-circuit path
Per ADR-0137's subsumption directive, the extractor produces a `CandidateInitial`
that flows through the existing graph machinery. No new bypass route was added.
### Negative-result refusal
If N - M < 0, the extractor refuses. Emitting a negative quantity would violate
the solver's non-negative invariant.
## Per-Case Impact
| Case | v2 Barrier | S.3 Effect | Post-S.3 Barrier | Why |
|---|---|---|---|---|
| 0010 | compound_statement | **Shifted** | fraction_operand | Sentence 1 now parses (Yun, 8, paperclips); sentence 2 "1/4 more than" blocks |
| 0012 | compound_statement | No change | compound_statement | "his fish ate half of them" = compound + fraction + coreference |
| 0013 | compound_statement | No change | compound_statement | "uploads 10 one-hour videos each day" = nested embedded quantifier |
| 0016 | compound_statement | No change | compound_statement | "2 more than 5 miles" = comparative arithmetic, not init-mutation |
| 0032 | compound_statement | No change | compound_statement | "draws and colors 10 pictures" = verb conjunction, not init-mutation |
| 0033 | compound_statement | No change | compound_statement | "7 times her age" = multiplier, not init-mutation |
## GSM8K Admission Count
| Metric | Pre-S.3 | Post-S.3 |
|---|---|---|
| Admitted (correct) | 3 | 3 |
| Wrong | 0 | 0 |
| Refused | 47 | 47 |
| Barrier shifted (v2 v3) | | 1 (gsm8k-0010) |
Direct admission delta: **0**. gsm8k-0010's sentence 1 now extracts cleanly but
sentence 2's fraction_operand blocks the case from admitting.
## Axis Lane
24 curated cases at `evals/math_capability_axes/S3_compound_initial_mutation/v1/`:
| Category | Count | Gate |
|---|---|---|
| subtract_canonical | 4 | answer == expected |
| subtract_synonym | 7 | answer == expected |
| add_canonical | 4 | answer == expected |
| add_synonym | 5 | answer == expected |
| refusal_negative_result | 2 | answer is None |
| refusal_verb_miss | 2 | answer is None |
All 24 pass, wrong = 0.
## Cross-Lane Regression
- S.1 rate_events: 20/20 pass, wrong = 0
- S.3 axis lane: 24/24 pass, wrong = 0
- GSM8K admission set: {0014, 0018, 0042} (unchanged)
## Deferred
Every other compound shape from the 6 cases:
- **0012**: "his fish ate half of them" compound + fraction + coreference
- **0013**: "uploads 10 one-hour videos each day" nested embedded quantifier + temporal
- **0016**: "2 more than 5 miles" comparative arithmetic expression
- **0032**: "draws and colors 10 pictures" verb conjunction (single object, multiple verbs)
- **0033**: "7 times her age" age-multiplier compound
## Evidence
- Parser addition: `generate/math_candidate_parser.py` (`_INIT_MUTATION_RE`, `_init_mutation_candidates`)
- Axis lane: `evals/math_capability_axes/S3_compound_initial_mutation/v1/`
- Tests: `tests/test_adr_0136_S3_compound_initial_mutation.py`