Introduction
Mathematical formulas are inherently structural and hierarchical. For instance, a fraction consists of a numerator and a denominator, while an exponent is positioned relative to its base. Despite this, many existing machine learning models treat mathematical notation as a flat sequence of symbols, similar to natural language. This "flat" approach fails to capture the underlying logic of mathematics, leading to significant retrieval gaps—where models struggle to identify structural similarities between formulas like $x^2 + y^2$ and $a^2 + b^2$—and generation failures, particularly for complex structures like matrices or nested fractions.
To address these challenges, the researchers introduced FORTE (Mathematical FOrmula Representation learning via Tree Embeddings), an unsupervised framework that represents formulas as hierarchical operator trees.
The FORTE Framework
The core innovation of FORTE lies in its shift from sequential to tree-based processing. The framework utilizes several key architectural components to better capture mathematical grammar.
Operator Trees and Positional Embedding
Formulas are first converted into Operator Trees (OT), where mathematical operators (e.g., $+$, $\int$) serve as internal nodes and variables or numbers act as leaves. To represent a node's location within the tree, FORTE employs a Binary Tree Positional Embedding scheme. Unlike traditional one-hot methods that scale linearly with the number of children, this binary encoding is significantly more space-efficient, reducing complexity from $O(LC)$ to $O(L \log_2 C)$, where $L$ is the tree depth and $C$ is the number of children.
Tree Decoder and "End" Nodes
A common difficulty in tree generation is determining when a specific branch is complete. FORTE addresses this by attaching a special "End" (E) node to every node in the target tree. These nodes provide a clear signal to the decoder to stop generating children for a given operator, ensuring the structural integrity of the generated formula.
Tree Beam Search (TBS)
While standard beam search is effective for sequences, it is ill-suited for the branching nature of trees. The authors developed Tree Beam Search, a stack-based algorithm that tracks multiple candidate trees simultaneously during the generation process, resulting in higher-quality and more mathematically sound outputs.
Experimental Setup and Results
FORTE was trained and evaluated using a massive dataset of over 770,000 formulas curated from Wikipedia and arXiv, alongside the NTCIR-12 benchmark for retrieval tasks.
Formula Reconstruction
In reconstruction tasks, FORTE achieved a 94.67% Top-1 Accuracy, significantly outperforming specialized tree-based baselines such as tree2treeRNN (71.73%) and treeTransformer (77.20%). This demonstrates the model's superior ability to learn the "grammar" of mathematics through its tree-based architecture.
Formula Retrieval
Evaluated on the NTCIR-12 benchmark, a hybrid version of the model (FORTE-App) achieved a Mean Average Precision (MAP) of 0.509. This set a new state-of-the-art record, surpassing established systems like Tangent-S and Approach0.
Conclusion and Future Directions
FORTE demonstrates that treating mathematics as a tree rather than a string allows models to inherently learn the complex structural rules of mathematical notation. While the model is highly effective at capturing semantic similarity, future work could focus on further bridging the gap between neural representations and symbolic nuance. Additionally, integrating surrounding natural language context from textbooks could enhance retrieval performance and open doors for educational applications such as automated grading and neural mathematical reasoning.
Summary updated