Prompt Mixing in Diffusion Models using the Black Scholes Algorithm

Divya Kothandaraman, Ming C. Lin, Dinesh Manocha · OpenReview

Abstract

We introduce a novel approach for prompt mixing, aiming to generate images at the intersection of multiple text prompts using pre-trained text-to-image diffusion models. At each time step during diffusion denoising, our algorithm forecasts predictions w.r.t. the generated image and makes informed text conditioning decisions. To do so, we leverage the connection between diffusion models (rooted in non-equilibrium thermodynamics) and the Black-Scholes model for pricing options in Finance, and draw analogies between the variables in both contexts to derive an appropriate algorithm for prompt mixing using the Black Scholes model. Specifically, the parallels between diffusion models and the Black-Scholes model enable us to leverage properties related to the dynamics of the Markovian model derived in the Black-Scholes algorithm. Our prompt-mixing algorithm is data-efficient, meaning it does not need additional training. Furthermore, it operates without human intervention or hyperparameter tuning. We highlight the benefits of our approach by comparing it qualitatively and quantitatively to other prompt mixing techniques, including linear interpolation, alternating prompts, step-wise prompt switching, and CLIP-guided prompt selection across various scenarios such as single object per text prompt, multiple objects per text prompt and objects against backgrounds. Code is available at https://github.com/divyakraman/BlackScholesDiffusion2024.

Introduction

In the field of generative AI, "concept blending" or prompt mixing represents a significant creative challenge: the ability to seamlessly merge distinct concepts (e.g., a "parrot" made of "pizza") into a single, coherent image. While state-of-the-art diffusion models like Stable Diffusion are highly capable, they often struggle to balance multiple prompts effectively. Existing methods typically fall into three categories, each with distinct drawbacks:

  1. Linear Interpolation: Averaging text embeddings often fails due to the high non-linearity of the latent space.
  2. Manual Switching: Alternating prompts or switching at specific steps requires intensive human intervention and trial-and-error prompt engineering.
  3. Bias and Artifacts: Many automated methods result in images dominated by a single concept or plagued by visual hallucinations and glitches.

This paper proposes a zero-shot, automated method to optimally switch between prompts during the denoising process, ensuring fair and high-fidelity representation of all target concepts by borrowing principles from quantitative finance.

Methodology: The Black-Scholes Analogy

The core innovation lies in establishing a mathematical bridge between the non-equilibrium thermodynamics of diffusion models and the Black-Scholes model used for option pricing. Both frameworks are fundamentally rooted in Stochastic Differential Equations (SDEs).

By treating the image generation process as an asset pricing problem, the algorithm dynamically determines which prompt requires the most "optimization effort" at any given time step. The model calculates a "Black-Scholes score" for each input prompt and selects the one with the lowest score—representing the highest "cost" or need for refinement—to guide the current denoising step.

The mapping of financial variables to diffusion variables is as follows:

  • Spot Price ($S$): The current CLIP score, measuring alignment between the image and prompt.
  • Strike Price ($K$): The target CLIP score desired by the end of the process.
  • Time to Expiration ($t$): The remaining number of denoising steps.
  • Volatility ($\sigma$): The variance defined by the diffusion scheduler.
  • Risk-free Rate ($r$): A constant ($1/T$) used to distribute "returns" across the timeline.

This "fore-sighted" approach allows the model to make decisions based on the long-term dynamics of the generation process rather than just immediate alignment.

Experimental Results

The method was evaluated using Stable Diffusion 2.1 across four complexity levels: simple objects, multiple objects in scenes, object-background morphing, and action-style blending.

Qualitative comparison of various prompt mixing techniques against the proposed Black-Scholes approach across four test scenarios.

Quantitative Performance

The proposed method achieved the highest CLIP-combined and CLIP-add scores, indicating superior text-image alignment. It also excelled in DINO and BLIP metrics, which measure the preservation of individual concept characteristics. Furthermore, significantly lower Kernel Inception Distance (KID) scores were observed, reflecting higher visual realism and fewer artifacts compared to alternating or step-wise methods.

Qualitative Analysis

As shown in the comparison grid, the Black-Scholes method produces more balanced and coherent blends. While methods like "Step" or "Alt" often lose one concept entirely or create disjointed compositions, the Black-Scholes algorithm maintains the structural integrity of both prompts. For instance, in the "Parrot; Pizza" scenario, it successfully integrates pizza textures into the parrot's form more naturally than competitors. Similarly, in the "Corgi; Penguin" scenario, it avoids the visual glitches seen in vanilla Stable Diffusion.

Conclusion

This research demonstrates that financial pricing models can be effectively repurposed for generative AI. The Black-Scholes prompt mixing algorithm is a "plug-and-play" wrapper that requires no retraining or manual hyperparameter tuning. While it introduces a slight computational overhead due to per-step CLIP score calculations, the gains in image quality and conceptual balance are substantial. Future work may explore adaptations for non-Gaussian diffusion processes and distilled one-step models.

Summary updated

Abstract

We introduce a novel approach for prompt mixing, aiming to generate images at the intersection of multiple text prompts using pre-trained text-to-image diffusion models. At each time step during diffusion denoising, our algorithm forecasts predictions w.r.t. the generated image and makes informed text conditioning decisions. To do so, we leverage the connection between diffusion models (rooted in non-equilibrium thermodynamics) and the Black-Scholes model for pricing options in Finance, and draw analogies between the variables in both contexts to derive an appropriate algorithm for prompt mixing using the Black Scholes model. Specifically, the parallels between diffusion models and the Black-Scholes model enable us to leverage properties related to the dynamics of the Markovian model derived in the Black-Scholes algorithm. Our prompt-mixing algorithm is data-efficient, meaning it does not need additional training. Furthermore, it operates without human intervention or hyperparameter tuning. We highlight the benefits of our approach by comparing it qualitatively and quantitatively to other prompt mixing techniques, including linear interpolation, alternating prompts, step-wise prompt switching, and CLIP-guided prompt selection across various scenarios such as single object per text prompt, multiple objects per text prompt and objects against backgrounds. Code is available at https://github.com/divyakraman/BlackScholesDiffusion2024.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
concept blendingBlack ScholesCLIP-combined0.3469backbone=CLIP
Source quote
L267: Black Scholes │ {\bf 0.3469} │ {\bf 0.3112} │ {\bf 0.3912} │ {\bf 0.01531} │ {\bf 100} │ {\bf 14} │ {\bf 0.00389} │ {\bf 7.7}
concept blendingAlt. Samp.CLIP-combined0.3445backbone=CLIP
Source quote
L264: Alt. Samp.~\cite{kothandaraman2023aerial} │ 0.3445 │ 0.3098 │ 0.3894 │ 0.01786 │ 100 │ 14 │ 0.00389 │ 7.7
concept blendingBlack ScholesBLIP ⊙ DINO0.3912Table-level result with no scenario-specific breakdown reported; pretrained Stable Diff…
Source quote
L267: Black Scholes │ {\bf 0.3469} │ {\bf 0.3112} │ {\bf 0.3912} │ {\bf 0.01531} │ {\bf 100} │ {\bf 14} │ {\bf 0.00389} │ {\bf 7.7}
concept blendingAlt. Samp.BLIP ⊙ DINO0.3894Table-level result with no scenario-specific breakdown reported; pretrained Stable Diff…
Source quote
L264: Alt. Samp.~\cite{kothandaraman2023aerial} │ 0.3445 │ 0.3098 │ 0.3894 │ 0.01786 │ 100 │ 14 │ 0.00389 │ 7.7
concept blendingBlack ScholesKID (↓)0.01531Table-level result with no scenario-specific breakdown reported; pretrained Stable Diff…
Source quote
L267: Black Scholes │ {\bf 0.3469} │ {\bf 0.3112} │ {\bf 0.3912} │ {\bf 0.01531} │ {\bf 100} │ {\bf 14} │ {\bf 0.00389} │ {\bf 7.7}
concept blendingCLIP Min.KID (↓)0.00866backbone=CLIP
Source quote
L265: CLIP Min. │ 0.3195 │ 0.2955 │ 0.3107 │ 0.00866 │ 100 │ 14 │ 0.00389 │ 7.7
BibTeX
@misc{kothandaraman2024prompt,
  author = {Divya Kothandaraman and Ming C. Lin and Dinesh Manocha},
  title = {{Prompt Mixing in Diffusion Models using the Black Scholes Algorithm}},
  year = {2024},
  eprint = {2405.13685},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.13685},
}
Figure