Qwen3.5-0.8B learns Countdown: reach a target number using each given number exactly
once with + − × ÷. With thinking off, the base model solves 1% of 200 held-out
puzzles. After 80 GRPO steps on one GPU it solves 69.5%. It gets there by learning
to try a combination, compute it and check it before answering.
The environment generates the puzzles, so there is no dataset licence to
consider, and every puzzle is solvable by construction: 3 or 4 numbers, a whole-number
target from 1 to 999. Training and evaluation use different seeds.
Reward: 1 when the expression in <answer>...</answer> uses exactly the given
numbers and equals the target, else 0.
A first run cut answers at 1,024 tokens. It reached 61% and then fell to 48.5%. Long
attempts were cut off before the answer and scored 0, so the model learned that working
things out does not pay. At 1,536 tokens it kept improving to the end.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
tok = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-0.8B")
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-0.8B", torch_dtype="bfloat16")
model = PeftModel.from_pretrained(base, "cetusian/qwen3.5-0.8b-countdown-grpo")
stop = [tok.convert_tokens_to_ids(t) for t in ("<|im_end|>", "<|endoftext|>")]
# model.generate(..., eos_token_id=stop)
Use the system prompt from environments/countdown
and enable_thinking=False. This adapter ends its turn with <|endoftext|>, so stop on
both tokens as above; the Surogate server does that already.
Countdown only. It is a clean test of whether RL can teach a small model to reason,
not a general maths model.
About 30% of puzzles are still wrong, mostly the four-number ones (in the 24-puzzle
check: 11 of 12 three-number puzzles solved, 5 of 12 four-number ones).