Table of Contents
Fetching ...

VerityMath: Advancing Mathematical Reasoning by Self-Verification Through Unit Consistency

Vernon Toh Yan Han, Ratish Puduppully, Nancy F. Chen

TL;DR

VerityMath tackles the open problem of robust mathematical reasoning in open-source LLMs by introducing Unit Consistency Programs that enforce unit-correctness via Counter objects and assert checks. The authors curate a UCP-annotated dataset and fine-tune 7B LLMs to generate executable Python programs for math word problems, achieving competitive but slightly lower overall accuracy than PAL-based baselines. Through detailed error analysis, they reveal that Counter/assert correctness and data scale are key factors affecting performance, and they outline concrete paths for improvement. The work demonstrates the value of self-verification through unit consistency in enhancing trustworthy reasoning, with potential for further gains as training data and unit-check mechanisms improve.

Abstract

Large Language Models (LLMs), combined with program-based solving techniques, are increasingly demonstrating proficiency in mathematical reasoning. For example, closed-source models such as OpenAI GPT-4 and Claude show excellent results in solving math word problems. However, progress in math word problem-solving for open-source LLMs is limited, and the challenges these models face are not well-studied. In this paper, we study the performance of strong open-source LLMs, including Llama 2 (7B), Code Llama (7B), and Mistral (7B) on math word problems using program-based solving techniques. Specifically, we analyze the outputs of these models when applied to math word problems and identify a category of problems that pose a significant challenge, particularly those involving quantities spanning multiple units. To address this issue, we propose a systematic approach by defining the units for each quantity and ensuring the consistency of these units during mathematical operations. We developed Unit Consistency Programs (UCPs), an annotated dataset of math word problems, each paired with programs containing unit specifications and unit verification routines. We fine-tuned Llama 2 (7B), Code Llama (7B), and Mistral (7B) models with UCPs to produce theirVerityMath variants. Our findings indicate that our approach, which incorporates unit consistency, currently slightly underperforms compared to an approach that does not. To understand the reasons behind this, we conduct an in-depth error analysis and suggest options for future improvements. Our code and dataset are available at https://github.com/vernontoh/VerityMath.

VerityMath: Advancing Mathematical Reasoning by Self-Verification Through Unit Consistency

TL;DR

VerityMath tackles the open problem of robust mathematical reasoning in open-source LLMs by introducing Unit Consistency Programs that enforce unit-correctness via Counter objects and assert checks. The authors curate a UCP-annotated dataset and fine-tune 7B LLMs to generate executable Python programs for math word problems, achieving competitive but slightly lower overall accuracy than PAL-based baselines. Through detailed error analysis, they reveal that Counter/assert correctness and data scale are key factors affecting performance, and they outline concrete paths for improvement. The work demonstrates the value of self-verification through unit consistency in enhancing trustworthy reasoning, with potential for further gains as training data and unit-check mechanisms improve.

Abstract

Large Language Models (LLMs), combined with program-based solving techniques, are increasingly demonstrating proficiency in mathematical reasoning. For example, closed-source models such as OpenAI GPT-4 and Claude show excellent results in solving math word problems. However, progress in math word problem-solving for open-source LLMs is limited, and the challenges these models face are not well-studied. In this paper, we study the performance of strong open-source LLMs, including Llama 2 (7B), Code Llama (7B), and Mistral (7B) on math word problems using program-based solving techniques. Specifically, we analyze the outputs of these models when applied to math word problems and identify a category of problems that pose a significant challenge, particularly those involving quantities spanning multiple units. To address this issue, we propose a systematic approach by defining the units for each quantity and ensuring the consistency of these units during mathematical operations. We developed Unit Consistency Programs (UCPs), an annotated dataset of math word problems, each paired with programs containing unit specifications and unit verification routines. We fine-tuned Llama 2 (7B), Code Llama (7B), and Mistral (7B) models with UCPs to produce theirVerityMath variants. Our findings indicate that our approach, which incorporates unit consistency, currently slightly underperforms compared to an approach that does not. To understand the reasons behind this, we conduct an in-depth error analysis and suggest options for future improvements. Our code and dataset are available at https://github.com/vernontoh/VerityMath.
Paper Structure (33 sections, 4 figures, 5 tables)

This paper contains 33 sections, 4 figures, 5 tables.

Figures (4)

  • Figure 1: Comparison between PAL-based Programs and Unit Consistency Programs. Unit Consistency Programs contain unit specifications using Counter objects and unit verification routines using assert statements.
  • Figure 2: Error analysis of VerityMath-Mistral (7B). Correct Answer: The program compiles and produces the correct answer. Wrong Answer: The program compiles but produces an incorrect answer. Wrong Counter or assert : After removing Counter and assert statements, the program produces the correct answer. Compilation Error: The program is unable to compile.
  • Figure 3: Performance of VerityMath-Mistral (7B) on the GSM8K test dataset based on the number of assert statements in the code solution. The percentage shown in each bar represents the percentage of correct answers given the number of assert statements in the code solution.
  • Figure 4: Performance of VerityMath-Mistral (7B) as we scale the number of training examples of GSM8K-PAL and UCPs. GSM8K-PAL has a total of 6877 annotated training examples whereas UCPs have 4480 annotated training examples.