Instruct-CLIP: Improving Instruction-Guided Image Editing with Automated Data Refinement Using Contrastive Learning

Sherry X. Chen, Misha Sra, Pradeep Sen

Abstract

Instruction-guided image editing allows users to perform complex visual modifications through intuitive natural language commands. However, the performance of these models is often bottlenecked by the quality of synthetic training data, which frequently contains misalignments between text instructions and actual visual changes. We introduce Instruct-CLIP (I-CLIP), a self-supervised framework designed to address this "garbage in, garbage out" problem. By learning to align the semantic difference between image pairs with their corresponding instructions, I-CLIP enables automated data refinement and introduces a novel guidance loss. Our approach significantly improves the accuracy and visual quality of diffusion-based editing models, yielding a 24.5% improvement in visual alignment on the MagicBrush benchmark.

Introduction

Training models for instruction-guided image editing (e.g., "make the sky a fiery sunset") requires massive datasets of (original image, edited image, instruction) triplets. Currently, these datasets are generated synthetically using a pipeline involving Large Language Models (LLMs) and Text-to-Image models. This process is inherently noisy: teacher models often produce images that do not match the instruction, or instructions that describe changes not present in the visual output.

When models like InstructPix2Pix (IP2P) are trained on this misaligned data, they inherit these flaws, struggling to follow complex instructions or inadvertently altering unrelated parts of the image. Instruct-CLIP addresses this by acting as a semantic bridge between visual changes and text, ensuring that the model learns from high-fidelity, well-aligned examples.

Methodology

1. Visual-Change Encoding

Unlike standard CLIP models that encode single images, I-CLIP is designed to capture the delta between two states. The framework utilizes a modified DINOv2 backbone as an image encoder to extract features from both the original and edited images. By computing the difference between these feature sets, I-CLIP creates a representation of the "visual edit" that can be mapped into a shared embedding space with text.

2. Automated Data Refinement

I-CLIP serves as an automated "re-labeler" for existing datasets. By embedding the visual change and utilizing a text decoder based on the DeCap architecture, the authors generated new, more accurate instructions for the InstructPix2Pix dataset. This process identified and refined over 120,000 samples where the original synthetic instructions were poorly aligned with the visual content.

3. LD-DINOv2 (Latent Diffusion DINO)

A significant challenge in applying semantic guidance to diffusion models is that standard vision backbones like DINOv2 are not trained to handle the Gaussian noise present during the generation process. To solve this, the authors developed LD-DINOv2, a version of the backbone pre-trained to be noise-robust. This allows I-CLIP to enforce instruction alignment at any timestep of the diffusion process, rather than just at the final output.

4. I-CLIP Guidance Loss

During the fine-tuning of the diffusion model, the standard Mean Squared Error (MSE) loss is supplemented with a new contrastive guidance loss. This loss forces the model’s predicted denoised latent to align semantically with the refined text instruction, ensuring the generated change matches the user's intent.

Experiments and Results

Datasets and Benchmarks

The model was trained using a refined version of the InstructPix2Pix (IP2P) dataset. Evaluation was conducted on two primary benchmarks:

  • MagicBrush: A rigorous dataset for single-turn and multi-turn (iterative) editing.
  • ZONE: A benchmark specifically focused on local instruction-guided editing.

Quantitative Performance

On the MagicBrush benchmark, I-CLIP demonstrated substantial improvements over the baseline InstructPix2Pix model:

  • Single-turn edits: 24.5% improvement in the DINO-I score (visual alignment).
  • Multi-turn edits: 25.8% improvement in the DINO-I score.

Qualitative and Human Evaluation

Qualitative results indicate that I-CLIP-trained models are superior at preserving the identity of subjects. For example, when tasked with changing a "panda" to a "monkey," the model successfully alters the species while maintaining the background and the original pose of the subject. A user study involving 104 participants confirmed these findings, with I-CLIP being significantly preferred over state-of-the-art baselines like MagicBrush and the original IP2P.

Discussion and Limitations

While I-CLIP significantly advances the state of instruction-guided editing, it remains influenced by the limitations of its underlying generative "teacher" models. If the initial synthetic images contain artifacts like "color bleeding," I-CLIP may learn to describe these changes accurately but cannot inherently correct the visual artifact itself. Additionally, the model still faces challenges with "Object Removal" instructions, which can occasionally leave ghostly artifacts or unrealistic fills.

Conclusion

Instruct-CLIP demonstrates that the bottleneck in instruction-guided image editing is not just model architecture, but data quality. By focusing on the semantic "difference" between images and introducing noise-robust features, I-CLIP provides a robust framework for cleaning synthetic datasets and guiding diffusion models toward higher fidelity and better instruction following. Future work involves scaling this approach to larger models like SDXL to further enhance generative quality.

Summary updated

BibTeX
@inproceedings{chen2025instruct,
  author = {Sherry X. Chen and Misha Sra and Pradeep Sen},
  title = {{Instruct-CLIP: Improving Instruction-Guided Image Editing with Automated Data Refinement Using Contrastive Learning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02655},
}
Figure