DiffGraph: An Automated Agent-driven Model Merging Framework for In-the-Wild Text-to-Image Generation

Zhuoling Li, Hossein Rahmani, Jiarui Zhang, Yu Xue, Majid Mirmehdi, Jason Kuen, Jiuxiang Gu, Jun Liu

TL;DR

DiffGraph is an automated, agent-driven framework that organizes thousands of open-source text-to-image "expert" models into a unified graph structure. By dynamically activating localized subgraphs and using a Variational Graph Autoencoder (VGAE) to predict optimal merging weights, it seamlessly combines diverse specialized models to satisfy complex, in-the-wild user prompts without any retraining or test-time optimization.

What Problem Does This Paper Address?

The open-source text-to-image (T2I) community has seen an explosion of specialized diffusion checkpoints and LoRAs (referred to here as "experts") hosted on platforms like Civitai and Hugging Face. These models excel at specific tasks, such as rendering a particular art style or generating a niche character.

However, existing model merging techniques struggle to leverage this vast, ever-expanding ecosystem. Current methods are typically restricted to small, fixed sets of pre-provided models, require expensive test-time optimization, or rely strictly on raw model parameters as input features. Because real-world online experts vary wildly in their training configurations, datasets, and architectures (e.g., full checkpoints vs. low-rank adaptations), parameter-dependent methods fail to generalize. DiffGraph addresses the challenge of dynamically selecting and merging an arbitrary number of heterogeneous online experts to fulfill complex, unpredictable user demands.

Methods

DiffGraph shifts the model-merging paradigm from parameter-space optimization to a graph-based capability space. The framework consists of two main stages:

1. Universal Graph Construction

A Graph Construction Agent (GCA) automatically scrapes online expert models and integrates them into a single universal graph using two mechanisms:

  • Node Registration: An MLLM (GPT-4o) summarizes the text and examples from an expert's homepage into a concise capability description, which is then converted into a text embedding to serve as the node's feature vector.
  • Node Calibration: To capture quantitative performance, experts are evaluated on a diverse set of representative "reference prompts" (also stored as nodes). The resulting image quality scores (CLIP Score, ImageReward, PickScore, etc.) are concatenated to form the edge features between expert nodes and reference prompt nodes.

2. Dynamic Subgraph Activation

During inference, when a user inputs a prompt:

  • Expert Selection Agent (ESA): An LLM parses the user prompt, breaking it down into macro style requirements (to select base checkpoints) and fine-grained visual attributes (to select LoRAs).
  • Merging Planner (MP): The user prompt is temporarily inserted into the graph as a node, activating a localized subgraph containing only the selected experts and their immediate neighbors. A trained Variational Graph Autoencoder (VGAE) processes this subgraph to predict optimal merging coefficients (modeled via a Beta distribution). The final merged model is constructed by computing a weighted softmax average of the selected checkpoints and LoRAs.

Datasets

  • DABench: A dataset comprising 50,482 real-world user prompts collected from Civitai, featuring complex combinations of visual attributes. It was used to train the VGAE and evaluate in-the-wild performance.
  • DiffusionDB: A large-scale prompt gallery dataset utilized as an external benchmark to evaluate text faithfulness and image generation quality.

Key Insights and Ideas

  • Capability Space over Parameter Space: Instead of trying to align raw, chaotic weight matrices from thousands of independently trained models, DiffGraph maps models into a structured graph based on semantic descriptions and empirical performance scores.
  • Functional Division of Labor: The framework explicitly separates the roles of base checkpoints (which dictate overall structure and composition) and PEFT/LoRA models (which refine fine-grained attributes), allowing the LLM agent to make highly complementary selections.
  • Zero-Shot Scalability: Because the VGAE operates on graph topology and capability features rather than raw weights, new models can be added to the universal graph in a training-free manner in just 1.2 minutes per expert, allowing the system to scale seamlessly as the online ecosystem grows.

Key Results

The authors evaluated DiffGraph using both Stable Diffusion 1.5 and FLUX.1 Dev as base architectures, comparing it against popular merging baselines like DARE, Model Swarms, and Diffusion Soup.

  • Superior Image Quality and Alignment: DiffGraph significantly outperformed all baselines across human preference metrics (ImageReward, PickScore) and text alignment (CLIP Score) on both the DABench and DiffusionDB datasets.
  • Evolving Ecosystem Success: In a scalability simulation ("2023 $\rightarrow$ 2025"), a DiffGraph model trained only on 2023 data successfully integrated and utilized experts released up to June 2025 without any retraining, outperforming baseline methods that were fully trained on the 2025 dataset.
Figure 2. Qualitative comparisons of different methods on T2I generation. Different attributes in the prompt text are labeled with different colors. We illustrate visual attributes in a paint box man- ner, where a full colored cell denotes an attribute is successfully reflected in the generated image, a half colored cell denotes the attribute is reflected but at low quality, and an empty (white) cell means the corresponding attribute is totally missing. Zoom in for a better view. More examples are in Supplementary.

Limitations and Future Work

Not explicitly discussed in the paper. However, potential areas for exploration include the computational latency introduced by calling LLM/MLLM APIs for prompt parsing and node registration during inference, as well as exploring how the framework handles potential conflicts when merging highly divergent base checkpoints.

Summary updated

BibTeX
@inproceedings{li2026diffgraph,
  author = {Zhuoling Li and Hossein Rahmani and Jiarui Zhang and Yu Xue and Majid Mirmehdi and Jason Kuen and Jiuxiang Gu and Jun Liu},
  title = {{DiffGraph: An Automated Agent-driven Model Merging Framework for In-the-Wild Text-to-Image Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=iVzSzSFoeZ},
}
Figure