AgenticFine-TuningFrameworks

Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems

by Hugging Face (Ben Burtenshaw, Kashif Rasul)

AdvancedTutorialFree~15 min read; reproducing the run takes about 5 hours on two H200s via Hugging Face Jobs (roughly $50)

Train four small agents to cooperate with GRPO in TRL, then check whether communication beat simply spending more tokens.

Start LearningAdded Nov 28, 2026 · Updated Nov 28, 2026

Overview

Swarms, Flocks, Gangs is a Hugging Face blog tutorial by Ben Burtenshaw and Kashif Rasul, published November 26, 2026 as Part 1 (Understanding swarms and training to communicate) of a series. It starts by questioning recent large-swarm results: did cooperation help, or did the agents just spend more tokens? The authors set up a fair test that compares communicating and independent agents at matched token budgets and treats agent count as a scaling axis. A section on multi-agent RL frames the problem as a decentralized POMDP and covers credit assignment, centralized training with decentralized execution, and the hierarchy versus distributed-team patterns. The worked experiment replicates the information-aggregation task from the s3 paper (Simple Scaling of Swarms via Cooperative Multi-agent RL): four Qwen3-0.6B agents sharing one policy each hold a private number and must message each other to return the sorted list. Messaging uses three tools, message, read_messages and check_notifications. The reward is team success discounted by token use, with eight attempts per problem normalized into group advantages. Training success rose from 6.6% to 82.3% over 75 steps while token use per attempt fell about 37%. A trained team's single attempt (82.3%, about 8k tokens) beat an untrained team's best-of-8 (37.5%, about 103k tokens). The practical section runs the TRL example async_grpo_s3_aggregation on Hugging Face Jobs with vLLM 0.32.0 rollouts and Trackio metrics.

At a Glance

Topic
Agentic
Level
Advanced
Format
Tutorial
Cost
Free
Duration
~15 min read; reproducing the run takes about 5 hours on two H200s via Hugging Face Jobs (roughly $50)
Provider
Hugging Face (Ben Burtenshaw, Kashif Rasul)
Hands-on
Yes — code/exercises
Certificate
None

What You’ll Learn

  • ✓Test whether agent cooperation helps by comparing teams against independent agents at matched token budgets
  • ✓Frame a multi-agent problem as a decentralized POMDP and reason about credit assignment
  • ✓Choose between hierarchical lead-worker and distributed peer-messaging organization for an agent team
  • ✓Give agents message, read_messages and check_notifications tools so they can coordinate on a task
  • ✓Design a shared team reward that discounts success by token use and normalizes group advantages
  • ✓Train a shared Qwen3-0.6B policy with TRL's async GRPO trainer and vLLM rollouts on Hugging Face Jobs
  • ✓Track and compare pre- and post-training runs with Trackio and Hugging Face buckets

Highlights

  • •Reports a matched-budget comparison: one trained-team attempt at 82.3% with about 8k tokens versus untrained best-of-8 at 37.5% with about 103k
  • •Fully reproducible: a shell script runs the official TRL example on two H200s in about five hours for roughly $50
  • •Built on the official async_grpo_s3_aggregation example in huggingface/trl (about 19.8k GitHub stars) with a published checkpoint
  • •Uses a 0.6B model, so the multi-agent RL loop is cheap enough to modify and rerun
  • •First post of a series; later parts are announced to cover evaluating and analyzing swarms

Who It’s For

Best For

  • ✓ML engineers experimenting with multi-agent RL and GRPO-trained agent teams
  • ✓Agent builders deciding whether a multi-agent design is worth its extra token cost
  • ✓Researchers who want a small, reproducible baseline for agent communication experiments

Prerequisites

  • •Familiarity with GRPO or other policy-gradient RL fine-tuning of language models
  • •Experience with Hugging Face TRL, vLLM and the hf command-line tool
  • •A Hugging Face account with Jobs access and budget for H200 compute to reproduce the run

FAQ

What is Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems?

This Hugging Face tutorial, published November 26, 2026, is part 1 of a series on building, training and evaluating multi-agent systems. It is for engineers who already run GRPO or RL fine-tuning and want to train agents that message each other. Afterwards you can train a small communicating swarm in TRL on Hugging Face Jobs and measure it fairly.

Is Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems free?

Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems is free to access.

What level is Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems for?

Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems is aimed at a advanced audience. Recommended background: Familiarity with GRPO or other policy-gradient RL fine-tuning of language models, Experience with Hugging Face TRL, vLLM and the hf command-line tool, A Hugging Face account with Jobs access and budget for H200 compute to reproduce the run.

How long does Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems take?

Expect roughly ~15 min read; reproducing the run takes about 5 hours on two H200s via Hugging Face Jobs (roughly $50). Most learners work through it at their own pace.

What will I learn from Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems?

You'll learn: Test whether agent cooperation helps by comparing teams against independent agents at matched token budgets; Frame a multi-agent problem as a decentralized POMDP and reason about credit assignment; Choose between hierarchical lead-worker and distributed peer-messaging organization for an agent team; Give agents message, read_messages and check_notifications tools so they can coordinate on a task; Design a shared team reward that discounts success by token use and normalizes group advantages; Train a shared Qwen3-0.6B policy with TRL's async GRPO trainer and vLLM rollouts on Hugging Face Jobs; Track and compare pre- and post-training runs with Trackio and Hugging Face buckets.

Topics

multi-agent-systemsgrpotrlreinforcement-learninghugging-face

Sources

This page was written from 3 sources, 2 on domains other than huggingface.co.

  1. 1.huggingface.co — training swarmsvendor
  2. 2.github.com — async grpo s3 aggregation
  3. 3.github.com — training swarms.md