This model is a fine-tuned version of
LiquidAI/LFM2-350M trained on the
AI-MO/NuminaMath-CoT dataset using
Group Relative Policy Optimization (GRPO) - an online reinforcement learning method.
This model was trained on the
AI-MO/NuminaMath-CoT dataset:
NuminaMath-CoT provides step-by-step mathematical solutions, enabling the model to learn structured reasoning patterns.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "ermiaazarkhalili/LFM2-350M-GRPO-NuminaMath-10K"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto"
11)
12
13# Math problem
14prompt = "Solve step by step: If a train travels 120 km in 2 hours, what is its average speed?"
15
16inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
17outputs = model.generate(
18 **inputs,
19 max_new_tokens=512,
20 temperature=0.7,
21 do_sample=True
22)
23
24response = tokenizer.decode(outputs[0], skip_special_tokens=True)
25print(response)
1@misc{ermiaazarkhalili_lfm2_350m_grpo_numinamath_10k,
2 author = {Ermia Azarkhalili},
3 title = {LFM2-350M-GRPO-NuminaMath-10K: GRPO-trained LFM2-350M for Math},
4 year = {2025},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/ermiaazarkhalili/LFM2-350M-GRPO-NuminaMath-10K}}
7}