The measurement foundation for docs/plans/grammar-unification-2026-07-26.md.
WHY: evals/deterministic_fluency reports 1.00 on all six predicates and
still passes "banana does the.", "wet ground rains the is." and
"is is is is." — it checks terminal punctuation, presence of a verb-shaped
token, and two anti-shape regexes. Heuristic predicates will always have
that failure mode, because grammaticality cannot be measured without a
grammar. So this lane measures agreement between the two halves of CORE
that already encode grammar, and requires the measurement to FAIL on salad.
Two directions, reported separately because they fail for different
reasons and have different remedies:
G-round-trip graph -> realize_target -> surface -> comprehend -> graph
S-round-trip surface -> comprehend -> graph -> categorical renderer -> surface
v1 baseline on main @ 9696443a:
graph_cases 280 surface_cases 8
g_write_rate 1.000 s_read_rate 1.000
g_read_rate 0.000 s_renderable_rate 0.625
g_exact_rate 0.000 s_surface_match_rate 0.000
negative_cases 16
reject_rate 1.000
g_read_rate and s_surface_match_rate are pins on measured DEFECTS, not
goals; they may be revised upward only. s_surface_match_rate = 0 is the
§1.7 categorical render defect caught by construction — the lane found it
without being told to look.
g_args_rate and g_predicates_rate are deliberately separate: high argument
agreement with low predicate agreement would mean the grammars align and
only the vocabulary is split, a materially different remedy from both
being low. That distinction decides the arc's direction (plan §6).
Design notes:
- The committed cases.jsonl is the SINGLE source for authored surfaces —
no in-module duplicate, since a second copy of a corpus is the defect
this arc exists to remove. Negative shuffles are DERIVED at run time so
they cannot drift from the positives.
- The shuffles are lexically identical to positives (same vocabulary, same
length, order destroyed) so the lane cannot pass by vocabulary-checking.
- Fixed rotation, not a PRNG, so reject_rate is byte-reproducible.
- The lane keeps a local copy of the reader's quantifier map ON PURPOSE so
it never becomes a consumer of what it measures;
test_quantifier_map_matches_reader fails loudly if the reader changes.
- _render_categorical deliberately reaches a private serving function: a
lane measuring a private copy would measure what users never see.
Every guarantee is paired with a mutation test. The load-bearing one is
test_reject_rate_goes_red_when_the_reader_accepts_everything: an
accept-everything reader must drive reject_rate to 0.0. Without it,
reject_rate == 1.0 would be unfalsifiable — precisely the defect that
makes the existing fluency lane decoration.
Also documents plainly what round-trip does NOT prove: it measures mutual
intelligibility, not English quality. english_fluency_ood accepts "river
flows valley" and round-trip would be happy with it. No metric here may be
cited as evidence of prose quality.
scripts/measure_grammar_seam.py reproduces every number in the plan's §1
so a reader can check them instead of trusting them.
[Verification]: in-worktree on CPython 3.12.13, uv sync --locked —
smoke 621 (unchanged), deductive 364 (349 + 15 new). Lane SHA pins
verified separately. No serving code touched; new files plus one suite
registration line.
6.2 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 |
| 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 |
280 |
| 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 280
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.