Source-linked AI summary

PA-CDM: Position-Aware Character Detection Matching for Evaluating Handwritten Mathematical Expression Recognition

Shiliang Luo

arXiv:2609.12917v1cs.CVcs.CLcs.LG

TL;DR

HMER evaluation metrics can overlook where structural errors occur, and tree-edit metrics can penalize equivalent rewrites outside parser normalization. The paper proposes PA-CDM, a position-aware character-detection metric, and evaluates it with a controlled benchmark and cross-metric protocol. In a human study, PA-CDM has the highest correlation among seven automatic metrics, while a frontier judge correlates slightly higher at greater cost and with nondeterministic outputs.

  • Problem

    HMER’s exact-match and string-similarity metrics are blind to error location, while render-based CDM misses structural roles and tree-edit metrics can penalize equivalent rewrites outside parser normalization.

    Source: §I · p. 1
  • Method

    PA-CDM combines character detection matching with position-forest encoding and divergence-level weighting, evaluated alongside a frozen perturbation benchmark and cross-metric consistency protocol.

    Source: §I · p. 2, §II · p. 2
  • Results

    ρ = 0.9535 (n = 990): PA-CDM has the highest correlation with human judgments among seven automatic metrics.

    Source: §I · p. 2
  • Takeaways & Limitations

    PA-CDM is proposed as the deterministic, diagnosable default metric, with LLM judges reserved for periodic audits.

    Source: §I · p. 2

    PA-CDM’s strictness ordering holds only at the mean level, and it is not the top-correlating automatic metric on CROHME 2016 or the unimer group.

    Source: §VIII · p. 8

Abstract

from arXiv · show

Handwritten mathematical expression recognition (HMER) is conventionally scored by exact-match rates and string-similarity metrics that are blind to where an error occurs: two predictions with identical token-error counts receive identical scores whether they misplace a subscript or swap the operands of a fraction. Render-based character detection matching (CDM) aligns glyphs robustly but remains position-blind---on controlled fraction-operand swaps it scores 0.8595 where position-aware scoring yields 0.6253. Tree-edit metrics exhibit a complementary blind spot: rewrites outside the parser's normalization coverage are penalized as structural errors (0.8552 where render-based metrics score 1.0). We propose PA-CDM, a position-aware metric that couples character detection matching with position-forest encoding and divergence-level weighting; StructPerturb v2.0, a frozen benchmark of 1,340 controlled perturbation pairs across 15 type--intensity cells; and a cross-metric consistency protocol combining a sensitivity matrix, a human study, and LLM-judge calibration. In a six-annotator study, PA-CDM attains the highest correlation with human judgments among seven automatic metrics (Spearman rho=0.9535, n=990). A frontier LLM judge correlates slightly higher (rho=0.9613) but is costly, nondeterministic, and API-dependent; PA-CDM approaches it at zero marginal cost with deterministic, diagnosable behavior.

I. INTRODUCTION

HMER metrics can miss where structural errors occur, while tree-edit metrics can penalize equivalent rewrites outside parser normalization. The paper introduces PA-CDM and a benchmark and evaluation protocol, reporting the strongest human-score correlation among seven automatic metrics.

I. INTRODUCTION

  • On fraction-operand swaps, CDM scores 0.8595 versus 0.6253 for position-aware scoring; on over rewrites, TED scores 0.8552 while CDM, PA-CDM, and IMS score 1.0.The examples illustrate complementary blind spots: CDM misses structural roles, while TED can penalize equivalent rewrites outside its parser’s normalization coverage.Source: §I · p. 1
  • The frontier VLM judge correlates with human scores at ρ = 0.9613, but its calibration cost, nondeterministic outputs, unusable verdicts, and hosted-model drift limit its role as a default signal.The calibration consumed roughly 7.09M API tokens and CNY 202.46; 34 of 3,024 scoring calls returned no usable verdict after retries.Source: §I · pp. 1–2
  • PA-CDM encodes formulas as position forests, aligns entity streams, and weights position-vetoed matches by divergence level; StructPerturb v2.0 contains 1,340 pairs across 15 type–intensity cells.The cross-metric protocol combines a seven-metric sensitivity matrix, a six-annotator human study, LLM-judge calibration, and a diagnostic decision table.Source: §I · p. 2
  • ρ = 0.9535 (n = 990): PA-CDM has the highest correlation with human judgments among seven automatic metrics.The study reports ρ = 0.9520 under the original n = 1,008 protocol; the difference reflects restricting the sample to items with three complete judge repeats.Source: §I · p. 2

II. THE PA-CDM METRIC

PA-CDM extends render-based character detection matching with structural positions: it encodes formulas as position forests, aligns identifiers to rendered glyphs, and penalizes position-vetoed matches according to divergence depth. Its structural strictness is reported at the mean level on real predictions, with exceptions among individual pairs.

II. THE PA-CDM METRIC

  • A deterministic walk encodes each formula as a position forest, assigning each symbol a role-path identifier rooted at M; identifier length represents structural depth.Superscripts and subscripts append A and B; fraction numerator and denominator likewise append A and B, respectively.Source: §II · p. 2
  • Entity identifiers are aligned to rendered tokens using one-to-many normalization; when normalized streams differ, sequence alignment assigns identifiers only to exactly matching blocks.Structural commands visible only in the rendering stream are excluded from the entity-level denominator.Source: §II · p. 2
  • The scorer follows CDM’s rendering and Hungarian box-matching pipeline, adding a structural alignment cost; with structural checks disabled and wa = 0, it reproduces CDM scores.Encoding failures—28 of 985 CROHME 2014 predictions, all truncated strings with unbalanced braces—fall back to pure CDM scoring.Source: §II · p. 2
  • Matched pairs with differing identifiers are position-vetoed, then re-enter the denominators with a penalty weighted by the depth of the first differing role.Pairs with missing identifiers are exempt; equivalent pairs, unmatched tokens, and exempt pairs keep weight 1, so equivalence rewrites are not penalized.Source: §II · pp. 2–3
  • A grid study fixed p = 2, while wa sweeps showed near-zero, non-monotone sensitivity; the relation-elimination channel was deleted after failing guardrails.The p study found veto coverage, not weight magnitude, to be the binding constraint; the aggressive relation redesign fired on 1.15% of matched pairs and broke two guardrails.Source: §II · p. 3
  • On 985 CROHME 2014 predictions, PA-CDM mean F1 is 0.9136 versus CDM’s 0.9233, while perfectly scored shares are 0.6365 versus 0.6457.PA-CDM ≤ CDM holds only at the mean level; individual-pair and frozen-cell reversals are reported.Source: §II · p. 3

III. STRUCTPERTURB V2.0 BENCHMARK

StructPerturb v2.0 is a frozen benchmark of controlled structural perturbations and equivalence rewrites; its sensitivity matrix shows widening PA-CDM–CDM gaps across structural families and complementary tree-edit blind spots.

III. STRUCTPERTURB V2.0 BENCHMARK

  • The frozen 1,340-pair benchmark spans 15 cells, using deterministic LaTeX rewrites for three structural families at L1–L3 plus equivalence and parser/glyph probes.L2/L3 select non-overlapping sites deterministically; each perturbation can be traced to the exact sites touched.Source: §III · p. 3
  • The equiv left-right gate reduces but does not eliminate visual non-equivalence: 43% of 30 gated pairs remained non-equivalent on rendering re-verification.Visual equivalence uses vertical ink-profile Dice ≥0.99; strict pixel-overlap IoU is unreachable for this cell by construction.Source: §III · p. 3
  • PA-CDM–CDM gaps widen at L1/L2/L3: script swap 0.0786/0.0974/0.2222, frac swap 0.2342/0.2999/0.4472, and nested move 0.0837/0.1142/0.1871.The no-veto share falls to 1% on frac swap L3; CDM recovers to 0.9694 there under repeated same-structure edits, further amplifying the gap.Source: §III · pp. 3–4, Table I · p. 4
  • The matrix reports frozen-set perturbation sensitivity, not metric rankings on natural prediction distributions; nested-move L2/L3 have only 36 and 4 pairs, respectively.The caption attributes the short cells to exhausted candidate pools and notes their limited statistical power.Source: Table I · p. 4
  • In the visually identical over-to-frac rewrite, CDM, PA-CDM, and IMS score 1.0, while TED, scores 0.8552 because the rewrite is outside parser normalization coverage.For sqrt order, TED stays at 1.0 while PA-CDM scores 0.9498; this is the sole matrix case where PA-CDM exceeds CDM (0.9409).Source: §III · p. 4

IV. HUMAN STUDY

In the human study, PA-CDM had the strongest correlation with human scores among the seven automatic metrics overall, with high annotator agreement. The study also reveals a ceiling effect: more than half of pairs received a perfect PA-CDM score.

IV. HUMAN STUDY

  • Six annotators scored each pair on an anchored 1–5 rubric using the reference and predicted renderings and both LaTeX sources.The 1,008-pair sample drew 252 pairs each from CROHME 2014, 2016, 2019, and UniMER-Test; pairs were binned into 20 corpus-by-quintile strata.Source: §IV · p. 4
  • Krippendorff’s ordinal α = 0.9693 on 202 overlap items, above the pre-registered acceptance bar of α ≥0.67.The 95% CI was [0.9472, 0.9853] under 10,000 bootstrap resamples.Source: §IV · p. 5
  • ρ = 0.9535: PA-CDM had the highest overall correlation with human scores among seven automatic metrics on the 990-item primary sample.Under the original n=1,008 protocol, its overall correlation was ρ = 0.9520; it ranked first among automatic metrics on CROHME 2014 and 2019, but not 2016 or UniMER-Test.Source: §IV · p. 5, Table II · p. 5
  • 52.2% of the 1,008 pairs scored PA-CDM = 1.0, merging the top two quintile boxes and concentrating high-end discrimination in the non-saturated segment.Stratified sampling ensured adequate mass in that segment.Source: §IV · pp. 4–5, Figure 1 · p. 4

V. LLM-AS-JUDGE CALIBRATION

The calibrated LLM judge correlated most strongly with human judgments among the automatic metrics, but its cost, nondeterminism, and API dependence argue against using it as the default evaluation signal. PA-CDM approached its correlation at zero marginal cost with deterministic, inspectable scores.

  • The judge received the same renderings, LaTeX sources, and anchored rubric as human annotators, scored each item three times, and returned usable verdicts for 2,990 of 3,024 main calls.Source: §V · p. 5
  • Mean pairwise Krippendorff’s α across repeat pairs was 0.9913 on 990 items with three complete repeats; exact three-way agreement was 92.51% on 1,001 items with at least one valid repeat.The judge-side and human-side α estimates use different sampling designs.Source: §V · p. 6
  • 187 of 199 comparable swapped-probe pairs had zero score difference (mean |∆| = 0.060; p = 0.7744), with no pair differing by two or more, yielding no evidence of positional bias.Source: §V · p. 6
  • ρ=0.9613 on 990 items, the judge exceeded every automatic metric and ranked first in all five corpus rows, including unimer 0.8742 versus TED 0.7999 and PA-CDM 0.7748.Source: §V · p. 6
  • PA-CDM reached ρ=0.9535, within ∆=0.0078 of the judge, at zero marginal cost and deterministically, supporting its use as the default rather than a hosted judge.The calibration run cost CNY 202.46 and roughly 7.09M API tokens for 1,008 items at three repeats; the judge is nondeterministic and API-dependent.Source: §V · p. 6
  • 26 of 990 items (2.6%) differed by two or more points; 24 were cases where the judge scored more strictly than humans, including two structural or scope errors humans missed.The two examples were a numerator-boundary error and a factor moved into a radical; in both, the judge and metrics were stricter than the human annotator.Source: §V · p. 6

VI. DIAGNOSTIC PROTOCOL

The diagnostic protocol matches metric combinations to six evaluation contexts rather than ranking metrics, using sensitivity, human-study, and judge-calibration evidence. Its recommendations make each metric’s blind spots part of the interpretation.

VI. DIAGNOSTIC PROTOCOL

  • PA-CDM is the primary RL reward with CDM as a control, but rendering cost, zero-scored render failures, and near-binary rewards constrain its operational use.IMS penalizes equivalence rewrites as harshly as real errors and is unfit as an equivalence-preserving reward.Source: §VI · p. 6
  • Equivalence judgment uses encoder, semantic, and visual tiers because no single metric suffices.The tiers are position-forest identity, TED, and profile-Dice ≥0.99, respectively.Source: §VI · p. 6
  • Table III maps six evaluation scenarios to recommended metric combinations and their expected blind spots, rather than ranking metrics.The OOD row reports PA-CDM > CDM for 33 of 799 UniMER-Test pairs (max +0.1489); the equivalence row’s 43% residual follows a single-line-height gate on 30 re-verified pairs.Source: §VI · p. 6, Table III · p. 7
  • Per-sample diagnosis pairs PA-CDM veto counts with TED tree-edit paths; when no veto fires, PA-CDM reduces to CDM and adds no diagnostic information.OOD evaluation calls for per-pair disclosure because PA-CDM > CDM inversions amplify out of distribution.Source: §VI · p. 7
  • Structural-compliance probing uses the gap by intensity grade, but short nested-move bins and length confounds mean conclusions should rest on script-swap and fraction-swap families.The nested-move L2/L3 bins contain n=36 and n=4 pairs because candidate pools were exhausted.Source: §VI · p. 7, Table III · p. 7

VII. RELATED WORK

Prior HMER evaluation relies on sequence-based metrics that ignore error location, while render-based and tree-edit approaches capture different aspects of formula similarity. PA-CDM combines glyph-level matching with structural position, alongside work on human and model judges and image-level rewards.

VII. RELATED WORK

  • Expression rate and string metrics such as BLEU score token sequences without error location, treating a misplaced subscript and swapped fraction operand comparably.HMER model work includes bidirectional sequence modeling, coverage and counting-aware mechanisms, position-forest supervision, and scaling toward real-world inputs.Source: §VII · p. 7
  • CDM renders formulas and matches localized characters, while tree-edit metrics compare normalized operator trees and can penalize equivalent rewrites beyond parser normalization.PA-CDM combines CDM-like glyph matching with structural positions audited through veto and weighting; its CDM reimplementation matches the official implementation with zero maximum absolute difference on 985 shared CROHME 2014 samples.Source: §VII · p. 7
  • Human and model judges provide another evaluation line, while IMPO uses an image-level IMS reward for GRPO-trained HMER models.The authors’ independent IMS reimplementation uses a different rendering and alignment convention, so its absolute scores are not comparable with the original report.Source: §VII · p. 7

VIII. LIMITATIONS AND ONGOING WORK

The paper qualifies its metric, benchmark, and judge claims with limits on strictness, correlation, coverage, perturbation sampling, and equivalence verification. A reward-quality study across three rewards, two backbones, and two seeds is ongoing.

VIII. LIMITATIONS AND ONGOING WORK

  • PA-CDM ≤ CDM holds only at the mean level, with observed reversals on CROHME 2014, UniMER-Test, and one frozen cell; their cause remains unresolved.The reported reversals are 2 of 985 CROHME 2014 pairs (max +0.051), 33 of 799 UniMER-Test pairs (max +0.1489), and one frozen cell (+0.0089).Source: §VIII · p. 8
  • PA-CDM is not the top-correlating automatic metric in the CROHME 2016 and UniMER groups, and limited UniMER-Test alignment leaves 294 of 799 pairs scored by pure CDM.Alignment covers 63.08% of predictions in the wider UniMER-Test re-evaluation, making the PA-CDM column a mixed-coverage measure.Source: §VIII · p. 8
  • Sensitivity-matrix intensity comparisons should be read within perturbation families because short nested-move bins and multi-site candidate pools bias some samples toward longer formulas.The nested-move L2/L3 cells have n=36 and n=4; candidate-pool lengths vary across structural families and grades.Source: §VIII · p. 8
  • Judge-calibration results are tied to one hosted model revision, and its score column is not strictly comparable with the human column.The judge column averages three repeats per item, whereas the human column uses two-annotator means on overlap items.Source: §VIII · p. 8
  • The ongoing reward-quality study tests whether PA-CDM improves recognition quality over CDM and reimplemented IMS, and whether sensitivity differences translate into downstream behavior.It crosses three rewards with PosFormer and CoMER backbones and two seeds; results will be reported separately.Source: §VIII · p. 8
Loading 2609.12917v1…