Sketch-Guided Text-to-Image Diffusion Models

Andrey Voynov, Kfir Aberman, Daniel Cohen-Or · DOI

While text-to-image (T2I) diffusion models like Stable Diffusion have achieved remarkable results, precise spatial control remains a significant challenge. Users often struggle to dictate the exact orientation or placement of objects through text prompts alone. Existing methods either sacrifice fine-grained structure (like SDEdit) or require massive retraining of auxiliary encoders (like PITI), which often fail when faced with "out-of-domain" human sketches.

The Latent Guidance Predictor (LGP)

The authors propose a lightweight solution: the Latent Guidance Predictor (LGP). This approach leverages the observation that the internal layers of a diffusion model's U-Net already encode rich spatial information. Instead of a large convolutional network, the LGP is a tiny, per-pixel Multi-Layer Perceptron (MLP).

The LGP takes concatenated features from a single "latent pixel" at various noise levels and learns to predict the corresponding pixel in a spatial map, such as a sketch. Because it operates per-pixel, the LGP is exceptionally efficient—training requires only a few thousand images and takes less than an hour on a single GPU. This per-pixel nature also makes the model "domain-oblivious," allowing it to handle messy, free-hand human sketches far better than image-wide encoders.

Guidance via Backpropagation

During the inference process, the LGP predicts an edge map from the current noisy latent. The system calculates the loss between this prediction and the user's input sketch. By computing the gradient of this loss with respect to the latent image, the model "nudges" the generation process to align with the sketch's layout.

To maintain image quality, the authors employ guidance scheduling. Guidance is typically applied only during the first half of the diffusion steps. This allows the model to establish the global structure early on, leaving the final steps free to generate realistic textures and fine details without being overly constrained by the sketch's specific lines.

Key Results and Versatility

The primary strength of this method is its ability to combine strict spatial adherence with the creative flexibility of the base T2I model. As shown in the figure below, a single input sketch can be transformed into vastly different styles—from an origami bicycle to one made of wood—while perfectly maintaining the original orientation and proportions.

Figure 2: The LGP allows for precise spatial control across diverse text prompts using a single input sketch.

Beyond sketches, the technique generalizes to other forms of spatial control, such as saliency-guided inpainting and spatial label guidance. This proves that pretrained diffusion models act as "latent world models" that already understand edges; they simply require a lightweight probe like the LGP to tap into that knowledge.

Limitations

Despite its efficiency and robustness, the method introduces a backward pass through the U-Net at each guided step, increasing sampling time by approximately 80%. Additionally, while it handles simple sketches well, it can still struggle with extremely complex or cluttered scenes where internal U-Net features become ambiguous. Future work may explore "sketch inversion" to find noise seeds that naturally align with the input, further harmonizing the guidance with the diffusion process.

Summary updated

BibTeX
@inproceedings{voynov2023sketch,
  author = {Andrey Voynov and Kfir Aberman and Daniel Cohen-Or},
  title = {{Sketch-Guided Text-to-Image Diffusion Models}},
  booktitle = {SIGGRAPH (Conference Paper Track)},
  year = {2023},
  doi = {10.1145/3588432.3591560},
}
Figure