TopoAlign: A Framework for Aligning Code to Math via Topological Decomposition

Yupei Li, Philipp Borchert, Gerasimos Lampouras


Abstract
Large Language Models (LLMs) excel at both informal and formal (e.g. Lean 4) mathematical reasoning but still struggle with autoformalisation, the task of transforming informal into formal mathematical statements. Yet, the performance of current Math LLMs is constrained by the scarcity of large-scale corpora, particularly those containing pairs of informal and formal statements. Interestingly, the formal languages used in autoformalisation share structural similarities with programming languages, and code data is available at scale. However, current models trained on code do not transfer effectively to formal math, due to structural and syntactic differences between them. To address this, we propose TopoAlign, a framework that unlocks widely available code repositories as training resources for Math LLMs. TopoAlign decomposes code into docstrings, main functions, and dependency functions, and reassembles these components into analogues that structurally mirror formal statements. We train three state-of-the-art models, , and , and evaluate them on the , , and benchmarks. TopoAlign provides substantial gains for , improving performance by 17.77% on BEq@10 and 68.82% on typecheck@10, and also measurably improves by 0.12% on BEq@10 and 1.09% on typecheck@10 despite introducing no new mathematical knowledge.
Anthology ID:
2026.emnlp-main.512
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
11751–11768
Language:
URL:
https://aclanthology.org/2026.emnlp-main.512/
DOI:
Bibkey:
Cite (ACL):
Yupei Li, Philipp Borchert, and Gerasimos Lampouras. 2026. TopoAlign: A Framework for Aligning Code to Math via Topological Decomposition. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 11751–11768, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
TopoAlign: A Framework for Aligning Code to Math via Topological Decomposition (Li et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.512.pdf