Amortizing intractable inference in diffusion models for vision, language, and control

Diffusion models have emerged as effective distribution estimators in vision, language, and reinforcement learning, but their use as priors in downstream tasks poses an intractable posterior inference problem. This paper studies amortized sampling of the posterior over data, $\mathbf{x}\sim p^{\rm post}(\mathbf{x})\propto p(\mathbf{x})r(\mathbf{x})$, in a model that consists of a diffusion generative model prior $p(\mathbf{x})$ and a black-box constraint or likelihood function $r(\mathbf{x})$. We state and prove the asymptotic correctness of a data-free learning objective, relative trajectory balance, for training a diffusion model that samples from this posterior, a problem that existing methods solve only approximately or in restricted cases. Relative trajectory balance arises from the generative flow network perspective on diffusion models, which allows the use of deep reinforcement learning techniques to improve mode coverage. Experiments illustrate the broad potential of unbiased inference of arbitrary posteriors under diffusion priors: in vision (classifier guidance), language (infilling under a discrete diffusion LLM), and multimodal data (text-to-image generation). Beyond generative modeling, we apply relative trajectory balance to the problem of continuous control with a score-based behavior prior, achieving state-of-the-art results on benchmarks in offline reinforcement learning.

Paper

References (92)

10Transport meets Variational Inference: Controlled Monte Carlo Diffusions2023

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer Z1Kk7/10 · confidence 3/52024-07-11

Summary

This paper studies the problem of training diffusion models to sample from an intractable posterior distribution, defined by a prior diffusion model and an arbitrary likelihood function. The contributions are summarized as follows: - This paper proposes relative trajectory balance (RTB) for training diffusion-based models to sample from a posterior distribution. RTB is derived from the perspective of continuous GFlowNets, which thus enables off-policy training. In contrast to related literature, the proposed approach performs posterior inference by fine-tuning a prior diffusion model in a parameter-efficient way. - The effectiveness of the proposed approach is validated through experiments in vision, language modeling, and continuous control benchmarks.

Strengths

- This paper proposes to train diffusion-based models to sample from an intractable posterior distribution. In particular, the proposed approach performs posterior inference by fine-tuning a prior diffusion model $p_{\theta}$ in a parameter-efficient way. - The paper is well-written and well-organized.

Weaknesses

We use a posterior sampler, parameterized by a prior diffusion model with a learnable drift term $u^{post}$, to simulate trajectories and obtain samples $x_{1}$. Then, we compute the likelihood function $r(x_{1})$ and the prior $p_{\theta}$. Using these as an unnormalized density, the model parameters can be updated using GFlowNet-based loss. For fine-tuning a diffusion model, do we need to ensure that the initial state is an empty set (discrete) or a point mass (continuous)? In general, the initial state for DDPM follows a Gaussian distribution. Does this violate the GFlowNet assumption?

Questions

Some typos: - Line 158: $x_{1} \leftarrow x_{0}$ --> $x_{1} \rightarrow x_{0}$? - Eq11: $NN_{2}(x_{t}, t)$ --> $NN_{2}(t)$?

Rating

7

Confidence

3

Soundness

3

Presentation

3

Contribution

3

Limitations

Yes. Limitations were included.

Reviewer VfXT5/10 · confidence 2/52024-07-24

Summary

The paper looks at the problem of finetuning/training a generative model to sample from a desired posterior distribution when given access to a diffusion model prior. The experiments validated the generation capability across different tasks that diffusion models (and conditional generation) can be applied to - text infilling, text-to-image generation and training policies through offline RL. The work proposes a fine-tuning objective to train the model that will sample from the posterior (which in this case is instantiated from the prior’s checkpoint), which can be computed using off policy data/trajectories, ie. trajectories that are not all sampled from the posterior model.

Strengths

Conditional generation is an active field of study and being able to use a foundational diffusion/generative model as a prior that can be employed/modified to get a posterior distribution of interest, is of interest in many applications. The paper is mostly written clearly, and presents experiments on three different generation problems. Developing an off-policy objective for RL training/finetuning of a generative prior is very useful, however it’s somewhat unclear to me how off-policy the data actually is - I believe the data used is mostly on-policy with small amounts of noise added - could the authors add a small discussion making it very clear how the training data is related to the on/off-policy distributions of the prior/posterior models and how it is different from the data used to train the baselines, as well as how realistic these data collection assumptions are?

Weaknesses

1. Speaking very qualitatively, the provided generations in Fig 4 and H.1 don’t look very different from each other and DPOK (and often even DDPO) seems to be generating samples of the same quality. This leads me to think that marginal improvements in the metrics provided (log likelihood etc) are not strongly tied to the generation quality. Also how were these samples chosen? To avoid cherry-picking and encourage reproducibility, i’d suggest mentioning the seed they were sampled with in the corresponding code readme files. 2. Why isn’t there a std dev/error reported for baseline numbers in Table 4? The numbers look close enough for many methods and aggregating metrics over seeds can significantly change results in RL. 3. A major concern is that the authors should ablate each stabilization/implementation trick they used when it is applicable to other baselines that they compare to (Clipping, using the pretrained ckpt from the prior for the finetuning, using parameter efficient training, any tweaks made to noising schedules, any special tricks used in data collection etc) since there are so many that have been used. Overall, I'm only moderately familiar with this area, and therefore will assign a lower confidence to my review. However, my current belief is that the paper has not demonstrated the advantages of the proposed method satisfactorily(or maybe this just has not been presented clearly) so far (either in terms of showing that it can really work well with very off-policy data that is easily available, or showing impressive gains in generation quality/diversity).

Questions

1. On the text infilling task, am I correct in assuming that none of the other baselines had access to both x and y (the first 3 and the fifth sentences) since they are autoregressive and can’t condition on y? If yes, is the comparison to diffusion models that can condition on y fair? Should the comparison instead be with encoder-decoder or non-causal language models? 2. Is there a typo in Line 112? It says “... would sample the product distribution 𝑝post(x1) ∝ 𝑝𝜃 (x1)𝑟(x1). If 𝑟(x1) = 𝑝(y | x1) is a conditional distribution over another variable y, then 𝑝post is the Bayesian posterior 𝑝𝜃 (x1 | y).” Shouldn’t the product distribution be equal to the probably of the intersection of x and y and not y given x? Or is there a term which has implicitly been assumed to be constant/irrelevant?

Rating

5

Confidence

2

Soundness

2

Presentation

3

Contribution

3

Limitations

The paper includes a very brief discussion on limitations which could be improved. I can provide more suggestions for this discussion after engaging with the authors and understanding their assumptions better.

Authorsrebuttal2024-08-11

Dear reviewer, Thanks for your response. We are happy to clarify these points: 1. The training free baselines (DPS, LGD-MC) cannot be used with discrete diffusion models for the text infilling task and are only derived for the particular case of inverse problems in continuous space. DPOK/DDPO are RL finetuning baselines which can in principle be used for all the tasks, but do require significant changes to be adopted for the case of discrete diffusion (which was not considered in the original work). Note that **all the baselines are also biased samplers**, and hence expected to give worse performance for tasks requiring unbiased posterior inference such as classifier guidance (as we show in the paper) and other important scientific tasks (for example [1]). In the context of offline RL, the D-QL baseline trains the policy with an objective very similar to DPOK - The policy is trained to maximize the Q function with a per-step KL regularization term with behavior policy. We can add some notes in the appendix to make these connections clearer in the final version. 2. We agree that the claim "matches state-of-the-art" is more accurate, and will update the abstract in the revision. **We hope we've addressed your questions and concerns. Feel free to reach out with any additional questions.** [1] Adam, Alexandre, et al. "Posterior samples of source galaxies in strong gravitational lenses with score-based priors." arXiv preprint arXiv:2211.03812 (2022).

Reviewer VfXT2024-08-13

Dear Authors, Thank you for your response. From what I understand, empirically, the results of RTB look similar to those of DPOK (or DPOK-like methods, ie, D-QL, like the authors said) on 2 of the 3 tasks: offline RL and text-to-image generation, and it was not tried out on the text-infilling task since that would require changes beyond what the DPOK paper had. Additionally, the qualitative examples/infills are not shown in the appendix for for the GFN baseline in the autoregressive prior category of models which seems to get the next best scores in table 3 so it is hard to say if the generated infills are much better than the next best performing method or not. The experimental results do not demonstrate an advantage to using this approach, but the method is more principled compared to alternative methods (I have not validated the proofs in the appendix rigorously and will consult the other reviewers in the discussion phase to follow about this) and I will update my score to reflect this.

Reviewer 4zDq5/10 · confidence 4/52024-07-30

Summary

This paper proposed a method to train a posterior $p^{post}(x)$ given a prior distribution $p(x)$ and some additional (possibly unnormalized) constraint function $r(x)$, when the prior is a pretrained diffusion model. Through the choice over $r(x)$, this setup can capture a wide range of tasks. The authors propose *relative trajectory balance* (RTB) constraint, which, if satisfied by the posterior under training, guarantees that $p^{post} \sim p(x)r(x)$. By training $p^{post}(x)$ to satisfy the RTB constraint, one can recover the desired posterior. Importantly, this training objective allows for efficient computation of the loss and off-policy training. The paper provides convincing empirical results on a variety of tasks ranging from conditional generation to offline RL.

Strengths

**Motivation and Theoretical Justification** * The paper provides a theoretical justification (Proposition 1) for the proposed method, which is a natural extension of the trajectory balance constraint for the setting where we cannot easily sample from $p^{post}$. This is a realistic constraint that one often encounters when trying to perform posterior inference given a pretrained prior. **Empirical Analysis** * While it's clear that the formulation does capture a wide range of tasks, it is nice to see an experimental evidence of that. The generality of the proposed method is emphasized through the results on four different tasks. * I appreciate that the authors took time to discuss some of the implementation details (Sec 2.3). **Writing Quality** * The presentation is very well-done. The problem being tackled is clear, and the technical aspects of the solution are intuitive and easy to follow.

Weaknesses

**Scalability** * One main concern I have is how scalable the method is due to trajectory matching, especially as the prior becomes larger. The main benefit of this technique relies on the assumption that one aims to repurpose an existing diffusion prior, which is presumable a large foundation model -- so it's important that the method scales desirably to the prior's size, which is not clear from the results in the paper. * Section H discusses some techniques employed to reduce memory usage, but even this relatively small-scale experiment (50 steps on latent diffusion with LoRA), the authors report that they could fit only 8 timesteps on an A100. * It'd be very useful to get some idea of how sensitive the method is to these hyperparameters. One extreme case to consider would be to use single-step gradient subsampling for a much larger T (e.g. 1000 steps). **Experimental Results** * Sec 2.3 claims that the proposed method should easily generalize to conditional constraints (which I believe), but there doesn't seem to be any experiment that tests this claim. For example, it'd strengthen the paper to have a result where RTB training successfully extracts a class-conditional model (that takes a conditioning input) from an unconditional one (perhaps for the CIFAR experiment). * The text-conditional image synthesis experiment seems to be done for only four hardcoded text prompts, which is pretty limited. * While the text in-filling results are great to have, a more practical and interesting task would be fine tuning a pretrained LLM. As hinted in Sec. 2.4, I'm curious if RTB can be used to efficiently customize an LLM, where we deviate from the Gaussian transition kernel. * Having a data-dependent reference as an upper bound on the performance of the proposed method would be useful (e.g. classifier guidance trained classifier trained on noisy data, or directly fine-tuning the prior itself on a specific task). This can tell us more about how much of the potential performance the model captures.

Questions

* For the MNIST even-digit experiment, why was the reward function chosen to be $max_{i \textrm{ even}} p(c=i \mid x)$? Wouldn't $\sum_{i \textrm{ even}} p(c=i \mid x)$ be a more reasonable reward? I'm curious if this particular choice of reward makes it more likely for certain methods to mode collapse (e.g. by maximizing the probability for a single even class), and whether the results in Table 2 would change for MNIST with a different $r(x)$. * Could you share some more details of how LoRA was used for MNIST/CIFAR setup (e.g. which weights were LoRAed)? Also I'm curious what happens if you don't use LoRA and train the posterior on full set of weights (from prior weight or from scratch), as I LoRA could act as a regularizer. * How long is the ratio between prior vs. posterior training in terms of flops or wall-clock time? How quickly the posterior can be fine-tuned could limit the applicability of this method on certain real-world tasks.

Rating

5

Confidence

4

Soundness

3

Presentation

4

Contribution

3

Limitations

Yes. For concerns and potential limitations, see the comments and questions above.

Authorsrebuttal2024-08-10

Any more questions?

Dear reviewers, As we approach the end of the discussion period, we’d like to ask if we can give any final clarifications that would help you assess the paper. Otherwise, if the responses and new results we shared earlier have resolved any doubts, please consider updating your ratings. Thank you again for your time. The authors

Reviewer VfXT2024-08-10

Dear Authors, Thank you for your response. I had the following clarification questions/thoughts: 1. " a general-purpose method that can be applied to a wide range of tasks simultaneously, achieving results comparable to specialized methods that had been developed for each problem." - is this true for all baselines considered in the work (that they are developed for specific problems)? Could the DPOK/DDPO baseline not have have been used on all the tasks? Could you explain why it was not applicable to the other two setups (Offline RL, text infilling) 2. On offline RL the method is slightly worse than both QGPO and D-QL (if we count the number of setups where a method is not within the top 5%) - and so I would suggest removing the claim from the abstract that it achieves state-of-the-art results - instead saying that it almost matches the state-of-the-art (if the other two methods are that).

Authorsrebuttal2024-08-12

Dear Reviewer 4zDq, Thank you again for your initial feedback. We have addressed your concerns in the above comment and added three new experiments based on your suggestions in the global response. Would you kindly let us know if these have affected your evaluation of the paper and if there is any further clarification we can provide? The authors.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC