[Paper Review] Solving Probability and Statistics Problems by Program Synthesis
This paper introduces a novel approach to solving undergraduate-level probability and statistics problems by transforming them into programming tasks for program synthesis using OpenAI's Codex. By employing concept-grounded prompting and probabilistic simulation, the method achieves high accuracy on a new dataset of 40 university-level problems, demonstrating that large language models can effectively generate correct probabilistic code for complex statistical reasoning tasks.
We solve university level probability and statistics questions by program synthesis using OpenAI's Codex, a Transformer trained on text and fine-tuned on code. We transform course problems from MIT's 18.05 Introduction to Probability and Statistics and Harvard's STAT110 Probability into programming tasks. We then execute the generated code to get a solution. Since these course questions are grounded in probability, we often aim to have Codex generate probabilistic programs that simulate a large number of probabilistic dependencies to compute its solution. Our approach requires prompt engineering to transform the question from its original form to an explicit, tractable form that results in a correct program and solution. To estimate the amount of work needed to translate an original question into its tractable form, we measure the similarity between original and transformed questions. Our work is the first to introduce a new dataset of university-level probability and statistics problems and solve these problems in a scalable fashion using the program synthesis capabilities of large language models.
Motivation & Objective
- To address the challenge of automating solutions to complex, university-level probability and statistics problems that are difficult for standard foundation models.
- To develop a scalable, simulation-based approach using program synthesis to solve problems grounded in probabilistic dependencies.
- To introduce the first dataset of 40 undergraduate-level probability and statistics problems from MIT and Harvard courses for benchmarking.
- To evaluate the effectiveness of prompt engineering—particularly concept-grounded prompting—in enabling accurate program generation for probabilistic reasoning.
- To demonstrate that large language models can generate correct probabilistic simulations that yield accurate numerical solutions when properly prompted.
Proposed method
- Transform original probability and statistics questions into explicit programming tasks that request simulation of large numbers of probabilistic scenarios.
- Use OpenAI’s Codex, a fine-tuned Transformer model on code, to generate probabilistic programs from these programming tasks.
- Apply concept-grounded prompting by embedding relevant probability concepts (e.g., Bayes’ Theorem, conditional expectation) directly into the prompt to improve code accuracy.
- Execute the generated code to compute empirical estimates of probabilities or expectations through Monte Carlo simulation.
- Measure success by comparing the execution output of the synthesized code to the ground truth solution.
- Evaluate performance across two curated datasets: 20 applied problems from MIT’s 18.05 and 20 conceptual problems from Harvard’s STAT110 and Brainstellar.
Experimental results
Research questions
- RQ1Can program synthesis via large language models like Codex be effectively used to solve complex, university-level probability and statistics problems?
- RQ2How effective is concept-grounded prompting in improving the accuracy of program generation for probabilistic reasoning tasks?
- RQ3To what extent can probabilistic simulation via synthesized code approximate exact analytical solutions in undergraduate-level probability problems?
- RQ4What is the impact of prompt engineering on the reliability and correctness of generated programs for statistical problems?
- RQ5Can a new, curated dataset of undergraduate-level probability problems serve as a meaningful benchmark for evaluating program synthesis in mathematical reasoning?
Key findings
- The method achieved a 100% success rate on 20 applied probability problems from MIT’s 18.05 course, with all generated programs producing correct numerical solutions.
- On 20 conceptual problems from Harvard’s STAT110 and Brainstellar, the approach achieved a 95% success rate, with only one incorrect solution among the 20 tested.
- The average execution result across all problems was within 0.01 of the ground truth solution, indicating high numerical accuracy.
- The use of concept-grounded prompting significantly improved code correctness, especially for problems involving conditional probability and Bayes’ Theorem.
- The approach successfully solved the St. Petersburg paradox problem, generating a simulation that correctly estimated the expected payoff as approximately 50.
- The paper introduces a new, publicly available dataset of 40 university-level probability and statistics problems, filling a gap in existing benchmarks that focus only on grade-school level mathematics.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.