CountLoop Cuts AI Image Counting Errors by 57% Without Retraining
A training-free loop pairs a planning VLM with a critic VLM to generate images containing precise object counts, cutting counting error by up to 57 percent.
ProTakeaways
- CountLoop is a training-free framework that generates images with precise object counts, up to 200 instances per scene.
- Reduces counting error by up to 57% on standard benchmarks and 43-48% on new high-instance benchmarks.
- Uses a Design VLM to build a planning graph, cumulative attention to prevent leakage, and a Critic VLM to iteratively refine.
- Achieves MAE of 7.59 on CountLoop-S versus 14.55 for the best prior method 3DIS, at competitive runtime.
- Plug-and-play with frozen SDXL, SD 3.5, or SD 1.5 backbones; most prompts converge in three critic rounds.
- Paper and project page at mondalanindya.github.io/CountLoop; code and benchmarks to be released.
Ask any modern text-to-image model for "140 oranges and 31 birds" and you will get a photorealistic mess: piles that saturate around a dozen objects, birds that fuse with oranges, or suspiciously grid-like arrangements. A team from Surrey, Universitat Autònoma de Barcelona, and Simon Fraser has released CountLoop, a training-free framework that turns dense, count-faithful generation into an iterative design process without touching a single diffusion weight.
The paper reports that CountLoop reduces counting error by up to 57% on standard benchmarks and 43-48% on high-instance scenes, while achieving the highest or comparable spatial quality across four benchmarks. The technique wraps any frozen diffusion model (SDXL by default) in a loop of two vision-language models: one plans the scene, the other critiques it.
Why diffusion models can't count
Counting has been a stubborn failure mode of text-to-image systems. Current image diffusion models typically saturate around 10 instances per category, with precise quantity a known long-tail compositional failure that produces three characteristic bugs:
- Semantic drift: attributes bleed between objects (birds start looking like eggs).
- Spatial collapse: instances merge into cluttered blobs.
- Grid artifacts: LLM-derived layouts fall into rigid rows and columns.

Prior fixes fall into three camps. Gradient-guided methods inject a counting loss during denoising but treat counting as a global scalar constraint, optimising a signal that tells the model how many objects to produce but not where to place them. Layout-to-image pipelines condition on boxes or masks, but single-pass generation causes cross-attention leakage and identity confusion as objects crowd together. Agentic frameworks add LLM critics but lack a persistent scene representation.
Storyboarding with two VLMs
CountLoop treats generation like an art director iterating on a storyboard. It runs three stages, with both VLM roles instantiated from an 8B Qwen3-VL checkpoint.

- Planning graph: The Design VLM parses the prompt into a JSON graph where each node includes attributes like category, a unique identifier, normalized position, size, depth prior, and color. Edges encode spatial relations via directional operators, normalized distances, and angular orientations. This representation is more expressive than raw LLM bounding-box lists and specifically discourages grid layouts.
- Cumulative attention composition: Rather than generating all objects at once, CountLoop synthesises one instance at a time, applying a shape-aware binary mask so each object's cross-attention is confined to its own region. Objects are composed in far-to-near depth order, and IP-Adapter conditions each pass on the previous image to keep textures consistent.
- Critic loop: A Critic VLM scores the result on count fidelity (via GroundingDINO, since VLMs are notoriously bad at dense counting) and aesthetics (via Q-Align). It emits structured edits from a fixed vocabulary:
move,add,remove,resize,degrid.
The clever bit is the refinement operator, which interprets feedback and estimates a textual analogue of a gradient using a loss function defined as a pre-defined textual prompt template. It rewrites the JSON graph rather than updating any weights, so the whole pipeline stays training-free.
The numbers
The team evaluated on COCO-Count, T2I-CompBench, and two new benchmarks (CountLoop-S for single-category and CountLoop-M for multi-category, both with 30 to 200 instances per prompt). Counting is measured with MAE (lower is better) using OWLv2 as an independent evaluator.
| Method | COCO-Count MAE | CountLoop-S MAE | CountLoop-M MAE |
|---|---|---|---|
| FLUX | 1.40 | 17.47 | 9.62 |
| Qwen-Image | 1.04 | 17.30 | 6.92 |
| SLD | 1.15 | 29.65 | 3.74 |
| 3DIS | 1.56 | 14.55 | 5.75 |
| CountGen | 1.88 | 34.44 | 6.46 |
| CountLoop | 0.45 | 7.59 | 2.13 |
The gap widens as density grows. CountGen's MAE rises from 1.88 on COCO-Count to 34.44, and SLD from 1.15 to 29.65. Ablations show the components are roughly additive: planning graph alone drops MAE from 29.91 to 14.98, cumulative attention to 14.39, combined to 11.27, and iterative refinement finishes the job at 7.59. Most prompts converge within three critic rounds.
Runtime holds up too. At 100 instances, CountLoop achieves 3× lower error (MAE ≈ 13 vs. 50) in 25% less time (~150 s vs. 200 s) than the agentic SLD baseline.
Where it helps, where it hurts
The authors point to three practical wedges: augmenting counting datasets like FSC-147 (fine-tuning CountGD on CountLoop-generated data cuts test MAE from 5.74 to 4.68), populating game waves with exact enemy quotas, and producing count-labeled supervision for text-to-video pretraining.
Limitations are honest. As a training-free system, CountLoop inherits the constraints of its frozen VLM and detector, allowing their biases to propagate. Dense occlusions, especially in human scenes, can degrade attention quality and spatial consistency. Lacking explicit 3D priors, the system struggles to generate objects in varied poses and complex perspectives. Strong layout guidance can also collapse intra-class diversity toward canonical poses. And there is a physical ceiling: past a certain instance count, the pixels per object simply run out on a fixed-resolution canvas.
Code, prompts, planning-graph templates, and the two new benchmarks will be released upon acceptance, per the supplementary. In the meantime, the project page is the place to watch.