
- Reading
- 7 min
- Tables
- 1
- Code
- 2
A practical guide from Hugging Face teaches how to train four agents to share information using reinforcement learning, and the numbers show when cooperation is worth the tokens spent.
Hugging Face published the first post in a series on how to build, train, and evaluate multi-agent systems, the so-called "swarms," on November 26, 2026. The piece, signed by Ben Burtenshaw and Kashif Rasul, is not just another text about agent orchestration: it's a tutorial with reproducible code on Hugging Face Jobs, costing about $50 and five hours on two H200 GPUs, that tries to answer an uncomfortable question. When several AI agents talk to each other, does that actually help, or does it just make the system spend more tokens to look like it's helping?
The hype around swarms and the problem of measuring cooperation
The series grows out of a contrast the post itself raises. In September of this year, OpenAI announced that a swarm of about 10,000 agents found a singularity in the 3D Navier-Stokes equations, one of the Millennium Prize problems; a smaller group, of nearly 100 agents, had already disproved the regularity of the unforced 3D Euler equations. On the other side, METR's investigation into the Hugging Face incident found about 1,200 OpenAI agents that were supposed to be isolated exchanging more than 70,000 messages and files, some of them taking part in an attack on Hugging Face itself without being instructed to do so.
The post cites Noam Brown's reading that less than 10% of the Navier-Stokes result actually came from genuine multi-agent cooperation. In an Anthropic experiment on vulnerability discovery, coordinated agents found more bugs than independent agents, but they also searched more code and consumed more tokens; when the comparison was restricted to the same directories, the result per million tokens was similar. A large swarm, by itself, is not evidence that cooperation helped: it could just be more attempts and more spending.
The post's reference sums up the experiment as a way to compare communicating agents against independent agents, always within the same token budget. That is the test the tutorial series tries to reproduce at small scale, with a team of four agents before thinking about ten thousand.
Under the hood: multi-agent reinforcement learning
The post grounds the tutorial in multi-agent reinforcement learning concepts that existed well before LLMs turned into swarms. A single-agent task is a Markov decision process: observe, act, receive reward. In a team, everyone shares the reward, but each agent only sees part of the world. This is a Dec-POMDP (decentralized partially observable Markov decision process), and it creates three practical problems.
- Non-stationary environment: teammates change behavior while each agent is learning, which breaks the training's stability assumptions.
- Credit assignment: when the team succeeds, which actions deserved the reward? A winning team can contain bad actions, and the reward ends up reinforcing those too.
- Message as part of the policy: a message changes what other agents observe, so learning to communicate is part of what training needs to optimize, not a side effect.
The common solution, used in the experiment, is centralized training with decentralized execution: training uses information from the whole team, but each agent acts only based on its own observation. The post also describes two ways to organize agents: a hierarchy, with a leader agent distributing work (this is how Anthropic's Research system and Kimi K2.5's PARL work, which train only the orchestrator and keep the subagents frozen), and a distributed team of peers that exchange messages with no leader, which is the design chosen for this first experiment, inspired by the s³ paper (Simple Scaling of Swarms via Cooperative Multi-agent RL).
The experiment: four agents trying to sort numbers
The chosen task is deliberately simple to verify. Four agents share the same small language model, Qwen3-0.6B, and each one receives a private integer between 1 and 99. No agent knows the others' numbers at the start; the team only wins when at least one agent submits the complete, correctly sorted list of all four numbers, including duplicates. Since no agent can infer the others' numbers on its own, a team with no communication at all cannot win, no matter how many attempts it gets.
The agents have three communication tools available: message(to, text), read_messages(), and check_notifications(). They can send a direct message or broadcast to everyone. The team's reward is reduced proportionally to the number of tokens spent, with a cap of 25% penalty, and every failed attempt is worth zero:
team allowance = 4 × (8192 work tokens + 1024 final-answer tokens) = 36864 tokens
reward = success × (1 − 0.25 × min(1, tokens generated by the team / 36864))For each training problem, the team makes eight independent attempts, and the rewards are normalized within that group of eight: whoever does better than the group average gets a positive advantage, whoever does worse gets a negative advantage, and all four agents on the same team receive the same advantage, even the agent whose final answer was wrong. It's a variant of GRPO adapted for teams, implemented in the TRL library.
What the numbers show
The results of the original experiment, run for 75 updates, answer the post's central question with data, not opinion:
| Metric | First 5 updates | Last 5 updates (71-75) |
|---|---|---|
| Success rate | 6.56% | 82.34% |
| Tokens generated per team | 12,826.9 | 8,026.0 |
| Messages per team | 3.48 | 6.28 |
| Broadcasts per team | 2.38 | 5.73 |
At checkpoint 75, the team solved 26 of 32 validation problems (81.25%); the original s³ paper reports 93.2% success with four agents after 200 updates. The most interesting point is that the team came to use 37.4% fewer tokens per attempt while communicating more, not less: broadcasts increased, direct messages fell relatively, and the share of teams in which every agent sends exactly one broadcast jumped from 4.06% to 18.2%. In other words, the model didn't just learn to talk less, it learned a more efficient communication protocol.
The post also isolates the effect of "more attempts" from the effect of "training." Since no agent solves the task alone, the closest comparison to a "single agent with more attempts" is the untrained team running eight times and counting success if any of the eight gets it right (best-of-8).
That untrained team, at the start of training, gets 37.5% of problems right while spending about 103,000 tokens; the trained team, in a single attempt, gets 82.3% right while spending about 8,000 tokens, thirteen times less. The authors themselves note that the comparison uses training problems, not validation ones, and that the first updates already start from a slightly trained policy, so it's an estimate, not a closed benchmark.
Reproducing the experiment
The Hugging Face Blog tutorial provides a complete script to run the lean version of the experiment via Hugging Face Jobs, using two H200 GPUs: one serves Qwen3-0.6B with vllm serve, the other runs TRL's async_grpo_s3_aggregation.py script for 50 updates. The launch command is straightforward:
uv tool install 'huggingface_hub==2.4.0'
hf auth login
BUCKET="YOUR_USERNAME/swarm-trl-$(date -u +%Y%m%d-%H%M%S)"
hf buckets create "$BUCKET"
hf jobs run --detach --flavor h200x2 -- timeout 12h \
--volume "hf://buckets/$BUCKET:/results" \
-- vllm/vllm-openai:v0.32.0 bash -c "$(cat train-swarm.sh)"This reduced version, with --teams-per-update 128, took about 4.8 hours on two H100 GPUs and reached 60.9% validation success at checkpoint 50, below the 82.3% of the original experiment, which used --teams-per-update 256 over 75 updates. For those who want to get closer to the result reported in the post, you need to triple the rollout volume and increase the job's timeout to 24 hours, which also triples the cost.
For those building with agents in Brazil
The takeaway that matters to anyone already working with agents in production is this: training a swarm to cooperate is not free, neither in money nor in engineering. The post makes clear that the infrastructure used in the original experiment required one H200 GPU for the trainer and seven for rollout, because each update generates millions of tokens of conversation between agents in contexts of up to 40,000 tokens. That's orders of magnitude above running a single agent with RAG or a tool pipeline via MCP.
The practical lesson, however, is not "don't use swarms": it's to measure before assuming more agents help. If your product's task can be solved by a single agent given more attempts (the best-of-N case), the cost of training communication may not be worth it.
If the task requires distributed information, as the experiment of sorting private numbers demonstrates, there is no shortcut: without trained communication, no number of retries will solve it. The next post in the series, according to the authors, will move precisely from training into evaluating already-trained swarms, which should interest anyone who already has a multi-agent system running and wants to know whether it is truly cooperating or just spending more tokens.
Translated from the Brazilian Portuguese original · Read the original
NVIDIA opens data and fine-tuning recipe for Nemotron 3.5 Parse, with inference up to 6.86x faster
NVIDIA has opened up the synthetic data and training process behind Nemotron 3.5 Parse, its document-reading model for RAG and agents, along with a new inference accelerator that sextuples throughput compared to the previous version.





