Skip to content
AI.info

Research

Text-Conditioned Background Generation for Editable Multi-Layer Documents

Overview Research area: Computer vision and generative modeling for document editing, specifically diffusion-based background synthesis for multi-page, layered documents. Technical level: Advanced (as

arXiv
2512.17151
Published
2025-12-19
Authors
Taewon Kang, Joseph K J, Chris Tensmeyer, Jihyung Kil, Wanrong Zhu, Ming C. Lin, Vlad I. Morariu

AI summary

Overview

Research area: Computer vision and generative modeling for document editing, specifically diffusion-based background synthesis for multi-page, layered documents.

Technical level: Advanced (assumes familiarity with diffusion models, latent-space representations, contrast/luminance standards, and LLM-based instruction pipelines).

Scope: A training-free framework that regenerates only the background layer of existing multi-page documents while preserving foreground text and figures, enforcing WCAG-based readability, and maintaining stylistic continuity across pages.

What This Paper Is About

Existing diffusion models are built to produce standalone images, so applying them to documents tends to overwrite titles, alter figures, change semantic content, or shift resolution. The paper targets a constrained editing setting in which the text, figures, and layout of a multi-page document must stay exactly as they are, and only the background layer is redesigned. The goal is a framework that generates visually coherent, thematically consistent backgrounds across an entire document while keeping every text region readable.

Key Contributions

  1. Latent masking for foreground-aware backgrounds. A layout-aware attenuation field applied in latent space reduces diffusion updates over text and figure regions using a soft mask rather than hard binary constraints, so backgrounds evolve naturally around protected content instead of producing boundary artifacts.

  2. Automated Readability Optimization (ARO). A contrast-driven, WCAG-guided method that computes the minimal opacity of semi-transparent, rounded backing shapes per text box, using coverage-aware linear-light computation, so legibility is guaranteed without manual tuning.

  3. LLM-based multi-page consistency. A two-stage pipeline with a Summarization Model that distills each page into a compact representation and an Instruction Generation Model that converts summaries into concise background design prompts, recursively carrying context across pages via a Recursive Narrative Bank (RNB).

  4. A layered, training-free document editing framework. Text, figures, and backgrounds are treated as separately preserved or regenerated layers, with user prompts allowing stylistic adjustment of color and texture.

Main Findings

  • Readability near saturation: The method reaches 99.75% WCAG contrast coverage and 0.9665 OCR accuracy in Prompt+Text mode, and 99.38% / 0.9578 in Prompt-only mode, versus 66.98% / 0.5536 for BAGEL and 55.02% / 0.5225 for GPT-5.

  • Best scores across all design metrics: In Table 1, our method leads on Layout, Color, Graphic Style, Compliance, WCAG, OCR, CLIP MP Consistency, CLIP Prompt Score, and LLM Voting. The Prompt-only configuration scores highest on several LLM-judged metrics (Layout 4.355, Color 4.545, Compliance 4.7357, LLM Voting 4.5100).

  • Strong multi-page consistency: CLIP MP Consistency reaches 0.6955 (Prompt+Text) and 0.6259 (Prompt-only), compared with 0.5571 for BAGEL and 0.6870 for GPT-5.

  • Ablations confirm each component matters: Removing latent masking (Ours w/o LM) drops OCR to 0.9085 and WCAG to 99.67%; removing ARO drops WCAG to 97.35% and OCR to 0.9012; removing multi-page consistency drops CLIP MP to 0.6420 and LLM Voting to 4.2592 while leaving WCAG (99.69%) and OCR (0.9632) essentially unchanged.

  • LLM dependence is limited and isolated: Removing the LLM-driven multi-page module changes only consistency (CLIP MP −0.06, LLM Voting −0.07), while latent masking, ARO, and RNB are described as LLM-independent.

  • Baselines violate the task constraint: BAGEL often produces strong textures or high-frequency patterns that partially interfere with dense text; GPT-5 frequently alters layout structure, modifies embedded figures, or hallucinates additional text.

  • Users prefer the method: In a study with 30 participants rating on a 5-point Likert scale, the method scored highest on all four dimensions (4.669–4.8024) versus BAGEL and GPT-5 (1.169–1.6452). Overall preference was 83.57% for Ours, 15.24% for GPT-5, and 1.43% for BAGEL.

  • Benchmark design: The benchmark consists of academic-style documents and slide decks, each with exactly three pages/slides, mixing long-form text, bullet points, and at least one embedded figure in non-trivial layouts. Text was authored with GPT-5 and images with GPT-4o.

Methodology in Plain English

The pipeline starts by extracting the document's foreground. Text lines are detected with bounding boxes, grouped into paragraphs, and merged into column-like regions using horizontal overlap and vertical-gap tolerances, with an NMS-style suppression step removing redundant overlapping regions. This yields both full-page text and a smaller set of representative bounding boxes.

A summarization model compresses each page's verbose text into a short phrase (five words or fewer) capturing its dominant visual theme. An instruction model then turns that summary — optionally combined with a user prompt and the history of prior page instructions — into a concise background design instruction. Prior instructions are kept in a Recursive Narrative Bank with a memory window of size N, so stylistic cues such as color tone and texture carry forward across pages.

Background generation uses a text-to-image diffusion model modified so that updates are partly suppressed in foreground regions. The mask is a two-dimensional lattice that is set to an attenuation factor lambda inside a centered window covering a fraction rho of the lattice and 1 elsewhere. This attenuation is applied at later timesteps: the effective velocity blends the model-predicted velocity with a stopped-gradient copy of itself, then the latent is updated with that softened velocity. In implementation, the attenuation strength is 0.2 and masking begins at step 0.29 of the diffusion schedule.

Finally, ARO guarantees legibility. It converts sRGB to linear RGB, computes relative luminance with standard coefficients, computes WCAG contrast ratio, and searches for the minimum opacity alpha such that the blended luminance between the overlay and the background pixels achieves a target contrast across a required fraction of pixels. The final opacity is clamped between a minimum and 1. In experiments, the target contrast is 7.0, coverage is 0.98, padding is 24, and the radius fraction is 0.12. Overlays are drawn as rounded rectangles expanded from each text bounding box and composited over the background.

Latent masking was implemented inside BAGEL, which serves as the baseline editing framework. The summarization and instruction modules use GPT-4o; bounding boxes are extracted with PyMuPDF and OpenCV. The framework is training-free.

Why This Matters

Impact on research. The paper argues that document-centric editing requires a different objective from mainstream diffusion research, which overwhelmingly pursues sharper, more detailed outputs. To preserve strict text fidelity, the model must sometimes do less, not more. Soft latent attenuation and explicit contrast optimization offer a principled alternative to hard mask-based inpainting, and the paper positions this as a bridge between generative modeling and natural design workflows.

Real-world applications.

  • Redesigning backgrounds of academic reports, handouts, and lecture slides without touching the text or figures.
  • Automated accessibility compliance for documents whose backgrounds would otherwise fail WCAG contrast requirements.
  • Multi-page branding or theme application, where a consistent palette and motif must carry across an entire deck or report.
  • Iterative design refinement, where a user regenerates only the background layer in response to prompts such as making it more subtle.

Industry relevance. The paper states its contribution is a technical enabler for already-deployed use cases rather than a new use case, noting that commercial tools such as Canva Magic Design and Microsoft Designer expose automated background generation and may benefit from algorithms that ensure foreground readability for text-dense documents. It cites its OCR 0.97 and WCAG 99.75% against 0.55 / 66.98% (BAGEL) and 0.52 / 55.02% (GPT-5) as a "near-saturation readability regime" baselines do not approach.

Future Directions

  • More adaptive masking strategies to reduce residual artifacts around text boundaries in dense, irregular layouts, and to improve ARO reliability on irregular transparent figure overlays.

  • Enhanced semantic encoders for tighter alignment between visual motifs and document meaning, since the summarization-and-instruction mechanism occasionally oversimplifies nuanced content.

  • Scaling to long-form documents. The benchmark fixes documents at three pages; the Recursive Narrative Bank is length-agnostic with per-page O(1) memory, but its fixed window saturates beyond roughly ten pages, and empirical validation on long-form documents is left as future work.

  • Finer-grained interactive control, such as per-section themes or adaptive palette shifts, and interactive editing pipelines where users refine backgrounds iteratively across multi-page documents alongside discussion of commercial deployment requirements.

  • A fair inpainting baseline. The paper reports no empirical SD-Inpainting baseline because a fair configuration at document resolutions (A4, 16:9) is non-trivial: downsampling destroys the text legibility being evaluated, and tiling introduces implementation-dependent seams. It notes the Ours w/o LM ablation (OCR 0.91 / WCAG 99.67%) already bounds inpainting-style behavior from above.

Target Audience

Researchers and practitioners working on diffusion-based image generation, document understanding, and design automation; accessibility engineers interested in automated WCAG contrast enforcement; and product teams building document, slide, or poster editing tools who need background synthesis that does not compromise text fidelity. It is also relevant to readers studying layer-aware or training-free generative editing and multi-page visual consistency.

Authors’ abstract

We present a framework for document-centric background generation with multi-page editing and thematic continuity. To ensure text regions remain readable, we employ a latent masking formulation that softly attenuates updates in the diffusion space, inspired by smooth barrier functions in physics and numerical optimization. In addition, we introduce Automated Readability Optimization (ARO), which automatically places semi-transparent, rounded backing shapes behind text regions. ARO determines the minimal opacity needed to satisfy perceptual contrast standards (WCAG 2.2) relative to the underlying background, ensuring readability while maintaining aesthetic harmony without human intervention. Multi-page consistency is maintained through a summarization-and-instruction process, where each page is distilled into a compact representation that recursively guides subsequent generations. This design reflects how humans build continuity by retaining prior context, ensuring that visual motifs evolve coherently across an entire document. Our method further treats a document as a structured composition in which text, figures, and backgrounds are preserved or regenerated as separate layers, allowing targeted background editing without compromising readability. Finally, user-provided prompts allow stylistic adjustments in color and texture, balancing automated consistency with flexible customization. Our training-free framework produces visually coherent, text-preserving, and thematically aligned documents, bridging generative modeling with natural design workflows.

Read the original paper