---
title: Gemma2-9B-IT-Simpo-Infinity-Preference
canonical_url: "https://www.modelscope.ai/models/BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference"
md_url: "https://www.modelscope.ai/models/BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference.md"
repository: BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference
last_updated: 2025-09-20
model_type:
  - gemma2
base_model:
  - google/gemma-2-9b-it
base_model_relation: finetune
library_name:
  - pytorch
  - transformer
  - safetensors
frameworks:
  - pytorch
language:
  - en
downloads: 129
stars: 0
---

# Gemma2-9B-IT-Simpo-Infinity-Preference

> Gemma2-9B-IT-Simpo-Infinity-Preference - An open-source model by BAAI on ModelScope. Overview Gemma2-9B-IT-Simpo-Infinity-Preference is based on gemma-2-9b-it and finetuned on Infinity-Preference with Simpo. It achieves 73.4% LC win-rate on AlpacaEval 2.0…

BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference is a machine learning model on ModelScope. derived from google/gemma-2-9b-it.

- **Repository**: BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference
- **Base model**: google/gemma-2-9b-it
- **Downloads**: 129
- **Stars**: 0
- **Last updated**: 2025-09-20

Source: https://www.modelscope.ai/models/BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference

---

## Overview
Gemma2-9B-IT-Simpo-Infinity-Preference is based on [gemma-2-9b-it](https://huggingface.co/google/gemma-2-9b-it) and finetuned on [Infinity-Preference](https://huggingface.co/datasets/BAAI/Infinity-Preference) with [Simpo](https://github.com/princeton-nlp/SimPO). It achieves 73.4% LC win-rate on AlpacaEval 2.0 and 58.1% win-rate on Arena-Hard against GPT-4.

## Training hyperparameters

```yaml
beta: 10
gamma_beta_ratio: 1
learning_rate: 8.0e-7
log_level: info
logging_steps: 5
max_length: 2048
max_prompt_length: 1800
num_train_epochs: 1
batch_size: 128
```

## How to Use

Gemma2-9B-IT-Simpo-Infinity-Preference adopt the same chat template of [gemma-2-9b-it](https://huggingface.co/google/gemma-2-9b-it):

```bash
<bos><start_of_turn>user
How are you?<end_of_turn>
<start_of_turn>model
Hi!<end_of_turn>
```

To apply this model and template in conversation scenarios, you can refer to the following code:

```python
from transformers import AutoModelForCausalLM, AutoTokenizer, LogitsProcessorList
import torch
device = "cuda" # the device to load the model onto

model = AutoModelForCausalLM.from_pretrained("BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference",
    torch_dtype=torch.bfloat16,
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference")

prompt = "Give me a short introduction to large language model."
messages = [
    {"role": "user", "content": prompt}
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)

logits_processor = LogitsProcessorList(
            [
                MinLengthLogitsProcessor(1, eos_token_id=tokenizer.eos_token_id),
                TemperatureLogitsWarper(0.8),
            ]
 )
 
generated_ids = model.generate(
    model_inputs.input_ids,
    logits_processor=logits_processor,
    max_new_tokens=512
)

generated_ids = [
    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]

response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
```

## Disclaimer

The resources, including code, data, and model weights, associated with this project are restricted for academic research purposes only and cannot be used for commercial purposes. The content produced by any version of Infinity-Preference is influenced by uncontrollable variables such as randomness, and therefore, the accuracy of the output cannot be guaranteed by this project. This project does not accept any legal liability for the content of the model output, nor does it assume responsibility for any losses incurred due to the use of associated resources and output results.
