π Paper Β | Β π Dataset (v2) Β | Β π Model (v2)
LIMO challenges the conventional wisdom in mathematical reasoning by demonstrating that models can achieve superior performance with significantly less but higher quality training data. Our approach:
Our LIMO models are available on Hugging Face π€:
| Model | Backbone | Size | Link |
|---|---|---|---|
| LIMO-v2 (Latest) | Qwen2.5-32B-Instruct | 32B | π€ |
| LIMO-v1 | Qwen2.5-32B-Instruct | 32B | π€ |
We release our datasets through Hugging Face π€:
| Dataset | Description | Link |
|---|---|---|
| LIMO-v2 (Latest) | Updated training set for the latest paper version (800 samples) | π€ |
| LIMO-v1 | Original training set (817 samples) | π€ |
Our models are fine-tuned on Qwen2.5-32B-Instruct and are compatible with most mainstream frameworks like HF Transformers, VLLM, TensorRT-LLM and etc.
# Install required packages
pip install transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Initialize model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"GAIR/LIMO-v2",
torch_dtype="auto",
trust_remote_code=True,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("GAIR/LIMO-v2", trust_remote_code=True)
# Prepare input messages (We use the following template and system prompt during training and inference)
messages = [
{"role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}."},
{"role": "user", "content": "What is the result of 1+1?"}
]
# Format input using chat template
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Tokenize input
inputs = tokenizer(text, return_tensors="pt").to(model.device)
# Generate response
outputs = model.generate(
**inputs,
max_new_tokens=32768,
temperature=0.7,
top_p=0.95,
do_sample=True
)
# Decode and print response
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
# Install required packages
pip install vllm
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
# Initialize the model
llm = LLM(
model="GAIR/LIMO-v2",
tensor_parallel_size=4, # adjust based on available GPUs
trust_remote_code=True,
swap_space=60,
gpu_memory_utilization=0.96,
)
# Prepare input messages (We use the following template and system prompt during training and inference)
messages = [
{"role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}."},
{"role": "user", "content": "What is the result of 1+1?"}
]
# Setup tokenizer
tokenizer = AutoTokenizer.from_pretrained("GAIR/LIMO-v2", trust_remote_code=True)
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Configure generation parameters
sampling_params = SamplingParams(
temperature=0.7,
max_tokens=32768,
top_p=0.95,
)
# Generate response
output = llm.generate(text, sampling_params)
print(output[0].outputs[0].text)
We utilize LLaMA-Factory framework for training, which provides a convenient and efficient training pipeline.
Environment Setup
Data Preparation
Configuration
For multi-node training, use the following command:
FORCE_TORCHRUN=1 \
NNODES=${PET_NNODES} \
NODE_RANK=${PET_NODE_RANK} \
MASTER_ADDR=${MASTER_ADDR} \
MASTER_PORT=${MASTER_PORT} \
llamafactory-cli train <path to yaml config file>
Where:
PET_NNODES: Total number of nodesPET_NODE_RANK: Rank of current node (0-based)MASTER_ADDR: Address of master nodeMASTER_PORT: Port for communication<path to yaml config file>: Path to your training configuration YAMLFor more detailed training examples and configurations, refer to LLaMA-Factory's official training examples.
Note: Multi-node training environments can vary significantly between different machines and cluster setups. You'll need to adapt the training configuration and launch commands according to your specific environment and infrastructure.
We also release scripts for evaluating Large Language Models (LLMs) on mathematical reasoning tasks. The evaluation framework includes both inference (using the VLLM framework) and evaluation (using both rule-based and model-based approaches) components.
For rule-based evaluation, we support pure numerical problems like AIME and most MATH problems. For more complex responses (expressions, equations, or natural language descriptions), we employ model-based evaluation using Qwen2.5-32B-Instruct as the judge model.
For detailed instructions and implementation details, please refer to eval/README.md.
If you need the original LIMO resources from the initial paper version, they are still available:
The v1 resources correspond to the initial paper submission and contain the experimental results that were previously shown in this README.
This project is licensed under the MIT License - see the LICENSE file for details.
@misc{ye2025limoreasoning,
title={LIMO: Less is More for Reasoning},
author={Yixin Ye and Zhen Huang and Yang Xiao and Ethan Chern and Shijie Xia and Pengfei Liu},
year={2025},
eprint={2502.03387},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2502.03387},
}
Python
99.2%
π Paper Β | Β π Dataset (v2) Β | Β π Model (v2)
LIMO challenges the conventional wisdom in mathematical reasoning by demonstrating that models can achieve superior performance with significantly less but higher quality training data. Our approach:
Our LIMO models are available on Hugging Face π€:
| Model | Backbone | Size | Link |
|---|---|---|---|
| LIMO-v2 (Latest) | Qwen2.5-32B-Instruct | 32B | π€ |
| LIMO-v1 | Qwen2.5-32B-Instruct | 32B | π€ |
We release our datasets through Hugging Face π€:
| Dataset | Description | Link |
|---|---|---|
| LIMO-v2 (Latest) | Updated training set for the latest paper version (800 samples) | π€ |
| LIMO-v1 | Original training set (817 samples) | π€ |
Our models are fine-tuned on Qwen2.5-32B-Instruct and are compatible with most mainstream frameworks like HF Transformers, VLLM, TensorRT-LLM and etc.
# Install required packages
pip install transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Initialize model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"GAIR/LIMO-v2",
torch_dtype="auto",
trust_remote_code=True,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("GAIR/LIMO-v2", trust_remote_code=True)
# Prepare input messages (We use the following template and system prompt during training and inference)
messages = [
{"role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}."},
{"role": "user", "content": "What is the result of 1+1?"}
]
# Format input using chat template
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Tokenize input
inputs = tokenizer(text, return_tensors="pt").to(model.device)
# Generate response
outputs = model.generate(
**inputs,
max_new_tokens=32768,
temperature=0.7,
top_p=0.95,
do_sample=True
)
# Decode and print response
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
# Install required packages
pip install vllm
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
# Initialize the model
llm = LLM(
model="GAIR/LIMO-v2",
tensor_parallel_size=4, # adjust based on available GPUs
trust_remote_code=True,
swap_space=60,
gpu_memory_utilization=0.96,
)
# Prepare input messages (We use the following template and system prompt during training and inference)
messages = [
{"role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}."},
{"role": "user", "content": "What is the result of 1+1?"}
]
# Setup tokenizer
tokenizer = AutoTokenizer.from_pretrained("GAIR/LIMO-v2", trust_remote_code=True)
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Configure generation parameters
sampling_params = SamplingParams(
temperature=0.7,
max_tokens=32768,
top_p=0.95,
)
# Generate response
output = llm.generate(text, sampling_params)
print(output[0].outputs[0].text)
We utilize LLaMA-Factory framework for training, which provides a convenient and efficient training pipeline.
Environment Setup
Data Preparation
Configuration
For multi-node training, use the following command:
FORCE_TORCHRUN=1 \
NNODES=${PET_NNODES} \
NODE_RANK=${PET_NODE_RANK} \
MASTER_ADDR=${MASTER_ADDR} \
MASTER_PORT=${MASTER_PORT} \
llamafactory-cli train <path to yaml config file>
Where:
PET_NNODES: Total number of nodesPET_NODE_RANK: Rank of current node (0-based)MASTER_ADDR: Address of master nodeMASTER_PORT: Port for communication<path to yaml config file>: Path to your training configuration YAMLFor more detailed training examples and configurations, refer to LLaMA-Factory's official training examples.
Note: Multi-node training environments can vary significantly between different machines and cluster setups. You'll need to adapt the training configuration and launch commands according to your specific environment and infrastructure.
We also release scripts for evaluating Large Language Models (LLMs) on mathematical reasoning tasks. The evaluation framework includes both inference (using the VLLM framework) and evaluation (using both rule-based and model-based approaches) components.
For rule-based evaluation, we support pure numerical problems like AIME and most MATH problems. For more complex responses (expressions, equations, or natural language descriptions), we employ model-based evaluation using Qwen2.5-32B-Instruct as the judge model.
For detailed instructions and implementation details, please refer to eval/README.md.
If you need the original LIMO resources from the initial paper version, they are still available:
The v1 resources correspond to the initial paper submission and contain the experimental results that were previously shown in this README.
This project is licensed under the MIT License - see the LICENSE file for details.
@misc{ye2025limoreasoning,
title={LIMO: Less is More for Reasoning},
author={Yixin Ye and Zhen Huang and Yang Xiao and Ethan Chern and Shijie Xia and Pengfei Liu},
year={2025},
eprint={2502.03387},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2502.03387},
}
Python
99.2%