Diffusion models have revolutionized how we create images, but ask one to "remove the haze from this specific photo" or "fix the lighting while keeping the text on that sign readable," and things often fall apart. Most models either hallucinate new details or wash away the fine textures that make a photo look real.
In their NeurIPS 2024 paper, PromptFix, researchers from the University of Rochester and Microsoft Research introduce a comprehensive framework designed to bridge the gap between high-level creative editing and low-level image restoration, all controlled through natural language.
TL;DR
PromptFix is a unified diffusion-based model that performs a massive range of image tasks—from dehazing and super-resolution to object removal—using simple human instructions. By leveraging Vision-Language Models (VLMs) to "diagnose" image defects and a novel high-frequency sampling method to preserve fine details, it outperforms specialized models in both quality and fidelity.
What Problem Does This Paper Address?
While we have models that follow instructions (like InstructPix2Pix), they generally struggle with two things:
- Data Scarcity: There isn't much high-quality data that pairs "degraded images" with "clean images" and "natural language instructions" for tasks like snow removal or watermark cleaning.
- The "Blurry Detail" Problem: Standard diffusion architectures use Variational Autoencoders (VAEs) to compress images. This compression is lossy, often destroying high-frequency information like text, fine textures, or sharp edges during the restoration process.
PromptFix aims to create a single "all-in-one" model that understands what is wrong with a photo and fixes it without losing the "soul" (the fine details) of the original.
Methods
The researchers introduced three key innovations to make PromptFix work:
- VLM-based Auxiliary Prompting: The model doesn't just rely on the user's prompt. It uses a frozen Vision-Language Model (InternVL2) to look at the degraded image and generate two auxiliary prompts: a semantic caption (what is in the image) and a defect description (what is wrong with it). This helps the model understand the context and the specific "fix" required.
- High-frequency Guidance Sampling (HGS): To solve the loss of detail, the authors introduced a "fidelity constraint" during the denoising process. They use a low-pass filter and Sobel edge detection to ensure the generated image matches the high-frequency structure of the original in areas that shouldn't be changed.
- VAE Skip-Connections with LoRA: They modified the VAE decoder to include skip-connections from the encoder, fused using lightweight Low-Rank Adaptation (LoRA). This allows the model to "pass through" fine details that would otherwise be lost in the bottleneck of the VAE.
Datasets
The authors curated the PromptFix Dataset, a massive collection of 1.01 million triplet instances (input image, goal image, and instruction).
- Tasks covered: Image inpainting, object creation, dehazing, colorization, super-resolution, low-light enhancement, snow removal, and watermark removal.
- Instruction Generation: They used GPT-4 to generate diverse, natural-sounding instructions for each task to ensure the model generalizes to how real humans talk.
- Data Sources: They pulled from established benchmarks like LAION-5B, Flickr, GoPro, and various specialized restoration datasets (RESIDE, SRRS, etc.).
Key Insights and Ideas
- Self-Diagnosis is Key: One of the "aha" moments is using the VLM as an automated diagnostician. By letting the VLM describe the defects (e.g., "the image is blurry and has low light"), the diffusion model gets a much clearer "target" than a vague user prompt like "make it better."
- Frequency Matters: Most diffusion models operate purely in the spatial domain. By explicitly calculating a loss in the frequency domain (using Fourier Transforms) during sampling, PromptFix can preserve text on signs or license plates that other models turn into "alphabet soup."
- Unified vs. Expert Models: Traditionally, you'd need one model for dehazing and another for super-resolution. PromptFix proves that a single, large-scale model trained on diverse instructions can match or beat these "expert" models while offering much more flexibility.
Key Results
- Quantitative Superiority: PromptFix consistently achieved the best (lowest) LPIPS scores (a measure of perceptual similarity) and the best ManIQA scores (image quality assessment) across almost all tested tasks.
- Detail Preservation: In qualitative comparisons, PromptFix was the only model capable of restoring low-light images while keeping small-scale text perfectly legible.
- Zero-Shot Multi-tasking: The model can handle "combination" tasks it wasn't explicitly trained for—such as removing snow and haze while performing super-resolution simultaneously—simply by combining the instructions.
- Efficiency: Despite its power, it maintains an inference efficiency comparable to much simpler baseline models.
Limitations and Future Work
The authors acknowledge a few hurdles:
- Instruction Length: The model's performance dips slightly when instructions exceed 40 words, likely due to the "long-tail" effect in the training data.
- VLM Over-reliance: Occasionally, the auxiliary VLM prompt can be too influential, leading the model to generate a new image based on the description rather than strictly restoring the original pixels.
- The Fidelity-Quality Trade-off: While HGS preserves details, it can sometimes make the restored image look a bit too much like the degraded version if the constraints are set too high.
Future work will likely focus on augmenting the dataset with even longer, more complex instructions and refining the balance between the VLM's "vision" and the user's "intent."
Check out the project page and code: https://www.yongshengyu.com/PromptFix-Page
Summary updated