# s3-aggregation scaling sweep What the s³ paper's Figure 5 (information aggregation: success against swarm size) looks like with Legion: every problem of this dataset at N = 1, 2, 4, 8 and 16 agents, each team its own Legion run on the HF cluster. The results so far (`Qwen/Qwen3.5-27B` and `Qwen/Qwen3.5-2B`) are in huggingface/legion#120's comments and on Legion's `s3-aggregation-results` branch, and the raw runs in the private `HuggingFaceSwarms/s3-aggregation-results`. | File | | | --- | --- | | `serve-vllm.sbatch` | the model server: vLLM with `$MODEL` (default `Qwen/Qwen3.5-27B`) on one B200 GPU (Legion's docs/open-models.md), thinking off for every request (the Qwen3.5 templates' defaults differ: the 27B's thinks, the 2B's doesn't) | | `sweep.py` | runs the grid, one command, resumable: a row per team in `/rows.jsonl` | | `plot.py` | `scaling.png` (Figure 5's style), `teams.csv`, `by_n.csv` and `by_n.md` from the rows, one series per model | | `setaside.py` | why each attempt in `rows-discarded.jsonl` didn't count, and how many teams needed a rerun | | `failures.py` | per agent: the answer the verifier saw (no answer, malformed, wrong count, wrong numbers, right) and, from the state bucket's event streams, its tool calls, failed calls and posts | | `waits.py` | how long each kept team's worker queued | | `registries.conf` | the workers' podman pulls Docker Hub images through `mirror.gcr.io` | ## Run it From Legion's checkout at or after `0401df9` (with its Slurm results, huggingface/legion#122, so each Trial's grading reaches the run directory, and huggingface/legion#129, so the teams' agents spread over the servers), with this dataset downloaded on the shared disk at the revision the teams pin (`DS` below), since the workers read `registries.conf` from it. Two model servers, one GPU each: one B200 is saturated by about 50 agents at a time (the 27B grid needs about 70M prompt and 2M generated tokens), and a job's time limit is 3 hours. ```sh hf download HuggingFaceSwarms/s3-aggregation --repo-type dataset --revision --local-dir $DS sbatch -p hopper-b200 -o .legion/s3-sweep/vllm-%j.log $DS/legion/sweep/serve-vllm.sbatch sbatch -p hopper-b200 --export=ALL,PORT=8001 -o .legion/s3-sweep/vllm-%j.log $DS/legion/sweep/serve-vllm.sbatch # each log ends with: serving Qwen/Qwen3.5-27B at http://:/v1 uv run python $DS/legion/sweep/sweep.py --urls http://:8000/v1,http://:8001/v1 \ --revision --parallel 12 --bucket /s3-aggregation-grid \ --dataset HuggingFaceSwarms/s3-aggregation-results --prefix grid scancel -n s3-sweep-vllm ``` The 2B grid is the same with `--export=ALL,MODEL=Qwen/Qwen3.5-2B` for the server, and `--model Qwen/Qwen3.5-2B --tag q2b-` and its own bucket and `--prefix` for the driver. Its agents run far longer, so more teams are in flight at once: `--max-worker-cpus 8` keeps their workers small enough to be scheduled, except at N = 16, whose 2B teams need 16 CPUs (30 GB) and run from a second driver (`--agents 16`) on the same root. Then plot both: `plot.py --series Qwen3.5-27B= --series Qwen3.5-2B= --out `. Each team is team.py's cluster spec (`--where cluster`) with the model on all the servers' URLs (each agent calls one: Legion at or after `0401df9`, huggingface/legion#129, picks it from the run and the agent's name, so concurrent teams' agents spread over the servers; with an older Legion every team's `agent-001` lands on the same server): `compute: slurm`, one worker on hopper-cpu running the team in rootless podman with a local board, sized to the team (a CPU per agent, at least 4). The board rules, loop and limits are the template's at every N. sweep.py inits and launches a team, waits until its loop is done and its agents are idle, releases it (`legion stop --release`: each Trial is graded as the worker drains, and the results land in the run directory), and appends metrics.py's row with the wall time. The run state goes to a private bucket (a new one per grid: a swarm's name is used once in a bucket), the run directories (spec, results, logs; never `run.env`) to the private dataset, and plot.py runs at the end. **A run counts only when it is complete**: one worker incarnation (until legion#121 is fixed, a relaunched or preempted worker overwrites results), its controller kept, every agent's reward and the board export, and its worker started within 2 min of the launch (the loop's 15 minutes and the driver's 40 count from the launch, also for a team a restarted driver adopts). hopper-cpu is spot capacity, so reclaims take workers and controllers mid-run, and a missing reward means the verifier never ran. A run that doesn't count goes to `rows-discarded.jsonl` and the team runs again as `-rK` (up to 5 times); its row records the reruns. **Resuming.** The same command resumes: a team with a row is skipped, a team a stopped driver launched is adopted (waited for, released and scored, or scored from what it left when its controller is gone), and one that never launched runs again. Stopping the driver to add a server is safe: in-flight teams keep running and are adopted. ## How it differs from the paper's Figure 5 | | s³ (Figure 5, top row) | here | | --- | --- | --- | | Agents | Qwen3-0.6B trained with RL at N = 4, and its controls | `Qwen/Qwen3.5-27B` and `Qwen/Qwen3.5-2B`, not trained: one prompted condition each | | Harness | their asynchronous harness: `message(to, text)` and `read_messages()`, notifications that interrupt generation, idle until a message arrives | Pi in a container per agent, with legion's board tools (`legion-tool message_board.*`) through its shell; a shared `#general` channel, mentions and a long-poll `wait`; legion's loop prompts again at each turn's end | | Messages | to one teammate or broadcast | posts on `#general`, the only channel (`max_channels: 1`), which every agent reads | | Private number | in the agent's prompt | in its own task's instruction (one task per slot) | | Names | sampled from `agent_1`..`agent_64`, teammates in shuffled order | `agent-001`..`agent-00N`, in order | | Budget | 8,192 work tokens + 1,024 for the answer per agent; reward reduced by tokens used | no token allowance: 60 model calls per prompt, 4 loop rounds, 15 min, 10 min per turn, 262,144-token window | | Answer | `####` and a JSON array, from any agent active at the end | `/app/answer.json` per agent, graded after the run; the team succeeds if any agent's is right | | Instruction | Appendix G's, with an example message and the token-cost rule | adapted from Appendix G for the board, with no example message and no token cost | | Problems | 32 held-out problems x 6 seeds; N = 1, 2, 4, 6, 8, 12, 16 | 32 problems (our seed, the same recipe: 16 numbers in 1..99, the first N) x 1 attempt; N = 1, 2, 4, 8, 16 | | Intervals | mean ± SE across six seeds | 95% Wilson intervals across problems | | Right panel | token efficiency (needs the allowance) | four cost panels: input and generated tokens per team (as the paper's Figure 10), wall time per team and board posts per agent |