Datasets:

Modalities:
Text
Languages:
English
ArXiv:
Libraries:
Datasets
Harbor
License:
File size: 8,591 Bytes
e3a266f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75968d9
 
 
e3a266f
 
 
 
 
6db0e7c
48157bc
 
 
 
e3a266f
 
 
 
6db0e7c
 
e3a266f
 
 
 
 
6db0e7c
 
e3a266f
6db0e7c
 
48157bc
 
6db0e7c
48157bc
e3a266f
 
75968d9
 
 
e3a266f
 
 
 
 
 
 
24df058
 
 
 
 
8d461e0
 
 
 
e3a266f
75968d9
48157bc
75968d9
48157bc
 
75968d9
48157bc
 
75968d9
 
48157bc
0258148
 
 
 
e3a266f
 
 
 
 
48157bc
24df058
 
e3a266f
 
6db0e7c
 
 
 
24df058
6db0e7c
 
 
 
24df058
 
 
8d461e0
 
 
 
6db0e7c
 
 
 
 
 
 
 
 
 
 
 
 
e3a266f
 
75968d9
 
e3a266f
 
24df058
8d461e0
 
 
75968d9
 
e3a266f
6db0e7c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
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).
A team uses a shared message board supplied by the runner. Each participant receives its own
Harbor task.

## 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 finds its number in its instruction,
shares it 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 |
| Teams | 160: one per problem and team size N ∈ {1, 2, 4, 8, 16}, holding the problem's first N numbers, e.g. `agg-p07-n08` |
| Tasks | 992: one per slot of each team, `agg-p07-n08-s01` .. `-s08`, whose instruction states that slot's number |
| 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-sKK/    slot K of team agg-pPP-nNN (zero-padded: name order is slot order)
  instruction.md          "Your private number is ...": slot K's, and no other
  task.toml
  tests/test.sh           the grader, the same for every slot of the team
  tests/expected.json     the team's answer: copied in only after the agent is done
  solution/solve.sh       an oracle with its own copy of the answer
problems.json             the 32 problems
generate.py               writes problems.json and tasks/ from its seed (115)
check.py                  the checks that need no model
```

**Private numbers** reach each participant through its own task. To run a team, assign each
participant one of its slots in name order and give the team a fresh board shared only among
its members. Harbor copies `tests/` in after the agent has finished.

## 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. The answer counts only as a regular file of its own at exactly
`/app/answer.json`: a symlink (e.g. to `/tests/expected.json`, which arrives only after the
agent is done), a link anywhere on the path (a symlinked `/app`), a hardlink, a directory or a
FIFO scores 0, and `expected.json` is read the same way. The grader follows no link an agent may
have left, writes 0 before it checks anything (a crash also scores 0), and keeps a copy of the
answer with the trial's results. Its Python runs isolated (`python3 -I -S`), so no module in the
working directory or on `PYTHONPATH`, and no `sitecustomize`, `usercustomize` or `.pth` hook,
can change what it imports; besides `bash`, `python3` is the only command it runs. Each agent is
scored on its own answer; the team succeeds if any agent scores 1.

## Run a Harbor task

Validate the grader with the oracle for one slot:

```sh
uv run --with harbor==0.25.0 harbor run --path tasks/agg-p01-n02-s01 --agent oracle --env docker
```

For a cooperative run, the runner supplies the shared message board and aggregates the
individual Trial rewards. The team succeeds if any participant earns 1.

The maintained team recipe uses these tasks with a shared board. [Legion experiment](https://github.com/huggingface/legion/tree/main/experiments/s3-aggregation)

The prior sweep and metrics are archived with the original run setup. [Dataset revision `bc8474f`](https://huggingface.co/datasets/HuggingFaceSwarms/s3-aggregation/tree/bc8474f012ef8270fde97e93a828c929e867ff3d)

## Checks

The checks that need no model, in one command (`uv` installs Harbor 0.25.0):

```sh
uv run check.py                   # the Trials on HF Sandboxes (HF_TOKEN, twenty cpu-basic sandboxes)
uv run check.py --env docker      # the Trials in local docker
uv run check.py --env none        # without the Trials
```

1. **Generator:** `generate.py` reproduces `problems.json` and `tasks/` byte for byte; another
   seed gives other problems; 32 problems of 16 integers in 1..99; the words read back to their
   numbers; each team has one task per slot, whose answer is the problem's first N numbers
   sorted and whose instruction states that slot's number, and name order is slot order.
2. **Graders**, run as Harbor runs them (`tests/` copied in after the agent is done, through
   any link the agent left), on slot 1 of each team (every slot's `tests/` and `solution/` are
   the same, which this checks): on all 160 teams the oracle scores 1, and wrong, partial,
   padded, unsorted and duplicate-dropping answers score 0. On one team per size, twelve kinds
   of malformed answer score 0, and so do sixteen cheats: the answer as a symlink to the tests'
   `expected.json` (dangling until the tests arrive; absolute or relative), a symlink or a
   hardlink to a right answer elsewhere, a hardlink to `expected.json`, a symlinked `/app` (to a
   right answer, or into the tests' folder), an `expected.json` planted as a link to the answer,
   a directory and a FIFO (which must not hang the grader); and a wrong answer with Python made
   to read any answer as right: a `json.py` in the grader's working directory or on
   `PYTHONPATH`, a `sitecustomize` on `PYTHONPATH`, a `usercustomize` or a `.pth` file in the user
   site, and a `dirname` shadowed on the `PATH` that points `expected.json` at the agent's file.
3. **No-cheat, in the files:** a task folder holds only its five files; its instruction states
   its own slot's number on one line and is otherwise the same for every task of its team size,
   so it holds no teammate's number; the answer is only in `tests/` and `solution/`; and no
   folder beside `tasks/` holds numbers.
4. **No-cheat, from inside Trials** of team `agg-p01-n16`, with probe agents (no model): sixteen
   probes, one in each slot's task, look around the container while "the agent works": every
   file, every process's environment and command line, and the instruction. Each finds its own
   number only in its instruction, and no teammate's number, no `tests/` or `solution/` and no
   file holding the answer anywhere; then it writes the answer, the same search finds it (a
   control), and the task's verifier scores it 1. Four more leave a cheat with a wrong answer,
   and the verifier scores each 0: `/app/answer.json` as a symlink to `/tests/expected.json`;
   `/app` as a symlink into a `/tests` they made; a `json.py` that reads any answer as right
   wherever the verifier may start; a `sitecustomize` in site-packages that does the same.
## Known limits

- Each multi-agent task is one participant's view. Its teammates' numbers are available
  through the runner's message board.
- **The grader can't see the board:** an agent could guess or copy a wrong number and still be
  scored only on its file. The board export in the run directory shows what was said.
- **The verifier runs in the agent's container**, as in every Harbor task. The grader closes the
  file and import holes above, but an agent that replaced the container's `python3`, `bash` or
  Python's standard library, or left a process running to rewrite the reward, could still forge
  one: check the run's board export and the agents' transcripts when a result looks too good.
- Give each team a fresh board so it only sees posts from its own run.

- **Not the paper's setup:** a message board instead of `message`/`read_messages` tools with
  notifications, an answer file instead of a `####` line, no example message, no token cost in
  the reward, and N = 1 is a solo control rather than a team.