Downloads · 30 days
8
11% of all-time downloads
koushikkb12/Qwen2.5-32B-GRPO-Math
Qwen2.5-32B-GRPO-Math is a machine learning model from koushikkb12. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
This is a fine-tuned LoRA adapter for Qwen/Qwen2.5-32B-Instruct that significantly enhances its mathematical logic and reasoning capabilities. The model was trained using Group Relative Policy Optimization (GRPO), a c…
Downloads · 30 days
8
11% of all-time downloads
All-time downloads
72
Public
Repo size
822 MB
Likes
0
Public
Click a slice to open those files.
.safetensors537 MB · 65%
From the Hugging Face model README
This is a fine-tuned LoRA adapter for Qwen/Qwen2.5-32B-Instruct that significantly enhances its mathematical logic and reasoning capabilities. The model was trained using Group Relative Policy Optimization (GRPO), a cutting-edge reinforcement learning technique.
Rather than just learning to output answers, the model was actively rewarded for formulating structured algebraic approaches and strictly formatting its final deductions inside <answer>...</answer> tags.
Qwen/Qwen2.5-32B-InstructThis model excels at breaking down complex word problems and physics/math scenarios into step-by-step logical deductions. It is highly resistant to "hallucinating" math, as it was trained to self-correct during the generation phase.
Formatting Requirement: When prompting the model, instruct it to wrap its final answer in <answer> tags. It has been highly conditioned to follow this structural constraint.
Use the code below to dynamically load this LoRA adapter over the base Qwen 32B model.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load the native 16-bit base model
base_model_id = "Qwen/Qwen2.5-32B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
attn_implementation="sdpa",
)
# Attach the GRPO-trained LoRA adapter
adapter_id = "koushikkb12/Qwen2.5-32B-GRPO-Math"
model = PeftModel.from_pretrained(model, adapter_id)
# Inference
prompt = "A train leaves New York at 8:00 AM traveling 60 mph. Another leaves at 9:00 AM at 80 mph. When do they meet?"
messages = [
{"role": "system", "content": "You are a logical math assistant. Wrap your final answer in <answer> tags."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to("cuda")
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Trained on the GSM8K (Grade School Math 8K) dataset, evaluating against thousands of diverse algebraic and logical reasoning problems.
bfloat16 (Native 16-bit, NO 4-bit quantization used)peft: 0.19.1trl: Latesttransformers: Latesttorch: 2.8.0+cu128