Probabilistic Programs of Thought

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Garg, Poorva, Geh, Renato Lui, Israel, Daniel, Millstein, Todd, Richardson, Kyle, Broeck, Guy Van den
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917420209274880
author Garg, Poorva
Geh, Renato Lui
Israel, Daniel
Millstein, Todd
Richardson, Kyle
Broeck, Guy Van den
author_facet Garg, Poorva
Geh, Renato Lui
Israel, Daniel
Millstein, Todd
Richardson, Kyle
Broeck, Guy Van den
contents LLMs are widely used for code generation and mathematical reasoning tasks where they are required to generate structured output. They either need to reason about code, generate code for a given specification, or reason using programs of thought. The typical approach to code generation is to prompt the model and generate samples until an appropriate program is obtained. Within this process, sampling $n$ programs from the language model requires $n$ GPU compute-intensive generations which becomes prohibitively expensive for larger values of $n$. In this work, we address this limitation by exposing the LLM's distribution within the generated programs themselves. We propose a novel test-time framework we dub probabilistic programs of thought to obtain more samples from the model with fewer LLM generations. Given a program generated by a model and the associated next-token probabilities, we build a probabilistic program that compactly represents exponentially many deterministic programs. Since performing probabilistic reasoning in this probabilistic program is much cheaper, our approach allows sampling new programs without any additional GPU compute and little CPU overhead. We instantiate our approach on benchmarks for code generation, code understanding and mathematical reasoning and report improvements in performance with fewer generations from the LLM.
format Preprint
id arxiv_https___arxiv_org_abs_2604_17290
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Probabilistic Programs of Thought
Garg, Poorva
Geh, Renato Lui
Israel, Daniel
Millstein, Todd
Richardson, Kyle
Broeck, Guy Van den
Computation and Language
Artificial Intelligence
Programming Languages
LLMs are widely used for code generation and mathematical reasoning tasks where they are required to generate structured output. They either need to reason about code, generate code for a given specification, or reason using programs of thought. The typical approach to code generation is to prompt the model and generate samples until an appropriate program is obtained. Within this process, sampling $n$ programs from the language model requires $n$ GPU compute-intensive generations which becomes prohibitively expensive for larger values of $n$. In this work, we address this limitation by exposing the LLM's distribution within the generated programs themselves. We propose a novel test-time framework we dub probabilistic programs of thought to obtain more samples from the model with fewer LLM generations. Given a program generated by a model and the associated next-token probabilities, we build a probabilistic program that compactly represents exponentially many deterministic programs. Since performing probabilistic reasoning in this probabilistic program is much cheaper, our approach allows sampling new programs without any additional GPU compute and little CPU overhead. We instantiate our approach on benchmarks for code generation, code understanding and mathematical reasoning and report improvements in performance with fewer generations from the LLM.
title Probabilistic Programs of Thought
topic Computation and Language
Artificial Intelligence
Programming Languages
url https://arxiv.org/abs/2604.17290