Modeling Mathematical Notation Semantics in Academic Papers

Hwiyeol Jo, Dongyeop Kang, Andrew Head, Marti A. HearstEMNLP 2021

Abstract

Hwiyeol Jo, Dongyeop Kang, Andrew Head, Marti A. Hearst. Findings of the Association for Computational Linguistics: EMNLP 2021.

2021.

Introduction

While natural language processing has made massive strides in understanding prose, mathematical notation remains a "black box" for most models. In academic writing, mathematical symbols are rarely "self-explanatory." The symbol $\alpha$ might represent a learning rate in a machine learning paper, an angle in a geometry proof, or a significance level in statistics. Humans rely on the surrounding text to disambiguate these meanings, but standard language models like BERT often treat math as noise or fail to capture the semantic link between a variable and its definition.

This paper introduces MATHPREDICTOR, a fine-tuned BERT model designed to bridge the gap between text and equations. The authors identify two major pain points for researchers: convention adherence (choosing symbols that align with domain standards) and notation consistency (avoiding "symbol collisions" where the same letter is used for different concepts).

Methods

The authors propose a specialized fine-tuning approach for BERT called MATHPREDICTOR. The core innovations include:

  • LaTeX-Aware Tokenization: Standard BERT tokenizers often mangle LaTeX macros (e.g., splitting \overline into \, over, and ##line). The researchers expanded the vocabulary to treat common LaTeX macros and symbols as single, atomic tokens.
  • Targeted Masked Language Modeling (MLM): Unlike standard BERT, which masks random words, MATHPREDICTOR is trained specifically to predict masked mathematical tokens based on the surrounding prose.
  • Contextual Encoding: The model uses "local context" (sentences immediately preceding or following the notation) to inform predictions.
  • Permutation Training: To help the model understand complex, multi-token symbols (like $\hat{x}_i$), they used a permutation technique that forces the model to learn the internal structure of mathematical expressions.
Comparison of standard text, LaTeX source, and the specialized tokenization used for MATHPREDICTOR.

Datasets and Evaluation

The study utilized the S2ORC (Semantic Scholar Open Research Corpus), specifically a sub-sample of 1,000 papers containing full-text LaTeX. To reduce noise, the authors replaced non-mathematical entities like citations and figure references with placeholder tokens (e.g., CITATION, EQUATION).

Evaluation was conducted on two distinct sets:

  1. "Easy" set: The target symbol appears elsewhere in the local context, testing the model's ability to maintain consistency.
  2. "Challenge" set: The model must predict the symbol based purely on domain conventions, without seeing it nearby.

Key Results and Insights

MATHPREDICTOR significantly outperformed standard baselines. It achieved 61% Top-1 accuracy for notation auto-suggestion and 74% for consistency checks, compared to just 9% and 14% for the original BERT.

Accuracy comparison between BERT, fine-tuned BERT, and MATHPREDICTOR across different symbol types in Easy and Challenge sets.

Key insights from the evaluation include:

  • Memorization vs. Semantics: Performance was significantly higher on the "Easy" set (up to 78% accuracy) than the "Challenge" set (roughly 7.6%). This suggests the model excels at "memorizing" and repeating symbols defined nearby but still struggles to learn broader scientific conventions.
  • The "Global Context" Paradox: Surprisingly, adding global context (averaging the whole paper) slightly degraded performance. The authors hypothesize that the model becomes "confused" by the high density of different symbols used across a long document.
  • Domain Sensitivity: Performance varied by field. Physics papers were the easiest to predict due to stricter notation rules, while Statistics was the hardest due to the high frequency of generic numbers.

Conclusion

MATHPREDICTOR represents a significant first step in modeling the semantics of mathematical notation. While it struggles to predict the "first use" of a symbol without strong domain conventions, its success in consistency checks opens the door for new authoring tools like automated notation conflict warnings in LaTeX editors. Future directions include tree-structured modeling to capture the hierarchical nature of mathematical formulas and scaling training to a larger portion of the S2ORC corpus.

Summary updated

BibTeX
@inproceedings{jo2021modeling,
  author = {Hwiyeol Jo and Dongyeop Kang and Andrew Head and Marti A. Hearst},
  title = {{Modeling Mathematical Notation Semantics in Academic Papers}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  url = {https://openreview.net/forum?id=VE8Lee0svhQ},
}
Figure