Instructions to use atifquamar07/ministral-3-3b-math-hard-pc-grpo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use atifquamar07/ministral-3-3b-math-hard-pc-grpo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="atifquamar07/ministral-3-3b-math-hard-pc-grpo") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("atifquamar07/ministral-3-3b-math-hard-pc-grpo") model = AutoModelForMultimodalLM.from_pretrained("atifquamar07/ministral-3-3b-math-hard-pc-grpo") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use atifquamar07/ministral-3-3b-math-hard-pc-grpo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "atifquamar07/ministral-3-3b-math-hard-pc-grpo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "atifquamar07/ministral-3-3b-math-hard-pc-grpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/atifquamar07/ministral-3-3b-math-hard-pc-grpo
- SGLang
How to use atifquamar07/ministral-3-3b-math-hard-pc-grpo with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "atifquamar07/ministral-3-3b-math-hard-pc-grpo" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "atifquamar07/ministral-3-3b-math-hard-pc-grpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "atifquamar07/ministral-3-3b-math-hard-pc-grpo" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "atifquamar07/ministral-3-3b-math-hard-pc-grpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use atifquamar07/ministral-3-3b-math-hard-pc-grpo with Docker Model Runner:
docker model run hf.co/atifquamar07/ministral-3-3b-math-hard-pc-grpo
Ministral-3-3B Math-Hard Prefix-Consistency GRPO
This is a merged full-weight fine-tune of mistralai/Ministral-3-3B-Instruct-2512-BF16 for mathematical reasoning. The model was optimized with GRPO and a Prefix-Consistency reward signal, then merged into the base weights so it can be loaded directly with transformers.
Model Details
- Base model:
mistralai/Ministral-3-3B-Instruct-2512-BF16 - Training data:
lighteval/MATH-Hard - Training method: GRPO with Prefix-Consistency reward shaping
- Model format: Full-weight model
- Primary task: step-by-step math problem solving
- Recommended precision: bfloat16
The full training configuration is included in this repository.
Intended Use
This model is intended for research and experimentation with mathematical reasoning. It is best suited for problems where a worked solution and a final boxed answer are expected.
The training prompt asks the model to reason step by step and finish with a final line containing only a boxed answer, for example \boxed{...}.
Usage
import torch
from transformers import AutoTokenizer, Mistral3ForConditionalGeneration
model_id = "atifquamar07/ministral3-3b-math-hard-prefix-consistency-grpo"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = Mistral3ForConditionalGeneration.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
messages = [
{
"role": "system",
"content": (
"You are an expert math solver. Solve the given problem while "
"giving step-by-step reasoning. End with exactly one final line "
"containing only \\boxed{...}. Stop immediately after the boxed "
"final answer."
),
},
{"role": "user", "content": "Problem:\\nFind the value of x if 2x + 5 = 17."},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=8192,
temperature=0.6,
top_p=0.95,
do_sample=True,
)
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))
Training Summary
The model was fine-tuned with a LoRA adapter and then merged into the base model weights for direct inference. The training setup used MATH-Hard examples, chat-formatted prompts, long-form completions, and a reward design that emphasizes both answer correctness and Prefix-Consistency.
See the included training configuration for implementation details.
Limitations
This model is specialized for math reasoning and may be less reliable outside that domain. It can still make algebraic mistakes, produce overlong reasoning, or give an incorrect final answer with confident wording. Outputs should be checked independently when correctness matters.
No benchmark claim is made in this card unless separate evaluation results are added.
License And Terms
This model is derived from mistralai/Ministral-3-3B-Instruct-2512-BF16. Use is subject to the base model license, dataset terms, and any applicable distribution requirements.
- Downloads last month
- 42
Model tree for atifquamar07/ministral-3-3b-math-hard-pc-grpo
Base model
mistralai/Ministral-3-3B-Base-2512