← Latest papers
🤖 machine learning

PPDL: LLM-Based Flows as Probabilistic Programs

This paper introduces PPDL, a probabilistic programming language that enables developers to quantify and propagate uncertainty across LLM-based application flows and experiment with inference scaling techniques without modifying the core logic, as demonstrated through a theorem proving agent for the Rocq prover.

Original authors: Louis Mandel, Guillaume Baudart, Mandana Vaziri, Martin Hirzel

Published 2026-08-07
📖 6 min read🧠 Deep dive

Original authors: Louis Mandel, Guillaume Baudart, Mandana Vaziri, Martin Hirzel

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to solve a really tricky puzzle, but instead of doing it alone, you have a super-smart, creative friend who can talk to you. This friend is an Artificial Intelligence called a Large Language Model (LLM). They are amazing at writing stories, solving math problems, and even writing computer code. However, they aren't perfect. Sometimes they get confident about the wrong answer, or they might make up facts that sound real but aren't. This is called "uncertainty."

Now, imagine you need to solve a really hard problem that requires many steps. You ask your AI friend for a plan, then ask them to write code based on that plan, then ask them to check the code, and so on. Every time you ask a question, the AI gives an answer, but that answer might be slightly shaky. If you chain ten of these shaky answers together, the final result could be a total mess. It's like trying to build a tower of Jenga blocks where every block is slightly wobbly; the higher you go, the more likely the whole thing is to collapse. Developers and users often feel lost here: "Is this answer right? How sure are we? Should I trust it?"

To fix this, scientists have tried a few tricks. One popular idea is "inference scaling." Think of this as asking your AI friend to try the same puzzle ten different times and seeing which answer comes up most often. It's like asking a group of friends to guess the answer to a riddle and going with the majority vote. But here's the catch: doing this manually is messy. You have to write special computer code to run those ten tries, keep track of which ones look good, and throw away the bad ones. It's like having to build a new factory every time you want to bake a batch of cookies just to make sure they taste right. It's complicated, expensive, and hard to change if you want to try a different way of baking.

The Paper's Big Idea: The "Magic Scorecard"

This paper introduces a new tool called PPDL (Probabilistic Prompt Declaration Language). You can think of PPDL as a special "magic scorecard" for AI workflows. Instead of just asking the AI a question and getting a single answer, PPDL lets you write a program that naturally understands that the AI might be unsure.

Here is how it works in plain language:

  1. The Flow: You write your instructions for the AI just like you normally would (e.g., "Plan the code," then "Write the code," then "Check the code").
  2. The Magic Factor: You add a special instruction called a factor. This is like a scorecard where you tell the AI, "Hey, if the plan sounds logical, give it a high score. If the code has errors, give it a low score."
  3. The Result: When you run the program, the computer doesn't just give you one answer. It runs the whole process many times in parallel (like having a hundred different versions of you trying the puzzle at once). It uses your "scorecard" to weigh the results. If one path looks really promising, the computer focuses more energy on that path. If a path looks bad, it drops it.

The coolest part is that you don't have to write the complex "run it ten times" code yourself. PPDL handles all that heavy lifting in the background. You just write the logic once, and the system automatically figures out the best way to explore all the possibilities.

What They Found

The authors tested this idea on several challenges, from solving grade-school math problems to writing complex computer code and even proving mathematical theorems.

  • Better Accuracy: In their tests, using PPDL with these "scorecards" made the AI significantly more accurate. For example, on a math test called GSM8k, a standard AI got about 83.8% of the answers right. But when they used PPDL with a method called "Importance Sampling" (which is like a smart way of picking the best guesses), the accuracy jumped to 93.7%.
  • The "Smart" Way Wins: They compared different ways of using the scorecards. Sometimes, just taking the "majority vote" (the most common answer) worked well. But often, the smarter methods (like Importance Sampling and Sequential Monte Carlo) were much better. These methods are like having a detective who doesn't just count votes but actually investigates why an answer is good or bad, discarding bad paths early and focusing on the good ones.
  • The Theorem Prover Case Study: To really stress-test the system, they built an AI agent to prove mathematical theorems using a tool called Rocq. This is a very hard task where the AI has to write a proof, check if it's wrong, and fix it repeatedly. They found that the "smart" method (Sequential Monte Carlo) was much better at finding the right proof than just trying random guesses over and over. It could explore many different paths at once and quickly abandon the ones that were going nowhere.

What They Didn't Claim

The authors are careful not to say this is a "magic bullet" that solves everything. They point out that the "scorecards" (the factors) are only as good as the information you put into them. If your scorecard is bad, the system won't magically fix it. Also, while this method makes the AI more reliable, it doesn't mean the AI is suddenly perfect; it just means we have a much better way to measure how sure we should be about the answer.

Why It Matters

This paper suggests that by treating AI workflows as "probabilistic programs" (programs that understand uncertainty), we can make AI applications much more trustworthy without making them incredibly complicated to build. It's like giving developers a new set of tools that automatically handle the messy business of "trying again and again," so they can focus on building cool things while the computer figures out the best way to get the right answer.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →