Transparent AI for Mathematics: Transformer-Based Large Language Models for Mathematical Entity Relationship Extraction with XAI
Organizations: Department of Data Science and Engineering, University of Frontier Technology, Bangladesh, .
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.
Figures & tables
| Text | Entity 1 | Entity 2 | Relationship |
|---|---|---|---|
| Eighteen players of the Sri Lankan national cricket team have come to play in Bangladesh. Bangladesh team also has eighteen players. There is total thirty six players in two teams. | Eighteen | Eighteen | Addition |
| Subtracting fifty from ten is equals forty. | Fifty | Ten | Subtraction |
| Two thousand multiplied by five is ten thousand. | Two Thousand | Two | Multiplication |
| The square root of four is two . | Four | Two | Square Root |
| The factorial value of seven is five thousand and forty. | Seven | Five Thousand Forty | Factorial |
| Man bought twelve mangoes and divided them equally among three children. Each child got four of mangoes. | Twelve | Three | Division |
| Hyperparameters | BERT |
|---|---|
| learning rate (AdamW) | 2e-04 |
| max_len | 50 |
| Batch_size | 12 |
| verbose | 1 |
| epoch | 40 |
| Class | TP | TN | FP | FN | Precision | Recall | Specificity | Error Rate | F1 Score |
| Factorial | 70 | 466 | 0 | 0 | 100 | 100 | 100 | 0 | 100 |
| Addition | 99 | 459 | 8 | 1 | 93 | 99 | 98 | 1.8 | 96 |
| Subtraction | 96 | 467 | 0 | 2 | 100 | 98 | 100 | 0.4 | 99 |
| Multiplication | 116 | 449 | 4 | 0 | 97 | 100 | 99 | 0.8 | 98 |
| Division | 101 | 454 | 0 | 4 | 100 | 96 | 100 | 0.8 | 98 |
| Square Root | 163 | 392 | 0 | 0 | 100 | 100 | 100 | 0 | 100 |
Relation Extraction
Relation extraction identifies and classifies relationships between entities or events in text and multimodal data.
See all 82 papers