# Poster 29749

- Kind: Poster
- Talk page and recording: https://iclr.cc/virtual/2025/poster/29749

> Transcript of the talk's recording (session_asr), made by speech recognition or taken from the host's captions. It may contain errors. The words are the speakers'; listen to the recording on the talk's page before quoting it.

Hi, my name is Ashish Tiwari and I'll be talking about a recent work titled Execution Guided Within Prompt Search. This is joint work with other members of my team at Microsoft. So what's the problem? The task that we are interested in is to generate code that passes all the given assertions. For example, here I have just one assertion that says that the output of the function f should be the string 1, 3 when its arguments are the strings 1, 2, 3 and the string 2, 3 with spaces in between them.
Of course, I can use a large language model to generate such a function, but large language models can fail. So what can we do to improve the chances of success of a large language model? Now there are several works in the literature, several ideas such as self-reflection or self-debugging, chain of thought, tree of thought, and so on. And today I'll be going to talk about another such idea. So here's how we are thinking about the framework for describing code generation. We start...
from the input assertions describing the task. For the first line there may be some options based on the task, based on the assertions and let's say we have four options for line one for the code that goes on line one.
For each such option, there may be one or more options for line 2 and so on. Thus we get a search tree as shown here and a path in the search tree from the root to the leaf will correspond to a program, in this case a three-line program, and one of those programs might be the program that satisfies all the assertions and our task is to find that program. If we do this search explicitly, it's slow. How can we make it more efficient and how can we really guide the LLM to the correct completion?
So our first idea is within prompt search. The idea is to take the search tree that we saw in the previous slide and turn it into a linear path as shown here. Specifically, we take all the four options for line one and turn them as four lines of a bloated program. Then we generate options for line two conditioned on this bloated program.
So the prompt for line 3 will be a bloated program that has nine lines, four lines corresponding to the options for line 1 and five lines corresponding to the options for line 2. A second idea is execution guided search. Here we simply execute each line of code and annotate that line with the result of execution. The execution results are shown in blue over here.
When we generate options for line 2, that generation is conditioned on the bloated program with execution results. So, let's say we get a few options. We again execute those options, add the results in comments, and to get a bloated program that we use for generating line 3. So, at this point, when the LLM has to generate options for line 3, it really has to decide which of these v1 through v5 value should I use.
So what do the results look like? The main benefit of within prompt search is that it uses less tokens than outside prompt search such as free of thought and this is what we see in our experiments as well. If we normalize for the token usage and give each technique the same budget of tokens then we observe that our technique performs the best or the second best across all benchmark sets and we call this new metric that normalizes for token usage aligned pass at k.
Ablation results show that both execution guidance as well as within prompt search contribute to the overall performance of a technique. Our final experiment shows that our approach is able to backtrack and even forward jump. So backtracking corresponds to the case when you generate multiple options for a particular line, but you don't use any of them in the final program. And forward jumping corresponds to
The case when you generate multiple options for a particular line and use more than one in the final program. So to conclude I presented a technique called execution guided within from search which is an approach that allows large language models to function as a good policy function that generates good options for each line condition on execution results as well as a good value function that picks the most promising options to use for generating the next line.
Our approach is really a way to optimize token usage as compared to explicit out-of -prompt search. On the new aligned pass -at-k metric that normalizes for token usage, we showed that our method does better than most of the other baselines. Thank you.
