Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6df90dc0aa | ||
|
|
8372c37a15 | ||
|
|
15f5355f5f | ||
|
|
d1bfcbc636 | ||
|
|
f50ec5c4c8 | ||
|
|
9b944591c4 | ||
|
|
3b22dd951c | ||
|
|
13770289ef | ||
|
|
31ff561df6 | ||
|
|
dea7707526 | ||
|
|
fca9fb0975 | ||
|
|
1dcec737d9 | ||
|
|
43c2905243 | ||
|
|
54307fc301 | ||
|
|
069e580c78 | ||
|
|
45488ca048 | ||
|
|
3b5d031028 | ||
|
|
783cff546d | ||
|
|
acbabc6f0f | ||
|
|
055f62ca32 | ||
|
|
1b8c5ef01a | ||
|
|
55fc08db46 |
@@ -1,8 +1,6 @@
|
||||
name: Build Image (ghcr)
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
@@ -27,12 +25,12 @@ on:
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: primeintellect-ai/prime-rl
|
||||
BUILD_REF: ${{ github.event.release.tag_name || inputs.ref || github.ref_name }}
|
||||
BUILD_TAG: ${{ github.event.release.tag_name || inputs.tag || '' }}
|
||||
BUILD_REF: ${{ inputs.ref || github.ref_name }}
|
||||
BUILD_TAG: ${{ inputs.tag || '' }}
|
||||
BUILD_PLATFORMS: ${{ inputs.platforms || 'both' }}
|
||||
|
||||
concurrency:
|
||||
group: build-image-${{ github.event.release.tag_name || inputs.tag || inputs.ref || github.ref_name }}
|
||||
group: build-image-${{ inputs.tag || inputs.ref || github.ref_name }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -121,3 +121,11 @@ jobs:
|
||||
PYTEST_OUTPUT_DIR: /tmp/outputs
|
||||
VLLM_WORKER_MULTIPROC_METHOD: spawn
|
||||
run: uv run pytest -vvs ${{ matrix.pytest_args }}
|
||||
- name: Upload run logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.test }}-logs
|
||||
path: /tmp/outputs/**/*.log
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
name: Nightly FFT
|
||||
|
||||
on:
|
||||
# Allow to manually trigger the workflow
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
config_file:
|
||||
description: "Full-FT config to dispatch (e.g. configs/ci/nightly-fft/wordle.toml). Leave empty to run all."
|
||||
required: false
|
||||
default: ""
|
||||
image_tag:
|
||||
description: "prime-rl image tag to pin (e.g. v0.7.1.dev58). Leave empty to auto-resolve the newest v*.dev* with a published manifest."
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
# Scheduled run at 3AM PST (11AM UTC)
|
||||
schedule:
|
||||
- cron: "0 11 * * *"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
|
||||
jobs:
|
||||
discover-configs:
|
||||
name: Discover configs
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
matrix: ${{ steps.build-matrix.outputs.matrix }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
- name: Build matrix from nightly FFT configs
|
||||
id: build-matrix
|
||||
run: |
|
||||
# Find all nightly full-finetune configs
|
||||
files=$(ls configs/ci/nightly-fft/*.toml)
|
||||
|
||||
# Filter to specific config if provided in workflow_dispatch
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.config_file }}" ]; then
|
||||
filtered=$(echo "$files" | grep -F "${{ github.event.inputs.config_file }}" || true)
|
||||
if [ -z "$filtered" ]; then
|
||||
echo "Error: Config file '${{ github.event.inputs.config_file }}' not found"
|
||||
exit 1
|
||||
fi
|
||||
files="$filtered"
|
||||
fi
|
||||
|
||||
echo "Discovered nightly FFT configs:"
|
||||
echo "$files"
|
||||
|
||||
# Build JSON of the form: { "config_file": ["configs/ci/nightly-fft/foo.toml", ...] }
|
||||
json=$(printf '%s\n' "$files" | jq -R . | jq -sc '{config_file: .}')
|
||||
|
||||
echo "matrix=$json" >> "$GITHUB_OUTPUT"
|
||||
|
||||
dispatch-run:
|
||||
name: Dispatch hosted FFT run
|
||||
needs: discover-configs
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJSON(needs.discover-configs.outputs.matrix) }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
- name: Resolve prime-rl image tag
|
||||
id: image
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Pass the dispatch input through env so a malicious value
|
||||
# cannot break out of shell context via $(...) or embedded
|
||||
# quotes — the GitHub expression is substituted before Bash
|
||||
# parses the script.
|
||||
REQUESTED_IMAGE_TAG: ${{ github.event.inputs.image_tag }}
|
||||
run: |
|
||||
# If workflow_dispatch passed an explicit image_tag, validate
|
||||
# it as a Docker/OCI tag, verify its manifest is pullable,
|
||||
# and use it as-is (skip resolution).
|
||||
requested="$REQUESTED_IMAGE_TAG"
|
||||
if [ -n "$requested" ]; then
|
||||
# OCI/Docker tag charset: [A-Za-z0-9._-], max 128, no
|
||||
# leading '.' or '-'. Reject anything else before it
|
||||
# reaches curl or GITHUB_OUTPUT.
|
||||
if ! printf '%s' "$requested" | grep -Eq '^[A-Za-z0-9_][A-Za-z0-9._-]{0,127}$'; then
|
||||
echo "Invalid image_tag: only [A-Za-z0-9._-] allowed, max 128 chars, no leading '.' or '-'." >&2
|
||||
exit 1
|
||||
fi
|
||||
registry_token=$(curl -fsSL \
|
||||
"https://ghcr.io/token?scope=repository:primeintellect-ai/prime-rl:pull" \
|
||||
| jq -r .token)
|
||||
code=$(curl -sS -o /dev/null -w '%{http_code}' \
|
||||
-H "Authorization: Bearer $registry_token" \
|
||||
-H 'Accept: application/vnd.oci.image.index.v1+json' \
|
||||
-H 'Accept: application/vnd.docker.distribution.manifest.list.v2+json' \
|
||||
"https://ghcr.io/v2/primeintellect-ai/prime-rl/manifests/$requested")
|
||||
if [ "$code" != "200" ]; then
|
||||
echo "Requested image_tag '$requested' has no published manifest (HTTP $code)." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Using pinned prime-rl image tag: $requested"
|
||||
echo "tag=$requested" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# No dispatch input: auto-resolve the newest v*.dev* tag on
|
||||
# GHCR (the point of a nightly is to catch regressions on
|
||||
# tip-of-main). The GHCR versions API can list a tag before
|
||||
# its manifest is actually pullable (build in-flight, or
|
||||
# manifest step didn't finish), so pull the top N candidates
|
||||
# and verify each with a manifest HEAD via the anonymous
|
||||
# registry token flow; take the newest one that resolves.
|
||||
# Disable pipefail locally: `grep` may exit 1 on no matches
|
||||
# (empty tag list) and `head` may SIGPIPE `sort` after
|
||||
# reading its 10 lines. Both would abort the step before the
|
||||
# explicit no-candidates guard below runs.
|
||||
set +o pipefail
|
||||
candidates=$(gh api --paginate \
|
||||
"/orgs/primeintellect-ai/packages/container/prime-rl/versions" \
|
||||
--jq '.[].metadata.container.tags[]' \
|
||||
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+$' \
|
||||
| sort -Vru | head -n 10)
|
||||
set -o pipefail
|
||||
if [ -z "$candidates" ]; then
|
||||
echo "No v*.dev* tag listed on GHCR." >&2
|
||||
exit 1
|
||||
fi
|
||||
registry_token=$(curl -fsSL \
|
||||
"https://ghcr.io/token?scope=repository:primeintellect-ai/prime-rl:pull" \
|
||||
| jq -r .token)
|
||||
tag=""
|
||||
for cand in $candidates; do
|
||||
code=$(curl -sS -o /dev/null -w '%{http_code}' \
|
||||
-H "Authorization: Bearer $registry_token" \
|
||||
-H 'Accept: application/vnd.oci.image.index.v1+json' \
|
||||
-H 'Accept: application/vnd.docker.distribution.manifest.list.v2+json' \
|
||||
"https://ghcr.io/v2/primeintellect-ai/prime-rl/manifests/$cand")
|
||||
if [ "$code" = "200" ]; then
|
||||
tag="$cand"
|
||||
break
|
||||
fi
|
||||
echo "Skip $cand — manifest HEAD returned $code"
|
||||
done
|
||||
if [ -z "$tag" ]; then
|
||||
echo "None of the top v*.dev* tags have a published manifest." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Latest published prime-rl image tag on GHCR: $tag"
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
|
||||
- name: Install prime CLI (latest)
|
||||
run: uv tool install prime
|
||||
|
||||
- name: Dispatch run
|
||||
env:
|
||||
PRIME_API_KEY: ${{ secrets.PRIME_FFT_API_KEY }}
|
||||
PRIME_TEAM_ID: ${{ secrets.PRIME_FFT_TEAM_ID }}
|
||||
PRIME_BASE_URL: ${{ secrets.PRIME_BASE_URL }}
|
||||
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
|
||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||
run: |
|
||||
echo "Dispatching config: ${{ matrix.config_file }}"
|
||||
echo "Image tag: ${{ steps.image.outputs.tag }}"
|
||||
# Tag the RFTRun so it's identifiable on the platform as
|
||||
# coming from this workflow. Injected here rather than in
|
||||
# the checked-in toml because a top-level `name` field
|
||||
# breaks tests/unit/test_configs.py::test_load_configs
|
||||
# (RLConfig has no top-level name).
|
||||
config_base=$(basename "${{ matrix.config_file }}" .toml)
|
||||
run_name="nightly-${config_base}-$(date -u +%Y-%m-%d)-${{ github.run_id }}"
|
||||
dispatch_cfg=$(mktemp --suffix=.toml)
|
||||
printf 'name = "%s"\n\n' "$run_name" > "$dispatch_cfg"
|
||||
cat "${{ matrix.config_file }}" >> "$dispatch_cfg"
|
||||
echo "Dispatched run name: $run_name"
|
||||
# Forward WANDB_API_KEY / HF_TOKEN into the hosted payload:
|
||||
# the full-FT dispatch path (`prime train`) only picks up
|
||||
# secrets that were explicitly collected via `-e` / `--env-file`,
|
||||
# not ambient env, so the workflow env: block alone is not
|
||||
# enough to reach the hosted trainer/orchestrator pods.
|
||||
prime train "$dispatch_cfg" \
|
||||
--image-tag "${{ steps.image.outputs.tag }}" \
|
||||
-e WANDB_API_KEY \
|
||||
-e HF_TOKEN \
|
||||
--yes --output json
|
||||
@@ -1,11 +1,9 @@
|
||||
name: Sync Docs to Public Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**'
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -119,6 +119,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
# Needed to dispatch build_image.yaml below (POST .../dispatches).
|
||||
actions: write
|
||||
steps:
|
||||
- name: Publish draft release
|
||||
env:
|
||||
@@ -127,11 +129,22 @@ jobs:
|
||||
run: |
|
||||
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --draft=false --latest
|
||||
|
||||
# Publishing runs as GITHUB_TOKEN, whose events don't retrigger
|
||||
# workflows, so dispatch the image build explicitly.
|
||||
- name: Trigger image build for the release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ needs.auto-tag-on-main.outputs.tag }}
|
||||
run: |
|
||||
gh workflow run build_image.yaml --repo "$GITHUB_REPOSITORY" -f ref="$TAG"
|
||||
|
||||
tag-and-release:
|
||||
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
# Needed to dispatch build_image.yaml below (POST .../dispatches).
|
||||
actions: write
|
||||
steps:
|
||||
- name: Checkout tagged release (dispatch)
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
@@ -195,6 +208,7 @@ jobs:
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Publish draft release
|
||||
id: publish
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ steps.release.outputs.tag }}
|
||||
@@ -207,6 +221,17 @@ jobs:
|
||||
fi
|
||||
if [ "$STATE" = "false" ]; then
|
||||
echo "Release $TAG is already published; nothing to do."
|
||||
echo "published=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --draft=false --latest
|
||||
echo "published=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Skipped when the release was already published (no rebuild needed).
|
||||
- name: Trigger image build for the release
|
||||
if: steps.publish.outputs.published == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ steps.release.outputs.tag }}
|
||||
run: |
|
||||
gh workflow run build_image.yaml --repo "$GITHUB_REPOSITORY" -f ref="$TAG"
|
||||
|
||||
@@ -35,7 +35,8 @@ max_completion_tokens = 768
|
||||
[[orchestrator.train.env]]
|
||||
name = "alphabet-sort"
|
||||
env.taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ seq_len = 8192
|
||||
[[orchestrator.train.env]]
|
||||
name = "hendrycks-math"
|
||||
env.taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.model]
|
||||
seq_len = 16384
|
||||
|
||||
@@ -25,7 +25,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -43,7 +43,8 @@ max_completion_tokens = 512
|
||||
[[orchestrator.train.env]]
|
||||
name = "wiki-search"
|
||||
env.taskset = { id = "wiki-search-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ group_size = 8
|
||||
[[orchestrator.train.env]]
|
||||
name = "wordle"
|
||||
env.taskset = { id = "wordle-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.player.harness = { id = "null" }
|
||||
env.player.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 1024
|
||||
|
||||
@@ -25,7 +25,8 @@ max_completion_tokens = 384
|
||||
[[orchestrator.train.env]]
|
||||
name = "alphabet-sort"
|
||||
env.taskset = { id = "alphabet-sort-v1", min_turns = 2, max_turns = 2, min_names_per_turn = 1, max_names_per_turn = 3, task = { similarity_power = 4, power_per_turn = false } }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference]
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference]
|
||||
enable_lora = true
|
||||
|
||||
@@ -28,7 +28,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference]
|
||||
enable_lora = true
|
||||
|
||||
@@ -28,7 +28,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.7
|
||||
|
||||
@@ -17,7 +17,8 @@ max_completion_tokens = 128
|
||||
[[train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[ckpt]
|
||||
interval = 10
|
||||
|
||||
@@ -40,7 +40,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -52,7 +53,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -46,7 +46,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -58,7 +59,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -26,7 +26,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference]
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference]
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
max_steps = 200
|
||||
seq_len = 2048
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 4
|
||||
num_infer_gpus = 4
|
||||
|
||||
[wandb]
|
||||
project = "alphabet-sort"
|
||||
name = "alphabet-sort"
|
||||
|
||||
[ckpt]
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "alphabet-sort"
|
||||
env.taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 768
|
||||
|
||||
[trainer]
|
||||
|
||||
[inference.parallel]
|
||||
dp = 4
|
||||
@@ -0,0 +1,51 @@
|
||||
max_steps = 5000
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 4
|
||||
num_infer_gpus = 4
|
||||
|
||||
[wandb]
|
||||
project = "hendrycks-sanity"
|
||||
name = "hendrycks-sanity"
|
||||
|
||||
[ckpt]
|
||||
|
||||
[model]
|
||||
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 8
|
||||
seq_len = 8192
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "hendrycks-math"
|
||||
env.taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 50
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "aime2024"
|
||||
env.taskset = { id = "aime24-v1" }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
group_size = 32
|
||||
|
||||
[trainer]
|
||||
|
||||
[trainer.model]
|
||||
seq_len = 16384
|
||||
attn = "flash_attention_2"
|
||||
|
||||
[inference.parallel]
|
||||
dp = 4
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 8192
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
reasoning_parser = "think"
|
||||
@@ -0,0 +1,35 @@
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 1
|
||||
num_infer_gpus = 1
|
||||
|
||||
[wandb]
|
||||
project = "reverse-text"
|
||||
name = "reverse-text"
|
||||
|
||||
[ckpt]
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 128
|
||||
group_size = 16
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[trainer]
|
||||
|
||||
[inference]
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "prime-qwen3"
|
||||
@@ -0,0 +1,41 @@
|
||||
max_steps = 200
|
||||
seq_len = 4096
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 4
|
||||
num_infer_gpus = 4
|
||||
|
||||
[wandb]
|
||||
project = "wiki-search"
|
||||
name = "wiki-search"
|
||||
|
||||
[ckpt]
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
oversampling_factor = 2.0
|
||||
|
||||
[[orchestrator.pre_batch_filters]]
|
||||
type = "zero_advantage"
|
||||
enforce = true
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "wiki-search"
|
||||
env.taskset = { id = "wiki-search-v1" }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 512
|
||||
|
||||
[trainer]
|
||||
|
||||
[inference.parallel]
|
||||
dp = 4
|
||||
|
||||
[inference.model]
|
||||
tool_call_parser = "hermes"
|
||||
@@ -0,0 +1,36 @@
|
||||
max_steps = 200
|
||||
seq_len = 8192
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 2
|
||||
num_infer_gpus = 6
|
||||
|
||||
[wandb]
|
||||
project = "wordle"
|
||||
name = "wordle"
|
||||
|
||||
[ckpt]
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-1.7B-Wordle-SFT"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "wordle"
|
||||
env.taskset = { id = "wordle-v1" }
|
||||
env.player.harness = { id = "null" }
|
||||
env.player.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 1024
|
||||
|
||||
[trainer]
|
||||
|
||||
[inference.parallel]
|
||||
dp = 6
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "prime-qwen3"
|
||||
@@ -23,7 +23,8 @@ max_completion_tokens = 64
|
||||
[[orchestrator.train.env]]
|
||||
name = "color-codeword"
|
||||
env.taskset = { id = "color-codeword-v1", images_per_turn = 1 }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer]
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ alpha = 0.1
|
||||
[[orchestrator.train.env]]
|
||||
name = "alphabet-sort"
|
||||
env.taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 512
|
||||
|
||||
@@ -24,7 +24,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -36,7 +37,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -24,7 +24,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -36,7 +37,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -34,12 +34,14 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text-grpo"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text-opd"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.train.env.algo]
|
||||
type = "opd"
|
||||
@@ -58,7 +60,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -36,7 +36,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -48,7 +49,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -36,7 +36,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -48,7 +49,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-4
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
max_steps = 20
|
||||
seq_len = 4096
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-0.6B"
|
||||
|
||||
[wandb]
|
||||
project = "algorithms-debug"
|
||||
name = "debug-rae"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 32
|
||||
group_size = 1
|
||||
|
||||
[orchestrator.algo]
|
||||
type = "rae"
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 512
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "kuhn-poker"
|
||||
env.taskset = { id = "kuhn-poker-v1" }
|
||||
env.player0.harness = { id = "null" }
|
||||
env.player0.runtime = { type = "subprocess" }
|
||||
env.player1.harness = { id = "null" }
|
||||
env.player1.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
num_examples = 16
|
||||
|
||||
[orchestrator.eval.sampling]
|
||||
max_completion_tokens = 512
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "kuhn-poker"
|
||||
env.taskset = { id = "kuhn-poker-v1" }
|
||||
env.player0.harness = { id = "null" }
|
||||
env.player0.runtime = { type = "subprocess" }
|
||||
env.player1.harness = { id = "null" }
|
||||
env.player1.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
[ckpt]
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.5
|
||||
@@ -32,7 +32,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -44,7 +45,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -41,7 +41,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -53,7 +54,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -41,7 +41,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -53,7 +54,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.eval.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-4
|
||||
|
||||
Vendored
+1
-1
Submodule deps/research-environments updated: f5d423c321...6a2dee6fcd
Vendored
+1
-1
Submodule deps/verifiers updated: b13ba60da6...d0bb0ffe53
+30
-3
@@ -17,6 +17,7 @@ This page covers the math and the configurable algorithmic components: the algor
|
||||
- [Custom Loss](#custom-loss)
|
||||
- [Advantage](#advantage)
|
||||
- [Default Advantage](#default-advantage)
|
||||
- [Self-Play Advantage (RAE)](#self-play-advantage-rae)
|
||||
- [Authoring an Algorithm](#authoring-an-algorithm)
|
||||
- [Reference Scoring](#reference-scoring)
|
||||
- [Filters](#filters)
|
||||
@@ -67,6 +68,7 @@ type = "grpo" # the default
|
||||
|---|---|---|---|
|
||||
| `grpo` | policy | `rl` on actions | Standard group-relative RL. |
|
||||
| `max_rl` | policy | `rl` on actions | MaxRL ([arXiv:2602.02710](https://arxiv.org/abs/2602.02710)): GRPO's centered reward normalized by the group **mean** instead of the standard deviation — the gradient is unbiased for the order-`group_size` truncation of the maximum-likelihood objective, upweighting hard examples like `1/p`. |
|
||||
| `rae` | policy | `rl` on actions | RAE (SPIRAL, [arXiv:2506.24119](https://arxiv.org/abs/2506.24119)): reward minus a per-agent EMA baseline of that agent's own rewards — the estimator for multi-agent self-play envs, where the group mean would mix the agents' opposite reward scales. See [Self-Play Advantage](#self-play-advantage-rae). |
|
||||
| `opd` | policy | `ref_kl` on actions | On-policy distillation ([Thinking Machines](https://thinkingmachines.ai/blog/on-policy-distillation/)): the policy samples, per-token reverse KL against a reference model as the gradient signal. Needs a `teacher`. |
|
||||
| `sft` | *(the teacher)* | `ce` on actions | Hard distillation: a frozen model generates rollouts, the policy trains with CE on its tokens. Needs a frozen `sampling.source` (the teacher it samples from). |
|
||||
| `opsd` | policy | `ref_kl` on actions | SDFT ([arXiv:2601.19897](https://arxiv.org/abs/2601.19897)): the model is its own reference, conditioned on an expert demonstration. The teacher *is* the live policy (the paper's setting, no extra deployment) — no model to configure. |
|
||||
@@ -119,13 +121,15 @@ type = "grpo"
|
||||
[[orchestrator.train.env]]
|
||||
name = "math"
|
||||
taskset = { id = "math-v1" }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
harness = { id = "null" }
|
||||
runtime = { type = "subprocess" }
|
||||
# inherits the top-level grpo
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "terminal"
|
||||
taskset = { id = "terminal-v1" }
|
||||
harness = { id = "bash", runtime = { type = "subprocess" } }
|
||||
harness = { id = "bash" }
|
||||
runtime = { type = "subprocess" }
|
||||
algo = { type = "echo" } # this env runs its own algorithm
|
||||
```
|
||||
|
||||
@@ -138,6 +142,7 @@ At runtime, each env's resolved config builds two objects: a `Sampler` (`prime_r
|
||||
| `grpo` | `GRPOAlgorithm` | `score_group`: group-norm credit (optional length penalty) |
|
||||
| `echo` | `EchoAlgorithm` | `score_rollout`: weighted ce on observation tokens; `score_group`: group-norm credit (inherited) |
|
||||
| `max_rl` | `MaxRLAlgorithm` | `score_group`: mean-normalized group credit |
|
||||
| `rae` | `RAEAlgorithm` | `score_group`: per-agent EMA-baseline credit |
|
||||
| `opd` | `OPDAlgorithm` | `score_rollout`: own-context prefill under the teacher |
|
||||
| `opsd` | `OPSDAlgorithm` | `score_rollout`: demo-conditioned prefill under the live policy |
|
||||
| `sft` | `SFTDistillAlgorithm` | `score_group`: group-norm credit (feeds filters) |
|
||||
@@ -174,7 +179,7 @@ $$
|
||||
\mathcal{L} = \frac{\sum \mathcal{L}_{rl}}{N_{rl}} + \frac{\sum \mathcal{L}_{ce}}{N_{ce}} + \frac{\sum \mathcal{L}_{ref\_kl}}{N_{ref\_kl}}
|
||||
$$
|
||||
|
||||
- `rl` — the configured RL loss (`[trainer.loss]`): DPPO + KL by default, or a [custom loss](#custom-loss). Fed by the group-relative algorithms (`grpo`, `max_rl`, and `echo`'s action tokens).
|
||||
- `rl` — the configured RL loss (`[trainer.loss]`): DPPO + KL by default, or a [custom loss](#custom-loss). Fed by the advantage-assigning algorithms (`grpo`, `max_rl`, `rae`, and `echo`'s action tokens).
|
||||
- `ce` — masked NLL. Used for frozen-model tokens (`sft`) and env-observation tokens (`echo`).
|
||||
- `ref_kl` — the per-token reverse KL to a reference model ($\log \pi_{\text{ref}} - \log \pi$) as the policy-gradient signal, importance-ratio corrected with a one-sided trust region (`opd`, `opsd`). Requires `ref_logprobs` from a [reference scoring](#reference-scoring); the scoring model must be a vLLM server (it's the only one that exposes `prompt_logprobs`).
|
||||
|
||||
@@ -276,6 +281,7 @@ The per-token training signal is set by `algo.type` and the [algorithm](#the-alg
|
||||
|---|---|---|
|
||||
| `grpo` | `rl` | Group-norm: reward minus per-group baseline, optional length penalty. |
|
||||
| `max_rl` | `rl` | Mean-normalized group credit (maximum-likelihood RL). |
|
||||
| `rae` | `rl` | Reward minus a per-agent EMA baseline (SPIRAL's role-conditioned advantage estimation) — for multi-agent self-play envs. |
|
||||
| `echo` | `rl` + `ce` | Group-norm on action tokens, plus weighted CE on env-provided tokens selected by message role (each role's `alpha` is its ECHO λ), optionally narrowed by a user filter. |
|
||||
| `opd` | `ref_kl` | On-policy distillation: per-token reverse KL to a reference model (`teacher`, an inline frozen hosted model), evaluated in the trainer from shipped reference logprobs. No credit — rollouts keep `advantages = None` (advantage-based filters never fire) and ship no advantage stream; `group_size` only fans out sampling. |
|
||||
| `opsd` | `ref_kl` | SDFT: per-token reverse KL to a demo-conditioned reference. No credit — rollouts keep `advantages = None` (advantage-based filters never fire) and ship no advantage stream. |
|
||||
@@ -297,6 +303,27 @@ type = "grpo"
|
||||
type = "linear"
|
||||
```
|
||||
|
||||
### Self-Play Advantage (RAE)
|
||||
|
||||
Group-relative baselines assume the group is exchangeable attempts by one agent. A multi-agent self-play env breaks that: one episode yields one trace per agent, all trainable, and in a zero-sum game the rewards sum to ~0 whatever the policy does — the group mean carries no information, and centering against it converts any structural asymmetry (a first-mover edge) into permanent credit for one agent.
|
||||
|
||||
`rae` implements SPIRAL's role-conditioned advantage estimation ([arXiv:2506.24119](https://arxiv.org/abs/2506.24119)): each agent keeps an exponential-moving-average baseline of its own rewards, and every trace's advantage is its reward minus its agent's baseline — measured against the *pre-update* baseline (the unbiased order), then folded in at `decay` (SPIRAL's α, default 0.95). The algorithm instance is per-env, so baselines are keyed per (env, agent) — the paper's per (game, role). Advantages are not normalized, and `group_size` is free (RAE needs no sibling rollouts; `group_size = 1` is fine). Baselines live in orchestrator memory and re-warm from 0 over ~`1/(1 − decay)` traces per agent after a restart.
|
||||
|
||||
```toml
|
||||
[orchestrator.algo]
|
||||
type = "rae"
|
||||
decay = 0.95
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "kuhn-poker"
|
||||
env.taskset = { id = "kuhn-poker-v1" }
|
||||
env.player0.harness = { id = "null" }
|
||||
env.player0.runtime = { type = "subprocess" }
|
||||
env.player1.harness = { id = "null" }
|
||||
env.player1.runtime = { type = "subprocess" }
|
||||
```
|
||||
|
||||
Both of `kuhn-poker-v1`'s agents late-bind to the run's own model — shared-policy self-play against a continuously improving opponent. Pin one agent to a frozen endpoint (`env.player1.model = ...`) for asymmetric play; its traces are marked untrainable by the env and never reach the advantage computation. A single-agent env under `rae` degrades to REINFORCE with an EMA baseline.
|
||||
|
||||
### Authoring an Algorithm
|
||||
|
||||
|
||||
@@ -150,19 +150,22 @@ Training environments are an array of tables — set one per env, optionally wit
|
||||
[[orchestrator.train.env]]
|
||||
name = "gsm8k"
|
||||
env.taskset = { id = "gsm8k-v1", split = "train" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
ratio = 3 # 75% of batches
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
ratio = 1 # default — 25% of batches
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "gsm8k-eval"
|
||||
env.taskset = { id = "gsm8k-v1", split = "test" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
```
|
||||
|
||||
`ratio` defaults to `1` (equal weight per env); values are relative weights normalized to probabilities across envs.
|
||||
|
||||
@@ -14,6 +14,7 @@ This page covers workflows for developing on `prime-rl` itself — running the t
|
||||
- [Implement the Modeling Code](#implement-the-modeling-code)
|
||||
- [Register a Mini Preset](#register-a-mini-preset)
|
||||
- [Run the Smoke Test](#run-the-smoke-test)
|
||||
- [Adding a Custom VLM Implementation](#adding-a-custom-vlm-implementation)
|
||||
|
||||
## Test Suite
|
||||
|
||||
@@ -137,3 +138,15 @@ Before merging a new model, you need to ensure the following:
|
||||
- The small smoke test passes.
|
||||
|
||||
In the PR that adds the new model, you also need to provide a table covering the KL mismatch across 20 steps on `math` environment with `batch_size=64`. All the entries in the table must lower than 0.015. If this is not met, the PR will not be merged (unless reasonable justification is provided). This is to ensure all our models are consistent and their implementations match the implementations in the inference framework.
|
||||
|
||||
## Adding a Custom VLM Implementation
|
||||
|
||||
VLM training (any run with `[model.vlm]` set, SFT or RL) is custom-implementation-only: `get_model` rejects models without a custom PrimeRL VLM class at load time. To make a new VLM family trainable, extend a custom text model with a composite VLM body — the Qwen3.5 dense (`models/qwen3_5/`) and MoE (`models/qwen3_5_moe/`) implementations are the reference. The pieces, in dependency order:
|
||||
|
||||
1. **Custom text model first.** The VLM body wraps a custom `*ForCausalLM` (see [Adding a New Model](#adding-a-new-model)), so the text side — including its state-dict conversion and KL-mismatch table — comes first.
|
||||
2. **Composite VLM body.** A `*VLMModel` that holds the HF vision encoder and the custom text model, with a `prepare_inputs_embeds_and_position_ids` step: embed tokens, run the vision encoder, scatter image embeddings over placeholder tokens, and build MRoPE 3D positions from `mm_token_type_ids` (the renderer owns the token→modality mapping). The unified `*ForCausalLM` dispatches on the config: composite config → VLM path, text config → text path.
|
||||
3. **Always run the vision encoder.** Text-only micro-batches must feed the encoder dummy pixels and graft the result into the graph with zero contribution (`inputs_embeds + image_embeds.sum() * 0.0`) so FSDP/EP collectives stay symmetric across ranks when the encoder is trainable.
|
||||
4. **Packed-boundary consumption.** Samples pack into shared rows with per-document boundaries in `seq_lens`; every custom model's `forward()` declares the typed `seq_lens`/`seq_lens_are_pre_shard` parameters (the trainer passes them unconditionally) and must honor the boundaries — varlen flash `cu_seqlens`, linear-attention state resets per document, and a loud rejection on attention paths that can't (see the packed-batch guard in any modeling file). Set `supports_packed_multimodal_training` on the VLM model once packed rows are handled — RL fails loudly at startup for VLM models without it.
|
||||
5. **Registration.** Register the composite `model_type` in `_CUSTOM_VLM_MAPPING` (`models/__init__.py`) so `get_model` dispatches to the custom class, and describe the family in `VLM_REGISTRY` (`utils/vlm.py`).
|
||||
6. **Context parallelism (optional).** CP-capable VLMs implement `set_context_parallel_attributes` and shard embeds/positions inside the model after the vision merge; the trainers defer sharding to the model for MRoPE batches under ulysses.
|
||||
7. **Validation.** Same bar as text models: the KL-mismatch table for the text path, plus an SFT run and an RL run on a real multimodal dataset (the `color-codeword` environment is the reference task).
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ A `prime-rl` RL run is three cooperating processes:
|
||||
- **Orchestrator** — Lightweight CPU process that owns the data plane across many [`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) training and eval environments. Each env runs in an isolated subprocess with a variable-size pool of env workers for scalability. The orchestrator drives multi-turn rollouts against the inference fleet (tool use, browsers, sandboxes, long horizons) without re-tokenizing across turns, computes advantages, packs the rollouts into training batches, and relays new weights from trainer to inference.
|
||||
- **Trainer** — FSDP2 process group that consumes packed rollouts and steps the optimizer. We ship optimized custom modeling code for many MoE / dense / VLM families that unlocks advanced trainer parallelism — expert parallelism (EP, with DeepEP kernels) and context parallelism (CP) for long-sequence training — plus selective activation checkpointing, FP8 training on Hopper+, LoRA, and multi-tenant training (many concurrent LoRA tenants sharing one trainer + inference deployment). You can read more in the dedicated [training documentation](training.md).
|
||||
|
||||
The three processes communicate through configurable transports — by default the trainer↔orchestrator rollout link uses the local filesystem, and weight broadcast uses NCCL for synchronous in-memory transfer (falling back to filesystem when LoRA is enabled or no inference server is configured). Swap to ZMQ for multi-host setups without shared storage. See [Scaling](scaling.md) for the deployment options.
|
||||
The three processes communicate through configurable transports — by default the trainer↔orchestrator rollout link uses ZMQ, and weight broadcast uses NCCL for synchronous in-memory transfer (falling back to filesystem when LoRA is enabled or no inference server is configured). Swap the rollout link to the local filesystem (`rollout_transport.type = "filesystem"`) if you want rollouts persisted to disk. See [Scaling](scaling.md) for the deployment options.
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
+2
-1
@@ -59,7 +59,7 @@ A condensed view of the knobs you'll most often tune. For trainer-side paralleli
|
||||
| `orchestrator.batch_size` | Tasks per trainer step. |
|
||||
| `orchestrator.group_size` | Rollouts generated per task. |
|
||||
| `orchestrator.max_off_policy_steps` | How many distinct policies may have contributed to one rollout before it's discarded (default 8). The main off-policy dial on long agentic rollouts — bump for throughput, lower for tighter on-policyness. Watch `errored_rollouts` and `mismatch_kl/all/mean` when tuning. |
|
||||
| `[orchestrator.algo]` | Training algorithm — its `type` names it (`grpo` default, `max_rl`, `opd`, `opsd`, `sft`, `echo`). See [Algorithms](#algorithms). |
|
||||
| `[orchestrator.algo]` | Training algorithm — its `type` names it (`grpo` default, `max_rl`, `rae`, `opd`, `opsd`, `sft`, `echo`). See [Algorithms](#algorithms). |
|
||||
| `[[orchestrator.train.env]]` | Training environments. List multiple tables for multi-env training; weight them via `ratio`. See [Configuration § Environments](configuration.md#environments-orchestratortrainenv). |
|
||||
| `[[orchestrator.eval.env]]` + `orchestrator.eval.interval` | Eval environments and cadence (default every 100 steps). |
|
||||
|
||||
@@ -89,6 +89,7 @@ The RL entrypoint supports several training algorithms, switched via `[orchestra
|
||||
|---|---|---|
|
||||
| `grpo` (default) | None | Standard group-relative RL |
|
||||
| `max_rl` | None | [MaxRL](https://arxiv.org/abs/2602.02710): GRPO with mean-normalized advantages (maximum-likelihood RL) |
|
||||
| `rae` | None | [SPIRAL](https://arxiv.org/abs/2506.24119)'s role-conditioned advantage estimation: reward minus a per-agent EMA baseline, for multi-agent self-play envs (e.g. `kuhn-poker-v1`) |
|
||||
| `opd` | Required, must be vLLM (needs `prompt_logprobs`) | [On-policy distillation](https://thinkingmachines.ai/blog/on-policy-distillation/): the policy generates rollouts, the trainer minimizes per-token reverse KL to a reference model |
|
||||
| `sft` | Required, any OpenAI-compatible endpoint | Hard-distill: a frozen model generates rollouts, the policy trains on its tokens |
|
||||
| `opsd` | None — the live policy is its own reference (no deployment) | [SDFT](https://arxiv.org/abs/2601.19897): the model is its own reference conditioned on expert demonstrations |
|
||||
|
||||
@@ -46,7 +46,7 @@ enable_router_replay = true
|
||||
[trainer.model]
|
||||
impl = "custom"
|
||||
attn = "flash_attention_3"
|
||||
cp = 8
|
||||
cp = 4
|
||||
cp_style = "ulysses"
|
||||
fused_lm_head_token_chunk_size = 1024
|
||||
optim_cpu_offload = true
|
||||
@@ -95,7 +95,8 @@ num_turns_weight = 0.0
|
||||
# the plugged BC-style prompt is replaced by the reference judge's stock prompt).
|
||||
[[orchestrator.train.env]]
|
||||
name = "openseeker"
|
||||
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] } }
|
||||
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = [65536, 131072] }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] }
|
||||
|
||||
[orchestrator.train.env.env.taskset]
|
||||
id = "openseeker-v1"
|
||||
@@ -117,7 +118,8 @@ choices = ["A", "B"]
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "redsearcher"
|
||||
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] } }
|
||||
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = [65536, 131072] }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] }
|
||||
|
||||
[orchestrator.train.env.env.taskset]
|
||||
id = "redsearcher-v1" # optional `difficulty` filter (easy/medium/hard)
|
||||
@@ -145,7 +147,8 @@ interval = 20
|
||||
[[orchestrator.eval.env]]
|
||||
name = "browsecomp"
|
||||
num_examples = 500 # full set is 1266; cap eval at 500
|
||||
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] } }
|
||||
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], summarize_at_tokens = 98304 }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] }
|
||||
env.agent.timeout = { rollout = 3600 }
|
||||
|
||||
[orchestrator.eval.env.env.taskset]
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# term is pass_rate-scaled and normalized by the group's own max before the GRPO baseline
|
||||
# subtraction.
|
||||
#
|
||||
# 2 train + 4 infer nodes. Trainer uses cp=8 (ulysses) plus
|
||||
# 2 train + 4 infer nodes. Trainer uses cp=4 (ulysses) plus
|
||||
# the memory improvements from the GLM-5.1 prod run (research-prod rlm5/prod.toml): LM-head token
|
||||
# chunking, activation checkpointing (freq=1) + activation offloading (max_inflight=1), optimizer
|
||||
# CPU offload, and skip-gather / skip-optimizer checkpointing.
|
||||
@@ -57,7 +57,7 @@ enable_router_replay = true
|
||||
[trainer.model]
|
||||
impl = "custom"
|
||||
attn = "flash_attention_3"
|
||||
cp = 8
|
||||
cp = 4
|
||||
cp_style = "ulysses"
|
||||
fused_lm_head_token_chunk_size = 1024
|
||||
optim_cpu_offload = true
|
||||
@@ -100,7 +100,8 @@ thinking_retention = "all"
|
||||
[[orchestrator.train.env]]
|
||||
name = "scaleswe"
|
||||
env.taskset = { id = "scaleswe-v1" }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] } }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072] }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] }
|
||||
|
||||
[orchestrator.prime_monitor]
|
||||
|
||||
@@ -112,7 +113,8 @@ interval = 20
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swebench-verified"
|
||||
env.taskset = { id = "swebench-verified-v1" }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] } }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304 }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] }
|
||||
env.agent.timeout = { rollout = 3600 }
|
||||
|
||||
# --- Inference ---
|
||||
|
||||
@@ -47,7 +47,7 @@ enable_router_replay = true
|
||||
[trainer.model]
|
||||
impl = "custom"
|
||||
attn = "flash_attention_3"
|
||||
cp = 8
|
||||
cp = 4
|
||||
cp_style = "ulysses"
|
||||
fused_lm_head_token_chunk_size = 1024
|
||||
optim_cpu_offload = true
|
||||
@@ -93,7 +93,8 @@ num_turns_weight = 0.1
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "tmax"
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072] }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] }
|
||||
|
||||
[orchestrator.train.env.env.taskset]
|
||||
id = "tmax-v1"
|
||||
@@ -120,7 +121,8 @@ interval = 20
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swebench-verified"
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304 }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] }
|
||||
env.agent.timeout = { rollout = 3600 }
|
||||
|
||||
[orchestrator.eval.env.env.taskset]
|
||||
@@ -143,7 +145,8 @@ id = "swebench-verified-v1"
|
||||
[[orchestrator.eval.env]]
|
||||
name = "terminal-bench-2"
|
||||
group_size = 4 # avg@4
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304 }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] }
|
||||
env.agent.timeout = { rollout = 3600 }
|
||||
|
||||
[orchestrator.eval.env.env.taskset]
|
||||
|
||||
@@ -99,7 +99,8 @@ extra_body = {chat_template_kwargs = {clear_thinking = false}}
|
||||
[[orchestrator.train.env]]
|
||||
name = "r2e"
|
||||
env.taskset = { id = "r2e-gym-v1" }
|
||||
env.agent.harness = { id = "rlm", runtime = { type = "prime", labels = ["glm5-llmd"] } }
|
||||
env.agent.harness = { id = "rlm" }
|
||||
env.agent.runtime = { type = "prime", labels = ["glm5-llmd"] }
|
||||
|
||||
[inference]
|
||||
enable_expert_parallel = true
|
||||
|
||||
@@ -74,7 +74,8 @@ interval = 20
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swe-bench-verified"
|
||||
env.taskset = { id = "swebench-verified-v1" }
|
||||
env.agent.harness = { id = "bash", runtime = { type = "prime", labels = ["glm5-pd-disag", "swe-bench-verified"] } }
|
||||
env.agent.harness = { id = "bash" }
|
||||
env.agent.runtime = { type = "prime", labels = ["glm5-pd-disag", "swe-bench-verified"] }
|
||||
|
||||
[[orchestrator.post_batch_filters]]
|
||||
type = "gibberish"
|
||||
|
||||
@@ -51,31 +51,36 @@ oversampling_factor = 2
|
||||
name = "swe"
|
||||
ratio = 0.3
|
||||
env.taskset = { id = "r2e-gym-v1" }
|
||||
env.agent.harness = { id = "bash", runtime = { type = "prime", labels = ["intellect-3.1", "swe"] } }
|
||||
env.agent.harness = { id = "bash" }
|
||||
env.agent.runtime = { type = "prime", labels = ["intellect-3.1", "swe"] }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "deepdive"
|
||||
ratio = 0.2
|
||||
env.taskset = { id = "deepdive-v1" }
|
||||
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"], runtime = { type = "prime", labels = ["intellect-3.1", "deepdive"] } }
|
||||
env.agent.harness = { id = "rlm", skills = ["search"], forward_env = ["SERPER_API_KEY"] }
|
||||
env.agent.runtime = { type = "prime", labels = ["intellect-3.1", "deepdive"] }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "math"
|
||||
ratio = 0.3
|
||||
env.taskset = { id = "i3_math_v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "logic"
|
||||
ratio = 0.2
|
||||
env.taskset = { id = "i3_logic_v1", filter = { max = 0.874 } }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "code"
|
||||
ratio = 0.2
|
||||
env.taskset = { id = "i3_code_v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[[orchestrator.pre_batch_filters]]
|
||||
type = "zero_advantage"
|
||||
@@ -87,12 +92,14 @@ interval = 25
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swe-bench-verified"
|
||||
env.taskset = { id = "swebench-verified-v1" }
|
||||
env.agent.harness = { id = "bash", runtime = { type = "prime", labels = ["intellect-3.1", "swe-bench-verified"] } }
|
||||
env.agent.harness = { id = "bash" }
|
||||
env.agent.runtime = { type = "prime", labels = ["intellect-3.1", "swe-bench-verified"] }
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "aime2025"
|
||||
env.taskset = { id = "aime25-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference.parallel]
|
||||
tp = 8
|
||||
|
||||
@@ -52,7 +52,8 @@ max_off_policy_steps = 16
|
||||
[[orchestrator.train.env]]
|
||||
name = "swe"
|
||||
env.taskset = { id = "r2e-gym-v1" }
|
||||
env.agent.harness = { id = "bash", runtime = { type = "prime", labels = ["minimax-swe", "swe"] } }
|
||||
env.agent.harness = { id = "bash" }
|
||||
env.agent.runtime = { type = "prime", labels = ["minimax-swe", "swe"] }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 25
|
||||
@@ -60,7 +61,8 @@ interval = 25
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swe-bench-verified"
|
||||
env.taskset = { id = "swebench-verified-v1" }
|
||||
env.agent.harness = { id = "bash", runtime = { type = "prime", labels = ["minimax-swe", "swe-bench-verified"] } }
|
||||
env.agent.harness = { id = "bash" }
|
||||
env.agent.runtime = { type = "prime", labels = ["minimax-swe", "swe-bench-verified"] }
|
||||
|
||||
[inference.parallel]
|
||||
tp = 8
|
||||
|
||||
@@ -84,7 +84,8 @@ truncate_history_thinking = false
|
||||
[[orchestrator.train.env]]
|
||||
name = "scaleswe"
|
||||
env.taskset = { id = "scaleswe-v1" }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["nemotron-3-super-swe"] } }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = [65536, 131072] }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["nemotron-3-super-swe"] }
|
||||
|
||||
[orchestrator.prime_monitor]
|
||||
|
||||
@@ -94,7 +95,8 @@ interval = 20
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swebench-verified"
|
||||
env.taskset = { id = "swebench-verified-v1" }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["nemotron-3-super-swe"] } }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304 }
|
||||
env.agent.runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["nemotron-3-super-swe"] }
|
||||
env.agent.timeout = { rollout = 3600 }
|
||||
|
||||
[inference]
|
||||
|
||||
@@ -51,7 +51,8 @@ max_completion_tokens = 32768
|
||||
[[orchestrator.train.env]]
|
||||
name = "math"
|
||||
env.taskset = { id = "i3_math_v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 25
|
||||
@@ -59,7 +60,8 @@ interval = 25
|
||||
[[orchestrator.eval.env]]
|
||||
name = "aime2025"
|
||||
env.taskset = { id = "aime25-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference.parallel]
|
||||
tp = 8
|
||||
tp = 8
|
||||
|
||||
@@ -49,7 +49,8 @@ max_off_policy_steps = 16
|
||||
[[orchestrator.train.env]]
|
||||
name = "swe"
|
||||
env.taskset = { id = "r2e-gym-v1" }
|
||||
env.agent.harness = { id = "bash", runtime = { type = "prime", labels = ["qwen30b-swe", "swe"] } }
|
||||
env.agent.harness = { id = "bash" }
|
||||
env.agent.runtime = { type = "prime", labels = ["qwen30b-swe", "swe"] }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 25
|
||||
@@ -57,7 +58,8 @@ interval = 25
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swe-bench-verified"
|
||||
env.taskset = { id = "swebench-verified-v1" }
|
||||
env.agent.harness = { id = "bash", runtime = { type = "prime", labels = ["qwen30b-swe", "swe-bench-verified"] } }
|
||||
env.agent.harness = { id = "bash" }
|
||||
env.agent.runtime = { type = "prime", labels = ["qwen30b-swe", "swe-bench-verified"] }
|
||||
|
||||
[inference.parallel]
|
||||
tp = 8
|
||||
tp = 8
|
||||
|
||||
@@ -37,7 +37,8 @@ max_off_policy_steps = 32
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
env.taskset = { id = "general-agent-v1", task = { tools = { colocated = true } }, min_tier = 1 }
|
||||
env.agent.harness = { id = "null", runtime = { type = "modal" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "modal" }
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.85
|
||||
|
||||
@@ -34,6 +34,7 @@ max_completion_tokens = 768
|
||||
[[orchestrator.train.env]]
|
||||
name = "alphabet-sort"
|
||||
env.taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[inference] # Default inference config
|
||||
|
||||
@@ -19,7 +19,8 @@ seq_len = 8192
|
||||
[[orchestrator.train.env]]
|
||||
name = "hendrycks-math"
|
||||
env.taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 50
|
||||
@@ -27,7 +28,8 @@ interval = 50
|
||||
[[orchestrator.eval.env]]
|
||||
name = "aime2024"
|
||||
env.taskset = { id = "aime24-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
group_size = 32
|
||||
|
||||
[trainer.model]
|
||||
|
||||
@@ -18,7 +18,8 @@ max_completion_tokens = 128
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
@@ -136,7 +136,8 @@ The V1 taskset fixes the question bank and searchable corpus. You can replace it
|
||||
[[orchestrator.train.env]]
|
||||
name = "wiki-search"
|
||||
taskset = { id = "wiki-search-v1", task = { judges = [{ id = "reference", model = "openai/gpt-5.4-nano" }] } }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
harness = { id = "null" }
|
||||
runtime = { type = "subprocess" }
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
@@ -47,7 +47,8 @@ enforce = true
|
||||
[[orchestrator.train.env]]
|
||||
name = "wiki-search"
|
||||
env.taskset = { id = "wiki-search-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ group_size = 16
|
||||
[[orchestrator.train.env]]
|
||||
name = "wordle"
|
||||
env.taskset = { id = "wordle-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.player.harness = { id = "null" }
|
||||
env.player.runtime = { type = "subprocess" }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 1024
|
||||
|
||||
@@ -232,6 +232,27 @@ class MaxRLAlgoConfig(BaseAlgoConfig):
|
||||
action_loss_type: ClassVar[ActionLossType] = "rl"
|
||||
|
||||
|
||||
class RAEAlgoConfig(BaseAlgoConfig):
|
||||
type: Literal["rae"] = "rae"
|
||||
"""RAE — role-conditioned advantage estimation (SPIRAL,
|
||||
https://arxiv.org/abs/2506.24119): scalar advantage = reward minus a
|
||||
per-agent EMA baseline of that agent's own rewards, consumed by the ``rl``
|
||||
loss component. The advantage estimator for multi-agent self-play envs
|
||||
(``kuhn-poker-v1`` and friends): in a zero-sum game the group mean is ~0
|
||||
whatever the policy does, so a group-relative baseline mixes the agents'
|
||||
opposite reward scales — a structural first-mover edge would read as
|
||||
permanent credit. Per-agent baselines measure each agent against its own
|
||||
expected reward instead. Works with any ``group_size`` (including 1)."""
|
||||
|
||||
action_loss_type: ClassVar[ActionLossType] = "rl"
|
||||
|
||||
decay: float = Field(0.95, ge=0.0, lt=1.0)
|
||||
"""EMA decay of the per-agent baselines (SPIRAL's α): after a trace is
|
||||
scored, its agent's baseline moves as ``baseline ← decay · baseline +
|
||||
(1 − decay) · reward``. Baselines start at 0 and live in orchestrator
|
||||
memory — a restart re-warms them over ~1/(1 − decay) traces per agent."""
|
||||
|
||||
|
||||
class OPDAlgoConfig(BaseAlgoConfig):
|
||||
type: Literal["opd"] = "opd"
|
||||
"""On-policy distillation: the per-token signal is the reverse KL to
|
||||
@@ -305,7 +326,7 @@ class SFTAlgoConfig(BaseAlgoConfig):
|
||||
|
||||
|
||||
AlgoConfig: TypeAlias = Annotated[
|
||||
GRPOAlgoConfig | EchoAlgoConfig | MaxRLAlgoConfig | OPDAlgoConfig | OPSDAlgoConfig | SFTAlgoConfig,
|
||||
GRPOAlgoConfig | EchoAlgoConfig | MaxRLAlgoConfig | RAEAlgoConfig | OPDAlgoConfig | OPSDAlgoConfig | SFTAlgoConfig,
|
||||
Field(discriminator="type"),
|
||||
]
|
||||
"""The training algorithm: sampling plus the per-token training signal (credit
|
||||
@@ -314,6 +335,7 @@ its class defaults are the vetted setting.
|
||||
|
||||
- ``grpo`` — policy group sampling, group-relative advantage, RL loss (the default).
|
||||
- ``max_rl`` — GRPO with mean-normalized advantages (maximum-likelihood RL).
|
||||
- ``rae`` — reward minus a per-agent EMA baseline (SPIRAL), for multi-agent self-play envs.
|
||||
- ``opd`` — on-policy distillation: policy samples, per-token reverse KL against a reference model. Needs ``teacher``.
|
||||
- ``opsd`` — SDFT: policy samples, demo-conditioned reverse KL against the live policy (the teacher is the policy itself).
|
||||
- ``sft`` — a frozen model samples, the policy trains with CE on its tokens. Needs a frozen ``sampling.source``.
|
||||
|
||||
@@ -15,12 +15,12 @@ from prime_rl.configs.shared import (
|
||||
ClientConfig,
|
||||
EnvVars,
|
||||
FileMonitorConfig,
|
||||
FileSystemTransportConfig,
|
||||
HeartbeatConfig,
|
||||
LogConfig,
|
||||
PrimeMonitorConfig,
|
||||
TransportConfig,
|
||||
WandbWithExtrasConfig,
|
||||
ZMQTransportConfig,
|
||||
)
|
||||
from prime_rl.configs.trainer import TokenizerConfig
|
||||
from prime_rl.utils.config import BaseConfig
|
||||
@@ -509,7 +509,7 @@ class OrchestratorConfig(BaseConfig):
|
||||
weight_broadcast: WeightBroadcastConfig = FileSystemWeightBroadcastConfig()
|
||||
"""Transport used to receive updated weights from the trainer."""
|
||||
|
||||
rollout_transport: TransportConfig = FileSystemTransportConfig()
|
||||
rollout_transport: TransportConfig = ZMQTransportConfig()
|
||||
"""Transport used to ship rollouts from orchestrator to trainer."""
|
||||
|
||||
output_dir: Path = Path("outputs/run_default")
|
||||
|
||||
@@ -22,6 +22,7 @@ from prime_rl.configs.shared import (
|
||||
EnvVars,
|
||||
FileMonitorConfig,
|
||||
SlurmConfig,
|
||||
TransportConfig,
|
||||
VLMConfig,
|
||||
)
|
||||
from prime_rl.configs.trainer import (
|
||||
@@ -260,6 +261,8 @@ class RLConfig(BaseConfig):
|
||||
|
||||
weight_broadcast: SharedWeightBroadcastConfig | None = None
|
||||
|
||||
rollout_transport: TransportConfig | None = None
|
||||
|
||||
bench: bool = False
|
||||
"""Benchmark mode. Sets trainer and orchestrator to benchmark mode and, when set, suffixes the W&B project with ``-bench``."""
|
||||
|
||||
@@ -419,6 +422,28 @@ class RLConfig(BaseConfig):
|
||||
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_rollout_transport(self):
|
||||
"""Resolve the shared ``rollout_transport`` from the sub-configs so the launcher can
|
||||
gate multi-node ZMQ host injection on it (mirrors ``auto_setup_weight_broadcast``).
|
||||
|
||||
``rollout_transport`` may be set either as the shared block (propagated down to both
|
||||
sub-configs by ``propagate_shared_fields``) or directly on
|
||||
``trainer.rollout_transport`` / ``orchestrator.rollout_transport`` (the documented
|
||||
fallback). Either way the shared field must reflect the resolved per-component
|
||||
transport, otherwise the launcher would leave ZMQ trainers connecting to localhost.
|
||||
"""
|
||||
if self.trainer.rollout_transport.type != self.orchestrator.rollout_transport.type:
|
||||
raise ValueError(
|
||||
"trainer.rollout_transport.type "
|
||||
f"({self.trainer.rollout_transport.type!r}) != orchestrator.rollout_transport.type "
|
||||
f"({self.orchestrator.rollout_transport.type!r}); set the shared [rollout_transport] "
|
||||
"block or make both sub-configs the same type."
|
||||
)
|
||||
if self.rollout_transport is None:
|
||||
self.rollout_transport = self.trainer.rollout_transport
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_eplb_requires_quantized_weight_transfer(self):
|
||||
if self.inference is None or not self.inference.enable_eplb:
|
||||
|
||||
@@ -322,8 +322,6 @@ class SFTConfig(BaseConfig):
|
||||
raise ValueError(
|
||||
"VLM models must use optimization_dtype='bfloat16' and reduce_dtype='bfloat16' to match vLLM inference."
|
||||
)
|
||||
if self.model.cp > 1 and self.model.cp_style != "ulysses":
|
||||
raise ValueError("VLM models require cp_style='ulysses' for context parallelism")
|
||||
if self.data.micro_batch_size != 1:
|
||||
raise ValueError("VLM SFT requires data.micro_batch_size = 1.")
|
||||
if self.val is not None and self.val.data.micro_batch_size != 1:
|
||||
|
||||
@@ -8,12 +8,12 @@ from prime_rl.configs.shared import (
|
||||
BaseModelConfig,
|
||||
EnvVars,
|
||||
FileMonitorConfig,
|
||||
FileSystemTransportConfig,
|
||||
HeartbeatConfig,
|
||||
MetricsServerConfig,
|
||||
TrainerLogConfig,
|
||||
TransportConfig,
|
||||
WandbConfig,
|
||||
ZMQTransportConfig,
|
||||
)
|
||||
from prime_rl.utils.config import BaseConfig
|
||||
|
||||
@@ -242,6 +242,12 @@ class ModelConfig(BaseModelConfig):
|
||||
raise ValueError("VLM training requires model.impl='custom'")
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def vlm_cp_requires_ulysses(self):
|
||||
if self.vlm is not None and self.cp > 1 and self.cp_style != "ulysses":
|
||||
raise ValueError("VLM models require cp_style='ulysses' for context parallelism")
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_cp(self):
|
||||
if self.cp > 1 and self.attn not in ["flash_attention_2", "flash_attention_3", "flash_attention_4", "auto"]:
|
||||
@@ -576,7 +582,7 @@ class TrainerConfig(BaseConfig):
|
||||
weight_broadcast: WeightBroadcastConfig = FileSystemWeightBroadcastConfig()
|
||||
"""Transport used to broadcast updated weights from trainer to inference."""
|
||||
|
||||
rollout_transport: TransportConfig = FileSystemTransportConfig()
|
||||
rollout_transport: TransportConfig = ZMQTransportConfig()
|
||||
"""Transport used to ship rollouts from orchestrator to trainer."""
|
||||
|
||||
log: TrainerLogConfig = TrainerLogConfig()
|
||||
|
||||
@@ -126,6 +126,9 @@ def propagate_shared_fields(data: Any) -> Any:
|
||||
"inference.model.chat_template",
|
||||
)
|
||||
|
||||
# [rollout_transport] → both sub-configs (host is launcher-injected for zmq multi-node).
|
||||
propagate("rollout_transport", "trainer.rollout_transport", "orchestrator.rollout_transport")
|
||||
|
||||
# Top-level scalars.
|
||||
propagate("max_steps", "trainer.max_steps", "orchestrator.max_steps")
|
||||
propagate("seq_len", "trainer.model.seq_len", "orchestrator.seq_len")
|
||||
|
||||
@@ -44,7 +44,8 @@ Incompatible combinations (e.g. CP requires flash attention) must raise in a `mo
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.agent.harness = { id = "null" }
|
||||
env.agent.runtime = { type = "subprocess" }
|
||||
```
|
||||
|
||||
CLI: `--orchestrator.train.env.0.env.taskset.id reverse-text-v1`.
|
||||
@@ -53,7 +54,7 @@ CLI: `--orchestrator.train.env.0.env.taskset.id reverse-text-v1`.
|
||||
|
||||
**Discriminated unions** — set the `type` field to pick the variant (`[orchestrator.algo] type = "max_rl"`). Omit `type` to keep the default variant.
|
||||
|
||||
**Algorithms** — `[orchestrator.algo] type = "grpo" | "max_rl" | "opd" | "opsd" | "sft" | "echo"` — the type names the algorithm (credit assignment + loss routing, fused), and each type's class defaults are its vetted setting; any other key you set is your own assembly (e.g. `[orchestrator.algo.roles.user] alpha = 0.1` for echo — setting any echo role replaces the whole role table). There is no preset layer, and no config hook that points at user code — a new algorithm is a named class in the repo (subclass `Algorithm`, register it). Per-env override: `[orchestrator.train.env.algo] type = "opd"` (the env assembles its own algorithm). prime-rl only hosts the trainable policy; frozen models are inline external endpoints on the algorithm, named where the model is used — `[orchestrator.algo.teacher]` for opd (the frozen model scored against), `[orchestrator.algo.sampling.source]` for sft (the model it samples from), each with `name` + `base_url`. There is no shared `teacher` slot. opsd declares no model — it self-distills against the live policy. See `docs/algorithms.md`.
|
||||
**Algorithms** — `[orchestrator.algo] type = "grpo" | "max_rl" | "rae" | "opd" | "opsd" | "sft" | "echo"` — the type names the algorithm (credit assignment + loss routing, fused), and each type's class defaults are its vetted setting; any other key you set is your own assembly (e.g. `[orchestrator.algo.roles.user] alpha = 0.1` for echo — setting any echo role replaces the whole role table). There is no preset layer, and no config hook that points at user code — a new algorithm is a named class in the repo (subclass `Algorithm`, register it). Per-env override: `[orchestrator.train.env.algo] type = "opd"` (the env assembles its own algorithm). prime-rl only hosts the trainable policy; frozen models are inline external endpoints on the algorithm, named where the model is used — `[orchestrator.algo.teacher]` for opd (the frozen model scored against), `[orchestrator.algo.sampling.source]` for sft (the model it samples from), each with `name` + `base_url`. There is no shared `teacher` slot. opsd declares no model — it self-distills against the live policy. See `docs/algorithms.md`.
|
||||
|
||||
**`BaseModel | None` fields** — bare flag enables defaults; nested override enables and sets:
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ jq '.rewards' {output_dir}/rollouts/step_42/train/effective/traces.jsonl
|
||||
jq 'select(.ok | not) | {id, env: .info.env_name, runtime}' {output_dir}/rollouts/step_*/train/all/traces.jsonl
|
||||
```
|
||||
|
||||
The binary batches consumed by the trainer still live at `{output_dir}/rollouts/step_N/train_rollouts.bin`, next to the trace subtrees.
|
||||
The batches consumed by the trainer are shipped over ZMQ by default, so nothing binary is written. With `rollout_transport.type = "filesystem"` they land at `{output_dir}/rollouts/step_N/train_rollouts.bin`, next to the trace subtrees.
|
||||
|
||||
### Common failure modes
|
||||
|
||||
|
||||
@@ -430,6 +430,7 @@ def write_slurm_script(config: RLConfig, config_dir: Path, script_path: Path) ->
|
||||
dp_per_node=config.deployment.gpus_per_node // config.inference.parallel.tp,
|
||||
**mooncake_vars,
|
||||
use_nccl_broadcast=config.weight_broadcast is not None and config.weight_broadcast.type == "nccl",
|
||||
use_zmq_transport=config.rollout_transport is not None and config.rollout_transport.type == "zmq",
|
||||
ranks_filter=",".join(map(str, config.trainer.log.ranks_filter)),
|
||||
orchestrator_on_inference=config.deployment.orchestrator_on_inference,
|
||||
)
|
||||
@@ -454,6 +455,7 @@ def write_slurm_script(config: RLConfig, config_dir: Path, script_path: Path) ->
|
||||
dp_per_node=(config.deployment.gpus_per_node // config.inference.parallel.tp) if config.inference else 1,
|
||||
**mooncake_vars,
|
||||
use_nccl_broadcast=config.weight_broadcast is not None and config.weight_broadcast.type == "nccl",
|
||||
use_zmq_transport=config.rollout_transport is not None and config.rollout_transport.type == "zmq",
|
||||
ranks_filter=",".join(map(str, config.trainer.log.ranks_filter)),
|
||||
orchestrator_on_inference=config.deployment.orchestrator_on_inference,
|
||||
trainer_env_vars=trainer_env_vars,
|
||||
|
||||
@@ -5,7 +5,7 @@ is — a bundle of sampling and the per-token training signal. This package
|
||||
turns the signal half into runtime objects (the sampling half is the env's
|
||||
:class:`~prime_rl.orchestrator.sampler.Sampler`):
|
||||
|
||||
- one module per algorithm (``grpo``, ``echo``, ``max_rl``, ``opd``,
|
||||
- one module per algorithm (``grpo``, ``echo``, ``max_rl``, ``rae``, ``opd``,
|
||||
``opsd``, ``sft``) — each named class owns its scoring hooks
|
||||
(``score_rollout`` / ``score_group``) and declares what it needs (loss
|
||||
component, a "teacher", ...). One instance per env, built by
|
||||
@@ -34,6 +34,7 @@ from prime_rl.orchestrator.algo.grpo import GRPOAlgorithm
|
||||
from prime_rl.orchestrator.algo.max_rl import MaxRLAlgorithm
|
||||
from prime_rl.orchestrator.algo.opd import OPDAlgorithm
|
||||
from prime_rl.orchestrator.algo.opsd import OPSDAlgorithm
|
||||
from prime_rl.orchestrator.algo.rae import RAEAlgorithm
|
||||
from prime_rl.orchestrator.algo.routing import stamp_advantages, stamp_loss_routing
|
||||
from prime_rl.orchestrator.algo.sft import SFTDistillAlgorithm
|
||||
from prime_rl.orchestrator.types import Rollout
|
||||
@@ -48,6 +49,7 @@ ALGORITHM_CLASSES: dict[str, type[Algorithm]] = {
|
||||
"grpo": GRPOAlgorithm,
|
||||
"echo": EchoAlgorithm,
|
||||
"max_rl": MaxRLAlgorithm,
|
||||
"rae": RAEAlgorithm,
|
||||
"opd": OPDAlgorithm,
|
||||
"opsd": OPSDAlgorithm,
|
||||
"sft": SFTDistillAlgorithm,
|
||||
@@ -72,6 +74,7 @@ __all__ = [
|
||||
"MaxRLAlgorithm",
|
||||
"OPDAlgorithm",
|
||||
"OPSDAlgorithm",
|
||||
"RAEAlgorithm",
|
||||
"Rollout",
|
||||
"SFTDistillAlgorithm",
|
||||
"build_algorithm",
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import defaultdict
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from prime_rl.configs.algorithm import RAEAlgoConfig
|
||||
from prime_rl.orchestrator.algo.base import Algorithm
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from prime_rl.orchestrator.types import Rollout
|
||||
from prime_rl.utils.client import InferencePool
|
||||
|
||||
|
||||
class RAEAlgorithm(Algorithm):
|
||||
"""Role-conditioned advantage estimation (SPIRAL, arXiv:2506.24119):
|
||||
credit = reward minus a per-agent EMA baseline of that agent's rewards.
|
||||
|
||||
The advantage estimator for multi-agent self-play envs (kuhn-poker-v1 and
|
||||
friends): in a zero-sum game the group mean is ~0 whatever the policy does,
|
||||
and centering all agents against it mixes their opposite reward scales — a
|
||||
structural first-mover edge would read as permanent credit for one agent.
|
||||
A per-agent baseline tracks each agent's own expected reward instead, so
|
||||
credit measures improvement over that agent's usual result. The instance is
|
||||
per-env, so baselines are keyed per (env, agent) — the paper's per
|
||||
(game, role). A single-agent env degrades to REINFORCE with an EMA baseline.
|
||||
|
||||
Each trace is scored against the baseline *before* its reward updates it
|
||||
(the reference implementation's unbiased order). Baselines start at 0 and
|
||||
live in orchestrator memory: a restart re-warms them over ~1/(1 − decay)
|
||||
traces per agent."""
|
||||
|
||||
def __init__(self, config: RAEAlgoConfig, policy_pool: InferencePool):
|
||||
super().__init__(config, policy_pool)
|
||||
self.decay = config.decay
|
||||
self.baselines: dict[str | None, float] = defaultdict(float)
|
||||
|
||||
async def score_group(self, group: list[Rollout]) -> None:
|
||||
for rollout in group:
|
||||
baseline = self.baselines[rollout.agent_name]
|
||||
rollout.assign_advantages(rollout.reward - baseline)
|
||||
self.baselines[rollout.agent_name] = self.decay * baseline + (1.0 - self.decay) * rollout.reward
|
||||
@@ -12,7 +12,7 @@ is flat over the rollout list except the solve rates, which group by ``group_id`
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Iterator, Literal
|
||||
from typing import TYPE_CHECKING, Any, Callable, Iterator, Literal
|
||||
|
||||
from prime_rl.orchestrator.utils import compute_pass_metrics
|
||||
|
||||
@@ -134,16 +134,20 @@ class TimingMetrics(StatGroup):
|
||||
|
||||
class CustomMetrics(StatGroup):
|
||||
"""Per-key ``Stat``s over a dynamic per-rollout dict attribute (env ``@metric``s or reward
|
||||
components), each averaged over the rollouts that report the key."""
|
||||
components), each averaged over the rollouts that report the key. ``value`` extracts the
|
||||
float from each entry (rewards are ``vf.Reward`` records; metrics are plain floats)."""
|
||||
|
||||
def __init__(self, rollouts: list[Rollout], attr: str) -> None:
|
||||
def __init__(self, rollouts: list[Rollout], attr: str, value: Callable[[Any], float] = float) -> None:
|
||||
super().__init__(rollouts)
|
||||
self.attr = attr
|
||||
self.value = value
|
||||
|
||||
def stats(self) -> dict[str, Stat]:
|
||||
names = sorted({name for r in self.rollouts for name in getattr(r, self.attr)})
|
||||
return {
|
||||
name: Stat([getattr(r, self.attr)[name] for r in self.rollouts if name in getattr(r, self.attr)])
|
||||
name: Stat(
|
||||
[self.value(getattr(r, self.attr)[name]) for r in self.rollouts if name in getattr(r, self.attr)]
|
||||
)
|
||||
for name in names
|
||||
}
|
||||
|
||||
@@ -188,8 +192,9 @@ class RolloutMetrics:
|
||||
|
||||
@property
|
||||
def rewards(self) -> CustomMetrics:
|
||||
"""Per-component reward breakdown, keyed by name (summed into the scalar ``reward``)."""
|
||||
return CustomMetrics(self.rollouts, "rewards")
|
||||
"""Per-component reward breakdown, keyed by name (each entry's weighted ``value``,
|
||||
summed into the scalar ``reward``)."""
|
||||
return CustomMetrics(self.rollouts, "rewards", value=lambda reward: reward.value)
|
||||
|
||||
# Boolean rate metrics (0/1 distributions — ``.mean()`` is the rate)
|
||||
@property
|
||||
|
||||
@@ -176,6 +176,8 @@ class Orchestrator:
|
||||
self.eval_triggered_at = {}
|
||||
self.consecutive_empty_batches = 0
|
||||
self.gate_closed_at = None
|
||||
# Pulsed by the version hooks so a held ship can re-check ``policy.version``
|
||||
self.version_advanced = asyncio.Event()
|
||||
self.wait_for_policy_time = 0.0
|
||||
self.component_tasks = []
|
||||
|
||||
@@ -602,6 +604,35 @@ class Orchestrator:
|
||||
f"({n_trainable / len(batch.rollouts):.1%}) — consider reviewing task difficulty / filter config"
|
||||
)
|
||||
|
||||
# Ship batch ``step`` only once the trainer has published v{step-1-TARGET_LAG}.
|
||||
# Without this, fast envs fill batches from buffered rollouts, the
|
||||
# orchestrator finishes early, and its teardown strands the trainer inside
|
||||
# an in-memory broadcast handshake that needs the live weight watcher.
|
||||
# Always satisfiable: the trainer skips only the final TARGET_LAG+1
|
||||
# in-memory broadcasts. Bench runs have no trainer, so they ship freely.
|
||||
required_version = step - 1 - TARGET_LAG
|
||||
if not config.bench and self.policy.version < required_version:
|
||||
get_logger().info(
|
||||
f"Holding batch {step} until the trainer publishes policy v{required_version} "
|
||||
f"(currently v{self.policy.version})"
|
||||
)
|
||||
hold_start = time.perf_counter()
|
||||
while True:
|
||||
self.version_advanced.clear()
|
||||
if self.policy.version >= required_version:
|
||||
break
|
||||
await self.version_advanced.wait()
|
||||
self.wait_for_policy_time += time.perf_counter() - hold_start
|
||||
|
||||
# Stamp each rollout's true staleness: batch ``step`` trains on policy
|
||||
# v{step-1}, so a rollout generated from v{k} is (step-1)-k versions
|
||||
# off-policy — queue time included, unlike the dispatcher's in-flight
|
||||
# counter, which only sees weight updates during generation. Frozen-
|
||||
# sourced rollouts stay 0 (their sampler doesn't follow the policy).
|
||||
for r in batch.rollouts:
|
||||
if self.train_envs.get(r.env_name).sampler.samples_from_live_policy:
|
||||
r.off_policy_steps = (step - 1) - r.policy_version
|
||||
|
||||
# The effective (clean, trained-on) subset lands in the per-step ``effective`` trace file
|
||||
# at ship time; the full arrival window already streamed into ``all`` on arrival.
|
||||
# to_record drops the per-node training tensors — they're for training, not the rollout
|
||||
@@ -905,11 +936,14 @@ class Orchestrator:
|
||||
gate.set()
|
||||
|
||||
async def on_version_pending(self, step: int) -> None:
|
||||
"""``VersionObserver`` hook, fired at publish confirmation (pre-apply):
|
||||
``policy.version`` already carries the new version, so wake a held ship."""
|
||||
if self.model_express is not None:
|
||||
await asyncio.to_thread(self.model_express.set_status, p2p_pb2.SOURCE_STATUS_READY)
|
||||
self.version_advanced.set()
|
||||
|
||||
async def on_new_version(self, step: int) -> None:
|
||||
"""``VersionObserver`` hook: the watcher just advanced ``policy.version``;
|
||||
"""``VersionObserver`` hook: the weight update completed;
|
||||
re-evaluate the dispatch gate (may resume if the trainer caught up)."""
|
||||
if self.model_express is not None:
|
||||
await asyncio.to_thread(self.model_express.set_status, p2p_pb2.SOURCE_STATUS_INITIALIZING)
|
||||
|
||||
@@ -64,6 +64,12 @@ class WeightWatcher:
|
||||
|
||||
async def stop(self) -> None:
|
||||
self.stopped.set()
|
||||
# Let an in-flight apply finish before dying: the trainer blocks inside
|
||||
# its in-memory broadcast until the apply completes, so cancelling
|
||||
# mid-apply would strand it. The orchestrator's global teardown budget
|
||||
# bounds this wait.
|
||||
async with self.update_lock:
|
||||
pass
|
||||
if self.task is not None:
|
||||
await safe_cancel(self.task)
|
||||
self.task = None
|
||||
@@ -103,6 +109,13 @@ class WeightWatcher:
|
||||
await wait_for_path(stable_marker)
|
||||
self.last_wait_for_ckpt_time = time.perf_counter() - t0
|
||||
|
||||
# Publish confirmed: the policy version advances here, before the
|
||||
# apply — inference pauses during the update, so nothing can generate
|
||||
# under the new number from the old weights, and a ship held on this
|
||||
# version releases without waiting out the inference weight reload.
|
||||
self.ckpt_step = next_step
|
||||
self.policy.version = next_step
|
||||
|
||||
# Drain off-policy rollouts BEFORE pausing the inference engines.
|
||||
# Aborting a rollout triggers vLLM's KV-connector cleanup (NIXL's
|
||||
# ``_reqs_not_processed``), which is only propagated to the workers
|
||||
@@ -128,8 +141,6 @@ class WeightWatcher:
|
||||
self.update_count += 1
|
||||
get_logger().debug(f"Updated weights to step {next_step} in {format_time(self.last_update_weights_time)}")
|
||||
|
||||
self.ckpt_step = next_step
|
||||
self.policy.version = next_step
|
||||
if self.lora_name is not None:
|
||||
self.inference.update_model_name(self.lora_name)
|
||||
self.policy.model_name = self.lora_name
|
||||
|
||||
@@ -407,7 +407,8 @@ else
|
||||
--local-ranks-filter={{ ranks_filter }} \
|
||||
-m prime_rl.trainer.rl.train \
|
||||
@ $CONFIG_DIR/trainer.toml \
|
||||
2>&1 | sed -u 's/^\[[a-zA-Z]*[0-9]*\]://' | tee -a $OUTPUT_DIR/logs/trainer/node_${TRAIN_NODE_RANK}.log &
|
||||
{% if use_zmq_transport %}--rollout_transport.host $MASTER_ADDR \
|
||||
{% endif %}2>&1 | sed -u 's/^\[[a-zA-Z]*[0-9]*\]://' | tee -a $OUTPUT_DIR/logs/trainer/node_${TRAIN_NODE_RANK}.log &
|
||||
{% if num_infer_nodes > 0 %} fi{% endif %}
|
||||
{% if num_infer_nodes > 0 %}
|
||||
# Launch the orchestrator on one node. Default is trainer rank 0 (SLURM_PROCID ==
|
||||
@@ -426,6 +427,7 @@ if [ "$SLURM_PROCID" -eq "$ORCH_PROCID" ]; then
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{% if use_nccl_broadcast %}ORCHESTRATOR_ARGS="$ORCHESTRATOR_ARGS --weight_broadcast.host $MASTER_ADDR"
|
||||
{% endif %}{% if use_zmq_transport %}ORCHESTRATOR_ARGS="$ORCHESTRATOR_ARGS --rollout_transport.host $MASTER_ADDR"
|
||||
{% endif %}WANDB_SHARED_LABEL=orchestrator uv run orchestrator $ORCHESTRATOR_ARGS \
|
||||
2>&1 | tee $OUTPUT_DIR/logs/orchestrator.log &
|
||||
fi
|
||||
|
||||
@@ -94,11 +94,25 @@ def _truncate_mm(
|
||||
return cut, sliced
|
||||
|
||||
|
||||
def multimodal_sample_error(sample: TrainingSample) -> str | None:
|
||||
mm_token_type_ids = sample.mm_token_type_ids
|
||||
if mm_token_type_ids is not None and len(mm_token_type_ids) != len(sample.token_ids):
|
||||
return (
|
||||
"mm_token_type_ids length must match token_ids length "
|
||||
f"({len(mm_token_type_ids)} != {len(sample.token_ids)})"
|
||||
)
|
||||
if sample.mm_kwargs is not None and "image_grid_thw" in sample.mm_kwargs and mm_token_type_ids is None:
|
||||
return "image_grid_thw multimodal samples require mm_token_type_ids"
|
||||
return None
|
||||
|
||||
|
||||
def prepare_sample(training_example: TrainingSample, seq_len: int) -> MicroBatch:
|
||||
"""
|
||||
Prepare a problem for sequence packing training.
|
||||
Tokenize and prepare tensors.
|
||||
"""
|
||||
if error := multimodal_sample_error(training_example):
|
||||
raise ValueError(error)
|
||||
input_ids = training_example.token_ids
|
||||
loss_mask = training_example.mask
|
||||
inference_logprobs = training_example.logprobs
|
||||
@@ -186,10 +200,6 @@ def prepare_sample(training_example: TrainingSample, seq_len: int) -> MicroBatch
|
||||
)
|
||||
assert len(routed_experts.data) == len(input_ids) * _routed_experts_row_size(routed_experts)
|
||||
|
||||
if mm_token_type_ids is not None:
|
||||
assert len(mm_token_type_ids) == len(input_ids), (
|
||||
f"mm_token_type_ids: {len(mm_token_type_ids)}, input_ids: {len(input_ids)}"
|
||||
)
|
||||
assert len(env_names) == len(input_ids), f"env_names: {len(env_names)}, input_ids: {len(input_ids)}"
|
||||
|
||||
return MicroBatch(
|
||||
@@ -230,17 +240,45 @@ class _MicroBatchBin:
|
||||
def first_sample(self) -> MicroBatch:
|
||||
return self.samples[0][1]
|
||||
|
||||
def can_add(self, sample: MicroBatch, max_seq_len: int) -> bool:
|
||||
@property
|
||||
def first_lora_idx(self) -> int:
|
||||
return self.samples[0][0]
|
||||
|
||||
@property
|
||||
def first_multimodal_sample(self) -> MicroBatch | None:
|
||||
for _, sample in self.samples:
|
||||
if _is_multimodal_sample(sample):
|
||||
return sample
|
||||
return None
|
||||
|
||||
def can_add(self, sample: MicroBatch, max_seq_len: int, lora_idx: int) -> bool:
|
||||
# Loss routing is per token (component weight streams), so samples of
|
||||
# different loss types pack together freely — only modality, length and
|
||||
# routed-experts presence constrain packing.
|
||||
# different loss types pack together freely. Multimodal packing is still
|
||||
# constrained by modality sidecars, length, routed experts, and LoRA/run.
|
||||
first_sample = self.first_sample
|
||||
return (
|
||||
not _is_multimodal_sample(first_sample)
|
||||
and not _is_multimodal_sample(sample)
|
||||
and self.length + len(sample.input_ids) <= max_seq_len
|
||||
and (first_sample.routed_experts is None) == (sample.routed_experts is None)
|
||||
)
|
||||
if self.length + len(sample.input_ids) > max_seq_len:
|
||||
return False
|
||||
if (first_sample.routed_experts is None) != (sample.routed_experts is None):
|
||||
return False
|
||||
|
||||
sample_is_mm = _is_multimodal_sample(sample)
|
||||
existing_mm_sample = self.first_multimodal_sample
|
||||
if existing_mm_sample is None and not sample_is_mm:
|
||||
return True
|
||||
if self.first_lora_idx != lora_idx:
|
||||
return False
|
||||
if existing_mm_sample is not None and sample_is_mm:
|
||||
dst = existing_mm_sample.mm_kwargs
|
||||
src = sample.mm_kwargs
|
||||
assert dst is not None and src is not None, "multimodal samples must carry mm_kwargs"
|
||||
return set(dst) == set(src) and all(
|
||||
dst[key].dtype == src[key].dtype
|
||||
and len(dst[key].shape) > 0
|
||||
and len(dst[key].shape) == len(src[key].shape)
|
||||
and dst[key].shape[1:] == src[key].shape[1:]
|
||||
for key in dst
|
||||
)
|
||||
return True
|
||||
|
||||
def add(self, lora_idx: int, sample: MicroBatch) -> None:
|
||||
self.samples.append((lora_idx, sample))
|
||||
@@ -285,6 +323,7 @@ def _materialize_bin(bin_content: _MicroBatchBin, num_loras: int) -> MicroBatch:
|
||||
env_names: list[str] = []
|
||||
ref_logprobs: list[float] | None = [] if has_ref_logprobs else None
|
||||
mm_token_type_ids: list[int] | None = [] if has_mm_token_type_ids else None
|
||||
mm_kwargs: dict[str, EncodedTensor] | None = None
|
||||
streams: dict[str, list[float] | None] = {name: ([] if has_stream[name] else None) for name in STREAM_FILL}
|
||||
seq_lens: list[int] = []
|
||||
routed_experts: RoutedExperts | None = None
|
||||
@@ -318,13 +357,19 @@ def _materialize_bin(bin_content: _MicroBatchBin, num_loras: int) -> MicroBatch:
|
||||
assert routed_experts.shape[1:] == sample.routed_experts.shape[1:]
|
||||
routed_experts.data += sample.routed_experts.data
|
||||
routed_experts.shape[0] += sample.routed_experts.shape[0]
|
||||
if sample.mm_kwargs is not None:
|
||||
if mm_kwargs is None:
|
||||
mm_kwargs = copy.deepcopy(sample.mm_kwargs)
|
||||
else:
|
||||
for key in mm_kwargs:
|
||||
mm_kwargs[key].data += sample.mm_kwargs[key].data
|
||||
mm_kwargs[key].shape[0] += sample.mm_kwargs[key].shape[0]
|
||||
seq_lens.extend(sample.seq_lens)
|
||||
lora_num_tokens[lora_idx] += sample_len
|
||||
|
||||
sequence_lengths = [len(sample.input_ids) for _, sample in bin_content.samples]
|
||||
assert sum(sequence_lengths) == len(input_ids), (sequence_lengths, len(input_ids))
|
||||
assert sum(seq_lens) == len(input_ids), (seq_lens, len(input_ids))
|
||||
first_sample = bin_content.first_sample
|
||||
|
||||
return MicroBatch(
|
||||
input_ids=input_ids,
|
||||
@@ -339,7 +384,7 @@ def _materialize_bin(bin_content: _MicroBatchBin, num_loras: int) -> MicroBatch:
|
||||
routed_experts=routed_experts,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
env_names=env_names,
|
||||
mm_kwargs=first_sample.mm_kwargs if _is_multimodal_sample(first_sample) else None,
|
||||
mm_kwargs=mm_kwargs,
|
||||
rl_weights=streams["rl_weights"],
|
||||
ce_weights=streams["ce_weights"],
|
||||
ref_kl_weights=streams["ref_kl_weights"],
|
||||
@@ -354,7 +399,7 @@ def _expand_bins_by_splitting(
|
||||
candidates = [
|
||||
(bin_content.workload(bin_cost), idx)
|
||||
for idx, bin_content in enumerate(bins)
|
||||
if len(bin_content.samples) > 1
|
||||
if len(bin_content.samples) > 1 and bin_content.first_multimodal_sample is None
|
||||
]
|
||||
if not candidates:
|
||||
break
|
||||
@@ -376,8 +421,9 @@ def packed_samples_into_micro_bs(
|
||||
We follow the First Fit Decreasing algorithm to pack the samples into bins and minimize potential padding while never truncating.
|
||||
With per-token temperatures, samples can be packed together regardless of their temperature values.
|
||||
|
||||
NOTE: Multimodal samples (with mm_kwargs) are NOT packed together as they have variable-sized
|
||||
vision data that doesn't pack well. Each multimodal sample becomes its own micro batch.
|
||||
Multimodal samples pack with text spans from the same run/LoRA and with
|
||||
compatible eager ``mm_kwargs`` samples. Packed batches preserve sample
|
||||
boundaries in ``seq_lens``.
|
||||
"""
|
||||
# Sort by (lora_idx, -length) for packing efficiency
|
||||
samples.sort(key=lambda x: (x[0], -len(x[1].input_ids)))
|
||||
@@ -385,9 +431,10 @@ def packed_samples_into_micro_bs(
|
||||
bins: list[_MicroBatchBin] = []
|
||||
|
||||
for idx, sample in samples:
|
||||
# Try to find a bin that can fit this sequence (only pack text-only samples)
|
||||
# Try to find a bin that can fit this sequence. Multimodal samples only
|
||||
# pack when their sidecar tensors are compatible.
|
||||
for bin_content in bins:
|
||||
if bin_content.can_add(sample, max_seq_len):
|
||||
if bin_content.can_add(sample, max_seq_len, idx):
|
||||
bin_content.add(idx, sample)
|
||||
break
|
||||
else:
|
||||
|
||||
@@ -937,7 +937,10 @@ def load_dcp_from_hf(model: nn.Module, config: ModelConfig, parallel_dims: Paral
|
||||
snapshot_keys = dict.fromkeys(load_state_dict_keys(source_path))
|
||||
model_keys = dict.fromkeys(model.state_dict().keys())
|
||||
|
||||
if model.is_hf_state_dict(snapshot_keys) and model.is_prime_state_dict(model_keys):
|
||||
snapshot_is_hf = model.is_hf_state_dict(snapshot_keys)
|
||||
snapshot_is_prime = model.is_prime_state_dict(snapshot_keys)
|
||||
|
||||
if snapshot_is_hf and not snapshot_is_prime and model.is_prime_state_dict(model_keys):
|
||||
logger.warning(
|
||||
"Found HF weight format in snapshot state dict and PrimeRL weight format in model state dict. Trying to auto-convert..."
|
||||
)
|
||||
@@ -951,7 +954,7 @@ def load_dcp_from_hf(model: nn.Module, config: ModelConfig, parallel_dims: Paral
|
||||
save_state_dict(snapshot_state_dict, snapshot_path)
|
||||
del snapshot_state_dict
|
||||
|
||||
elif model.is_prime_state_dict(snapshot_keys) and model.is_hf_state_dict(model_keys):
|
||||
elif snapshot_is_prime and not snapshot_is_hf and model.is_hf_state_dict(model_keys):
|
||||
logger.warning(
|
||||
"Found PrimeRL weight format in snapshot state dict and HF weight format in model state dict. Trying to auto-convert..."
|
||||
)
|
||||
|
||||
@@ -124,8 +124,10 @@ class LlamaPreTrainedModel(PreTrainedModelPrimeRL):
|
||||
|
||||
@classmethod
|
||||
def is_prime_state_dict(cls, state_dict: dict[str, Tensor]) -> bool:
|
||||
"""Check if the state dict is in PrimeRL training format."""
|
||||
return True
|
||||
# Dense models use identical key names in HF and PrimeRL format, so we
|
||||
# never claim to be in a separate PrimeRL format. This disables the
|
||||
# auto-conversion path in load_dcp_from_hf and lets DCP load directly.
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def convert_to_hf(cls, state_dict: dict[str, Tensor]) -> dict[str, Tensor]:
|
||||
|
||||
@@ -107,7 +107,10 @@ class Qwen3PreTrainedModel(PreTrainedModelPrimeRL):
|
||||
|
||||
@classmethod
|
||||
def is_prime_state_dict(cls, state_dict: dict[str, Tensor]) -> bool:
|
||||
return True
|
||||
# Dense models use identical key names in HF and PrimeRL format, so we
|
||||
# never claim to be in a separate PrimeRL format. This disables the
|
||||
# auto-conversion path in load_dcp_from_hf and lets DCP load directly.
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def convert_to_hf(cls, state_dict: dict[str, Tensor]) -> dict[str, Tensor]:
|
||||
|
||||
@@ -160,7 +160,10 @@ class Qwen3_5PreTrainedModel(PreTrainedModelPrimeRL, HFQwen3_5PreTrainedModel):
|
||||
|
||||
@classmethod
|
||||
def is_prime_state_dict(cls, state_dict: dict[str, Tensor]) -> bool:
|
||||
return True
|
||||
# Dense models use identical key names in HF and PrimeRL format, so we
|
||||
# never claim to be in a separate PrimeRL format. This disables the
|
||||
# auto-conversion path in load_dcp_from_hf and lets DCP load directly.
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def convert_to_hf(cls, state_dict: dict[str, Tensor]) -> dict[str, Tensor]:
|
||||
@@ -371,6 +374,7 @@ class Qwen3_5ForCausalLM(Qwen3_5PreTrainedModel, GenerationMixin):
|
||||
def __init__(self, config, **kwargs):
|
||||
super().__init__(config, **kwargs)
|
||||
self._is_vlm = hasattr(config, "vision_config")
|
||||
self.supports_packed_multimodal_training = self._is_vlm
|
||||
|
||||
if self._is_vlm:
|
||||
self.model = Qwen3_5VLMModel(config)
|
||||
|
||||
@@ -892,6 +892,7 @@ class Qwen3_5MoeForCausalLM(Qwen3_5MoePreTrainedModel, GenerationMixin):
|
||||
def __init__(self, config, **kwargs):
|
||||
super().__init__(config, **kwargs)
|
||||
self._is_vlm = hasattr(config, "vision_config")
|
||||
self.supports_packed_multimodal_training = self._is_vlm
|
||||
|
||||
if self._is_vlm:
|
||||
self.model = Qwen3_5MoeVLMModel(config)
|
||||
|
||||
@@ -92,9 +92,10 @@ def is_view_of(value: torch.Tensor, root: torch.Tensor) -> bool:
|
||||
def plan_tensor_replay(shape: tuple[int, ...], dtype: torch.dtype, ops: OperationChain) -> TensorReplayPlan:
|
||||
"""Resolve a directly transferable source view and local replay suffix.
|
||||
|
||||
The prefix must remain a same-dtype view of the trainer root and can
|
||||
therefore be addressed by RDMA. The first materializing or dtype-changing
|
||||
operation and everything after it is replayed on the receive arena.
|
||||
The prefix must remain a contiguous, same-dtype view of the trainer root
|
||||
and can therefore be transferred in large RDMA runs. The first strided,
|
||||
materializing, or dtype-changing operation and everything after it is
|
||||
replayed on the receive arena.
|
||||
"""
|
||||
root = torch.empty(shape, dtype=dtype, device="meta")
|
||||
prefix_len = 0
|
||||
@@ -105,7 +106,7 @@ def plan_tensor_replay(shape: tuple[int, ...], dtype: torch.dtype, ops: Operatio
|
||||
if candidate_len < len(ops) and ops[candidate_len].name == "tuple_getitem":
|
||||
continue
|
||||
candidate = apply_chain(root, ops[:candidate_len])
|
||||
if candidate.dtype != dtype or not is_view_of(candidate, root):
|
||||
if candidate.dtype != dtype or not is_view_of(candidate, root) or not candidate.is_contiguous():
|
||||
break
|
||||
prefix_len = candidate_len
|
||||
source_view = candidate
|
||||
|
||||
@@ -6,7 +6,7 @@ from abc import ABC, abstractmethod
|
||||
from collections import deque
|
||||
from collections.abc import Callable, Sequence
|
||||
|
||||
from prime_rl.trainer.batch import prepare_batch
|
||||
from prime_rl.trainer.batch import multimodal_sample_error, prepare_batch
|
||||
from prime_rl.trainer.runs import get_multi_run_manager
|
||||
from prime_rl.transport import (
|
||||
MicroBatch,
|
||||
@@ -177,6 +177,8 @@ class MultiPacker(BasePacker):
|
||||
False,
|
||||
f"Run wrote a sample with ref logprobs length != sample length ({len(sample.ref_logprobs)} != {sample_length})",
|
||||
)
|
||||
if error := multimodal_sample_error(sample):
|
||||
return False, error
|
||||
return True, None
|
||||
|
||||
def _get_batch(self) -> None:
|
||||
|
||||
@@ -10,6 +10,7 @@ from torch import Tensor
|
||||
|
||||
from prime_rl.configs.trainer import DefaultLossConfig, TrainerConfig
|
||||
from prime_rl.trainer.rl.loss import compute_importance_ratio_and_mismatch_kl
|
||||
from prime_rl.utils.logger import get_logger
|
||||
|
||||
SCHEMA_VERSION = 1
|
||||
|
||||
@@ -93,7 +94,12 @@ class TokenExporter:
|
||||
ready_run_ids = ready_run_ids or set()
|
||||
for run_id in [rid for rid in self._pending_stable_dirs if rid is None or rid in ready_run_ids]:
|
||||
for stable_dir in self._pending_stable_dirs.pop(run_id):
|
||||
(stable_dir / "STABLE").touch()
|
||||
try:
|
||||
(stable_dir / "STABLE").touch()
|
||||
except FileNotFoundError:
|
||||
# A multi-run run dir can be deleted while its tail steps are
|
||||
# still flushing (mirrors the broadcast paths' guard)
|
||||
get_logger().warning(f"Run dir for {run_id} is deleted, skipping token-export STABLE marker")
|
||||
|
||||
def _export_dir(self, export_step: int, run_id: str | None) -> Path:
|
||||
if run_id is not None:
|
||||
|
||||
@@ -154,6 +154,9 @@ def train(config: TrainerConfig):
|
||||
logger.info(f"Initializing tokenizer ({config.tokenizer})")
|
||||
tokenizer = setup_tokenizer(config.tokenizer)
|
||||
|
||||
if config.model.vlm is not None and not getattr(model, "supports_packed_multimodal_training", False):
|
||||
raise ValueError("Packed multimodal training requires model support")
|
||||
|
||||
# Set up the loss function for the RL loss type (ce / ref_kl are fixed)
|
||||
logger.info(f"Setting up loss function ({config.loss})")
|
||||
rl_loss_fn = setup_rl_loss_fn(config.loss)
|
||||
@@ -368,6 +371,11 @@ def train(config: TrainerConfig):
|
||||
# tensor to CUDA and let the model's forward sort them.
|
||||
mm_kwargs_raw = micro_batch.get("mm_kwargs")
|
||||
mm_kwargs = {k: v.to("cuda") for k, v in mm_kwargs_raw.items()} if mm_kwargs_raw else None
|
||||
if mm_kwargs is not None and config.model.vlm is None:
|
||||
raise ValueError(
|
||||
"Received multimodal samples but [model.vlm] is not set. "
|
||||
"Set [model.vlm] to train on multimodal samples."
|
||||
)
|
||||
mm_token_type_ids = (
|
||||
micro_batch["mm_token_type_ids"].to("cuda")
|
||||
if micro_batch.get("mm_token_type_ids") is not None
|
||||
@@ -378,30 +386,30 @@ def train(config: TrainerConfig):
|
||||
|
||||
labels = shift_tensor_left(input_ids)
|
||||
|
||||
# VLM + CP is not supported: MRoPE requires global positions but CP shards the sequence
|
||||
if cp_enabled and mm_kwargs is not None:
|
||||
raise NotImplementedError("Context parallelism is not supported with VLM/multimodal training")
|
||||
seq_lens_are_pre_shard = False
|
||||
|
||||
if cp_enabled:
|
||||
input_ids, forward_position_ids = setup_cp_params(
|
||||
input_ids,
|
||||
position_ids,
|
||||
cp_rank,
|
||||
cp_size,
|
||||
cp_group,
|
||||
seq_lens=seq_lens,
|
||||
cp_style=config.model.cp_style,
|
||||
)
|
||||
# MRoPE batches must merge image embeddings before sharding.
|
||||
defer_vlm_cp_to_model = mm_kwargs is not None and "image_grid_thw" in mm_kwargs
|
||||
if not defer_vlm_cp_to_model:
|
||||
input_ids, position_ids = setup_cp_params(
|
||||
input_ids,
|
||||
position_ids,
|
||||
cp_rank,
|
||||
cp_size,
|
||||
cp_group,
|
||||
seq_lens=seq_lens,
|
||||
cp_style=config.model.cp_style,
|
||||
)
|
||||
seq_lens_are_pre_shard = True
|
||||
labels = shard_for_cp(labels, cp_rank=cp_rank, cp_world_size=cp_size)
|
||||
if routed_experts is not None:
|
||||
if routed_experts is not None and not defer_vlm_cp_to_model:
|
||||
routed_experts = shard_for_cp(routed_experts, cp_rank=cp_rank, cp_world_size=cp_size)
|
||||
else:
|
||||
forward_position_ids = position_ids
|
||||
|
||||
if config.model.lora:
|
||||
lora_num_tokens = micro_batch["lora_num_tokens"].to("cuda")
|
||||
if cp_enabled:
|
||||
chunk_size = input_ids.shape[1]
|
||||
chunk_size = labels.shape[1]
|
||||
# Convert to cumsum, adjust for CP chunk, convert back to num_tokens
|
||||
cu_offsets = lora_num_tokens.cumsum(dim=0, dtype=torch.int32)
|
||||
adjusted_cu = torch.clip(cu_offsets - chunk_size * cp_rank, min=0, max=chunk_size)
|
||||
@@ -421,13 +429,13 @@ def train(config: TrainerConfig):
|
||||
out = forward(
|
||||
model,
|
||||
input_ids,
|
||||
forward_position_ids,
|
||||
position_ids,
|
||||
labels=labels,
|
||||
temperature=temperatures,
|
||||
mm_kwargs=mm_kwargs,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
seq_lens=seq_lens,
|
||||
seq_lens_are_pre_shard=cp_enabled,
|
||||
seq_lens_are_pre_shard=seq_lens_are_pre_shard,
|
||||
routed_experts=routed_experts,
|
||||
)
|
||||
|
||||
|
||||
@@ -328,10 +328,11 @@ ROWS = 6
|
||||
|
||||
|
||||
def line_panels(metrics: Sequence[str], regexes: Sequence[str]) -> list[wr.LinePlot]:
|
||||
# inference/* is logged against wall time (step_metric="_timestamp") → "WallTime" (== W&B's
|
||||
# "_timestamp"); everything else on "step" (prime-rl's logged training step, not internal "Step").
|
||||
# inference/* is logged against time (step_metric="_timestamp"), plotted on "RelativeTime(Wall)"
|
||||
# (== W&B's "_absolute_runtime", seconds since run start) so runs started at different times
|
||||
# overlay; everything else on "step" (prime-rl's logged training step, not internal "Step").
|
||||
# x is set per-panel because LinePlot defaults it to "Step", which overrides the workspace x_axis.
|
||||
return [wr.LinePlot(x="WallTime" if m.startswith("inference/") else "step", y=[m]) for m in metrics] + [
|
||||
return [wr.LinePlot(x="RelativeTime(Wall)" if m.startswith("inference/") else "step", y=[m]) for m in metrics] + [
|
||||
wr.LinePlot(x="step", metric_regex=r) for r in regexes
|
||||
]
|
||||
|
||||
@@ -395,15 +396,11 @@ def list_views(entity: str, project: str) -> list[tuple[str, str]]:
|
||||
return [(e["node"]["displayName"], e["node"]["name"]) for e in edges if e.get("node")]
|
||||
|
||||
|
||||
def env_signature(train_envs: Sequence[str], eval_envs: Sequence[str]) -> tuple:
|
||||
return (tuple(sorted(train_envs)), tuple(sorted(eval_envs)))
|
||||
|
||||
|
||||
def view_env_signature(sections: Sequence[ws.Section]) -> tuple:
|
||||
"""Reconstruct the ``(train, eval)`` env set a view was built for from its section names."""
|
||||
def view_signature(sections: Sequence[ws.Section]) -> tuple:
|
||||
train = sorted(s.name[len("train/") :] for s in sections if s.name.startswith("train/") and s.name != "train/agg")
|
||||
evals = sorted(s.name[len("eval/") :] for s in sections if s.name.startswith("eval/"))
|
||||
return (tuple(train), tuple(evals))
|
||||
axes = {getattr(p.x, "name", p.x) for s in sections for p in s.panels if isinstance(p, wr.LinePlot)}
|
||||
return (tuple(train), tuple(evals), tuple(sorted(axes)))
|
||||
|
||||
|
||||
def next_overview_name(base: str, existing: Sequence[str]) -> str:
|
||||
@@ -424,13 +421,14 @@ def ensure_overview_view(
|
||||
"""Ensure an overview saved view exists for this run's env set. Reuses an existing overview built
|
||||
for the same envs; when the env set is new, creates a fresh versioned view (``overview`` →
|
||||
``overview-v2`` → …). Returns the URL of a newly created view, else None."""
|
||||
target = env_signature(train_envs, eval_envs)
|
||||
sections = build_sections(train_envs, eval_envs)
|
||||
target = view_signature(sections)
|
||||
overviews = [(dn, iname) for dn, iname in list_views(entity, project) if dn == name or dn.startswith(f"{name}-v")]
|
||||
for _, internal_name in overviews:
|
||||
slug = internal_name.removeprefix("nw-").removesuffix("-v")
|
||||
try:
|
||||
existing = ws.Workspace.from_url(f"https://wandb.ai/{entity}/{project}?nw={slug}")
|
||||
matches = view_env_signature(existing.sections) == target
|
||||
matches = view_signature(existing.sections) == target
|
||||
except Exception as e:
|
||||
# A single unreadable view must not abort reuse detection / versioning for the rest.
|
||||
get_logger().warning(f"Could not inspect overview view {internal_name} - {e}")
|
||||
@@ -441,7 +439,7 @@ def ensure_overview_view(
|
||||
entity=entity,
|
||||
project=project,
|
||||
name=next_overview_name(name, [dn for dn, _ in overviews]),
|
||||
sections=build_sections(train_envs, eval_envs),
|
||||
sections=sections,
|
||||
auto_generate_panels=False,
|
||||
settings=ws.WorkspaceSettings(x_axis="step"),
|
||||
)
|
||||
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
@@ -74,11 +73,11 @@ def branch_name() -> str:
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def output_dir(tmp_path_factory: pytest.TempPathFactory) -> Generator[Path, None, None]:
|
||||
"""Fixture for temporary output directory for tests with automatic cleanup"""
|
||||
"""Fixture for the tests' output directory. Never deleted — CI uploads run logs
|
||||
from it on failure; runs start with ``--clean-output-dir`` for a fresh workspace."""
|
||||
output_dir = Path(os.environ.get("PYTEST_OUTPUT_DIR", tmp_path_factory.mktemp("outputs")))
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
yield output_dir
|
||||
shutil.rmtree(output_dir, ignore_errors=True)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
||||
@@ -38,6 +38,7 @@ def rl_process(
|
||||
"rl",
|
||||
"@",
|
||||
"configs/ci/integration/alphabet_sort.toml",
|
||||
"--clean-output-dir",
|
||||
"--wandb.project",
|
||||
wandb_project,
|
||||
"--wandb.name",
|
||||
|
||||
@@ -29,6 +29,7 @@ def rl_process(
|
||||
"rl",
|
||||
"@",
|
||||
"configs/ci/integration/reverse-text-moe/start.toml",
|
||||
"--clean-output-dir",
|
||||
"--trainer.model.impl",
|
||||
"custom",
|
||||
"--wandb.project",
|
||||
|
||||
@@ -20,6 +20,17 @@ TIMEOUT = 600 # 10 minutes (was 300s — too tight when 3 concurrent orchestrat
|
||||
ORCHESTRATOR_NAMES = ["alpha", "beta", "gamma"]
|
||||
|
||||
|
||||
def remove_run_dir(run_dir: Path) -> None:
|
||||
"""Delete a run dir, tolerating the shared trainer still flushing its tail
|
||||
(token exports recreate directories mid-rmtree -> 'Directory not empty')."""
|
||||
for _ in range(10):
|
||||
shutil.rmtree(run_dir, ignore_errors=True)
|
||||
if not run_dir.exists():
|
||||
return
|
||||
time.sleep(1)
|
||||
shutil.rmtree(run_dir)
|
||||
|
||||
|
||||
def wait_for_file(
|
||||
file_path: Path,
|
||||
timeout: int = 600,
|
||||
@@ -274,7 +285,7 @@ def multi_run_result(
|
||||
print(f"Copied alpha checkpoint to {tmp_path / 'alpha_ckpt_step_10'}")
|
||||
|
||||
# Remove alpha run directory
|
||||
shutil.rmtree(output_dir / "run_alpha")
|
||||
remove_run_dir(output_dir / "run_alpha")
|
||||
|
||||
# ===========================
|
||||
# Queue alpha's resume proc
|
||||
@@ -305,7 +316,7 @@ def multi_run_result(
|
||||
shutil.copy(run_dir / "logs" / "orchestrator.log", log_dir / "beta_orchestrator.log")
|
||||
shutil.copytree(beta_ckpt_dir, tmp_path / "beta_ckpt_step_20")
|
||||
print(f"Copied {beta_ckpt_dir} to {tmp_path / 'beta_ckpt_step_20'}")
|
||||
shutil.rmtree(run_dir)
|
||||
remove_run_dir(run_dir)
|
||||
|
||||
# =====================
|
||||
# Queue beta's resume
|
||||
@@ -329,7 +340,7 @@ def multi_run_result(
|
||||
timeout=TIMEOUT,
|
||||
)
|
||||
shutil.copy(output_dir / "run_gamma" / "logs" / "orchestrator.log", log_dir / "gamma_orchestrator.log")
|
||||
shutil.rmtree(output_dir / "run_gamma")
|
||||
remove_run_dir(output_dir / "run_gamma")
|
||||
|
||||
# ================================================
|
||||
# Wait for alpha_resume and beta_resume to finish
|
||||
|
||||
@@ -101,7 +101,7 @@ def _build_rollout(
|
||||
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
|
||||
nodes=nodes,
|
||||
calls=calls,
|
||||
rewards={"reward": reward},
|
||||
rewards={"reward": vf.Reward(score=reward)},
|
||||
metrics=metrics or {},
|
||||
)
|
||||
rollout.env_name = env_name
|
||||
|
||||
@@ -258,7 +258,7 @@ def _two_turn_rollout(observation_role: str = "tool") -> Rollout:
|
||||
rollout = Rollout(
|
||||
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
|
||||
nodes=nodes,
|
||||
rewards={"r": 1.0},
|
||||
rewards={"r": vf.Reward(score=1.0)},
|
||||
env_name="test-env",
|
||||
)
|
||||
rollout.samples = trace_to_samples(rollout, env_name="test-env")
|
||||
@@ -309,7 +309,7 @@ def test_echo_weights_only_content_tokens_when_is_content_present():
|
||||
rollout = Rollout(
|
||||
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt=None)),
|
||||
nodes=nodes,
|
||||
rewards={"r": 1.0},
|
||||
rewards={"r": vf.Reward(score=1.0)},
|
||||
env_name="test-env",
|
||||
)
|
||||
rollout.samples = trace_to_samples(rollout, env_name="test-env")
|
||||
|
||||
@@ -448,6 +448,51 @@ def test_prepare_sample_truncates_mm_at_image_boundary():
|
||||
assert n_placeholders == mb.mm_kwargs["pixel_values"].shape[0] # ppt == 1 here
|
||||
|
||||
|
||||
def test_prepare_batch_packs_multimodal_with_text():
|
||||
mm_sample = TrainingSample(
|
||||
token_ids=[10, 11, 12],
|
||||
mask=[False, True, True],
|
||||
logprobs=[0.0, -0.1, -0.2],
|
||||
temperatures=[1.0, 1.0, 1.0],
|
||||
advantages=[0.0, 1.0, 1.0],
|
||||
env_name="mm-env",
|
||||
mm_token_type_ids=[0, 1, 0],
|
||||
mm_kwargs={
|
||||
"pixel_values": _encoded(np.array([[1.0, 2.0]], dtype=np.float32)),
|
||||
"image_grid_thw": _encoded(np.array([[1, 2, 2]], dtype=np.int64)),
|
||||
},
|
||||
)
|
||||
text_sample = TrainingSample(
|
||||
token_ids=[20, 21],
|
||||
mask=[False, True],
|
||||
logprobs=[0.0, -0.3],
|
||||
temperatures=[0.7, 0.7],
|
||||
advantages=[0.0, 1.0],
|
||||
env_name="text-env",
|
||||
)
|
||||
|
||||
batches_per_gpu = prepare_batch(
|
||||
rollouts=[mm_sample, text_sample],
|
||||
seq_len=8,
|
||||
num_train_workers=2,
|
||||
idxs=[0, 0],
|
||||
num_loras=1,
|
||||
bin_cost=build_bin_cost(None),
|
||||
)
|
||||
|
||||
real_batches = [batch for batch in _flatten_batches(batches_per_gpu) if _has_loss_tokens(batch)]
|
||||
assert len(real_batches) == 1
|
||||
batch = real_batches[0]
|
||||
assert batch.seq_lens == [3, 2]
|
||||
assert batch.sequence_lengths == [3, 2]
|
||||
assert batch.position_ids == [0, 1, 2, 0, 1]
|
||||
assert batch.mm_token_type_ids == [0, 1, 0, 0, 0]
|
||||
assert batch.mm_kwargs is not None
|
||||
assert batch.mm_kwargs["pixel_values"].shape == [1, 2]
|
||||
assert batch.mm_kwargs["image_grid_thw"].shape == [1, 3]
|
||||
assert batch.env_names == ["mm-env"] * 3 + ["text-env"] * 2
|
||||
|
||||
|
||||
def test_prepare_sample_none_routed_experts():
|
||||
"""When routed_experts is None, micro_batch.routed_experts is None."""
|
||||
sample = TrainingSample(
|
||||
|
||||
@@ -58,7 +58,9 @@ def _make_rollout(
|
||||
else:
|
||||
nodes = [_assistant_node(completion_ids, completion_logprobs)]
|
||||
rollout = Rollout[vf.TaskData](
|
||||
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt="")), nodes=nodes, rewards={"reward": reward}
|
||||
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt="")),
|
||||
nodes=nodes,
|
||||
rewards={"reward": vf.Reward(score=reward)},
|
||||
)
|
||||
rollout.env_name = "test"
|
||||
rollout.group_id = uuid.uuid4()
|
||||
@@ -140,7 +142,7 @@ def test_gibberish_aligns_logprobs_under_generation_prompt_scaffold():
|
||||
rollout = Rollout[vf.TaskData](
|
||||
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=0, prompt="")),
|
||||
nodes=[_scaffold_assistant_node([50, 80, 120_000], [-1.0, -0.5, gibberish_filter.logprob_threshold - 1.0])],
|
||||
rewards={"reward": 1.0},
|
||||
rewards={"reward": vf.Reward(score=1.0)},
|
||||
)
|
||||
|
||||
result = gibberish_filter.check(rollout)
|
||||
|
||||
@@ -2,6 +2,7 @@ import math
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
import verifiers.v1 as vf
|
||||
|
||||
from prime_rl.orchestrator.metrics import EvalRollouts, Stat, TrainRollouts
|
||||
from prime_rl.orchestrator.utils import compute_pass_metrics
|
||||
@@ -141,8 +142,8 @@ def test_stop_condition_breakdown():
|
||||
|
||||
def test_nested_metrics_and_rewards():
|
||||
rollouts = [
|
||||
mk(metrics={"acc": 1.0}, rewards={"correct": 1.0, "format": 0.0}),
|
||||
mk(metrics={"acc": 3.0, "fmt": 5.0}, rewards={"correct": 0.0, "format": 1.0}),
|
||||
mk(metrics={"acc": 1.0}, rewards={"correct": vf.Reward(score=1.0), "format": vf.Reward(score=0.0)}),
|
||||
mk(metrics={"acc": 3.0, "fmt": 5.0}, rewards={"correct": vf.Reward(score=0.0), "format": vf.Reward(score=1.0)}),
|
||||
]
|
||||
m = TrainRollouts(rollouts).metrics
|
||||
assert m.metrics["acc"].mean() == 2.0 and m.rewards["correct"].mean() == 0.5 # nested group access
|
||||
|
||||
@@ -268,6 +268,24 @@ def test_orchestrator_vlm_requires_renderer():
|
||||
assert config.renderer is not None
|
||||
|
||||
|
||||
def test_trainer_rejects_vlm_cp_with_ring():
|
||||
config = {
|
||||
"model": {
|
||||
"cp": 2,
|
||||
"impl": "custom",
|
||||
"optimization_dtype": "bfloat16",
|
||||
"reduce_dtype": "bfloat16",
|
||||
"vlm": {
|
||||
"vision_encoder_attr": "model.visual",
|
||||
"language_model_attr": "model.language_model",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
with pytest.raises(ValidationError, match="cp_style='ulysses'"):
|
||||
TrainerConfig.model_validate(config)
|
||||
|
||||
|
||||
def test_selective_activation_checkpointing_requires_custom_impl():
|
||||
with pytest.raises(ValidationError, match="Selective activation checkpointing requires model.impl='custom'"):
|
||||
TrainerModelConfig.model_validate({"impl": "hf", "ac": {"mode": "selective"}})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from pathlib import Path
|
||||
from typing import Generator
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
import tomli_w
|
||||
import torch
|
||||
@@ -12,7 +13,7 @@ from prime_rl.trainer.rl.packer import MultiPacker
|
||||
from prime_rl.trainer.runs import setup_multi_run_manager
|
||||
from prime_rl.trainer.utils import build_bin_cost
|
||||
from prime_rl.trainer.world import reset_world
|
||||
from prime_rl.transport.types import TrainingSample
|
||||
from prime_rl.transport.types import EncodedTensor, TrainingSample
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, scope="module")
|
||||
@@ -52,6 +53,66 @@ def make_training_sample() -> TrainingSample:
|
||||
)
|
||||
|
||||
|
||||
def _encoded_tensor(data, dtype) -> EncodedTensor:
|
||||
arr = np.asarray(data, dtype=dtype)
|
||||
return EncodedTensor(dtype=str(arr.dtype), shape=list(arr.shape), data=arr.tobytes())
|
||||
|
||||
|
||||
def _decode_encoded_tensor(encoded: EncodedTensor):
|
||||
return np.frombuffer(encoded.data, dtype=np.dtype(encoded.dtype)).reshape(encoded.shape).tolist()
|
||||
|
||||
|
||||
def _mm_sample(value: float, env_name: str = "test-env") -> TrainingSample:
|
||||
return TrainingSample(
|
||||
token_ids=[1, 250, 2],
|
||||
mask=[False, True, True],
|
||||
logprobs=[0.0, -0.1, -0.2],
|
||||
temperatures=[1.0, 1.0, 1.0],
|
||||
env_name=env_name,
|
||||
advantages=[0.0, 1.0, 1.0],
|
||||
mm_token_type_ids=[0, 1, 0],
|
||||
mm_kwargs={
|
||||
"pixel_values": _encoded_tensor([[value, value + 1]], np.float32),
|
||||
"image_grid_thw": _encoded_tensor([[1, 2, 2]], np.int64),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def _packer_with_two_runs(tmp_path, monkeypatch, dp_world_size, seq_len):
|
||||
"""Set up a MultiPacker over two discovered runs; capture sent grids."""
|
||||
reset_world()
|
||||
runs._MULTI_RUN_MANAGER = None
|
||||
manager = setup_multi_run_manager(output_dir=tmp_path, max_runs=2, device=torch.device("cpu"))
|
||||
create_run_with_config(tmp_path, "run_a")
|
||||
create_run_with_config(tmp_path, "run_b")
|
||||
manager.discover_runs()
|
||||
|
||||
sent: list = []
|
||||
|
||||
class DummyReceiver:
|
||||
def receive(self):
|
||||
return []
|
||||
|
||||
def reset_run(self, idx):
|
||||
pass
|
||||
|
||||
class DummySender:
|
||||
def send(self, micro_batch_grid):
|
||||
sent.append(micro_batch_grid)
|
||||
|
||||
monkeypatch.setattr("prime_rl.trainer.rl.packer.setup_training_batch_receiver", lambda _c: DummyReceiver())
|
||||
monkeypatch.setattr("prime_rl.trainer.rl.packer.setup_micro_batch_sender", lambda *a, **k: DummySender())
|
||||
packer = MultiPacker(
|
||||
dp_world_size=dp_world_size,
|
||||
seq_len=seq_len,
|
||||
pad_to_multiple_of=1,
|
||||
config=FileSystemTransportConfig(),
|
||||
bin_cost=build_bin_cost(None),
|
||||
start_step=0,
|
||||
)
|
||||
return manager, packer, sent
|
||||
|
||||
|
||||
def test_packer_progress_updates_once_per_run(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
reset_world()
|
||||
runs._MULTI_RUN_MANAGER = None
|
||||
@@ -114,3 +175,67 @@ def test_packer_progress_updates_once_per_run(tmp_path: Path, monkeypatch: pytes
|
||||
micro_batch = sender.sent[0][0][0]
|
||||
assert micro_batch.run_id == "run_test123"
|
||||
assert micro_batch.run_step == 1
|
||||
|
||||
|
||||
def test_multipacker_pack_preserves_mm_kwargs_modality_and_run_tagging(tmp_path, monkeypatch):
|
||||
"""MultiPacker keeps multimodal and text microbatches aligned across ranks."""
|
||||
from prime_rl.trainer.batch import _is_multimodal_sample
|
||||
|
||||
manager, packer, sent = _packer_with_two_runs(tmp_path, monkeypatch, dp_world_size=2, seq_len=5)
|
||||
malformed = _mm_sample(0.0)
|
||||
malformed.mm_token_type_ids = None
|
||||
valid, reason = packer._validate_sample(malformed)
|
||||
assert not valid
|
||||
assert reason is not None and "require mm_token_type_ids" in reason
|
||||
|
||||
a, b = manager.id_2_idx["run_a"], manager.id_2_idx["run_b"]
|
||||
for idx, value in ((a, 1.0), (b, 10.0)):
|
||||
packer.buffers[idx].append((_mm_sample(value), 0))
|
||||
packer.buffers[idx].append((make_training_sample(), 0))
|
||||
|
||||
packer.pack()
|
||||
assert sent, "pack() sent nothing"
|
||||
grid = sent[-1]
|
||||
assert len(grid) == 2
|
||||
|
||||
for step_mbs in zip(*grid):
|
||||
assert len({_is_multimodal_sample(mb) for mb in step_mbs}) == 1
|
||||
|
||||
mm_mbs = [mb for rank in grid for mb in rank if _is_multimodal_sample(mb)]
|
||||
assert mm_mbs, "no MM microbatches produced"
|
||||
real_run_idxs = set()
|
||||
for mb in mm_mbs:
|
||||
assert mb.mm_kwargs is not None
|
||||
if any(mb.loss_mask):
|
||||
tagged = [i for i, n in enumerate(mb.lora_num_tokens) if n > 0]
|
||||
assert len(tagged) == 1 and mb.lora_num_tokens[tagged[0]] == len(mb.input_ids)
|
||||
real_run_idxs.add(tagged[0])
|
||||
assert real_run_idxs == {a, b}, f"both runs' MM should be tagged; got {real_run_idxs}"
|
||||
|
||||
|
||||
def test_multipacker_packs_mm_kwargs_within_each_run(tmp_path, monkeypatch):
|
||||
"""Compatible eager multimodal samples pack within a run but never across runs."""
|
||||
from prime_rl.trainer.batch import _is_multimodal_sample
|
||||
|
||||
manager, packer, sent = _packer_with_two_runs(tmp_path, monkeypatch, dp_world_size=1, seq_len=12)
|
||||
a, b = manager.id_2_idx["run_a"], manager.id_2_idx["run_b"]
|
||||
for idx, base in ((a, 1.0), (b, 10.0)):
|
||||
packer.buffers[idx].append((_mm_sample(base), 0))
|
||||
packer.buffers[idx].append((_mm_sample(base + 2), 0))
|
||||
|
||||
packer.pack()
|
||||
assert sent
|
||||
grid = sent[-1]
|
||||
real_mm_mbs = [mb for rank in grid for mb in rank if _is_multimodal_sample(mb) and any(mb.loss_mask)]
|
||||
|
||||
assert len(real_mm_mbs) == 2
|
||||
for mb in real_mm_mbs:
|
||||
assert len(mb.input_ids) == 6
|
||||
assert mb.position_ids == [0, 1, 2, 0, 1, 2]
|
||||
assert mb.seq_lens == [3, 3]
|
||||
assert mb.mm_kwargs is not None
|
||||
assert mb.mm_kwargs["pixel_values"].shape == [2, 2]
|
||||
assert mb.mm_kwargs["image_grid_thw"].shape == [2, 3]
|
||||
assert len(_decode_encoded_tensor(mb.mm_kwargs["pixel_values"])) == 2
|
||||
tagged = [i for i, n in enumerate(mb.lora_num_tokens) if n > 0]
|
||||
assert len(tagged) == 1
|
||||
|
||||
@@ -38,7 +38,7 @@ def _build_rollout(*, example_id: int, reward: float, task: str) -> Rollout:
|
||||
rollout = Rollout[vf.TaskData](
|
||||
task=vf.TraceTask(type="Task", data=vf.TaskData(idx=example_id, prompt=f"prompt-{example_id}")),
|
||||
nodes=nodes,
|
||||
rewards={"reward": reward},
|
||||
rewards={"reward": vf.Reward(score=reward)},
|
||||
)
|
||||
rollout.env_name = task
|
||||
# Per-token advantage stream (full-length-N): 0.0 on the 3 prompt tokens,
|
||||
|
||||
@@ -45,6 +45,7 @@ members = [
|
||||
"bfcl-v3-v1",
|
||||
"browsecomp-plus-v1",
|
||||
"browsecomp-v1",
|
||||
"charxiv-v1",
|
||||
"clbench-v1",
|
||||
"code-golf-v1",
|
||||
"color-codeword-v1",
|
||||
@@ -67,6 +68,7 @@ members = [
|
||||
"i3-science-v1",
|
||||
"ifbench-v1",
|
||||
"ifeval-v1",
|
||||
"kuhn-poker-v1",
|
||||
"lean-v1",
|
||||
"livecodebench-v1",
|
||||
"longbenchpro-v1",
|
||||
@@ -77,6 +79,7 @@ members = [
|
||||
"math500-v1",
|
||||
"mcp-atlas-v1",
|
||||
"mmlu-pro-v1",
|
||||
"mmmu-pro-v1",
|
||||
"mmmu-v1",
|
||||
"mrcr-v2-v1",
|
||||
"multiswe-v1",
|
||||
@@ -593,7 +596,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bfcl-v3-v1"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
source = { editable = "deps/research-environments/environments/tool_use/bfcl_v3_v1" }
|
||||
dependencies = [
|
||||
{ name = "bfcl-eval" },
|
||||
@@ -605,7 +608,7 @@ dependencies = [
|
||||
requires-dist = [
|
||||
{ name = "bfcl-eval", git = "https://github.com/mikasenghaas/gorilla.git?subdirectory=berkeley-function-call-leaderboard&rev=898763a" },
|
||||
{ name = "soundfile", specifier = ">=0.13.0" },
|
||||
{ name = "verifiers", specifier = ">=0.2.0" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev21" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -871,6 +874,23 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/db/8f/61959034484a4a7c527811f4721e75d02d653a35afb0b6054474d8185d4c/charset_normalizer-3.4.7-py3-none-any.whl", hash = "sha256:3dce51d0f5e7951f8bb4900c257dad282f49190fdbebecd4ba99bcc41fef404d", size = 61958, upload-time = "2026-04-02T09:28:37.794Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "charxiv-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/multimodal/charxiv_v1" }
|
||||
dependencies = [
|
||||
{ name = "datasets" },
|
||||
{ name = "pillow" },
|
||||
{ name = "verifiers" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "pillow" },
|
||||
{ name = "verifiers", specifier = ">=0.2.0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chess"
|
||||
version = "1.11.2"
|
||||
@@ -3229,6 +3249,17 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/46/2c/5c160dbdef7123f8cc97fd8ece7e0198627a426a2a49614845e9086feb8d/kubernetes-36.0.2-py2.py3-none-any.whl", hash = "sha256:faf9b5241b58de0c4a5069f2a0ffc8ac06fece7215156cd3d3ba081a78a858b6", size = 4617568, upload-time = "2026-06-01T18:20:28.737Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kuhn-poker-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/verifiers/environments/kuhn_poker_v1" }
|
||||
dependencies = [
|
||||
{ name = "verifiers" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers" }]
|
||||
|
||||
[[package]]
|
||||
name = "langdetect"
|
||||
version = "1.0.9"
|
||||
@@ -3762,6 +3793,23 @@ requires-dist = [
|
||||
{ name = "verifiers", specifier = ">=0.2.0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mmmu-pro-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/multimodal/mmmu_pro_v1" }
|
||||
dependencies = [
|
||||
{ name = "datasets" },
|
||||
{ name = "pillow" },
|
||||
{ name = "verifiers" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "pillow" },
|
||||
{ name = "verifiers", specifier = ">=0.2.0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mmmu-v1"
|
||||
version = "0.1.0"
|
||||
@@ -3973,7 +4021,7 @@ dependencies = [
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "multi-swe-bench" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev5" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev27" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4644,7 +4692,7 @@ dependencies = [
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "huggingface-hub" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev5" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev27" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5325,7 +5373,7 @@ requires-dist = [
|
||||
|
||||
[[package]]
|
||||
name = "prime-sandboxes"
|
||||
version = "0.2.32"
|
||||
version = "0.2.33"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "aiofiles" },
|
||||
@@ -5335,9 +5383,9 @@ dependencies = [
|
||||
{ name = "pydantic" },
|
||||
{ name = "tenacity" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/62/fd/f57ad87b273ae1696ca620deaac2c56e28a54905d2d2791a5b9a387f443c/prime_sandboxes-0.2.32.tar.gz", hash = "sha256:ea3d6230cdfb5af2e4542814996257bad60fc9913f15f776a65ca1ef05f4f504", size = 77656, upload-time = "2026-07-17T17:41:02.296Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/15/a9/880685cefd503aa92d2b49da46b60ba807015f8839c344a83d8c5bc02f30/prime_sandboxes-0.2.33.tar.gz", hash = "sha256:4253a3c345ccf6c07b41a81790f8515763333f094d20bc405a257432461e81d8", size = 81228, upload-time = "2026-07-22T23:23:55.715Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/75/a3/c345509abf8f7707c0c3e9d6badba2e057781d1c05a88a46733ab67521e5/prime_sandboxes-0.2.32-py3-none-any.whl", hash = "sha256:4fe730622e51c489f8f86e7ad959fd8320db6d7a9fe22442ae3c680687da4c22", size = 40897, upload-time = "2026-07-17T17:41:00.935Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f8/1b/10b1044b8aaef561c32a34140f4a13c7310f73f92f9546337e2e8e6a5239/prime_sandboxes-0.2.33-py3-none-any.whl", hash = "sha256:92c9647557e76191ba926ac8ed01708de9ec4450142131b673cd5cf8d9d7ea56", size = 42773, upload-time = "2026-07-22T23:23:54.381Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6019,7 +6067,7 @@ dependencies = [
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev5" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev27" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6334,7 +6382,7 @@ dependencies = [
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev5" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev27" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6453,7 +6501,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers", extras = ["harbor"], specifier = ">=0.2.1" }]
|
||||
requires-dist = [{ name = "verifiers", extras = ["harbor"], specifier = ">=0.2.2.dev27" }]
|
||||
|
||||
[[package]]
|
||||
name = "sentence-transformers"
|
||||
@@ -6871,7 +6919,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers", extras = ["harbor"], specifier = ">=0.2.1" }]
|
||||
requires-dist = [{ name = "verifiers", extras = ["harbor"], specifier = ">=0.2.2.dev27" }]
|
||||
|
||||
[[package]]
|
||||
name = "swebench-pro-v1"
|
||||
@@ -6882,7 +6930,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.2.1" }]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.2.2.dev27" }]
|
||||
|
||||
[[package]]
|
||||
name = "swebench-verified-v1"
|
||||
@@ -6893,7 +6941,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.2.1" }]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.2.2.dev27" }]
|
||||
|
||||
[[package]]
|
||||
name = "swelego-v1"
|
||||
@@ -6907,7 +6955,7 @@ dependencies = [
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev5" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev27" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6922,7 +6970,7 @@ dependencies = [
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev5" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev27" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6946,7 +6994,7 @@ requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "swebench" },
|
||||
{ name = "swesmith", git = "https://github.com/SWE-bench/SWE-smith.git?rev=9b74ac0" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev5" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev27" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7859,7 +7907,7 @@ requires-dist = [
|
||||
{ name = "openai-agents", specifier = ">=0.8.2" },
|
||||
{ name = "openenv", marker = "extra == 'openenv'", specifier = ">=0.4.1" },
|
||||
{ name = "prime-pydantic-config", extras = ["toml"], specifier = ">=0.4.2" },
|
||||
{ name = "prime-sandboxes", specifier = ">=0.2.31" },
|
||||
{ name = "prime-sandboxes", specifier = ">=0.2.33" },
|
||||
{ name = "prime-tunnel", specifier = ">=0.1.8" },
|
||||
{ name = "pydantic", specifier = ">=2.12.3" },
|
||||
{ name = "python-dotenv", marker = "extra == 'browser'", specifier = ">=1.0.0" },
|
||||
@@ -7889,10 +7937,10 @@ dev = [
|
||||
{ name = "pytest-xdist", specifier = ">=3.8.0" },
|
||||
{ name = "python-dotenv", specifier = ">=1.0.0" },
|
||||
{ name = "reasoning-gym", specifier = ">=0.1.8" },
|
||||
{ name = "ruff", specifier = ">=0.9.0" },
|
||||
{ name = "ruff", specifier = ">=0.16.0" },
|
||||
{ name = "stagehand", specifier = ">=3.4.0" },
|
||||
{ name = "textarena", specifier = "==0.7.4" },
|
||||
{ name = "ty", specifier = ">=0.0.1a29,<0.0.22" },
|
||||
{ name = "ty", specifier = ">=0.0.63" },
|
||||
]
|
||||
examples = [
|
||||
{ name = "alphabet-sort-v1", editable = "deps/verifiers/environments/alphabet_sort_v1" },
|
||||
@@ -7902,6 +7950,7 @@ examples = [
|
||||
{ name = "deepwiki-v1", editable = "deps/verifiers/environments/deepwiki_v1" },
|
||||
{ name = "glossary-v1", editable = "deps/verifiers/environments/glossary_v1" },
|
||||
{ name = "gsm8k-v1", editable = "deps/verifiers/environments/gsm8k_v1" },
|
||||
{ name = "kuhn-poker-v1", editable = "deps/verifiers/environments/kuhn_poker_v1" },
|
||||
{ name = "openenv-wordle-v1", editable = "deps/verifiers/environments/openenv_wordle_v1" },
|
||||
{ name = "proposer-solver-v1", editable = "deps/verifiers/environments/proposer_solver_v1" },
|
||||
{ name = "reverse-text-v1", editable = "deps/verifiers/environments/reverse_text_v1" },
|
||||
@@ -8518,7 +8567,7 @@ dependencies = [
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "openai" },
|
||||
{ name = "verifiers", specifier = ">=0.2.0" },
|
||||
{ name = "verifiers", specifier = ">=0.2.2.dev27" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Reference in New Issue
Block a user