MAGPIE: Agentic Multi-Reference Image Generation via Executable Scene Construction

Yifan Dai, Daili Hua, Bohan Zeng, Yuran Wang, Jialing Liu, Bozhou Li, Chengzhuo Tong, Yang Shi, Kai Zeng, Liu Yang, Xinyu Liu, Shujie Li, Yiyan Ji, Bingyin Mei, Yushuo Guan, Yuanxing Zhang, Fangcheng Fu, Wentao ZhangarXiv 2026

TL;DR

Ask an AI image generator to grab specific people and props from three different photos and pose them together on a ladder, and you’ll usually get floating hands, missing items, or extra limbs. MAGPIE solves this by acting like a film director who blocks out the scene with digital mannequins first: a coding agent builds, checks, and debugs an executable 3D scene in Blender before a fine-tuned image generator paints in the real-world appearances. It turns messy compositional guesswork into verifiable, debuggable code.

What Problem Does This Paper Address?

Multi-reference image generation (MRIG) lets you feed a model multiple reference photos alongside a text prompt—say, "Take the woman from Image 1, the moon prop (ignore the sun!) from Image 2, and the man from Image 3; put her on a ladder holding the moon's top ring while he supports it from below."

Modern diffusion models are getting great at copying faces and textures, but they struggle when asked to compose multiple specific items while respecting selective inclusion and physical interactions. Standard pipelines try to figure out spatial layout and render pixel-level textures all at once in a black box. Even methods that plan ahead using 2D bounding boxes leave too much ambiguity: two overlapping boxes don't guarantee a hand actually grasps a ring, nor do they resolve depth ordering. Without an explicit, inspectable intermediate scene, compositional errors only show up after the final image is baked.

Comparison of existing methods vs. MAGPIE's executable 3D proxy approach

Methods

MAGPIE decouples scene blocking from appearance rendering across two main stages:

  1. Agentic Proxy Scene Construction (New): Instead of jumping straight to pixels, a multimodal coding agent (powered by Qwen3.8-flash) writes Python code for Blender to build a simplified, clay-like 3D "proxy" scene.
  2. Planning & Procedural Building: The agent maps reference subjects to scene instances and pulls from an expandable library of parameterized 3D components (articulated mannequins, furniture, shapes) equipped with interaction "anchors" (e.g., snapping a "hand" anchor to a "ring" anchor).
  3. Dual-Verification Loop: Just because code runs doesn't mean the scene looks right. MAGPIE runs up to six rounds of automated debugging. A geometric verifier runs ray-casting and mesh distance checks in 3D space (checking visibility, depth ordering, and physical contact), while a multimodal visual reviewer inspects the 2D render against the prompt. The agent edits the Blender script until the blocking is right.
  4. Proxy-Guided Synthesis (Standard + Targeted Adaptation): Once the grey 3D mannequin render is locked in, it's fed into a pretrained image generator (like FLUX or Qwen) alongside the original reference photos and a structured prompt. Because off-the-shelf generators might accidentally copy the grey, low-poly look of the 3D mannequins, the authors use lightweight LoRA (Low-Rank Adaptation) fine-tuning to teach the generator a strict rule: steal the geometry and poses from the 3D proxy, but take all colors, lighting, and identities from the reference photos.

Datasets

  • MAGPIE-Instruct-3K (New Training Dataset): Existing datasets don't come with Blender scripts. The authors curated 3,187 examples sourced from public datasets (Echo-4o, Scone, Pico-Banana, and MICo-150K). They ran their agentic harness (with access to target images during offline creation) to generate matching Blender scenes and proxy renders, using Qwen3.8-27B as a judge to filter for high alignment.
  • DreamOmni2 & SconeEval (Evaluation Benchmarks): Standard benchmarks testing multi-reference generation, editing, complex spatial composition, and the ability to distinguish requested subjects from distractors in the same photo.

Key Insights and Ideas

  • Zero-shot 3D proxies can actually hurt: You can't just hand a grey 3D render to an unadapted model and hope for the best. Feeding proxies to base Qwen without LoRA adaptation tanked its DreamOmni2 score from 42.01% down to 29.47% because the model didn't know how to decouple grey placeholder textures from structural layout. Training on MAGPIE-Instruct-3K is the secret sauce that unlocks the proxy's value.
  • 3D code beats 2D boxes and text plans: When the authors swapped out the 3D Blender render for text-only plans or 2D bounding boxes (even with dedicated LoRA training for each), 3D proxies beat the next-best representation by 12.28 percentage points on Qwen and 8.77 points on FLUX. Explicit 3D geometry resolves pose and contact ambiguities that 2D boxes simply can't express.
  • Iterative code debugging pays off: Letting the agent critique and fix its own Blender code matters—going from 0 refinement rounds (initial code) to 6 rounds steadily climbed overall success from 53.61% to 67.08%.

Key Results

Tested on two open-weight backbones—Qwen-Image-Edit-2511 and FLUX.2-klein-base-9B—MAGPIE delivered substantial jumps across the board:

  • DreamOmni2: MAGPIE boosted Qwen's overall success rate by +22.25 percentage points (42.01% $\rightarrow$ 64.26%) and FLUX by +28.21 points (38.87% $\rightarrow$ 67.08%). Both beat the strongest open-weight baseline (DreamOmni2 at 58.31%) and proprietary Gemini-2.5-Flash-Image (61.44%). Crucially, MAGPIE beat standard fine-tuning on the exact same training data (without proxies) by over 18 percentage points on both models.
  • SconeEval: FLUX + MAGPIE scored 9.05/10 overall, taking the #1 spot among all evaluated models—edging out proprietary heavyweights GPT-4o (8.94) and Gemini-2.5-Flash-Image (8.70).

Limitations and Future Work

The authors do not include a dedicated limitations section, though a few natural constraints emerge from their design:

  • Scope of 3D proxies: When building their dataset, the authors explicitly filtered for scenes with "identifiable entities and requirements expressible through proxy geometry, such as shape, poses and spatial arrangements"—meaning purely abstract stylistic edits or fluid phenomena (like smoke or typography, though font transfer works via the base model) aren't directly modeled by rigid 3D meshes.
  • Inference overhead: Generating an image now involves an agentic loop—writing code, running Blender, and executing up to six rounds of LLM visual/geometric review before diffusion even starts (runtime specifics are deferred to the supplementary material).
  • Future Work: The authors hope this framework sparks broader exploration into using executable scene representations to give users fine-grained, verifiable control over multi-reference generation.

Summary updated

Abstract

Multi-reference image generation requires a model to preserve the appearance of selected subjects while arranging them according to an instruction. Despite recent progress in reference-based generation and compositional control, reliably organizing selected subjects into the intended scene remains challenging. Although existing methods provide various forms of compositional guidance, the planned relationships are not always explicitly instantiated for inspection and refinement before image synthesis. To address this limitation, we introduce MAGPIE, which represents the intended composition as a simplified 3D scene defined by an executable Blender program. A coding agent links each scene instance to its reference, checks the geometry and rendered view against the instruction, and revises the program to correct discrepancies. The final proxy rendering serves as a visual plan for the image generator. Using MAGPIE-Instruct-3K, we train the generator to follow this plan while drawing each subject's appearance from its reference. MAGPIE improves both Qwen and FLUX on DreamOmni2 and SconeEval. With FLUX, it improves overall success on DreamOmni2 by 28.21 percentage points over the original backbone and achieves the highest overall score among the models evaluated on SconeEval.
BibTeX
@misc{dai2026magpie,
  author = {Yifan Dai and Daili Hua and Bohan Zeng and Yuran Wang and Jialing Liu and Bozhou Li and Chengzhuo Tong and Yang Shi and Kai Zeng and Liu Yang and Xinyu Liu and Shujie Li and Yiyan Ji and Bingyin Mei and Yushuo Guan and Yuanxing Zhang and Fangcheng Fu and Wentao Zhang},
  title = {{MAGPIE: Agentic Multi-Reference Image Generation via Executable Scene Construction}},
  year = {2026},
  eprint = {2611.32462},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.32462},
}
Figure