Training
Table with columns: Setting, Value| Setting | Value |
|---|
| Base model | Qwen/Qwen3-4B-Base |
| Training data | 3,200 examples from the GSM8K train split |
| On-policy rollouts | 12,800 |
| GRPO group size | 4 |
| LoRA | rank 16, alpha 32, dropout 0, all linear layers |
| Reward | Binary exact match on the final numeric answer |
| Learned reward model | None |
| Learning rate | 1e-5 with linear decay |
| Precision | BF16 |
| Selected checkpoint | Step 350, selected on a fixed validation split |
| Training seed | 42 |
| Hardware | One NVIDIA RTX 5090 32 GB |
The policy was trained for one epoch. The selected run used TRL 0.24.0,
PEFT 0.17.1, Transformers 4.56.2, and vLLM 0.10.2.
Evaluation
Base and adapter evaluations used identical prompts, answer parsing,
temperature, token budgets, and decoding seeds (42, 43, and 44).
Table with columns: Benchmark, Base, LoRA-GRPO, Absolute gain| Benchmark | Base | LoRA-GRPO | Absolute gain |
|---|
| GSM8K official test (1,319 examples) | 84.69% | 88.91% | +4.22 pp |
| SVAMP OOD (1,000 examples) | 84.93% | 88.90% | +3.97 pp |
On GSM8K, the relative error reduction was 27.56%. Each paired decoding-seed
comparison had a bootstrap 95% confidence interval above zero and an exact
McNemar p-value below 0.001. SVAMP was not used for training or checkpoint
selection, and all three decoding seeds improved.
The reported seeds are decoding seeds, not independent training runs. Only one
GRPO training seed was run.
Usage
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model_id = "Qwen/Qwen3-4B-Base"
adapter_id = "Terve0916/Qwen3-4B-Base-GRPO-GSM8K-LoRA"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
The training prompt asks the model to place its reasoning inside <think> tags
and its final numeric answer inside <answer> tags. Use the same prompting
protocol for results comparable to those reported above.
Reproducibility
Training code, configurations, data construction, evaluation scripts, and
paired statistical analysis are available at
sheihui/qwen3-4b-lora-grpo.
Limitations
- Only one GRPO training seed was evaluated.
- GSM8K and SVAMP are both elementary arithmetic word-problem datasets.
- These results do not establish generalization to competition mathematics,
coding, or general reasoning.
- The pretraining data of the base model cannot be fully audited and may contain
GSM8K or related examples.