EDITOR: Effective and Interpretable Prompt Inversion for Text-to-Image Diffusion Models

Mingzhe Li, Gehao Zhang, Zhenting Wang, Shiqing Ma, Siqi Pan, Richard Cartwright, Juan Zhai · DOI

TL;DR

This paper introduces EDITOR, a novel prompt inversion technique for text-to-image diffusion models. EDITOR effectively reconstructs interpretable and semantically aligned text prompts from generated images, outperforming existing methods in image similarity, textual alignment, and prompt interpretability. This advancement has significant implications for AI ethics, data attribution, and creative image manipulation.

What Problem Does This Paper Address?

Text-to-image diffusion models have revolutionized content creation, but the prompts that guide them are often proprietary and crucial for understanding model behavior and provenance. Prompt inversion, the task of recovering the original text prompt from a generated image, is essential for applications like data attribution, model provenance, and watermarking. Existing methods struggle with a trade-off: either they produce prompts that are semantically fluent but don't accurately reconstruct the image, or they generate prompts that are visually similar but lack interpretability and are computationally inefficient due to discrete optimization steps that disrupt semantic continuity.

Methods

EDITOR tackles prompt inversion through a three-step pipeline:

  1. Initialization: Instead of starting from scratch, EDITOR leverages a pre-trained image captioning model to generate an initial, semantically meaningful prompt for the target image. This prompt is then encoded into the latent space of the diffusion model.
  2. Reverse-Engineering: The core innovation lies in optimizing the continuous latent text embedding directly, rather than discrete token embeddings. This is achieved through gradient-based optimization in the latent space, minimizing the difference between the input image and the image generated by the current embedding. This continuous optimization avoids the semantic disruption caused by discrete projections in prior methods.
  3. Embedding Inversion: Finally, a trained embedding-to-text (E2T) model is used to convert the optimized continuous embedding back into a human-readable text prompt. This E2T model is trained on text-representation pairs from the diffusion model itself, ensuring the projected prompts are in-distribution and semantically aligned. A correction model is also employed to further refine the E2T output.

Datasets

The authors evaluated EDITOR on several widely-used datasets:

  • MS COCO: A dataset of diverse natural images with detailed annotations.
  • LAION: A large-scale dataset of image-text pairs.
  • Flickr30k: A dataset of diverse images including everyday scenes, natural landscapes, animals, and urban settings.
  • DiffusionDB: A large gallery of user prompts and generated images from text-to-image diffusion models.

For training the embedding-to-text model, they used the MSMARCO corpus.

Key Insights and Ideas

  • Continuous Optimization is Key: The most significant insight is that optimizing directly in the continuous latent embedding space, rather than relying on discrete token projections, dramatically improves both efficiency and the semantic coherence of the inverted prompts. This avoids the "projection penalty" that plagues prior methods.
  • Initialization Matters: Using an image captioning model for initial prompt generation provides a strong starting point, significantly reducing the search space and improving the overall optimization process.
  • E2T Model for Semantic Alignment: A dedicated embedding-to-text model, trained on diffusion model-specific data, is crucial for translating the optimized continuous embeddings back into natural, interpretable prompts that are semantically aligned with the original image.
  • EDITOR's Versatility: The method demonstrates strong performance across various diffusion models, including advanced multi-encoder architectures like SDXL Turbo and Stable Diffusion 3.5 Medium, highlighting its generalizability.

Key Results

  • Image Similarity: EDITOR achieved the highest CLIP scores (e.g., 0.796 on MS COCO, 0.826 on LAION) and competitive LPIPS scores across all tested datasets, indicating superior image reconstruction quality.
  • Textual Alignment: EDITOR significantly outperformed baselines in BERTScore metrics (Precision, Recall, F1), achieving precision of 0.900 on MS COCO and 0.841 on LAION, demonstrating better semantic consistency with ground-truth prompts.
  • Prompt Interpretability: EDITOR drastically reduced perplexity (e.g., 80.659 on MS COCO), producing much more fluent and natural language prompts compared to existing methods.
  • Applications: The generated prompts were successfully applied to cross-concept image synthesis, concept manipulation (removal/replacement), evolutionary multi-concept generation, and unsupervised segmentation, showcasing the practical utility of EDITOR.

Limitations and Future Work

  • Prompt Length Impact: While EDITOR generally performs well, the paper notes that initial prompt length can influence performance, with 16 tokens often striking a good balance between semantic richness and optimization complexity. Longer prompts can improve interpretability but increase complexity.
  • Ethical Considerations: The authors acknowledge that their method, by recovering high-quality prompts, could be misused for prompt stealing, potentially infringing on intellectual property. They emphasize responsible use and advocate for research into safeguards.
  • Future Work: The paper suggests that stronger image captioning or vision-language models could further enhance EDITOR's performance. The research also opens avenues for exploring more sophisticated applications in AI ethics, data attribution, and creative content generation.

Summary updated

BibTeX
@misc{li2025editor,
  author = {Mingzhe Li and Gehao Zhang and Zhenting Wang and Shiqing Ma and Siqi Pan and Richard Cartwright and Juan Zhai},
  title = {{EDITOR: Effective and Interpretable Prompt Inversion for Text-to-Image Diffusion Models}},
  year = {2025},
  eprint = {2506.03067},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.03067},
}
Figure