Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f7f8c0b2a | ||
|
|
560cf1a86b | ||
|
|
440b3afaa8 | ||
|
|
f5946b098e | ||
|
|
cd00986f71 | ||
|
|
208ea64308 | ||
|
|
c505e07a1a | ||
|
|
cb74ae2beb | ||
|
|
56a6c5fea6 | ||
|
|
d69dbb8da4 | ||
|
|
67ba2ff986 | ||
|
|
0af5506215 | ||
|
|
47f97ee1b0 | ||
|
|
5264eb8984 | ||
|
|
4453922943 | ||
|
|
ed16f19a05 | ||
|
|
691dd4ef14 | ||
|
|
256809b2ec | ||
|
|
d085605be2 | ||
|
|
3da69fdea9 | ||
|
|
aa4f04fe22 | ||
|
|
a12935c140 | ||
|
|
0eadc24027 | ||
|
|
3d2dbae5f7 | ||
|
|
825e6ce98f | ||
|
|
9208731022 | ||
|
|
8dcf55acbc | ||
|
|
18665f7d58 | ||
|
|
5f7e3ffcaa | ||
|
|
188192ce64 | ||
|
|
cac463e795 | ||
|
|
e0d60e4d85 | ||
|
|
d7bcd1b1f5 | ||
|
|
4d8df5120e | ||
|
|
6b1604380c | ||
|
|
013a7f8c25 | ||
|
|
3ff7902a73 | ||
|
|
c9acaa3c90 | ||
|
|
c7dc7929a0 | ||
|
|
0d2a7f5a12 | ||
|
|
1cb5d91ab2 | ||
|
|
d05744678e | ||
|
|
67c20ba8c8 | ||
|
|
683377520e | ||
|
|
7a7dd80291 | ||
|
|
c012c45cf7 | ||
|
|
5af45e4310 |
@@ -146,7 +146,7 @@ jobs:
|
||||
id: artifact
|
||||
run: echo "name=benchmark-${{ matrix.runner }}-$(echo '${{ matrix.model }}' | sed 's/\//--/')-${{ matrix.type }}-${{ matrix.lora_rank || 'full' }}-${{ matrix.num_gpus }}gpu-${{ matrix.ac }}-${{ matrix.attention }}-${{ matrix.seq_len }}-cp${{ matrix.cp }}-ep${{ matrix.ep }}" >> "$GITHUB_OUTPUT"
|
||||
- name: Upload benchmark result
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v5
|
||||
if: always()
|
||||
with:
|
||||
name: ${{ steps.artifact.outputs.name }}
|
||||
@@ -163,16 +163,16 @@ jobs:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout repository # We can't use the image because then no git
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
- name: Install dependencies
|
||||
run: uv sync
|
||||
- name: Download all benchmark artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
path: /tmp/benchmark_artifacts
|
||||
pattern: benchmark-*
|
||||
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
esac
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ env.BUILD_REF }}
|
||||
fetch-depth: 0
|
||||
@@ -116,7 +116,6 @@ jobs:
|
||||
build:
|
||||
name: Build and push (${{ matrix.suffix }})
|
||||
needs: prepare
|
||||
environment: ghcr-publish
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
||||
@@ -130,7 +129,7 @@ jobs:
|
||||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ needs.prepare.outputs.ref }}
|
||||
fetch-depth: 0
|
||||
@@ -144,21 +143,24 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Build and push
|
||||
id: build
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.cuda
|
||||
# This experiment tag derives from the immutable current-main arm64
|
||||
# image and only bakes the pinned NVFP4 runtime. Main still uses
|
||||
# Dockerfile.cuda; this workflow change exists solely on the tag.
|
||||
file: ./Dockerfile.nvfp4-e2e
|
||||
push: true
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: |
|
||||
@@ -199,7 +201,7 @@ jobs:
|
||||
packages: write
|
||||
steps:
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: false
|
||||
- name: Init public submodules
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
git config --global url."https://github.com/".insteadOf "git@github.com:"
|
||||
git submodule update --init --recursive -- deps/verifiers deps/renderers deps/research-environments deps/pydantic-config
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
@@ -48,9 +48,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
@@ -90,20 +90,15 @@ jobs:
|
||||
assert find_package_resource("templates") is None, "templates should not be in slim wheel"
|
||||
print("slim install OK — configs import with no heavy deps loaded")
|
||||
PY
|
||||
- name: Verify real configs (with [slurm]) parse on slim install
|
||||
- name: Verify real SFT config (with [slurm]) parses on slim install
|
||||
run: |
|
||||
/tmp/slim/bin/python - <<'PY'
|
||||
from pydantic_config import cli
|
||||
from prime_rl.configs.sft import SFTConfig
|
||||
from prime_rl.configs.rl import RLConfig
|
||||
# Configs that don't pull in a v1 env package parse on the slim
|
||||
# (prime-rl-configs-only) install: the SFT config has no env sections, and the
|
||||
# reverse_text RL recipe uses a v0 env id (resolved lazily, not imported at parse).
|
||||
# RL configs on a v1 taskset can't parse here because vf.EnvServerConfig imports the
|
||||
# (uninstalled) env package at parse time.
|
||||
# The slim wheel intentionally excludes taskset packages, so validate a real
|
||||
# SFT config here. RL recipes are covered by the full config suite.
|
||||
for cfg_cls, args in [
|
||||
(SFTConfig, ["@", "examples/reverse_text/slurm_sft.toml"]),
|
||||
(RLConfig, ["@", "examples/reverse_text/rl.toml", "@", "examples/reverse_text/slurm_rl.toml"]),
|
||||
(SFTConfig, ["@", "configs/ci/slim_sft.toml"]),
|
||||
]:
|
||||
cfg = cli(cfg_cls, args=args)
|
||||
assert cfg.slurm is not None, f"expected [slurm] in {args}"
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create next .dev tag from latest release
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const { owner, repo } = context.repo;
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
name: Docker Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags:
|
||||
- "*"
|
||||
jobs:
|
||||
cuda:
|
||||
name: Push CUDA image to Docker
|
||||
runs-on: image-builder
|
||||
steps:
|
||||
- name: Remove unnecessary packages
|
||||
run: |
|
||||
echo "=== Before pruning ==="
|
||||
df -h
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
sudo rm -rf /usr/local/lib/android
|
||||
sudo rm -rf /opt/ghc
|
||||
echo "=== After pruning ==="
|
||||
df -h
|
||||
|
||||
# Link to discussion: https://github.com/orgs/community/discussions/25678
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: false
|
||||
- name: Init public submodules
|
||||
run: |
|
||||
git config --global url."https://github.com/".insteadOf "git@github.com:"
|
||||
git submodule update --init --recursive -- deps/verifiers deps/renderers deps/research-environments deps/pydantic-config
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: crazy-max/ghaction-docker-meta@v2
|
||||
with:
|
||||
images: |
|
||||
primeintellect/prime-rl
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha,prefix=commit-
|
||||
type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.cuda
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
||||
- name: Test import
|
||||
run: docker run --entrypoint python primeintellect/prime-rl:main -c "import prime_rl"
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
apt-get install -y git
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: false
|
||||
- name: Init public submodules
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
git config --global url."https://github.com/".insteadOf "git@github.com:"
|
||||
git submodule update --init --recursive -- deps/verifiers deps/renderers deps/research-environments deps/pydantic-config
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
uses: astral-sh/setup-uv@v7
|
||||
- name: Install dependencies
|
||||
run: uv sync --all-extras --all-packages --locked
|
||||
- name: Run unit tests
|
||||
@@ -97,7 +97,7 @@ jobs:
|
||||
apt-get install -y git
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: false
|
||||
- name: Init public submodules
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
git config --global url."https://github.com/".insteadOf "git@github.com:"
|
||||
git submodule update --init --recursive -- deps/verifiers deps/renderers deps/research-environments deps/pydantic-config
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
uses: astral-sh/setup-uv@v7
|
||||
- name: Install dependencies
|
||||
run: uv sync --all-extras --all-packages --locked
|
||||
- name: Run integration tests
|
||||
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
@@ -73,7 +73,7 @@ jobs:
|
||||
apt-get install -y git
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: false
|
||||
- name: Init public submodules
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
git config --global url."https://github.com/".insteadOf "git@github.com:"
|
||||
git submodule update --init --recursive -- deps/verifiers deps/renderers deps/research-environments deps/pydantic-config
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
|
||||
@@ -15,17 +15,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
# Submodules are excluded from ruff via pyproject.toml; no need to fetch them.
|
||||
with:
|
||||
submodules: false
|
||||
- name: Run ruff
|
||||
uses: astral-sh/ruff-action@v3
|
||||
uses: astral-sh/ruff-action@v4.1.0
|
||||
with:
|
||||
version: "0.13.0"
|
||||
args: "check --config=pyproject.toml"
|
||||
- name: Run ruff format (check)
|
||||
uses: astral-sh/ruff-action@v3
|
||||
uses: astral-sh/ruff-action@v4.1.0
|
||||
with:
|
||||
version: "0.13.0"
|
||||
args: "format --check --config=pyproject.toml"
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
trigger-docs-sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Validate mint.json pages exist
|
||||
run: |
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
echo "All mint.json pages verified."
|
||||
|
||||
- name: Trigger public-docs workflow
|
||||
uses: peter-evans/repository-dispatch@v3
|
||||
uses: peter-evans/repository-dispatch@v4
|
||||
with:
|
||||
token: ${{ secrets.DOCS_SYNC_PAT }}
|
||||
repository: PrimeIntellect-ai/public-docs
|
||||
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
version: ${{ steps.tag.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout main
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -135,14 +135,14 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout tagged release (dispatch)
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: refs/tags/${{ inputs.tag }}
|
||||
|
||||
- name: Checkout tagged release (push)
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
+6
-6
@@ -85,16 +85,14 @@ COPY packages/ /app/packages/
|
||||
COPY deps/ /app/deps/
|
||||
COPY configs /app/configs
|
||||
COPY examples /app/examples
|
||||
COPY k8s /app/k8s
|
||||
COPY benchmarks/scripts /app/benchmarks/scripts
|
||||
COPY scripts/docker-editable-pretend-versions.sh /app/scripts/docker-editable-pretend-versions.sh
|
||||
COPY scripts/patch-vllm-nvfp4-writable-scales.py /app/scripts/patch-vllm-nvfp4-writable-scales.py
|
||||
|
||||
# Use submodule git metadata from the build context when present. Docker copies
|
||||
# only the submodule .git pointer files into /app/deps, so we temporarily link
|
||||
# /app/.git/modules to the read-only context before resolving versions.
|
||||
# Opt-in extras for disaggregated P/D inference (deep-ep, deep-gemm, quack).
|
||||
# Default off — they're heavy source builds only the disagg-MoE path needs.
|
||||
# Enable via `--build-arg INCLUDE_DISAGG_EXTRAS=1`.
|
||||
ARG INCLUDE_DISAGG_EXTRAS=0
|
||||
ARG VERIFIERS_PRETEND_VERSION
|
||||
ARG RENDERERS_PRETEND_VERSION
|
||||
RUN --mount=type=cache,target=/app/.cache/uv \
|
||||
@@ -109,9 +107,11 @@ RUN --mount=type=cache,target=/app/.cache/uv \
|
||||
&& \
|
||||
sed -i "s/fallback-version = \"0.0.0\"/fallback-version = \"${RENDERERS_PRETEND_VERSION}\"/" /app/deps/renderers/pyproject.toml \
|
||||
&& \
|
||||
EXTRA_DISAGG_FLAG=""; if [ "$INCLUDE_DISAGG_EXTRAS" = "1" ]; then EXTRA_DISAGG_FLAG="--extra disagg"; fi \
|
||||
uv sync --all-packages --extra flash-attn --extra flash-attn-3 --extra flash-attn-cute --extra disagg --extra gpt-oss --extra quack --group mamba-ssm --locked --no-dev \
|
||||
&& \
|
||||
uv sync --all-packages --extra flash-attn --extra flash-attn-3 --extra flash-attn-cute --extra gpt-oss --extra modelexpress $EXTRA_DISAGG_FLAG --group mamba-ssm --locked --no-dev
|
||||
/app/.venv/bin/python -c 'from importlib.metadata import version; [version(name) for name in ("deep-ep", "deep-gemm", "mamba-ssm", "nixl", "quack-kernels", "vllm", "vllm-router")]' \
|
||||
&& \
|
||||
/app/.venv/bin/python /app/scripts/patch-vllm-nvfp4-writable-scales.py
|
||||
|
||||
# Optional: build NIXL from source against the UCX 1.19 baked above. The PyPI
|
||||
# nixl wheel ships its own UCX which segfaults on prefill→decode KV transfer
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
ARG BASE_IMAGE=ghcr.io/primeintellect-ai/prime-rl@sha256:a86004b9b44d43c8018633283ec0267c3339c0dac0e35a9957f48f0a6b56153c
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
USER root
|
||||
|
||||
COPY pyproject.toml /app/pyproject.toml
|
||||
COPY uv.lock /app/uv.lock
|
||||
COPY scripts/patch-vllm-nvfp4-writable-scales.py /app/scripts/patch-vllm-nvfp4-writable-scales.py
|
||||
COPY k8s/experiments/run_nvfp4_inference.sh /app/k8s/experiments/run_nvfp4_inference.sh
|
||||
|
||||
RUN uv --no-config pip install \
|
||||
--python /app/.venv/bin/python \
|
||||
--upgrade \
|
||||
--no-deps \
|
||||
'https://wheels.vllm.ai/910cc8543a6907c9cc87c417f8f2420969278bf5/vllm-0.23.1rc1.dev1392%2Bg910cc8543-cp38-abi3-manylinux_2_28_aarch64.whl' \
|
||||
'https://github.com/flashinfer-ai/flashinfer/releases/download/v0.6.15.post1/flashinfer_python-0.6.15.post1-py3-none-any.whl' \
|
||||
'https://github.com/flashinfer-ai/flashinfer/releases/download/v0.6.15.post1/flashinfer_cubin-0.6.15.post1-py3-none-any.whl' \
|
||||
&& /app/.venv/bin/python /app/scripts/patch-vllm-nvfp4-writable-scales.py \
|
||||
&& /app/.venv/bin/python -c 'from importlib.metadata import version; expected={"vllm":"0.23.1rc1.dev1392+g910cc8543","flashinfer-python":"0.6.15.post1","flashinfer-cubin":"0.6.15.post1"}; actual={name:version(name) for name in expected}; assert actual == expected, (actual, expected)'
|
||||
|
||||
USER appuser
|
||||
@@ -9,7 +9,7 @@
|
||||
---
|
||||
|
||||
<h3 align="center">
|
||||
PRIME-RL: Async RL Training at Scale
|
||||
prime-rl: Async RL Training at Scale
|
||||
</h3>
|
||||
|
||||
---
|
||||
@@ -29,7 +29,7 @@ PRIME-RL: Async RL Training at Scale
|
||||
|
||||
## Overview
|
||||
|
||||
PRIME-RL is a framework for large-scale reinforcement learning. It is designed to be easy to use and hackable, yet capable of scaling to 1000+ GPUs. Here is what we think sets it apart:
|
||||
prime-rl is a framework for large-scale reinforcement learning. It is designed to be easy to use and hackable, yet capable of scaling to 1000+ GPUs. Here is what we think sets it apart:
|
||||
|
||||
1. Fully asynchronous RL for high-throughput agentic training at scale.
|
||||
2. Performant: built to train 1T+ MoE models on 1000+ GPUs with [FSDP2](https://docs.pytorch.org/tutorials/intermediate/FSDP_tutorial.html) for training and [vLLM](https://github.com/vllm-project/vllm) for inference, with FP8 inference, PD disaggregation, EP and CP parallelism, and more.
|
||||
@@ -38,7 +38,7 @@ PRIME-RL is a framework for large-scale reinforcement learning. It is designed t
|
||||
5. Multi-node deployment with Slurm and Kubernetes support.
|
||||
6. Multimodal support for VLMs such as Qwen3-VL.
|
||||
7. Hackable, modular, and extensible by design.
|
||||
8. One-line SLURM deployment for frontier models — e.g. [`GLM-5` FP8 with P/D disaggregation, the `llm-d` router, and Mooncake KV offload](examples/glm5_llmd/README.md).
|
||||
8. One-line SLURM deployment for frontier models — e.g. [`GLM-5` FP8 with P/D disaggregation, the `llm-d` router, and Mooncake KV offload](examples/advanced/glm-5.2/).
|
||||
|
||||
|
||||
## Models support
|
||||
@@ -53,7 +53,7 @@ With `[model] impl = "auto"` (the default), the trainer selects that custom stac
|
||||
| GLM-5 (`glm_moe_dsa`) | `zai-org/GLM-5`, `zai-org/GLM-5-FP8` | yes | ✅ | ✅ |
|
||||
| Qwen3 MoE (`qwen3_moe`) | `Qwen/Qwen3-30B-A3B`, … | yes | ✅ | ✅ |
|
||||
| Qwen3.5 MoE (`qwen3_5_moe`) | `Qwen/Qwen3.5-35B-A3B`, … | yes | ✅ | ✅ |
|
||||
| Qwen3 / Qwen3.5 VLMs | see [advanced.md](docs/advanced.md#vision-language-models) (`qwen3_vl`, `qwen3_5`, `qwen3_5_moe`) | MoE only on MoE VLMs | MoE only | ✅ |
|
||||
| Qwen3 / Qwen3.5 VLMs | see [advanced.md](docs/advanced.md#multimodal-training) (`qwen3_vl`, `qwen3_5`, `qwen3_5_moe`) | MoE only on MoE VLMs | MoE only | ❌ |
|
||||
| Poolside Laguna (`laguna`) | `poolside/Laguna-XS.2` | yes | ✅ | ✅ |
|
||||
| MiniMax M2 (`minimax_m2`) | `MiniMax/MiniMax-M2` | yes | ✅ | ✅ |
|
||||
| Nemotron H (`nemotron_h`) | `nvidia/Nemotron-3-Nano-30B-A3B`, `nvidia/Nemotron-3-Super-120B-A12B`, … | yes | ✅ | ✅ |
|
||||
@@ -69,11 +69,11 @@ With `[model] impl = "auto"` (the default), the trainer selects that custom stac
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Currently, you **need at least one NVIDIA GPU to use PRIME-RL**. If you don't already have access to one, we recommend our [compute platform](https://app.primeintellect.ai) for everything from renting on-demand single GPUs for developing, debugging and small ablations, to [reserving 1000+ GPU clusters](https://app.primeintellect.ai/dashboard/quotes) for production-scale training.
|
||||
Currently, you **need at least one NVIDIA GPU to use prime-rl**. If you don't already have access to one, we recommend our [compute platform](https://app.primeintellect.ai) for everything from renting on-demand single GPUs for developing, debugging and small ablations, to [reserving 1000+ GPU clusters](https://app.primeintellect.ai/dashboard/quotes) for production-scale training.
|
||||
|
||||
### Quick Setup
|
||||
|
||||
Set up PRIME-RL in a single command.
|
||||
Set up prime-rl in a single command.
|
||||
|
||||
```bash
|
||||
curl -sSL https://raw.githubusercontent.com/PrimeIntellect-ai/prime-rl/main/scripts/install.sh | bash
|
||||
@@ -154,33 +154,25 @@ uv run python -c "import flash_attn"
|
||||
3. Check that you can run SFT trainer (*this requires 1 GPU*)
|
||||
|
||||
```bash
|
||||
uv run sft @ configs/debug/sft/train.toml
|
||||
uv run sft @ configs/debug/fake/sft.toml
|
||||
```
|
||||
|
||||
4. Check that you can run the RL trainer (*this requires 1 GPU*)
|
||||
|
||||
```bash
|
||||
uv run trainer @ configs/debug/rl/train.toml
|
||||
uv run trainer @ configs/debug/fake/rl.toml
|
||||
```
|
||||
|
||||
5. Check that you can run the inference server (*this requires 1 GPU*)
|
||||
|
||||
```bash
|
||||
uv run inference @ configs/debug/infer.toml
|
||||
uv run inference --model.name Qwen/Qwen3-0.6B
|
||||
```
|
||||
|
||||
*Keep the inference server running in the background for the next steps.*
|
||||
|
||||
5.1. Check that you can run the orchestrator against the inference server
|
||||
6. Check that the full RL stack (inference + orchestrator + trainer) runs end-to-end (*this requires 2 GPUs*)
|
||||
|
||||
```bash
|
||||
uv run orchestrator @ configs/debug/orch.toml
|
||||
```
|
||||
|
||||
5.2. Check that you can run evals against the inference server
|
||||
|
||||
```bash
|
||||
uv run eval @ configs/debug/eval.toml
|
||||
uv run rl @ configs/basic/reverse-text/rl.toml
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -206,29 +198,29 @@ We provide end-to-end training examples in the [`examples`](examples) directory
|
||||
|
||||
### Basic Training: 1 to 8 GPUs
|
||||
|
||||
Follow this guide to learn the basics of Prime-RL. You can train your own models on 1 to 8 GPUs. Ideal for getting started and exploring the capabilities of the framework. These guides cover most use cases -- single-turn, multi-turn, tool calling, etc. -- on toy environments and small models.
|
||||
Follow this guide to learn the basics of prime-rl. You can train your own models on 1 to 8 GPUs. Ideal for getting started and exploring the capabilities of the framework. These guides cover most use cases -- single-turn, multi-turn, tool calling, etc. -- on toy environments and small models.
|
||||
|
||||
1. [**Reverse Text**](examples/reverse_text/README.md): Train `Qwen3-0.6B` to reverse a small chunk of text. Demonstrates tiny-scale single-turn SFT and RL training. Can be trained on a single consumer GPU in a few minutes, and is ideal for getting started.
|
||||
2. [**Wordle**](examples/wordle/README.md): Train `Qwen3-1.7B` to play Wordle. A fun example of multi-turn SFT and RL training. Can be trained on a 2-4 H100 GPUs in a few hours. Ideal for exploring the multi-turn training capabilities of the framework.
|
||||
3. [**Alphabet Sort**](examples/alphabet_sort/README.md): Train `Qwen3-4B-Instruct-2507` to sort names alphabetically. Demonstrates multi-turn RL training via LoRA without SFT warmup. Can be trained on a single H100 GPU in just over an hour. Ideal for exploring LoRA-based training.
|
||||
4. [**Wiki Search**](examples/wiki_search/README.md): Train `Qwen3-4B-Instruct-2507` to answer trivia questions by searching through a Wikipedia. Demonstrates multi-turn with web search tool use.
|
||||
5. [**Hendrycks Sanity**](examples/hendrycks_sanity/README.md): Run a sanity check experiment on `DeepSeek-R1-Distill-Qwen-1.5B` using a filtered subset of MATH where the model already partially solves 20-80% of problems. Useful for algorithm ablations.
|
||||
1. [**Reverse Text**](examples/basic/reverse-text/README.md): Train `Qwen3-0.6B` to reverse a small chunk of text. Demonstrates tiny-scale single-turn SFT and RL training. Can be trained on a single consumer GPU in a few minutes, and is ideal for getting started.
|
||||
2. [**Wordle**](examples/basic/wordle/README.md): Train `Qwen3-1.7B` to play Wordle. A fun example of multi-turn SFT and RL training. Can be trained on a 2-4 H100 GPUs in a few hours. Ideal for exploring the multi-turn training capabilities of the framework.
|
||||
3. [**Alphabet Sort**](examples/basic/alphabet-sort/README.md): Train `Qwen3-4B-Instruct-2507` to sort names alphabetically. Demonstrates multi-turn RL training via LoRA without SFT warmup. Can be trained on a single H100 GPU in just over an hour. Ideal for exploring LoRA-based training.
|
||||
4. [**Wiki Search**](examples/basic/wiki-search/README.md): Train `Qwen3-4B-Instruct-2507` to answer trivia questions by searching through a Wikipedia. Demonstrates multi-turn with web search tool use.
|
||||
5. [**Hendrycks Sanity**](examples/basic/hendrycks-sanity/README.md): Run a sanity check experiment on `DeepSeek-R1-Distill-Qwen-1.5B` using a filtered subset of MATH where the model already partially solves 20-80% of problems. Useful for algorithm ablations.
|
||||
|
||||
### Advanced Training: 32 - 2048 GPUs:
|
||||
|
||||
Follow this guide to train large models on hard reasoning and agentic / swe environments.
|
||||
Follow this guide to train large models on hard reasoning and agentic tasks.
|
||||
These guides are designed to be run from a Slurm cluster but can also be adapted to k8s deployments.
|
||||
|
||||
1. [**Qwen 3 30B - A3B Math**](examples/qwen30b_math/README.md): Train `Qwen3-30B-A3B` to solve hard math problems.
|
||||
2. [**Qwen 3 30B - A3B SWE**](examples/qwen30b_swe/README.md): Train `Qwen3-30B-A3B` to solve hard SWE problems.
|
||||
3. [**Intellect-3.1**](examples/Intellect-3.1/README.md): Reproduce our `INTELLECT-3.1` training run.
|
||||
4. [**MiniMax-M2.5 SWE**](examples/minimax_m2.5_swe/README.md): Train `MiniMax-M2.5` on agentic SWE tasks.
|
||||
5. [**High-throughput GLM-5**](examples/glm5_pd_disag/README.md): Train `GLM-5` with PD disaggregation and FP8 inference on SWE.
|
||||
6. [**High-throughput GLM-5 (llm-d)**](examples/glm5_llmd/README.md): One-line SLURM deployment for `GLM-5` FP8 with P/D disaggregation, the `llm-d` router, and Mooncake KV offload — the faster way to run `GLM-5`.
|
||||
1. [**Qwen3-30B-A3B**](examples/advanced/qwen3-30b-a3b/): Train `Qwen3-30B-A3B` on math, SWE, and agentic tool use.
|
||||
2. [**GLM-4.5-Air**](examples/advanced/glm-4.5-air/): Train `GLM-4.5-Air` on search, SWE, and terminal tasks.
|
||||
3. [**Nemotron-3-Super**](examples/advanced/nemotron-3-super/): Train the `Nemotron-3-Super-120B` hybrid-Mamba MoE on SWE at 131k context.
|
||||
4. [**MiniMax-M2.5 SWE**](examples/advanced/minimax-m2.5/): Train `MiniMax-M2.5` on agentic SWE tasks.
|
||||
5. [**INTELLECT-3.1**](examples/advanced/intellect-3.1/): Reproduce our `INTELLECT-3.1` training run.
|
||||
6. [**High-throughput GLM-5**](examples/advanced/glm-5.2/): Large-scale `GLM-5`/`GLM-5.2` inference with P/D disaggregation, the `llm-d` router, and FP8.
|
||||
|
||||
## Docs
|
||||
|
||||
Check out the [docs](docs) directory for in-depth guides on how to use PRIME-RL.
|
||||
Check out the [docs](docs) directory for in-depth guides on how to use prime-rl.
|
||||
|
||||
- [**Overview**](docs/overview.md) - Architecture, install, and a copy-pasteable end-to-end RL run
|
||||
- [**Configuration**](docs/configuration.md) - TOML composition, CLI overrides, env vars, validation
|
||||
@@ -276,7 +268,7 @@ If you find our work useful, feel free to cite it using
|
||||
```tex
|
||||
@misc{primeintellect2025prime-rl,
|
||||
author = {Prime Intellect},
|
||||
title = {PRIME-RL},
|
||||
title = {prime-rl},
|
||||
url = {https://github.com/PrimeIntellect-ai/prime-rl},
|
||||
year = {2025}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,507 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Exercise Prime's layerwise reload path with vLLM online NVFP4 weights."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import importlib.metadata
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import time
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from typing import Any, Iterable
|
||||
|
||||
DEFAULT_MODEL = "Qwen/Qwen3-30B-A3B-Instruct-2507"
|
||||
EXPERT_WEIGHT_SUFFIXES = (
|
||||
".gate_proj.weight",
|
||||
".up_proj.weight",
|
||||
".down_proj.weight",
|
||||
)
|
||||
KERNEL_WEIGHT_NAMES = {"w13_weight", "w2_weight"}
|
||||
KERNEL_DERIVED_NAMES = {
|
||||
"g1_scale_c",
|
||||
"gemm1_alpha",
|
||||
"gemm1_beta",
|
||||
"gemm1_clamp_limit",
|
||||
}
|
||||
|
||||
|
||||
def _package_version(name: str) -> str:
|
||||
try:
|
||||
return importlib.metadata.version(name)
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
return "not-installed"
|
||||
|
||||
|
||||
def environment_probe() -> dict[str, Any]:
|
||||
import torch
|
||||
import vllm
|
||||
from vllm._custom_ops import scaled_fp4_quant
|
||||
from vllm.model_executor.layers.quantization.online.nvfp4 import (
|
||||
Nvfp4OnlineMoEMethod,
|
||||
)
|
||||
from vllm.utils.flashinfer import has_flashinfer_trtllm_fused_moe
|
||||
|
||||
from prime_rl.inference.vllm.worker.weight_transfer import (
|
||||
load_weights_checkpoint_layerwise,
|
||||
)
|
||||
|
||||
if not torch.cuda.is_available():
|
||||
raise RuntimeError("CUDA is unavailable")
|
||||
|
||||
capability = torch.cuda.get_device_capability()
|
||||
if capability[0] != 10:
|
||||
raise RuntimeError(f"online NVFP4 requires SM100, found SM{capability[0]}{capability[1]}")
|
||||
if not has_flashinfer_trtllm_fused_moe():
|
||||
raise RuntimeError("FlashInfer TRTLLM fused MoE is unavailable")
|
||||
|
||||
source = torch.arange(256, device="cuda", dtype=torch.bfloat16).reshape(16, 16)
|
||||
scale = torch.ones((), device="cuda", dtype=torch.float32)
|
||||
packed, block_scales = scaled_fp4_quant(
|
||||
source,
|
||||
scale,
|
||||
is_sf_swizzled_layout=False,
|
||||
)
|
||||
torch.cuda.synchronize()
|
||||
|
||||
return {
|
||||
"torch": _package_version("torch"),
|
||||
"torch_cuda": torch.version.cuda,
|
||||
"vllm": _package_version("vllm"),
|
||||
"vllm_module": str(Path(vllm.__file__).resolve()),
|
||||
"flashinfer_python": _package_version("flashinfer-python"),
|
||||
"flashinfer_cubin": _package_version("flashinfer-cubin"),
|
||||
"gpu": torch.cuda.get_device_name(),
|
||||
"compute_capability": list(capability),
|
||||
"nvfp4_method": f"{Nvfp4OnlineMoEMethod.__module__}.{Nvfp4OnlineMoEMethod.__name__}",
|
||||
"prime_reload_helper": (
|
||||
f"{load_weights_checkpoint_layerwise.__module__}.{load_weights_checkpoint_layerwise.__name__}"
|
||||
),
|
||||
"scaled_fp4_quant": {
|
||||
"packed_shape": list(packed.shape),
|
||||
"packed_dtype": str(packed.dtype),
|
||||
"block_scale_shape": list(block_scales.shape),
|
||||
"block_scale_dtype": str(block_scales.dtype),
|
||||
},
|
||||
"persistent_cache": {
|
||||
"hit": os.environ.get("NVFP4_CACHE_HIT") == "1",
|
||||
"key": os.environ.get("NVFP4_CACHE_KEY"),
|
||||
"marker": os.environ.get("NVFP4_CACHE_READY_MARKER"),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _mark_persistent_cache_ready() -> None:
|
||||
"""Mark the versioned JIT cache reusable after engine warmup succeeds."""
|
||||
marker_value = os.environ.get("NVFP4_CACHE_READY_MARKER")
|
||||
cache_key = os.environ.get("NVFP4_CACHE_KEY")
|
||||
if not marker_value or not cache_key:
|
||||
return
|
||||
|
||||
marker = Path(marker_value)
|
||||
marker.parent.mkdir(parents=True, exist_ok=True)
|
||||
temporary = marker.with_name(f".{marker.name}.{os.getpid()}.tmp")
|
||||
temporary.write_text(cache_key + "\n")
|
||||
os.replace(temporary, marker)
|
||||
|
||||
|
||||
def _get_worker_model(worker: Any):
|
||||
model_runner = worker.model_runner
|
||||
get_model = getattr(model_runner, "get_model", None)
|
||||
model = get_model() if callable(get_model) else model_runner.model
|
||||
return getattr(model, "runnable", model)
|
||||
|
||||
|
||||
def _is_expert_weight(name: str, layer_index: int) -> bool:
|
||||
marker = f"model.layers.{layer_index}.mlp.experts."
|
||||
return name.startswith(marker) and name.endswith(EXPERT_WEIGHT_SUFFIXES)
|
||||
|
||||
|
||||
def _reload_checkpoint(
|
||||
worker: Any,
|
||||
*,
|
||||
model_path: str,
|
||||
mutation_layer: int | None,
|
||||
) -> dict[str, Any]:
|
||||
"""Worker-side reload through Prime's production checkpoint-format helper."""
|
||||
import torch
|
||||
from torch.nn import Module
|
||||
from vllm.model_executor.model_loader import DefaultModelLoader, get_model_loader
|
||||
|
||||
from prime_rl.inference.vllm.worker.weight_transfer import (
|
||||
load_weights_checkpoint_layerwise,
|
||||
)
|
||||
|
||||
model = _get_worker_model(worker)
|
||||
if not isinstance(model, Module):
|
||||
raise TypeError(f"expected torch Module, got {type(model)!r}")
|
||||
|
||||
model_loader = get_model_loader(worker.load_config)
|
||||
if not isinstance(model_loader, DefaultModelLoader):
|
||||
raise TypeError(f"expected DefaultModelLoader, got {type(model_loader)!r}")
|
||||
|
||||
source = DefaultModelLoader.Source(
|
||||
model_path,
|
||||
revision=None,
|
||||
prefix="",
|
||||
fall_back_to_pt=getattr(model, "fall_back_to_pt_during_load", True),
|
||||
allow_patterns_overrides=getattr(model, "allow_patterns_overrides", None),
|
||||
)
|
||||
source_iterator = model_loader._get_weights_iterator(source)
|
||||
stats: dict[str, Any] = {
|
||||
"mutated_tensors": 0,
|
||||
"mutated_numel": 0,
|
||||
"mutated_names": [],
|
||||
}
|
||||
|
||||
def transformed_weights() -> Iterable[tuple[str, torch.Tensor]]:
|
||||
for name, tensor in source_iterator:
|
||||
if mutation_layer is not None and _is_expert_weight(name, mutation_layer):
|
||||
stats["mutated_tensors"] += 1
|
||||
stats["mutated_numel"] += tensor.numel()
|
||||
if len(stats["mutated_names"]) < 12:
|
||||
stats["mutated_names"].append(name)
|
||||
# Negation changes every non-zero packed FP4 value without
|
||||
# creating the degenerate all-zero activation path. That
|
||||
# keeps this test focused on reload/restore correctness.
|
||||
yield name, tensor.neg()
|
||||
else:
|
||||
yield name, tensor
|
||||
|
||||
started = time.perf_counter()
|
||||
load_weights_checkpoint_layerwise(
|
||||
model,
|
||||
transformed_weights(),
|
||||
worker.model_runner.model_config,
|
||||
worker.vllm_config,
|
||||
)
|
||||
torch.cuda.synchronize()
|
||||
stats["elapsed_seconds"] = time.perf_counter() - started
|
||||
|
||||
if mutation_layer is not None:
|
||||
num_experts = int(worker.model_runner.model_config.hf_text_config.num_experts)
|
||||
expected_tensors = num_experts * len(EXPERT_WEIGHT_SUFFIXES)
|
||||
if stats["mutated_tensors"] != expected_tensors:
|
||||
raise RuntimeError(f"mutated {stats['mutated_tensors']} expert tensors, expected {expected_tensors}")
|
||||
|
||||
return stats
|
||||
|
||||
|
||||
def _sample_tensor(tensor: Any, sample_size: int = 8192) -> dict[str, Any]:
|
||||
import torch
|
||||
|
||||
value = tensor.detach()
|
||||
if not value.is_contiguous():
|
||||
value = value.contiguous()
|
||||
raw = value.view(torch.uint8).reshape(-1)
|
||||
count = min(sample_size, raw.numel())
|
||||
if count:
|
||||
indices = torch.linspace(
|
||||
0,
|
||||
raw.numel() - 1,
|
||||
steps=count,
|
||||
device=raw.device,
|
||||
dtype=torch.float64,
|
||||
).to(torch.long)
|
||||
sample = raw[indices].to(device="cpu", dtype=torch.uint8)
|
||||
payload = bytes(sample.tolist())
|
||||
else:
|
||||
payload = b""
|
||||
|
||||
return {
|
||||
"shape": list(tensor.shape),
|
||||
"dtype": str(tensor.dtype),
|
||||
"device": str(tensor.device),
|
||||
"nbytes": tensor.numel() * tensor.element_size(),
|
||||
"data_ptr": tensor.data_ptr(),
|
||||
"sample_bytes": len(payload),
|
||||
"sample_nonzero": sum(byte != 0 for byte in payload),
|
||||
"sample_sha256": hashlib.sha256(payload).hexdigest(),
|
||||
"sample_prefix": list(payload[:16]),
|
||||
}
|
||||
|
||||
|
||||
def _probe_model(model: Any, *, layer_index: int) -> dict[str, Any]:
|
||||
import torch
|
||||
|
||||
model = getattr(model, "runnable", model)
|
||||
marker = f"model.layers.{layer_index}.mlp.experts"
|
||||
tensors: dict[str, Any] = {}
|
||||
for name, tensor in model.named_parameters():
|
||||
leaf = name.rsplit(".", 1)[-1]
|
||||
if marker in name and (
|
||||
leaf.startswith(("w13_", "w2_")) or leaf in KERNEL_DERIVED_NAMES
|
||||
):
|
||||
tensors[name] = tensor
|
||||
for name, tensor in model.named_buffers():
|
||||
leaf = name.rsplit(".", 1)[-1]
|
||||
if marker in name and (
|
||||
leaf.startswith(("w13_", "w2_")) or leaf in KERNEL_DERIVED_NAMES
|
||||
):
|
||||
tensors.setdefault(name, tensor)
|
||||
|
||||
if not tensors:
|
||||
nearby = [name for name, _ in model.named_parameters() if marker in name]
|
||||
raise RuntimeError(f"found no NVFP4 kernel tensors under {marker}; nearby={nearby[:20]}")
|
||||
|
||||
quant_methods: dict[str, str] = {}
|
||||
kernel_references: dict[str, Any] = {}
|
||||
for name, module in model.named_modules():
|
||||
if marker not in name:
|
||||
continue
|
||||
method = getattr(module, "_quant_method", None)
|
||||
if method is None:
|
||||
method = getattr(module, "quant_method", None)
|
||||
if method is not None:
|
||||
quant_methods[name] = f"{type(method).__module__}.{type(method).__name__}"
|
||||
quant_config = getattr(method, "moe_quant_config", None)
|
||||
for attr in (
|
||||
"g1_alphas",
|
||||
"g2_alphas",
|
||||
"a1_gscale",
|
||||
"a2_gscale",
|
||||
"w1_scale",
|
||||
"w2_scale",
|
||||
):
|
||||
value = getattr(quant_config, attr, None)
|
||||
if isinstance(value, torch.Tensor):
|
||||
kernel_references[f"{name}.moe_quant_config.{attr}"] = _sample_tensor(value)
|
||||
|
||||
moe_kernel = getattr(method, "moe_kernel", None)
|
||||
fused_experts = getattr(moe_kernel, "fused_experts", None)
|
||||
for attr in KERNEL_DERIVED_NAMES:
|
||||
value = getattr(fused_experts, attr, None)
|
||||
if isinstance(value, torch.Tensor):
|
||||
kernel_references[f"{name}.moe_kernel.fused_experts.{attr}"] = _sample_tensor(value)
|
||||
|
||||
if not any(value.endswith(".Nvfp4OnlineMoEMethod") for value in quant_methods.values()):
|
||||
raise RuntimeError(f"layer {layer_index} is not using Nvfp4OnlineMoEMethod: {quant_methods}")
|
||||
|
||||
return {
|
||||
"quant_methods": quant_methods,
|
||||
"tensors": {name: _sample_tensor(tensor) for name, tensor in sorted(tensors.items())},
|
||||
"kernel_references": dict(sorted(kernel_references.items())),
|
||||
"cuda_memory": {
|
||||
"allocated": torch.cuda.memory_allocated(),
|
||||
"reserved": torch.cuda.memory_reserved(),
|
||||
"max_allocated": torch.cuda.max_memory_allocated(),
|
||||
"max_reserved": torch.cuda.max_memory_reserved(),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _generation_signature(llm: Any, prompt: str) -> dict[str, Any]:
|
||||
from vllm import SamplingParams
|
||||
|
||||
params = SamplingParams(
|
||||
temperature=0.0,
|
||||
max_tokens=4,
|
||||
logprobs=5,
|
||||
seed=0,
|
||||
)
|
||||
request = llm.generate([prompt], params, use_tqdm=False)[0]
|
||||
sequence = request.outputs[0]
|
||||
chosen_logprobs: list[float | None] = []
|
||||
for token_id, candidates in zip(sequence.token_ids, sequence.logprobs or []):
|
||||
candidate = candidates.get(token_id)
|
||||
chosen_logprobs.append(None if candidate is None else float(candidate.logprob))
|
||||
return {
|
||||
"token_ids": list(sequence.token_ids),
|
||||
"text": sequence.text,
|
||||
"cumulative_logprob": (None if sequence.cumulative_logprob is None else float(sequence.cumulative_logprob)),
|
||||
"chosen_logprobs": chosen_logprobs,
|
||||
}
|
||||
|
||||
|
||||
def _kernel_leaf(name: str) -> str:
|
||||
return name.rsplit(".", 1)[-1]
|
||||
|
||||
|
||||
def _compare_phases(
|
||||
baseline: dict[str, Any],
|
||||
mutated: dict[str, Any],
|
||||
restored: dict[str, Any],
|
||||
baseline_generation: dict[str, Any],
|
||||
mutated_generation: dict[str, Any],
|
||||
restored_generation: dict[str, Any],
|
||||
) -> dict[str, Any]:
|
||||
baseline_tensors = baseline["tensors"]
|
||||
mutated_tensors = mutated["tensors"]
|
||||
restored_tensors = restored["tensors"]
|
||||
if baseline_tensors.keys() != mutated_tensors.keys() or baseline_tensors.keys() != restored_tensors.keys():
|
||||
raise RuntimeError("kernel tensor names changed across reload phases")
|
||||
|
||||
pointer_mismatches = [
|
||||
name
|
||||
for name in baseline_tensors
|
||||
if not (
|
||||
baseline_tensors[name]["data_ptr"]
|
||||
== mutated_tensors[name]["data_ptr"]
|
||||
== restored_tensors[name]["data_ptr"]
|
||||
)
|
||||
]
|
||||
restore_hash_mismatches = [
|
||||
name
|
||||
for name in baseline_tensors
|
||||
if baseline_tensors[name]["sample_sha256"] != restored_tensors[name]["sample_sha256"]
|
||||
]
|
||||
changed_kernel_weights = [
|
||||
name
|
||||
for name in baseline_tensors
|
||||
if _kernel_leaf(name) in KERNEL_WEIGHT_NAMES
|
||||
and baseline_tensors[name]["sample_sha256"] != mutated_tensors[name]["sample_sha256"]
|
||||
]
|
||||
kernel_weights = [name for name in baseline_tensors if _kernel_leaf(name) in KERNEL_WEIGHT_NAMES]
|
||||
|
||||
baseline_logprob = baseline_generation["cumulative_logprob"]
|
||||
mutated_logprob = mutated_generation["cumulative_logprob"]
|
||||
restored_logprob = restored_generation["cumulative_logprob"]
|
||||
mutation_changed_output = baseline_generation["token_ids"] != mutated_generation["token_ids"] or (
|
||||
baseline_logprob is not None
|
||||
and mutated_logprob is not None
|
||||
and not math.isclose(baseline_logprob, mutated_logprob, abs_tol=1e-5)
|
||||
)
|
||||
restored_output_matches = baseline_generation["token_ids"] == restored_generation["token_ids"]
|
||||
if baseline_logprob is not None and restored_logprob is not None:
|
||||
restored_output_matches = restored_output_matches and math.isclose(
|
||||
baseline_logprob,
|
||||
restored_logprob,
|
||||
abs_tol=1e-5,
|
||||
)
|
||||
|
||||
checks = {
|
||||
"kernel_tensor_names_stable": True,
|
||||
"kernel_storage_pointers_preserved": not pointer_mismatches,
|
||||
"mutated_kernel_weights_changed": bool(kernel_weights) and len(changed_kernel_weights) == len(kernel_weights),
|
||||
"restored_kernel_fingerprints_match": not restore_hash_mismatches,
|
||||
"mutation_changed_generation": mutation_changed_output,
|
||||
"restored_generation_matches": restored_output_matches,
|
||||
}
|
||||
return {
|
||||
"passed": all(checks.values()),
|
||||
"checks": checks,
|
||||
"pointer_mismatches": pointer_mismatches,
|
||||
"restore_hash_mismatches": restore_hash_mismatches,
|
||||
"changed_kernel_weights": changed_kernel_weights,
|
||||
}
|
||||
|
||||
|
||||
def run_experiment(args: argparse.Namespace) -> dict[str, Any]:
|
||||
from vllm import LLM
|
||||
|
||||
probe = environment_probe()
|
||||
started = time.perf_counter()
|
||||
llm = LLM(
|
||||
model=args.model,
|
||||
quantization="nvfp4_per_token",
|
||||
dtype="bfloat16",
|
||||
tensor_parallel_size=1,
|
||||
enforce_eager=args.enforce_eager,
|
||||
enable_prefix_caching=False,
|
||||
max_model_len=args.max_model_len,
|
||||
max_num_seqs=1,
|
||||
gpu_memory_utilization=args.gpu_memory_utilization,
|
||||
trust_remote_code=False,
|
||||
disable_log_stats=True,
|
||||
)
|
||||
load_seconds = time.perf_counter() - started
|
||||
_mark_persistent_cache_ready()
|
||||
|
||||
try:
|
||||
baseline = llm.apply_model(partial(_probe_model, layer_index=args.layer))[0]
|
||||
baseline_generation = _generation_signature(llm, args.prompt)
|
||||
|
||||
mutated_reload = llm.collective_rpc(
|
||||
_reload_checkpoint,
|
||||
timeout=args.reload_timeout,
|
||||
kwargs={"model_path": args.model, "mutation_layer": args.layer},
|
||||
)[0]
|
||||
mutated = llm.apply_model(partial(_probe_model, layer_index=args.layer))[0]
|
||||
mutated_generation = _generation_signature(llm, args.prompt)
|
||||
|
||||
restored_reload = llm.collective_rpc(
|
||||
_reload_checkpoint,
|
||||
timeout=args.reload_timeout,
|
||||
kwargs={"model_path": args.model, "mutation_layer": None},
|
||||
)[0]
|
||||
restored = llm.apply_model(partial(_probe_model, layer_index=args.layer))[0]
|
||||
restored_generation = _generation_signature(llm, args.prompt)
|
||||
|
||||
comparison = _compare_phases(
|
||||
baseline,
|
||||
mutated,
|
||||
restored,
|
||||
baseline_generation,
|
||||
mutated_generation,
|
||||
restored_generation,
|
||||
)
|
||||
return {
|
||||
"status": "passed" if comparison["passed"] else "failed",
|
||||
"environment": probe,
|
||||
"configuration": {
|
||||
"model": args.model,
|
||||
"layer": args.layer,
|
||||
"quantization": "nvfp4_per_token",
|
||||
"enforce_eager": args.enforce_eager,
|
||||
"max_model_len": args.max_model_len,
|
||||
"gpu_memory_utilization": args.gpu_memory_utilization,
|
||||
},
|
||||
"initial_load_seconds": load_seconds,
|
||||
"reloads": {
|
||||
"mutated": mutated_reload,
|
||||
"restored": restored_reload,
|
||||
},
|
||||
"generations": {
|
||||
"baseline": baseline_generation,
|
||||
"mutated": mutated_generation,
|
||||
"restored": restored_generation,
|
||||
},
|
||||
"kernel_probes": {
|
||||
"baseline": baseline,
|
||||
"mutated": mutated,
|
||||
"restored": restored,
|
||||
},
|
||||
"comparison": comparison,
|
||||
}
|
||||
finally:
|
||||
shutdown = getattr(llm, "shutdown", None)
|
||||
if callable(shutdown):
|
||||
shutdown()
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--model", default=DEFAULT_MODEL)
|
||||
parser.add_argument("--layer", type=int, default=0)
|
||||
parser.add_argument("--prompt", default="The capital of France is")
|
||||
parser.add_argument("--max-model-len", type=int, default=256)
|
||||
parser.add_argument("--gpu-memory-utilization", type=float, default=0.5)
|
||||
parser.add_argument("--reload-timeout", type=float, default=1800)
|
||||
parser.add_argument("--enforce-eager", action=argparse.BooleanOptionalAction, default=True)
|
||||
parser.add_argument("--environment-only", action="store_true")
|
||||
parser.add_argument("--output", type=Path)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main() -> None:
|
||||
os.environ.setdefault("VLLM_ALLOW_INSECURE_SERIALIZATION", "1")
|
||||
args = parse_args()
|
||||
if args.environment_only:
|
||||
result: dict[str, Any] = {"status": "passed", "environment": environment_probe()}
|
||||
else:
|
||||
result = run_experiment(args)
|
||||
|
||||
rendered = json.dumps(result, indent=2, sort_keys=True)
|
||||
print(rendered, flush=True)
|
||||
if args.output is not None:
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.output.write_text(rendered + "\n")
|
||||
if result["status"] != "passed":
|
||||
raise RuntimeError("NVFP4 layerwise reload verification failed")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+15
-1
@@ -1,3 +1,17 @@
|
||||
# Configs
|
||||
|
||||
This directory contains configurations for internal experiments. We do not guarantee that these configurations are functional or up-to-date.
|
||||
Configurations for running prime-rl.
|
||||
|
||||
- **[`basic/`](basic)** — small, 2-GPU (1 trainer + 1 inference) configs for the core
|
||||
environments, sized to run on a single dev machine. Each mirrors the matching
|
||||
[`examples/basic/`](../examples/basic) tutorial and is smoke-tested for one step.
|
||||
Envs: `reverse-text`, `alphabet-sort`, `wiki-search`, `wordle`, `hendrycks-sanity`.
|
||||
- **`ci/`** — integration and nightly configs used by CI.
|
||||
- **`debug/`** — throwaway configs for developing the framework itself: `algo/`
|
||||
(per-algorithm smokes) and `fake/` (fake-data trainer/SFT smokes). Not guaranteed
|
||||
functional or up to date.
|
||||
|
||||
```bash
|
||||
uv run rl @ configs/basic/<env>/rl.toml
|
||||
uv run sft @ configs/basic/<env>/sft.toml # where present
|
||||
```
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
max_steps = 100
|
||||
seq_len = 2048
|
||||
|
||||
[wandb]
|
||||
project = "alphabet-sort-debug"
|
||||
name = "alphabet-sort"
|
||||
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 512
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "alphabet-sort"
|
||||
name = "alphabet-sort"
|
||||
args = { min_turns = 2, max_turns = 2 }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 50
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "alphabet-sort"
|
||||
name = "alphabet-sort"
|
||||
num_examples = 50
|
||||
group_size = 4
|
||||
args = { min_turns = 2, max_turns = 2 }
|
||||
|
||||
[trainer]
|
||||
|
||||
[inference]
|
||||
@@ -0,0 +1,8 @@
|
||||
# alphabet-sort (2 GPU)
|
||||
|
||||
Multi-turn task driven by a colocated user simulator, LoRA on `Qwen3-4B`. Dev mirror of
|
||||
[`examples/basic/alphabet-sort`](../../../examples/basic/alphabet-sort).
|
||||
|
||||
```bash
|
||||
uv run rl @ configs/basic/alphabet-sort/rl.toml
|
||||
```
|
||||
@@ -0,0 +1,42 @@
|
||||
# Alphabet-sort on 2 GPUs (1 trainer + 1 inference) — a multi-turn task driven by a colocated
|
||||
# user simulator, trained with LoRA on Qwen3-4B. Dev-sized mirror of examples/basic/alphabet-sort.
|
||||
|
||||
max_steps = 200
|
||||
seq_len = 2048
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 1
|
||||
num_infer_gpus = 1
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[wandb]
|
||||
project = "alphabet-sort"
|
||||
name = "alphabet-sort"
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.lora]
|
||||
rank = 32
|
||||
alpha = 64
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-5
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 128
|
||||
group_size = 8
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
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" } }
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
[inference]
|
||||
@@ -0,0 +1,9 @@
|
||||
# hendrycks-sanity (2 GPU)
|
||||
|
||||
Single-turn math sanity run (reward climbs slowly, meant to run long),
|
||||
`DeepSeek-R1-Distill-Qwen-1.5B`. Dev mirror of
|
||||
[`examples/basic/hendrycks-sanity`](../../../examples/basic/hendrycks-sanity).
|
||||
|
||||
```bash
|
||||
uv run rl @ configs/basic/hendrycks-sanity/rl.toml
|
||||
```
|
||||
@@ -0,0 +1,36 @@
|
||||
# Hendrycks-math sanity on 2 GPUs (1 trainer + 1 inference) — a single-turn math env meant to
|
||||
# run long (reward climbs slowly). Dev-sized mirror of examples/basic/hendrycks-sanity.
|
||||
|
||||
max_steps = 5000
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 1
|
||||
num_infer_gpus = 1
|
||||
|
||||
[model]
|
||||
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"
|
||||
|
||||
[wandb]
|
||||
project = "hendrycks-sanity"
|
||||
name = "hendrycks-sanity"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 128
|
||||
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", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.model]
|
||||
seq_len = 16384
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 8192
|
||||
|
||||
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
reasoning_parser = "think"
|
||||
@@ -0,0 +1,9 @@
|
||||
# reverse-text (2 GPU)
|
||||
|
||||
Smallest end-to-end RL loop — single-turn, `Qwen3-0.6B`. Dev mirror of
|
||||
[`examples/basic/reverse-text`](../../../examples/basic/reverse-text).
|
||||
|
||||
```bash
|
||||
uv run sft @ configs/basic/reverse-text/sft.toml # optional warmup
|
||||
uv run rl @ configs/basic/reverse-text/rl.toml
|
||||
```
|
||||
@@ -0,0 +1,40 @@
|
||||
# Reverse-text on 2 GPUs (1 trainer + 1 inference) — the smallest end-to-end RL loop
|
||||
# (single-turn, 0.6B). Dev-sized mirror of examples/basic/reverse-text.
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 1
|
||||
num_infer_gpus = 1
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
|
||||
|
||||
[wandb]
|
||||
project = "reverse-text"
|
||||
name = "reverse-text"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 128
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
[inference]
|
||||
|
||||
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
|
||||
# suffix misses the MODEL_RENDERER_MAP exact match).
|
||||
[orchestrator.renderer]
|
||||
name = "prime-qwen3"
|
||||
@@ -0,0 +1,19 @@
|
||||
# SFT warmup for reverse-text on 2 GPUs. Dev-sized mirror of examples/basic/reverse-text/sft.toml.
|
||||
|
||||
max_steps = 100
|
||||
|
||||
[deployment]
|
||||
num_gpus = 2
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B"
|
||||
|
||||
[data]
|
||||
name = "willcb/R1-reverse-wikipedia-paragraphs-v1-1000"
|
||||
seq_len = 4096
|
||||
batch_size = 32
|
||||
|
||||
[optim]
|
||||
lr = 2e-5
|
||||
@@ -0,0 +1,8 @@
|
||||
# wiki-search (2 GPU)
|
||||
|
||||
Multi-turn tool calling (search a wiki corpus via native V1 tools), LoRA on `Qwen3-4B`. Dev mirror
|
||||
of [`examples/basic/wiki-search`](../../../examples/basic/wiki-search).
|
||||
|
||||
```bash
|
||||
uv run rl @ configs/basic/wiki-search/rl.toml
|
||||
```
|
||||
@@ -0,0 +1,51 @@
|
||||
# Wiki-search on 2 GPUs (1 trainer + 1 inference) — a multi-turn tool-calling task (the model
|
||||
# searches a wiki corpus via MCP tools), trained with LoRA on Qwen3-4B. Dev-sized mirror of
|
||||
# examples/basic/wiki-search.
|
||||
|
||||
max_steps = 200
|
||||
seq_len = 4096
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 1
|
||||
num_infer_gpus = 1
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[wandb]
|
||||
project = "wiki-search"
|
||||
name = "wiki-search"
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-5
|
||||
weight_decay = 0.0
|
||||
|
||||
[trainer.model.lora]
|
||||
rank = 8
|
||||
dropout = 0.0
|
||||
target_modules = [
|
||||
"q_proj",
|
||||
"k_proj",
|
||||
"v_proj",
|
||||
"o_proj",
|
||||
"gate_proj",
|
||||
"up_proj",
|
||||
"down_proj",
|
||||
]
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 128
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 512
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "wiki-search"
|
||||
env.taskset = { id = "wiki-search-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
[inference.model]
|
||||
tool_call_parser = "hermes"
|
||||
@@ -0,0 +1,9 @@
|
||||
# wordle (2 GPU)
|
||||
|
||||
Multi-turn Wordle (~6-turn games), `Qwen3-1.7B-Wordle-SFT`. Dev mirror of
|
||||
[`examples/basic/wordle`](../../../examples/basic/wordle).
|
||||
|
||||
```bash
|
||||
uv run sft @ configs/basic/wordle/sft.toml # optional warmup
|
||||
uv run rl @ configs/basic/wordle/rl.toml
|
||||
```
|
||||
@@ -1,6 +1,5 @@
|
||||
# Wordle (classic v0 TextArena env) on 2 GPUs (1 trainer + 1 inference), run via the
|
||||
# legacy bridge. The Wordle-SFT model plays a full ~6-turn game per rollout; the bridge
|
||||
# serves each multi-turn rollout to the orchestrator as a vf.Trace.
|
||||
# Wordle on 2 GPUs (1 trainer + 1 inference). The Wordle-SFT model plays a
|
||||
# full ~6-turn game per rollout.
|
||||
|
||||
max_steps = 200
|
||||
seq_len = 8192
|
||||
@@ -23,8 +22,9 @@ batch_size = 128
|
||||
group_size = 8
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "wordle"
|
||||
name = "wordle"
|
||||
env.taskset = { id = "wordle-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 1024
|
||||
@@ -33,9 +33,6 @@ max_completion_tokens = 1024
|
||||
|
||||
[inference] # single inference GPU (no data parallelism)
|
||||
|
||||
# Qwen3 finetune with the standard PI template patch (byte-identical to
|
||||
# PrimeIntellect/Qwen3-0.6B base); always re-emits prior <think> blocks.
|
||||
# Match that with renderer thinking_retention.
|
||||
# Fine-tune inherits the PrimeIntellect Qwen3 template byte-for-byte.
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
thinking_retention = "all"
|
||||
name = "prime-qwen3"
|
||||
@@ -0,0 +1,20 @@
|
||||
# SFT warmup for wordle on 2 GPUs. Dev-sized mirror of examples/basic/wordle/sft.toml.
|
||||
|
||||
max_steps = 20
|
||||
|
||||
[deployment]
|
||||
num_gpus = 2
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-1.7B"
|
||||
|
||||
[data]
|
||||
name = "willcb/V3-wordle"
|
||||
seq_len = 1024
|
||||
batch_size = 64
|
||||
micro_batch_size = 1
|
||||
|
||||
[optim]
|
||||
lr = 1e-5
|
||||
@@ -23,9 +23,9 @@ group_size = 8
|
||||
max_completion_tokens = 384
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "alphabet-sort"
|
||||
name = "alphabet-sort"
|
||||
args = { min_turns = 2, max_turns = 2, min_names_per_turn = 1, max_names_per_turn = 3, similarity_power = 4, power_per_turn = false }
|
||||
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" } }
|
||||
|
||||
[inference]
|
||||
|
||||
|
||||
+6
-3
@@ -27,12 +27,15 @@ name = "r8-1e-4"
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[inference]
|
||||
enable_lora = true
|
||||
gpu_memory_utilization = 0.7
|
||||
|
||||
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
|
||||
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
|
||||
# suffix misses the MODEL_RENDERER_MAP exact match).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
name = "prime-qwen3"
|
||||
+6
-3
@@ -26,12 +26,15 @@ name = "r8-1e-4"
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[inference]
|
||||
enable_lora = true
|
||||
gpu_memory_utilization = 0.7
|
||||
|
||||
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
|
||||
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
|
||||
# suffix misses the MODEL_RENDERER_MAP exact match).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
name = "prime-qwen3"
|
||||
+3
-1
@@ -26,7 +26,9 @@ group_size = 16
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.7
|
||||
+6
-3
@@ -15,7 +15,9 @@ lr = 3e-5
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[ckpt]
|
||||
interval = 10
|
||||
@@ -24,6 +26,7 @@ resume_step = -1
|
||||
[weight_broadcast]
|
||||
type = "filesystem"
|
||||
|
||||
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
|
||||
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
|
||||
# suffix misses the MODEL_RENDERER_MAP exact match).
|
||||
[renderer]
|
||||
name = "default"
|
||||
name = "prime-qwen3"
|
||||
+8
-4
@@ -2,7 +2,7 @@
|
||||
# The policy inference deployment is launched by the rl entrypoint on GPU 0;
|
||||
# the frozen reference server is started externally by the test fixture (see
|
||||
# tests/integration/test_reverse_text_rl_opd.py) on the same GPU. Trainer
|
||||
# takes GPU 1. Training config mirrors `reverse_text/start.toml`.
|
||||
# takes GPU 1. Training config mirrors `reverse-text/start.toml`.
|
||||
|
||||
max_steps = 15
|
||||
seq_len = 2048
|
||||
@@ -32,13 +32,15 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
|
||||
base_url = ["http://localhost:8001/v1"]
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -48,7 +50,9 @@ num_examples = 16
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
+12
-9
@@ -2,7 +2,7 @@
|
||||
# The policy inference deployment is launched by the rl entrypoint on GPU 0;
|
||||
# the frozen sampling server is started externally by the test fixture (see
|
||||
# tests/integration/test_reverse_text_rl_sft.py) on the same GPU. Trainer
|
||||
# takes GPU 1. Training config mirrors `reverse_text/start.toml`.
|
||||
# takes GPU 1. Training config mirrors `reverse-text/start.toml`.
|
||||
|
||||
max_steps = 15
|
||||
seq_len = 2048
|
||||
@@ -33,19 +33,20 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
|
||||
base_url = ["http://localhost:8001/v1"]
|
||||
|
||||
# The student's renderer tokenizes the teacher's messages into the student's
|
||||
# token space (backfill). Use `default` (wraps the student tokenizer's
|
||||
# apply_chat_template) so the CE target is faithful to the student's actual
|
||||
# chat template. The stock `qwen3` renderer reimplements the Qwen format and
|
||||
# injects an empty `<think></think>` block, which this model's custom template
|
||||
# does not emit — corrupting the distillation target.
|
||||
# token space (backfill). Use `prime-qwen3` — it matches this PrimeIntellect
|
||||
# Qwen3 model's chat template token-for-token (single-turn + system), so the CE
|
||||
# target stays faithful, without the empty `<think></think>` block the stock
|
||||
# `qwen3` renderer injects (which this model's template never emits).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -55,7 +56,9 @@ num_examples = 16
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
+6
-3
@@ -24,10 +24,13 @@ group_size = 16
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[inference]
|
||||
|
||||
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
|
||||
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
|
||||
# suffix misses the MODEL_RENDERER_MAP exact match).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
name = "prime-qwen3"
|
||||
+6
-3
@@ -23,10 +23,13 @@ group_size = 16
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[inference]
|
||||
|
||||
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
|
||||
# PrimeIntellect Qwen3 fine-tune - select its renderer explicitly (the -SFT
|
||||
# suffix misses the MODEL_RENDERER_MAP exact match).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
name = "prime-qwen3"
|
||||
@@ -1,4 +1,4 @@
|
||||
# Based on configs/multimodal/rl_color_codeword.toml but tuned for CI
|
||||
# Based on configs/debug/multimodal.toml but tuned for CI.
|
||||
max_steps = 25
|
||||
seq_len = 4096
|
||||
|
||||
@@ -7,7 +7,7 @@ num_train_gpus = 4
|
||||
num_infer_gpus = 4
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-VL-4B-Instruct"
|
||||
name = "Qwen/Qwen3.5-4B"
|
||||
|
||||
[model.vlm]
|
||||
vision_encoder_attr = "model.visual"
|
||||
@@ -22,12 +22,13 @@ max_completion_tokens = 64
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "color-codeword"
|
||||
taskset = { id = "color-codeword-v1", images_per_turn = 1 }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
env.taskset = { id = "color-codeword-v1", images_per_turn = 1 }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer]
|
||||
|
||||
[trainer.model]
|
||||
impl = "custom"
|
||||
optimization_dtype = "bfloat16"
|
||||
reduce_dtype = "bfloat16"
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Minimal SFT config with a [slurm] section — fixture for the slim-wheel config
|
||||
# parse check in cpu_tests.yaml. On the slim wheel the templates/ data dir is
|
||||
# absent, so [slurm].template_path must resolve to None instead of erroring.
|
||||
[slurm]
|
||||
job_name = "slim-sft-check"
|
||||
@@ -36,27 +36,27 @@ Every config writes to the default `outputs/` directory, so running two back-to-
|
||||
|
||||
```bash
|
||||
# GRPO (no frozen model)
|
||||
uv run rl @ configs/debug/algorithms/grpo.toml --output-dir outputs/grpo
|
||||
uv run rl @ configs/debug/algo/grpo.toml --output-dir outputs/grpo
|
||||
|
||||
# MaxRL (no frozen model)
|
||||
uv run rl @ configs/debug/algorithms/max_rl.toml --output-dir outputs/max_rl
|
||||
uv run rl @ configs/debug/algo/max_rl.toml --output-dir outputs/max_rl
|
||||
|
||||
# OPD (needs the frozen model on port 8001)
|
||||
uv run rl @ configs/debug/algorithms/opd.toml --output-dir outputs/opd
|
||||
uv run rl @ configs/debug/algorithms/opd_lora.toml --output-dir outputs/opd_lora
|
||||
uv run rl @ configs/debug/algo/opd.toml --output-dir outputs/opd
|
||||
uv run rl @ configs/debug/algo/opd_lora.toml --output-dir outputs/opd_lora
|
||||
|
||||
# SFT distillation (needs the frozen model on port 8001)
|
||||
uv run rl @ configs/debug/algorithms/sft_distill.toml --output-dir outputs/sft_distill
|
||||
uv run rl @ configs/debug/algorithms/sft_distill_lora.toml --output-dir outputs/sft_distill_lora
|
||||
uv run rl @ configs/debug/algo/sft_distill.toml --output-dir outputs/sft_distill
|
||||
uv run rl @ configs/debug/algo/sft_distill_lora.toml --output-dir outputs/sft_distill_lora
|
||||
|
||||
# Self-distillation against the live policy (no frozen model)
|
||||
uv run rl @ configs/debug/algorithms/self_distill.toml --output-dir outputs/self_distill
|
||||
uv run rl @ configs/debug/algo/self_distill.toml --output-dir outputs/self_distill
|
||||
|
||||
# ECHO (no frozen model; multi-turn env)
|
||||
uv run rl @ configs/debug/algorithms/echo.toml --output-dir outputs/echo
|
||||
uv run rl @ configs/debug/algo/echo.toml --output-dir outputs/echo
|
||||
|
||||
# Mixed per-env algorithms: GRPO + OPD in one run (needs the frozen model on port 8001)
|
||||
uv run rl @ configs/debug/algorithms/mixed_grpo_opd.toml --output-dir outputs/mixed_grpo_opd
|
||||
uv run rl @ configs/debug/algo/mixed_grpo_opd.toml --output-dir outputs/mixed_grpo_opd
|
||||
```
|
||||
|
||||
See [docs/algorithms.md](../../../docs/algorithms.md) for what each algorithm does and how to author your own.
|
||||
@@ -1,6 +1,6 @@
|
||||
# ECHO on the multi-turn alphabet-sort env (bundled with verifiers): GRPO on
|
||||
# ECHO on the multi-turn alphabet-sort V1 taskset: GRPO on
|
||||
# action tokens + weighted CE on the env's observation tokens.
|
||||
# uv run rl @ configs/debug/algorithms/echo.toml
|
||||
# uv run rl @ configs/debug/algo/echo.toml
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 4096
|
||||
@@ -25,8 +25,9 @@ type = "echo"
|
||||
alpha = 0.1
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "alphabet-sort"
|
||||
args = { min_turns = 3, max_turns = 5, power_per_turn = false }
|
||||
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" } }
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 512
|
||||
@@ -37,11 +38,9 @@ max_completion_tokens = 512
|
||||
type = "zero_advantage"
|
||||
enforce = false
|
||||
|
||||
# Qwen3 finetune with the standard PI template patch; always re-emits prior
|
||||
# <think> blocks, matched by renderer thinking_retention.
|
||||
# Fine-tune inherits the PrimeIntellect Qwen3 template byte-for-byte.
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
thinking_retention = "all"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-6
|
||||
@@ -16,13 +16,15 @@ group_size = 16
|
||||
type = "grpo"
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -32,7 +34,9 @@ num_examples = 128
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
@@ -16,13 +16,15 @@ group_size = 16
|
||||
type = "max_rl"
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -32,7 +34,9 @@ num_examples = 128
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
+9
-5
@@ -6,7 +6,7 @@
|
||||
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
|
||||
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
|
||||
# Then:
|
||||
# uv run rl @ configs/debug/algorithms/mixed_grpo_opd.toml
|
||||
# uv run rl @ configs/debug/algo/mixed_grpo_opd.toml
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
@@ -26,18 +26,20 @@ group_size = 16
|
||||
type = "grpo"
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text-grpo"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text-opd"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.train.env.algo]
|
||||
type = "opd"
|
||||
@@ -54,7 +56,9 @@ num_examples = 128
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
@@ -3,7 +3,7 @@
|
||||
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
|
||||
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
|
||||
# Then:
|
||||
# uv run rl @ configs/debug/algorithms/opd.toml
|
||||
# uv run rl @ configs/debug/algo/opd.toml
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
@@ -28,13 +28,15 @@ base_url = ["http://localhost:8001/v1"]
|
||||
|
||||
# Teacher rolls out over plain chat-completions (no tokens); the renderer backfills them.
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -44,7 +46,9 @@ num_examples = 128
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
@@ -3,7 +3,7 @@
|
||||
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
|
||||
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
|
||||
# Then:
|
||||
# uv run rl @ configs/debug/algorithms/opd_lora.toml
|
||||
# uv run rl @ configs/debug/algo/opd_lora.toml
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
@@ -28,13 +28,15 @@ base_url = ["http://localhost:8001/v1"]
|
||||
|
||||
# Teacher rolls out over plain chat-completions (no tokens); the renderer backfills them.
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -44,7 +46,9 @@ num_examples = 128
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-4
|
||||
@@ -2,7 +2,7 @@
|
||||
# policy itself: the reference for each completion is the current model
|
||||
# conditioned on the expert demonstration — no extra deployment needed.
|
||||
# reverse-text carries the demonstration in its top-level `answer` field.
|
||||
# uv run rl @ configs/debug/algorithms/self_distill.toml
|
||||
# uv run rl @ configs/debug/algo/self_distill.toml
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
@@ -24,13 +24,15 @@ type = "opsd"
|
||||
demo_key = "answer"
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -40,7 +42,9 @@ num_examples = 128
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
@@ -3,7 +3,7 @@
|
||||
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
|
||||
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
|
||||
# Then:
|
||||
# uv run rl @ configs/debug/algorithms/sft_distill.toml
|
||||
# uv run rl @ configs/debug/algo/sft_distill.toml
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
@@ -28,18 +28,20 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
|
||||
base_url = ["http://localhost:8001/v1"]
|
||||
|
||||
# The student's renderer tokenizes the teacher's messages into the student's
|
||||
# token space (backfill). Use `default` (wraps the student tokenizer's
|
||||
# apply_chat_template) so the CE target is faithful to the student's actual
|
||||
# chat template. The stock `qwen3` renderer injects an empty `<think></think>`
|
||||
# block this model's custom template never emits, corrupting the target.
|
||||
# token space (backfill). Use `prime-qwen3` — it matches this PrimeIntellect
|
||||
# Qwen3 model's chat template token-for-token (single-turn + system), keeping the
|
||||
# CE target faithful, without the empty `<think></think>` block the stock `qwen3`
|
||||
# renderer injects (which this model's template never emits).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -49,7 +51,9 @@ num_examples = 128
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
+12
-8
@@ -3,7 +3,7 @@
|
||||
# --model.name PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL \
|
||||
# --server.port 8001 --gpu-memory-utilization 0.5 --model.enforce-eager
|
||||
# Then:
|
||||
# uv run rl @ configs/debug/algorithms/sft_distill_lora.toml
|
||||
# uv run rl @ configs/debug/algo/sft_distill_lora.toml
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
@@ -28,18 +28,20 @@ name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-RL"
|
||||
base_url = ["http://localhost:8001/v1"]
|
||||
|
||||
# The student's renderer tokenizes the teacher's messages into the student's
|
||||
# token space (backfill). Use `default` (wraps the student tokenizer's
|
||||
# apply_chat_template) so the CE target is faithful to the student's actual
|
||||
# chat template. The stock `qwen3` renderer injects an empty `<think></think>`
|
||||
# block this model's custom template never emits, corrupting the target.
|
||||
# token space (backfill). Use `prime-qwen3` — it matches this PrimeIntellect
|
||||
# Qwen3 model's chat template token-for-token (single-turn + system), keeping the
|
||||
# CE target faithful, without the empty `<think></think>` block the stock `qwen3`
|
||||
# renderer injects (which this model's template never emits).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
name = "prime-qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 1
|
||||
@@ -49,7 +51,9 @@ num_examples = 128
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-4
|
||||
@@ -1,42 +0,0 @@
|
||||
max_steps = 3000
|
||||
seq_len = 4096
|
||||
|
||||
[wandb]
|
||||
project = "hendrycks-math-debug"
|
||||
name = "hendrycks-math-sanity"
|
||||
|
||||
[model]
|
||||
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 256
|
||||
max_inflight_rollouts = 512
|
||||
group_size = 8
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "hendrycks-math"
|
||||
taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 50
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "aime2024"
|
||||
taskset = { id = "aime24-v1" }
|
||||
group_size = 16
|
||||
|
||||
[trainer.model.ac]
|
||||
|
||||
[trainer.model.compile]
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 4096
|
||||
|
||||
[log]
|
||||
level = "debug"
|
||||
|
||||
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
reasoning_parser = "think"
|
||||
@@ -1,2 +0,0 @@
|
||||
[model]
|
||||
enforce_eager = true
|
||||
@@ -1,14 +0,0 @@
|
||||
max_steps = 5
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/GLM-0.5B"
|
||||
moe_use_grouped_mm = false
|
||||
impl = "custom"
|
||||
attn = "sdpa"
|
||||
|
||||
[model.compile]
|
||||
|
||||
[data]
|
||||
type = "fake"
|
||||
batch_size = 2
|
||||
seq_len = 1024
|
||||
@@ -1,51 +0,0 @@
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
|
||||
|
||||
[wandb]
|
||||
project = "reverse-text-debug"
|
||||
name = "debug-multi-env"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 128
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
|
||||
# -- multi train envs --
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text-train-1"
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text-train-2"
|
||||
|
||||
# -- multi eval envs --
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 10
|
||||
num_examples = 16
|
||||
group_size = 4
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text-eval-1"
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text-eval-2"
|
||||
interval = 5
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.5
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 128
|
||||
@@ -1,76 +0,0 @@
|
||||
# 2-GPU debug RL run for the multimodal (renderer) path: Qwen3-VL-4B on
|
||||
# color-codeword. Sized to actually learn (reward should trend up) while
|
||||
# staying 2-GPU friendly. Exercises RendererClient + Qwen3VLRenderer end-to-end.
|
||||
|
||||
max_steps = 15
|
||||
seq_len = 4096
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-VL-4B-Instruct"
|
||||
|
||||
[model.vlm]
|
||||
vision_encoder_attr = "model.visual"
|
||||
language_model_attr = "model.language_model"
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 1
|
||||
num_infer_gpus = 1
|
||||
gpus_per_node = 2
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 256
|
||||
group_size = 16
|
||||
# Image processor is CPU-bound and dominates for VLMs; returns diminish past 4.
|
||||
pool_size = 4
|
||||
|
||||
# Step 0 on Qwen3-VL-4B vs color-codeword can be uniform (all-correct or
|
||||
# all-wrong), so don't enforce zero-advantage dropping or training would crash
|
||||
# before any progress.
|
||||
[[orchestrator.post_batch_filters]]
|
||||
type = "gibberish"
|
||||
|
||||
[[orchestrator.post_batch_filters]]
|
||||
type = "repetition"
|
||||
|
||||
[[orchestrator.post_batch_filters]]
|
||||
type = "zero_advantage"
|
||||
enforce = false
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 64
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "color-codeword"
|
||||
taskset = { id = "color-codeword-v1", images_per_turn = 1 }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
# Default renderer (AutoRendererConfig) resolves Qwen3-VL-4B-Instruct from
|
||||
# MODEL_RENDERER_MAP to Qwen3VLRenderer at runtime; no explicit name needed.
|
||||
|
||||
[trainer]
|
||||
|
||||
[trainer.model]
|
||||
optimization_dtype = "bfloat16"
|
||||
reduce_dtype = "bfloat16"
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
[inference]
|
||||
|
||||
[inference.model]
|
||||
# Workaround for vLLM 0.20.1 Qwen3-VL deepstack buffer bug: when num_scheduled_tokens
|
||||
# (188) gets padded up to the next cudagraph_capture_size (192), the model's
|
||||
# _set_deepstack_input_embeds sizes the buffer to 188 but forward() runs with 192,
|
||||
# triggering "Requested more deepstack tokens than available in buffer". Eager mode
|
||||
# skips the padding so num_input_tokens == num_scheduled_tokens.
|
||||
enforce_eager = true
|
||||
|
||||
[inference.parallel]
|
||||
dp = 1
|
||||
tp = 1
|
||||
|
||||
[wandb]
|
||||
project = "debug"
|
||||
name = "multimodal"
|
||||
tags = ["qwen3vl-4b", "color-codeword", "renderer"]
|
||||
@@ -1,6 +0,0 @@
|
||||
max_steps = 5
|
||||
batch_size = 16
|
||||
|
||||
[train.sampling]
|
||||
max_completion_tokens = 16
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# v1 port of examples/alphabet_sort/rl.toml — identical except the env block, which loads
|
||||
# the v1 `alphabet-sort-v1` taskset (multi-turn via a colocated vf.User) instead of the v0
|
||||
# `primeintellect/alphabet-sort` env. Harness runs on the subprocess runtime.
|
||||
|
||||
max_steps = 200
|
||||
seq_len = 2048
|
||||
|
||||
[ckpt] # Checkpoint at the end of training
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[wandb]
|
||||
project = "alphabet-sort"
|
||||
name = "alphabet-sort"
|
||||
|
||||
[trainer.model]
|
||||
impl = "auto"
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.lora]
|
||||
rank = 32
|
||||
alpha = 64
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-5
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 8
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 768
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "alphabet-sort"
|
||||
taskset = { id = "alphabet-sort-v1", min_turns = 3, max_turns = 5, task = { power_per_turn = false } }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[inference] # Default inference config
|
||||
@@ -1,54 +0,0 @@
|
||||
# Debug v1 RL run: the v1 `general-agent-v1` taskset (GeneralAgentSolverTaskset) driven by the
|
||||
# default harness, with the agent and its tool server colocated in a modal sandbox. Copied from
|
||||
# configs/general_agent/rl_qwen3_4b.toml and rewired for v1 (taskset + harness + renderer; the
|
||||
# v0 `id = "general-agent-solver-rlm"` env becomes the v1 taskset + a separate harness).
|
||||
|
||||
max_steps = 200
|
||||
seq_len = 32768
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 4
|
||||
num_infer_gpus = 4
|
||||
|
||||
[wandb]
|
||||
project = "general-agent-debug"
|
||||
name = "qwen3-4b-v1"
|
||||
|
||||
[ckpt]
|
||||
interval = 100
|
||||
keep_last = 1
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[trainer]
|
||||
|
||||
[trainer.model]
|
||||
cp = 2
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.compile]
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 256
|
||||
rollouts_per_example = 8
|
||||
max_off_policy_steps = 32
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
# v1 general-agent solver taskset; the tool server is colocated in the harness's modal sandbox.
|
||||
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } } }
|
||||
harness = { id = "null", runtime = { type = "modal" } }
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.85
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 32768
|
||||
|
||||
[inference.parallel]
|
||||
dp = 4
|
||||
@@ -1,41 +0,0 @@
|
||||
# GSM8K (v1) — the v1 port of configs/gsm8k/rl.toml. Trains Qwen3-0.6B on GSM8K through the
|
||||
# v1 env server: the orchestrator spawns a v1 EnvServer for the gsm8k-v1 taskset and trains on
|
||||
# the returned Traces. Runs on 2 GPUs (1 inference, 1 training):
|
||||
# uv run inference --model.name PrimeIntellect/Qwen3-0.6B # Inference pane (GPU 0)
|
||||
# uv run rl @ configs/debug/v1/gsm8k.toml --ckpt # Trainer pane (GPU 1)
|
||||
|
||||
max_steps = 100
|
||||
seq_len = 2048
|
||||
|
||||
[wandb]
|
||||
project = "gsm8k-debug"
|
||||
name = "gsm8k-v1"
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-0.6B"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
taskset = { id = "gsm8k-v1", split = "train" }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 20
|
||||
num_examples = 256
|
||||
|
||||
[orchestrator.eval.sampling]
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
taskset = { id = "gsm8k-v1", split = "test" }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer] # Default trainer config
|
||||
|
||||
[inference] # Default inference config
|
||||
@@ -1,55 +0,0 @@
|
||||
# v1 analog of examples/hendrycks_sanity/rl.toml — identical config with only
|
||||
# the env sections swapped to v1 taskset/harness syntax (math-env taskset,
|
||||
# default harness, modal runtime). Submits to slurm by default; pass --no-slurm
|
||||
# to run locally.
|
||||
|
||||
output_dir = "/beegfs/mika/hendrycks-sanity-v1"
|
||||
max_steps = 200
|
||||
|
||||
[wandb]
|
||||
project = "hendrycks-sanity"
|
||||
name = "v1"
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 4
|
||||
num_infer_gpus = 4
|
||||
|
||||
[slurm]
|
||||
job_name = "hendrycks-modal"
|
||||
partition = "all"
|
||||
|
||||
[model]
|
||||
name = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 8
|
||||
seq_len = 8192
|
||||
max_inflight_rollouts = 256
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "hendrycks-math"
|
||||
taskset = { id = "math-env-v1", dataset_name = "mikasenghaas/Sanity-Test-R1D-1.5B", dataset_subset = "default" }
|
||||
harness = { id = "null", runtime = { type = "modal" } }
|
||||
timeout = { scoring = 300 }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 50
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "aime2024"
|
||||
taskset = { id = "aime24-v1" }
|
||||
harness = { id = "null", runtime = { type = "modal" } }
|
||||
timeout = { scoring = 300 }
|
||||
group_size = 32
|
||||
|
||||
[trainer.model]
|
||||
seq_len = 16384
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 8192
|
||||
|
||||
# Model not in MODEL_RENDERER_MAP — opt into DefaultRenderer (apply_chat_template).
|
||||
[orchestrator.renderer]
|
||||
name = "default"
|
||||
reasoning_parser = "think"
|
||||
@@ -1,84 +0,0 @@
|
||||
# Qwen3.5-4B SWE RL on the v1 `r2e-gym-v1` taskset through the rlm harness on the prime runtime.
|
||||
|
||||
output_dir = "/beegfs/mika/rlm-swe-qwen35-4b"
|
||||
max_steps = 400
|
||||
seq_len = 65536
|
||||
|
||||
[slurm]
|
||||
job_name = "rlm-swe-qwen35-4b"
|
||||
project_dir = "."
|
||||
pre_run_command = "prime sandbox delete --label rlm-swe-qwen35-4b -y --plain || true"
|
||||
|
||||
[deployment]
|
||||
type = "multi_node"
|
||||
num_train_nodes = 1
|
||||
num_infer_nodes = 1
|
||||
num_infer_replicas = 2
|
||||
|
||||
[wandb]
|
||||
project = "rlm-swe-debug"
|
||||
name = "qwen35-4b"
|
||||
|
||||
[weight_broadcast]
|
||||
type = "nccl"
|
||||
|
||||
[ckpt]
|
||||
interval = 50
|
||||
keep_last = 1
|
||||
resume_step = -1
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3.5-4B"
|
||||
|
||||
# --- Trainer ---
|
||||
|
||||
[trainer]
|
||||
|
||||
[trainer.model]
|
||||
cp = 4
|
||||
cp_style = "ulysses"
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.compile]
|
||||
|
||||
# --- Orchestrator ---
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 256
|
||||
group_size = 8
|
||||
max_inflight_rollouts = 512
|
||||
max_off_policy_steps = 16
|
||||
|
||||
# Thinking enabled for the Qwen3.5 renderer.
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3.5"
|
||||
enable_thinking = true
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
temperature = 1.0
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "rlm-swe-r2e"
|
||||
taskset = { id = "r2e-gym-v1" }
|
||||
harness = { id = "rlm", runtime = { type = "prime", labels = ["rlm-swe-qwen35-4b"] } }
|
||||
|
||||
[orchestrator.prime_monitor]
|
||||
|
||||
# --- Inference ---
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.85
|
||||
enable_prefix_caching = true
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 65536
|
||||
|
||||
[inference.parallel]
|
||||
dp = 8
|
||||
|
||||
# Qwen3.5-4B is a VL model; skip the vision tower for text-only SWE.
|
||||
# `language_model_only` is a vLLM MultiModalConfig arg (no prime-rl field) → pass via vllm_extra.
|
||||
[inference.vllm_extra]
|
||||
language_model_only = true
|
||||
@@ -1,41 +0,0 @@
|
||||
# Debug RL run on the v1 env server (reverse-text starter).
|
||||
# The orchestrator spawns a v1 EnvServer per env (it never loads the env
|
||||
# itself), dispatches rollouts by task index, and trains on the returned Traces
|
||||
# (renderer-tokenized). Light settings for a quick end-to-end smoke.
|
||||
|
||||
max_steps = 20
|
||||
seq_len = 2048
|
||||
|
||||
[wandb]
|
||||
project = "reverse-text"
|
||||
name = "v1"
|
||||
|
||||
[model]
|
||||
name = "PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 128
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3"
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 128
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
taskset = { id = "reverse-text-v1" }
|
||||
# reverse-text is a pure-text single-turn env: disable the bash tool (the model answers
|
||||
# directly) and use the subprocess runtime (no docker).
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
# No eval block, mirroring examples/reverse_text/rl.toml — this is a train-only
|
||||
# smoke. Add an [orchestrator.eval] block (with an interval) to exercise eval.
|
||||
|
||||
[trainer.optim]
|
||||
lr = 3e-6
|
||||
|
||||
[ckpt]
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.5
|
||||
@@ -1,118 +0,0 @@
|
||||
# v1 RL run: Qwen3.6-35B-A3B (MoE) on the v1 `scaleswe-v1` SWE taskset, rlm harness on a prime
|
||||
# sandbox runtime. Each scaleswe row ships its own Docker image (NEEDS_CONTAINER) which the
|
||||
# Environment injects into the prime sandbox; the agent edits the repo + runs tests there (no MCP
|
||||
# toolset). Router replay is enabled: trainer.enable_router_replay replays the routed-expert
|
||||
# decisions returned by inference (enable_return_routed_experts).
|
||||
#
|
||||
# Built from configs/debug/v1/r2e_gym.toml (the v1 SWE structure) + the MoE parallelism from
|
||||
# configs/general_agent/rl_qwen3_30b_a3b.toml. The deployment/parallelism is a starting point off
|
||||
# the 30B-A3B reference — confirm/adjust for your cluster and the 35B / 65k-context footprint.
|
||||
|
||||
max_steps = 400
|
||||
seq_len = 65536
|
||||
|
||||
[slurm]
|
||||
job_name = "scaleswe-qwen36-35b-a3b-rlm"
|
||||
project_dir = "."
|
||||
partition = "all"
|
||||
# Clean up this run's orphaned prime sandboxes before launch (label == SLURM job name).
|
||||
pre_run_command = 'timeout 120 prime sandbox delete --label "$SLURM_JOB_NAME" -y || true'
|
||||
|
||||
[deployment]
|
||||
type = "multi_node"
|
||||
num_train_nodes = 2
|
||||
num_infer_nodes = 2
|
||||
|
||||
[wandb]
|
||||
project = "scaleswe-debug"
|
||||
name = "qwen36-35b-a3b-rlm"
|
||||
|
||||
[weight_broadcast]
|
||||
type = "nccl"
|
||||
|
||||
[ckpt]
|
||||
interval = 50
|
||||
keep_last = 1
|
||||
resume_step = -1
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3.6-35B-A3B"
|
||||
|
||||
# --- Trainer ---
|
||||
|
||||
[trainer]
|
||||
# NCCL collective watchdog timeout — raised from default 600s: scaleswe's slow
|
||||
# multi-node startup (step-0 swebench eval + slow first SWE batch) was tripping the
|
||||
# 600s _ALLGATHER_BASE watchdog → SIGABRT trainer crash.
|
||||
dist_timeout_seconds = 3600
|
||||
# Replay the routed-expert decisions returned by inference (enable_return_routed_experts)
|
||||
# so the trainer's MoE routing matches the rollout's — cuts trainer/inference mismatch on A3B.
|
||||
enable_router_replay = true
|
||||
|
||||
[trainer.model]
|
||||
cp = 2
|
||||
# Qwen3.6 is a hybrid/linear-attention model — ring CP is unsupported; ulysses
|
||||
# all-to-all on Q/K/V works with the non-softmax kernels.
|
||||
cp_style = "ulysses"
|
||||
# Chunk the LM head over tokens to avoid materializing the full [seq, vocab] logits
|
||||
# (65k seq × large vocab) — big activation-memory saver. 1024 matches the SWE configs.
|
||||
fused_lm_head_token_chunk_size = 1024
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.compile]
|
||||
|
||||
# --- Orchestrator ---
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 256
|
||||
group_size = 16
|
||||
max_off_policy_steps = 16
|
||||
|
||||
[orchestrator.renderer]
|
||||
name = "qwen3.6"
|
||||
enable_thinking = true
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
temperature = 1.0
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "scaleswe"
|
||||
# v1 scaleswe SWE taskset; rlm harness in a prime sandbox using the row's injected Docker image.
|
||||
taskset = { id = "scaleswe-v1" }
|
||||
harness = { id = "rlm", runtime = { type = "prime", labels = ["scaleswe-qwen36-35b-a3b-rlm"] } }
|
||||
|
||||
[orchestrator.prime_monitor]
|
||||
|
||||
# --- Eval: SWE-Bench Verified (first 100 tasks) every 20 steps, rlm harness on prime ---
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 20
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swebench-verified"
|
||||
taskset = { id = "swebench-verified-v1", use_prime_registry = true }
|
||||
harness = { id = "rlm", runtime = { type = "prime", labels = ["scaleswe-qwen36-35b-a3b-rlm"] } }
|
||||
num_examples = 100
|
||||
group_size = 1
|
||||
timeout = { rollout = 3600 }
|
||||
|
||||
# --- Inference ---
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.85
|
||||
enable_prefix_caching = true
|
||||
# Return per-token routed-expert decisions to the trainer for router replay
|
||||
# (pairs with trainer.enable_router_replay).
|
||||
enable_return_routed_experts = true
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 65536
|
||||
# Qwen3.6 is not matched by the auto tool-parser resolver; set explicitly so vLLM
|
||||
# enables auto tool choice (the scaleswe SWE agent sends tool_choice="auto").
|
||||
tool_call_parser = "qwen3_coder"
|
||||
|
||||
[inference.parallel]
|
||||
dp = 2
|
||||
tp = 4
|
||||
@@ -1,17 +0,0 @@
|
||||
# Testing Elastic Inference
|
||||
|
||||
To test the elastic inference pool without having the `rl` entrypoint start the inference server:
|
||||
|
||||
1. **Run RL with the elastic config** (orchestrator discovers servers via DNS; it will find `localhost:8000` once the server is started):
|
||||
|
||||
```bash
|
||||
uv run rl @ examples/alphabet_sort/rl_elastic.toml
|
||||
```
|
||||
|
||||
The config uses `[orchestrator.model.client.elastic]` with `hostname = "localhost"` and `port = 8000`. The orchestrator will wait for at least one ready server before starting rollouts.
|
||||
|
||||
2. **Start the inference server manually** (in a separate terminal or on another machine):
|
||||
|
||||
```bash
|
||||
uv run inference --model.name Qwen/Qwen3-4B-Instruct-2507 --enable-lora --max-lora-rank 32
|
||||
```
|
||||
@@ -1,46 +0,0 @@
|
||||
# Alphabet sort RL with elastic inference pool (no inference process started by rl).
|
||||
# Start the inference server manually first, then run: uv run rl @ examples/alphabet_sort/rl_elastic.toml
|
||||
# The orchestrator discovers servers via DNS (hostname) and only uses ready ones.
|
||||
# Omitting [inference] means inference = None, so the rl entrypoint will not start an inference process.
|
||||
|
||||
max_steps = 200
|
||||
seq_len = 2048
|
||||
|
||||
[ckpt]
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[wandb]
|
||||
project = "alphabet-sort"
|
||||
name = "alphabet-sort-elastic"
|
||||
|
||||
[trainer.model]
|
||||
impl = "auto"
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.lora]
|
||||
rank = 32
|
||||
alpha = 64
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-5
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 8
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 768
|
||||
|
||||
[orchestrator.model.client.elastic]
|
||||
hostname = "localhost"
|
||||
port = 8000
|
||||
sync_interval = 5.0
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "alphabet-sort"
|
||||
name = "alphabet-sort"
|
||||
args = { min_turns = 3, max_turns = 5, power_per_turn = false }
|
||||
@@ -1,30 +0,0 @@
|
||||
max_steps = 5
|
||||
seq_len = 8192
|
||||
|
||||
[wandb]
|
||||
project = "general-agent-debug"
|
||||
name = "qwen3-0p6b-rlm"
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-0.6B"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 16
|
||||
rollouts_per_example = 4
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 4096
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } } }
|
||||
harness = { id = "null", runtime = { type = "modal" } }
|
||||
|
||||
[trainer]
|
||||
|
||||
[inference]
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 8192
|
||||
|
||||
[inference.parallel]
|
||||
dp = 1
|
||||
@@ -1,45 +0,0 @@
|
||||
max_steps = 200
|
||||
seq_len = 32768
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 4
|
||||
num_infer_gpus = 4
|
||||
|
||||
[wandb]
|
||||
project = "general-agent-debug"
|
||||
name = "qwen3-4b-rlm"
|
||||
|
||||
[ckpt]
|
||||
interval = 100
|
||||
keep_last = 1
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[trainer]
|
||||
|
||||
[trainer.model]
|
||||
cp = 2
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.compile]
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
rollouts_per_example = 8
|
||||
max_off_policy_steps = 32
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
taskset = { id = "general-agent-v1", task = { tools = { colocated = true } } }
|
||||
harness = { id = "null", runtime = { type = "modal" } }
|
||||
|
||||
[inference]
|
||||
gpu_memory_utilization = 0.85
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 32768
|
||||
|
||||
[inference.parallel]
|
||||
dp = 4
|
||||
@@ -1,83 +0,0 @@
|
||||
# GSM8K
|
||||
|
||||
In this example, we demonstrate how to train `Qwen3-0.6B` to answer math problems from the GSM8K dataset.
|
||||
|
||||
> This example runs on 2 GPUs (1 for inference, 1 for training).
|
||||
|
||||
## Setup
|
||||
|
||||
Install the environment:
|
||||
|
||||
```bash
|
||||
prime env install primeintellect/math-env
|
||||
```
|
||||
|
||||
Verify installation:
|
||||
|
||||
```bash
|
||||
uv run python -c "import math_env"
|
||||
```
|
||||
|
||||
Start the tmux session:
|
||||
|
||||
```bash
|
||||
bash scripts/tmux.sh
|
||||
```
|
||||
|
||||
## Baseline Evaluation
|
||||
|
||||
Start the inference server:
|
||||
|
||||
```bash
|
||||
# In the `Inference` pane
|
||||
uv run inference --model.name PrimeIntellect/Qwen3-0.6B
|
||||
```
|
||||
|
||||
Evaluate the base model:
|
||||
|
||||
```bash
|
||||
# In the `Trainer` pane
|
||||
uv run vf-eval math-env \
|
||||
-a '{"dataset_name": "openai/gsm8k", "dataset_subset": "main"}' \
|
||||
-m PrimeIntellect/Qwen3-0.6B \
|
||||
-b http://localhost:8000/v1 \
|
||||
-n 20 \
|
||||
-t 2048
|
||||
```
|
||||
|
||||
## RL Training
|
||||
|
||||
Train with the config file:
|
||||
|
||||
```bash
|
||||
# In the `Trainer` pane
|
||||
uv run rl @ configs/gsm8k/rl.toml \
|
||||
--wandb.project your-project-name \
|
||||
--wandb.name your-run-name \
|
||||
--ckpt
|
||||
```
|
||||
|
||||
This will write weight checkpoints in `outputs/weights/step_*`. Upload the final checkpoint to HuggingFace:
|
||||
|
||||
```bash
|
||||
uv run hf upload <user>/Qwen3-0.6B-GSM8K-RL outputs/weights/step_100
|
||||
```
|
||||
|
||||
## Evaluation
|
||||
|
||||
Evaluate your trained model:
|
||||
|
||||
```bash
|
||||
# In the `Inference` pane
|
||||
uv run inference --model.name <user>/Qwen3-0.6B-GSM8K-RL
|
||||
```
|
||||
|
||||
```bash
|
||||
# In the `Trainer` pane
|
||||
uv run vf-eval math-env \
|
||||
-a '{"dataset_name": "openai/gsm8k", "dataset_subset": "main"}' \
|
||||
-m <user>/Qwen3-0.6B-GSM8K-RL \
|
||||
-b http://localhost:8000/v1 \
|
||||
-n 20 \
|
||||
-t 2048
|
||||
```
|
||||
@@ -1,31 +0,0 @@
|
||||
max_steps = 100
|
||||
seq_len = 2048
|
||||
|
||||
[wandb]
|
||||
project = "gsm8k-debug"
|
||||
name = "gsm8k"
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-0.6B"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "gsm8k"
|
||||
taskset = { id = "gsm8k-v1", split = "train" }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer] # Default trainer config
|
||||
|
||||
[inference] # Default inference config
|
||||
|
||||
# Mirror of Qwen/Qwen3-0.6B; PI's template patch always re-emits prior
|
||||
# <think> blocks. Match that with renderer thinking_retention.
|
||||
[orchestrator.renderer]
|
||||
name = "auto"
|
||||
thinking_retention = "all"
|
||||
@@ -1,57 +0,0 @@
|
||||
# Hendryck's Math
|
||||
|
||||
In this example, we demonstrate how to train `Qwen/Qwen3-4B-Instruct-2507` to answer math problems from the Hendryck's Math dataset.
|
||||
|
||||
> This example runs on 2 GPUs (1 for inference, 1 for training).
|
||||
|
||||
## Setup
|
||||
|
||||
Install the environment:
|
||||
|
||||
```bash
|
||||
prime env install primeintellect/math-env
|
||||
```
|
||||
|
||||
Verify installation:
|
||||
|
||||
```bash
|
||||
uv run python -c "import math_env"
|
||||
```
|
||||
|
||||
Start the tmux session:
|
||||
|
||||
```bash
|
||||
bash scripts/tmux.sh
|
||||
```
|
||||
|
||||
## Baseline Evaluation
|
||||
|
||||
Start the inference server:
|
||||
|
||||
```bash
|
||||
# In the `Inference` pane
|
||||
uv run inference --model.name Qwen/Qwen3-4B-Instruct-2507
|
||||
```
|
||||
|
||||
Evaluate the base model:
|
||||
|
||||
```bash
|
||||
# In the `Trainer` pane
|
||||
uv run vf-eval math-env \
|
||||
-a '{"dataset_name": "PrimeIntellect/Hendrycks-Math", "dataset_subset": "default"}' \
|
||||
-m Qwen/Qwen3-4B-Instruct-2507 \
|
||||
-b http://localhost:8000/v1 \
|
||||
-n 20 \
|
||||
-t 2048
|
||||
```
|
||||
|
||||
## RL Training
|
||||
|
||||
Train with the config file:
|
||||
|
||||
```bash
|
||||
# In the `Trainer` pane
|
||||
uv run rl @ configs/hendrycks_math/rl.toml \
|
||||
--wandb.project your-project-name \
|
||||
--wandb.name your-run-name
|
||||
```
|
||||
@@ -1,38 +0,0 @@
|
||||
max_steps = 500
|
||||
seq_len = 2048
|
||||
|
||||
[wandb]
|
||||
project = "hendrycks-math-debug"
|
||||
name = "hendrycks-math"
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "hendrycks-math"
|
||||
taskset = { id = "math-env-v1", dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default", task = { math_verify_timeout = 60 } }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 10
|
||||
|
||||
[orchestrator.eval.sampling]
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "math500"
|
||||
taskset = { id = "math500-v1" }
|
||||
num_examples = 30
|
||||
group_size = 4
|
||||
|
||||
[trainer] # Default trainer config
|
||||
|
||||
[inference] # Default inference config
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
# math-python
|
||||
|
||||
## Setup
|
||||
|
||||
CLone `verifiers`
|
||||
|
||||
```bash
|
||||
cd ~ && curl -sSL https://raw.githubusercontent.com/PrimeIntellect-ai/verifiers/main/scripts/install.sh | bash && cd -
|
||||
```
|
||||
|
||||
Install the environment as local packages
|
||||
|
||||
```bash
|
||||
uv pip install -e ~/verifiers/environments/math_python
|
||||
```
|
||||
|
||||
This will automatically install the environment, and a pinned verifiers commit (`71006c`) which includes necessary changes to the PythonEnv.
|
||||
|
||||
## Eval
|
||||
|
||||
Get a quick vibe-check of the model
|
||||
|
||||
```bash
|
||||
vllm serve Qwen/Qwen3-4B-Instruct-2507 --enable-auto-tool-choice --tool-call-parser hermes --max-model-len 8192
|
||||
```
|
||||
|
||||
```bash
|
||||
uv run --no-sync vf-eval math-python -n 16 -r 1 -c -1 -v -m Qwen/Qwen3-4B-Instruct-2507 -b http://localhost:8000/v1 -a '{"dataset_name": "PrimeIntellect/Hendrycks-Math", "dataset_subset": "default"}' -t 512
|
||||
```
|
||||
|
||||
## RL
|
||||
|
||||
Again, make sure to have installed the environment as local packages from verifiers
|
||||
|
||||
```bash
|
||||
uv pip install -e ~/verifiers/environments/math_python
|
||||
```
|
||||
|
||||
Then, run RL in debug mode (small batch size, limited turns, 2 GPUs, etc.)
|
||||
|
||||
```bash
|
||||
uv run --no-sync rl @ configs/math_python/math_python.toml --log.level debug
|
||||
```
|
||||
@@ -1,29 +0,0 @@
|
||||
max_steps = 300
|
||||
seq_len = 4096
|
||||
|
||||
[wandb]
|
||||
project = "math-python-debug"
|
||||
name = "math-python"
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 512
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "math-python"
|
||||
args = { sandbox_client_max_workers = 128, sandbox_timeout_minutes = 10, sandbox_memory_gb = 1, sandbox_disk_size_gb = 1, pip_install_packages = "numpy sympy" }
|
||||
|
||||
[trainer] # Default trainer config
|
||||
|
||||
[inference]
|
||||
api_server_count = 4
|
||||
|
||||
[inference.model]
|
||||
tool_call_parser = "hermes"
|
||||
max_model_len = 4096
|
||||
@@ -1,72 +0,0 @@
|
||||
output_dir = "/data/sami_debug/nemotron-debug"
|
||||
clean_output_dir = true
|
||||
max_steps = 5
|
||||
seq_len = 2048
|
||||
|
||||
[slurm]
|
||||
job_name = "nemotron-4node"
|
||||
pre_run_command = "uv sync --all-extras --all-packages --group mamba-ssm"
|
||||
|
||||
[deployment]
|
||||
type = "multi_node"
|
||||
num_train_nodes = 4
|
||||
num_infer_nodes = 4
|
||||
|
||||
[log]
|
||||
level = "debug"
|
||||
|
||||
[wandb]
|
||||
project = "sami_debug_nemotron"
|
||||
name = "nemotron-120b-math"
|
||||
|
||||
[weight_broadcast]
|
||||
type = "nccl"
|
||||
|
||||
[model]
|
||||
name = "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16"
|
||||
|
||||
[trainer]
|
||||
dist_timeout_seconds = 1800
|
||||
|
||||
[trainer.model]
|
||||
impl = "custom"
|
||||
attn = "flash_attention_2"
|
||||
optim_cpu_offload = true
|
||||
ep = 8
|
||||
fused_lm_head_token_chunk_size = 8192
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.ac_offloading]
|
||||
max_inflight_activations = 5
|
||||
|
||||
[trainer.model.compile]
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 128
|
||||
group_size = 8
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "hendrycks-math"
|
||||
taskset = { id = "math-env-v1", dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default", task = { math_verify_timeout = 60 } }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 10
|
||||
|
||||
[orchestrator.eval.sampling]
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "math500"
|
||||
taskset = { id = "math500-v1" }
|
||||
num_examples = 30
|
||||
group_size = 4
|
||||
|
||||
[inference.parallel]
|
||||
tp = 8
|
||||
dp = 1
|
||||
@@ -1,71 +0,0 @@
|
||||
output_dir = "outputs/rl-nemotron-debug"
|
||||
clean_output_dir = true
|
||||
max_steps = 500
|
||||
seq_len = 4096
|
||||
|
||||
[slurm]
|
||||
job_name = "nemotron-sami-debug"
|
||||
|
||||
[deployment]
|
||||
type = "multi_node"
|
||||
num_train_nodes = 2
|
||||
num_infer_nodes = 2
|
||||
|
||||
[log]
|
||||
level = "debug"
|
||||
|
||||
[wandb]
|
||||
project = "nemotron_sami_debug"
|
||||
name = "nemotron-120b-math"
|
||||
|
||||
[weight_broadcast]
|
||||
type = "nccl"
|
||||
|
||||
[model]
|
||||
name = "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16"
|
||||
|
||||
[trainer.model]
|
||||
impl = "custom"
|
||||
attn = "flash_attention_2"
|
||||
optim_cpu_offload = true
|
||||
fused_lm_head_token_chunk_size = 8192
|
||||
|
||||
[trainer.model.debug]
|
||||
random_init = true
|
||||
num_layers = 8
|
||||
|
||||
[trainer.model.ac_offloading]
|
||||
max_inflight_activations = 5
|
||||
|
||||
[trainer.model.ac]
|
||||
freq = 1
|
||||
|
||||
[trainer.model.compile]
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 4096
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "hendrycks-math"
|
||||
taskset = { id = "math-env-v1", dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default", task = { math_verify_timeout = 60 } }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 10
|
||||
|
||||
[orchestrator.eval.sampling]
|
||||
max_completion_tokens = 4096
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "math500"
|
||||
taskset = { id = "math500-v1" }
|
||||
num_examples = 30
|
||||
group_size = 4
|
||||
|
||||
[inference.parallel]
|
||||
tp = 4
|
||||
dp = 4
|
||||
@@ -1,40 +0,0 @@
|
||||
max_steps = 500
|
||||
seq_len = 4096
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[wandb]
|
||||
project = "wiki-search-debug"
|
||||
name = "wiki-search-4b"
|
||||
|
||||
[trainer.optim]
|
||||
lr = 1e-5
|
||||
weight_decay = 0.0
|
||||
|
||||
[trainer.model.lora]
|
||||
rank = 8
|
||||
dropout = 0.0
|
||||
target_modules = [
|
||||
"q_proj",
|
||||
"k_proj",
|
||||
"v_proj",
|
||||
"o_proj",
|
||||
"gate_proj",
|
||||
"up_proj",
|
||||
"down_proj"
|
||||
]
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
oversampling_factor = 2.0
|
||||
|
||||
[orchestrator.train.sampling]
|
||||
max_completion_tokens = 512
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "wiki-search"
|
||||
|
||||
[inference.model]
|
||||
tool_call_parser = "hermes"
|
||||
Vendored
+1
-1
Submodule deps/pydantic-config updated: 99f47c6cc0...4f5ae37358
Vendored
+1
-1
Submodule deps/renderers updated: 5904fa24aa...bdb96b0c84
Vendored
+1
-1
Submodule deps/research-environments updated: 06232831fd...f5d423c321
Vendored
+1
-1
Submodule deps/verifiers updated: 31415cd32a...b13ba60da6
+22
-12
@@ -28,7 +28,7 @@ impl = "custom" # or "hf" to force the HF path
|
||||
| GLM-5 / GLM-5.2 (`glm_moe_dsa`) | `zai-org/GLM-5`, `zai-org/GLM-5-FP8`, `zai-org/GLM-5.2`, `zai-org/GLM-5.2-FP8` | ✅ | ✅ |
|
||||
| Qwen3 MoE | `Qwen/Qwen3-30B-A3B`, … | ✅ | ✅ |
|
||||
| Qwen3.5 MoE | `Qwen/Qwen3.5-35B-A3B`, … | ✅ | ✅ |
|
||||
| Qwen3 / Qwen3.5 VLMs | see [Multimodal training](#multimodal-training) | MoE only | ✅ |
|
||||
| Qwen3 / Qwen3.5 VLMs | see [Multimodal training](#multimodal-training) | MoE only | ❌ |
|
||||
| Laguna | `poolside/Laguna-XS.2` | ✅ | ✅ |
|
||||
| MiniMax M2 | `MiniMax/MiniMax-M2` | ✅ | ✅ |
|
||||
| Nemotron H | `nvidia/Nemotron-3-Nano-30B-A3B`, … | ✅ | ❌ |
|
||||
@@ -36,7 +36,21 @@ impl = "custom" # or "hf" to force the HF path
|
||||
| GLM-4 / GLM-4.5 / INTELLECT-3 | `THUDM/GLM-4-9B-0414`, `zai-org/GLM-4.5`, `PrimeIntellect/INTELLECT-3`, … | ✅ | ✅ |
|
||||
| GPT-OSS (HF MoE) | `openai/gpt-oss-20b`, `openai/gpt-oss-120b` | ❌ | ✅ |
|
||||
|
||||
The custom path enables you to set EP, CP, selective activation checkpointing, FP8 training (`model.fp8 = true`, requires SM90+), and faster MoE kernels (`moe_use_grouped_mm = true`, default). Forcing `impl = "hf"` is mostly useful when debugging — it's slower and disables most MoE-specific knobs.
|
||||
The custom path enables you to set EP, CP, selective activation checkpointing, low-precision training (`[trainer.model.quantization]`), and faster MoE kernels (`moe_use_grouped_mm = true`, default). Forcing `impl = "hf"` is mostly useful when debugging — it's slower and disables most MoE-specific knobs.
|
||||
|
||||
### Low-precision training
|
||||
|
||||
Set `[trainer.model.quantization]` to train dense linears and MoE expert GEMMs in low precision. Two backends are available via the `type` discriminator:
|
||||
|
||||
- `type = "fp8"` — DeepGEMM FP8 blockwise (requires SM90+ / Hopper). Options: `enable_grouped_gemm` (FP8 MoE expert GEMM). Both default on.
|
||||
- `type = "mxfp8"` — torchao MXFP8 microscaling (requires SM100+ / Blackwell). Options: `enable_grouped_gemm`, `enable_a2a` (MXFP8 expert-parallel all-to-all), and `recipe` (`mxfp8_rceil` default or `mxfp8_rceil_wgrad_with_hp`).
|
||||
|
||||
```toml
|
||||
[trainer.model.quantization]
|
||||
type = "mxfp8"
|
||||
recipe = "mxfp8_rceil"
|
||||
enable_a2a = true
|
||||
```
|
||||
|
||||
GLM-5.2 adds IndexShare: the DSA sparse-attention indexer runs only on a subset of layers and the remaining layers reuse the cached top-k indices. The trainer reads this schedule from the model's `indexer_types` config field and enables the index cache automatically, so no extra config is needed. To override the schedule manually, set `[trainer.model.index_cache]` (`topk_freq` or `topk_pattern`).
|
||||
|
||||
@@ -58,20 +72,17 @@ The built-in VLM registry covers:
|
||||
|
||||
| Family | `model_type` | Vision attr | LM attr |
|
||||
|---|---|---|---|
|
||||
| Qwen3-VL | `qwen3_vl` | `model.visual` | `model.language_model` |
|
||||
| Qwen3-VL MoE | `qwen3_vl_moe` | `model.visual` | `model.language_model` |
|
||||
| Qwen3.5 | `qwen3_5` | `model.visual` | `model.language_model` |
|
||||
| Qwen3.5-MoE | `qwen3_5_moe` | `model.visual` | `model.language_model` |
|
||||
|
||||
For a model not in the table, look up the attribute paths on the loaded HF model with `model.named_children()` and set them under `[model.vlm]` directly.
|
||||
|
||||
### Enabling VLM Mode
|
||||
|
||||
Add `[model.vlm]` and bfloat16 dtypes:
|
||||
|
||||
```toml
|
||||
[model]
|
||||
name = "Qwen/Qwen3-VL-4B-Instruct"
|
||||
name = "Qwen/Qwen3.5-4B"
|
||||
impl = "custom"
|
||||
optimization_dtype = "bfloat16"
|
||||
reduce_dtype = "bfloat16"
|
||||
|
||||
@@ -83,12 +94,11 @@ language_model_attr = "model.language_model"
|
||||
|
||||
The weight-broadcast key prefix is derived as `{language_model_attr}.layers.` automatically.
|
||||
|
||||
To add a new model family permanently, append an entry to `VLM_REGISTRY` in `src/prime_rl/utils/vlm.py`.
|
||||
VLM training requires a registered custom PrimeRL implementation.
|
||||
|
||||
### Limitations
|
||||
|
||||
- **Vision encoder frozen by default.** Set `freeze_vision_encoder = false` to fine-tune it; in that case it's FSDP-sharded per block. The combination `freeze_vision_encoder = false` + LoRA is rejected by a config validator — LoRA freezes everything non-adapter, so unfreezing the encoder under LoRA would be a silent no-op.
|
||||
- **No multimodal-safe truncation.** Token sequences are truncated to `seq_len`, but `pixel_values` and `image_grid_thw` pass through unchanged. If a sample's tokens overflow, image tokens may get dropped while image tensors still describe the full image set. Set `seq_len` to cover your longest sample.
|
||||
- **Vision encoder frozen by default.** The default LoRA targets do not match Qwen3.5 vision modules. Set `freeze_vision_encoder = false` to fine-tune the encoder; this is incompatible with LoRA because LoRA freezes all non-adapter parameters.
|
||||
- **bfloat16 mandatory.** The trainer config validator refuses any other `optimization_dtype` / `reduce_dtype` for VLMs — vLLM serves VLMs in bfloat16 and a mismatch breaks the importance ratio.
|
||||
- **Higher KL mismatch with multi-image inputs.** Expect noisier `mismatch_kl` than text-only; this is from minor numerical differences between the trainer's and vLLM's image processing.
|
||||
- **Images aren't logged to monitors.** Sample logging captures the prompt text but not the actual images.
|
||||
@@ -128,7 +138,7 @@ For large MoE serving, splitting prefill and decode onto separate vLLM groups ca
|
||||
| Agentic (SWE, Lean) | 3:1 | Long growing contexts → prefill-heavy |
|
||||
| Non-agentic (math, chat) | 1:2 | Short prompts, long generations → decode-heavy |
|
||||
|
||||
Example config: [`examples/glm5_pd_disag/rl.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/glm5_pd_disag/rl.toml) — full RL run on `GLM-5` with P/D disaggregation behind a `vllm-router`, FP8 inference, and NCCL weight broadcast (see the [README](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/glm5_pd_disag) for the launch story).
|
||||
Example config: [`examples/advanced/glm-5.2/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/advanced/glm-5.2/swe.toml) — full RL run on `GLM-5` with P/D disaggregation behind a `vllm-router`, FP8 inference, and NCCL weight broadcast, paired with an inference config from [`examples/advanced/glm-5.2/infer/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2/infer).
|
||||
|
||||
Monitor live queue depths to detect imbalance:
|
||||
|
||||
@@ -146,4 +156,4 @@ salloc -N 1 --gres=gpu:1 bash -c 'bash scripts/install_nixl_from_source.sh'
|
||||
uv pip install --reinstall --no-deps deps/nixl_cu12-*.whl
|
||||
```
|
||||
|
||||
The script writes UCX 1.19 to `third_party/ucx/`; the bundled sbatch templates prepend it to `LD_LIBRARY_PATH` so it overrides the system version. Re-run both commands after every `uv sync`, since the lock pins the wheel.
|
||||
The script writes UCX 1.19 to `third_party/ucx/`; the bundled sbatch templates prepend it to `LD_LIBRARY_PATH` so it overrides the system version. Re-run both commands after every `uv sync`, since the lock pins the wheel.
|
||||
|
||||
+9
-4
@@ -117,10 +117,15 @@ Both components resolve per environment. Each env inherits `[orchestrator.algo]`
|
||||
type = "grpo"
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "math-env" # inherits grpo
|
||||
name = "math"
|
||||
taskset = { id = "math-v1" }
|
||||
harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
# inherits the top-level grpo
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "terminal-env"
|
||||
name = "terminal"
|
||||
taskset = { id = "terminal-v1" }
|
||||
harness = { id = "bash", runtime = { type = "subprocess" } }
|
||||
algo = { type = "echo" } # this env runs its own algorithm
|
||||
```
|
||||
|
||||
@@ -272,7 +277,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). |
|
||||
| `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 (`model`, 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. |
|
||||
| `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. |
|
||||
| `sft` | `ce` | Cross-entropy on the sampled tokens. Assigns no advantage — trains on every sampled token. |
|
||||
|
||||
@@ -415,7 +420,7 @@ tok.apply_chat_template(messages, tokenize=False)
|
||||
# (the <think>R1</think> from turn 2 is gone)
|
||||
```
|
||||
|
||||
Hand-coded renderers ship for `qwen3`, `qwen3-vl`, `qwen3.5`, `glm5`, `glm4.5`, `minimax-m2`, `deepseek-v3`, `kimi-k2`, `kimi-k2.5`, `nemotron-3`, `gpt-oss`; anything else falls back to `DefaultRenderer` (a generic `apply_chat_template` wrapper). Pick one via:
|
||||
Hand-coded renderers ship for `qwen3`, `qwen3-vl`, `qwen3.5`, `glm-5`, `glm-4.5`, `minimax-m2`, `deepseek-v3`, `kimi-k2`, `kimi-k2.5`, `nemotron-3`, `gpt-oss`; anything else falls back to `DefaultRenderer` (a generic `apply_chat_template` wrapper). Pick one via:
|
||||
|
||||
```toml
|
||||
[orchestrator.renderer]
|
||||
|
||||
+23
-20
@@ -34,7 +34,7 @@ Field values come from three sources — Pydantic defaults, TOML files (passed w
|
||||
The `@` token introduces a TOML file. Multiple `@` arguments compose left-to-right, deep-merged — unset fields in an overlay keep the base value:
|
||||
|
||||
```bash
|
||||
uv run rl @ examples/reverse_text/rl.toml # one file
|
||||
uv run rl @ examples/basic/reverse-text/rl.toml # one file
|
||||
uv run rl @ base.toml @ overlay.toml # left to right
|
||||
uv run rl --trainer @ trainer.toml --orchestrator @ orch.toml # per-section
|
||||
uv run rl @ base.toml --trainer @ trainer.toml # mixed
|
||||
@@ -148,26 +148,28 @@ Training environments are an array of tables — set one per env, optionally wit
|
||||
|
||||
```toml
|
||||
[[orchestrator.train.env]]
|
||||
id = "math-env"
|
||||
name = "gsm8k"
|
||||
args = { dataset_name = "openai/gsm8k", dataset_subset = "main" }
|
||||
env.taskset = { id = "gsm8k-v1", split = "train" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
ratio = 3 # 75% of batches
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "reverse-text"
|
||||
name = "reverse-text"
|
||||
env.taskset = { id = "reverse-text-v1" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
ratio = 1 # default — 25% of batches
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "math-env"
|
||||
name = "gsm8k-eval"
|
||||
args = { dataset_name = "openai/gsm8k", dataset_subset = "main" }
|
||||
env.taskset = { id = "gsm8k-v1", split = "test" }
|
||||
env.agent.harness = { id = "null", runtime = { type = "subprocess" } }
|
||||
```
|
||||
|
||||
`ratio` defaults to `1` (equal weight per env); values are relative weights normalized to probabilities across envs.
|
||||
|
||||
`args` is forwarded verbatim to the environment's `load_environment(**args)`.
|
||||
Everything environment lives under the `env` block (verifiers' `[env]` shape): `env.taskset` configures the v1 taskset, and each agent is a field on the env — `env.agent.harness` selects how the single-agent env's tasks are run, and per-run caps are per-agent (`env.agent.max_turns`, `env.agent.timeout`, `env.agent.max_output_tokens`). A multi-agent env declares its own seats (`env.<role>.*`).
|
||||
|
||||
The same `id` can appear multiple times across train and eval (or with different `args`) — useful for evaluating on a held-out split of the env you're training on, or comparing two configurations of the same env side by side. When `id` is reused, set a distinct `name` on each entry; `name` defaults to `id` and must be unique across all envs in the same group.
|
||||
The same taskset can appear multiple times across train and eval (or with different settings) — useful for evaluating on a held-out split or comparing two configurations side by side. When it is reused, set a distinct `name` on each entry; `name` defaults to the taskset id and must be unique across all envs in the same group.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
@@ -204,30 +206,31 @@ For standalone `sft` and `inference` configs, `[env_vars]` applies to that entry
|
||||
|
||||
## Examples
|
||||
|
||||
The shipped end-to-end examples in [`examples/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples) are the canonical, kept-up-to-date references — the rest of the repo's TOMLs (under `configs/`) are CI- and debug-internal and may drift. Each example directory has its own README with the full launch story.
|
||||
The shipped end-to-end examples in [`examples/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples) are the canonical, kept-up-to-date references — the rest of the repo's TOMLs (under `configs/`) are CI- and debug-internal and may drift. Each basic example directory has its own README with the full launch story; the advanced examples are config-only.
|
||||
|
||||
**Basic** (1–8 GPUs):
|
||||
|
||||
- [**Reverse Text**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/reverse_text) — `Qwen3-0.6B` reversing a chunk of text. Tiny single-turn SFT + RL; runs on a single consumer GPU in minutes.
|
||||
- [**Wordle**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/wordle) — `Qwen3-1.7B` playing Wordle. Multi-turn SFT + RL; 2–4 H100s.
|
||||
- [**Alphabet Sort**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/alphabet_sort) — `Qwen3-4B-Instruct-2507` sorting names alphabetically. Multi-turn LoRA RL without SFT warmup; one H100.
|
||||
- [**Wiki Search**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/wiki_search) — `Qwen3-4B-Instruct-2507` answering trivia by web-searching Wikipedia. Multi-turn with tool use.
|
||||
- [**Hendrycks Sanity**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/hendrycks_sanity) — `DeepSeek-R1-Distill-Qwen-1.5B` on a filtered MATH subset. Useful for algorithm ablations.
|
||||
- [**Reverse Text**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/reverse-text) — `Qwen3-0.6B` reversing a chunk of text. Tiny single-turn SFT + RL; runs on a single consumer GPU in minutes.
|
||||
- [**Wordle**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/wordle) — `Qwen3-1.7B` playing Wordle. Multi-turn SFT + RL; 2–4 H100s.
|
||||
- [**Alphabet Sort**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/alphabet-sort) — `Qwen3-4B-Instruct-2507` sorting names alphabetically. Multi-turn LoRA RL without SFT warmup; one H100.
|
||||
- [**Wiki Search**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/wiki-search) — `Qwen3-4B-Instruct-2507` answering trivia by searching a Wikipedia corpus. Multi-turn with tool use.
|
||||
- [**Hendrycks Sanity**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/basic/hendrycks-sanity) — `DeepSeek-R1-Distill-Qwen-1.5B` on a filtered MATH subset. Useful for algorithm ablations.
|
||||
|
||||
**Advanced** (32–2048 GPUs, SLURM):
|
||||
|
||||
- [**Qwen 3 30B – A3B Math**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/qwen30b_math) — `Qwen3-30B-A3B` on hard math.
|
||||
- [**Qwen 3 30B – A3B SWE**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/qwen30b_swe) — `Qwen3-30B-A3B` on hard SWE.
|
||||
- [**INTELLECT-3.1**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/intellect-3.1) — reproduces our INTELLECT-3.1 training run.
|
||||
- [**MiniMax-M2.5 SWE**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/minimax_m2.5_swe) — `MiniMax-M2.5` on agentic SWE.
|
||||
- [**High-throughput GLM-5**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/glm5_pd_disag) — `GLM-5` with P/D disaggregation and FP8 inference.
|
||||
- [**Qwen3-30B-A3B**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/qwen3-30b-a3b) — `Qwen3-30B-A3B` on math, SWE, and tool use.
|
||||
- [**GLM-4.5-Air**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-4.5-air) — `GLM-4.5-Air` on search, SWE, and terminal.
|
||||
- [**Nemotron-3-Super**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/nemotron-3-super) — `Nemotron-3-Super-120B` hybrid-Mamba MoE on SWE at 131k context.
|
||||
- [**MiniMax-M2.5 SWE**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/minimax-m2.5) — `MiniMax-M2.5` on agentic SWE.
|
||||
- [**INTELLECT-3.1**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/intellect-3.1) — reproduces our INTELLECT-3.1 training run.
|
||||
- [**High-throughput GLM-5**](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2) — large-scale `GLM-5`/`GLM-5.2` inference with P/D disaggregation and FP8.
|
||||
|
||||
### Worked Example: Compose, Override, Dry-Run
|
||||
|
||||
Start from a shipped base config, override two fields on the CLI, and dry-run:
|
||||
|
||||
```bash
|
||||
uv run rl @ examples/reverse_text/rl.toml \
|
||||
uv run rl @ examples/basic/reverse-text/rl.toml \
|
||||
--wandb.name my-experiment \
|
||||
--trainer.optim.lr 5e-6 \
|
||||
--output-dir /tmp/reverse-dry \
|
||||
|
||||
+4
-5
@@ -71,7 +71,7 @@ Drop the modeling code under `src/prime_rl/trainer/models/<arch>/` (HF-compatibl
|
||||
|
||||
### Register a Mini Preset
|
||||
|
||||
Add an entry to [`scripts/mini_moe.py`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/scripts/mini_moe.py) so the smoke-test workflow can build a ~0.5B test model in your architecture. The preset names the config class, picks small dimensions, and wires up the HF + PrimeRL model classes plus a tokenizer source:
|
||||
Add an entry to [`scripts/mini_moe.py`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/scripts/mini_moe.py) so the smoke-test workflow can build a ~0.5B test model in your architecture. The preset names the config class, picks small dimensions, and wires up the HF + prime-rl model classes plus a tokenizer source:
|
||||
|
||||
```python
|
||||
ARCH_PRESETS = {
|
||||
@@ -88,7 +88,7 @@ ARCH_PRESETS = {
|
||||
|
||||
### Run the Smoke Test
|
||||
|
||||
Build the mini model. This creates a ~543M-parameter GLM-4 MoE (1024 hidden, 24 layers, 8 experts) with random weights, copies the tokenizer from the original GLM-4 model, and verifies the HF↔PrimeRL roundtrip is lossless:
|
||||
Build the mini model. This creates a ~543M-parameter GLM-4 MoE (1024 hidden, 24 layers, 8 experts) with random weights, copies the tokenizer from the original GLM-4 model, and verifies the HF↔prime-rl roundtrip is lossless:
|
||||
|
||||
```bash
|
||||
uv run python scripts/mini_moe.py --arch glm4_moe --output-dir ./mini-glm-moe
|
||||
@@ -103,10 +103,9 @@ uv run python scripts/mini_moe.py --arch glm4_moe --output-dir ./mini-glm-moe --
|
||||
Warm up the random-weight mini model with SFT on reverse-text so KL divergence becomes meaningful in the RL phase. Loss drops from ~12 to ~2.5 — the output won't be coherent, but the distribution is non-trivial. A pre-built SFT'd checkpoint lives at [samsja/mini-glm-moe](https://huggingface.co/samsja/mini-glm-moe) if you want to skip this step:
|
||||
|
||||
```bash
|
||||
uv run sft @ configs/debug/moe/sft/train.toml \
|
||||
uv run sft \
|
||||
--model.name ./mini-glm-moe \
|
||||
--data.name PrimeIntellect/Reverse-Text-SFT \
|
||||
--data.type null \
|
||||
--max_steps 200 \
|
||||
--optim.lr 1e-4 \
|
||||
--ckpt.weights
|
||||
@@ -115,7 +114,7 @@ uv run sft @ configs/debug/moe/sft/train.toml \
|
||||
Then run the full RL stack on reverse-text:
|
||||
|
||||
```bash
|
||||
uv run rl @ configs/ci/integration/reverse_text_moe/start.toml \
|
||||
uv run rl @ configs/ci/integration/reverse-text-moe/start.toml \
|
||||
--model.name samsja/mini-glm-moe \
|
||||
--trainer.model.impl custom \
|
||||
--inference.gpu-memory-utilization 0.7 \
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ This page covers the inference configuration and the supported features/deployme
|
||||
- [Multi-Node](#multi-node)
|
||||
- [Multi-replica](#multi-replica)
|
||||
- [Wide-EP](#wide-ep)
|
||||
- [P/D Dissagregation](#pd-dissagregation)
|
||||
- [P/D Disaggregation](#pd-disaggregation)
|
||||
- [Router](#router)
|
||||
- [Routing policies](#routing-policies)
|
||||
- [Advanced Configuration](#advanced-configuration)
|
||||
@@ -26,7 +26,7 @@ This page covers the inference configuration and the supported features/deployme
|
||||
We support 3 distinct deployment shapes:
|
||||
- [Single-Node](#single-node) - Runs the inference server on a single node. Useful for debugging, small scale experiments or smaller models. The default deployment shape.
|
||||
- [Multi-Node](#multi-node) - Runs the inference server on multiple nodes. Useful for large scale experiments or larger models, where latency is not a concern - i.e. single turn inference, long context inference, etc.
|
||||
- [Disaggregated](#disaggregated) - Runs the inference server on multiple nodes, but disaggregates the prefill and decode stages. Useful for large scale experiments or larger models, where latency is a concern and multi-node deployment creates very high E2E rollout latency, such as agentic workflows.
|
||||
- [Disaggregated](#pd-disaggregation) - Runs the inference server on multiple nodes, but disaggregates the prefill and decode stages. Useful for large scale experiments or larger models, where latency is a concern and multi-node deployment creates very high E2E rollout latency, such as agentic workflows.
|
||||
|
||||
Most of the features are supported for all deployment shapes, with few exceptions. These exceptions are rejected on validation.
|
||||
|
||||
@@ -124,7 +124,7 @@ dp = 8
|
||||
|
||||
This configuration will run 2 vLLM processes, each with `data_parallel_size_local = 4` and `tp = 2` and expert parallelism spanning 2 nodes. The requests are again routed to these processes via the `vllm-router`.
|
||||
|
||||
## P/D Dissagregation
|
||||
## P/D Disaggregation
|
||||
|
||||
This is the most advanced deployment shape. It allows you to disaggregate the prefill and decode stages, with KV cache flowing between them. This is useful for large scale deployments, where there are high requirements on latency, such as agentic workflows spanning 100s of turns.
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://mintlify.com/docs.json",
|
||||
"navigation": [
|
||||
{
|
||||
"group": "PRIME-RL",
|
||||
"group": "prime-rl",
|
||||
"pages": [
|
||||
"overview",
|
||||
"configuration",
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ A `prime-rl` RL run is three cooperating processes:
|
||||
|
||||

|
||||
|
||||
- **Inference** — vLLM-backed server (or fleet) holding the current policy. The orchestrator drives rollouts through the token-in `/v1/generate` route via the [`renderers`](https://github.com/PrimeIntellect-ai/renderers) package (OpenAI-compatible chat/completions routes are also exposed for external clients). We are trying to stay up-to-date with the latest vLLM features, you can read more about the supported features and deployment options in the dedicated [inference documentation](inference.md).
|
||||
- **Inference** — vLLM-backed server (or fleet) holding the current policy. The orchestrator drives rollouts through the token-in `/inference/v1/generate` route via the [`renderers`](https://github.com/PrimeIntellect-ai/renderers) package (OpenAI-compatible chat/completions routes are also exposed for external clients). We are trying to stay up-to-date with the latest vLLM features, you can read more about the supported features and deployment options in the dedicated [inference documentation](inference.md).
|
||||
- **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).
|
||||
|
||||
@@ -29,10 +29,10 @@ You need at least one NVIDIA GPU (RTX 3090/4090/5090, A100, H100, H200, or B200)
|
||||
Train an SFT-warmed `Qwen3-0.6B` on the `reverse-text` task — the env is bundled with the [`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) submodule so no separate install is needed. This config ships in the repo and runs on two GPUs (one for inference, one for the trainer):
|
||||
|
||||
```bash
|
||||
uv run rl @ examples/reverse_text/rl.toml
|
||||
uv run rl @ examples/basic/reverse-text/rl.toml
|
||||
```
|
||||
|
||||
The `rl` entrypoint reads `examples/reverse_text/rl.toml`, splits it into per-process sub-configs, picks GPU 0 for inference and GPU 1 for the trainer, launches all three processes, and tees their stdout into `outputs/logs/{trainer,orchestrator,inference}.log`. Within a minute the trainer should log `step 1` and a reward sample; after 20 steps the run completes and final HF-compatible weights land at `outputs/weights/step_20`.
|
||||
The `rl` entrypoint reads `examples/basic/reverse-text/rl.toml`, splits it into per-process sub-configs, picks GPU 0 for inference and GPU 1 for the trainer, launches all three processes, and tees their stdout into `outputs/logs/{trainer,orchestrator,inference}.log`. Within a minute the trainer should log `step 1` and a reward sample; after 20 steps the run completes and final HF-compatible weights land at `outputs/weights/step_20`.
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
+6
-4
@@ -107,10 +107,12 @@ ep_comm_backend = "torch" # or "deepep"
|
||||
|
||||
CP shards a single sequence across multiple GPUs along the token dimension — for long-context sequences. We reccomend using `ulysses` style CP for most of the models to get the most throughput. Some models (e.g. GLM-5) only support `ring` style CP. Wrong setting will be rejected on validation.
|
||||
|
||||
`ulysses` head-shards Q/K/V, so the CP degree must divide `num_attention_heads`. GQA models with fewer KV heads than the CP degree (e.g. NemotronH: 32 query heads, 2 KV heads) are supported via KV-head replication; the CP degree must then be a multiple of `num_key_value_heads`. Hybrid Mamba layers head-shard independently (`cp_mamba`), which requires the CP degree to divide `mamba_num_heads` and `n_groups`.
|
||||
|
||||
```toml
|
||||
[trainer.model]
|
||||
impl = "custom"
|
||||
attn = "flash_attention_2" # or fa3 / fa4
|
||||
attn = "auto" # auto = FA3 on Hopper, FA4 on Blackwell; or flash_attention_2/3/4
|
||||
cp = 2 # CP degree
|
||||
cp_style = "ulysses" # "ring"
|
||||
```
|
||||
@@ -224,10 +226,10 @@ gpus_per_node = 8
|
||||
|
||||
### Examples
|
||||
|
||||
Full multi-node configs ship in [`examples/multinode/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/multinode):
|
||||
Full multi-node configs ship under [`examples/advanced/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced):
|
||||
|
||||
- [`rl.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/multinode/rl.toml) — two-node RL run with NCCL weight broadcast on a 30B MoE policy.
|
||||
- [`sft.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/multinode/sft.toml) — two-node SFT against the same model.
|
||||
- [`nemotron-3-super/swe.toml`](https://github.com/PrimeIntellect-ai/prime-rl/blob/main/examples/advanced/nemotron-3-super/swe.toml) — 4 trainer + 1 inference node RL on a 120B hybrid-Mamba MoE with NCCL weight broadcast.
|
||||
- [`glm-5.2/`](https://github.com/PrimeIntellect-ai/prime-rl/tree/main/examples/advanced/glm-5.2) — large-scale and P/D-disaggregated inference across the GLM-5 family.
|
||||
|
||||
For inference-only multi-node, set `[deployment] type = "multi_node"` on an inference TOML — each node runs an independent vLLM replica (TP and DP must fit within one node), and the launcher prints one URL per node. Front the URLs with a router or point clients at any of them.
|
||||
|
||||
|
||||
+16
-7
@@ -45,7 +45,7 @@ This page covers everything you need to launch, observe, checkpoint, and recover
|
||||
The minimal RL run trains an SFT-warmed `Qwen3-0.6B` on the `reverse-text` task — the env is bundled with the [`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) submodule, so nothing else needs to be installed:
|
||||
|
||||
```bash
|
||||
uv run rl @ examples/reverse_text/rl.toml
|
||||
uv run rl @ examples/basic/reverse-text/rl.toml
|
||||
```
|
||||
|
||||
### Useful Knobs
|
||||
@@ -144,12 +144,21 @@ Two accepted layouts:
|
||||
|
||||
If both columns are present, `messages` takes precedence.
|
||||
|
||||
**Tool definitions.** For tool-use SFT, add a `tools` column (OpenAI function-calling format) or `tool_defs` ([`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) rollout format). Each row's value can be either a list of dicts or a JSON-encoded string of a list — both are accepted, and `tool_defs` rows are auto-converted to OAI shape before being passed into the chat template's `tools=...` argument. The `chat_template_kwargs` column, if present, is forwarded verbatim into `apply_chat_template`.
|
||||
**Tool definitions and renderer controls.** For tool-use SFT, add a `tools` column (OpenAI function-calling format) or `tool_defs` ([`verifiers`](https://github.com/PrimeIntellect-ai/verifiers) rollout format). Each row's value can be either a list of dicts or a JSON-encoded string of a list — both are accepted, and `tool_defs` rows are auto-converted to OAI shape before being passed into the renderer.
|
||||
|
||||
**Position-dependent chat templates.** Multi-turn SFT under the default tokenization path (`build_incremental_token_mask`) requires that tokenizing the first _k_ turns of a conversation be a strict prefix of tokenizing all _n ≥ k_ turns. Qwen3's upstream template _violates_ this — it strips past `<think>` blocks across user turns, silently corrupting the loss mask. Two fixes:
|
||||
Renderer-backed SFT reads template controls from the typed `[renderer]` config in the SFT TOML. For example:
|
||||
|
||||
- **Enable the renderer** (set a typed `[renderer]` config, e.g. `name = "qwen3"`, recommended; defaults to `"auto"` for RL). The [`renderers`](algorithms.md#renderers) package owns tokenization end-to-end and is robust to position-dependent templates. Hand-coded renderers ship for Qwen3, Qwen3.5, GLM-5, GLM-4.5, Kimi K2/K2.5, MiniMax M2, DeepSeek V3, Nemotron 3, GPT-OSS. Not supported for VLMs.
|
||||
- **Patched chat template** — the prime-rl–patched checkpoints (e.g. `PrimeIntellect/Qwen3-0.6B`, used in `examples/reverse_text/sft.toml`) ship a chat template that preserves thinking. Or supply your own.
|
||||
```toml
|
||||
[renderer]
|
||||
name = "qwen3"
|
||||
enable_thinking = false
|
||||
```
|
||||
|
||||
If a model needs another template control, add it to that model's renderer config in `renderers` (for example a new field on the relevant `*RendererConfig`) and consume it in the renderer implementation.
|
||||
|
||||
**Renderer-backed tokenization.** SFT tokenization is renderer-only. The [`renderers`](algorithms.md#renderers) package owns message-to-token conversion and loss attribution end-to-end, so position-dependent chat templates (for example templates that strip past `<think>` blocks across user turns) do not corrupt the loss mask. `[renderer]` defaults to `name = "auto"`; set a typed renderer config only when you need model-specific template controls. Hand-coded renderers ship for Qwen3, Qwen3.5, GLM-5, GLM-4.5, Kimi K2/K2.5, MiniMax M2, DeepSeek V3, Nemotron 3, GPT-OSS, and VLM families such as Qwen3-VL/Qwen3.5.
|
||||
|
||||
**VLM training requires a custom PrimeRL implementation.** Training a model with `[model.vlm]` set (SFT or RL) requires `model.impl = "custom"` and only works for models with a registered PrimeRL VLM class (currently Qwen3.5 dense and MoE).
|
||||
|
||||
See [Algorithms § Multi-Turn Trajectories](algorithms.md#multi-turn-trajectories) for the full picture.
|
||||
|
||||
@@ -158,7 +167,7 @@ See [Algorithms § Multi-Turn Trajectories](algorithms.md#multi-turn-trajectorie
|
||||
The minimal SFT run trains `Qwen3-0.6B` on the `reverse-text` SFT dataset:
|
||||
|
||||
```bash
|
||||
uv run sft @ examples/reverse_text/sft.toml --wandb
|
||||
uv run sft @ examples/basic/reverse-text/sft.toml --wandb
|
||||
```
|
||||
|
||||
Multi-GPU and multi-node use torchrun under the hood (the `sft` entrypoint manages this for you — see [Scaling § SFT and Torchrun](scaling.md#sft-and-torchrun) for non-default layouts; multi-node SFT goes through [SLURM](scaling.md#slurm)).
|
||||
@@ -328,7 +337,7 @@ Requires `PRIME_API_KEY` (set via `prime login` or env var) and an allowlisted t
|
||||
|
||||
## Rules of Thumb
|
||||
|
||||
- **Start small.** Run `examples/reverse_text/rl.toml` end-to-end on 2 GPUs before scaling. If the smoke run finishes cleanly, your install is good.
|
||||
- **Start small.** Run `examples/basic/reverse-text/rl.toml` end-to-end on 2 GPUs before scaling. If the smoke run finishes cleanly, your install is good.
|
||||
- **Batch size ≥ 64.** Smaller batches give noisy gradient estimates and the trainer's overhead-per-step dominates throughput. 64 is the practical floor; 128–512 is the range for quick ablations; production RL often runs at 1024+.
|
||||
- **Group size ≥ 8.** Bigger groups (`orchestrator.group_size`) make it more likely that a task produces a mix of high- and low-reward rollouts, which is what gives the trainer a usable signal — if all rollouts in a group succeed or all fail, the within-group advantage collapses to zero and the trainer learns nothing from that task. Bigger groups also tighten advantage normalization. 8 is the floor; 16–32 is common.
|
||||
- **Pin `output_dir` per run.** Sharing a directory across runs will mix rollouts and break resumes. `--output-dir outputs/<unique-name>` is the simplest discipline.
|
||||
|
||||
+15
-1
@@ -1,3 +1,17 @@
|
||||
# Examples
|
||||
|
||||
This directory maintains configurations for usage examples of PRIME-RL which are referenced in the [README](../README.md).
|
||||
End-to-end usage examples for prime-rl, referenced from the top-level [README](../README.md).
|
||||
|
||||
- **[`basic/`](basic)** — walk-throughs for the core environments on 1–8 GPUs (baseline eval →
|
||||
optional SFT warmup → RL → eval), each with its own README:
|
||||
- `reverse-text` — smallest end-to-end loop (single-turn, 0.6B)
|
||||
- `alphabet-sort` — multi-turn, user simulator, LoRA
|
||||
- `wiki-search` — multi-turn tool calling, LoRA
|
||||
- `wordle` — multi-turn (~6-turn games)
|
||||
- `hendrycks-sanity` — single-turn math, long-running
|
||||
- **[`advanced/`](advanced)** — larger, mostly multi-node runs on frontier models, one folder
|
||||
per model: `qwen3-30b-a3b` (math/swe/tool), `glm-4.5-air` (search/swe/terminal), `glm-5.2`
|
||||
(large-scale + PD-disaggregated inference), `minimax-m2.5` (swe), `nemotron-3-super` (swe),
|
||||
`intellect-3.1` (swe).
|
||||
|
||||
Dev-sized (2-GPU) counterparts of `basic/` live in [`configs/basic/`](../configs/basic).
|
||||
|
||||
@@ -95,12 +95,12 @@ num_turns_weight = 0.0
|
||||
# the plugged BC-style prompt is replaced by the reference judge's stock prompt).
|
||||
[[orchestrator.train.env]]
|
||||
name = "openseeker"
|
||||
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], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] } }
|
||||
|
||||
[orchestrator.train.env.taskset]
|
||||
[orchestrator.train.env.env.taskset]
|
||||
id = "openseeker-v1"
|
||||
|
||||
[[orchestrator.train.env.taskset.task.judges]]
|
||||
[[orchestrator.train.env.env.taskset.task.judges]]
|
||||
id = "reference"
|
||||
name = "correct"
|
||||
model = "Qwen/Qwen3-235B-A22B-Instruct-2507"
|
||||
@@ -108,7 +108,7 @@ question_field = "question"
|
||||
choices = ["A", "B"]
|
||||
|
||||
# # Metric-only monitor (weight 0): rlm harness-mechanics rubric, judged by GLM-5.2.
|
||||
# [[orchestrator.train.env.taskset.task.judges]]
|
||||
# [[orchestrator.train.env.env.taskset.task.judges]]
|
||||
# id = "rubric"
|
||||
# name = "rlm"
|
||||
# path = "deps/research-environments/rubrics/rlm.toml"
|
||||
@@ -117,12 +117,12 @@ choices = ["A", "B"]
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "redsearcher"
|
||||
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], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-search"] } }
|
||||
|
||||
[orchestrator.train.env.taskset]
|
||||
[orchestrator.train.env.env.taskset]
|
||||
id = "redsearcher-v1" # optional `difficulty` filter (easy/medium/hard)
|
||||
|
||||
[[orchestrator.train.env.taskset.task.judges]]
|
||||
[[orchestrator.train.env.env.taskset.task.judges]]
|
||||
id = "reference"
|
||||
name = "correct"
|
||||
model = "Qwen/Qwen3-235B-A22B-Instruct-2507"
|
||||
@@ -130,7 +130,7 @@ question_field = "question"
|
||||
choices = ["A", "B"]
|
||||
|
||||
# # Metric-only monitor (weight 0): rlm harness-mechanics rubric, judged by GLM-5.2.
|
||||
# [[orchestrator.train.env.taskset.task.judges]]
|
||||
# [[orchestrator.train.env.env.taskset.task.judges]]
|
||||
# id = "rubric"
|
||||
# name = "rlm"
|
||||
# path = "deps/research-environments/rubrics/rlm.toml"
|
||||
@@ -145,15 +145,15 @@ interval = 20
|
||||
[[orchestrator.eval.env]]
|
||||
name = "browsecomp"
|
||||
num_examples = 500 # full set is 1266; cap eval at 500
|
||||
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"] } }
|
||||
timeout = { rollout = 3600 }
|
||||
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.timeout = { rollout = 3600 }
|
||||
|
||||
[orchestrator.eval.env.taskset]
|
||||
[orchestrator.eval.env.env.taskset]
|
||||
id = "browsecomp-v1"
|
||||
task = { judge = { model = "Qwen/Qwen3-235B-A22B-Instruct-2507" } }
|
||||
|
||||
# # Metric-only monitor (weight 0): rlm harness-mechanics rubric, judged by GLM-5.2.
|
||||
# [[orchestrator.eval.env.taskset.task.judges]]
|
||||
# [[orchestrator.eval.env.env.taskset.task.judges]]
|
||||
# id = "rubric"
|
||||
# name = "rlm"
|
||||
# path = "deps/research-environments/rubrics/rlm.toml"
|
||||
@@ -10,8 +10,7 @@
|
||||
# 2 train + 4 infer nodes. Trainer uses cp=8 (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. Derived from
|
||||
# configs/debug/v1/scaleswe.toml + GLM-4.5-Air model settings from the int5 opencode configs.
|
||||
# CPU offload, and skip-gather / skip-optimizer checkpointing.
|
||||
|
||||
max_steps = 1000
|
||||
seq_len = 131072
|
||||
@@ -100,8 +99,8 @@ thinking_retention = "all"
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "scaleswe"
|
||||
taskset = { id = "scaleswe-v1", use_prime_registry = true }
|
||||
harness = { id = "rlm", summarize_at_tokens = [65536, 131072], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] } }
|
||||
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"] } }
|
||||
|
||||
[orchestrator.prime_monitor]
|
||||
|
||||
@@ -112,9 +111,9 @@ interval = 20
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swebench-verified"
|
||||
taskset = { id = "swebench-verified-v1", use_prime_registry = true }
|
||||
harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-swe"] } }
|
||||
timeout = { rollout = 3600 }
|
||||
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.timeout = { rollout = 3600 }
|
||||
|
||||
# --- Inference ---
|
||||
|
||||
@@ -93,20 +93,20 @@ num_turns_weight = 0.1
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
name = "tmax"
|
||||
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], runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
|
||||
|
||||
[orchestrator.train.env.taskset]
|
||||
[orchestrator.train.env.env.taskset]
|
||||
id = "tmax-v1"
|
||||
|
||||
# # Metric-only monitors (weight 0): rlm harness-mechanics + swe code-usage rubrics, judged by GLM-5.2.
|
||||
# [[orchestrator.train.env.taskset.judges]]
|
||||
# [[orchestrator.train.env.env.taskset.judges]]
|
||||
# id = "rubric"
|
||||
# name = "rlm"
|
||||
# path = "deps/research-environments/rubrics/rlm.toml"
|
||||
# model = "zai-org/GLM-5.2"
|
||||
# weight = 0.0
|
||||
|
||||
# [[orchestrator.train.env.taskset.judges]]
|
||||
# [[orchestrator.train.env.env.taskset.judges]]
|
||||
# id = "rubric"
|
||||
# name = "swe"
|
||||
# path = "deps/research-environments/rubrics/swe.toml"
|
||||
@@ -120,21 +120,20 @@ interval = 20
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "swebench-verified"
|
||||
harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
|
||||
timeout = { rollout = 3600 }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
|
||||
env.agent.timeout = { rollout = 3600 }
|
||||
|
||||
[orchestrator.eval.env.taskset]
|
||||
[orchestrator.eval.env.env.taskset]
|
||||
id = "swebench-verified-v1"
|
||||
use_prime_registry = true
|
||||
|
||||
# [[orchestrator.eval.env.taskset.judges]]
|
||||
# [[orchestrator.eval.env.env.taskset.judges]]
|
||||
# id = "rubric"
|
||||
# name = "rlm"
|
||||
# path = "deps/research-environments/rubrics/rlm.toml"
|
||||
# model = "zai-org/GLM-5.2"
|
||||
# weight = 0.0
|
||||
|
||||
# [[orchestrator.eval.env.taskset.judges]]
|
||||
# [[orchestrator.eval.env.env.taskset.judges]]
|
||||
# id = "rubric"
|
||||
# name = "swe"
|
||||
# path = "deps/research-environments/rubrics/swe.toml"
|
||||
@@ -144,20 +143,20 @@ use_prime_registry = true
|
||||
[[orchestrator.eval.env]]
|
||||
name = "terminal-bench-2"
|
||||
group_size = 4 # avg@4
|
||||
harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
|
||||
timeout = { rollout = 3600 }
|
||||
env.agent.harness = { id = "rlm", summarize_at_tokens = 98304, runtime = { type = "prime", vm = true, idle_timeout = "None", labels = ["glm45air-terminal"] } }
|
||||
env.agent.timeout = { rollout = 3600 }
|
||||
|
||||
[orchestrator.eval.env.taskset]
|
||||
[orchestrator.eval.env.env.taskset]
|
||||
id = "terminal-bench-2-v1"
|
||||
|
||||
# [[orchestrator.eval.env.taskset.judges]]
|
||||
# [[orchestrator.eval.env.env.taskset.judges]]
|
||||
# id = "rubric"
|
||||
# name = "rlm"
|
||||
# path = "deps/research-environments/rubrics/rlm.toml"
|
||||
# model = "zai-org/GLM-5.2"
|
||||
# weight = 0.0
|
||||
|
||||
# [[orchestrator.eval.env.taskset.judges]]
|
||||
# [[orchestrator.eval.env.env.taskset.judges]]
|
||||
# id = "rubric"
|
||||
# name = "swe"
|
||||
# path = "deps/research-environments/rubrics/swe.toml"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user