coref-eval
The groupant beside coref/src/eval.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| approximant | partial | approximant |
| ast | partial | syntax.json |
| composition | partial | composition |
| descriptant | present | descriptant |
| invariant | partial | invariant |
| tests | executed bounded checks | tests |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| id | type | label | where |
|---|---|---|---|
behavior_complement | behavior_complement | partial source derived model | behavior_complement |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
visibility | visibility | partial source derived model | visibility |
micro_transport | micro_transport | partial source derived model | micro_transport |
failure_effect_order | failure_effect_order | partial source derived model | failure_effect_order |
diagnostic_precedence | diagnostic_precedence | partial source derived model | diagnostic_precedence |
Parts
Model text
descriptant
coref-eval
Transport resolver partitions to scoring/serialization, accumulate micro counts and render bounded evaluation reports.
State: Gold ordered mentions/entities/anaphoric flags; Sys mentions/clusters/links; report buffer and optional output paths.
Epoch 2026-10-31: prospective analysis preceded test additions. Production behavior is unchanged. A registry entry records partial source-bound modeling, not verification.
No real corpus, fault injection or exhaustive score checks; existing score source modeled elsewhere. Partial gold-leak equality does not compare head/etype.
approximant
Forward model
gold_of groups first-seen eid and sets anaphoric iff mention key differs from entity minimum (sent,start,-end). visible excludes internal and singleton coordination absent coord-sgl substring override. sys_entities recomputes span heads; out_mentions preserves mention heads, numbers nonempty visible clusters from1 and notes last link/new/sgl. score_all adds score_doc Counts over zip, not average F1. run gold parses/self-checks then verifies document counts, appends baseline/cumulative reports, writes errors, checks strip invariance, optionally writes CoNLL-U.
Domain: acyclic, in-range document views from checked parsing unless explicitly discussing permissive adapters; stable environment during each call; finite addressable allocations. Public vectors can be malformed and panic.
No runtime substitute or numerical error budget is established.
invariant
Invariant and cost
Scores are micro numerator/denominator totals. Empty counts yield scorer zero ratios. Gold ids and output ids are local ordinal labels, not cross-document identity. run mismatch fails before appending report; later failures can leave report and error file effects. Filtered clusters remain ordered.
Costs sum repeated resolver and scorer calls: two singleton policies ร six systems plus FULL.len+1 cumulative runs plus diagnostics and strip-control reruns. Scoring delegates matching and assignment matrix costs. Error rows capped400 per diagnostic run; report/output buffers and per-document predictions retained.
Integer counters/lengths use Rust native arithmetic with no separate overflow certificate. Allocation exhaustion, panics and I/O failures are not experimentally characterized.
composition
Source-fragment composition
Fragments project exact byte ranges of this source; shared types/imports outside ranges remain prerequisites. Models compose through actual caller/callee state, not an error-budget sum.
- transport: bytes [871,4415); Gold ids/anaphoric keys and Sys visibility/metric/output adapters.
- diagnostics: bytes [4415,8726); Link/pronoun counts, rows and scorer self-check.
- report: bytes [8726,16449); System configs, cumulative contribution report and ordered optional effects.
Parent relation: gold_of groups first-seen eid and sets anaphoric iff mention key differs from entity minimum (sent,start,-end). visible excludes internal and singleton coordination absent coord-sgl substring override. sys_entities recomputes span heads; out_mentions preserves mention heads, numbers nonempty visible clusters from1 and notes last link/new/sgl. score_all adds score_doc Counts over zip, not average F1. run gold parses/self-checks then verifies document counts, appends baseline/cumulative reports, writes errors, checks strip invariance, optionally writes CoNLL-U.
Integration: checked document tree -> mention spans/features -> ordered resolver partition -> eval visibility -> CorefUD rows or existing score module. Source-specific exceptions and projection losses remain in models.md.
models
Typed models
behavior_complement
Internal mentions cannot enter sys_entities/out_mentions even with coord-sgl enabled. A mismatched input document count cannot reach report generation after successful gold self-check. score_all alone does not exclude truncated unequal slices. Leak comparison covers span/eid/note, not head/etype.
reverse_reconstruction
Given output entities, compatible Sys states may differ in filtered internal mentions, singleton groups, explanations and original heads (sys_entities recomputes them). A metric row admits many gold/pred partitions with identical aggregate counts. Serialized notes constrain last from-link but not complete history.
visibility
visible uses full cluster length before filtering; a coordination mention clustered only with an internal mention can become visible. coord-sgl checks substring, unlike exact-token sieve switches.
micro_transport
score_all(g,p)=sum_i score_doc(g_i,p_i) for i<min lengths; precision/recall/F are computed after summing Counts.
failure_effect_order
gold parse -> scorer self-check -> length check -> report -> errors write -> strip leak check -> output write. No transaction or directory creation in run.
diagnostic_precedence
link_stats counts from-spurious before to-spurious; same-chain only when both match. Wrong-chain error examples capped400; pronouns count matched third-person ppr only.
No executable percentage surrogate: categorical state/effect semantics currently lack a useful cheaper observation metric. Supported future caps are 1%, 2%, 5%, 10%; no profile is claimed here.
tests
Evidence โ 2026-10-31
Safe synthetic command: env -u COREF_X -u COREF_MD -u PRAG_OFF cargo test -p coref tests:: -- --skip score::. Two debug and two release executions are retained externally with numeric exit status and sorted named outcomes. Selected checks:
- tests::write_read_round_trip
- tests::wave27_coordination_mentions_and_visibility
- tests::wave27_event_antecedent_and_empty_evaluation
See source-test-map.json and controls.json in the wave27 coref run receipts. The library declaration file has compilation evidence only. No corpus, teacher, GPU or speed measurement.
Partial scope: No real corpus, fault injection or exhaustive score checks; existing score source modeled elsewhere. Partial gold-leak equality does not compare head/etype.
Measured receipts
Final source state: 13 named tests (12 library, 1 binary) passed twice debug and twice release, 52 total executed test instances; all four command exits0 and sorted named outcomes identical. Five added tests are four library boundary tests plus one main load test. The pre-existing score tests and groupant_transfers were filtered out.
Compiled actual-source control: tests::wave27_coordination_mentions_and_visibility. Compile exit0, assertion-run exit101, exact bytes restored, positive rerun exit0. Retained logs: control-eval-compile.log, control-eval-red.log, control-eval-restored.log.
Nine source AST projections were generated twice identically. Shared ancestor declarations are deferred to root integration; local owned leaves have no structural diagnostics. No timings or general accuracy claim.
Strict scoped Clippy: exit101 on four pre-existing production lints (corefud unnecessary_sort_by, doc if_same_then_else and clone_on_copy, mention collapsible_if). Those source files are byte-identical to the base. No unrelated lint refactor was made.
This page in Markdown โ https://md.groupants.elamur.ai/free/en/mova/coref/src/eval.rs.groupant/