Autoformalize Mathematical Statements by Symbolic Equivalence and Semantic Consistency

Autoformalization, the task of automatically translating natural language descriptions into a formal language, poses a significant challenge across various domains, especially in mathematics. Recent advancements in large language models (LLMs) have unveiled their promising capabilities to formalize even competition-level math problems. However, we observe a considerable discrepancy between pass@1 and pass@k accuracies in LLM-generated formalizations. To address this gap, we introduce a novel framework that scores and selects the best result from k autoformalization candidates based on two complementary self-consistency methods: symbolic equivalence and semantic consistency. Elaborately, symbolic equivalence identifies the logical homogeneity among autoformalization candidates using automated theorem provers, and semantic consistency evaluates the preservation of the original meaning by informalizing the candidates and computing the similarity between the embeddings of the original and informalized texts. Our extensive experiments on the MATH and miniF2F datasets demonstrate that our approach significantly enhances autoformalization accuracy, achieving up to 0.22-1.35x relative improvements across various LLMs and baseline methods.

Paper

Similar papers

Peer review

Reviewer GLbW5/10 · confidence 4/52024-06-13

Summary

This paper designs two self-consistency methods for formalizing mathematical statements in natural language into Isabelle --- symbolic equivalence and semantic consistency. In particular, symbolic equivalence measures whether the formalized statements are equivalent (judged by the Isabelle’s built-in automated theorem provers), and semantic consistency measures the similarity of the natural language translation of the formalized statement and its original statement (In other words, semantic consistency measures whether the formalized statement keeps the semantic meaning.) Tested with various base models, this paper shows that the combination of the two proposed methods improves the success rate of the autoformalization process.

Strengths

- This paper studies an interesting topic, self-consistency for autoformalization, which is non-trivial because the target is not unique. To the best of my knowledge, this is the first paper to study the self-consistency methods for autoformalization. - Figure 2 shows that self-consistency methods for autoformalization have great potential because the pass@k accuracy keeps increasing with more trails.

Weaknesses

- The major weakness of this paper is the scope of the autoformalization --- the symbolic equivalence method only applies to the formalization of theorem statements instead of their proofs. Autoformalization of theorem statements is an arguably less significant problem since it cannot be used to verify any informal proofs.

Questions

- Definition 1 looks unnecessarily complicated to me. For two theorems A and B, does the symbolic equivalence just mean that A and B are equivalent (which can be checked by the Isabelle solve_direct tool)? - The variable misalignment example is confusing to me. In particular, do the authors suggest that the No. 2 and No.3 outputs in Figure 1 should be equivalent? It seems to me that in output No. 3, the variables x and y are untyped but x, y in output No. 2 have type real. In addition, it is even unclear to me whether output No. 3 is provable. - Is the phenomenon in Figure 2 true for models finetuned for autoformalization such as MMA? In addition, does SymEq/SemCo still improve the performance over MMA models?

Rating

5

Confidence

4

Soundness

2

Presentation

4

Contribution

2

Limitations

The authors adequately addressed the limitations and potential negative societal impact.

Reviewer LZ2a6/10 · confidence 4/52024-06-29

Summary

This paper targets the task of autoformalization for mathematics, which inputs an informal theorem statement (in English) and outputs a formal theorem statement (inside an interactive theorem prover). Prior work has used LLMs in-context to produce autoformalizations. The work is motivated by a disparity between top-1 accuracy and top-k accuracy when sampling formalizations from LLMs. The proposed method works atop any generative model of formalized statements. Their approach is to refine the k samples to a final choice via a voting mechanism. The approach is twofold - first a symbolic equivalence method uses automated theorem provers (ATPs) to check for equivalence between two formalized statements. The k-samples are then clustered by equivalence, and then they perform semantic consistency: measuring the embedding similarity between the original informal statement and the informalized formal statement. They indicate improvements over the baselines.

Strengths

1. The idea to compare formalization candidates via symbolic equivalence is interesting. It is a nice strategy to impose additional structure on the k-autoformalization samples. The use of the semantic consistency is a natural extension of the distilled backpropogation idea presented in (https://arxiv.org/abs/2302.12433). While measuring alignment with the informal statement is not automatable, the symbolic equivalence is a nice intermediate which I believe will be further explored in the future. 2. The results indicate that their approach is effective. As the approach can be placed atop any autoformalization strategy sampling > 1 candidates from a generative model, the idea is generally applicable and should be useful for all such future work.

Weaknesses

1. The semantic consistency alone does not appear to perform much better, I wonder if this is due to the choice of BERT for the embeddings. Perhaps you can use a newer model to judge its efficacy? 2. The formulae for combining the semantic consistency score do not seem to have any motivation for the particular choice of $f(x) = x, x^2, \log x$. Can the authors explain the rationale for these choices? 3. The definition of $\tau$-semantic consistency is not used elsewhere. In particular, it is unclear the purpose of the incorporation of $\tau$ as it is not mentioned again.

Questions

1. The BERT model is used for measuring embedding similarity. How do the results change if using better models? BERT is quite outdated at this point. 2. Can you provide analysis as to why the log-combination is better than the other two? 3. On line 308 you indicate that on average about 2 symbolic equivalences are proven for k = 10 samples, this is lower than I had expected. What is the average cluster size per problem? Is it often the case that the models output candidates which are not symbolically equivalent (or at least, cannot be proven to be)? Does the chosen formalization end up coming from a larger cluster, even with semantic consistency being used? 4. In algorithm 1 you mentioned you standardize candidates $\Psi_i, \Psi_j$. What is the protocol for performing this operation? Do all hypotheses go in P_i, P_j? Typos: 1. On line 164 you mentioned that prior works commonly assign scores based on cluster size. Could you include a reference? 2. On line 166 you mentioned the self-consistency is the similarity between the autoformalized version and its informalization. Did you mean the informalized version and the informal statement? Line 34: Cover -> Recover? Line 261: wining -> winning Line 301: autoformalizaiton -> autoformalization Line 578: "Some motivation examples -> "Some motivational examples" or "Motivating examples"

Rating

6

Confidence

4

Soundness

3

Presentation

3

Contribution

3

Limitations

I believe the authors have adequately addressed the potential limitations of their work in the limitations section in the appendix.

Authorsrebuttal2024-08-10

Response to the Reviewer LZ2a

Equivalence checking solely up to variable naming is not considered the general case. In fact, the primary challenge in autoformalization lies in accurately modeling mathematical concepts. Therefore, symbolic reasoning that extends beyond mere variable matching is essential when language models represent the same concept in various ways. We list four examples in the following. ``` (*A standard six-sided die was rolled 50 times, and the outcomes are shown in the table. What is the average of the 50 outcomes? Express your answer as a decimal to the nearest hundredth. \\begin{tabular}{|c|c|}\n\\hline\nOutcome&$\\#$ of Occurrences\\\\\\hline\n1&14\\\\\\hline\n2&5\\\\\\hline\n3&9\\\\\\hline\n4&7\\\\\\hline\n5&7\\\\\\hline\n6&8\\\\\\hline\n\\end{tabular}*) theorem fixes outcome :: "nat \<Rightarrow> nat" assumes h0 : "outcome 1 = 14" and h1 : "outcome 2 = 5" and h2 : "outcome 3 = 9" and h3 : "outcome 4 = 7" and h4 : "outcome 5 = 7" and h5 : "outcome 6 = 8" and h6 : "sum outcome {1..6} = 50" shows "(sum (\<lambda>i. i * outcome i) {1..6}) / 50 = 3.24" theorem fixes avg :: real assumes h0 : "avg = (14*1 + 5*2 + 9*3 + 7*4 + 7*5 + 8*6) / 50" shows "avg = 3.24" (* Problem : The sum of the $x$-coordinates of the vertices of a triangle in the Cartesian plane equals $\\sqrt{13}$. Let $S$ equal the sum of the $x$-coordinates of the midpoints of the sides of the triangle. Find $S^2$.*) theorem fixes A B C M1 M2 M3 :: "real * real" assumes h0 : "fst A + fst B + fst C = sqrt 13" and h1 : "M1 = ((fst A + fst B) / 2, (snd A + snd B) / 2)" and h2 : "M2 = ((fst B + fst C) / 2, (snd B + snd C) / 2)" and h3 : "M3 = ((fst A + fst C) / 2, (snd A + snd C) / 2)" and h4 : "S = fst M1 + fst M2 + fst M3" shows "S powr 2 = 13" theorem fixes A B C M1 M2 M3 :: "real * real" assumes h0 : "fst A + fst B + fst C = sqrt 13" and h1 : "M1 = midpoint A B" and h2 : "M2 = midpoint B C" and h3 : "M3 = midpoint C A" and h4 : "\<forall> P Q. midpoint P Q = ((fst P + fst Q)/2, (snd P + snd Q)/2)" and h5 : "S = fst M1 + fst M2 + fst M3" shows "S^2 = 13" (* What is the least common multiple of all positive integers smaller than 8? *) theorem fixes n :: nat and lcm :: "nat \<Rightarrow> nat \<Rightarrow> nat" assumes h0 : "n < 8" and h1 : "\<forall> a b. lcm a b = (a * b) div (gcd a b)" shows "fold lcm [1..<8] 1 = 420" theorem fixes lcm :: "nat \<Rightarrow> nat \<Rightarrow> nat" assumes h0 : "\<forall> a b. lcm a b = (a * b) div (gcd a b)" shows "lcm (lcm (lcm (lcm (lcm (lcm (lcm 1 1) 2) 3) 4) 5) 6) 7 = 420" (* Daniel works at an electronics store, and he claims that the popularity of a television (measured in number of sales) is inversely proportional to its cost. If 15 customers buy a television that costs $\\$$1500, according to Daniel's theory, how many customers would buy a television that costs $\\$$2500? *) theorem fixes cost1 cost2 sales1 sales2 :: real assumes h0 : "cost1 = 1500" and h1 : "cost2 = 2500" and h2 : "sales1 = 15" and h3 : "cost1 * sales1 = cost2 * sales2" shows "sales2 = 9" theorem fixes x y k :: real and f :: "real \<Rightarrow> real" assumes h0 : "f 1500 = 15" and h1 : "f 2500 = y" and h2 : "\<forall> x. x * f x = k" shows "y = 9" ```

Reviewer LZ2a2024-08-12

These examples are illuminating and help me better understand that the symbolic equivalence is checking for more than just variable name differences. Thanks to the authors for the responses, which have alleviated my previous concerns. Consequently, I will increase my score.

Reviewer zk1U8/10 · confidence 4/52024-07-11

Summary

This paper introduces two methods metrics, symbolic equivalence and semantic consistency, to determine the equivalence relation between formal statements. They design novel technical solutions to measure each method and show that this improves autoformalization by allowing self-consistency-based clustering.

Strengths

1. The paper addresses an important and novel problem of improving autoformalization with more test-time compute. 2. The methods used are very intuitive and easy to understand. 3. The evaluation is sound and shows good performance gain. 4. The writing is clear and easy to follow.

Weaknesses

Since the authors investigated 5 models of different sizes, I wish they investigated the models' performances with the same amount of test-time compute. I.e., given the same amount of FLOP (as measured by cost, since Codex and GPT-4 did not reveal their parameter count), which model is preferred. This helps the reader understand which model they should choose for their workload.

Questions

How are the numbers supporting Figure 2 obtained? How many datapoints from MATH and miniF2F did you evaluate?

Rating

8

Confidence

4

Soundness

4

Presentation

4

Contribution

4

Limitations

In the conclusions, the authors did mention the things they wish to leave for future work, but it feels somewhat vague. It would be good if the authors can be more concrete and lay out future ideas they'd like to try or would like the community to carry out.

Reviewer 37Eh7/10 · confidence 2/52024-07-14

Summary

The paper presents a novel framework aimed at enhancing the accuracy of autoformalization in mathematics using LLMs. It addresses the challenge of translating natural language mathematical statements into formal language by introducing a two-pronged approach based on symbolic equivalence and semantic consistency. Symbolic equivalence leverages automated theorem provers to ensure logical homogeneity among autoformalization candidates, while semantic consistency evaluates the preservation of the original statement's meaning by comparing embeddings of the re-informalized text and the original. The framework scores and selects the best result from multiple autoformalization candidates, significantly improving accuracy across various LLMs and datasets like MATH and miniF2F. The extensive experiments demonstrate the synergistic effect of the two consistency methods, achieving relative improvements in autoformalization accuracy and reducing the need for manual verification.

Strengths

1. Clear Presentation and Structure: The paper is well-organized, with a nice logical flow. I really like the figures and tables in the paper. 2. Open Source: The authors submit the implementation of the proposed methods, which is beneficial for the research community. 3. Innovative Framework: Introduces a new approach that combines symbolic equivalence and semantic consistency to improve the accuracy of autoformalization. Symbolic equivalence and semantic consistency are mutually complementary, with their combination further enhancing performance. 4. Comprehensive Evaluation: The authors conduct extensive experiments on two mathematical datasets, MATH and miniF2F, demonstrating the efficacy of the proposed methods. 5. Wide Applicability: The proposed framework is effective across various model sizes and is not limited to a specific LLM, indicating broad applicability.

Weaknesses

This paper makes a valuable contribution to the field of formal mathematics. While I'm new to autoformalization and not an expert in this area, I believe the paper is well-written and presents a strong argument. However, due to my limited experience, my confidence level is relatively low as I might have missed some key points.

Questions

I only have a few questions as below. 1. According to Table 1, It seems to me that semantic consistency is not working alone. It has to be used with Symbolic Equivalence. Could you provide more insights into why this is the case? On the other hand, the default settings of semantic consistency use representation from BERT and cosine similarity. Did you try other alternative methods to compute semantic consistency? I am not sure if the bottleneck is the idea of semantic consistency or the method used. 2. I am wondering if the proposed method also works for "low-resource autoformalization". The community is switching from Lean 3 to Lean 4, but existing LLMs are not performing well on Lean 4 as they have not been pretrained on enough Lean 4 corpus (also because of the limited availability).

Rating

7

Confidence

2

Soundness

3

Presentation

3

Contribution

3

Limitations

The authors adequately addressed the limitations

Reviewer 37Eh2024-08-09

Thanks for the response. The authors have addressed most of my concerns. I will keep my rating positive for t his paper.

Reviewer zk1U2024-08-09

Thank you for the response. They have addressed my question. I'll maintain my score.

Reviewer LZ2a2024-08-10

Thanks to the authors for addressing my questions. >The standardization is employed to align variables and it does put all hypothesis into $P_i$ and $P_j$. Elaborately, given two formal statements, if their conclusions are in the form of the numerical relation, the standardization introduces new variables $\alpha$, and identifies other variable as auxiliary variables. For other cases, the standardization conduct the bipartite matching for the alignment. Is it normally the case that the symbolic equivalence is only checking for statements being equivalent up to variable naming, but no more than that? What is an instance where the symbolic equivalence checks for a more nontrivial property? I believe the ones included in the main body and the appendix are all instances of variable matching.

Reviewer GLbW2024-08-11

I thank the authors for the examples and additional results. My concerns are addressed and I will increase my score accordingly.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC