Skip to content

A-03 Solver

Open source, Apache-2.0

69.5% of 200 held-out puzzles solved, up from 1.0%

reasoningarithmeticshows its workpuzzles

A 0.8B model is given a handful of numbers and a target, and must reach it using each number once. Thinking mode is off, so every step of its reasoning has to be written into the answer.

It started at 1%. Eighty steps of reinforcement learning on one GPU took it to 69.5%, with no worked examples. The only signal was whether the final expression hit the target.

The weights are a LoRA adapter on top of Qwen/Qwen3.5-0.8B. Load both with transformers and peft.

  1. Install

    Terminal window
    pip install -U transformers peft accelerate
  2. Load and ask

    run.py
    from transformers import AutoModelForCausalLM, AutoTokenizer
    from peft import PeftModel
    base = "Qwen/Qwen3.5-0.8B"
    tok = AutoTokenizer.from_pretrained(base)
    model = AutoModelForCausalLM.from_pretrained(base, torch_dtype="auto", device_map="auto")
    model = PeftModel.from_pretrained(model, "superbird-labs/a-03-solver")
    SYSTEM = open("system_prompt.txt").read() # the prompt below
    messages = [{"role": "system", "content": SYSTEM},
    {"role": "user", "content": "your input here"}]
    ids = tok.apply_chat_template(messages, add_generation_prompt=True,
    enable_thinking=False, return_tensors="pt").to(model.device)
    out = model.generate(ids, max_new_tokens=512, do_sample=False)
    print(tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True))

Trained with this exact system prompt. Use it word for word: small models are picky about their instructions.

system prompt
Reach the target number using each given number exactly once, with + - * / and parentheses. Work it out step by step: try a combination, compute it, and check it before moving on. Keep it short. End with only the expression inside <answer></answer>, e.g. <answer>(3 + 5) * 2</answer>.
a real test input
Numbers: 9, 21, 37
Target: 444
shape of the answer
37 × 12 = 444, and 21 − 9 = 12
<answer>37 * (21 - 9)</answer>

Real cases from the held-out set, never seen in training.

Make 444 from 9, 21 and 37
Numbers: 9, 21, 37
Target: 444
✕ Before training
(21 − 37) + 9 = −16

Gives −16. The target was 444.

✓ After training, A-03
444 is 37 × 12. Can 9 and 21 make 12?
21 − 9 = 12
37 × (21 − 9) = 444

Works backwards from the target, then checks the answer.

Make 594 from 6, 9 and 11
Numbers: 6, 9, 11
Target: 594
✕ Before training
(9 × 6) + 11 × 11

That is 175, and it uses 11 twice.

✓ After training, A-03
11 × 9 = 99
99 + 6 = 105, too small
99 × 6 = 594
(11 × 9) × 6

Tries, rejects, and lands on 594 with each number once.

Make 252 from 2, 8, 20 and 31
Numbers: 2, 8, 20, 31
Target: 252
✕ Before training
(20 + 31) × 2 − 8

That is 94.

✓ After training, A-03
31 − 2 = 29
29 × 8 = 232
232 + 20 = 252
(31 − 2) × 8 + 20

252, with all four numbers used once.

Base model Qwen/Qwen3.5-0.8B
Method GRPO with LoRA on the Surogate engine
Steps 80
Batch 16 puzzles × 8 tries each
Answer length up to 1,536 tokens
Hardware one 48 GB L40S
Time 67 minutes

Puzzles generated on the fly: 3 or 4 numbers and a target from 1 to 999. Training and test use different seeds, so there is no dataset to license.

1 when the expression in <answer> uses exactly the given numbers and equals the target.

Trained with the open-source Surogate engine (1.5.17 or later), kit countdown. Full kit notes: Surogate countdown kit.

Terminal window
CUDA_VISIBLE_DEVICES=0 surogate grpo-colocate \
--train examples/kits/countdown/train.yaml \
--infer examples/kits/countdown/infer.yaml \
--orch examples/kits/countdown/orch.yaml

The held-out score shows in the log as Avg@1= and the adapter lands in outputs/kits/countdown/. To point it at your data, read Retrain on your data.

1.0%base
61.5%step 20
54.0%step 40
62.0%step 60
69.5%step 80

Puzzles solved out of 200 held out. A 1,024-token cap made training collapse; 1,536 fixed it. One run, one seed.

  • The token budget acts as the curriculum. With answers capped at 1,024 tokens it reached 61%, then fell to 48.5%: long, careful attempts were cut off and scored zero, so it learned that reasoning did not pay. At 1,536 tokens it kept improving.
  • A clear demonstration of RL. From 1% to 69.5% on one GPU in about an hour: a compact way to see reinforcement learning teach a small model to reason.
  • A puzzle tutor. It writes every step, so a learner can follow its working and catch its mistakes.
  • A test bed for RL research. Change the reward, the budget or the schedule and measure what changes.

Open small models for every industry, free to run offline. Custom ones for companies.

superbirdlabs.com Custom models Hugging Face hello@superbirdlabs.com