reinforced-qwen-grpo

Training Qwen3.5-4B with reinforcement learning on verifiable data analysis tasks.

What I built

Can you make a 4-billion-parameter model comparable to a 27-billion-parameter model using RL? RL environments keep coming up in recent model releases. They give models tasks to practice and a way to check their answers. Xiaomi released thousands of open RL environments with MiMo-V2.6, and Hugging Face’s FineEnvs project includes environments for small models. I wanted to explore one simple question: can you use these open environments on your own hardware to make a small model better?

I used SmolDataEnvs, a collection of verifiable data analysis tasks built around real Kaggle datasets. The model gets a file and a question, investigates through a terminal, and saves its answer. I added a local sandbox and a stricter checker, then trained Qwen3.5-4B with rank-64 LoRA adapters on an AMD Instinct MI300X.

A video game sales dataset and a question asking which publisher has the highest total sales.
A real file, a question, and an answer the environment can check. Click any image to enlarge it.

How it works

The original checker could accept “42, yes” when the expected answer was “42.” I wrote a stricter checker that requires a bare numeric answer for numeric tasks, and used it as the training reward.

I used TRL’s GRPO trainer to update the model from the environment’s rewards. For each task, the model makes eight attempts. The checker rewards a correct answer with 1 and an incorrect answer with 0. Training reinforces attempts that beat their group’s average reward.

Groups where every attempt succeeds or fails offer no relative reward signal. I screened about 1,000 tasks and kept 240 with mixed success. These gave the model useful opportunities to practice.

Eight attempts at the same task receive correct or incorrect rewards for group-relative reinforcement learning.
Eight attempts at one task supply the comparison GRPO learns from.

What happened

Compare evaluation results

Across the full exam, RL improved the score from 51.8% to 58.4%. Follow-up runs with more RL and teacher distillation stayed around 58%. The 27B-FP8 reference scored 64.0%.

Reported strict accuracy on all 394 tasks: base 4B 51.8%, RL 58.4%, more RL 58.1%, distilled 58.1%, distillation plus RL 58.6%, and 27B 64.0%.
Strict pass@1 with greedy decoding on all 394 held-out tasks. The exam was reused across checkpoints.

On tasks from datasets absent from training, the reported score rose from 52.9% to 62.1% after teacher distillation followed by RL. The 27B-FP8 reference scored 64.4% on this same subset.

Reported strict accuracy on 87 unseen-dataset tasks: base 4B 52.9%, RL 58.6%, more RL 54.0%, distilled 57.5%, distillation plus RL 62.1%, and 27B 64.4%.
Strict pass@1 with greedy decoding on the 87-task unseen-dataset subset of the 394-task exam. The exam was reused across checkpoints.

In the initial RL comparison, episodes ending without an answer fell from 99 to 72. The overall scores plateaued, while distillation followed by RL gave the strongest reported result on unseen datasets.