# Tree-Based Representation and Generation of Natural and Mathematical Language

Source: [Tree-Based Representation and Generation of Natural and Mathematical Language](<https://www.sota2.com/research/paper/68fa6e8d1e209131cea40850>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2026-01-04T04:27:42.107Z

Authors: Alexander Scarlatos, Andrew Lan

Published: 2023-02-15T22:38:34.000Z

## Abstract

Mathematical language in scientific communications and educational scenarios is important yet relatively understudied compared to natural languages. Recent works on mathematical language focus either on representing stand-alone mathematical expressions, especially in their natural tree format, or mathematical reasoning in pre-trained natural language models. Existing works on jointly modeling and generating natural and mathematical languages simply treat mathematical expressions as text, without accounting for the rigid structural properties of mathematical expressions. In this paper, we propose a series of modifications to existing language models to jointly represent and generate text and math: representing mathematical expressions as sequences of node tokens in their operator tree format, using math symbol and tree position embeddings to preserve the semantic and structural properties of mathematical expressions, and using a constrained decoding method to generate mathematically valid expressions. We ground our modifications in GPT-2, resulting in a model MathGPT, and demonstrate that it outperforms baselines on mathematical expression generation tasks.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Headline Generation on EXEQ-300k (test)](<https://www.sota2.com/research/sota/headline-generation-on-exeq-300k-test.md>): Headline Generation; EXEQ-300k (test); BLEU-4: 56.5.

- [Student Answer Scoring on ASSISTments](<https://www.sota2.com/research/sota/student-answer-scoring-on-assistments.md>): Student Answer Scoring; ASSISTments; AUC: 94.2.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2302.07974>)

[PDF](<https://arxiv.org/pdf/2302.07974.pdf>)

[Implementation](<https://github.com/umass-ml4ed/mathGPT>)
