diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3c5e071c2f2b7ec2b667b6ff640c1cb98d453c52 --- /dev/null +++ b/README.md @@ -0,0 +1,135 @@ +--- +pretty_name: s3-aggregation +license: apache-2.0 +language: +- en +tags: +- harbor +- agent-environment +- multi-agent +- message-board +size_categories: +- n<1K +--- + +# s3-aggregation + +A [Harbor](https://harborframework.com) environment that measures whether a swarm of agents +**communicates**: each agent holds one private number, and no agent can solve the task alone. It +adapts the information-aggregation task of +[s³: Simple Scaling of Swarms via Cooperative Multi-agent RL](https://arxiv.org/abs/2611.08615) +([scalingswarms.com](https://scalingswarms.com)) to [Flock](https://github.com/huggingface/flock) +swarms, whose agents talk over a shared message board. It isn't a replication of the paper: the +agents are Pi with Flock's board, and the board is what we measure. + +**This dataset is private for now.** + +## The task + +Each of the N agents holds one private integer from 1 to 99, written in English words +("seventy-three"). The team must list all N numbers in ascending order, keeping equal numbers +from different agents as separate entries. Each agent shares its number on the board, reads the +others', keeps one number per participant, writes `/app/answer.json` (a JSON array of N +integers in ascending order) and stops. The team succeeds if any agent's answer is right. The +instruction adapts the paper's (Appendix G) to the board and prescribes no protocol beyond that. + +| | | +| --- | --- | +| Problems | 32 (the paper's held-out set size), each 16 integers drawn uniformly from 1 to 99, repeats allowed, from a fixed seed | +| Tasks | 160: one per problem and team size N ∈ {1, 2, 4, 8, 16}, whose team holds the problem's first N numbers, e.g. `agg-p07-n08` | +| Image | `python:3.12-slim`, prebuilt and public (no Dockerfile): HF Sandboxes, docker and podman | +| Agent / verifier timeout | 1800 s / 60 s | +| Resources | 1 CPU, 1 GB memory per agent | + +```text +tasks/agg-pPP-nNN/ + instruction.md the same for every problem of a team size: no number in it + task.toml + tests/test.sh the grader + tests/expected.json the answer: copied in only after the agent is done + solution/solve.sh an oracle with its own copy of the answer +roles/agg-pPP-nNN/ + slot-01.md ... "Your private number: seventy-three", one per agent +problems.json the 32 problems +generate.py writes problems.json, tasks/ and roles/ from its seed (115) +check.py the checks that need no model +``` + +**Private numbers** reach each agent only through its own instructions: Flock's +`agents.role_files` gives agent `agent-00k` the text of `slot-0k.md` and nothing else. The role +files live outside the task folders, and a task folder puts nothing in the container while the +agent works (no `environment/`; `tests/` arrives after the agent is done), so no agent's +container holds another agent's number. + +## Reward + +`tests/test.sh` writes reward **1** to `/logs/verifier/reward.txt` when `/app/answer.json` is +exactly `tests/expected.json`: a JSON array of the team's integers in ascending order, one per +agent. Anything else scores **0**: a missing or unreadable file, invalid JSON, `NaN`, a +non-array, strings, words, floats or booleans, a missing, extra or dropped duplicate number, and +a wrong order. It writes 0 before it checks anything, so a crash also scores 0, and keeps a copy +of the answer with the trial's results. Each agent is scored on its own answer; the team +succeeds if any agent scores 1. + +## Run it with Flock + +Flock's [`experiments/s3-aggregation`](https://github.com/huggingface/flock/tree/main/experiments/s3-aggregation) +writes the spec for one team (the task, its N agents and their role files, the board) and +`experiments/s3/metrics.py` turns a run into one row per team: success, each agent's reward, +tokens and board posts, and the message graph's centralization and reciprocity (the paper's +Appendix M). On HF Sandboxes, with the board on a Space: + +```sh +uv run experiments/s3-aggregation/team.py --problem 7 --agents 4 # out/agg-p07-n04/ +uv run flock launch experiments/s3-aggregation/out/agg-p07-n04/spec.yaml +uv run experiments/s3/metrics.py .flock/agg-p07-n04-