Manuscript Offprint

arXiv:2609.35530

AutoRef: Harness Optimization for Agentic Multi-Reference Image Generation

Yuta Oshima, Ku Onoda, Yusuke Iwasawa, Masahiro Suzuki, Yutaka Matsuo, Hiroki Furuta

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Recent image generation models can take multiple reference images as input and combine them into a new image. However, multi-reference image generation remains challenging: models may omit or duplicate subjects from the references, or produce images in which multiple subjects appear unnaturally copied and pasted. Recent work has proposed image generation agents that combine image generation models, reasoning models, and a harness, which is an executable program that specifies how reference images are interpreted, how generation is performed, how outputs are diagnosed, and how the final image is selected. In multi-reference generation, however, references play different roles and outputs must satisfy many criteria at once, such as fidelity to each reference and the naturalness of the whole image, so many parts of the harness could be improved, from how references are processed to how outputs are diagnosed. This makes it hard to predict which changes will improve performance and by how much, and good harnesses difficult to design by hand; indeed, human-written harnesses vary widely in performance. We therefore propose AutoRef, which optimizes the harness automatically while keeping both models frozen: a coding agent iteratively rewrites the harness code. AutoRef separates the tasks whose feedback informs proposals from the tasks used to select candidates, and continues the search from a beam of the top-ranked harnesses on the selection tasks. Using this procedure, we discover AutoRef-Harness, which improves the open-weight FLUX.2 [klein] 4B from 5.72 to 7.37 (out of 10) on held-out four-reference tasks of the MultiBanana benchmark, matching or exceeding proprietary models including Nano Banana Pro and GPT-Image-1.5. Without re-optimization, the same harness also improves results when the generator, number of references, benchmark, evaluator, or reasoning model differs from those used in the search. We release our code and AutoRef-Harness at https://github.com/KuOnoda/AutoRef.

(a) Comparison with Baselines

Figure

(b) Transfers to Unseen # Refs.

(c) Beyond Model Size and Family

Figure 1: AutoRef-Harness (+ Ours), optimized on four-reference MultiBanana tasks with FLUX.2 [klein] 4B, (a) enables FLUX.2 [klein] 4B to match or exceed proprietary models on the held-out test split and transfers unchanged to (b) unseen three- and five-reference settings and (c) generators of different scales and families.

∗^{*}Equal contribution

1 INTRODUCTION

Recent image generation models can take multiple reference images as input and combine them into a new image (Google DeepMind, 2025a;b; OpenAI, 2025a; Wu et al., 2025). This capability, referred to as multi-reference image generation (Wu et al., 2026a; Xia et al., 2026; Zhang et al., 2026c; Huang et al., 2026b), matters for practical image creation because users can specify people, objects, clothing, backgrounds, and styles using separate images. Such control is directly useful in applications including advertising (Inoue et al., 2023; Morita et al., 2025), virtual try-on (Zhu et al., 2023; Chong et al., 2025; Hu et al., 2026), and content creation (Ruiz et al., 2023; Xu et al., 2026). Yet combining multiple references correctly remains challenging. Models may omit or duplicate subjects from the references, or produce images in which the subjects appear pasted in rather than forming a coherent scene (Xia et al., 2026; Huang et al., 2026b).

Recent work has proposed image generation agents that combine image generation and reasoning models through a harness and iteratively plan, generate, diagnose, and refine (Hao et al., 2023; Yang et al., 2024b; Ma et al., 2025; He et al., 2026b). The harness is executable code that specifies how the frozen models are used: how references are interpreted, prompts are constructed, candidates are generated and evaluated, and the output is selected. In multi-reference image generation, however, a good harness is harder to design than in text-to-image generation: references play different roles (e.g., identity, background, or style), and outputs must satisfy many criteria, including fidelity to each reference and the naturalness of the whole image (Oshima et al., 2026; Huang et al., 2026b). Many parts of the harness could therefore be improved, from which references to provide and in what order to how outputs are checked against each one, yet the effect of each change is hard to predict. Indeed, existing human-written harnesses vary widely in performance (Section 6.4).

Recent work on automatic agent optimization has expanded from prompts and workflows to executable code (Lee et al., 2026; Zhang et al., 2026b; Miyai et al., 2026). These methods, however, have largely been developed for tasks with verifiable rewards such as math (Lee et al., 2026) and coding (Lin et al., 2026; Zhang et al., 2026a), whereas image generation relies on noisy visual evaluation and provides little diagnostic information through scalar scores alone. We therefore propose AutoRef, which optimizes harness code while keeping the image generation and reasoning models frozen. To address these challenges, AutoRef separates the tasks used to propose harness updates from those used to select candidates, so that selection does not reuse the examples the proposer sees. It also runs an iterative beam search, in which the top-ranked harnesses on the selection tasks, rather than a harness chosen by the proposer, become the next parents.

AutoRef-Harness, the optimized harness for multi-reference image generation, was discovered by AutoRef on the MultiBanana benchmark (Oshima et al., 2026) using the open-weight FLUX.2 [klein] 4B (Black Forest Labs, 2026). It uses reference-grounded prompting, generates structurally diverse drafts, revises the better draft from explicit complaints, and selects among candidates with failure-aware comparisons. With AutoRef-Harness, FLUX.2 [klein] 4B improves from 5.72 to 7.37 on the four-reference MultiBanana held-out test split, matching or exceeding proprietary models including Nano Banana Pro (Google DeepMind, 2025b) and GPT-Image-1.5 (OpenAI, 2025b) (Figure 1). The same harness also improves results without re-optimization when the generator, number of references, benchmark, evaluator, or reasoning model is changed. We release our code and AutoRef-Harness.

References (72)