Skip to main content

Transparent AI for Mathematics: Transformer-Based Large Language Models for Mathematical Entity Relationship Extraction with XAI

AuthorsTanjim Taharat Aurpa
Year2026
FieldNLP
arXiv2603.06348
PDFDownload
Categoriescs.CL

Abstract

Mathematical text understanding is a challenging task due to the presence of specialized entities and complex relationships between them. This study formulates mathematical problem interpretation as a Mathematical Entity Relation Extraction (MERE) task, where operands are treated as entities and operators as their relationships. Transformer-based models are applied to automatically extract these relations from mathematical text, with Bidirectional Encoder Representations from Transformers (BERT) achieving the best performance, reaching an accuracy of 99.39%. To enhance transparency and trust in the model's predictions, Explainable Artificial Intelligence (XAI) is incorporated using Shapley Additive Explanations (SHAP). The explainability analysis reveals how specific textual and mathematical features influence relation prediction, providing insights into feature importance and model behavior. By combining transformer-based learning, a task-specific dataset, and explainable modeling, this work offers an effective and interpretable framework for MERE, supporting future applications in automated problem solving, knowledge graph construction, and intelligent educational systems.


Engineering Breakdown

Plain English

This paper frames mathematical problem understanding as an entity-relation extraction task, where mathematical operands are treated as entities and operators as relationships between them. The authors apply BERT-based Transformer models to automatically extract these mathematical relationships from text, achieving 99.39% accuracy on their task. To make the model's decisions interpretable and trustworthy, they integrate SHAP (Shapley Additive Explanations) to provide explainability analysis showing which textual and mathematical features drive the model's predictions. This combination of high accuracy with built-in interpretability addresses a significant gap in transparent AI for mathematical reasoning.

Core Technical Contribution

The core contribution is formulating mathematical problem interpretation as a structured Mathematical Entity Relation Extraction (MERE) task with a clear entity-relationship framework, rather than treating it as a generic sequence classification or free-form generation problem. The authors demonstrate that BERT achieves state-of-the-art performance (99.39% accuracy) on this reformulated problem, suggesting the transformer architecture is well-suited to capturing mathematical relationships. The novel aspect is coupling this extraction approach with SHAP-based explainability analysis to surface which linguistic and mathematical patterns the model learned, providing transparency into how transformers handle mathematical reasoning. This work bridges the gap between achieving high accuracy and maintaining interpretability in specialized domain understanding.

How It Works

The system takes mathematical text as input and processes it through a BERT encoder, which generates contextual embeddings for each token in the sequence. These embeddings capture both the semantic meaning of mathematical terminology and their contextual relationships within the problem statement. The model then performs relation extraction by classifying pairs of tokens—specifically identifying operand entities (numbers, variables) and the operators that connect them—essentially extracting a graph structure from unstructured mathematical text. For explainability, SHAP computes Shapley values for each input feature (tokens or token combinations), determining their contribution to the final prediction by running the model on multiple feature subsets and measuring the marginal impact of each feature. The output is both the extracted entity-relation pairs (the mathematical structure) and a set of importance scores showing which parts of the input text were most influential in making the extraction decision.

Production Impact

Integrating this approach would transform how backend systems parse and validate mathematical problems—instead of brittle rule-based parsing or regex patterns, you'd have a learned model that handles diverse problem formulations with 99.39% accuracy. In a production math tutoring platform, homework grading system, or computational pipeline, this enables automatic structure extraction from user-submitted or source material problems, reducing the need for manual annotation or templated input formats. The SHAP explainability component is critical for production because it lets you audit model decisions, debug failures, and provide teachers/students with feedback on which parts of a problem statement the system found ambiguous or incorrectly parsed. The main trade-offs are inference latency (BERT inference is slower than symbolic parsing but likely acceptable for batch processing), the requirement for labeled training data of <entity, relation> pairs in mathematical text, and the need to maintain SHAP computation overhead if real-time explanations are required (SHAP can be computationally expensive; you may want to cache or approximate for latency-sensitive systems).

Limitations and When Not to Use This

The paper only reports accuracy on what appears to be a single dataset or evaluation set, with no mention of generalization to out-of-domain mathematical problems (e.g., does it handle physics problems with different notation? calculus vs. algebra?). The 99.39% accuracy is suspiciously high and suggests either the task is well-constrained, the test set is not representative, or there may be data leakage—production deployment would require much more rigorous evaluation on held-out problem types and real-world noise. The paper does not address handling of ambiguous or incomplete mathematical expressions, nor does it discuss failure modes like when operand-operator relationships span large distances in text or involve nested expressions. Finally, the explainability via SHAP shows feature importance but does not necessarily validate that the model learned correct mathematical reasoning—a model could extract relations with high accuracy while misunderstanding the underlying mathematical semantics, which SHAP alone cannot detect.

Research Context

This work builds on the established pipeline of applying Transformers (particularly BERT) to structured prediction tasks in specialized domains, extending prior work on information extraction and relation extraction to the mathematical reasoning domain. It fits within the broader effort to move beyond generic black-box NLP systems toward interpretable, domain-aware AI, leveraging recent advances in explainability (SHAP) that have become standard in production ML. The mathematical entity-relation framing is novel for mathematical problem understanding and could inspire similar structured reformulations in other specialized domains (chemistry, physics, medical terminology). This positions the work at the intersection of NLP, explainable AI, and domain-specific language understanding, opening potential follow-up directions in multi-modal mathematical understanding (handling equations rendered as images or LaTeX) and composition of extracted relations for end-to-end problem solving.


:::tip Subscribe Get weekly breakdowns of papers like this in AI Letters - the newsletter for engineers building production AI systems. :::


Back to Research Lab → · Subscribe to AI Letters →

© 2026 EngineersOfAI. All rights reserved.