wikillm

Paper · 2025-10-09 · cs.CL, cs.AI

Dynamic Generation of Multi-LLM Agents Communication Topologies with Graph Diffusion Models

Guided Topology Diffusion (GTD) generates a communication graph for an LLM agent team with a conditional discrete graph diffusion model. At each denoising step a GNN proxy scores five sampled candidates on predicted utility and cost, and the best one steers the step. Author-reported: 94.14% on GSM8K with GPT-4o-mini agents, versus 92.30% for the best baseline (MaAS).

Multi-agent systemsDiscrete diffusionGraph transformerGraph neural networkmulti-agentcommunication-topologygraph-generationdiffusionguided-sampling

arXivPDFCodeMarkdown15 min read

AI-compiled by claude-haiku-5-5 on 2026-11-06, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

A team of AI agents that talk to each other needs to know who sends messages to whom. Fixed patterns, such as everyone talks to everyone or a single chain, waste effort on easy questions and become bottlenecks on hard ones. This paper learns a fresh message pattern for each task.

The generator starts from a random pattern of links and removes the noise step by step, the same basic idea as image diffusion models, until a clean pattern remains. A small learned predictor estimates how well a pattern would do on the task and how costly it would be. At every step the generator tries several candidate patterns and keeps the one the predictor likes best, so the search is steered as it goes rather than judged only at the end.

The aim is patterns that are accurate, cheap in messages and sparse. The authors report that this beats hand-made and learned baselines on math and code benchmarks, with the caveat that all numbers are their own.

TL;DR

GTD is a guided discrete graph diffusion model that writes a sparse, task-specific communication graph for a multi-agent LLM team. Training needs simulated runs of baseline topologies to fit a GNN proxy and a denoiser. Inference samples K=5 candidates per step and keeps the one with the best proxy score (utility minus 0.1 times cost in the released code). The paper reports top accuracy on most math benchmarks, with GPT-4o-mini agents. All results are author-reported, single-run, with no variance given.

Problem

Choosing the communication graph among LLM agents is a design problem with competing goals: task accuracy, token cost, robustness to failed agents and sparsity §1 eq. 1. Hand-made patterns (chain, star, fully connected) do not adapt to the task §1. Earlier learned topology methods are said to use single-step generators, which limit exploration, and to apply reward only after the whole graph exists §1. Evaluating the reward means running a full multi-agent simulation for each candidate graph, which is too slow to use inside a sampling loop §3.1 §3.3.

Method

GTD writes the team's communication graph as a binary adjacency matrix A in {0,1}^(N×N), where A_ij = 1 means agent i may send to agent j §3.1. Its goal is to find the A that maximises a composite reward R(A, C) of utility, cost, sparsity and further terms, given a task condition C §3.1 eq. 1. The paper's reward has no fixed weights; the released code uses only utility and cost (see Paper vs code).

The method has four stages.

  1. Build a seed dataset. Run a set of baseline topologies on a small set of training tasks and record utility and cost for each run §4.1 app. D. The paper uses 50 training samples §5 app. D.
  2. Train the proxy P. A graph neural network with two graph attention layers (hidden size 32) reads the graph and node states. Mean pooling gives one vector, which is concatenated with the projected task condition and passed to an MLP that outputs (utility, cost). Training minimises mean squared error §4.1 eq. 4 eq. 5.
  3. Train the denoiser G. G is a conditional graph transformer with two layers and two heads §4.2 app. D. It is trained only on high-performing graphs, those above a performance threshold that the paper does not give §4.2. Each training step corrupts a clean graph with a variance-preserving forward process over T=50 steps §4.2 eq. 6 and trains G to predict the clean graph with binary cross-entropy eq. 7.
  4. Guided sampling (inference). Start from noise. At each step t, predict the clean graph without guidance, sample K candidate graphs from that prediction, score each candidate with P, keep the one with the best weighted score w_u·utility − w_c·cost eq. 8, and use it in place of the raw prediction when computing the reverse posterior §4.3 alg. 1 app. E. The paper argues this is a zeroth-order (gradient-free) step, because the candidates are discrete and P is not differentiable with respect to G's output §4.3. Appendix G gives a theorem that bounds the performance gap by twice the proxy's maximum error; the bound is for an idealised optimiser, not for the K-sample search app. G.2 eq. 8.
Pseudocode
# Guided Topology Diffusion: sample one topology for a task  [alg. 1] [app. E]
# Input:  task condition C (embedding of the query), trained G and P
# Input:  weights w_u, w_c (values not stated in the paper)
# Output: graph A0 with entries in {0, 1}, shape (N, N)

def generate_topology(C, G, P, w_u, w_c, K, T):
    # Start from random noise on the adjacency matrix  [alg. 1]
    A_t = random_noise(N, N)                    # (N, N)
    for t in range(T, 0, -1):                   # T = 50 steps  [§5]
        # Predict the clean graph without guidance  [alg. 1]
        A0_hat = G(A_t, C, t)                   # (N, N), entries in [0, 1]
        # Draw K binary candidates from the prediction  [alg. 1]
        candidates = [bernoulli(A0_hat) for k in range(K)]
        # Score each candidate with the proxy  [alg. 1]
        scores = []
        for candidate in candidates:
            utility, cost = P(candidate, C)
            scores.append(w_u * utility - w_c * cost)
        # Keep the candidate with the best weighted score  [eq. 8]
        A0_best = candidates[argmax(scores)]
        # Take the reverse step using A0_best instead of A0_hat  [alg. 1]
        A_t = sample_posterior(A_t, A0_best, t)
    return A_t

Training pseudocode for the two learned parts, as the paper and code describe them:

Pseudocode
# Proxy training on simulated outcomes  [§4.1] [app. D]
# Input: records (A_j, C_j, (utility_j, cost_j)) from baseline runs

def train_proxy(records):
    # 10 epochs, Adam with learning rate 1e-3, batch size 16  [app. D]
    for epoch in range(10):
        for batch in minibatches(records, size=16):
            predicted = P(batch.graphs, batch.conditions)
            # Mean squared error on (utility, cost)  [eq. 5]
            loss = mean(squared_error(predicted, batch.outcomes))
            update(P, loss)
    return P
Pseudocode
# Denoiser training on high-performing graphs only  [§4.2] [eq. 6] [eq. 7]
# Input: clean graphs A0 whose utility exceeds a threshold (not stated)

def train_denoiser(clean_graphs, conditions):
    # Learning rate 1e-4 over 50 timesteps  [app. D]
    for A0, C in minibatches(clean_graphs, conditions):
        # Pick a random timestep and corrupt the clean graph  [eq. 6]
        t = random_step(0, T)
        A_t = forward_noise(A0, t)
        # Predict the clean graph; compare with cross-entropy  [eq. 7]
        A0_hat = G(A_t, C, t)
        loss = binary_cross_entropy(A0_hat, A0)
        update(G, loss)
    return G

Key equations, as written in the paper:

\mathcal{R}(A, C) = f(\text{Utility}(A,C), \text{Cost}(A,C), \text{Sparsity}(A), \ldots) eq. 1

q(A_t \mid A_0) = \mathcal{N}(A_t;\ \sqrt{\bar{\alpha}_t}\,A_0,\ (1-\bar{\alpha}_t)\,I) eq. 2 eq. 6

\mathcal{L}_\theta = \mathbb{E}\big[\,\| A_0 - \mathcal{G}_\theta(\sqrt{\bar{\alpha}_t}A_0 + \sqrt{1-\bar{\alpha}_t}\,\epsilon,\ C,\ t)\|^2\big] eq. 3

\mathcal{L}_\phi = \frac{1}{M}\sum_{j=1}^{M} \lVert \mathcal{P}_\phi(A_j, C_j) - P_j \rVert_2^2 eq. 5

\mathcal{L}_\theta = \mathbb{E}\big[\,\mathrm{BCE}\big(\mathcal{G}_\theta(\sqrt{\bar{\alpha}_t}A_0 + \sqrt{1-\bar{\alpha}_t}\,\epsilon,\ C,\ t),\ A_0\big)\big] eq. 7

A^{(t)}_{0,\text{best}} = \arg\max_{A^{(t)}_{0,k}} \big( w_u \hat{u}_k - w_c \hat{c}_k \big), \quad [\hat{u}_k, \hat{c}_k]^T = \mathcal{P}_{\phi^*}(A^{(t)}_{0,k}, C_{\text{new}}) eq. 8

The GNN update in the surrogate is written as a graph attention layer with learned attention coefficients eq. 4. Figures are described in words only: fig. 1 compares three workflows, fig. 2 shows the four-stage pipeline, fig. 3 contrasts static and adaptive graphs, fig. 4 shows robustness to a failed agent, fig. 5 plots accuracy against tokens, and fig. 6 shows the ablations. fig. 7 and fig. 8 are case studies of topologies and agent roles (appendix Q).

Hyperparameters

NameValueWhereNotes
LLM backbone for agentsGPT-4o-mini§5 app. DQwen-3-8B used for the generalisation study §6.2
Agent team, math tasks4 MathSolver agents§5 app. DGSM8K, MATH, MultiArith, SVAMP
Agent team, code4 CodeSolver agents§5 app. DHumanEval; code uses four differently named roles, see Paper vs code
Agent team, science3 KnowledgeableAcademic agents§5 app. DMMLU
Proxy architectureGNN, 2 GAT layers, hidden 32§4.1 app. DHidden size 32 applies to the GNN; the MLP size is not stated in the paper
Proxy optimiserAdam, lr 1e-3, batch 16§5 app. DMSE loss
Proxy epochs10§5 app. D
Denoiser architecturegraph transformer, 2 layers, 2 heads§4.2 app. DModel width not stated in the paper
Denoiser optimiserlr 1e-4§4.2 app. DBatch size and epochs not stated
Diffusion timesteps T50§4.2 app. DAlso used at inference
Noise schedule {β_t}not stated§3.2Released code uses a linear schedule from 1e-4 to 0.02 diffusion_model.py
Candidates per step K5§4.3 app. D app. MK=1 means no guidance; K=10 and K=20 change accuracy by less than 0.25 points tab. 12
Reward weights w_u, w_cnot statedeq. 8Released code: w_u=1.0, w_c=0.1 (cost enters with negative sign) run_gsm8k.py
Training filterutility above a threshold§4.2Threshold value not stated; code keeps utility > 0.5 run_gsm8k.py
Seed dataset size50 training samples§5 app. DReleased code runs 6 baseline topologies per sample run_gsm8k.py
Inference batch size2§5Released script sets a batch size of 2 for the dataset loop, while each query generates one graph run_gsm8k.sh
Final binarisationthreshold 0.5not in paperReleased code thresholds the output at 0.5 run_gsm8k.py
Task conditionquery embedding§4.3Paper: concatenated with graph-state embedding; code: query embedding only (384-d)
Time embedding size128not in paperrun_gsm8k.py
Condition projection size128not in paperrun_gsm8k.py
Node feature size384not in paperCode: sentence embeddings of agent role descriptions run_gsm8k.py
Sentence encoderall-MiniLM-L6-v2not in paperprofile_embedding.py
Proxy MLP width64not in paperrun_gsm8k.py
Dropout0.1not in papergraph_transformer.py

Results

Author-reported, GPT-4o-mini agents, GSM8K, MATH, MultiArith, HumanEval, MMLU and SVAMP §5 tab. 1. The paper does not report repeated runs, seeds or confidence intervals. Two Avg. entries in the paper's own table do not equal the mean of their row (see Pitfalls).

MethodGSM8KMATHMultiArithHumanEvalMMLUSVAMPAvg.
Vanilla87.4546.2996.8587.0882.1486.6781.75
CoT87.1046.4096.3188.1382.6587.3381.99
ComplexCoT86.8946.5396.7087.4983.7887.6781.84
SC (CoT×5)87.5747.9196.5888.6082.6688.0081.89
MultiPersona87.5045.4397.4988.3283.6587.0081.90
LLM-Debate89.4748.5497.3388.6883.6989.0082.79
LLM-Blender88.3546.9297.2988.8081.2287.3381.65
DyLAN89.9848.6397.1290.4280.1688.6782.50
AgentVerse89.9147.3597.5089.2981.2288.3382.27
MacNet87.9545.1896.0384.5779.8586.0079.93
AutoAgents87.6945.3296.4287.6482.1386.3480.96
GPTSwarm89.1447.8896.7989.3283.9888.6782.96
ADAS86.1243.1896.0284.1977.9386.3378.96
AgentSquare87.6248.5197.7789.0879.8588.0081.81
AFlow91.1651.2896.2290.9383.2888.3383.53
G-Designer92.0951.0097.7891.1184.5090.0084.41
MaAS92.3051.8298.8090.5683.7889.6784.49
GTD (this paper)94.1454.0798.8891.4684.5891.3385.74

Headline claims from the text: GTD is best on GSM8K, MATH, MultiArith and SVAMP §5.1. On MATH it is more than 2 points above the strongest baseline, MaAS §5.1.

Other author-reported results:

  • Accuracy against tokens fig. 5: the paper plots accuracy against token use on GSM8K, MultiArith, SVAMP and MMLU, and reports for GSM8K about 4.8e+06 tokens for GTD, against about 15% more for G-Designer, and LLM-Debate at over five times that §5.2. On MultiArith, GTD reaches nearly 99% with about 8.4e+04 tokens §5.2. On SVAMP it is the only method above 91% at about 1.4e+05 tokens §5.2.
  • Robustness fig. 4 §5.3: when one non-critical agent is made to output errors, GTD drops from 94.1% to 93.8% on GSM8K. DyLAN drops by nearly 13 points, and a complete graph by over 2 points §5.3. Extended failure table below.
  • Inference time tab. 6 app. H: 7.9 s per instance on GSM8K (4 agents, one A6000) for GTD, against 8.8 s for MaAS, 9.2 s for G-Designer, 11.7 s for LLM-Debate and 1.8 s for vanilla CoT.

Ablations:

VariantGSM8KHumanEvalSource
GTD (ours)94.1491.43tab. 2
w/o guidance88.4287.19tab. 2
w/ random guidance89.6588.32tab. 2

Generalisation to Qwen-3-8B §6.2 tab. 3:

MethodGSM8KMATHMMLUAvg.
Vanilla (CoT)87.855.059.667.5
SC (CoT × 5)89.159.261.469.9
GPT Swarm90.960.063.571.5
MaAS91.260.463.971.8
G-Designer91.560.264.672.1
GTD (ours)91.761.565.272.8

LiveCodeBench, Pass@1, Qwen-3-8B tab. 10: base model 25.4%, MaAS 29.3%, GTD 30.8%.

Failure scenarios on GSM8K, change from the no-failure accuracy tab. 9 app. K:

ScenarioGTDMaASG-Designer
Single-agent failure−0.3−1.8−2.1
Two-agent failure−2.1−5.6−6.8
Noisy agent (50% errors)−1.4−3.2−3.9

Ablation on the number of candidates K, GSM8K tab. 12 app. M: K=1 gives 88.42% at 3.2 s; K=3 gives 93.15% at 5.8 s; K=5 gives 94.14% at 7.9 s; K=10 gives 94.31% at 18.1 s; K=20 gives 94.38% at 36.8 s.

Comparison of generation strategies, GSM8K tab. 11 app. L: a direct GNN prediction gives 91.23% with one proxy evaluation; direct GNN with top-K gives 92.15% with 100; 100-step MCMC gives 92.87% with 100; GTD gives 94.14% with 250 evaluations (50 steps × K=5).

Surrogate fidelity on held-out data from the seed dataset tab. 8 app. J: utility MSE 0.0089 and cost MSE 0.0124; Pearson correlation 0.91 (utility) and 0.94 (cost); top-1 of 5 ranking accuracy 78.4% and 85.2%; top-2 of 5 93.6% and 96.1%. On topologies that GTD itself generated, top-1 ranking accuracy is 72.8% and top-2 is 89.3% app. J.

Scalability, GPU memory, diffusion plus proxy tab. 7 app. I: 2.8 GB at 5 agents, 3.4 GB at 50, 3.9 GB at 100, 4.9 GB at 1000.

Compute: four NVIDIA A6000 GPUs, 48 GB each app. C app. N.

Dataset licences, as listed in the paper tab. 4 app. F: MMLU, GSM8K, SVAMP, MATH and HumanEval are listed as MIT License, and MultiArith as "Unspecified". Dataset URLs are in tab. 5 app. F.

Paper vs code

Official code: github.com/ericjiang18/diffusion_agent, linked from the abstract. The owner is the paper's first author. Cloned at commit 22738c3739fd14189193fc8f9e412b2bfe627137. The repository has no LICENSE file, so no code is quoted; citations are for reference only. Only the GSM8K pipeline (experiments/run_gsm8k.py and run_gsm8k.sh) and the GTD modules under GDesigner/gdt/ were read in full. The other run scripts were checked for agent settings only.

Discrepancies between the paper and the released code:

  • Attention is local, not global. The paper says the graph transformer uses global attention, so each edge prediction sees all nodes §4.2. The code masks attention with the binarised noisy graph plus self-loops, so each node attends only to its neighbours in that graph graph_transformer.py diffusion_model.py. The code also applies a FiLM layer that conditions every transformer layer on the task and time embedding graph_transformer.py.
  • Training loss. The preliminaries write a squared-error loss eq. 3, and the appendix proves that form equivalent to the ELBO app. G.1. The method section trains with binary cross-entropy eq. 7, and the code does too diffusion_model.py.
  • Candidate sampling. The algorithm samples candidates from Bernoulli(sigmoid(Â0)) alg. 1. The network already ends with a sigmoid, so the code samples Bernoulli directly from the network's probabilities guided_generation.py graph_transformer.py. Applying sigmoid again, as the paper's notation reads, would give a different distribution.
  • Initial noise and state space. The paper starts from N(0, I) alg. 1. The code starts from a uniform matrix in [0, 1], symmetrised diffusion_model.py. States are kept in [0, 1] by a clamp after each noising and denoising step diffusion_model.py diffusion_model.py. The paper does not describe this clamp.
  • Reward terms. The reward in eq. 1 includes robustness and sparsity. The released guidance uses only the proxy's utility and cost guided_generation.py run_gsm8k.py. Robustness is measured but not optimised.
  • Cost. The paper defines cost as token consumption or communication overhead §3.1. The code uses the number of edges in the topology, not tokens run_gsm8k.py.
  • Task condition. The paper says the condition is the query embedding concatenated with an embedding of the current graph state §4.3. The code uses the query embedding only run_gsm8k.py.
  • Final output. At t=0 the posterior coefficients reduce to 1 and 0, so under guidance the returned matrix is the guided binary candidate itself. The 0.5 threshold then changes nothing diffusion_model.py diffusion_model.py run_gsm8k.py. This is read from the code, not run.
  • Noise schedule. The paper says {β_t} is predefined §3.2. The code uses a linear schedule from 1e-4 to 0.02 over T steps diffusion_model.py. The class default is 1000 steps, but the driver passes 50 gtd_framework.py run_gsm8k.py.
  • Proxy GNN. The paper gives the update as a single attention-weighted sum eq. 4. The code uses a GAT with four heads averaged (concat off), followed by ReLU, mean pooling, and an MLP of width 64 proxy_reward_model.py proxy_reward_model.py.
  • Proxy data. The paper says the seed data come from baseline topologies run on 50 samples §5. The code runs six baselines per sample (fully connected, chain, star and three random graphs), so up to 300 runs run_gsm8k.py.
  • Training filter. The paper says graphs are kept if they exceed a performance threshold §4.2. The code keeps graphs whose utility is above 0.5 run_gsm8k.py.
  • HumanEval agents. The paper uses four CodeSolver agents §5. The released HumanEval script names four different roles run_humaneval.sh.
  • Inference batch size. The paper says inference uses a batch size of 2 §5. In the code this is the number of queries per loop iteration, and each query generates one graph with num_graphs=1 run_gsm8k.sh run_gsm8k.py.
  • Denoiser learning rate and batch. The paper's lr of 1e-4 matches the code run_gsm8k.py. The code uses batch 16 run_gsm8k.py, which the paper does not state.
  • Proxy learning rate and batch. Adam at 1e-3 with batch 16 matches the paper run_gsm8k.py.

No code was found for the reported comparison baselines, the robustness and failure experiments, the Qwen-3-8B runs, or the LiveCodeBench runs. Those numbers are not verifiable from the repository.

Pitfalls

  • Missing reward weights. w_u and w_c are not given in the paper. The code uses 1.0 and 0.1, with cost subtracted. The guidance depends on that ratio, so an implementation that picks other values will change behaviour.
  • Missing architecture details. The paper does not give the denoiser's width, the feed-forward size, the node features, the time embedding, the threshold for the training filter, the noise schedule, or the batch size and epochs for the denoiser. Reproducing the paper alone is not possible without guessing; the code fills these in (see Hyperparameters).
  • Node features are undescribed. The paper never says what the node inputs are. The code uses 384-dimensional sentence embeddings of agent role descriptions.
  • Global versus local attention. Choosing global attention, as the paper states, gives a different model from the code's edge-masked attention. The paper's motivation (long-range dependencies) rests on global attention.
  • Two losses. The preliminaries and the method describe different losses. Implement binary cross-entropy, which is what the method and the code use.
  • Guidance is greedy and local. Each step picks the best of K candidates by proxy score. The appendix bound app. G.2 assumes an ε-accurate proxy over all topologies and a global maximiser. Neither holds for K=5 sampling, so the bound does not apply to the method as run.
  • The proxy is trained on simulated outcomes of the same agent team. It has to be refit for each domain and team, and the paper says the seed data is still a requirement §7 app. A.
  • Hidden costs. Training data needs one multi-agent run per baseline topology per sample. The paper reports about 4.0e5 tokens for GSM8K seed data and about 4.4e6 tokens per test run §5. Inference evaluates the proxy 250 times per query at K=5 with 50 steps tab. 11.
  • Single runs, no spread. No seeds, repeats or confidence intervals are reported. Many gaps over MaAS and G-Designer are 1 to 2 points, so run-to-run variance could matter. Treat the ranking as unconfirmed.
  • Text and table disagree on SVAMP. The text reports 91.30 for GTD on SVAMP §5.1, and the table reports 91.33 tab. 1.
  • Average column errors. The Avg. column for Vanilla (81.75) and CoT (81.99) does not equal the mean of their rows. The rows average to about 81.08 and 81.32 tab. 1. The GTD average (85.74) is consistent with its row. The Avg. deltas shown for the other methods are computed from the stated averages, so they inherit the Vanilla and CoT errors.
  • Ablation control. The "w/o guidance" row (88.42%) matches the K=1 entry in the candidate table (88.42%) tab. 2 tab. 12. They appear to be the same configuration, which the paper does not say.
  • Robustness is one scenario in the main text. The main figure uses a single failed agent on GSM8K. Other failure modes are in the appendix at one benchmark only tab. 9.
  • Scale claims are untested. The 1000-agent memory figure is from the memory scaling table only tab. 7. The benchmarks use 3 to 4 agents.
  • Dataset licence. The paper lists MultiArith as "Unspecified" tab. 4. Do not redistribute that dataset.

Lineage

  • Builds on: denoising diffusion §2 §3.2 (the paper cites Ho et al., 2020 and Song et al., 2021); discrete graph diffusion (DiGress, Vignac et al., 2023) §2; classifier-free guidance §3.3; graph attention networks §4.1; graph transformers §4.2.
  • Compared against: Vanilla, chain-of-thought, self-consistency, LLM-Debate, LLM-Blender, MultiPersona, ComplexCoT, DyLAN, AgentVerse, MacNet, AutoAgents, GPTSwarm, ADAS, AgentSquare, AFlow, G-Designer and MaAS tab. 1 tab. 3.
  • Superseded by: not known from wiki content.

Source and license

Adapted from “Dynamic Generation of Multi-LLM Agents Communication Topologies with Graph Diffusion Models” by Eric Hanchen Jiang, Mengting Li, Guancheng Wan, Sophia Yin, Yuchen Wu, Xiao Liang, Xinfeng Li, Yizhou Sun, Wei Wang, Kai-Wei Chang, Ying Nian Wu (arXiv:2510.07799), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/ericjiang18/diffusion_agent at commit 22738c3739fd (none (no LICENSE file in repository)). Any quoted code is shown under that license.