File size: 9,140 Bytes
92fcbf3 5873600 92fcbf3 5873600 92fcbf3 5873600 92fcbf3 e3c5196 5873600 92fcbf3 5873600 92fcbf3 32084d2 92fcbf3 5873600 32084d2 e3c5196 5873600 e3c5196 32084d2 e3c5196 5873600 92fcbf3 5873600 b710f09 e3c5196 b710f09 32084d2 5538a28 b710f09 7713eb0 e3c5196 7713eb0 b710f09 5873600 e3c5196 92fcbf3 32084d2 1f9e7de 92fcbf3 0082d1f e3c5196 0082d1f 1f9e7de 32084d2 1f9e7de 32084d2 1f9e7de 5873600 92fcbf3 e3c5196 92fcbf3 32084d2 92fcbf3 5873600 b710f09 e3c5196 b710f09 e3c5196 b710f09 e3c5196 b710f09 92fcbf3 | 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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | # collab-intel-harbor: adapter reference
This package holds the host commands and the task-side services of the Collaborative Intelligence Harbor
tasks. Install and run it with the quickstart in the dataset README; this page is the reference.
## Commands
- `collab-intel-harbor-run --config RECIPE` runs the single task named by the recipe's `selector`.
- `collab-intel-harbor-sweep --config RECIPE --dataset-root DIR --output OUT` runs the benchmark schedule:
all catalog groups by default, or the manifests given with `--manifest`. `--plan-only` validates the recipe
and schedule without model calls; it does not test credentials, providers or the container engine.
The default schedule has 320 logical rows and at most 316 physical runs.
- `collab-intel-harbor-score` re-scores saved runs (below).
## Sweep behaviour
- Each scenario runs solo first; a failed solo skips that scenario's three test seeds. Optional baseline
controls run only with `--include-controls`.
- Reusing the same `--output` resumes: completed runs, including ordinary failures, are never rerun.
- Runs that fail for an infrastructure reason are held, not scored. `--retry-held N` retries each held run
at most N times, only when its saved errors show an infrastructure cause; the earlier attempt is kept as
`cases/<case>.held-K`. Runs stopped by Legion's one-hour limit and provider refusals are never retried.
- Changing the source, recipe, model route or manifest makes the sweep refuse to resume. An incomplete
sweep exits non-zero.
- `scores.json` uses Stanford's own aggregation; Taking-over test runs are graded by Stanford's released
Opus grader with its original rule.
## Re-scoring saved runs
Run from the Legion checkout:
```sh
OUT=results/cib/gemini # the sweep output; the glob excludes preserved *.held-K attempts
uv run --locked --with '../cib-harbor/adapter[hub]' collab-intel-harbor-score \
--manifest $OUT/scoring-manifests/manifests/taking_over.json \
--runs $OUT/cases/ci-taking-over-*-s[0-9]/legion/*/trials/*/verifier/result.json \
$(for f in $OUT/cases/ci-taking-over-*-s[0-9]/legion/*/run.json; do echo --legion-run $f; done) \
--upstream-root ../cib-harbor/tasks/ci-taking-over-r-lcbhard-27--qwen318-test-s0/tests
```
`--upstream-root` takes any task's private test context; its runtime archive is verified and unpacked to a
cache. Use the manifests under `$OUT/scoring-manifests/` (`manifest.json` for Sharing), which omit controls
that were not run.
## Models and API formats
The tasks, prompts, budgets and grading are the same for every model. The recipe chooses the model:
`model`, `inference.api_key_env` (the variable holding its key) and `inference.api_format`, the wire format
Pi uses. The task's model gateway serves all three formats and forwards each request to one provider
endpoint. The launcher selects Google's, OpenAI's or Anthropic's native endpoint from the model name;
set `CI_MODEL_UPSTREAM` for a different endpoint.
| `api_format` | `inference.base_url` | Use it for |
|---|---|---|
| `openai_chat_completions` | `http://model-compat:8003/v1` | Gemini, Hugging Face router models (e.g. DeepSeek), any OpenAI-compatible endpoint, Claude through Anthropic's OpenAI-compatible endpoint |
| `openai_responses` | `http://model-compat:8003/v1` | OpenAI reasoning models, which reject tools with a reasoning effort on chat completions |
| `anthropic_messages` | `http://model-compat:8003` | Claude through Anthropic's own Messages API |
`collab-intel-harbor-run` and `-sweep` use Legion's native Harbor launcher. The adapter maps the recipe's
endpoint and model ID to Legion's inference configuration and selects Pi's API format. Task instructions,
agent limits and grading are unchanged.
The private final-answer call uses the provider's own client, chosen from the model name: `gemini-*`
Google, `claude-*` Anthropic Messages, `gpt-*` and `o*` OpenAI Responses, any other model an
OpenAI-compatible chat endpoint. Set `CI_MODEL_PROVIDER` (`google`, `anthropic`, `openai`,
`openai-compatible`) to choose it explicitly.
`CI_MODEL_BODY` (a JSON object) adds provider request options to every call of the evaluated model, Pi's and
the private final answer's alike. Stanford evaluated DeepSeek-V4.1-Flash with thinking off; on the Hugging Face
router, the reference recipe pins `:together` and requests that setting with
`CI_MODEL_BODY='{"reasoning": {"enabled": false}}'`. Other router backends can interpret provider options
differently, so retain an explicit provider choice for comparisons. The option cannot change the model,
conversation, tools, streaming or output budgets, never reaches partner, judge or grader calls, and is
recorded with each run.
Recipes in `examples/`: `gemini-full-pi.yaml` (the reference results), `deepseek-hf-full-pi.yaml`
(Hugging Face router), `gpt-full-pi.yaml` (Responses), `claude-opus-messages-full-pi.yaml` (Anthropic Messages),
`claude-opus-full-pi.yaml` (Anthropic's OpenAI-compatible endpoint; set `ANTHROPIC_WORKSPACE_ID` for
either Claude recipe if your key requires it) and
`endpoint-full-pi.yaml` (any OpenAI-compatible endpoint: set `CI_MODEL_UPSTREAM=https://<endpoint>/v1`).
Gemini 3.8 Flash is the evaluated reference; the formats and provider routes of the other recipes are
checked with a scripted fake provider through Pi and Harbor, which shows they run, not how they score.
## Podman
Docker is the default backend. With rootless Podman 4+ (Legion's environment already includes `podman-compose==1.5.0`):
- set `environment.backend: podman` in the recipe;
- create a registries file named by `CONTAINERS_REGISTRIES_CONF`. Pull through a Docker Hub mirror wherever
many machines share one address, as on the HF cluster (images are pinned by digest, so the bytes are identical).
Before starting the agent, Harbor checks network-guard support with a small pinned `alpine` container and a
30-second limit; when throttled Docker Hub pulls make that check time out, Harbor refuses to start the agent
("cannot change network policy after start").
```toml
unqualified-search-registries = ["docker.io"]
[[registry]]
location = "docker.io"
[[registry.mirror]]
location = "mirror.gcr.io"
```
- wrap `podman-compose`, because Harbor calls `compose exec --no-TTY`, which podman-compose spells `-T`:
```sh
mkdir -p ~/bin
cat > ~/bin/podman-compose-shim <<'SH'
#!/bin/bash
args=(); for a in "$@"; do [[ "$a" == "--no-TTY" ]] && a="-T"; args+=("$a"); done
exec "$(dirname "$(command -v python)")/podman-compose" "${args[@]}"
SH
chmod 700 ~/bin/podman-compose-shim && export PODMAN_COMPOSE_PROVIDER=~/bin/podman-compose-shim
```
- in batch jobs without a user systemd session (the HF cluster's CPU nodes), Podman needs a private
`XDG_RUNTIME_DIR`, DNS that does not depend on `systemd-run`, and explicitly scheduled health checks. Legion's
[`scripts/slurm/podman-node.sh`](https://github.com/huggingface/legion/blob/main/scripts/slurm/podman-node.sh)
sets up all three. It replaces `PODMAN_COMPOSE_PROVIDER`, so export the shim after it;
- Harbor clones the task with Git inside the job, so the job also needs Git LFS on `PATH` and the
dataset credentials (the quickstart's `--add-to-git-credential` login works when the job sees your Git config).
On an HF cluster CPU node, from the Legion checkout:
```sh
uv sync --locked
VENV=$PWD/.venv source scripts/slurm/podman-node.sh
trap podman_node_cleanup EXIT
export PODMAN_COMPOSE_PROVIDER=~/bin/podman-compose-shim
export CONTAINERS_REGISTRIES_CONF=$HOME/registries.conf # the file above, with the mirror
```
Harbor's network guard needs the host kernel modules `nft_fib_inet`, `nft_redir` and `nft_chain_nat`
(`grep -E "^(nft_fib_inet|nft_redir|nft_chain_nat) " /proc/modules`; modules may also be built into the kernel).
On rootless Podman hosts, ask the administrator to enable any missing modules. Without the required
kernel support Harbor refuses to start the agent and the run is held.
## Credentials
Keys stay in the launch environment. The evaluated model's key reaches the agent through Legion and the
team service (for the private final-answer call); partner, judge and grader keys and the Qwen3-14B
endpoint go only to the team service. Submitted code runs in a separate worker without any credentials.
With a Hugging Face model the two Hugging Face roles can need different tokens: one that can read this
private dataset, and one allowed to run inference billed to your organization. Keep them apart:
```sh
# Log in for dataset access as shown in the quickstart.
export HF_INFERENCE_TOKEN=... # calls the router; named by the recipe's inference.api_key_env
# Scope CI_MODEL_UPSTREAM and optional CI_MODEL_HEADERS to the inference command (dataset README).
```
`CI_MODEL_HEADERS` is sent only on the evaluated model's calls (Pi and its private final answer), never on
partner, judge or grader calls. The dataset login and inference can use the same token if it has both permissions.
See `RUNTIME.md` for the team service interface and task configuration. Retain all upstream licenses,
notices and canaries; benchmark material is not training data.
|