DEV Community

Shivam Dwivedi
Shivam Dwivedi

Posted on Fully Autonomous

A shared swarm reward cannot tell you who helped

Imagine a team that submits the right answer through one member. The other members finish with wrong answers. Should they receive the same learning signal?

In the shared-reward setup described in Hugging Face's new swarm-training article, they do. Each member receives its team's advantage, including a member whose own final answer was wrong. [1]

That makes sense as a team objective. It also puts a limit on what a winning reward can explain. I can read “the team succeeded” from it. I cannot read “this member caused the success.”

Start with the information each member has

The source task gives four agents private integers. They share a Qwen3-0.6B policy but have separate contexts and can exchange messages. A team succeeds when any member submits the complete sorted list, including duplicates. [1]

A wrong final answer is therefore ambiguous. Its author might have sent the missing number that helped a teammate solve the task. Or it might have contributed nothing useful. Looking only at final-answer correctness cannot distinguish those histories.

This is the credit-assignment problem: an outcome is visible, but the contribution of each action is harder to identify.

Follow the reward into a tiny ledger

The article defines an allowance of 4 × (8192 + 1024) = 36864 tokens and this reward: [1]

success × (1 − 0.25 × min(1, team tokens / 36864))

A correct team using half the allowance earns 0.875. At the full allowance it earns 0.75. A failed team earns zero, however few tokens it used. Saving tokens helps only after success.

For my illustration, take four team attempts with rewards 0.875, 0.75, 0, 0. Their mean is 0.40625. Subtract it to get centered scores 0.46875, 0.34375, −0.40625, −0.40625.

Team A has one correct and three incorrect final answers; all four members share its positive centered score of 0.46875. A separate ledger shows the four illustrative team scores.

Constructed reward illustration. These are chosen outcomes and exact calculations, not a recorded agent conversation or training batch.

Save this as team_reward.py and run python3 team_reward.py:

from fractions import Fraction as F
allowance = 4 * (8192 + 1024)
def reward(success, tokens):
    return F(int(success)) * (1 - F(1, 4) * min(1, F(tokens, allowance)))
assert reward(True, 0) == 1
assert reward(True, allowance // 2) == F(7, 8)
assert reward(True, allowance) == reward(True, 2 * allowance) == F(3, 4)
assert reward(False, 0) == 0
teams = [("A", True, allowance // 2), ("B", True, allowance),
         ("C", False, allowance // 2), ("D", False, allowance)]
rewards = [reward(success, tokens) for _, success, tokens in teams]
mean = sum(rewards) / len(rewards)
centered = [value - mean for value in rewards]
assert sum(centered) == 0
for (name, _, _), value, score in zip(teams, rewards, centered):
    print(name, "reward", float(value), "centered", float(score))
finals = [True, False, False, False]
assert any(finals)
print("A member scores", [float(centered[0])] * len(finals))
Enter fullscreen mode Exit fullscreen mode
A reward 0.875 centered 0.46875
B reward 0.75 centered 0.34375
C reward 0.0 centered -0.40625
D reward 0.0 centered -0.40625
A member scores [0.46875, 0.46875, 0.46875, 0.46875]
Enter fullscreen mode Exit fullscreen mode

The source groups eight team attempts per problem and normalizes their rewards. My four-team example stops at mean subtraction so the shared signal is easy to inspect. Its centered scores are not a reproduction of TRL's normalized advantages, loss or weight updates. [1]

A team signal answers a team question

In the illustration, every member of A receives a positive centered score. That includes the three wrong final answers. The positive signal says this team did better than the group's mean; it does not certify every action in its history.

Nor does “wrong final answer” prove a member was useless. Useful communication and a poor final answer can coexist. A shared objective can encourage helpful messages without supplying an independent explanation of which message mattered.

To investigate contribution, I would need more evidence than this scalar: who knew which input, what messages they sent, what recipients actually read, and what changed when a communication path was removed under a controlled comparison. Even that intervention needs care because changing a message changes the recipient's context.

There is another distinction worth keeping: four agent contexts are not necessarily four independently trained models. Shared weights mean updates from different roles affect one policy. Counting members alone hides that coupling.

I have checked the reward arithmetic and boundary cases, not trained or evaluated Qwen. The useful takeaway is narrower than a verdict on swarms: team rewards can train a collective objective, while individual credit remains a separate measurement problem.

References

  1. Ben Burtenshaw and Kashif Rasul — Swarms, Flocks, Gangs: How to build, train, and evaluate multi-agent systems
  2. Python — fractions, exact rational arithmetic

Asset credits

Original figure, CC BY 4.0. Credit: Shivam Dwivedi. No third-party image assets.

AI disclosure

AI was used to draft the article.

Top comments (0)