---
id: openenv-coding-tasks/Qwen3.8-27B
title: RL Environment Pipeline
type: guide
project: openenv-coding-tasks
model_id: Qwen/Qwen3.8-27B
trainers:
- AsyncGRPOTrainer
tags:
- RL Environment Pipeline
- OpenEnv
- task preparation
url: https://trl-lib-trl-recipes.static.hf.space/guides/openenv-coding-tasks/index.html
markdown_url: https://trl-lib-trl-recipes.static.hf.space/guides/openenv-coding-tasks/index.md
json_url: https://trl-lib-trl-recipes.static.hf.space/guides/openenv-coding-tasks/recipe.json
hub_tree: https://huggingface.co/spaces/trl-lib/trl-recipes/tree/main/guides/openenv-coding-tasks
---

# RL Environment Pipeline (`Qwen/Qwen3.8-27B`)

Build verifiable coding tasks and select examples that give the base model a mix of successful and unsuccessful rollouts.

## Summary & Links

- **Recipe ID:** `openenv-coding-tasks/Qwen3.8-27B`
- **Model:** [Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B)
- **Trainers:** `AsyncGRPOTrainer`
- **Interactive guide:** https://trl-lib-trl-recipes.static.hf.space/guides/openenv-coding-tasks/index.html
- **Manifest JSON:** https://trl-lib-trl-recipes.static.hf.space/guides/openenv-coding-tasks/recipe.json

Prepare verifiable coding tasks for TRL’s `AsyncGRPOTrainer` with OpenEnv. Before training on a task, confirm two things: the verifier separates valid fixes from broken checkouts, and the base model gets a mix of passes and failures so GRPO has learning signal.

- **Local (CPU, no sign-in):** Reproduce the 177-task shortlist from the [pinned dataset revision](https://huggingface.co/datasets/harness-hub/harness-adapters/tree/5d320e93b7832c6c66e6a5acd8403fb1a3c50bc6) and inspect verifier evidence on a worked example (Squirrel, a Go query builder with a mutated `UPDATE` subquery).
- **Optional (HF Jobs):** Re-run native `openenv validate` checks in a cloud sandbox.

## 1. Collect and screen candidate tasks

Build a task pool from existing benchmarks and targeted synthetic generation, then filter out invalid tasks, duplicates, and evaluation overlap.

- **Hub tasks (847 accepted):** 490 Python and 227 Go tasks from SWE-smith (bugs injected into working repos) plus 130 SWE-Gym issue repairs from TaskTrove, screened for training eligibility, duplicates, repository caps, and eval-repo overlap.
- **Tasksmith tasks (24 accepted):** Generated from merged pull requests covering skills underrepresented in the Hub pool (filesystem operations, HTTP streaming, serialization). Tests are checked against four controls: the reference fix, a second valid solution, the unfixed code, and a known-wrong change.

Note: Repository caps and eval-repo exclusions applied to the Hub selection only. Three Tasksmith tasks share the `cattrs` repository with DeepSWE; exclude them if you evaluate on DeepSWE.

### How two collection paths produced 871 tasks

### Hub candidates

Of **1,127** SWE-smith and SWE-Gym candidates, **858** passed validation. The repository cap left **847**.

### Tasksmith generation

From **30** selected pull requests, Tasksmith produced **24** accepted tasks across **10** Python repositories.

**847 + 24 = 871 tasks** in `final_v1`. Of these, 463 had complete base-model scores. The 177 with both successful and failed attempts form `final_best_v1`.

## 2. Reproduce the shortlist locally

Download [prepare.py](https://trl-lib-trl-recipes.static.hf.space/guides/openenv-coding-tasks/prepare.py) into a fresh directory and run it with Python 3.12. It verifies the published 177-task shortlist against the pinned JSONL files and downloads the Squirrel example into `squirrel-task/`.

```sh
python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install huggingface_hub
python prepare.py
```

Expected output:

```text
871 tasks, 463 scored, 177 with mixed rewards
Squirrel: 1 solved in 4 attempts
```

## 3. Check verifier quality

Inspect the downloaded task directory before admitting it to training:

- `squirrel-task/instruction.md`: issue prompt shown to the agent
- `squirrel-task/solution/solve.sh`: reference repair
- `squirrel-task/tests/`: frozen Go tests restored at grading time
- `squirrel-task/validation/canaries/`: deliberately broken or cheated submissions

`prepare.py` prints the per-trial rewards from the published batch validation gate:

| Trial | Reward | What it tests |
| --- | --- | --- |
| Reference repair | 1 | The intended repair can earn full credit. |
| Reference replay | 1 | A second trial gives the same score. |
| No edit | 0 | Leaving the bug in place loses credit. |
| Original bug, deleted tests, stale reward | 0 each | These three submissions cannot collect credit. |

These controls verify that an unchanged checkout fails and that tampering with tests or reward files cannot collect credit. They do not test a plausible partial repair, such as fixing subqueries while breaking other SQL expressions. Add domain-specific partial-fix canaries when authoring new tasks.

### Optional: re-run validation on Hugging Face Jobs

`prepare.py` pins `squirrel-task/task.toml` to the separately published Linux task image. To run fresh native checks (starts billable sandbox trials), sign in with a Jobs-enabled Hugging Face account and run:

```sh
python -m pip install "openenv[harbor] @ git+https://github.com/openenv/OpenEnv@ebc8ac878fbe731332ec468100300b92fe750a21"
hf auth login
openenv validate squirrel-task --sandbox hf-sandbox
```

The recorded native run passed manifest, startup, reward format, oracle, replay, floor-gap, and canary checks. It returned **WARN** because optional checks, including solution leakage, were skipped.

## 4. Filter tasks by base-model difficulty

A passing reference repair proves a task is solvable, not that it is useful for RL. With binary rewards, GRPO needs rollout groups containing both passes and failures to compute non-zero advantages, so drop tasks the base model solves every time or never solves.

- **Scoring protocol:** Run Qwen3.8-27B on the broken checkout with oracle and grading assets withheld (temperature `0.7`, thinking disabled, up to 48 turns and 1,800 s per attempt, 4 or 8 valid attempts per task). Hub tasks used the pipeline’s tool-calling agent; Tasksmith used Harbor’s `terminus-2` agent. Provider or sandbox errors leave a task incomplete.
- **Results at this revision:** Across 463 scored tasks (408 lack complete scores), 123 had zero solves, 163 were always solved, and **177 had mixed outcomes** (including Squirrel at 1 of 4).

### How often did Qwen3.8-27B solve each source’s tasks?

Each bar covers the scored tasks in one source. SWE-Gym had mixed outcomes on 27 of 37 tasks (73%). The blog figure covers 442 Hub tasks. This dataset revision also includes 21 scored Tasksmith tasks, six with mixed outcomes. [Source rows](https://huggingface.co/datasets/harness-hub/harness-adapters/blob/5d320e93b7832c6c66e6a5acd8403fb1a3c50bc6/views/final_v1/train.jsonl)

| Source | Scored tasks | Outcomes |
|---|---|---|
| SWE-smith Python | 278 scored tasks | 100 never · 100 sometimes · 78 always |
| SWE-smith Go | 127 scored tasks | 15 never · 44 sometimes · 68 always |
| SWE-Gym | 37 scored tasks | 5 never · 27 sometimes · 5 always |
| Tasksmith | 21 scored tasks | 3 never · 6 sometimes · 12 always |

Reproduce the shortlist by keeping scored tasks with both passes and failures:

```python
scored = [r for r in tasks if r["qwen_status"] == "scored"]
mixed = [r for r in scored if 0 < r["qwen_solved"] < r["qwen_valid_attempts"]]
```

- **Re-score when setup changes:** Four attempts give a noisy estimate of pass rate. Repeat difficulty scoring if you change the base model, tool harness, or generation budget.
- **Audit status:** This filter checks difficulty only. Published rows still mark training admission as `false`, and corpus-wide leakage and alternative-solution audits remain open.

## 5. Run rollouts and capture training traces

When wiring shortlisted tasks into a TRL training loop:

1. Sample a shortlisted task and start each rollout in a fresh sandbox workspace.
2. Expose only the task instruction and broken source; keep the reference fix, grader, and expected rewards out of model context.
3. Grade the finished edit with the trusted verifier, pass the scalar reward to the trainer, and log infrastructure failures separately rather than as zero-reward trajectories.

## From a validated task to a training rollout

After admission, Harbor runs the task in the selected agent harness and the verifier grades the submission. OpenEnv records the model calls. The example below shows which evidence is available for a scored evaluation or an online RL sample. [Read the capture requirements](https://github.com/openenv/OpenEnv/blob/f7acf879c2cd7d2cb90aea27fc31ae3220dd9a50/docs/source/guides/harbor-provider-qualification.md#evaluation-and-training-capture).

Flow: Pinned Harbor task → Harness in sandbox → Model via capture proxy

### Verifier

Reward 1

Submission passes the tests.

Evaluation evidence **Graded success**

### Capture proxy

Training capture verified

Engine token IDs and sampled log probabilities.

Online RL export · requires both lanes **Trace eligible for training**

A valid verifier reward can be used in evaluation. Online RL export also requires a verified training capture.

## Results: short-run training ablation

To measure the effect of validation and difficulty filtering, we trained four Qwen3.8-27B LoRA adapters with TRL’s `AsyncGRPOTrainer`, varying only how tasks were selected. Each run used 32 tasks, the `opencode` harness (up to 48 model calls per attempt), binary verifier rewards, and one 8× H200 job.

### Verifier pass rate on each run’s own training tasks

| Run and task selection | First five steps | Last five steps* | Checkpoint step |
| --- | --- | --- | --- |
| Unvalidated — 24 accepted, 8 rejected by the gate | 63.8% | 67.1% | 40 |
| Validated — 32 accepted, sampled without difficulty labels | 56.2% | 70.4% | 50 |
| Unqualified — 32 accepted, all or zero attempts solved | 60.2% | 63.1% | 25 |
| Qualified — 32 accepted, some attempts solved | 62.4% | 81.2% | 50 |

*The last window ends at the listed checkpoint. The unvalidated and unqualified runs timed out at steps 48 and 26. Comparing the two step-50 checkpoints, training reward rose by 18.8 percentage points on the qualified set and 14.2 points on the validated set. Measuring transfer to Terminal-Bench 2.1 requires a separate held-out evaluation.
