---
id: harness-adapters
title: Harness adapters
type: project
trainers:
- AsyncGRPOTrainer
recipes:
- harness-adapters/Inkling-2-Mini
- harness-adapters/Qwen3.8-Flash-Next
- harness-adapters/LFM2.5-24B-A2B
- harness-adapters/LFM3-1.7B
- harness-adapters/Qwen3.8-27B
- harness-adapters/TwIL-8B
url: https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/index.html
markdown_url: https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/index.md
hub_tree: https://huggingface.co/spaces/trl-lib/trl-recipes/tree/main/recipes/harness-adapters
---

# Harness adapters

- **Trainers:** `AsyncGRPOTrainer`
- **Interactive page:** https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/index.html
- **Space files:** https://huggingface.co/spaces/trl-lib/trl-recipes/tree/main/recipes/harness-adapters
- **All TRL Recipes index:** https://trl-lib-trl-recipes.static.hf.space/llms.txt

## Models & Recipes

| Model | Trainers | Hardware | Platforms | Markdown | Interactive Page | Recipe YAML |
|---|---|---|---|---|---|---|
| `thinkingmachines/Inkling-2-Mini` | `AsyncGRPOTrainer` | H200, B200 | HF Jobs | [index.md](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Inkling-2-Mini/index.md) | [index.html](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Inkling-2-Mini/index.html) | [recipe.yaml](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Inkling-2-Mini/recipe.yaml) |
| `Qwen/Qwen3.8-Flash-Next` | `AsyncGRPOTrainer` | SLURM | SLURM | [index.md](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Qwen3.8-Flash-Next/index.md) | [index.html](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Qwen3.8-Flash-Next/index.html) | [recipe.yaml](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Qwen3.8-Flash-Next/recipe.yaml) |
| `LiquidAI/LFM2.5-24B-A2B` | `AsyncGRPOTrainer` | H200 | Local, HF Jobs | [index.md](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/LFM2.5-24B-A2B/index.md) | [index.html](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/LFM2.5-24B-A2B/index.html) | [recipe.yaml](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/LFM2.5-24B-A2B/recipe.yaml) |
| `LiquidAI/LFM3-1.7B` | `AsyncGRPOTrainer` | H200 | Local, HF Jobs | [index.md](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/LFM3-1.7B/index.md) | [index.html](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/LFM3-1.7B/index.html) | [recipe.yaml](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/LFM3-1.7B/recipe.yaml) |
| `Qwen/Qwen3.8-27B` | `AsyncGRPOTrainer` | H200, B200 | Local, HF Jobs | [index.md](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Qwen3.8-27B/index.md) | [index.html](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Qwen3.8-27B/index.html) | [recipe.yaml](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Qwen3.8-27B/recipe.yaml) |
| `webAI-Official/TwIL-8B` | `AsyncGRPOTrainer` | H200 | Local, HF Jobs | [index.md](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/TwIL-8B/index.md) | [index.html](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/TwIL-8B/index.html) | [recipe.yaml](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/TwIL-8B/recipe.yaml) |

## Guide

Small LoRA adapters trained with RL inside unmodified agent harnesses (pi, hermes, opencode): one adapter per model
and harness, all served from one base model. A tool call is checked by
[safeagents](https://github.com/huggingface/safeagents) before it runs. Blog post:
[harness-hub/harness-adapters](https://huggingface.co/spaces/harness-hub/harness-adapters).

| Model | Steps | Training tasks | HF Jobs | Recipe |
|---|--:|---|---|---|
| `LiquidAI/LFM2.5-24B-A2B` | 200 | 100 medium + 200 hard SmolDataEnvs, 230 traj2envs | h200x4 | [LFM2.5-24B-A2B/](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/LFM2.5-24B-A2B/index.md) |
| `LiquidAI/LFM3-1.7B` | 400 | 300 medium + 250 hard SmolDataEnvs, 230 traj2envs | h200x2 | [LFM3-1.7B/](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/LFM3-1.7B/index.md) |
| `webAI-Official/TwIL-8B` (experiment) | 100 | 150 medium + 250 hard SmolDataEnvs, 230 traj2envs | h200x4 | [TwIL-8B/](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/TwIL-8B/index.md) |
| `Qwen/Qwen3.8-27B` | 1000 | 750 scale800, 300 TermGrade | h200x2 per harness (untested) | [Qwen3.8-27B/](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Qwen3.8-27B/index.md) |

Qwen3.8-27B has its own training script, TRL branch and settings. Its README lists the
differences; the rest of this page describes the LFM / TwIL runs.

## How a run works

`scripts/launcher_train.py` runs everything inside one job:
- one `vllm serve --enable-lora` that serves the base model and every adapter version
- one OpenEnv Harbor server per harness, with its sandboxes on HF sandboxes
- one AsyncGRPO trainer per harness (`--run NAME:HARNESS:DIFFICULTY`) running `scripts/async_grpo_harbor.py`

After each optimizer step, a trainer loads only its new adapter into vLLM, so the three harnesses share one server.
Flags the launcher does not know are passed on to the training script.

Every model uses the same settings:
- LoRA r=32 on all linear layers, learning rate 1e-5, 8 rollouts per task
- 4 gradient-accumulation steps, rollouts at most 4 weight updates stale, temperature 0.8
- up to 32,768 output tokens per turn
- a checkpoint every 10 steps

The reward is the task's own verifier plus `0.1 × (1 − calls / 15)`, given only to correct rollouts
(`--tool-efficiency-weight 0.1`). safeagents runs with two atif-scan plugins: `scripts/atif_smoldataenvs.py` and
`scripts/atif_traj2envs.py`. They block the agent from reading a task's answers at their source.

Evaluation (`scripts/launcher_eval.py --eval-lora`) serves the base and every checkpoint on one vLLM and measures
pass@1 per harness on two held-out splits:
- `final-heldout`: 150 easy and medium SmolDataEnvs tasks from index 1000
- `traj2envs-heldout`: the 40 traj2envs tasks from index 230

## Layout

```
scripts/                 shared by every model
  launcher_train.py      HF Jobs / local entry point for training (PEP 723: `hf jobs uv run` installs its deps)
  launcher_eval.py       same for evaluation
  async_grpo_harbor.py   the training script (AsyncGRPOTrainer + LoRA + Harbor rollouts)
  evaluate_harbor.py     the eval client the eval launcher runs per checkpoint
  atif_*.py              safeagents plugins (atif_harbor.py: generic, used by Qwen3.8-27B)
  eval_sweep.py          scheduled job that evaluated every checkpoint of the released runs as it landed
  release_adapters.py    packages the 9 released adapters (+ GGUF) and writes their model cards
<model>/
  recipe.yaml            metadata: hyperparameters, datasets, hardware, released checkpoints, the TRL it runs on
  trl.patch              Qwen3.8-27B only: its TRL fork's changes to trl/, relative to the upstream commit it branched from
  train_local.sh  train_hf_jobs.sh  eval_local.sh  eval_hf_jobs.sh
```

## HF Jobs

You need the `hf` CLI logged in, and a bucket of yours the job mounts on `/outputs`, set with `BUCKET`.

```sh
BUCKET=<user>/<bucket> bash LFM3-1.7B/train_hf_jobs.sh
```

Each script uploads the files the job reads from the bucket (the training or eval script, the safeagents plugins, and
TwIL's chat template), then submits the job detached. Runs are written to `/outputs/runs/<model>-<harness>-<job id>-<hex>/`
and evals to `/outputs/eval/`.

To evaluate every new checkpoint of a run on a schedule, copy `scripts/launcher_eval.py` to the bucket and edit
`MODELS` in `scripts/eval_sweep.py` to point at your job id:

```sh
hf jobs scheduled uv run "0 */6 * * *" --no-concurrency --flavor h200 --image huggingface/trl --secrets HF_TOKEN \
    --volume hf://buckets/<user>/<bucket>:/outputs scripts/eval_sweep.py -- LFM2.5-24B-A2B
```

**TRL version.** The released runs installed a TRL wheel from the bucket
(`--trl-wheel /outputs/wheels/lfm3/trl-1.17.0.dev0-py3-none-any.whl`). The branch it was built from was not recorded.
Without `TRL_WHEEL`, the scripts use the launcher's pinned TRL: `huggingface/trl@9f8725f7` on main, the merge of
[#7966](https://github.com/huggingface/trl/pull/7966) that added tree-attention packing for LFM (no release includes it
yet). To use a wheel, set `TRL_WHEEL=/outputs/<path>.whl`.

**TRL fork changes.** Qwen3.8-27B still runs on a TRL fork, so its folder has a `trl.patch`. It holds the diff of
`trl/` between the TRL fork commit that recipe installs and the upstream `huggingface/trl` commit the fork branched from. Both commits are recorded in
`recipe.yaml` under `trl:` and in the patch header. To rebuild the same TRL from upstream, check out `upstream_base`
and run `git apply trl.patch`. To regenerate the patch after the fork moves:

```sh
git diff $(git merge-base origin/main <fork commit>) <fork commit> -- trl/
```

## Local machine

The `*_local.sh` scripts run the same launcher with the same flags on the machine you are on: `uv run` installs the
launcher's inline dependencies, and the training script, plugins and chat template are read from this folder instead of
a bucket. You need `uv`, `HF_TOKEN` (the HF sandboxes also run under it), and as many GPUs as the run uses: 4 for
LFM2.5-24B-A2B and TwIL-8B, 2 for LFM3-1.7B and for each Qwen3.8-27B harness, all H200 class. Runs and evals go to
`./outputs` (`DATA_ROOT`). These are **untested**: none of the runs was made this way.

```sh
cd LFM3-1.7B && MAX_STEPS=2 bash train_local.sh
```

## Shared Scripts

- [`scripts/async_grpo_harbor.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/async_grpo_harbor.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/async_grpo_harbor.py))
- [`scripts/atif_harbor.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/atif_harbor.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/atif_harbor.py))
- [`scripts/atif_smoldataenvs.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/atif_smoldataenvs.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/atif_smoldataenvs.py))
- [`scripts/atif_traj2envs.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/atif_traj2envs.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/atif_traj2envs.py))
- [`scripts/deepseek_harness.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/deepseek_harness.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/deepseek_harness.py))
- [`scripts/eval_sweep.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/eval_sweep.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/eval_sweep.py))
- [`scripts/evaluate_harbor.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/evaluate_harbor.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/evaluate_harbor.py))
- [`scripts/launcher_eval.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/launcher_eval.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/launcher_eval.py))
- [`scripts/launcher_train.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/launcher_train.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/launcher_train.py))
- [`scripts/release_adapters.py`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/release_adapters.py) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/release_adapters.py))
- [`scripts/slurm_setup.sh`](https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/scripts/slurm_setup.sh) ([Hub](https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/scripts/slurm_setup.sh))
