{
 "id": "harness-adapters/Inkling-2-Mini",
 "path": "AsyncGRPOTrainer/harness-adapters/Inkling-2-Mini",
 "trainers": [
  "AsyncGRPOTrainer"
 ],
 "project": "harness-adapters",
 "name": "Inkling-2-Mini",
 "org": "thinkingmachines",
 "avatar": "https://cdn-avatars.huggingface.co/v1/production/uploads/680a76de1b8d08640089fab0/r60-JyW_pv4llgjEyDYj9.png",
 "hub_url": null,
 "meta": {
  "title": "Inkling 2 Mini harness adapters",
  "project": "harness-adapters",
  "trainer": "AsyncGRPOTrainer",
  "model_id": "thinkingmachines/Inkling-2-Mini",
  "description": "LoRA adapters for agent harnesses on Inkling 2 Mini, trained with async GRPO. Released: Inkling-2-Mini-pi-adapted, for pi at reasoning effort high (coding + cyber tasks, a tool-efficiency bonus and a length penalty; PRESET=pi-adapted), and the effort-none adapters (pi, hermes, opencode, DeepSeek Harness on scale800 + TermGrade, one job per harness). The Qwen3.8-27B recipe's settings, with what Inkling needs.",
  "tags": [
   "lora",
   "agentic-rl",
   "harbor",
   "safeagents",
   "multi-harness",
   "live"
  ],
  "harnesses": [
   "pi",
   "hermes",
   "opencode",
   "deepseek-harness"
  ],
  "date_added": "2026-11-25"
 },
 "hardware": {
  "hf_jobs": "h200x2 per harness, 32768-token window; b200x4 for PRESET=pi-adapted (65536-token window)"
 },
 "datasets": {
  "train": [
   "harness-hub/scale800-harbor@56c7f75d01f70859ec1354e97866e32a175c1a40",
   "harness-hub/termgrade-train-harbor",
   "harness-hub/UltraTerminals@24e4ce50aeb68d33563f219613028c06c38591d2"
  ],
  "eval": {
   "tbfull": "harborframework/terminal-bench-2.1@3e235dff6880252a587fa479c09bcb1e16edf2eb, all 89 tasks, 3600 s and 100 steps",
   "sbp": "harness-hub/swebench-pro-v2-hard51-harbor, 7200 s and 100 steps"
  }
 },
 "hyperparameters": {
  "lora_r": 32,
  "lora_target_modules": ".*language_model.*self_attn\\.(q_proj|k_proj|v_proj|o_proj)\\.linear",
  "learning_rate": 2e-05,
  "num_generations": 8,
  "gradient_accumulation_steps": 32,
  "max_staleness": 16,
  "temperature": 0.8,
  "max_completion_length": 8192,
  "max_model_len": 32768,
  "token_budget": 32768,
  "agent_step_limit": 50,
  "agent_timeout_s": 1800,
  "max_inflight": 64,
  "tool_efficiency_weight": 0.1,
  "max_steps": 1000,
  "save_steps": 10,
  "thinking": false,
  "pi_adapted": "PRESET=pi-adapted: reasoning effort high, temperature 1.0, 16 gradient-accumulation steps, 96 rollouts in flight, 65536-token window, 32768 output tokens a call, tool-efficiency bonus 0.1 x clip(1 - tool calls / 30, 0, 1), length penalty 0.2 x min(1, tokens / 65536) on correct rollouts, released at step 100"
 },
 "vllm": {
  "commit": "b976fff86af82c559b19aa676f52ea193eb0c188",
  "tool_call_parser": "inkling",
  "reasoning_parser": "inkling",
  "extra_args": [
   "--enable-prefix-caching",
   "--default-chat-template-kwargs '{\"reasoning_effort\": \"none\"}'"
  ]
 },
 "transformers": "5.24.0",
 "trl": {
  "fork": "younesbelkada/trl@e498acc637084cffff14deb09ccdc423a766adb2 (async-grpo-shared-vllm) plus the Inkling changes",
  "upstream_base": "d115286bc5aef8d346e8510bfe312803c7881c4a",
  "patch": "trl.patch"
 },
 "scripts": {
  "train": {
   "hf_jobs": "train_hf_jobs.sh"
  },
  "eval": {
   "hf_jobs": "eval_hf_jobs.sh"
  }
 },
 "builder": {
  "verified": {
   "hf_jobs": true
  },
  "train": [
   {
    "env": "HARNESS",
    "label": "Harness",
    "choices": [
     "pi",
     "hermes",
     "opencode",
     "deepseek-harness"
    ]
   },
   {
    "env": "PRESET",
    "label": "Recipe",
    "choices": [
     "effort-none",
     "pi-adapted"
    ],
    "when": {
     "HARNESS": "pi"
    },
    "platforms": [
     "hf_jobs"
    ]
   }
  ],
  "eval": [
   {
    "env": "BENCH",
    "label": "Benchmark",
    "choices": [
     "tbfull",
     "sbp"
    ]
   },
   {
    "env": "EFFORT",
    "label": "Reasoning effort",
    "choices": [
     "none",
     "default",
     "max"
    ],
    "platforms": [
     "hf_jobs"
    ]
   },
   {
    "env": "EVALS",
    "label": "Policies",
    "input": true,
    "default": "pi@pi:base",
    "platforms": [
     "hf_jobs"
    ]
   }
  ]
 },
 "readme": "# Inkling 2 Mini harness adapters\n\nLoRA adapters for agent harnesses on\n[`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini). Released:\n[Inkling-2-Mini-pi-adapted](https://huggingface.co/harness-hub/Inkling-2-Mini-pi-adapted), for pi at reasoning effort\nhigh ([below](#released-inkling-2-mini-pi-adapted-pi-effort-high)). The effort-none runs, for pi, hermes, opencode and\nDeepSeek Harness, train for up to 1,000 steps on the 750 scale800 tasks interleaved with 300 TermGrade tasks, thinking\noff. Live dashboard:\n[harness-hub/inkling-livestream](https://huggingface.co/spaces/harness-hub/inkling-livestream). Setup and shared\nsettings: [../README.md](../README.md). Full hyperparameters: [recipe.yaml](recipe.yaml).\n\n| | HF Jobs |\n|---|---|\n| Train | `HARNESS=pi bash train_hf_jobs.sh`, one h200x2 job per harness; `PRESET=pi-adapted bash train_hf_jobs.sh`, the released adapter |\n| Eval | `BENCH=tbfull\\|sbp EVALS=\"pi@pi:base\" bash eval_hf_jobs.sh`, one h200 job per policy |\n\nHow this differs from the Qwen3.8-27B recipe (same data, reward, LoRA rank, learning rate and agent limits):\n- **TRL.** The `async-grpo-shared-vllm` branch plus what Inkling needs: tree packing for Inkling 2 Loop's attention\n  and short convolutions, and the adapter's module names renamed to vLLM's when the trainer syncs it. All of it is in\n  [trl.patch](trl.patch), relative to upstream `d115286b`. `train_hf_jobs.sh` applies it to that commit and builds a\n  wheel.\n- **Libraries.** transformers 5.24.0, the first with Inkling 2 Loop, and a vLLM nightly (`b976fff8`) that serves it\n  with runtime LoRA and has its `inkling` tool and reasoning parsers.\n- **Model split.** vLLM serves the quantized checkpoint; the trainer trains on the BF16-dequantized model.\n- **LoRA on attention only** (`q/k/v/o_proj` of the language model): the experts stay frozen, and those are the four\n  projections vLLM serves LoRA on for this model.\n- **Thinking off as effort.** Inkling's chat template has no `enable_thinking`: rollouts run at\n  `reasoning_effort: \"none\"`.\n- **Context window.** 32,768 tokens on H200 (40,960 and 49,152 ran out of memory on the trainer); 65,536 on B300,\n  where hermes from step 60 and DeepSeek Harness train.\n- **32 gradient-accumulation steps**: at 16, a step trained on 3-5 groups.\n- **DeepSeek Harness** runs through [../scripts/deepseek_harness.py](../scripts/deepseek_harness.py), the\n  harness-leaderboard's setup pointed at the capture proxy, with web fetch off in training (safeagents blocks most\n  fetches, which zeroes the reward).\n\n## Released: Inkling-2-Mini-pi-adapted (pi, effort high)\n\n[harness-hub/Inkling-2-Mini-pi-adapted](https://huggingface.co/harness-hub/Inkling-2-Mini-pi-adapted) is step 100 of a\npi run at reasoning effort high (the chat template's default), on coding and cyber tasks:\n\n```sh\nPRESET=pi-adapted bash train_hf_jobs.sh\n```\n\nWhat the preset changes from the effort-none runs below:\n- **Data.** 1,431 tasks of [UltraTerminals](https://huggingface.co/datasets/harness-hub/UltraTerminals)\n  (`@24e4ce50`), listed in [pi_adapted_tasks.txt](pi_adapted_tasks.txt): 531 coding tasks (SWE-smith Python and Go,\n  Tasksmith) interleaved with 900 Cedar and OpenFGA authorization tasks. Of four mixes (coding, coding + cyber, coding +\n  knowledge work, hard tasks only), coding + cyber gave the best Terminal-Bench 2.1 results. The adapter trained on\n  these tasks' earlier builds: the cyber tasks are unchanged, while UltraTerminals now runs the coding tasks in pinned,\n  prebuilt images (each instruction gains a short note on the environment) with the same problems and tests.\n- **Thinking.** Effort high, temperature 1.0 (Inkling's generation config), a 65,536-token window with up to 32,768\n  output tokens a call.\n- **Reward.** The verifier's 0/1, plus, on correct rollouts only, a tool-efficiency bonus `0.1 \u00d7 clip(1 \u2212 tool calls /\n  30, 0, 1)` and a length penalty `0.2 \u00d7 min(1, generated tokens / 65,536)`. An ablation at effort low found the length\n  penalty with a 0.1 bonus the most token-efficient at the same accuracy.\n- **Batch.** 16 gradient-accumulation steps, 96 rollouts in flight.\n\nThe released run trained on 4 B300 GPUs (vLLM on 2 with tensor parallelism, the trainer on 2). On HF Jobs, the preset\nruns on a b200x4 job (vLLM on one GPU, the trainer on three): the 65,536-token window does not\nfit an H200 trainer. It has not been run as written on HF Jobs.\n\nResults (pi, effort high, temperature 1.0, paired against the base model): Terminal-Bench 2.1 with 1 h per task, 44.2%\n\u2192 56.9% avg@3 and 56.2% \u2192 70.8% pass@3; SWE-bench Pro (hard 51), 66.7% \u2192 70.6%; on the tasks both solve, 22\u201333% fewer\ntool calls and about 40% fewer output tokens. With a generous budget (4 h per task, or 256k context), both models\nsolve about as many tasks. See the model card for the full results.\n\n## Results so far (effort none)\n\nTerminal-Bench 2.1, all 89 tasks, thinking off, one attempt per task, on HF Jobs (h200, `eval_hf_jobs.sh`):\n\n| harness | base | best checkpoint so far |\n|---|---|---|\n| hermes | 57.5% | 63.2% (step 70), 7% fewer tool calls per solved task |\n| pi | 54.0% | 58.6% (step 70), 25-30% fewer tool calls per solved task |\n| DeepSeek Harness | 47.1% | training |\n\nOn SWE-bench Pro (hard 51), hermes at step 70 solves 62.7%. These adapters are not released: see the dashboard for\ntheir numbers.\n\n## Evaluating checkpoints\n\nCheckpoints reach the dashboard and the HF Jobs evals through the bucket. `eval_listener_hf.sh` schedules an hourly HF\nJobs eval of the newest checkpoint; `eval_hf_jobs.sh` evaluates chosen ones side by side.\n",
 "files": {
  "train_hf_jobs.sh": "#!/bin/bash\n# Inkling 2 Mini pi harness adapter on HF Jobs: one h200x2 job, one vLLM (GPU 0) serving the quantized checkpoint and\n# the adapter versions, one LoRA AsyncGRPO trainer (GPU 1) on the BF16-dequantized model.\n#\n# The Qwen3.8-27B pi recipe, thinking off (Qwen3.8-27B/train_hf_jobs.sh), with what Inkling needs:\n#   - TRL: upstream at trl.patch's base with trl.patch applied (the async-grpo-shared-vllm fork plus Inkling tree\n#     packing and the adapter rename for vLLM), built into a wheel here and read from the bucket\n#   - transformers 5.24.0 (first with Inkling 2 Loop) and a vLLM nightly (`inkling2_loop`, tool and reasoning parsers)\n#   - LoRA on the language model's attention projections only (experts stay frozen), the four vLLM serves LoRA on\n#   - thinking off: Inkling's chat template has no `enable_thinking`, effort \"none\" is 0\n#\n#   bash train_hf_jobs.sh                                                        full run, pi\n#   HARNESS=hermes bash train_hf_jobs.sh                                         hermes\n#   HARNESS=opencode MAX_STEPS=3 GRAD_ACCUM=2 MAX_INFLIGHT=32 bash train_hf_jobs.sh    smoke run, another harness\n#   HARNESS=deepseek-harness bash train_hf_jobs.sh                              DeepSeek Harness, effort none as the others\n#   TRAIN_GPUS=3 EFFORT=low TEMPERATURE=1.0 bash train_hf_jobs.sh                 h200x4: the trainer on 3 GPUs\n#\n#   TRAIN_GPUS   trainer GPUs, default 1 (h200x2). More than 1 runs data parallel, one full model per GPU\n#                (launcher_train_fsdp.py, from ../Qwen3.8-Flash-Next/make_launcher_fsdp.py, starts one process per GPU):\n#                each micro-batch is one packed row per GPU, so a step trains on TRAIN_GPUS times the tasks at the same\n#                GRAD_ACCUM\n#   EFFORT       reasoning effort, as train_slurm.sh: none (default) or low, medium, high; other than none, 16k output\n#                tokens a call\n#   MIX_SPLIT    `REPO:N` mixed into SPLIT, default the 300 TermGrade tasks; MIX_SPLIT= for SPLIT alone\n#   MAX_MODEL_LEN  vLLM's window, default TOKEN_BUDGET (32768)\n#   TEMPERATURE  sampling temperature, default 0.8 (Inkling's generation_config: 1.0)\n#   PRESET       effort-none (default, the variables above) or pi-adapted: the run behind\n#                harness-hub/Inkling-2-Mini-pi-adapted (step 100), as defaults that any variable still overrides\n#   TASK_IDS     a file in this folder listing the task folders of SPLIT to train on, one per line (pi-adapted:\n#                pi_adapted_tasks.txt); empty for SPLIT's first N_TASKS (default 1000)\n#   GPU          the job's GPU type, default h200 (h200x(TRAIN_GPUS+1)); pi-adapted's 65536-token window needs b200\n#\n#   PRESET=pi-adapted bash train_hf_jobs.sh                                    the released pi adapter, b200x4\nset -euo pipefail\n\n# pi-adapted: reasoning effort high (the chat template's default), temperature 1.0, 65536-token window with 32768\n# output tokens a call, the 1,431 UltraTerminals tasks of pi_adapted_tasks.txt (531 SWE-smith and Tasksmith coding\n# tasks, 900 Cedar/OpenFGA cyber tasks, interleaved), 16 gradient-accumulation steps, the tool-efficiency bonus fading\n# out at 30 tool calls and a length penalty on correct rollouts (0.2 x min(1, tokens / 65536)). The released adapter is\n# step 100 of this run, trained on 4 B300 GPUs (vLLM on 2, tensor parallel, the trainer on 2); on HF Jobs, vLLM runs on\n# one GPU and the trainer on 3\nPRESET=\"${PRESET:-effort-none}\"\nif [ \"$PRESET\" = pi-adapted ]; then\n    : \"${HARNESS:=pi}\" \"${EFFORT:=high}\" \"${TEMPERATURE:=1.0}\" \"${GRAD_ACCUM:=16}\" \"${MAX_INFLIGHT:=96}\"\n    : \"${TOKEN_BUDGET:=65536}\" \"${MAX_OUTPUT_TOKENS:=32768}\" \"${GPU:=b200}\" \"${TRAIN_GPUS:=3}\" \"${MAX_STEPS:=100}\"\n    : \"${SPLIT:=harness-hub/UltraTerminals@24e4ce50aeb68d33563f219613028c06c38591d2}\"\n    : \"${MIX_SPLIT=}\" \"${TASK_IDS:=pi_adapted_tasks.txt}\" \"${N_TASKS:=1431}\"\n    : \"${TRAIN_EXTRA:=--tool-budget 30 --length-penalty-weight 0.2 --length-budget 65536}\"\nelif [ \"$PRESET\" != effort-none ]; then\n    echo \"PRESET=$PRESET: effort-none or pi-adapted\" >&2\n    exit 1\nfi\nGPU=\"${GPU:-h200}\"\n\nBUCKET=\"${BUCKET:-ybelkada/harbor-evals}\"\nHARNESS=\"${HARNESS:-pi}\"  # pi, opencode, hermes or deepseek-harness\nSPLIT=\"${SPLIT:-harness-hub/scale800-harbor@56c7f75d01f70859ec1354e97866e32a175c1a40}\"\nLEARNING_RATE=\"${LEARNING_RATE:-2e-5}\"\nMAX_INFLIGHT=\"${MAX_INFLIGHT:-64}\"\nMAX_STALENESS=\"${MAX_STALENESS:-16}\"\nGRAD_ACCUM=\"${GRAD_ACCUM:-32}\"  # the final runs' (474235, 489796): 16 gave 3-5 groups a step\nMAX_STEPS=\"${MAX_STEPS:-1000}\"\nTRAIN_EXTRA=\"${TRAIN_EXTRA:-}\"\n# Another Harbor dataset's first N tasks, mixed in (`REPO:N`); empty trains on SPLIT alone\nMIX_SPLIT=\"${MIX_SPLIT-harness-hub/termgrade-train-harbor:300}\"\nMIX_ARGS=()\n[ -n \"$MIX_SPLIT\" ] && MIX_ARGS=(--mix-split \"$MIX_SPLIT\")\nTRAIN_GPUS=\"${TRAIN_GPUS:-1}\"\nTEMPERATURE=\"${TEMPERATURE:-0.8}\"\nEFFORT=\"${EFFORT:-none}\"\n# 65536 ran out of memory on an H200 trainer, which holds the whole model even data parallel\nTOKEN_BUDGET=\"${TOKEN_BUDGET:-32768}\"\n# vLLM's window, default the token budget: a larger one lets rollouts grow past what the trainer keeps (it drops them)\nMAX_MODEL_LEN=\"${MAX_MODEL_LEN:-$TOKEN_BUDGET}\"\nif [ \"$EFFORT\" = none ]; then\n    MAX_OUTPUT_TOKENS=\"${MAX_OUTPUT_TOKENS:-8192}\"; THINKING_ARGS=(--no-responses-thinking)\nelse\n    # Half the window: a call asking for the whole window would leave no room for its prompt\n    MAX_OUTPUT_TOKENS=\"${MAX_OUTPUT_TOKENS:-16384}\"; THINKING_ARGS=()\nfi\n# vLLM on GPU 0, the trainer on the next TRAIN_GPUS\nTRAIN_DEVICES=\"$(seq 1 \"$TRAIN_GPUS\" | paste -sd, -)\"  # not `seq -s,`: macOS leaves a trailing comma\nLAUNCHER=launcher_train.py\n[ \"$TRAIN_GPUS\" -gt 1 ] && LAUNCHER=launcher_train_fsdp.py\nMAX_NUM_SEQS=$((2 * MAX_INFLIGHT))\nMAX_LORAS=$((MAX_STALENESS + 2))\n# The nightly that served Inkling 2 Mini with runtime LoRA in inkling_vllm_check.sh / inkling_parity_check.sh\nVLLM_COMMIT=\"${VLLM_COMMIT:-b976fff86af82c559b19aa676f52ea193eb0c188}\"\nTRACKIO_SPACE_ID=\"${TRACKIO_SPACE_ID:-ybelkada/async-grpo-harbor}\"\nHERE=\"$(cd \"$(dirname \"$0\")\" && pwd)\"\nSCRIPTS=\"$HERE/../scripts\"\n[ \"$TRAIN_GPUS\" -gt 1 ] && python3 \"$HERE/../Qwen3.8-Flash-Next/make_launcher_fsdp.py\" \"$SCRIPTS/launcher_train.py\"\n\n# TRL: upstream at the patch's base, with the patch applied\nTRL_BASE=d115286bc5aef8d346e8510bfe312803c7881c4a\nTRL_SRC=\"$(mktemp -d)\"\ngit -C \"$TRL_SRC\" init -q\ngit -C \"$TRL_SRC\" fetch -q --depth 1 https://github.com/huggingface/trl \"$TRL_BASE\"\ngit -C \"$TRL_SRC\" checkout -q FETCH_HEAD\ngit -C \"$TRL_SRC\" apply \"$HERE/trl.patch\"\nWHEELS=\"$(mktemp -d)\"\nuv build --wheel --out-dir \"$WHEELS\" \"$TRL_SRC\" > /dev/null\nWHEEL=\"$(basename \"$(ls \"$WHEELS\"/trl-*.whl)\")\"\nhf buckets cp \"$WHEELS/$WHEEL\" \"hf://buckets/$BUCKET/wheels/inkling/$WHEEL\"\nhf buckets cp \"$HERE/async_grpo_harbor.py\" \"hf://buckets/$BUCKET/inkling_async_grpo_harbor.py.txt\"\nhf buckets cp \"$SCRIPTS/atif_harbor.py\" \"hf://buckets/$BUCKET/atif_harbor.py\"\nTASK_ARGS=()\nif [ -n \"${TASK_IDS:-}\" ]; then\n    hf buckets cp \"$HERE/$TASK_IDS\" \"hf://buckets/$BUCKET/inkling_$TASK_IDS\"\n    TASK_ARGS=(--task-ids \"/outputs/inkling_$TASK_IDS\")\nfi\n# DeepSeek Harness's agent class, which the launcher adds to OpenEnv, and the effort it sends on every call\nDSH_ARGS=()\nif [ \"$HARNESS\" = deepseek-harness ]; then\n    hf buckets cp \"$SCRIPTS/deepseek_harness.py\" \"hf://buckets/$BUCKET/deepseek_harness.py.txt\"\n    DSH_ARGS=(--deepseek-harness-module /outputs/deepseek_harness.py.txt --deepseek-harness-effort none)\nfi\n\nhf jobs uv run --detach \\\n    --flavor \"${GPU}x$((TRAIN_GPUS + 1))\" --image huggingface/trl --secrets HF_TOKEN --timeout \"${JOB_TIMEOUT:-96h}\" \\\n    --env PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \\\n    --volume \"hf://buckets/$BUCKET:/outputs\" \\\n    \"$SCRIPTS/$LAUNCHER\" -- \\\n    --data-root /outputs --trl-wheel \"/outputs/wheels/inkling/$WHEEL\" --vllm-commit \"$VLLM_COMMIT\" \\\n    --pip-install \"transformers==5.24.0 triton==3.7.1 safeagents@git+https://github.com/huggingface/safeagents@5e683fa atif-scan==0.8.15 rich markdown-it-py mdurl pygments\" \\\n    --train-script-url file:///outputs/inkling_async_grpo_harbor.py.txt \\\n    --model thinkingmachines/Inkling-2-Mini --harness \"$HARNESS\" --split \"$SPLIT\" --n-tasks \"${N_TASKS:-1000}\" \\\n    ${TASK_ARGS[@]+\"${TASK_ARGS[@]}\"} ${MIX_ARGS[@]+\"${MIX_ARGS[@]}\"} --interleave \\\n    --sandbox hf-sandbox --expose gradio \\\n    --vllm-device 0 --train-device \"$TRAIN_DEVICES\" \\\n    --tool-call-parser inkling --reasoning-parser inkling --max-model-len \"$MAX_MODEL_LEN\" \\\n    --vllm-extra-args=\"--enable-prefix-caching --max-num-seqs $MAX_NUM_SEQS --default-chat-template-kwargs '{\\\"reasoning_effort\\\": \\\"$EFFORT\\\"}'\" \\\n    --max-inflight \"$MAX_INFLIGHT\" --max-lora-rank 32 --max-loras \"$MAX_LORAS\" \\\n    --max-output-tokens \"$MAX_OUTPUT_TOKENS\" ${THINKING_ARGS[@]+\"${THINKING_ARGS[@]}\"} \\\n    --reward-key correctness,reward --num-generations 8 \\\n    --gradient-accumulation-steps \"$GRAD_ACCUM\" --max-staleness \"$MAX_STALENESS\" --token-budget \"$TOKEN_BUDGET\" \\\n    --max-completion-length \"$MAX_OUTPUT_TOKENS\" --agent-step-limit 50 --agent-timeout 1800 --temperature \"$TEMPERATURE\" \\\n    --lora-r 32 --lora-target-modules '.*language_model.*self_attn\\.(q_proj|k_proj|v_proj|o_proj)\\.linear' \\\n    --learning-rate \"$LEARNING_RATE\" --tool-efficiency-weight 0.1 \\\n    --safeagents --safeagents-plugin /outputs/atif_harbor.py:checks \\\n    --max-steps \"$MAX_STEPS\" --save-steps 10 --save-total-limit 0 \\\n    --trackio-space-id \"$TRACKIO_SPACE_ID\" ${DSH_ARGS[@]+\"${DSH_ARGS[@]}\"} $TRAIN_EXTRA\n",
  "eval_hf_jobs.sh": "#!/bin/bash\n# Evaluate chosen Inkling 2 Mini checkpoints side by side on HF Jobs, one h200 job each, with eval_listener_hf.py's\n# staging and retries: results in a couple of hours instead of the scheduled listener's one checkpoint at a time.\n#\n#   EVALS   space-separated `<run folder glob part>@<harness>:<step or base>`\n#   EFFORT  none (default, the no-think runs), default (the thinking run) or a level (max for DeepSeek Harness, as the\n#           harness-leaderboard runs Inkling 2 Mini); one effort per call\n#   BENCH   tbfull (default) or sbp\n#   TEMPERATURE  sampling temperature (default 0.8, the earlier evals'; 1.0 as in training gets its own folders)\n#   EXTRA   more eval_listener_hf.py options, e.g. \"--n-tasks 10 --tag-suffix smoke\"\n#   TIMEOUT the job's time limit (default 8h)\n#\n#   EVALS=\"pi@pi:base hermes@hermes:base\" bash eval_hf_jobs.sh                   the base under each harness\n#   EVALS=\"pi-474235@pi:base pi-474235@pi:60 hermes-474237@hermes:50\" bash eval_hf_jobs.sh\n#   EFFORT=default EVALS=\"pi-475041@pi:20\" bash eval_hf_jobs.sh\n#   EFFORT=max EVALS=\"dsh@deepseek-harness:base\" EXTRA=\"--n-tasks 10 --tag-suffix smoke\" bash eval_hf_jobs.sh\n#\n# The checkpoints come from the bucket's runs/, which the cluster's sync_live.sh fills. Pause the listener schedules\n# meanwhile (hf jobs scheduled suspend <id>): one could pick the same policy and write the same folder.\nset -euo pipefail\n\nBUCKET=\"${BUCKET:-ybelkada/harbor-evals}\"\nBENCH=\"${BENCH:-tbfull}\"\nEFFORT=\"${EFFORT:-none}\"\nTEMPERATURE=\"${TEMPERATURE:-0.8}\"\nEVALS=\"${EVALS:?EVALS=\\\"<run part>@<harness>:<step or base> ...\\\"}\"\nEXTRA=\"${EXTRA:-}\"\nTIMEOUT=\"${TIMEOUT:-8h}\"\nVLLM_COMMIT=\"${VLLM_COMMIT:-b976fff86af82c559b19aa676f52ea193eb0c188}\"\nHERE=\"$(cd \"$(dirname \"$0\")\" && pwd)\"\nSCRIPTS=\"$HERE/../scripts\"\nread -r -a EXTRA_ARGS <<< \"$EXTRA\"\n\nhf buckets cp \"$SCRIPTS/launcher_eval.py\" \"hf://buckets/$BUCKET/launcher_eval.py\"\nhf buckets cp \"$SCRIPTS/evaluate_harbor.py\" \"hf://buckets/$BUCKET/evaluate_harbor.py\"\n# DeepSeek Harness's agent class, which the launcher adds to OpenEnv for a `deepseek-harness` eval\nhf buckets cp \"$SCRIPTS/deepseek_harness.py\" \"hf://buckets/$BUCKET/deepseek_harness.py\"\nfor entry in $EVALS; do\n    run=\"${entry%:*}\"\n    step=\"${entry##*:}\"\n    hf jobs uv run --detach \\\n        --flavor h200 --image huggingface/trl --secrets HF_TOKEN --timeout \"$TIMEOUT\" \\\n        --label \"name=inkling-eval-${run%@*}-$step-effort-$EFFORT-temp${TEMPERATURE//./p}\" \\\n        --volume \"hf://buckets/$BUCKET:/outputs\" \\\n        \"$HERE/eval_listener_hf.py\" \\\n        --bench \"$BENCH\" --runs \"$run\" --effort \"$EFFORT\" --temperature \"$TEMPERATURE\" --checkpoint \"$step\" --vllm-commit \"$VLLM_COMMIT\" ${EXTRA_ARGS[@]+\"${EXTRA_ARGS[@]}\"}\ndone\n",
  "recipe.yaml": "meta:\n  title: \"Inkling 2 Mini harness adapters\"\n  project: harness-adapters\n  trainer: AsyncGRPOTrainer\n  model_id: thinkingmachines/Inkling-2-Mini\n  description: \"LoRA adapters for agent harnesses on Inkling 2 Mini, trained with async GRPO. Released: Inkling-2-Mini-pi-adapted, for pi at reasoning effort high (coding + cyber tasks, a tool-efficiency bonus and a length penalty; PRESET=pi-adapted), and the effort-none adapters (pi, hermes, opencode, DeepSeek Harness on scale800 + TermGrade, one job per harness). The Qwen3.8-27B recipe's settings, with what Inkling needs.\"\n  tags: [lora, agentic-rl, harbor, safeagents, multi-harness, live]\n  harnesses: [pi, hermes, opencode, deepseek-harness]\n  date_added: 2026-11-25\n  dashboard: https://huggingface.co/spaces/harness-hub/inkling-livestream\n\nhardware:\n  slurm: \"B300 GPUs, 2 per harness\"   # vLLM on GPU 0 (the quantized checkpoint), the trainer on GPU 1 (BF16)\n  hf_jobs: \"h200x2 per harness, 32768-token window; b200x4 for PRESET=pi-adapted (65536-token window)\"   # 40960 and 49152 ran out of memory on the H200 trainer\n\ndatasets:\n  train:\n    - harness-hub/scale800-harbor@56c7f75d01f70859ec1354e97866e32a175c1a40   # 750 tasks (effort none)\n    - harness-hub/termgrade-train-harbor                                      # 300 tasks, interleaved (effort none)\n    - harness-hub/UltraTerminals@24e4ce50aeb68d33563f219613028c06c38591d2   # pi-adapted: the 1,431 tasks of pi_adapted_tasks.txt, 531 coding and 900 cyber, interleaved\n  eval:\n    tbfull: \"harborframework/terminal-bench-2.1@3e235dff6880252a587fa479c09bcb1e16edf2eb, all 89 tasks, 3600 s and 100 steps\"\n    sbp: \"harness-hub/swebench-pro-v2-hard51-harbor, 7200 s and 100 steps\"\n\nhyperparameters:\n  lora_r: 32\n  lora_target_modules: '.*language_model.*self_attn\\.(q_proj|k_proj|v_proj|o_proj)\\.linear'   # attention only, experts frozen\n  learning_rate: 2.0e-5\n  num_generations: 8\n  gradient_accumulation_steps: 32\n  max_staleness: 16\n  temperature: 0.8\n  max_completion_length: 8192\n  max_model_len: 32768\n  token_budget: 32768          # 65536 on B300 (hermes from step 60, DeepSeek Harness)\n  agent_step_limit: 50\n  agent_timeout_s: 1800\n  max_inflight: 64\n  tool_efficiency_weight: 0.1\n  max_steps: 1000\n  save_steps: 10\n  thinking: false              # reasoning_effort \"none\": Inkling's chat template has no enable_thinking\n  pi_adapted: \"PRESET=pi-adapted: reasoning effort high, temperature 1.0, 16 gradient-accumulation steps, 96 rollouts in flight, 65536-token window, 32768 output tokens a call, tool-efficiency bonus 0.1 x clip(1 - tool calls / 30, 0, 1), length penalty 0.2 x min(1, tokens / 65536) on correct rollouts, released at step 100\"\n\nvllm:\n  commit: b976fff86af82c559b19aa676f52ea193eb0c188   # a nightly: inkling2_loop with runtime LoRA, its parsers\n  tool_call_parser: inkling\n  reasoning_parser: inkling\n  extra_args: [--enable-prefix-caching, \"--default-chat-template-kwargs '{\\\"reasoning_effort\\\": \\\"none\\\"}'\"]\n\ntransformers: \"5.24.0\"   # the first with Inkling 2 Loop\n\ntrl:\n  fork: \"younesbelkada/trl@e498acc637084cffff14deb09ccdc423a766adb2 (async-grpo-shared-vllm) plus the Inkling changes\"\n  upstream_base: d115286bc5aef8d346e8510bfe312803c7881c4a\n  patch: trl.patch            # the changes to trl/, relative to upstream_base: Inkling 2 Loop tree packing, the adapter rename for vLLM\n\nprovenance:\n  released:\n    pi-adapted: {repo: harness-hub/Inkling-2-Mini-pi-adapted, step: 100}\n    pi-adapted-preview: {repo: harness-hub/Inkling-2-Mini-pi-adapted-preview, step: 200}\n  slurm_jobs: {pi: 474235, hermes: 489796, opencode: 474417, pi-thinking: 475041, deepseek-harness: 500242, pi-adapted: 513252}\n  hf_jobs: {deepseek-harness: 6b058b7faba0b0fd660accae}\n  notes: \"hermes 489796 resumes 474237 from checkpoint 60 with a 65536-token window; deepseek-harness moved from HF Jobs (32768) to the cluster (65536), where 25% of its rollouts no longer hit the window\"\n  status: training\n\nscripts:\n  train: {hf_jobs: train_hf_jobs.sh, slurm: train_slurm.sh}\n  eval: {hf_jobs: eval_hf_jobs.sh, slurm: eval_slurm.sh}\n  dashboard: ../scripts/sync_live.sh  # live.json and checkpoints -> the bucket the Space reads\n\n# What the command builder on the recipes site offers. Each option is an environment variable of the script it runs.\nbuilder:\n  verified: {hf_jobs: true, slurm: true}   # train_hf_jobs.sh ran (DeepSeek Harness), with TRL from the worktree trl.patch reproduces\n  train:\n    - env: HARNESS\n      label: Harness\n      choices: [pi, hermes, opencode, deepseek-harness]\n    - env: PRESET\n      label: Recipe\n      choices: [effort-none, pi-adapted]\n      when: {HARNESS: pi}\n      platforms: [hf_jobs]\n  eval:\n    - env: BENCH\n      label: Benchmark\n      choices: [tbfull, sbp]\n    - env: EFFORT\n      label: Reasoning effort\n      choices: [none, default, max]\n      platforms: [hf_jobs]\n    - env: EVALS\n      label: Policies\n      input: true\n      default: \"pi@pi:base\"\n      platforms: [hf_jobs]\n",
  "trl.patch": "TRL changes the Inkling 2 Mini recipe runs on, relative to upstream huggingface/trl.\n  upstream base: d115286bc5aef8d346e8510bfe312803c7881c4a (2026-11-11, Add UDPO loss for noisy preferences to DPOTrainer (#8211))\n  source:        the trl-inkling-exp worktree: younesbelkada/trl async-grpo-shared-vllm (e498acc6) plus uncommitted\n                 Inkling changes (Inkling 2 Loop tree packing, the adapter rename for vLLM)\nApply on a checkout of the upstream base: git apply trl.patch (train_hf_jobs.sh does this and builds a wheel)\nRegenerate: git diff d115286bc5aef8d346e8510bfe312803c7881c4a -- trl/, plus git diff --no-index /dev/null <file> for each untracked file under trl/\n\ndiff --git a/trl/experimental/async_distillation/async_distillation_config.py b/trl/experimental/async_distillation/async_distillation_config.py\nindex bc1d422e..38a1e7a2 100644\n--- a/trl/experimental/async_distillation/async_distillation_config.py\n+++ b/trl/experimental/async_distillation/async_distillation_config.py\n@@ -84,6 +84,9 @@ class AsyncDistillationConfig(_BaseConfig):\n             Timeout in seconds for calls to the vLLM servers: waiting for the student's server to be ready at startup,\n             each generation or scoring request, and each weight-sync call. Waiting for the server and weight-sync calls\n             raise when it runs out; a generation or scoring request that times out is retried.\n+        vllm_lora_name (`str`, *optional*, defaults to `\"trl-policy\"`):\n+            Prefix of the adapter names published to the student's vLLM server under adapter-only sync\n+            (`{vllm_lora_name}-v{N}`). Give each trainer its own prefix when several share one server.\n         teacher_server_urls (`dict[str, str]`, *optional*, defaults to `{\"default\": \"http://localhost:8001\"}`):\n             Teacher vLLM server(s), each started with `vllm serve <teacher-model> --logprobs-mode processed_logprobs\n             --max-logprobs -1`. Every teacher is static: this trainer never streams weight updates to any of them, so a\n@@ -295,6 +298,13 @@ class AsyncDistillationConfig(_BaseConfig):\n             \"weight-sync calls raise when it runs out; a generation or scoring request that times out is retried.\"\n         },\n     )\n+    vllm_lora_name: str = field(\n+        default=\"trl-policy\",\n+        metadata={\n+            \"help\": \"Prefix of the adapter names published to the student's vLLM server under adapter-only sync \"\n+            \"(`{vllm_lora_name}-v{N}`). Give each trainer its own prefix when several share one server.\"\n+        },\n+    )\n     teacher_server_urls: dict[str, str] | str | None = field(\n         default=None,\n         metadata={\ndiff --git a/trl/experimental/async_distillation/async_distillation_trainer.py b/trl/experimental/async_distillation/async_distillation_trainer.py\nindex 69a5da64..b42c97c9 100644\n--- a/trl/experimental/async_distillation/async_distillation_trainer.py\n+++ b/trl/experimental/async_distillation/async_distillation_trainer.py\n@@ -1348,7 +1348,7 @@ class AsyncDistillationTrainer(_BaseTrainer):\n         # Adapter-only vLLM sync is derived from a PEFT model plus a server started with `--enable-lora`, rather\n         # than configured. Rank 0 probes and broadcasts the answer below.\n         self._lora_sync = False\n-        self._lora_name = \"trl-policy\"\n+        self._lora_name = self.args.vllm_lora_name\n         # Absolute: the path is resolved by the *server's* process, which has its own working directory and may not\n         # be on this machine. vLLM reads a path it cannot resolve as a Hub repo id, failing deep inside the engine.\n         self._lora_dir = os.path.abspath(os.path.join(self.args.output_dir, \".vllm_lora\"))\n@@ -1967,11 +1967,10 @@ class AsyncDistillationTrainer(_BaseTrainer):\n         # Under DDP `self.model` is the wrapper, which does not expose `save_pretrained`.\n         model = self.accelerator.unwrap_model(self.model)\n \n-        logger.info(\"Weight sync: pausing vLLM...\")\n-        if self.accelerator.is_main_process:\n-            self.vllm_client.pause()\n+        # No `/pause`: in-flight requests keep the adapter they named, and pausing would stall every other trainer\n+        # sharing this server.\n         t_pause = time.time()\n-        logger.info(f\"Weight sync: pause took {t_pause - t0:.1f}s, waiting for all ranks...\")\n+        logger.info(\"Weight sync: waiting for all ranks...\")\n \n         self.accelerator.wait_for_everyone()\n         t_barrier = time.time()\n@@ -1984,12 +1983,11 @@ class AsyncDistillationTrainer(_BaseTrainer):\n \n         self.accelerator.wait_for_everyone()\n \n-        logger.info(f\"Weight sync: resuming vLLM... (transfer took {t_transfer - t_barrier:.1f}s)\")\n+        logger.info(f\"Weight sync: loading adapter... (transfer took {t_transfer - t_barrier:.1f}s)\")\n         if self.accelerator.is_main_process:\n             # The adapter has to exist on the server BEFORE the version moves below: the rollout worker derives the\n             # adapter it requests from `model_version`, so bumping first would name one that is not loaded yet.\n             self.vllm_client.load_lora_adapter(f\"{self._lora_name}-v{version}\", adapter_dir)\n-            self.vllm_client.resume()\n             stale_version = version - (self.args.max_staleness + 1)\n             if stale_version > 0:\n                 self.vllm_client.unload_lora_adapter(f\"{self._lora_name}-v{stale_version}\")\ndiff --git a/trl/experimental/async_grpo/async_grpo_config.py b/trl/experimental/async_grpo/async_grpo_config.py\nindex 6335eb5f..26a20220 100644\n--- a/trl/experimental/async_grpo/async_grpo_config.py\n+++ b/trl/experimental/async_grpo/async_grpo_config.py\n@@ -88,6 +88,9 @@ class AsyncGRPOConfig(_BaseConfig):\n             Timeout in seconds for calls to the vLLM server: waiting for it to be ready at startup, each generation\n             request, and each weight-sync call. Waiting for the server and weight-sync calls raise when it runs out; a\n             generation request that times out is retried.\n+        vllm_lora_name (`str`, *optional*, defaults to `\"trl-policy\"`):\n+            Prefix of the adapter names published to the vLLM server under adapter-only sync (`{vllm_lora_name}-v{N}`).\n+            Give each trainer its own prefix when several share one server.\n \n         > Parameters that control the training\n \n@@ -296,6 +299,13 @@ class AsyncGRPOConfig(_BaseConfig):\n             \"it runs out; a generation request that times out is retried.\"\n         },\n     )\n+    vllm_lora_name: str = field(\n+        default=\"trl-policy\",\n+        metadata={\n+            \"help\": \"Prefix of the adapter names published to the vLLM server under adapter-only sync \"\n+            \"(`{vllm_lora_name}-v{N}`). Give each trainer its own prefix when several share one server.\"\n+        },\n+    )\n \n     # Parameters that control the training\n     epsilon: float = field(\ndiff --git a/trl/experimental/async_grpo/async_grpo_trainer.py b/trl/experimental/async_grpo/async_grpo_trainer.py\nindex d716d5c7..2296d12f 100644\n--- a/trl/experimental/async_grpo/async_grpo_trainer.py\n+++ b/trl/experimental/async_grpo/async_grpo_trainer.py\n@@ -36,6 +36,7 @@ from accelerate.logging import get_logger\n from accelerate.utils import broadcast_object_list, is_peft_model, set_seed\n from datasets import Dataset, IterableDataset\n from packaging.version import Version\n+from safetensors.torch import load_file, save_file\n from torch.distributed._tensor import DTensor\n from torch.utils.data import DataLoader\n from transformers import AutoTokenizer, PreTrainedModel, PreTrainedTokenizerBase, TrainerCallback\n@@ -60,7 +61,15 @@ from ...trainer.utils import (\n )\n from .async_grpo_config import AsyncGRPOConfig\n from .async_rollout_worker import AsyncRolloutLoop, AsyncRolloutWorker, RolloutSample\n-from .packing import TREE_ATTENTION, TreeRow, patch_tree_gdn, register_tree_attention, unpad_tree\n+from .packing import (\n+    TREE_ATTENTION,\n+    TreeRow,\n+    patch_tree_gdn,\n+    patch_tree_inkling2_loop,\n+    patch_tree_qwen4_exp,\n+    register_tree_attention,\n+    unpad_tree,\n+)\n from .vllm_client import VLLMClient\n from .weight_transfer import WeightTransferClient\n \n@@ -688,6 +697,19 @@ def validate_lora_for_vllm_sync(model: \"PeftModel\") -> \"LoraConfig\":\n     return peft_config\n \n \n+# transformers renames Inkling 2 Loop's checkpoint on load; vLLM keeps the checkpoint's names and loads LoRA by them\n+_INKLING2_LOOP_VLLM_NAMES = [\n+    (\".language_model.layers.\", \".llm.layers.\"),\n+    (\".self_attn.q_proj.linear.\", \".attn.wq_du.\"),\n+    (\".self_attn.k_proj.linear.\", \".attn.wk_dv.\"),\n+    (\".self_attn.v_proj.linear.\", \".attn.wv_dv.\"),\n+    (\".self_attn.o_proj.linear.\", \".attn.wo_ud.\"),\n+    (\".self_attn.o_proj.gate_proj.\", \".attn.gate_attn.\"),\n+    (\".self_attn.relative_position_bias.linear.\", \".attn.wr_du.\"),\n+    (\".self_attn.sink_proj.\", \".attn.attn_sink_proj.\"),\n+]\n+\n+\n def save_lora_adapter(model: \"PeftModel\", accelerator: Accelerator, adapter_name: str, dest_dir: str) -> None:\n     \"\"\"\n     Save one PEFT adapter to `dest_dir`, gathering sharded parameters as needed.\n@@ -732,6 +754,21 @@ def save_lora_adapter(model: \"PeftModel\", accelerator: Accelerator, adapter_name\n     # PEFT nests every adapter but `\"default\"` in a subdirectory, while vLLM expects `adapter_config.json` at the root\n     # of the path it is handed.\n     saved_dir = tmp_dir if adapter_name == \"default\" else os.path.join(tmp_dir, adapter_name)\n+    if model.config.model_type == \"inkling2_loop\":\n+        weights_path = os.path.join(saved_dir, \"adapter_model.safetensors\")\n+        tensors = {}\n+        for name, tensor in load_file(weights_path).items():\n+            for old, new in _INKLING2_LOOP_VLLM_NAMES:\n+                name = name.replace(old, new)\n+            tensors[name] = tensor\n+        save_file(tensors, weights_path)\n+        # vLLM checks `target_modules` against its own module names too\n+        config_path = os.path.join(saved_dir, \"adapter_config.json\")\n+        with open(config_path) as f:\n+            adapter_config = json.load(f)\n+        adapter_config[\"target_modules\"] = sorted({name.split(\".lora_\")[0].rsplit(\".\", 1)[-1] for name in tensors})\n+        with open(config_path, \"w\") as f:\n+            json.dump(adapter_config, f, indent=2)\n     shutil.rmtree(dest_dir, ignore_errors=True)\n     os.rename(saved_dir, dest_dir)  # atomic within one filesystem\n     shutil.rmtree(tmp_dir, ignore_errors=True)\n@@ -1007,19 +1044,26 @@ class AsyncGRPOTrainer(_BaseTrainer):\n \n         text_config = model.config.get_text_config()\n         layer_types = set(getattr(text_config, \"layer_types\", None) or []) - {\"full_attention\", \"sliding_attention\"}\n+        # Inkling 2 Loop's hybrid layers are attention plus short convolutions: once patched, nothing is left to check\n+        if layer_types <= {\"hybrid\", \"hybrid_sliding\"} and layer_types and patch_tree_inkling2_loop(model):\n+            layer_types = set()\n         # Check tree attention compat\n         if layer_types:\n-            if layer_types == {\"linear_attention\"} and Version(transformers.__version__) < Version(\"5.15.0\"):\n+            if \"linear_attention\" in layer_types and Version(transformers.__version__) < Version(\"5.15.0\"):\n                 raise ValueError(\n                     f\"Tree packing of {type(model).__name__}'s gated DeltaNet layers requires transformers>=5.15.0: \"\n                     \"before it, these layers call the functions they stored at init rather than the module-level \"\n                     \"ones tree packing patches, so they would scan across samples.\"\n                 )\n-            if layer_types != {\"linear_attention\"} or not patch_tree_gdn(model):\n+            # Qwen4-Exp's indexed attention and n-gram embedding read across tokens too: patched for that model only\n+            supported = (\n+                {\"linear_attention\", \"indexed_attention\"} if patch_tree_qwen4_exp(model) else {\"linear_attention\"}\n+            )\n+            if not layer_types <= supported or not patch_tree_gdn(model):\n                 raise ValueError(\n                     f\"{type(model).__name__} has {sorted(layer_types)} layers. Tree packing routes attention and \"\n-                    \"transformers' gated DeltaNet layers along each sample's own path; any other recurrent or \"\n-                    \"convolutional layer would scan across samples.\"\n+                    \"transformers' gated DeltaNet layers and Inkling 2 Loop's hybrid layers along each sample's own \"\n+                    \"path; any other recurrent or convolutional layer would scan across samples.\"\n                 )\n         if any(name.endswith(\".sinks\") for name, _ in model.named_parameters()):\n             raise ValueError(\n@@ -1247,7 +1291,7 @@ class AsyncGRPOTrainer(_BaseTrainer):\n         # Adapter-only vLLM sync is derived from a PEFT model plus a server started with `--enable-lora`, rather\n         # than configured. Rank 0 probes and broadcasts the answer below.\n         self._lora_sync = False\n-        self._lora_name = \"trl-policy\"\n+        self._lora_name = self.args.vllm_lora_name\n         # Absolute: the path is resolved by the *server's* process, which has its own working directory and may not\n         # be on this machine. vLLM reads a path it cannot resolve as a Hub repo id, failing deep inside the engine.\n         self._lora_dir = os.path.abspath(os.path.join(self.args.output_dir, \".vllm_lora\"))\n@@ -1457,8 +1501,9 @@ class AsyncGRPOTrainer(_BaseTrainer):\n             **router_kwargs,\n             **unpad_tree(inputs),\n         )\n-        log_probs = outputs.log_probs.flatten()[token_index]\n-        entropy = outputs.entropy.flatten()[token_index]\n+        # With a model split over GPUs (`device_map`), the outputs are on the last GPU and the inputs on the first\n+        log_probs = outputs.log_probs.flatten().to(token_index.device)[token_index]\n+        entropy = outputs.entropy.flatten().to(token_index.device)[token_index]\n         self._last_forward_time_s = time.time() - forward_start\n \n         log_ratio = log_probs - old_log_probs\n@@ -1467,7 +1512,7 @@ class AsyncGRPOTrainer(_BaseTrainer):\n         is_masked = (coef_1 < low) | (coef_1 > high)\n         if self.args.score_centering:\n             # Score centering: https://huggingface.co/papers/2609.20807, Appendix A.2\n-            score_log_probs = outputs.score_log_probs[0][token_index]\n+            score_log_probs = outputs.score_log_probs[0].to(token_index.device)[token_index]\n             sampler_log_probs = inputs[\"sampler_log_probs\"][mask_bool][token_index]\n             with torch.no_grad():\n                 q = sampler_log_probs.exp()\n@@ -1496,7 +1541,7 @@ class AsyncGRPOTrainer(_BaseTrainer):\n \n         # The policy loss above is scaled for gradient accumulation (HF auto-scaling is off here), so scale aux too\n         if self.aux_loss_enabled:\n-            aux_loss = outputs.aux_loss\n+            aux_loss = outputs.aux_loss.to(loss.device)\n             loss = loss + self.router_aux_loss_coef * aux_loss / self.current_gradient_accumulation_steps\n \n         with torch.no_grad():\n@@ -1799,11 +1844,10 @@ class AsyncGRPOTrainer(_BaseTrainer):\n         # Under DDP `self.model` is the wrapper, which does not expose `save_pretrained`.\n         model = self.accelerator.unwrap_model(self.model)\n \n-        logger.info(\"Weight sync: pausing vLLM...\")\n-        if self.accelerator.is_main_process:\n-            self.vllm_client.pause()\n+        # No `/pause`: in-flight requests keep the adapter they named, and pausing would stall every other trainer\n+        # sharing this server.\n         t_pause = time.time()\n-        logger.info(f\"Weight sync: pause took {t_pause - t0:.1f}s, waiting for all ranks...\")\n+        logger.info(\"Weight sync: waiting for all ranks...\")\n \n         self.accelerator.wait_for_everyone()\n         t_barrier = time.time()\n@@ -1816,12 +1860,11 @@ class AsyncGRPOTrainer(_BaseTrainer):\n \n         self.accelerator.wait_for_everyone()\n \n-        logger.info(f\"Weight sync: resuming vLLM... (transfer took {t_transfer - t_barrier:.1f}s)\")\n+        logger.info(f\"Weight sync: loading adapter... (transfer took {t_transfer - t_barrier:.1f}s)\")\n         if self.accelerator.is_main_process:\n             # The adapter has to exist on the server BEFORE the version moves below: the rollout worker derives the\n             # adapter it requests from `model_version`, so bumping first would name one that is not loaded yet.\n             self.vllm_client.load_lora_adapter(f\"{self._lora_name}-v{version}\", adapter_dir)\n-            self.vllm_client.resume()\n             stale_version = version - (self.args.max_staleness + 1)\n             if stale_version > 0:\n                 self.vllm_client.unload_lora_adapter(f\"{self._lora_name}-v{stale_version}\")\ndiff --git a/trl/experimental/async_grpo/async_rollout_worker.py b/trl/experimental/async_grpo/async_rollout_worker.py\nindex 754a02d4..d55e043d 100644\n--- a/trl/experimental/async_grpo/async_rollout_worker.py\n+++ b/trl/experimental/async_grpo/async_rollout_worker.py\n@@ -564,6 +564,9 @@ class AsyncRolloutLoop:\n             max_workers=max(1, config.max_concurrent_rollouts), thread_name_prefix=\"grpo-tool\"\n         )\n \n+        # Starts at the requested concurrency, not at `KV cache tokens / max_model_len`: agent rollouts use a small\n+        # fraction of max_model_len, and growing 25% per turnover of the pool took hours when rollouts last minutes.\n+        # The control loop still cuts it when the server's KV cache fills up.\n         self._kv_cap = config.max_concurrent_rollouts\n         self._total_rollouts = 0\n         self._metrics_poll_s = 5.0\n@@ -667,7 +670,6 @@ class AsyncRolloutLoop:\n         async with aiohttp.ClientSession(connector=connector, timeout=timeout) as session:\n             self.session = session\n             await self._check_sampling_replay()\n-            await self._init_kv_cap()\n             logger.info(\n                 f\"vllm worker started: num_generations={self.config.num_generations}, \"\n                 f\"max_concurrent_rollouts={self.config.max_concurrent_rollouts}, kv_cap={self._kv_cap}, \"\n@@ -694,26 +696,6 @@ class AsyncRolloutLoop:\n         expected_tokens = self._produced_tokens + self._rollouts_unqueued * self._tokens_per_rollout\n         return expected_tokens < self._token_allowance.value\n \n-    async def _init_kv_cap(self) -> None:\n-        \"\"\"Start the cap at `KV cache tokens / max_model_len`: as many requests as fit at full length.\"\"\"\n-        try:\n-            async with self.session.get(f\"{self.vllm_server_url}/metrics\") as response:\n-                response.raise_for_status()\n-                text = await response.text()\n-            async with self.session.get(f\"{self.vllm_server_url}/v1/models\") as response:\n-                response.raise_for_status()\n-                models = await response.json()\n-        except Exception as e:\n-            logger.warning(f\"Could not read the vLLM server's KV capacity, starting at max_concurrent_rollouts: {e!r}\")\n-            return\n-        kv_matches = re.findall(r'^vllm:cache_config_info\\{.*kv_cache_size_tokens=\"(\\d+)\"', text, re.M)\n-        if not kv_matches:\n-            logger.warning(\"`/metrics` has no `kv_cache_size_tokens`, starting at max_concurrent_rollouts\")\n-            return\n-        kv_tokens = sum(map(int, kv_matches))\n-        max_model_len = max(model[\"max_model_len\"] for model in models[\"data\"] if model[\"max_model_len\"])\n-        self._kv_cap = max(1, min(self.config.max_concurrent_rollouts, kv_tokens // max_model_len))\n-\n     async def _control_loop(self, stop_event: asyncio.Event) -> None:\n         \"\"\"Size the KV cap from the vLLM server's load, polled from `/metrics`.\n \ndiff --git a/trl/experimental/async_grpo/openenv_harness.py b/trl/experimental/async_grpo/openenv_harness.py\nindex 1958e09c..f434e4bd 100644\n--- a/trl/experimental/async_grpo/openenv_harness.py\n+++ b/trl/experimental/async_grpo/openenv_harness.py\n@@ -161,6 +161,17 @@ class _HarnessRolloutLoop(AsyncRolloutLoop):\n             if correctness is not None:\n                 self._rates[\"rollout/correctness_mean\"][0] += correctness\n                 self._rates[\"rollout/correctness_mean\"][1] += 1.0\n+                # Tool calls, output tokens and thinking of solved rollouts only: the cost of a solution, unmixed with\n+                # failed attempts\n+                if correctness >= 1.0:\n+                    self._rates[\"rollout/solved_tool_calls_mean\"][0] += sum(metrics[\"tool_calls_by_name\"].values())\n+                    self._rates[\"rollout/solved_tool_calls_mean\"][1] += 1.0\n+                    self._rates[\"rollout/solved_completion_tokens_mean\"][0] += metrics[\"completion_tokens\"]\n+                    self._rates[\"rollout/solved_completion_tokens_mean\"][1] += 1.0\n+                    self._rates[\"rollout/solved_thinking_chars_mean\"][0] += metrics[\"thinking_chars\"]\n+                    self._rates[\"rollout/solved_thinking_chars_mean\"][1] += 1.0\n+            metrics.pop(\"completion_tokens\")\n+            metrics.pop(\"thinking_chars\")\n             for name, count in metrics.pop(\"tool_calls_by_name\").items():\n                 self._counters[f\"tools/{name}/call_count\"] += count\n             for name, count in metrics.pop(\"tool_failures_by_name\").items():\n@@ -302,6 +313,8 @@ class _HarnessRolloutLoop(AsyncRolloutLoop):\n                 tool_calls_by_name=tool_calls_by_name,\n                 tool_failures_by_name=tool_failures_by_name,\n                 tool_latency=tool_latency,\n+                completion_tokens=len(completion_ids),\n+                thinking_chars=_thinking_chars(trace),\n             )\n             if self._rollout_reward_fn is not None and env_reward is not None:\n                 metrics[\"correctness\"] = env_reward\n@@ -400,6 +413,20 @@ def _tool_failures_by_name(entries: list[TraceEntry]) -> dict[str, int]:\n     return failures\n \n \n+def _thinking_chars(entries: list[TraceEntry]) -> int:\n+    \"\"\"Characters of reasoning text over a rollout's captured model calls.\n+\n+    vLLM's reasoning parser returns it apart from the answer, as `reasoning_content` (or `reasoning` in newer versions);\n+    the engine reports no separate token count for it. Calls without a captured response count 0.\n+    \"\"\"\n+    total = 0\n+    for entry in entries:\n+        choices = (entry.get(\"response\") or {}).get(\"choices\") or []\n+        message = choices[0].get(\"message\") or {} if choices else {}\n+        total += len(message.get(\"reasoning_content\") or message.get(\"reasoning\") or \"\")\n+    return total\n+\n+\n def _messages_from_trace(entries: list[TraceEntry]) -> list[Message]:\n     \"\"\"Return the last selected request's messages followed by its assistant reply.\"\"\"\n     if not entries:\ndiff --git a/trl/experimental/async_grpo/packing.py b/trl/experimental/async_grpo/packing.py\nindex 9d5a54b6..e67362ee 100644\n--- a/trl/experimental/async_grpo/packing.py\n+++ b/trl/experimental/async_grpo/packing.py\n@@ -12,6 +12,7 @@\n # See the License for the specific language governing permissions and\n # limitations under the License.\n \n+import copy\n import math\n import sys\n from functools import cache\n@@ -300,13 +301,180 @@ def patch_tree_gdn(model) -> bool:\n     def causal_conv1d_fn(hidden_states, weight, bias=None, activation=None, **kwargs):\n         if \"tree_segment_parents\" not in kwargs:\n             return conv(hidden_states, weight, bias, activation=activation, **kwargs)\n-        return tree_causal_conv1d(hidden_states, weight, bias, activation, kwargs, conv)\n+        # Triton launches on the current device, not the inputs': with a model split over GPUs (`device_map`), a layer\n+        # on another GPU would run on the wrong stream and read inputs not yet written\n+        with torch.cuda.device(hidden_states.device):\n+            return tree_causal_conv1d(hidden_states, weight, bias, activation, kwargs, conv)\n \n     def torch_chunk_gated_delta_rule(query, key, value, g, beta, use_qk_l2norm_in_kernel=False, **kwargs):\n         if \"tree_segment_parents\" not in kwargs:\n             return chunk(query, key, value, g=g, beta=beta, use_qk_l2norm_in_kernel=use_qk_l2norm_in_kernel, **kwargs)\n-        return tree_chunk_gated_delta_rule(query, key, value, g, beta, kwargs, use_qk_l2norm_in_kernel), None\n+        with torch.cuda.device(query.device):\n+            return tree_chunk_gated_delta_rule(query, key, value, g, beta, kwargs, use_qk_l2norm_in_kernel), None\n \n     modeling.causal_conv1d_fn, modeling.torch_chunk_gated_delta_rule = causal_conv1d_fn, torch_chunk_gated_delta_rule\n     _PATCHED.add(modeling)\n     return True\n+\n+\n+_PATCHED_QWEN4_EXP = set()\n+\n+\n+def patch_tree_qwen4_exp(model) -> bool:\n+    \"\"\"\n+    Make Qwen4-Exp's indexed attention and per-layer n-gram embedding (PLE) follow the tree of a tree-packed forward.\n+\n+    Both read across tokens outside the attention interface and the gated DeltaNet functions [`patch_tree_gdn`] wraps:\n+    the indexer picks each query's key blocks among all the tokens it sees, and PLE hashes each token with the ones\n+    before it and runs a dilated convolution over them. Given the tree of [`~packing.TreeRow.pack`], the attention and\n+    PLE forwards follow it (see `tree_qwen4_exp`); otherwise they run unchanged.\n+\n+    Returns:\n+        `bool`: whether the model's modeling module is Qwen4-Exp's.\n+    \"\"\"\n+    modeling = sys.modules[type(model).__module__]\n+    names = (\"Qwen4ExpTextAttention\", \"Qwen4ExpTextPLELayer\", \"Qwen4ExpTextDecoderLayer\")\n+    attention, ple, decoder = (vars(modeling).get(name) for name in names)\n+    if attention is None or ple is None or decoder is None:\n+        return False\n+    # accelerate's `device_map` hooks call the forward a module had when the model was dispatched, saved as\n+    # `_old_forward`: point them at the patched one too, or a split model keeps running the reference\n+    for module in model.modules():\n+        if isinstance(module, (attention, ple, decoder)) and \"_old_forward\" in vars(module):\n+            module._old_forward = lambda *args, module=module, **kwargs: type(module).forward(module, *args, **kwargs)\n+    if modeling in _PATCHED_QWEN4_EXP:\n+        return True\n+    from .tree_qwen4_exp import tree_parent_index, tree_ple, tree_qsa_attention\n+\n+    attention_forward, ple_forward, decoder_forward = attention.forward, ple.forward, decoder.forward\n+\n+    def attention_forward_(self, hidden_states, position_embeddings, attention_mask, past_key_values=None, **kwargs):\n+        if \"tree_kv_index\" not in kwargs:\n+            return attention_forward(\n+                self, hidden_states, position_embeddings, attention_mask, past_key_values, **kwargs\n+            )\n+        # On the inputs' GPU: with a model split over GPUs (`device_map`), the current device is another one\n+        with torch.cuda.device(hidden_states.device):\n+            return tree_qsa_attention(\n+                self, hidden_states, position_embeddings, kwargs, modeling.apply_rotary_pos_emb\n+            ), None\n+\n+    # The decoder layer calls PLE without the forward's keyword arguments, so it hands PLE the tree here\n+    def decoder_forward_(self, hidden_states, *args, **kwargs):\n+        if self.ple is not None:\n+            tree = \"tree_segment_parents\" in kwargs\n+            self.ple.tree_parent_index = tree_parent_index(kwargs, hidden_states.shape[1]) if tree else None\n+        return decoder_forward(self, hidden_states, *args, **kwargs)\n+\n+    def ple_forward_(self, hidden_states, input_ids, past_key_values, conv_mask=None):\n+        if self.tree_parent_index is None:\n+            return ple_forward(self, hidden_states, input_ids, past_key_values, conv_mask=conv_mask)\n+        with torch.cuda.device(hidden_states.device):\n+            return tree_ple(self, hidden_states, input_ids, self.tree_parent_index)\n+\n+    attention.forward, decoder.forward, ple.forward = attention_forward_, decoder_forward_, ple_forward_\n+    _PATCHED_QWEN4_EXP.add(modeling)\n+    return True\n+\n+\n+_PATCHED_INKLING2_LOOP = set()\n+_IN_TREE_FORWARD = set()\n+\n+\n+def patch_tree_inkling2_loop(model) -> bool:\n+    \"\"\"\n+    Make Inkling 2 Loop's attention and short convolutions follow the tree of a tree-packed forward.\n+\n+    Its attention adds a learned bias per query-key distance and a sink logit per query, which the FlashAttention\n+    kernel of [`tree_attention`] cannot, and its short convolutions don't pass the forward's keyword arguments to the\n+    functions [`patch_tree_gdn`] wraps. Given the tree of [`~packing.TreeRow.pack`], the attention and both kinds\n+    of short convolution follow it (see `tree_inkling2_loop`); otherwise they run unchanged. The looped\n+    core works position by position and needs nothing, but its attention residuals, which attend over the depth of one\n+    position through the attention interface, are kept on eager attention so they never reach [`tree_attention`].\n+\n+    Returns:\n+        `bool`: whether the model's modeling module is Inkling 2 Loop's.\n+    \"\"\"\n+    modeling = sys.modules[type(model).__module__]\n+    names = (\n+        \"Inkling2LoopSlidingAttention\",\n+        \"Inkling2LoopFullAttention\",\n+        \"Inkling2LoopShortConvolution\",\n+        \"Inkling2LoopDynamicShortConvolution\",\n+        \"Inkling2LoopTextModel\",\n+        \"Inkling2LoopMessageAttentionResidual\",\n+        \"Inkling2LoopBlockAttentionResidual\",\n+    )\n+    classes = [vars(modeling).get(name) for name in names]\n+    if any(cls is None for cls in classes):\n+        return False\n+    sliding, full, short_conv, dynamic_conv, text_model, message_residual, block_residual = classes\n+    # Per model: the residuals get their own config, on eager attention, as the model is switched to tree attention\n+    for module in model.modules():\n+        if isinstance(module, (message_residual, block_residual)):\n+            module.config = copy.copy(module.config)\n+            module.config._attn_implementation = \"eager\"\n+    # accelerate's `device_map` hooks call the forward a module had when the model was dispatched, saved as\n+    # `_old_forward`: point them at the patched one too, or a split model keeps running the reference\n+    patched = (sliding, full, short_conv, dynamic_conv, text_model)\n+    for module in model.modules():\n+        if isinstance(module, patched) and \"_old_forward\" in vars(module):\n+            module._old_forward = lambda *args, module=module, **kwargs: type(module).forward(module, *args, **kwargs)\n+    if modeling in _PATCHED_INKLING2_LOOP:\n+        return True\n+    from .tree_inkling2_loop import (\n+        tree_dynamic_short_convolution,\n+        tree_inkling2_loop_attention,\n+        tree_short_convolution,\n+    )\n+\n+    def follow_tree(cls, tree_forward):\n+        forward = cls.forward\n+\n+        def wrapper(self, *args, **kwargs):\n+            if \"tree_segment_parents\" not in kwargs:\n+                return forward(self, *args, **kwargs)\n+            # On the inputs' GPU: with a model split over GPUs (`device_map`), the current device is another one\n+            with torch.cuda.device(next(t for t in (*args, *kwargs.values()) if isinstance(t, torch.Tensor)).device):\n+                return tree_forward(self, *args, **kwargs)\n+\n+        cls.forward = wrapper\n+\n+    def attention(self, hidden_states, key_hidden_states=None, value_hidden_states=None, conv_mask=None, **kwargs):\n+        for name in (\"attention_mask\", \"relative_distance\", \"cache\", \"cache_offset\"):\n+            kwargs.pop(name, None)\n+        return tree_inkling2_loop_attention(\n+            self, hidden_states, key_hidden_states, value_hidden_states, conv_mask, kwargs\n+        )\n+\n+    for cls in (sliding, full):\n+        follow_tree(cls, attention)\n+    follow_tree(short_conv, lambda self, hidden_states, *args, **kwargs: tree_short_convolution(\n+        self, modeling.causal_conv1d_fn, hidden_states, kwargs\n+    ))  # fmt: skip\n+    follow_tree(dynamic_conv, lambda self, hidden_states, dynamic_input, *args, **kwargs: tree_dynamic_short_convolution(\n+        self, hidden_states, dynamic_input, kwargs\n+    ))  # fmt: skip\n+\n+    # The text model builds dense `(N, N)` relative distances for the reference attention, gigabytes at training lengths.\n+    # The tree attention computes its own from depths, so during a tree-packed forward they are a broadcast placeholder.\n+    get_relative_distance, text_forward = modeling.get_relative_distance, text_model.forward\n+\n+    def relative_distance(inputs_embeds, cache, is_sliding):\n+        if modeling not in _IN_TREE_FORWARD:\n+            return get_relative_distance(inputs_embeds, cache, is_sliding)\n+        n = inputs_embeds.shape[1]\n+        return torch.zeros((), dtype=torch.long, device=inputs_embeds.device).expand(n, n)\n+\n+    def text_model_forward(self, *args, **kwargs):\n+        if \"tree_segment_parents\" not in kwargs:\n+            return text_forward(self, *args, **kwargs)\n+        _IN_TREE_FORWARD.add(modeling)\n+        try:\n+            return text_forward(self, *args, **kwargs)\n+        finally:\n+            _IN_TREE_FORWARD.discard(modeling)\n+\n+    modeling.get_relative_distance, text_model.forward = relative_distance, text_model_forward\n+    _PATCHED_INKLING2_LOOP.add(modeling)\n+    return True\ndiff --git a/trl/trainer/utils.py b/trl/trainer/utils.py\nindex d9613b68..cfbb2b3e 100644\n--- a/trl/trainer/utils.py\n+++ b/trl/trainer/utils.py\n@@ -1759,7 +1759,7 @@ def add_fused_lm_head(\n             else:\n                 # Some models return no router logits, e.g. granite-4.0-h-350m, which has no experts\n                 aux_loss = loss.new_zeros(())\n-            loss = loss + getattr(text_config, \"router_aux_loss_coef\", 0.0) * aux_loss\n+            loss = loss + getattr(text_config, \"router_aux_loss_coef\", 0.0) * aux_loss.to(loss.device)\n \n         return FusedCausalLMOutput(\n             loss=loss,\ndiff --git a/trl/experimental/async_grpo/tree_inkling2_loop.py b/trl/experimental/async_grpo/tree_inkling2_loop.py\nnew file mode 100644\nindex 00000000..802dc240\n--- /dev/null\n+++ b/trl/experimental/async_grpo/tree_inkling2_loop.py\n@@ -0,0 +1,204 @@\n+# Copyright 2020-2026 The HuggingFace Team. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+\"\"\"\n+Inkling 2 Loop's sequence-mixing steps over a tree-packed row, patched in by `patch_tree_inkling2_loop`\n+(`packing.py`).\n+\n+Three steps read across tokens, and each follows transformers' reference (`modeling_inkling2_loop.py`) with a token's\n+past taken along its own path in the tree:\n+\n+- Attention (sliding and full): a learned bias per query-key distance (zero past `rel_extent`), one sink logit per query\n+  and head, and a window for the sliding layers. The reference builds the bias as a dense `(query, key)` matrix from\n+  flat positions; here each segment gathers its root path (`tree_kv_index`, whose index is the depth) and computes the\n+  bias and window from depth differences, chunk by chunk.\n+- Short convolutions (on keys, values and after the attention): their 4 taps run back along the token's path.\n+- Dynamic short convolutions (keys and values of the full layers): the same, with per-token weights.\n+\n+The looped core, its messages and the attention residuals all work position by position, so they need nothing.\n+\"\"\"\n+\n+import math\n+import sys\n+\n+import torch\n+import torch.nn.functional as F\n+from torch.utils.checkpoint import checkpoint\n+\n+from .tree_gated_delta_rule import tree_causal_conv1d\n+\n+\n+# Upper bound on one chunk's `(queries, heads, keys)` attention scores, in elements (256 MB in float32)\n+_MAX_SCORES = 2**26\n+\n+\n+def tree_parent_index(tree, n_tokens):\n+    \"\"\"\n+    Packed position of the token before each one in its samples, `-1` for a first token: the previous position inside a\n+    segment, the end of the parent segment at a segment start.\n+    \"\"\"\n+    cu_seqlens, parents = tree[\"tree_cu_seqlens_q\"].long(), tree[\"tree_segment_parents\"].long()\n+    parent_index = torch.arange(-1, n_tokens - 1, device=cu_seqlens.device)\n+    parent_index[cu_seqlens[:-1]] = torch.where(parents >= 0, cu_seqlens[parents.clamp_min(0) + 1] - 1, -1)\n+    return parent_index\n+\n+\n+def _chunk_attention(module, eager, query, key, value, rel_logits, sinks, first_depth, key_start, window, scaling):\n+    \"\"\"\n+    Queries at depths `first_depth, first_depth + 1, ...` over the keys at depths `key_start, key_start + 1, ...`: a\n+    dense attention over one window, so it runs the model's own `eager_attention_forward` (scores plus relative bias and\n+    mask, softmax with the sink as one extra logit), which keeps the reference's rounding in bfloat16.\n+    \"\"\"\n+    n_queries, n_heads = query.shape[0], query.shape[1]\n+    n_keys = key.shape[0]\n+    distance = (first_depth + torch.arange(n_queries, device=query.device))[:, None] - (\n+        key_start + torch.arange(n_keys, device=query.device)\n+    )[None, :]\n+    rel_extent = rel_logits.shape[-1]\n+    index = distance.clamp(0, rel_extent - 1)[:, None, :].expand(-1, n_heads, -1)\n+    bias = rel_logits.gather(-1, index).to(query.dtype)\n+    bias = bias.masked_fill(((distance < 0) | (distance >= rel_extent))[:, None, :], 0.0)\n+    visible = distance >= 0\n+    if window is not None:\n+        visible = visible & (distance < window)\n+    mask = torch.zeros(visible.shape, dtype=query.dtype, device=query.device)\n+    mask = mask.masked_fill(~visible, torch.finfo(query.dtype).min)\n+\n+    # (tokens, heads, head_dim) -> (1, heads, tokens, head_dim), as the attention interface takes them\n+    out, _ = eager(\n+        module,\n+        query.transpose(0, 1)[None],\n+        key.to(query.dtype).transpose(0, 1)[None],\n+        value.to(query.dtype).transpose(0, 1)[None],\n+        mask[None, None],\n+        scaling=scaling,\n+        position_bias=bias.transpose(0, 1)[None],\n+        sinks=sinks.to(query.dtype).T[None, :, :, None],\n+    )\n+    return out[0]\n+\n+\n+def _segment_attention(module, eager, query, key, value, rel_logits, sinks, path, window, scaling):\n+    \"\"\"\n+    A segment's queries (the last `len(query)` tokens of `path`) over the K/V rows of their path. Checkpointed per chunk\n+    of queries, so the backward holds one chunk's scores at a time.\n+    \"\"\"\n+    n_queries, n_heads = query.shape[0], query.shape[1]\n+    first_depth = len(path) - n_queries\n+    key_start = 0 if window is None else max(0, first_depth - window + 1)\n+    keys = key.index_select(0, path[key_start:])\n+    values = value.index_select(0, path[key_start:])\n+    chunk = max(1, _MAX_SCORES // (n_heads * len(keys)))\n+    outputs = []\n+    for s in range(0, n_queries, chunk):\n+        depth = first_depth + s\n+        # The keys this chunk can see: its window (or all of the path) up to its last query\n+        lo = 0 if window is None else max(0, depth - window + 1) - key_start\n+        hi = min(depth + chunk, len(path)) - key_start\n+        outputs.append(\n+            checkpoint(\n+                _chunk_attention,\n+                module,\n+                eager,\n+                query[s : s + chunk],\n+                keys[lo:hi],\n+                values[lo:hi],\n+                rel_logits[s : s + chunk],\n+                sinks[s : s + chunk],\n+                depth,\n+                key_start + lo,\n+                window,\n+                scaling,\n+                use_reentrant=False,\n+            )\n+        )\n+    return torch.cat(outputs)\n+\n+\n+def tree_inkling2_loop_attention(module, hidden_states, key_hidden_states, value_hidden_states, conv_mask, kwargs):\n+    \"\"\"`Inkling2LoopSlidingAttention.forward` / `Inkling2LoopFullAttention.forward` over a tree-packed row.\"\"\"\n+    position_ids = kwargs[\"position_ids\"]\n+    input_shape = hidden_states.shape[:-1]\n+    key_hidden_states = hidden_states if key_hidden_states is None else key_hidden_states\n+    value_hidden_states = hidden_states if value_hidden_states is None else value_hidden_states\n+\n+    query = module.q_proj(hidden_states, position_ids)\n+    key = module.k_proj(key_hidden_states, conv_mask=conv_mask, **kwargs)\n+    value = module.v_proj(value_hidden_states, conv_mask=conv_mask, **kwargs)\n+    # (1, heads, N, head_dim) -> (N, heads, head_dim). K/V are gathered from float32 copies: `index_select`'s backward\n+    # adds the many queries' contributions to a row atomically, which would lose precision in bfloat16\n+    query = query[0].transpose(0, 1)\n+    key, value = (x[0].transpose(0, 1).float().contiguous() for x in (key, value))\n+\n+    # The bias of each query for every distance, `(N, heads, rel_extent)`, instead of the reference's dense matrix\n+    bias = module.relative_position_bias\n+    relative_states = bias.linear(hidden_states).view(*input_shape, bias.num_heads, -1)\n+    rel_logits = (bias.norm(relative_states, position_ids) @ bias.proj)[0]\n+    sinks = module.sink_proj(hidden_states)[0]\n+\n+    eager = sys.modules[type(module).__module__].eager_attention_forward\n+    cu_q, cu_k = kwargs[\"tree_cu_seqlens_q\"].tolist(), kwargs[\"tree_cu_seqlens_k\"].tolist()\n+    attn_output = torch.cat(\n+        [\n+            _segment_attention(\n+                module,\n+                eager,\n+                query[q_start:q_end],\n+                key,\n+                value,\n+                rel_logits[q_start:q_end],\n+                sinks[q_start:q_end],\n+                kwargs[\"tree_kv_index\"][k_start:k_end],\n+                module.sliding_window,\n+                module.scaling,\n+            )\n+            for q_start, q_end, k_start, k_end in zip(cu_q[:-1], cu_q[1:], cu_k[:-1], cu_k[1:], strict=True)\n+        ]\n+    )\n+    attn_output = attn_output.reshape(*input_shape, -1).contiguous()\n+    return module.o_proj(attn_output, hidden_states), None\n+\n+\n+def tree_short_convolution(module, conv, hidden_states, tree):\n+    \"\"\"`Inkling2LoopShortConvolution.forward` over a tree-packed row, its taps run by TRL's tree convolution.\"\"\"\n+    input_dtype = hidden_states.dtype\n+    hidden_states = hidden_states.float()\n+    residual = hidden_states\n+    weight, bias = module.conv1d.weight.squeeze(1), module.conv1d.bias\n+    hidden_states = tree_causal_conv1d(hidden_states.transpose(1, 2), weight, bias, None, tree, conv).transpose(1, 2)\n+    return ((hidden_states + residual) / math.sqrt(module.conv_kernel_size + 1)).to(input_dtype)\n+\n+\n+def tree_dynamic_short_convolution(module, hidden_states, dynamic_input, tree):\n+    \"\"\"`Inkling2LoopDynamicShortConvolution.forward` over a tree-packed row: each window runs back along the path.\"\"\"\n+    input_dtype = hidden_states.dtype\n+    _, n_tokens, hidden_size = hidden_states.shape\n+    width = module.conv_kernel_size\n+    dynamic_weights = module.weight_proj(dynamic_input).float().view(1, n_tokens, module.num_heads, 1, width)\n+    weights = module.static_weight.float().T.view(module.num_heads, -1, width) + dynamic_weights\n+\n+    hidden_states = hidden_states.float()\n+    residual = hidden_states\n+    # taps[t, lag]: the packed position `lag` steps back along t's path, `-1` past its first token\n+    parent_index = tree_parent_index(tree, n_tokens)\n+    taps, index = [], torch.arange(n_tokens, device=hidden_states.device)\n+    for _ in range(width):\n+        taps.append(index)\n+        index = torch.where(index >= 0, parent_index[index.clamp_min(0)], -1)\n+    taps = torch.stack(taps, dim=1)\n+    rows = F.pad(hidden_states[0], (0, 0, 0, 1))  # a zero row for the taps past a first token\n+    windows = rows[taps.where(taps >= 0, n_tokens)].transpose(1, 2)  # (N, hidden, width)\n+    windows = windows.reshape(1, n_tokens, module.num_heads, -1, width)\n+    hidden_states = (windows * weights).sum(-1).reshape(1, n_tokens, hidden_size)\n+    return ((hidden_states + residual) / math.sqrt(2 * width + 1)).to(input_dtype)\ndiff --git a/trl/experimental/async_grpo/tree_qwen4_exp.py b/trl/experimental/async_grpo/tree_qwen4_exp.py\nnew file mode 100644\nindex 00000000..c9f3e5e2\n--- /dev/null\n+++ b/trl/experimental/async_grpo/tree_qwen4_exp.py\n@@ -0,0 +1,229 @@\n+# Copyright 2020-2026 The HuggingFace Team. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+\"\"\"\n+Qwen4-Exp's indexed attention (QSA) and per-layer n-gram embedding (PLE) over a tree-packed row, patched in by\n+[`~packing.patch_tree_qwen4_exp`].\n+\n+Both follow transformers' reference implementation (`modeling_qwen4_exp.py`), which loops over every query position and\n+reads the tokens before each one from the flat row. Here a token's past is its path in the tree: the K/V rows tree\n+attention gathers for its segment (`tree_kv_index`), and the chain of `tree_parent_index`.\n+\n+QSA: each query sees at most `indexer_budget + compress_ratio - 1` tokens. Its visible tokens are cut into blocks of\n+`compress_ratio` consecutive ones, the indexer scores the blocks it sees whole, the query keeps the `block_topk` best\n+and the 0 to `compress_ratio - 1` tokens after the last whole block, and attends over those alone. The selection carries\n+no gradient, as in the reference (it is a boolean mask there), so it runs under `no_grad`.\n+\"\"\"\n+\n+import math\n+\n+import torch\n+import torch.nn.functional as F\n+from torch.utils.checkpoint import checkpoint\n+\n+\n+# Queries per chunk: bounds the indexer's score matrix and the gathered K/V of the sparse attention\n+_CHUNK = 1024\n+\n+\n+def _select_tokens(indexer, q_index, k_index, cos, sin, path, apply_rotary_pos_emb):\n+    \"\"\"\n+    Packed positions each of a segment's queries attends to, `-1`-padded: its `block_topk` best whole blocks and the\n+    tokens after the last one. `path` is the segment's root-to-end path, the queries are its last `len(q_index)` tokens.\n+    \"\"\"\n+    ratio, n_queries = indexer.compress_ratio, len(q_index)\n+    n_blocks = len(path) // ratio\n+    depths = torch.arange(len(path) - n_queries, len(path), device=path.device)\n+    complete = (depths + 1) // ratio  # whole blocks each query sees\n+    k = min(indexer.block_topk, n_blocks)\n+    if k:\n+        blocks = path[: n_blocks * ratio].view(n_blocks, ratio)\n+        pooled = indexer.k_layernorm(k_index[blocks].float().mean(dim=1).to(k_index.dtype))\n+        starts = blocks[:, 0]\n+        pooled = apply_rotary_pos_emb(pooled.unsqueeze(1), cos=cos[starts], sin=sin[starts]).squeeze(1).float()\n+        selected = []\n+        for start in range(0, n_queries, _CHUNK):\n+            q = q_index[start : start + _CHUNK].float()\n+            scores = torch.relu(torch.einsum(\"qhd,bd->qhb\", q, pooled)).sum(dim=1) / math.sqrt(indexer.index_head_dim)\n+            visible = torch.arange(n_blocks, device=path.device) < complete[start : start + _CHUNK, None]\n+            top = scores.masked_fill(~visible, -math.inf).topk(k, dim=-1)\n+            tokens = torch.where(torch.isfinite(top.values)[..., None], blocks[top.indices], -1)\n+            selected.append(tokens.flatten(1))\n+        selected = torch.cat(selected)\n+    else:\n+        selected = path.new_empty((n_queries, 0))\n+    tail_depths = (complete * ratio)[:, None] + torch.arange(ratio - 1, device=path.device)\n+    tail = torch.where(tail_depths <= depths[:, None], path[tail_depths.clamp_max(len(path) - 1)], -1)\n+    return torch.cat([selected, tail], dim=1)\n+\n+\n+def _sparse_attention(query, key, value, selected, scaling):\n+    \"\"\"\n+    Each query attends over its own selected K/V rows. Grouped by K/V head, so a group's query heads share the\n+    gathered rows instead of repeating them, and checkpointed per chunk, so the backward holds one chunk's rows at a\n+    time.\n+\n+    The rows are gathered with `index_select` from a float32 copy of K/V: each row is selected by up to `budget`\n+    queries, and the backward of advanced indexing (`key[index]`) sums those duplicates by sorting every index, which\n+    took 97% of the layer's forward + backward. `index_select`'s backward adds them atomically instead, in float32 so\n+    that thousands of contributions per row keep their precision. The copy is small: K/V have few heads.\n+    \"\"\"\n+    n_kv_heads, head_dim = key.shape[1], key.shape[2]\n+    key, value = key.float().contiguous(), value.float().contiguous()\n+\n+    def chunk(query, key, value, selected):\n+        rows = selected.clamp_min(0).flatten()\n+        shape = (*selected.shape, n_kv_heads, head_dim)\n+        out = F.scaled_dot_product_attention(\n+            query.reshape(len(query), n_kv_heads, -1, head_dim),\n+            key.index_select(0, rows).view(shape).to(query.dtype).transpose(1, 2),\n+            value.index_select(0, rows).view(shape).to(query.dtype).transpose(1, 2),\n+            attn_mask=(selected >= 0)[:, None, None, :],\n+            scale=scaling,\n+        )\n+        return out.reshape(len(query), -1, head_dim)\n+\n+    return torch.cat(\n+        [\n+            checkpoint(chunk, query[s : s + _CHUNK], key, value, selected[s : s + _CHUNK], use_reentrant=False)\n+            for s in range(0, len(query), _CHUNK)\n+        ]\n+    )\n+\n+\n+def tree_qsa_attention(module, hidden_states, position_embeddings, tree, apply_rotary_pos_emb):\n+    \"\"\"`Qwen4ExpTextAttention.forward` over a tree-packed row: the projections as in the reference, then QSA per\n+    segment.\"\"\"\n+    input_shape = hidden_states.shape[:-1]\n+    hidden_shape = (*input_shape, -1, module.head_dim)\n+\n+    query_states, gate = torch.chunk(\n+        module.q_proj(hidden_states).view(*input_shape, -1, module.head_dim * 2), 2, dim=-1\n+    )\n+    gate = gate.reshape(*input_shape, -1)\n+\n+    query_states = module.q_norm(query_states.view(hidden_shape)).transpose(1, 2)\n+    key_states = module.k_norm(module.k_proj(hidden_states).view(hidden_shape)).transpose(1, 2)\n+    value_states = module.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)\n+\n+    cos, sin = position_embeddings\n+    query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)\n+    # (1, heads, N, head_dim) -> (N, heads, head_dim)\n+    query, key, value = (x[0].transpose(0, 1) for x in (query_states, key_states, value_states))\n+    cos, sin = cos[0], sin[0]\n+\n+    indexer = module.indexer\n+    with torch.no_grad():\n+        q_index, k_index = torch.split(\n+            indexer.index_qk_proj(hidden_states[0]),\n+            [indexer.index_n_heads * indexer.index_head_dim, indexer.index_kv_heads * indexer.index_head_dim],\n+            dim=-1,\n+        )\n+        q_index = indexer.q_layernorm(q_index.view(len(q_index), -1, indexer.index_head_dim))\n+        q_index = apply_rotary_pos_emb(q_index, cos=cos, sin=sin, unsqueeze_dim=1)\n+        k_index = k_index.view(len(k_index), indexer.index_head_dim)  # one indexer K head, as the reference assumes\n+\n+    cu_q, cu_k = tree[\"tree_cu_seqlens_q\"].tolist(), tree[\"tree_cu_seqlens_k\"].tolist()\n+    attn_output = []\n+    for q_start, q_end, k_start, k_end in zip(cu_q[:-1], cu_q[1:], cu_k[:-1], cu_k[1:], strict=True):\n+        path = tree[\"tree_kv_index\"][k_start:k_end]\n+        with torch.no_grad():\n+            selected = _select_tokens(indexer, q_index[q_start:q_end], k_index, cos, sin, path, apply_rotary_pos_emb)\n+        attn_output.append(_sparse_attention(query[q_start:q_end], key, value, selected, module.scaling))\n+\n+    attn_output = torch.cat(attn_output).reshape(*input_shape, -1).contiguous()\n+    attn_output = attn_output * torch.sigmoid(gate)\n+    return module.o_proj(attn_output)\n+\n+\n+def tree_parent_index(tree, n_tokens):\n+    \"\"\"\n+    Packed position of the token before each one in its samples, `-1` for a first token: the previous position inside a\n+    segment, the end of the parent segment at a segment start.\n+    \"\"\"\n+    cu_seqlens, parents = tree[\"tree_cu_seqlens_q\"].long(), tree[\"tree_segment_parents\"].long()\n+    parent_index = torch.arange(-1, n_tokens - 1, device=cu_seqlens.device)\n+    parent_index[cu_seqlens[:-1]] = torch.where(parents >= 0, cu_seqlens[parents.clamp_min(0) + 1] - 1, -1)\n+    return parent_index\n+\n+\n+def _ancestor(parent_index, index):\n+    \"\"\"The packed position before each of `index` in its samples, `-1` past a first token.\"\"\"\n+    return torch.where(index >= 0, parent_index[index.clamp_min(0)], -1)\n+\n+\n+def _tree_ngram_embedding(embedding, input_ids, parent_index):\n+    \"\"\"`Qwen4ExpTextNGramEmbedding.forward` over a tree-packed row: each token's n-gram is read up its path.\"\"\"\n+    tokens, eos = input_ids[0], embedding.eos_token_id\n+    # The token `shift` before each one, or EOS where it is missing or an EOS lies in between, as\n+    # `_shift_right_ignore_eos` does on a flat row\n+    shifted_tokens = [tokens]\n+    index, valid = parent_index, parent_index >= 0\n+    for _ in range(1, embedding.ngram_size):\n+        previous = tokens[index.clamp_min(0)]\n+        valid = valid & (index >= 0)\n+        shifted_tokens.append(torch.where(valid, previous, eos))\n+        valid = valid & (previous != eos)\n+        index = _ancestor(parent_index, index)\n+    shifted_tokens = [t.unsqueeze(0) for t in shifted_tokens]\n+\n+    blocks = []\n+    for ngram in range(2, embedding.ngram_size + 1):\n+        start_idx = (ngram - 2) * embedding.heads_per_ngram\n+        end_idx = start_idx + embedding.heads_per_ngram\n+        mixed_ids = shifted_tokens[0] * embedding.layer_multipliers[0]\n+        for position in range(1, ngram):\n+            mixed_ids = torch.bitwise_xor(\n+                mixed_ids,\n+                shifted_tokens[position] * embedding.layer_multipliers[position],\n+            )\n+        head_vocab_sizes = embedding.ngram_heads_vocab_sizes[start_idx:end_idx]\n+        head_offsets = embedding.ngram_heads_offsets[start_idx:end_idx]\n+        ngram_ids = torch.remainder(mixed_ids.unsqueeze(-1), head_vocab_sizes.view(1, 1, -1))\n+        blocks.append(ngram_ids + head_offsets.view(1, 1, -1))\n+\n+    ngram_ids = torch.cat(blocks, dim=-1)\n+    execution_device = (\n+        embedding.ngram_embedding.weight.device if embedding.ngram_embedding.weight.device.type != \"meta\" else None\n+    )\n+    return embedding.ngram_embedding(ngram_ids.to(execution_device)).to(ngram_ids.device).flatten(-2)\n+\n+\n+def _tree_short_conv(ple, hidden_states, parent_index):\n+    \"\"\"`Qwen4ExpTextPLELayer._short_conv` over a tree-packed row: each tap reads the token `k * dilation` before up the\n+    path, zero past the first token, as the reference's left padding.\"\"\"\n+    weight = ple.conv1d.weight[:, 0]  # (channels, kernel_size), depthwise\n+    kernel_size, dilation = weight.shape[1], ple.conv1d.dilation[0]\n+    hidden_states = hidden_states[0]\n+    out = hidden_states * weight[:, kernel_size - 1]\n+    index = torch.arange(len(hidden_states), device=hidden_states.device)\n+    for tap in range(kernel_size - 2, -1, -1):\n+        for _ in range(dilation):\n+            index = _ancestor(parent_index, index)\n+        out = out + torch.where((index >= 0)[:, None], hidden_states[index.clamp_min(0)], 0) * weight[:, tap]\n+    return F.silu(out).unsqueeze(0)\n+\n+\n+def tree_ple(ple, hidden_states, input_ids, parent_index):\n+    \"\"\"`Qwen4ExpTextPLELayer.forward` over a tree-packed row (no padding, no cache).\"\"\"\n+    embeddings = _tree_ngram_embedding(ple.ple_embedding, input_ids, parent_index)\n+    key_normed = ple.norm_key(ple.key_proj(embeddings)).unflatten(-1, (ple.hc_count, ple.hidden_size))\n+    value = ple.value_proj(embeddings)\n+    query_normed = ple.norm_query(hidden_states).unflatten(-1, (ple.hc_count, ple.hidden_size))\n+    gate = (key_normed * query_normed).sum(dim=-1, keepdim=True) / math.sqrt(ple.hidden_size)\n+    gate = gate.abs().clamp_min(1e-6).sqrt() * gate.sign()\n+    gated_value = torch.sigmoid(gate) * value.unsqueeze(-2)\n+    gated_value_normed = ple.norm_conv(gated_value.flatten(-2))\n+    gated_value = gated_value.flatten(-2)\n+    return gated_value + _tree_short_conv(ple, gated_value_normed, parent_index)\n"
 },
 "other_files": [
  "async_grpo_harbor.py",
  "eval_listener_hf.py",
  "eval_listener_hf.sh",
  "pi_adapted_tasks.txt"
 ],
 "space": "trl-lib/trl-recipes",
 "shared_files": [
  "async_grpo_harbor.py",
  "atif_harbor.py",
  "atif_smoldataenvs.py",
  "atif_traj2envs.py",
  "deepseek_harness.py",
  "eval_sweep.py",
  "evaluate_harbor.py",
  "launcher_eval.py",
  "launcher_train.py",
  "release_adapters.py",
  "slurm_setup.sh"
 ],
 "urls": {
  "html": "https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Inkling-2-Mini/index.html",
  "markdown": "https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Inkling-2-Mini/index.md",
  "json": "https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Inkling-2-Mini/recipe.json",
  "yaml": "https://trl-lib-trl-recipes.static.hf.space/recipes/harness-adapters/Inkling-2-Mini/recipe.yaml",
  "hub_blob_markdown": "https://huggingface.co/spaces/trl-lib/trl-recipes/blob/main/recipes/harness-adapters/Inkling-2-Mini/index.md",
  "hub_raw_markdown": "https://huggingface.co/spaces/trl-lib/trl-recipes/raw/main/recipes/harness-adapters/Inkling-2-Mini/index.md",
  "hub_raw_yaml": "https://huggingface.co/spaces/trl-lib/trl-recipes/raw/main/recipes/harness-adapters/Inkling-2-Mini/recipe.yaml",
  "hub_tree": "https://huggingface.co/spaces/trl-lib/trl-recipes/tree/main/recipes/harness-adapters/Inkling-2-Mini",
  "rel_html": "recipes/harness-adapters/Inkling-2-Mini/index.html",
  "rel_markdown": "recipes/harness-adapters/Inkling-2-Mini/index.md",
  "rel_json": "recipes/harness-adapters/Inkling-2-Mini/recipe.json",
  "rel_yaml": "recipes/harness-adapters/Inkling-2-Mini/recipe.yaml"
 },
 "commands": {
  "train": {
   "hf_jobs": {
    "script": "train_hf_jobs.sh",
    "direct": false,
    "verified": true,
    "hardware": "h200x2 per harness, 32768-token window; b200x4 for PRESET=pi-adapted (65536-token window)",
    "command": "hf download trl-lib/trl-recipes --repo-type space --include \"recipes/harness-adapters/*\" --local-dir trl-recipes\ncd trl-recipes/recipes/harness-adapters/Inkling-2-Mini\nHARNESS=pi \\\nPRESET=effort-none \\\nBUCKET=\"<your user>/<bucket>\" \\\nbash train_hf_jobs.sh"
   }
  },
  "eval": {
   "hf_jobs": {
    "script": "eval_hf_jobs.sh",
    "direct": false,
    "verified": true,
    "hardware": "h200x2 per harness, 32768-token window; b200x4 for PRESET=pi-adapted (65536-token window)",
    "command": "hf download trl-lib/trl-recipes --repo-type space --include \"recipes/harness-adapters/*\" --local-dir trl-recipes\ncd trl-recipes/recipes/harness-adapters/Inkling-2-Mini\nBENCH=tbfull \\\nEFFORT=none \\\nEVALS=pi@pi:base \\\nBUCKET=\"<your user>/<bucket>\" \\\nbash eval_hf_jobs.sh"
   }
  }
 }
}