Bokeh Diffusion: Defocus Blur Control in Text-to-Image Diffusion Models

Armando Fortes, Tianyi Wei, Shangchen Zhou, Xingang Pan

Introduction

Bokeh Diffusion is a novel framework designed to bring professional-grade camera control to text-to-image models. It allows users to precisely adjust defocus blur (bokeh) using a single physical parameter. By introducing "grounded self-attention" and a hybrid training pipeline, the method ensures that changing the blur level does not inadvertently alter the objects or layout of the scene—a common failure in existing generative models.

The Challenge of Defocus Blur

In traditional photography, adjusting the lens aperture changes the depth-of-field: a wide aperture (low f-number) creates a blurry background (bokeh), while a narrow aperture keeps the entire scene in focus. Current AI image generators, such as Stable Diffusion or FLUX, struggle to replicate this physical relationship accurately.

A corgi puppy demonstrating natural background bokeh, illustrating the desired depth-of-field effect.

Users typically rely on "prompt engineering" (e.g., adding "f/1.8 aperture" to the text), but this is often ineffective. Changing the prompt frequently causes "content drift," where the AI alters the background or moves the subject to satisfy the new text. Furthermore, while adding blur to a sharp image is possible via post-processing, removing blur from a defocused image is a mathematically "ill-posed" problem. Bokeh Diffusion addresses the need for a model that understands the physical relationship between focus and scene content.

Methodology

The Bokeh Diffusion framework integrates three primary innovations:

  1. Bokeh Cross-Attention: Instead of relying solely on text, the model is conditioned on a scalar blur parameter $K$. This value is injected via lightweight adapters (decoupled cross-attention layers), allowing the model to learn specific textures for different blur strengths without interfering with the semantic meaning of the text prompt.
  2. Grounded Self-Attention: To prevent content drift, the researchers utilize a "pivot image" strategy. By forcing the model to attend to a reference "pivot" image of the same scene at a different blur level, the model learns to maintain structural layout while varying only the defocus intensity.
  3. Hybrid Training Pipeline: The team curated a dataset of ~15,000 "in-the-wild" images from Flickr with EXIF metadata and combined them with synthetic data where blur was manually rendered onto sharp images using a depth-aware engine.

Key Results and Insights

Bokeh Diffusion demonstrates significant improvements over existing methods in both quantitative metrics and user preference:

  • Quantitative Superiority: The model achieved a correlation score of 0.917 in blur accuracy, significantly outperforming the pretrained FLUX baseline (-0.033) and specialized models like GenPhoto (0.796).
  • Scene Consistency: Using the LPIPS metric, the model proved superior at maintaining scene identity across different blur levels compared to prompt-based methods.
  • User Preference: In a study with 20 participants, Bokeh Diffusion was preferred over 91% of the time for its superior bokeh control and consistency.
A portrait demonstrating professional-grade bokeh control and high scene consistency.

Limitations and Future Work

Despite its success, the model faces some challenges rooted in data bias. For example, it may struggle to generate perfectly "all-in-focus" versions of subjects typically photographed with long lenses, such as wildlife, due to the prevalence of blurry backgrounds in those training samples. Future work aims to extend this control to other camera parameters, such as exposure and motion blur, and to enable "focal-plane control," allowing users to shift the sharp region of an image dynamically.

Summary updated

BibTeX
@inproceedings{fortes2025bokeh,
  author = {Armando Fortes and Tianyi Wei and Shangchen Zhou and Xingang Pan},
  title = {{Bokeh Diffusion: Defocus Blur Control in Text-to-Image Diffusion Models}},
  booktitle = {SIGGRAPH Asia},
  year = {2025},
  doi = {10.1145/3757377.3763906},
}
Figure