NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

One Stone with Two Birds: A Null-Text-Null Frequency-Aware Diffusion Models for Text-Guided Image Inpainting

Haipeng Liu, Yang Wang, Meng Wang

TL;DR

NTN-Diff is a frequency-aware diffusion framework designed to solve the "two birds" of text-guided image inpainting: preserving unmasked background regions while ensuring newly generated content is semantically consistent with the prompt and the rest of the image. By disentangling low and mid-frequency bands during the early stages of denoising, it prevents text prompts from distorting the background while using robust mid-frequency information to guide the generation of the masked area.

What Problem Does This Paper Address?

Text-guided image inpainting—filling a masked area based on a text prompt—faces a persistent tug-of-war. On one hand, the unmasked regions must remain exactly as they were (preservation). On the other hand, the new content must match the lighting, style, and structure of the original image (semantic consistency).

Existing methods often fail at one or the other. Some preserve the background but produce "pasted-on" results that do not match the scene. Others achieve great consistency but accidentally cause the background to "drift," altering colors or textures in areas meant to be left untouched.

The authors identify the root cause of this trade-off as frequency entanglement. In the early stages of the diffusion denoising process, low-frequency information (which dictates global color and layout) is highly unstable and easily disrupted by text prompts. Meanwhile, mid-frequency bands are more robust and better at aligning with the semantic meaning of the text.

Methods

The core of NTN-Diff is a "Null-Text-Null" pipeline that operates in the frequency domain using the 2D Discrete Cosine Transform (DCT). The denoising process is split into an Early Stage (high noise) and a Late Stage (low noise).

The Early Stage Triple-Path

In the early stage, the model runs three parallel denoising processes to disentangle the frequencies:

  1. Null-Text Low-Frequency Process: Denoises the image using a "null" text prompt. This keeps the low-frequency components (color and layout) stable, preventing the background from shifting.
  2. Text-Guided Process: Denoises the masked region using the actual text prompt. This aligns the mid-frequency bands with the desired object.
  3. Null-Text Mid-Frequency Guided Process: This acts as the bridge. It uses the denoised mid-frequencies from the second path to guide the low-frequency denoising of the masked area. This ensures the new object has the right global structure to match the prompt without needing direct text guidance that might disrupt the background.
The NTN-Diff pipeline architecture showing the early and late stage processes.

To achieve this, the model uses specialized "Denoised Frequency Band" layers to substitute specific latent representations, swapping out frequency components between the text-guided and null-text latents as needed.

Datasets

The authors evaluated NTN-Diff on two primary benchmarks:

  • BrushBench: A comprehensive dataset of 600 images with human-annotated masks and captions, covering both "inside-inpainting" and "outside-outpainting" scenarios.
  • EditBench: A dataset featuring 240 images split between natural and generated content, used to test the model's flexibility across different image types.

Key Insights and Ideas

  • Frequency Robustness: The critical insight is that different frequency bands react differently to noise. Low frequencies are easily corrupted by text prompts early on, while mid-frequencies act as a stable anchor for semantic alignment.
  • Adaptive Thresholding: The model does not use a one-size-fits-all frequency mask. It adaptively adjusts the thresholds for low and mid-pass filtering based on the size of the masked region (the $\ell_1$ norm of the mask). Larger masks require more information from the null-text process to maintain stability.
  • Efficiency through Substitution: Unlike "dual-branch" models that require running two full U-Nets (which doubles VRAM usage), NTN-Diff achieves its results primarily through frequency-domain substitution, keeping memory requirements low.

Key Results

NTN-Diff outperformed state-of-the-art models like BLD and BrushNet across multiple metrics:

  • Quality & Consistency: Achieved higher Image Reward (IR) and HPS v2 scores, indicating better human-aligned quality and semantic consistency.
  • Preservation: Showed significantly better PSNR and lower MSE in unmasked regions compared to models that struggle with background drift.
  • Efficiency: Tied for the lowest VRAM consumption (2.11 GB), making it much more accessible than heavy-duty competitors like HDP (11.75 GB).
Qualitative comparison showing NTN-Diff's ability to preserve backgrounds while following prompts.

Limitations and Future Work

  • Inference Time: While highly VRAM efficient, the three parallel processes in the early stage increase the computational time per image compared to a standard single-pass diffusion model.
  • Ethical Risks: As with any high-quality generative tool, the authors acknowledge the potential for misuse in creating misleading information or deepfakes, advocating for clear accountability and oversight.
  • Future Directions: The frequency-aware approach could be extended beyond inpainting to other image editing tasks where background preservation is critical.

Summary updated

BibTeX
@inproceedings{liu2025one,
  author = {Haipeng Liu and Yang Wang and Meng Wang},
  title = {{One Stone with Two Birds: A Null-Text-Null Frequency-Aware Diffusion Models for Text-Guided Image Inpainting}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=5VmjFzoHG2},
}
Figure