Update README.md
Browse files1 unmodified line2345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273741 unmodified linelicense: apache-2.0---## Introduction**InfiR2-R1-7B-FP8** is a model derived from the **InfiR2-7B-base-FP8**, obtained through Supervised Fine-Tuning (SFT) utilizing **FP8** and the **InfiAlign dataset**.## Model DownloadDownload the InfiMed model from the Hugging Face Hub into the `./models` directory.```bash# Create a directory for modelsmkdir -p ./models# Download the R1 modelhuggingface-cli download --resume-download InfiX-ai/InfiR2-R1-7B-FP8 --local-dir ./models/InfiR2-R1-7B-FP8````## Quick Start```pythonimport torchfrom transformers import AutoModelForCausalLM, AutoTokenizerMODEL_NAME = "InfiX-ai/InfiR2-R1-7B-FP8"prompt_text = "Briefly explain what a black hole is, and provide two interesting facts."MAX_NEW_TOKENS = 256TEMPERATURE = 0.8DO_SAMPLE = Truetokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)device = "cuda" if torch.cuda.is_available() else "cpu"model = AutoModelForCausalLM.from_pretrained(MODEL_NAME,torch_dtype=torch.bfloat16 if device == "cuda" else None).to(device)messages = [{"role": "user", "content": prompt_text}]input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(device)with torch.no_grad():output_ids = model.generate(input_ids,max_new_tokens=MAX_NEW_TOKENS,temperature=TEMPERATURE,do_sample=DO_SAMPLE,pad_token_id=tokenizer.eos_token_id)generated_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)response_start_index = generated_text.rfind(prompt_text) + len(prompt_text)llm_response = generated_text[response_start_index:].strip()print("\n" + "="*70)print(f"Prompt: \n{prompt_text}")print("-" * 70)print(f"(LLM Response): \n{llm_response}")print("="*70)```## Acknowledgements* We would like to express our gratitude for the following open-source projects: [Slime](https://github.com/THUDM/slime), [Megatron](https://github.com/NVIDIA/Megatron-LM), [TransformerEngine](https://github.com/NVIDIA/TransformerEngine) and [Qwen2.5](https://github.com/QwenLM/Qwen2.5-Math).## CitationIf you find our work useful, please cite:1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951 unmodified linelicense: apache-2.0---# InfiR2-R1-7B-FP8<p align="center">Β <a href="https://arxiv.org/abs/2509.22536">π Paper</a> | <a href="https://github.com/InfiXAI/InfiR2">π Github</a> |Β <a href="https://infix-ai.com/research/infir2/">π Project Website</a> </p>## IntroductionWe performed **Reinforcement Learning (RL)** fine-tuning on the **InfiR2-7B-Instruct-FP8** model in two stages using the **dapo-math-17k** and the **FP8 format**, with hyperparameters shown below.<div align="center">| Parameter | Value || :---: | :---: || **Batch Size (train\_prompt\_bsz)** | 128 || **N Samples Per Prompt** | 16 || **Global Batch Size** | 2048 || **Maximum Response Length** | 16384 || **Rollout Temperature** | 1.1 || **Learning Rate (LR)** | 1e-6 || **Weight Decay** | 0.1 || **Eps Clip** | 0.2 || **KL Loss Coefficient** | 0.00 |</div>The resulting model is the **InfiR2-R1-7B-FP8**.**Training Recipe**:<p align="center"><img src="fp8_recipe.png" width="100%"/><p>- Stable and Reproducible Performance- Efficient and Low memory Training---## π InfiR2 Model SeriesThe InfiR2 framework offers multiple variants model with different size and training strategy:- **1.5B**- [InfiR2-1.5B-base-FP8](https://huggingface.co/InfiX-ai/InfiR2-1.5B-base-FP8): *Continue pretrain on Qwen2.5-1.5B-base*- [InfiR2-1.5B-Instruct-FP8](https://huggingface.co/InfiX-ai/InfiR2-1.5B-Instruct-FP8): *Supervised fine-tuning on InfiR2-1.5B-base-FP8 with [InfiAlign dataset](https://huggingface.co/papers/2508.05496)*- **7B**- [InfiR2-7B-base-FP8](https://huggingface.co/InfiX-ai/InfiR2-7B-base-FP8): *Continue pretrain on Qwen2.5-7B-base*- [InfiR2-7B-Instruct-FP8](https://huggingface.co/InfiX-ai/InfiR2-7B-Instruct-FP8): *Supervised fine-tuning on InfiR2-7B-base-FP8 with [InfiAlign dataset](https://huggingface.co/papers/2508.05496)*- [InfiR2-R1-7B-FP8](https://huggingface.co/InfiX-ai/InfiR2-R1-7B-FP8): *Reinforcement learning on InfiR2-7B-Instruct-FP8 with dapo dataset*---## π Model PerformanceBelow is the performance comparison of **InfiR2-R1-7B-FP8** on reasoning benchmarks. Note: 'w. InfiAlign' denotes Supervised Fine-Tuning (SFT) using the InfiAlign dataset.<div align="center"><table><thead><tr><th align="left">Model</th><th align="center">AIME 25</th><th align="center">AIME 24</th><th align="center">GPQA</th><th align="center">LiveCodeBench v5</th></tr></thead><tbody><tr><td align="left"><strong>Deepseek-Distill-Qwen-7B</strong></td><td align="center">43.00</td><td align="center">49.00</td><td align="center">48.20</td><td align="center">37.60</td></tr><tr><td align="left"><strong>Qwen2.5-7B-base (w. InfiAlign)</strong></td><td align="center">33.75</td><td align="center">43.02</td><td align="center">48.11</td><td align="center">39.48</td></tr><tr><td align="left"><strong>InfiR2-R1-7B-FP8</strong></td><td align="center">40.62</td><td align="center">55.73</td><td align="center">45.33</td><td align="center">40.31</td></tr></tr></tbody></table></div>---## π Quick Start```pythonfrom vllm import LLM, SamplingParamsimport torchimport osMODEL_NAME = "InfiX-ai/InfiR2-R1-7B-FP8"prompt_text = "Briefly explain what a black hole is, and provide two interesting facts."MAX_NEW_TOKENS = 256TEMPERATURE = 0.8DO_SAMPLE = Truellm = LLM(model=MODEL_NAME,dtype="auto",)sampling_params = SamplingParams(n=1,temperature=TEMPERATURE,max_tokens=MAX_NEW_TOKENS,)tokenizer = llm.get_tokenizer()messages = [{"role": "user", "content": prompt_text}]prompt_formatted = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)outputs = llm.generate(prompt_formatted,sampling_params)generated_text = outputs[0].outputs[0].textllm_response = generated_text.strip()print("\n" + "="*70)print(f"Prompt: \n{prompt_text}")print("-" * 70)print(f"(LLM Response): \n{llm_response}")print("="*70)````-----## π Model Download```bash# Create a directory for modelsmkdir -p ./models# Download InfiR2-R1-7B-FP8 modelhuggingface-cli download --resume-download InfiX-ai/InfiR2-R1-7B-FP8 --local-dir ./models/InfiR2-R1-7B-FP8```-----## π― Intended Uses### β Direct UseThis model is intended for research and commercial use. Example use cases include:- Instruction following- Mathematical reasoning- Code generation- General reasoning### β Out-of-Scope UseThe model should **not** be used for:- Generating harmful, offensive, or inappropriate content- Creating misleading information-----## π Acknowledgements* We would like to express our gratitude for the following open-source projects: [Slime](https://github.com/THUDM/slime), [Megatron](https://github.com/NVIDIA/Megatron-LM), [TransformerEngine](https://github.com/NVIDIA/TransformerEngine) and [Qwen2.5](https://github.com/QwenLM/Qwen2.5-Math).-----## π CitationIf you find our work useful, please cite:
README.md+155-34