InfR aims to advance AI systems by improving reasoning, reducing adoption barriers, and addressing privacy concerns through smaller model sizes.
For optimal performance, we recommend using PyTorch 2.0+ and CUDA 11.8+.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3# Load model and tokenizer
4tokenizer = AutoTokenizer.from_pretrained("InfiX-ai/InfiR-1B-Base")
5model = AutoModelForCausalLM.from_pretrained("InfiX-ai/InfiR-1B-Base")
6
7# Example prompt
8prompt = r"A new program had 60 downloads in the first month. The number of downloads in the second month was three times as many as the downloads in the first month, but then reduced by 30% in the third month. How many downloads did the program have total over the three months?"
9
10# Tokenize and generate
11inputs = tokenizer(prompt, return_tensors="pt")
12outputs = model.generate(**inputs, max_new_tokens=2048)
13print(tokenizer.decode(outputs[0], skip_special_tokens=True))
1# Mathematical problem solving
2math_prompt = """Solve this step by step:
3
4Problem: If a rectangle has a length of 8 units and a width of 6 units, what is its area and perimeter?
5
6Solution:"""
7
8inputs = tokenizer(math_prompt, return_tensors="pt")
9outputs = model.generate(
10 **inputs,
11 max_new_tokens=512,
12 temperature=0.1,
13 do_sample=True
14)
15print(tokenizer.decode(outputs[0], skip_special_tokens=True))
1# Code generation example
2code_prompt = """Write a Python function to calculate the factorial of a number:
3
4def factorial(n):
5"""
6
7inputs = tokenizer(code_prompt, return_tensors="pt")
8outputs = model.generate(
9 **inputs,
10 max_new_tokens=256,
11 temperature=0.2,
12 do_sample=True
13)
14print(tokenizer.decode(outputs[0], skip_special_tokens=True))
1# Chain-of-thought reasoning
2cot_prompt = """Let's approach this step by step:
3
4Question: A train travels 120 km in 2 hours. What is its speed in km/h?
5
6Let me think through this:"""
7
8inputs = tokenizer(cot_prompt, return_tensors="pt")
9outputs = model.generate(
10 **inputs,
11 max_new_tokens=300,
12 temperature=0.3,
13 do_sample=True
14)
15print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Data cleaning: heuristic filters, MinHash de-duplication, 10-gram benchmark decontamination, reward-model rejection sampling.
1@misc{xie2025infir,
2 title={InfiR: Crafting Effective Small Language Models and Multimodal Small Language Models in Reasoning},
3 author={Xie, Congkai and Cai, Shuo and Wang, Wenjun and others},
4 year={2025},
5 eprint={2502.11573},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}
Xie, C., Cai, S., Wang, W., et al. (2025). InfiR: Crafting Effective Small Language Models and Multimodal Small Language Models in Reasoning. arXiv:2502.11573.