Preprint · Multi-Agent LLM Systems · Sole-authored
Small-World Topology for Multi-Agent LLM Coordination
Multi-agent LLM systems spend most of their tokens re-sharing context with each other. SW-KG replaces that with a consolidated, FAISS-indexed knowledge graph on a small-world topology - agents read only the subgraph they need. Measured on the Claude API: 91.8% fewer inter-agent tokens (a 12.19× reduction).
Sole-authored preprint · Figshare · DOI 10.6084/m9.figshare.32519487
When several LLM agents collaborate on one task, the default is to keep re-sharing the growing conversation. Cost scales with roughly O(A·T²) - every agent, every turn, re-reading everyone's history. Past a few dozen turns, coordination overhead dominates the actual work.
SW-KG attacks this structurally rather than with prompt tricks. Agents communicate over a small-world topology and share knowledge through a single consolidated, FAISS-indexed graph. Instead of re-broadcasting full history, each agent retrieves only the task-relevant subgraph, reasons, and writes its result back through one queue - so the shared memory stays consistent as it grows. A token economy meters what each stored fact is worth, and frequently-read nodes are promoted to hubs.
Two pipelines over a shared small-world knowledge graph: retrieval (read the subgraph you need) and write-back (fold results in without conflicts).
Retrieval seeds from hub nodes via FAISS approximate-nearest-neighbour lookup, expands with a bounded BFS scored by token value, type match, and recency, then trims to a token budget - so an agent reads a small, relevant slice instead of the whole history. O(A·T·log²N) is the design target; measured scaling on the validation run was near-linear in task length.
Results are embedded, de-duplicated against existing nodes, checked for contradictions (contested edges are flagged, not silently overwritten), and linked into the primary graph through a single queue - so concurrent writes never conflict. Facts are promoted to the permanent store only after they've been referenced enough times.
Built in Python on the Anthropic API, with a Watts–Strogatz small-world graph (NetworkX), FAISS retrieval, and a token ledger that meters every prompt and completion. Complexity target: O(A·T²) flat history → O(A·T·log²N) with SW-KG (measured scaling was near-linear).
A 10-agent, 100-turn task run on the real Claude API; token counts taken from the run and estimated within ~5%.
Against a full-history baseline, SW-KG cut cumulative inter-agent tokens from 15.0M to 1.23M - a 91.8% reduction (12.19× fewer tokens). The two curves cross at turn 10: before that, maintaining the graph costs more than it saves; after it, the gap widens every turn.


Each component removed in isolation, same task, tokens measured. The result includes one that didn't help - reported, not hidden.

As agent count and task length grow, re-sharing context dominates cost. SW-KG is a concrete pattern for cutting that overhead - the exact problem production multi-agent systems hit.
A consolidated, retrieval-indexed graph with conflict-safe write-back is a reusable design for agent memory - not tied to this one task.
Every number is from a real API run, each component is isolated, and the results that didn't work are reported. That's the evaluation discipline production ML needs.