Undo-able-4B: a 4B ops agent that doesn't destroy what it wasn't asked to touch

Team lead: @aymuos15 Track: ft-hf · Base model: Qwen/Qwen3-4B-Instruct-2507 · Model: aymous/Undo-able-4B

Agents with shell and database access fail in a familiar way: they finish the task and quietly delete something on the way, or they say "done" when they aren't. We built a Halo environment that scores exactly that, trained a 4B model on two tools in it, and tested it on tools it has never seen.

On 209 unseen-tool and incident scenarios, Safe Success goes from 10.7% to 19.5% (mean of 3 seeds), and unrecoverable data loss drops from 18.0% to 15.3%. The published eval command reproduces it on an H200: 9.6% to 18.2%. That is above Qwen3-235B-A22B (14.4%), a model about 60 times larger, and still well below Claude Sonnet 5.5 (44.0%).

The task

Each episode is a small simulated world: a virtual filesystem with a mini-shell, a SQLite database, a cloud simulator, or a generated command-line tool. The user asks for an ops chore, such as "archive last year's orders" or "free up space in the logs directory". The agent has the tools sh, sql, cloud and ask_user, and ends with a report.

An episode is a Safe Success only if all of these hold:

The grader is deterministic and sees the real state diff, not the transcript. A red team wrote 25 attacks on it, and every one is a regression test.

Data

Everything is generated, and no training data comes from a closed model.

Set Size What it is
SFT 654 rows Base-model rollouts that passed the grader (369), plus scripted reference solutions replayed through the environment (285)
GRPO pool 1,325 items Procedurally generated filesystem and SQL chores, generator seed 4000
Eval: unseen 209 items 101 scenarios on invented command-line tools, plus 108 incident-style scenarios. Written by Claude Code agents for eval only, never trained on
Eval: heldout 200 items Procedural held-out families, cloud, generated CLIs and incident replays
Eval: in_distribution 140 items The train and benign families at a different generator seed

We checked for overlap. No eval item matches a training item, exactly or by n-gram similarity, in unseen or heldout. The in_distribution split reuses the training prompt templates on new worlds, so it measures fit, not transfer. We report it separately and don't use it for the headline.

Training

Both stages ran with Halo:

  1. LoRA SFT (examples/grpo/environmental/undoable/qwen3-4b-undoable-sft-lora.yaml): 2 epochs on one RTX 5090, about 1 s a step. The merged result is aymous/qwen3-4b-undoable-sft-v1-merged.
  2. Environment GRPO (qwen3-4b-undoable-grpo.yaml): Halo's environmental GRPO with async rollouts. 128 episodes a step (16 prompts × 8), LoRA r=32, lr 1e-5. The reward is Safe Success plus shaping terms from the grader: loss, false "done", unreported changes, over-asking, under-asking, partial progress, and doing nothing.

GRPO ran on HF Jobs: one A100 for the trainer and one A100 for the vLLM rollout server, sharing a private network.

The first 125 steps penalised over-asking at 0.1. The policy learned to ask about everything: 39% of episodes that needed no confirmation asked anyway. From step 125 we raised the penalty to 0.4. Over-asking fell to 34% at step 140, and gate Safe Success climbed from 27% to 35% by step 200.

The submitted model is step 220. After about step 237, rollout length grew from about 500 to 3,700 tokens per episode, a sign of GRPO drift, so we stopped at 260 and kept 220. It was the last checkpoint before the drift, with the best unseen score and the lowest loss.

Results

Mean of 3 seeds, temperature 0.6, at most 12 turns, 4,096 tokens per reply. "Loss" is the share of episodes that destroyed something unrecoverable. Lower is better.

Model Unseen SS Unseen loss Held-out SS Held-out loss In-dist. SS In-dist. loss
Qwen3-4B-Instruct-2507 (base) 10.7 ± 1.9 18.0 15.0 18.8 22.1 24.0
+ SFT 9.6 15.2 8.8 18.5 39.8 22.9
Undo-able-4B (SFT + GRPO) 19.5 ± 2.4 15.3 14.7 12.8 63.8 9.3
Qwen3-30B-A3B 10.0 ± 1.2 23.8 14.9 23.1 32.2 28.9
Qwen3-235B-A22B 14.4 ± 1.3 27.6 22.0 24.7 34.0 32.1
Claude Haiku 5.5 36.4 ± 2.5 4.9 53.5 9.3 63.6 11.0
Claude Sonnet 5.5 (1 seed) 44.0 5.7 55.5 7.5 63.6 12.1

What the table shows:

Training curve on the full 340-item gate (in-distribution + held-out):

Step 0 (SFT) 60 120 140 180 200 220 240
Gate SS 21.6 22.0 27.2 30.1 33.4 35.0 34.9 35.3
Gate loss 20.3 16.4 14.1 11.4 12.8 12.8 11.4 11.3
Unseen SS 9.6 12.0 14.5 15.8 17.7 15.9 19.5 18.5

Reproduce

python scripts/environments/inference/eval_undoable.py --dataset aymous/Undo-able-eval --split unseen \
  --backend transformers --model aymous/Undo-able-4B --num_examples 0 --max_tokens 4096 --max_turns 12 \
  --temperature 0.6 --seeds 0 1 2 --max_workers 8 --summary_path runs/undoable-eval/unseen.json

Swap --model Qwen/Qwen3-4B-Instruct-2507 for the base model, or --split heldout for the other set. --backend transformers generates in process. On one H200 it takes 127 minutes for Undo-able-4B and 56 for the base model, and scores 18.2% and 9.6% (loss 15.5% and 17.9%). The tables above were measured through a vLLM server (pass --base_url instead), which gave 19.5% and 10.7%. Keep --max_workers at 8: at 32 the batch runs out of memory.

Training: - SFT: torchrun --nproc_per_node=1 scripts/training/sft.py examples/grpo/environmental/undoable/qwen3-4b-undoable-sft-lora.yaml - GRPO: examples/grpo/environmental/undoable/hf-jobs/ has the trainer and rollout-server scripts we ran. - New items: python scripts/environments/preparation/make_undoable_items.py

Code: branch ft-undoable of aymuos15/halo.

Limits

Third-party materials

Platforms used

Platform What ran there How much
HuggingFace Jobs GRPO: an A100 trainer plus an A100 vLLM rollout server; pilots; adapter merges about 85 A100-hours, from hackathon credit
HuggingFace Hub Model, datasets, checkpoint bucket, this Space
Our own machines SFT and all evals: RTX 5090, RTX 4090
OpenRouter Qwen3-30B and Qwen3-235B baselines 2 models × 549 items × 3 seeds
Anthropic API Claude Haiku and Sonnet baselines; a judge audit of the rule grader eval only

Agents

Built with Claude Code (Claude Opus 5.5). Subagents wrote the eval scenarios, reviewed the code and red-teamed the grader. The session logs are attached as trajectories, with personal data and secrets removed.