Phase 4 of the grammar-unification arc, resolved by option (b) of the plan.
The problem: 149 green fluency cases scored `realize_target`, and
`core/cognition/pipeline.py` never calls it -- it calls `realize_semantic`.
`english_fluency_ood` reported 117/117 + 39/39 for a function that does not
speak, for the whole life of the lane.
The plan framed this as "which realizer is better". Reading the source says it
is not a quality question. `render_semantic`'s signature is
`(intent, subject, predicate, obj, secondary, language, root)` -- no `negated`,
no `quantifier`, no `tense`, no `aspect` -- and `realize_semantic` never reads
them off the step. So the serving writer cannot express content the
ArticulationStep is carrying:
negated=False -> 'Knowledge is defined as opinion.'
negated=True -> 'Knowledge is defined as opinion.'
It serves the AFFIRMATIVE of a negated proposition. That is the ADR-0261 §5.1
family, not a fluency defect. Pinned here as a defect; NOT fixed, because
fixing it changes served output and belongs to Shay.
Measured -- identical contract, all seven scored corpora
--------------------------------------------------------
bucket n realize_target realize_semantic
feature-bearing, single node 214 207 49
no features, multi-node 100 100 3
no features, single node (CONTROL) 33 33 33
total 347 340 85
The control is what makes the rest mean anything. Every corpus hardcodes
IntentTag.UNKNOWN, so "the serving writer scores badly" could have been an
artifact of never giving it a real intent. On the 33 cases carrying nothing it
cannot express, the two are IDENTICAL -- so the gap on the other 314 is the
dropped features and the clause joining, not the intent.
Delivered
---------
- `grammatical_coverage/runner.py` reports `serving_accuracy` beside
`accuracy`; `english_fluency_ood` delegates to that run_lane and gains it
for free. The realizer is a parameter now instead of a hardcoded import.
- `tests/test_phase4_realizer_resolution.py` -- the control, the decomposition,
the negation defect pin, and the §6 evidence.
- The claim is restated at both places it was made: the lane docstring and
`grammar_roundtrip/contract.md`.
Zero served bytes change. No serving authorization needed.
§6 -- the plan's pre-commitment was wrong, and is corrected rather than
quietly edited
------------------------------------------------------------------------
§6 forks on read_rate: risen => Phase 5 diversity; near-zero => §1.8 graph-model
mismatch => ADR. It pre-committed to the second. Neither is what the
measurement says.
g_read_rate went to 1/293. The unblocked case was blocked by a one-line WRITER
defect (predicate-nominal object agreement, #135), not by §1.8. The other 292:
no_template_match 289 reader has no SUBJ-VERB-OBJ template at all
unknown_morphology 2 prepositional objects (reserved_word_in_np)
unsupported_negation 1 reader has no negated-categorical template
Every one is the reader declining a CONSTRUCTION, not a projection disagreeing
about a graph it parsed. Where a construction is in both inventories the round
trip closes exactly. So the barrier is the OVERLAP of the two construction
inventories, currently one construction wide -- Phase 5's item 1, tractable,
not an ADR-scale model decision.
§1.6 read "uniform no_template_match" as evidence FOR the type mismatch. It is
not: no_template_match is a coverage fact, and the corpus was 289/293 bare
transitives, a construction the reader never claimed to read. The measurement
was mostly reporting the corpus's composition.
And a finding in my own stack
------------------------------
`tests/test_realizer_quantifier_agreement.py` lived ONLY in the `cognition`
suite, which is not on the AGENTS.md pre-push gate. So every pin Phases 3 and 4
added to it -- including the invariant covering all twelve inflection branches
-- ran in NO gate. That is why smoke stayed at 621 across two PRs that added 13
tests between them, and it is the same silent-red shape the smoke list already
calls out for test_adr_index.py.
Registered into `deductive`, which now runs 504 instead of 406.
Mutation
--------
baseline 12 pass
serving metric computed with realize_target 4 FAIL
render_semantic GAINS a `negated` parameter 2 FAIL
realize_semantic delegated to realize_target 6 FAIL
Row 2 matters most: if someone FIXES the negation defect, the pin forces a
deliberate revision instead of passing silently.
Still open, still Shay's: option (a), promoting realize_target to the serving
path. It now has a price tag -- 340/347 over 85/347 and the ability to say
"not", against a move in every surface hash and whatever the Shadow Coherence
Gate ruling in core/cognition/surface_resolution.py was protecting.
[Verification]: in-worktree on CPython 3.12.13 with `uv sync --locked` --
smoke 621, deductive 504 (was 406; +12 new Phase 4 pins, +86 previously
ungated), lane pins 11/11 unchanged, no pin edited.
6.6 KiB
Grammar Round-Trip Eval Lane — Contract
Lane: grammar_roundtrip
Version: v1
Created: 2026-07-26
Plan: docs/plans/grammar-unification-2026-07-26.md (Phase 1)
What this lane measures
Whether CORE can read what it writes and write what it reads — and, critically, whether it refuses word salad.
Why it exists
evals/deterministic_fluency reports 1.00 on all six of its predicates
and still passes every one of these:
| candidate | passes deterministic_fluency? |
|---|---|
"banana does the." |
yes |
"wet ground rains the is." |
yes |
"is is is is." |
yes |
It checks terminal punctuation, presence of a verb-shaped token, and two anti-shape regexes. It cannot distinguish English from word salad, so its 100% carries no information about fluency.
Heuristic predicates will always have that failure mode, because grammaticality cannot be measured without a grammar. This lane therefore measures agreement between the two halves of CORE that already encode grammar — the reader and the writer — and requires the measurement to fail on salad. Round-trip is falsifiable with no judge, no embedding, and no gold aesthetic.
The two directions
| direction | pipeline | what a failure means |
|---|---|---|
| G-round-trip | graph → realize_target → surface → comprehend → graph |
CORE cannot read its own writing |
realize_targetis eval-only (Phase 4).core/cognition/pipeline.pycallsrealize_semantic, neverrealize_target, sog_read_rateis a measurement of the grammar library and not of served English. Run through the serving writer instead, the G-direction reads back nothing (0.0 vs 0.003413) — seetests/test_phase4_realizer_resolution.py. Any claim made from this metric must say which writer it is about.
| S-round-trip | surface → comprehend → graph → categorical renderer → surface | CORE cannot reproduce what it just understood |
Both are reported because they fail for different reasons and have different remedies.
Metrics
| metric | definition |
|---|---|
g_write_rate |
fraction of graph cases the writer produced any surface for |
g_read_rate |
fraction of written surfaces the reader comprehended |
g_args_rate |
fraction of expected propositions whose argument pair was recovered |
g_predicates_rate |
fraction whose predicate name was recovered on the same arguments |
g_exact_rate |
fraction recovered exactly (predicate + arguments + polarity) |
s_read_rate |
fraction of positive surfaces comprehended |
s_renderable_rate |
fraction whose projection the categorical renderer can express at all |
s_surface_match_rate |
fraction that render back to the input surface |
reject_rate |
fraction of the negative corpus refused or reduced to zero propositions |
g_args_rate and g_predicates_rate are reported separately on purpose. High
argument agreement with low predicate agreement means the grammars align and
only the vocabulary is split — a materially different remedy from both being
low. Collapsing them into one boolean would hide the distinction that decides
this arc's direction (plan §6).
Corpora
| corpus | source | size |
|---|---|---|
| positive graphs | committed english_fluency_ood + grammatical_coverage case files |
293 |
| positive surfaces | in-module, each verified comprehensible by probe | 8 |
| negative surfaces | hand-authored salad + deterministic token shuffles of the positives | 16 |
The shuffles are load-bearing: they are lexically identical to positive
cases — same vocabulary, same length, order destroyed. A lane that rejects
hand-authored salad but accepts the shuffles is doing vocabulary checking, not
grammar checking. Shuffling uses a fixed rotation rather than a PRNG so
reject_rate is byte-reproducible.
Thresholds
| metric | v1 requirement | rationale |
|---|---|---|
reject_rate |
1.00, always | the guarantee; regression is a hard failure |
g_read_rate |
recorded baseline, revised upward only | currently a measured defect |
s_surface_match_rate |
recorded baseline, revised upward only | currently a measured defect |
v1 baseline — measured on main @ 9696443a
graph_cases 293
g_write_rate 1.000
g_read_rate 0.000 <-- CORE reads 0% of what it writes
g_propositions_expected 370
g_args_rate 0.000
g_predicates_rate 0.000
g_exact_rate 0.000
surface_cases 8
s_read_rate 1.000
s_renderable_rate 0.625
s_surface_match_rate 0.000 <-- nothing renders back to its input
negative_cases 16
reject_rate 1.000 <-- the guarantee holds
Two of these are pins on known defects, not goals. They are expected to be revised upward by plan Phases 2B and 5, and must never be revised downward to accommodate a regression.
s_renderable_rate = 0.625 is not a defect: 3 of the 8 positive surfaces
project to member / less predicates, which have no all X are Y categorical
surface at all. Those are reported as unrenderable rather than as match
failures, because "cannot write this" and "wrote this wrongly" need different
fixes.
What this lane does NOT prove
Round-trip is necessary, not sufficient for fluency. It measures mutual
intelligibility — both halves agreeing about a surface. Two halves can agree
on an impoverished construction: english_fluency_ood accepts "river flows valley" as a correct surface, and round-trip would be perfectly happy with it.
So a high round-trip rate licenses "CORE means what it says", never "CORE writes well". The negative corpus is what prevents the first failure mode. Nothing in this lane prevents the second, and no metric here should ever be cited as evidence of prose quality.
Mutation guarantees
Every guarantee is paired with a test proving it can break
(tests/test_grammar_roundtrip.py):
test_reject_rate_goes_red_when_the_reader_accepts_everything— an accept-everything reader must drivereject_rateto 0.0. Without this,reject_rate == 1.0would be unfalsifiable, which is precisely the defect that makes the existing fluency lane decoration.test_shuffled_negatives_reuse_positive_vocabulary— closes the vocabulary-checking escape hatch.test_positive_surfaces_are_all_inside_the_reader_envelope— a refused positive would silently measure reader coverage instead of round-trip.test_quantifier_map_matches_reader— the lane keeps a deliberate local copy of the reader's quantifier map so it never becomes a consumer of the thing it measures; this test fails loudly if the reader's map changes.