Imagine Before You Draw: Visual Prompt Engineering for Image Generation

Liyu Jia, Fengda Zhang, Jiachun Pan, Kesen Zhao, Saining Zhang, Wang Lin, Weijia Wu, Yue Liao, Aojun Zhou, Hanwang Zhang

TL;DR

The paper introduces Visual Prompt Engineering (VPE), a technique that forces image generation models to create a high-level "semantic blueprint" (using SigLIP 2 tokens) before rendering final pixels. By acting like a chain-of-thought for vision, VPE bridges the text-to-pixel gap, accelerating model convergence and drastically improving detail preservation in image editing tasks when integrated into unified, single-model architectures.

What Problem Does This Paper Address?

Modern multimodal models struggle with the massive leap from high-level text prompts to low-level, pixel-accurate images. To ease this transition, some recent methods use intermediate visual semantic features as a stepping stone. However, they typically rely on an external architecture: a two-stage pipeline where an autoregressive (AR) model generates semantic tokens, which are then passed to a completely separate diffusion decoder.

This external setup creates a severe information bottleneck. Because the diffusion decoder cannot directly access the original input image or text, it struggles with tasks like image editing, often completely regenerating unedited background details. On the flip side, internal architectures (which process all modalities within a single unified model) avoid this bottleneck but suffer from slow convergence because they try to map text directly to pixels without any intermediate guidance.

Methods

The authors propose Visual Prompt Engineering (VPE) to combine the best of both worlds. VPE breaks image generation into two distinct sub-problems: semantic planning ("what to draw") and detail rendering ("how to draw it").

Figure 1: VPE in two architectural frameworks. VPE inserts SigLIP 2 visual prompts before image generation as a semantic plan. (a) In the internal architecture, all modalities (text, SigLIP 2 tokens, image tokens) share attention within a single model via Eq. 4, enabling direct cross-referencing during generation. (b) In the external architecture, an AR model first produces SigLIP 2 features, which are then routed to a separate DiT decoder. While both frameworks benefit from VPE for generation, the external pipeline introduces an information bottleneck that limits editing fidelity (Section 4.3).
  1. The Semantic Plan ($c \rightarrow T_{vp}$): Given a condition $c$ (text or class), the model first autoregressively predicts a compact grid of discretized semantic tokens ($T_{vp}$) extracted using a frozen SigLIP 2 encoder.
  2. Detail Rendering ($T_{vp} \rightarrow T_{img}$): The model then generates the final image tokens ($T_{img}$) conditioned on both the original prompt and its own self-generated visual prompts.

To make VPE stable, the authors introduced a Progressive Training Schedule. If a model is trained only on perfect ground-truth semantic tokens, it fails at inference time when its own generated tokens are slightly imperfect (the train-inference discrepancy). For discrete token models (like LlamaGen), they use a step-dependent masking probability to gradually introduce the visual prompts. For continuous token models (like Transfusion), they dynamically modulate the cross-entropy loss coefficient ($\lambda_{CE}$) so the semantic token gradients don't overwhelm the diffusion/flow-matching denoising gradients early on.

Datasets

The authors validated VPE across several tasks and benchmarks:

  • Class-to-Image Generation: Trained and evaluated on ImageNet-1K.
  • Text-to-Image (Text Rendering): Fine-tuned on 6.35M English text images from TextAtlas and AnyWord-3M, and evaluated on TextScenesHQ, TextVisionBlend, and StyleTextSynth.
  • Image Editing: Fine-tuned on 5.4M editing pairs from NHR-Edit, UnicEdit, ShareGPT4o, and Pico-Banana, and evaluated using PIE-Bench.
  • General T2I Quality: Evaluated using the GenEval benchmark.

Key Insights and Ideas

  • Chain-of-Thought for Pixels: Much like chain-of-thought prompting breaks down complex reasoning for Large Language Models, VPE breaks down complex visual synthesis into layout planning followed by pixel filling.
  • The Power of Internal Integration: The paper proves that internal architectures are fundamentally superior for image editing. Because the single model can jointly attend to the original image, the text instruction, and the semantic plan simultaneously, it completely bypasses the information bottleneck of external pipelines.
  • Alleviating the Convergence Penalty: While unified internal models are traditionally harder to train from scratch, providing them with intermediate semantic guidance via VPE drastically accelerates their convergence speed.

Key Results

  • Higher Quality Ceilings: On ImageNet-1K (512×512), LlamaGen+VPE achieved an FID of 8.69 compared to the baseline's 24.56.
  • Superior Text Rendering: Integrating VPE into Show-o2 boosted OCR accuracy on TextScenesHQ from a meager 2.62% to 16.29% (a 6.2× improvement), demonstrating much better character structure planning.
  • Flawless Detail Preservation in Editing: When comparing internal vs. external paradigms on PIE-Bench, Internal+VPE drastically outperformed External+VPE in preserving unedited regions, boasting a +6.84 dB PSNR improvement (26.76 vs 19.92) and a 2.5× better Structure Distance.
Qualitative comparison of image editing preservation

Limitations and Future Work

  • Scale: VPE has currently only been validated on models up to 4.5B parameters; its scaling behavior on larger models remains to be explored.
  • Alternative Representations: The study strictly used SigLIP 2 tokens; other vision-language encoders like CLIP or DINOv2 might offer different performance trade-offs.
  • Hyperparameter Tuning: The progressive training schedule introduces several new hyperparameters ($p_0, p_1, k, \lambda_0, \lambda_1$) that were not exhaustively optimized and could be improved with better scheduling techniques.

Summary updated

BibTeX
@inproceedings{jia2026imagine,
  author = {Liyu Jia and Fengda Zhang and Jiachun Pan and Kesen Zhao and Saining Zhang and Wang Lin and Weijia Wu and Yue Liao and Aojun Zhou and Hanwang Zhang},
  title = {{Imagine Before You Draw: Visual Prompt Engineering for Image Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=0qIxwwc2xH},
}
Figure