CoolFace
Modelpublic

jaygala24/Qwen2.5-0.5B-GRPO-math-reasoning

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes20downloads
Model Card

Qwen2.5-0.5B-GRPO-math-reasoning

This model is a fine-tuned version of Qwen2.5-0.5B using GRPO (Group Relative Policy Optimization) without KL penalty for mathematical reasoning.

Trained with PipelineRL.

Training Details

Datasets

SplitDatasets
Traingsm8k_train, math_train
Testgsm8k_test, math_500

RL Algorithm

ParameterValue
AlgorithmGRPO (Group Relative Policy Optimization)
Advantage BaselineGroup mean reward
Extra InferenceNone
Group StructureRequired
Policy Lossppo
KL Coefficient0.0
Epsilon (clip)0.02
Discount Factor (gamma)1.0
Divide Advantage by StdFalse
Filter Zero Advantage GroupsFalse
Rollouts per Problem16

GRPO uses the group mean reward as the baseline for relative advantages.

Training Hyperparameters

ParameterValue
Base ModelQwen/Qwen2.5-0.5B
Learning Rate1e-06
LR Schedulercosine
Warmup Steps25
Max Training Steps1500
Micro Batch Size8
Gradient Accumulation32
Effective Batch Size256
Sequence Length8192
Gradient Clipping0.3
Weight Decay0.01
Optimizeradamw_torch
Precisionbf16
DeepSpeedZeRO Stage 3

Evaluation Results

Pass@k on math reasoning benchmarks (N=32 samples per problem, temperature=1.0):

Datasetpass@1pass@2pass@4pass@8pass@16pass@32
GSM8K (test)51.7762.2471.1278.6484.8589.76
MATH-50031.1840.4649.6358.3766.2673.00
Overall46.1156.2565.2273.0779.7485.16

GSM8K test: 1319 problems · MATH-500: 500 problems · Overall: 1819 problems (overall weighted by problem count).

Training Curves

[image]

W&B Run

Full training logs: https://wandb.ai/jaygala24-team/rl-post-training/runs/qwen2.5_0.5b_grpo_no_kl_3a1f_4xh100_202888_finetune_cd3a050a

Usage

Transformers

python
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("jaygala24/Qwen2.5-0.5B-GRPO-math-reasoning", revision="step-0200")  # optional branch, e.g. "step-0400"
tokenizer = AutoTokenizer.from_pretrained("jaygala24/Qwen2.5-0.5B-GRPO-math-reasoning", revision="step-0200")

prompt = "Please reason step by step, and put your final answer within \\boxed{}.\n\nWhat is the sum of 123 and 456?"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=4096, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

vLLM

python
from vllm import LLM, SamplingParams

llm = LLM(model="jaygala24/Qwen2.5-0.5B-GRPO-math-reasoning", revision="step-0200")  # optional branch, e.g. "step-0400"
sampling_params = SamplingParams(temperature=0.7, max_tokens=4096)

prompt = "Please reason step by step, and put your final answer within \boxed{}.

What is the sum of 123 and 456?"
outputs = llm.generate([prompt], sampling_params)
print(outputs[0].outputs[0].text)

Framework