Skip to main content
QUICK REVIEW

[Paper Review] Investigating Prompt Engineering in Diffusion Models

Sam Witteveen, Martin Andrews|arXiv (Cornell University)|Nov 21, 2022
Neuroscience and Music PerceptionNeuroscience15 citations
TL;DR

This paper investigates how different linguistic components in text prompts affect image generation in diffusion models like Stable Diffusion. By measuring semantic similarity via CLIP and image similarity via LPIPS, the authors demonstrate that nouns and artist names have the strongest influence on image content, while adjectives (descriptors) have minimal impact, offering a quantifiable framework for effective prompt engineering in text-to-image generation.

ABSTRACT

With the spread of the use of Text2Img diffusion models such as DALL-E 2, Imagen, Mid Journey and Stable Diffusion, one challenge that artists face is selecting the right prompts to achieve the desired artistic output. We present techniques for measuring the effect that specific words and phrases in prompts have, and (in the Appendix) present guidance on the selection of prompts to produce desired effects.

Motivation & Objective

  • To quantify the impact of different linguistic categories in text prompts on image generation in diffusion models.
  • To identify which prompt components (e.g., descriptors, nouns, artists) most significantly alter generated image content.
  • To develop a systematic method for measuring and comparing the effect of prompt modifications on image output.
  • To provide empirical guidance for artists and researchers on constructing effective prompts for desired visual outcomes.
  • To expose biases in generative models by analyzing how stylistic and semantic prompt components influence image generation.

Proposed method

  • The authors decompose prompts into two components: physical/factual content (e.g., 'a Mainecoon cat kneeling') and stylistic descriptors (e.g., lighting, artistic style).
  • They use a fixed random seed and scheduler to ensure deterministic image generation for each prompt variation, enabling controlled comparison.
  • Image similarity is measured using LPIPS and perceptual loss, while textual similarity is assessed via CLIP embedding cosine similarity and Sentence Transformers.
  • The study evaluates over 15,000 image generations across 2,000 prompt variations, isolating linguistic categories such as descriptors, nouns, artists, and lighting phrases.
  • Statistical distributions of LPIPS scores are analyzed across categories to assess the magnitude of visual change per prompt modification.
  • CLIP and LPIPS are correlated to evaluate whether semantic differences in text embeddings align with perceptual differences in generated images.

Experimental results

Research questions

  • RQ1How do different linguistic categories—such as adjectives, nouns, and proper nouns—impact the visual output of text-to-image diffusion models?
  • RQ2To what extent do stylistic descriptors (e.g., 'volumetric lighting') alter image content compared to content-modifying terms like 'artist name'?
  • RQ3How well do CLIP embeddings predict visual similarity between generated images based on prompt differences?
  • RQ4Can the effect of prompt components be systematically categorized and quantified across multiple model generations?
  • RQ5How do biases in training data manifest through prompt engineering, particularly when referencing specific artists or styles?

Key findings

  • Descriptors (e.g., adjectives like 'beautiful' or 'ethereal') have a relatively small impact on image generation, with average LPIPS similarity scores of 0.664.
  • Nouns cause significant shifts in image content, with average LPIPS similarity dropping to 0.512, indicating high visual divergence.
  • Artist names such as 'in the style of Leonardo da Vinci' result in the most dramatic changes, with LPIPS similarity scores as low as 0.465, indicating major structural and stylistic alterations.
  • Lighting modifiers exhibit bimodal behavior: some (e.g., 'ambient lighting') act like nouns and drastically alter images, while others (e.g., 'beautiful volumetric lighting') behave like descriptors with minimal impact.
  • CLIP-based text similarity shows a stronger correlation with LPIPS-based image similarity than Sentence Transformers, suggesting CLIP embeddings are better aligned with the diffusion model's latent space.
  • The study confirms that prompt engineering is not merely aesthetic but can be systematized, with nouns and artist names being the most powerful levers for controlling image composition.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.