mamut-mir-eval
MAMUT: A Novel Framework for Modifying Mathematical Formulas for the Generation of Specialized Datasets for Language Model Training — Drechsel et al. (2025) (arXiv:2502.20855, 2025)
What this evaluates
Evaluates mathematical information retrieval capabilities by testing whether models can match natural language names or LaTeX formulas to their corresponding mathematical identities from a candidate pool. It probes the model's ability to learn structural and notational variations in mathematical expressions through pretraining and fine-tuning.
Datasets
Metrics
nDCG (primary) — range: [0, 1]
- Normalized Discounted Cumulative Gain at rank k, measuring ranking quality by assigning higher scores to relevant items appearing higher in the list, normalized by the ideal DCG.
p@k — range: [0, 1]
- Precision at rank k, measuring the fraction of relevant items in the top-k retrieved results.
AP — range: [0, 1]
- Average Precision, the area under the precision-recall curve, averaging precision at each rank where a relevant item is retrieved.
F1 — range: [0, 1]
- Harmonic mean of precision and recall for binary classification of query-relevance.
Input / output format
Input: A query consisting of either a natural language name or a LaTeX formula, paired with a candidate set of formulas to retrieve from.
Output: A ranked list of candidate formulas or binary relevance scores for each candidate.
Scoring recipe
import math
def compute_metrics(predictions, gold):
k = 10
p_at_k = len(gold & set(predictions[:k])) / k
dcg = sum(1 / math.log2(i+2) for i, c in enumerate(predictions) if c in gold)
idcg = sum(1 / math.log2(i+2) for i in range(min(len(gold), k)))
ndcg = dcg / idcg if idcg > 0 else 0
ap = sum(len(gold & set(predictions[:i+1])) / (i+1) for i, c in enumerate(predictions) if c in gold) / len(gold)
tp = len(gold & set(predictions))
p = tp / len(predictions) if predictions else 0
r = tp / len(gold) if gold else 0
f1 = 2 * p * r / (p + r) if (p + r) > 0 else 0
return {'p@k': p_at_k, 'ndcg': ndcg, 'ap': ap, 'f1': f1}
Common pitfalls
- Models pretrained on NMF/MFR during pretraining are excluded from the main comparison to avoid data leakage; only MLM-pretrained models (MF/MT) are fine-tuned on NMF/MFR for fair evaluation.
- Metrics are averaged over five independent fine-tuning runs to ensure robustness, not just a single split or run.
Evidence (verbatim from paper)
We evaluate using both binary classification metrics (precision (P), recall (R), F1) and standard IR ranking metrics: Precisión at $k$ ( $p@k$ ), Average Precision (AP), and nDCG, that are averaged over all test queries, with higher values indicating better performance (Manning, 2009; Radlinski & Craswell, 2010).
Citation
@misc{drechsel2025mamut,
title={MAMUT: A Novel Framework for Modifying Mathematical Formulas for the Generation of Specialized Datasets for Language Model Training},
author={Drechsel et al. (2025)},
year={2025},
note={arXiv:2502.20855}
}
1---2name: mamut-mir-eval3description: Evaluates mathematical information retrieval capabilities by testing whether models can match natural language names or LaTeX formulas to their corresponding mathematical identities from a candidate pool. It probes the model's ability to learn structural and notational variations in mathematical expressions through pretraining and fine-tuning. Use when the user wants to benchmark on MAMUT-generated datasets (MF, MT, NMF, MFR), or asks about evaluating this task. Reports nDCG.4---56# mamut-mir-eval78> MAMUT: A Novel Framework for Modifying Mathematical Formulas for the Generation of Specialized Datasets for Language Model Training — Drechsel et al. (2025) (arXiv:2502.20855, 2025)910## What this evaluates1112Evaluates mathematical information retrieval capabilities by testing whether models can match natural language names or LaTeX formulas to their corresponding mathematical identities from a candidate pool. It probes the model's ability to learn structural and notational variations in mathematical expressions through pretraining and fine-tuning.1314## Datasets1516- **MAMUT-generated datasets (MF, MT, NMF, MFR)** — total ?; splits: train (-1), test (-1); repo https://github.com/aieng-lab/math-mutator1718## Metrics1920- `nDCG` **(primary)** — range: [0, 1]21 - Normalized Discounted Cumulative Gain at rank k, measuring ranking quality by assigning higher scores to relevant items appearing higher in the list, normalized by the ideal DCG.22- `p@k` — range: [0, 1]23 - Precision at rank k, measuring the fraction of relevant items in the top-k retrieved results.24- `AP` — range: [0, 1]25 - Average Precision, the area under the precision-recall curve, averaging precision at each rank where a relevant item is retrieved.26- `F1` — range: [0, 1]27 - Harmonic mean of precision and recall for binary classification of query-relevance.2829## Input / output format3031**Input**: A query consisting of either a natural language name or a LaTeX formula, paired with a candidate set of formulas to retrieve from.3233**Output**: A ranked list of candidate formulas or binary relevance scores for each candidate.3435## Scoring recipe3637```python38import math39def compute_metrics(predictions, gold):40 k = 1041 p_at_k = len(gold & set(predictions[:k])) / k42 dcg = sum(1 / math.log2(i+2) for i, c in enumerate(predictions) if c in gold)43 idcg = sum(1 / math.log2(i+2) for i in range(min(len(gold), k)))44 ndcg = dcg / idcg if idcg > 0 else 045 ap = sum(len(gold & set(predictions[:i+1])) / (i+1) for i, c in enumerate(predictions) if c in gold) / len(gold)46 tp = len(gold & set(predictions))47 p = tp / len(predictions) if predictions else 048 r = tp / len(gold) if gold else 049 f1 = 2 * p * r / (p + r) if (p + r) > 0 else 050 return {'p@k': p_at_k, 'ndcg': ndcg, 'ap': ap, 'f1': f1}51```5253## Common pitfalls5455- Models pretrained on NMF/MFR during pretraining are excluded from the main comparison to avoid data leakage; only MLM-pretrained models (MF/MT) are fine-tuned on NMF/MFR for fair evaluation.56- Metrics are averaged over five independent fine-tuning runs to ensure robustness, not just a single split or run.5758## Evidence (verbatim from paper)5960> We evaluate using both binary classification metrics (precision (P), recall (R), F1) and standard IR ranking metrics: Precisión at $k$ ( $p@k$ ), Average Precision (AP), and nDCG, that are averaged over all test queries, with higher values indicating better performance (Manning, 2009; Radlinski & Craswell, 2010).6162## Citation6364```bibtex65@misc{drechsel2025mamut,66 title={MAMUT: A Novel Framework for Modifying Mathematical Formulas for the Generation of Specialized Datasets for Language Model Training},67 author={Drechsel et al. (2025)},68 year={2025},69 note={arXiv:2502.20855}70}71```7273- arXiv: 2502.20855