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

Mingzhe Li, Kejing Xia, Gehao Zhang, Zhenting Wang, Guanhong Tao, Siqi Pan, Juan Zhai, Shiqing Ma

TL;DR

EDITOR is a novel prompt inversion technique that reconstructs highly accurate and human-readable text prompts from images generated by diffusion models. By shifting optimization from discrete token spaces to a continuous contextual embedding space and using a specialized embedding-to-text model, EDITOR avoids the uninterpretable "gibberish" prompts of prior methods while maintaining exceptional image reconstruction fidelity.

What Problem Does This Paper Address?

Prompt inversion—the task of finding the text prompt that produced a specific AI-generated image—is crucial for data attribution, model provenance, and intellectual property protection. However, current approaches suffer from a frustrating trade-off:

  1. Optimization-based methods (like PEZ or PH2P) iteratively update token embeddings and project them back onto a discrete vocabulary. This discrete projection step causes severe "embedding discrepancy" (dropping cosine similarity between optimized and projected embeddings to as low as 0.167), disrupting semantic continuity and yielding unreadable, disjointed word salads.
  2. Vision-Language Models (VLMs) or captioning models generate beautifully fluent descriptions, but they lack the precise alignment needed to faithfully recreate the original image when fed back into a diffusion model.

EDITOR bridges this gap, delivering prompts that are both highly interpretable (fluent) and accurate (high image similarity).

Methods

EDITOR breaks the prompt inversion process into a three-step pipeline:

  1. Initialization: Instead of starting from random noise, EDITOR uses a pre-trained image captioning model (like BLIP-large) to generate a fluent initial prompt ($p_0$), which is then mapped into the diffusion model's latent space.
  2. Continuous Reverse-Engineering: Rather than optimizing token embeddings before the text encoder's transformer layers, EDITOR directly optimizes the contextual embeddings after the transformer layers. This allows the optimization trajectory to remain entirely within a smooth, continuous latent space, avoiding the disruptive vocabulary projection steps of previous methods.
  3. Embedding Inversion (E2T): To convert the final optimized continuous embedding back into discrete text, the authors employ a trained Embedding-to-Text (E2T) model based on a T5 architecture. This consists of a zero-step model ($M_{zero}$) to generate an initial text hypothesis, paired with an iterative transformer-based correction model ($M_{corr}$) to eliminate semantic drift and ensure the final text aligns perfectly with the target embedding.
Fig. 3: Overview of EDITOR. Our approach comprises three steps: ①initializing the latent embedding via a pre-trained image captioning model; ②refining the em- bedding through reverse-engineering; ③mapping the refined embedding to text with an embedding-to-text model. This pipeline yields coherent prompts and streamlines optimization.

Datasets

The authors evaluated EDITOR across four widely-used benchmarks, sampling 100 images from each:

  • MS COCO: Diverse natural images with detailed human annotations.
  • LAION: A massive dataset of web-scraped image-text pairs.
  • Flickr30k: Images depicting everyday life, animals, and urban scenes.
  • DiffusionDB: A large-scale prompt gallery containing real user prompts and actual model-generated images.

Key Insights and Ideas

  • The Danger of Discrete Projections: Traditional hard prompt optimization acts like a broken compass. Every time an algorithm finds a good direction in the continuous space, projecting it to the nearest real words knocks it off course. EDITOR's continuous path ensures stable and rapid convergence.
Fig. 4: Comparison of optimization paths. The blue path illustrates continuous op- timization. The red path shows opti- mization with projection in PEZ and PH2P, where each step is displaced due to vocabulary projection.
  • Contextual vs. Token Embeddings: Optimizing after the text encoder's transformer layers leverages the deeper semantic processing already performed by the model, naturally preserving grammatical structure and context.
  • Downstream Versatility: Because EDITOR recovers clean, human-understandable tokens, users can easily modify the inverted prompts for downstream tasks like object removal, concept replacement, cross-concept image synthesis, and unsupervised semantic segmentation.

Key Results

EDITOR consistently outperformed state-of-the-art inversion methods (such as PEZ, PH2P, VGD, STEPS, and PRISM) across all datasets:

  • Image Fidelity: EDITOR achieved the highest or competitive CLIP similarity scores (e.g., 0.826 on LAION) and the lowest LPIPS perceptual distance scores, proving that its prompts reconstruct the target images more accurately than baselines.
  • Textual Alignment: On MS COCO, EDITOR achieved a BERTScore precision of 0.900 and an F1 score of 0.908, significantly outperforming PRISM and other baselines.
  • Prompt Interpretability: EDITOR drastically reduced Perplexity (PPL). On MS COCO, EDITOR achieved a PPL of 80.659, compared to PRISM (222.274) and optimization baselines like PH2P, which exploded into the thousands or millions due to their incoherent outputs.
Fig. 1: Original prompts and generated images along with inverted prompts.

Furthermore, the authors demonstrated EDITOR's robustness by successfully applying it to advanced multi-encoder architectures like SDXL-Turbo and Stable Diffusion 3.5 Medium.

Limitations and Future Work

  • White-Box Access Required: EDITOR relies on gradient-based optimization, meaning it requires full white-box access to the text encoder and diffusion model's internal parameters. Extending this to black-box APIs remains an open challenge.
  • Prompt Length Sensitivity: Ablation studies showed that an initial prompt length of around 16 tokens balances semantic richness and optimization complexity perfectly; shorter prompts lack detail, while excessively long prompts complicate optimization.
  • Ethical Concerns: The authors explicitly note that highly effective prompt inversion introduces risks of "prompt stealing," which could impact the commercial ecosystem for prompt engineers. They advocate for its use primarily in controlled verification and data attribution settings.

Summary updated

BibTeX
@misc{li2025editor,
  author = {Mingzhe Li and Kejing Xia and Gehao Zhang and Zhenting Wang and Guanhong Tao and Siqi Pan and Juan Zhai and Shiqing Ma},
  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