DEFT: Efficient Fine-tuning of Diffusion Models by Learning the Generalised $h$-transform

Alexander Denker, Francisco Vargas, Shreyas Padhy, Kieran Didi, Simon V Mathis, Riccardo Barbano, Vincent Dutordoir, Emile Mathieu, Urszula Julia Komorowska, Pietro Lio

TL;DR

DEFT (Doob’s $h$-transform Efficient FineTuning) provides a mathematically rigorous framework for turning large, pre-trained unconditional diffusion models into powerful conditional samplers. By fine-tuning a tiny auxiliary network to learn the "guidance" term, DEFT achieves state-of-the-art performance in image reconstruction and protein design while being up to 1.6× faster than existing methods.

What Problem Does This Paper Address?

Diffusion models have revolutionized generative AI, but they are notoriously difficult to "steer." While we have massive, expensively trained unconditional models (which generate anything from the training distribution), we often need conditional models to solve inverse problems—like filling in missing pixels (inpainting), increasing resolution (super-resolution), or designing proteins around a specific functional "motif."

Current approaches to this problem generally fall into two camps:

  1. Heuristic Guidance: Methods like Diffusion Posterior Sampling (DPS) use the base model to guess the final output and then backpropagate through the entire network at every sampling step to enforce the condition. This is computationally expensive and impossible if the model is behind a closed API.
  2. Full Fine-tuning: Training a new conditional model from scratch or fine-tuning all parameters of a large model. This requires massive amounts of data and compute.

The authors identify a lack of a unifying mathematical framework, leading to methods that are often sensitive to hyperparameters and inefficient to deploy.

Methods

The researchers turn to a classical result from stochastic differential equation (SDE) theory: Doob’s $h$-transform.

In simple terms, if an unconditional diffusion process is like a particle wandering randomly, the $h$-transform is the mathematical "force" required to steer that particle so it hits a specific target (the condition) at a specific time.

DEFT Architecture

DEFT (Doob’s $h$-transform Efficient FineTuning) works as follows:

  • Freeze the Base: The large, pre-trained unconditional model is kept completely frozen.
  • The $h$-network: A very small auxiliary network (only 4–17% of the base model's size) is introduced to learn the $h$-transform.
  • Likelihood-Informed Architecture: The authors propose a novel architecture for this small network that takes the current noisy state, the model's best guess of the clean image (the Tweedie estimate), and the specific observation (e.g., the blurry image) as inputs.
  • Efficient Training: Instead of simulating the whole diffusion process, they use a "simulation-free" score-matching loss, making training remarkably fast.
  • Fast Inference: During sampling, DEFT simply adds the output of the small $h$-network to the base model's output. Crucially, it does not require backpropagation through the large base model, which is the primary bottleneck in other guidance methods.

Datasets

The authors evaluated DEFT across several domains:

  • Natural Images: ImageNet (256x256) for tasks like inpainting, 4x super-resolution, high dynamic range (HDR) reconstruction, phase retrieval, and non-linear deblurring.
  • Medical Imaging: The AAPM (abdomen CT) and LoDoPab-CT (chest CT) datasets for sparse-view reconstruction.
  • Protein Design: The RFDiffusion benchmark (based on the SCOPe dataset) for "motif scaffolding"—designing a protein structure that holds a specific functional piece in place.
  • Ablations: The Flowers dataset was used to compare DEFT against amortized conditional training.

Key Insights and Ideas

  • Mathematical Unification: The paper shows that many popular heuristic methods (like DPS or $\Pi$GDM) are actually specific, sometimes crude, approximations of the $h$-transform.
  • The "Correction" Perspective: The $h$-transform can be viewed as a learned correction factor for the "Tweedie estimate." If the base model's guess is slightly off-target, the $h$-network nudges it back toward the condition.
  • Data Efficiency: DEFT is surprisingly sample-efficient. The authors showed that training on as few as 10 to 200 images can still produce competitive results, making it viable for niche applications where data is scarce.
  • API-Friendly: Because DEFT only needs the "forward pass" of the base model, it can be used to add custom conditioning to models hosted on platforms where the weights are not directly accessible.

Key Results

Inpainting Comparison
  • Speed: DEFT achieved speedups of up to 1.6× over DPS on ImageNet tasks by avoiding the need for expensive Jacobian calculations.
  • Image Quality: On ImageNet, DEFT achieved the best perceptual quality (measured by LPIPS and KID) compared to all baselines, as seen in the inpainting examples above.
  • Medical Accuracy: In CT reconstruction, DEFT outperformed existing guidance methods in PSNR (signal-to-noise ratio), providing more accurate reconstructions essential for clinical use.
  • Protein Scaffolding: DEFT solved 10 out of 12 complex protein design tasks, significantly outperforming standard guidance methods (which only solved 5) while using a fraction of the parameters of fully amortized models.

Limitations and Future Work

  • Paired Data Requirement: The primary version of DEFT requires a small dataset of paired samples (e.g., clean images and their corrupted versions).
  • Zero-Shot Challenges: While the authors proposed a "zero-shot" version using stochastic optimal control (which doesn't need paired data), it is currently too computationally demanding for high-resolution images.
  • Overfitting: With very small fine-tuning sets, there is a risk that the $h$-network might inherit or amplify biases present in the small sample.

The authors suggest that future work could focus on scaling the stochastic control objective to high-dimensional data, potentially allowing for "zero-shot" DEFT that works as fast as the current version without needing any training pairs.

Summary updated

BibTeX
@inproceedings{denker2024deft,
  author = {Alexander Denker and Francisco Vargas and Shreyas Padhy and Kieran Didi and Simon V Mathis and Riccardo Barbano and Vincent Dutordoir and Emile Mathieu and Urszula Julia Komorowska and Pietro Lio},
  title = {{DEFT: Efficient Fine-tuning of Diffusion Models by Learning the Generalised $h$-transform}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=AKBTFQhCjm},
}
Figure