CAL-RAG: Retrieval-Augmented Multi-Agent Generation for Content-Aware Layout Design

Najmeh Forouzandehmehr, Reza Yousefi Maragheh, Sriram Kollipara, Kai Zhao, Topojoy Biswas, Evren Korpeoglu, Kannan AchanarXiv 2025

TL;DR

CAL-RAG is a novel framework that combines Retrieval-Augmented Generation (RAG) with a multi-agent critique loop to automate content-aware layout design. By iteratively generating, grading, and refining the placement of text, logos, and underlays, the system achieves state-of-the-art visual harmony and semantic alignment, outperforming existing single-pass generation methods.

What Problem Does This Paper Address?

Automated content-aware layout design—such as arranging text, logos, and background underlays on an advertising canvas—is a complex task. It requires balancing strict aesthetic principles (like alignment and spacing) with semantic awareness (e.g., ensuring text doesn't obscure the main product).

Traditional approaches rely on rigid, hand-crafted rules or data-hungry deep learning models (like GANs and VAEs) that struggle with out-of-distribution inputs. While Large Language Models (LLMs) show promise in generating structured layouts (like JSON or HTML), they often operate in a vacuum, relying purely on prompt engineering without grounding in actual design exemplars or visual feedback.

Methods

The authors introduce CAL-RAG, an agentic framework implemented using LangGraph that treats layout design as an iterative, collaborative process among specialized agents:

  1. Layout Recommender Agent: Given an input background image, this agent uses a CLIP image encoder to retrieve the top-$k$ most visually similar images from a design knowledge base. It then uses these retrieved pairs as few-shot context to guide an LLM in predicting the ideal number, types, and bounding boxes of layout elements.
  2. Layout Generation Tool: This tool physically renders the abstract bounding boxes and elements onto the background canvas, handling coordinate transformations and alpha-blending operations.
  3. Grader Agent: Acting as a design expert, this vision-language agent evaluates the rendered layout against three mathematical metrics: color consistency/cohesion, composition/spacing (overlap minimization), and product visibility (occlusion prevention). If the layout passes all thresholds, it is accepted.
  4. Feedback Agent: If the layout is rejected, this agent analyzes the failures and generates precise, localized corrective shifts (e.g., adjusting position or size) to guide the Recommender Agent in the next iteration.
Figure 2: System Architecture Diagram of CAL-RAG.

Datasets

The framework was evaluated on the PKU PosterLayout dataset, a popular benchmark for content-aware visual-textual layout generation. The dataset consists of:

  • 9,974 poster-layout pairs.
  • 905 image canvases with annotations for text, logos, and underlays.
  • Standard splits of 7,735 images for training/knowledge-base construction, 1,000 for validation, and 1,000 for testing.

Key Insights and Ideas

  • Retrieval is Only the Starting Point: While RAG provides an excellent design "prior" or reference point, retrieval alone lacks the fine-grained optimization capabilities needed for perfect spatial harmony.
  • The Power of the Critique Loop: Shifting from a single-pass generation model to an iterative multi-agent loop (generate $\rightarrow$ evaluate $\rightarrow$ refine) drastically improves layout quality.
  • Semantic Underlay Mastery: One of the hardest tasks in layout design is placing "underlays" (colored bounding boxes behind text) accurately. CAL-RAG achieves perfect alignment here because the feedback loop explicitly penalizes misaligned or floating text elements.

Key Results

CAL-RAG achieved state-of-the-art performance across all primary geometric layout metrics on the PKU PosterLayout dataset, outperforming strong baselines like LayoutPrompter, CGL-GAN, and DS-GAN.

Table 1: Performance Comparison
  • Overlap (Ove) & Alignment (Ali): CAL-RAG minimized unwanted element overlap to 0.0023 and alignment deviation to 0.002, coming closest to the actual ground-truth human designs.
  • Underlay Effectiveness (Und$_l$ & Und$_s$): The model achieved a perfect score of 1.0000 in both loose and strict underlay effectiveness, proving that it flawlessly matches text blocks with their intended background decorations.

An ablation study confirmed that while the base Recommender Agent performed modestly, adding the Grader Agent and Feedback Agent progressively unlocked these top-tier results.

Table 2: Ablation Results

Limitations and Future Work

Not discussed in the paper.

Summary updated

BibTeX
@misc{forouzandehmehr2025cal,
  author = {Najmeh Forouzandehmehr and Reza Yousefi Maragheh and Sriram Kollipara and Kai Zhao and Topojoy Biswas and Evren Korpeoglu and Kannan Achan},
  title = {{CAL-RAG: Retrieval-Augmented Multi-Agent Generation for Content-Aware Layout Design}},
  year = {2025},
  eprint = {2506.21934},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.21934},
}
Figure