NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

LayoutDM: Transformer-based Diffusion Model for Layout Generation

Shang Chai, Liansheng Zhuang, Fengying Yan

Abstract

LayoutDM is a novel generative framework that applies the power of diffusion models to the task of graphic design. By replacing the standard image-centric U-Net backbone with a purely Transformer-based architecture, the model successfully generates high-quality, diverse layouts for applications ranging from mobile UIs to magazine pages. Experimental results demonstrate that LayoutDM significantly outperforms previous state-of-the-art methods based on Generative Adversarial Networks (GANs) and Variational Auto-Encoders (VAEs).

Introduction

Creating an effective layout—whether for a document, an advertisement, or a mobile application—requires a complex balancing act of semantic relationships, reading order, and aesthetic principles such as alignment and spacing. While automated layout generation has been explored using GANs and VAEs, these approaches face inherent limitations. GANs are notoriously difficult to train and often suffer from "mode collapse," leading to repetitive outputs. VAEs, while more stable, frequently struggle to produce high-visual-quality results.

Furthermore, layouts are fundamentally different from images. While images are structured as grids of pixels, layouts are unordered sets of elements characterized by discrete categories (e.g., "Title," "Image") and continuous spatial coordinates. Standard Convolutional Neural Networks (CNNs), which power most image-based diffusion models, are ill-suited for this non-sequential, coordinate-based data. LayoutDM addresses these challenges by reformulating layout generation as a set-based diffusion process.

Methodology

LayoutDM instantiates a conditional Denoising Diffusion Probabilistic Model (DDPM) specifically tailored for layout data. The framework introduces several key technical innovations to handle the unique structure of graphic design.

Transformer Backbone

Instead of the typical U-Net architecture used in image diffusion, LayoutDM employs a purely Transformer-based architecture called the cLayoutDenoiser. This choice allows the model to capture high-level global relationships between any two elements in a layout, regardless of their sequence or spatial distance. This global attention mechanism is critical for ensuring that elements like headers and body text maintain proper alignment and spacing.

Unordered Representation

A crucial departure from standard Transformer applications is the omission of positional encoding. In natural language processing, positional encoding defines the order of words. However, in layouts, the order in which elements are listed in a data structure should not influence the final design—only their spatial coordinates matter. By removing these encodings, the model is forced to treat the layout as a set, enhancing its ability to learn purely spatial relationships.

Conditional Generation and Hybrid Embedding

The model is conditioned on user-specified attributes, such as element types, using "Classifier-Free Diffusion Guidance." This ensures that the generated geometric parameters (x, y, width, height) strictly adhere to the requested design components. To process this data, the model utilizes a hybrid embedding strategy that fuses geometric coordinates, attribute categories, and timestep embeddings (representing the diffusion stage) into unified "element tokens."

Experimental Setup

The researchers evaluated LayoutDM across five diverse benchmarks to demonstrate its versatility:

  1. Rico: Over 72,000 user interface designs for mobile apps.
  2. PubLayNet: Over 330,000 scientific document layouts.
  3. Magazine: A dataset of various magazine page arrangements.
  4. COCO: Utilized for natural scene layout generation (bounding boxes for objects).
  5. TextLogo3K: A dataset focused on text-based logo layouts.

Results and Discussion

LayoutDM achieved state-of-the-art (SOTA) results across nearly all evaluated metrics. On the Rico dataset, LayoutDM achieved a Fréchet Inception Distance (FID) of 3.03, a substantial improvement over the previous SOTA, VTN, which scored 9.31. A lower FID indicates that the generated layouts more closely mirror the distribution of real-world designs.

Key Insights

  • Diversity via Diffusion: The iterative denoising process allows LayoutDM to cover the data distribution more faithfully than GANs. While a GAN might converge on a single "safe" arrangement, LayoutDM can generate dozens of distinct, valid variations for the same set of constraints.
  • Global Context: The self-attention mechanism in the Transformer is uniquely suited to capture long-range dependencies, such as centering text under a specific image across the canvas.
  • Ablation Studies: The authors confirmed that the Transformer layers are essential; replacing them with simple fully-connected layers caused the model's spatial reasoning to collapse, resulting in high overlap and poor alignment.

Limitations and Future Work

Despite its performance, LayoutDM has two primary limitations. First, it currently operates under a single-layer assumption, meaning it does not explicitly model occlusion where elements overlap in a specific Z-order. Second, like most diffusion models, the inference speed is slower than "one-shot" models like GANs due to the iterative nature of the sampling process.

Future research will focus on optimizing sampling speeds and extending the architecture to handle multi-layer or 3D-aware layouts to better reflect complex graphic design environments.

Summary updated

BibTeX
@inproceedings{chai2023layoutdm,
  author = {Shang Chai and Liansheng Zhuang and Fengying Yan},
  title = {{LayoutDM: Transformer-based Diffusion Model for Layout Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
}
Figure