# Poster 27850

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

> 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 Shreyas and I'm presenting our iClear 2025 paper on using diffusion on syntax trees for program synthesis. LLMs are very good at programming, they are crushing benchmarks and are being used by developers all over the world. Some people even say that these models have sparks of AGI since they can draw unicorn in code. So I kind of wanted to try this out myself. So I gave one of these LLMs a logo design that I spent absolutely an enormous time working on.
And to my surprise, it produces a valid SVG file. But when I compile the SVG file, I get that. Okay, let's try something easier. This is a sketch of some arrows that I drew. It produces an SVG file, which compiles to that. Okay, let's see maybe the model can fix its mistake. So let's give the image back into the model. Let's hit run, ask it to fix it, and it says it has fixed it. Let's view this image.
Okay, that's kind of sad. Okay, so the motivation for our work is that LLMs are autoregressive, meaning that they produce code one token at a time. But the way humans write code looks a lot more like editing code, running it, and then iterating and then editing and debugging it. And so these LLM models can't check their intermediate outputs. And where do we even find a large dataset of humans iterating on code? Okay, first I'll show a demo of our paper, and then I'll briefly talk about the technical details.
Here is the same task of converting a hand -drawn sketch shown on the bottom to a program that generates that hand-drawn icon. We see how our system actually edits code, looks at the outputs, and makes more edits until it figures out how to write the code for that sketch. And the input to our system is just the raw pixels of the sketch and nothing else. Here's another example. In blue, we show the probabilities of our model wanting to edit that part of the program.
Okay, so how does this work? Well, first of all, we want to be able to see programs as syntax trees. On the left is a program, in the middle is a syntax tree, and on the right is a compilation of that syntax tree. Here is another example of a different language. Recall that in diffusion models, we take continuous data such as images and then progressively add more and more noise, and then we train a neural network to reverse that noising process.
In our paper, we develop an analog for that for syntax trees. We first take a randomly generated program, add small mutations to that program, and then train a neural network to invert that noise. We called this neural network our policy network. Note that this neural network is conditional, that is, it is conditioned on a particular image that we want to generate the program for. In the example shown here, we have a nice looking icon and as we add more mutations to it, it becomes a very different image.
The mutations are happening in program space. Our policy network takes in a target image and the current output of the program we are editing, and passes that to an image encoder. We also take in the text version of that current program, and then we ask the model to predict an edit to that current program. Because we know the trajectory of the mutations, we add the noise and it's random noise.
Given two images, we can train a model to also predict the number of steps between the program. We call this neural network the value network. And when we have these two networks trained, we can actually do tree search to find programs that match a given target. But how do we use this system on hand-drawn sketches? Well, we just changed the compiler so it takes that program and instead of compiling an image, it compiles a hand-drawn sketch of that thing. With the system trained, it now outputs a distribution over edits to programs.
Here is an example of our model editing some code and figuring out how to make it the sketch match. Here is an example of our system diffusing a very small subset of the SVG language. Okay, so how does this compare to baseline approaches? So we quantitatively evaluated our system and compared its performance using previous baselines, including a vision language transformer that is allowed to repeatedly try to get the right program.
As you can see here, that gray line on the bottom is our vision language model, and our trade diffusion approach actually significantly improves the performance, and if you attack on search at the end, it makes it even better. For more technical details and quantitative ablations, please check out our work at trade diffusion.github.io. Thank you!
