CountLoop : Iterative Agent Guided High Instance Image Generation
Anindya Mondal, Ayan Banerjee, Sauradip Nag, Josep Lladós, Xiatian Zhu, Anjan Dutta · 2025
Read CountLoop : Iterative Agent Guided High Instance Image Generation by Anindya Mondal, Ayan Banerjee, Sauradip Nag, Josep Lladós, Xiatian Zhu, Anjan Dutta (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-16644.txt.
Introduction
Image generators are good at pretty scenes but bad at counting: ask for thirty birds and you may get twelve. Mondal and five co-authors present CountLoop, a training-free framework that fixes counts step by step. A vision-language planner first lays out the scene in structured form. The system generates an image, then a second vision-language critic checks the object counts, layout, and quality, and sends back corrections.
The loop repeats until the scene matches the request. Attention tricks keep objects from bleeding into each other, even in crowded, overlapping scenes. On standard counting benchmarks and two new high-count tests, CountLoop cut counting error by up to fifty-seven percent. It also scored at or near the top on spatial quality while keeping images realistic. The authors aim it at design and media tasks where exact numbers matter.
Catalog record
| CREATOR | Anindya Mondal, Ayan Banerjee, Sauradip Nag, Josep Lladós, Xiatian Zhu, Anjan Dutta |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 56 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2508-16644
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
CountLoop : Iterative Agent Guided High Instance Image Generation Anindya Mondal, Ayan Banerjee, Sauradip Nag, Josep Lladós, Xiatian Zhu, Anjan Dutta Abstract Diffusion models have achieved remarkable progress in photorealistic synthesis; however, they remain unreliable for generating scenes with a precise number of object instances, particularly in complex, high-density settings. We introduce CountLoop , a training-free framework that equips diffusion models with accurate instance control via iterative structured feedback. It alternates between image synthesis and multimodal agent evaluation: an LLM-guided layout planner and critic provide explicit feedback on object counts, spatial arrangements, and attribute consistency, which is used to refine scene layouts and guide subsequent generations. Instance-driven attention masking and compositional techniques further prevent semantic leakage, enabling clear separation of individual objects even in occluded scenes. Evaluations on COCO-Count, T2I-CompBench, and two newly introduced high-instance benchmarks demonstrate that CountLoop surpasses existing benchmarks by achieving a counting accuracy of as much as 98% while consistently achieving spatial arrangement and visual quality over existing layout and gradient‑guided baselines with a score of 0.97. The code and benchmarking data are available at: https://mondalanindya.github.io/CountLoop/ . Introduction Digital creators, designers, and artists increasingly use text-to-image diffusion models like DALL-E 3 ( Betker et al. 2023 ) , SDXL ( Podell et al. 2024 ) , and FLUX ( Black-Forest-Labs 2024 ) to produce high-quality visuals. However, these models struggle with scenes containing many distinct yet related object instances, limiting their effectiveness in applications such as product advertising ( e.g. , densely stocked retail shelves ( Amazon Ads 2023 ; Team 2023 ) ) or visualizing rare/extinct species ( e.g. , dodos or mammoths ( Yap 2024 ) , where real data are limited; see Fig. 1 ). Current diffusion models typically saturate at around 10 instances per category ( Binyamin, Tewel et al. 2024 ) , yielding semantic drift (mixed attributes), spatial collapse (cluttered or overlapping objects), or instance duplication. For instance, a prompt like “31 cups on a coffee table” might produce only a dozen cups or an incoherent pile ( Fig. 1 ), compromising both accuracy and usability. Figure 1: CountLoop enables high-instance image generation with accurate layout and strong visual quality. (a) It handles scenes with 30-100+ instances, achieving precise counts and aesthetic layouts where prior models like FLUX and LMD struggle. (b) It supports real-world applications like product advertising and visuals of rare or extinct species. Current solutions fall into two categories: (1) layout-first pipelines ( Li et al. 2023 ; Feng et al. 2023 ; Liu et al. 2024 ; Binyamin, Tewel et al. 2024 ; Zhou et al. 2024 ; Banerjee et al. 2024 ) and (2) gradient-guided methods ( Chefer et al. 2023a ) . However, neither scale effectively to high-instance scenes or resolves the issues shown in Fig. 2 . Layout-first pipelines use boxes or masks to guide diffusion, but often produce distorted semantics due to autoregressive biases in generative models ( Xiong et al. 2024 ; Barron 2025 ) ( e.g. , grid-like layouts that favor the top-left, see Fig. 2 (a)). These approaches typically require annotated data or carefully engineered prompts ( Binyamin, Tewel et al. 2024 ) . Gradient-guided methods inject counting signals during denoising to steer generation towards the desired instance count, but they often introduce visual artifacts or worsen semantic leakage – an issue inherent to high-instance generation – especially as object density increases ( Dahary et al. 2024a ; Dahary et al. 2025 ) (see Fig. 2 (b)). To address the persistent challenge of generating visually coherent scenes with precise object counts, we introduce CountLoop , a framework that reimagines high-instance image generation as an iterative design process rather than a one-shot operation. Inspired by how human designers refine their work through successive iterations, CountLoop establishes a closed-loop system where large language models serve dual roles: as creative planners that construct structured scene representations that capture object attributes and spatial relationships, and as critics evaluating the generated images against the original specification. Crucially, CountLoop integrates a cumulative attention mechanism during the denoising process to mitigate semantic leakage – a common issue in high-instance scenes. Rather than generating all subjects simultaneously, it provides per-instance grounding by preventing semantic entanglement and maintains the identity of individual objects. By imposing attention locality within instance-specific regions, CountLoop encourages independence across objects and prevents the borrowing of features from nearby or similar instances. This iterative agent-guided process involves generating an initial image, evaluating its alignment with the specification, and systematically refining the layout and prompt until quality thresholds are met. Together, these components enable CountLoop to overcome the counting saturation and spatial coherence that affect existing approaches. Unlike prior methods requiring model retraining, CountLoop acts as a plug-and-play enhancement to standard diffusion models, reliably producing dense scenes (100+ objects) with accurate instance counts and natural spatial distributions. Evaluations in COCO-Count, T2I-CompBench, and our new high-instance benchmark show that CountLoop more than doubles counting accuracy while maintaining visual fidelity. We summarize our contributions as follows: (1) We present CountLoop , a training-free pipeline for generating high-instance images with precise object counts and strong aesthetic quality; (2) We introduce a planning graph to guide scene structure, combined with cumulative attention composition to prevent semantic leakage, even in dense scenes; (3) We develop an iterative procedure where a critic evaluates the generated image and provides feedback to refine the planning graph for the next iteration; (4) We conduct extensive evaluations on COCO-Count, T2I-CompBench, and new high-instance benchmarks, showing that our method achieves over 2x improvement in counting accuracy and significantly better visual coherence than existing baselines. Figure 2: Issues in High-Instance Image Generation Related Work Figure 3: Given a text prompt, the Layout Designer constructs a planning graph encoding object attributes and spatial relations, which is converted into a pixel-aligned layout. Guided by instance masks and cumulative latent composition with an IP-Adapter, the image is synthesized. A Design-Critic evaluates the result and updates the planning graph via an iterative feedback loop. This loop repeats until the count and quality goals are met. Count control in Image Generation: Early diffusion models (LDM ( Rombach et al. 2022 ) , Imagen ( Saharia et al. 2022 ) , SDXL ( Podell et al. 2024 ) ) achieve stunning photorealism but falter beyond 10–15 identical objects, exhibiting attribute leakage and spatial collapse ( Chefer et al. 2023b ; Chefer et al. 2023a ; Dahary et al. 2024b ; Dahary et al. 2024a ) . Layout-based approaches ( Lian et al. 2023 ; Binyamin, Tewel et al. 2024 ) and gradient-guided corrections ( Kang, Galim, and Koo 2023 ; Chefer et al. 2023a ) offer partial fixes but demand heavy retraining or still fail in extremely dense scenes. CountLoop avoids retraining by coupling a frozen diffusion backbone with an LLM-driven layout-refinement loop, incorporating a multi-turn object generation and composition mechanism that prevents the model from attribute leakage, thereby generating high-quality images even at high instance densities. Layout-to-Image Generation: Techniques like GLIGEN ( Li et al. 2023 ) , LMD ( Lian et al. 2023 ) , and SceneLayoutNet ( Zhang et al. 2024 ) use bounding boxes or masks for coarse count and placement control. They work well for moderate densities but degrade