GAIR/LIMO

Model

LIMO: Less Is More for Reasoning πŸš€

45

4 commits

4 linked in READMEs

updated Feb 6, 2025

See the code

README

LIMO: Less Is More for Reasoning πŸš€

πŸ“Œ Table of Contents

Overview

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:

  • 🎯 Achieves SOTA with only 817 carefully curated training samples
  • 🌟 Shows strong generalization across diverse problem types
  • πŸ”¬ Provides comprehensive evaluation on 10 benchmarks
  • πŸ“š Releases high-quality datasets and evaluation tools

Key Results

ModelAIME24MATH500Training Samples
LIMO (Ours)57.1%94.8%817
Previous SOTA6.5%59.2%100k+
Click to see more detailed results
BenchmarkLIMOPrevious SOTAImprovement
AIME2457.1%6.5%+50.6%
MATH50094.8%59.2%+35.6%
AMC2392.0%40.6%+51.4%
OlympiadBench66.8%36.7%+30.1%
CHMath75.4%11.2%+64.2%
Gaokao81.0%49.4%+31.6%
Kaoyan73.4%32.7%+40.7%
GradeSchool76.2%36.2%+40.0%
Minerva44.9%47.1%-2.2%
GPQA66.7%73.3%-6.6%

Model Zoo

Our LIMO model is available on Hugging Face πŸ€—:

ModelBackboneSizeLink
LIMOQwen2.5-32B-Instruct32BπŸ€—

Datasets

We release our datasets through Hugging Face πŸ€—:

DatasetDescriptionSizeLink
LIMOTraining set used to train LIMO model817πŸ€—

Note: We are gradually releasing additional datasets mentioned in our paper, including those used for comparative experiments, to facilitate reproducibility and further analysis by the research community. Stay tuned!

Quick Start

Our model is fine-tuned on Qwen2.5-32B-Instruct and is compatible with most mainstream frameworks like HF Transformers, VLLM, TensorRT-LLM and etc.

Start with HF Transformers
# Install required packages
pip install transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

# Initialize model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
    "GAIR/LIMO",
    torch_dtype="auto",
    trust_remote_code=True,
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("GAIR/LIMO", 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)
Start with VLLM
# Install required packages
pip install vllm
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer

# Initialize the model
llm = LLM(
    model="GAIR/LIMO",
    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", 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)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

@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}, 
}
qwen2
safetensors

Contributors

YangXiao-nlp

3 commits

Benjamin02

1 commits

GAIR/LIMO

Model

LIMO: Less Is More for Reasoning πŸš€

45

4 commits

4 linked in READMEs

updated Feb 6, 2025

See the code

README

LIMO: Less Is More for Reasoning πŸš€

πŸ“Œ Table of Contents

Overview

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:

  • 🎯 Achieves SOTA with only 817 carefully curated training samples
  • 🌟 Shows strong generalization across diverse problem types
  • πŸ”¬ Provides comprehensive evaluation on 10 benchmarks
  • πŸ“š Releases high-quality datasets and evaluation tools

Key Results

ModelAIME24MATH500Training Samples
LIMO (Ours)57.1%94.8%817
Previous SOTA6.5%59.2%100k+
Click to see more detailed results
BenchmarkLIMOPrevious SOTAImprovement
AIME2457.1%6.5%+50.6%
MATH50094.8%59.2%+35.6%
AMC2392.0%40.6%+51.4%
OlympiadBench66.8%36.7%+30.1%
CHMath75.4%11.2%+64.2%
Gaokao81.0%49.4%+31.6%
Kaoyan73.4%32.7%+40.7%
GradeSchool76.2%36.2%+40.0%
Minerva44.9%47.1%-2.2%
GPQA66.7%73.3%-6.6%

Model Zoo

Our LIMO model is available on Hugging Face πŸ€—:

ModelBackboneSizeLink
LIMOQwen2.5-32B-Instruct32BπŸ€—

Datasets

We release our datasets through Hugging Face πŸ€—:

DatasetDescriptionSizeLink
LIMOTraining set used to train LIMO model817πŸ€—

Note: We are gradually releasing additional datasets mentioned in our paper, including those used for comparative experiments, to facilitate reproducibility and further analysis by the research community. Stay tuned!

Quick Start

Our model is fine-tuned on Qwen2.5-32B-Instruct and is compatible with most mainstream frameworks like HF Transformers, VLLM, TensorRT-LLM and etc.

Start with HF Transformers
# Install required packages
pip install transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

# Initialize model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
    "GAIR/LIMO",
    torch_dtype="auto",
    trust_remote_code=True,
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("GAIR/LIMO", 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)
Start with VLLM
# Install required packages
pip install vllm
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer

# Initialize the model
llm = LLM(
    model="GAIR/LIMO",
    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", 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)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

@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}, 
}
qwen2
safetensors

Contributors

YangXiao-nlp

3 commits

Benjamin02

1 commits