Ray2333/GRM-Llama3.2-3B-rewardmodel-ft

Model

14

stars

14

commits

2

linked in READMEs

Apr 30, 2025

updated

llama
safetensors
text-classification

README

Introduction

This reward model achieves a score of 90.9 on reward-bench, which is finetuned from the Ray2333/GRM-llama3.2-3B-sftreg using the decontaminated Skywork preference dataset v0.2. We obtain a SOTA 3B reward model that can outperform a series of 8B reward models and even surpass gpt4/gemini as a judge.

Check our GRM series at 🤗hugging face, our paper at Arxiv, and github repo at Github.

Evaluation

We evaluate GRM-Llama3.2-3B-rewardmodel-ft on the reward model benchmark, where it achieved strong performance among models smaller than 7B.

When evaluated using reward bench, please add '--not_quantized' to avoid performance drop.

ModelAverageChatChat HardSafetyReasoning
GRM_Llama3.1_8B_rewardmodel-ft(8B)92.695.087.791.496.4
GRM-Llama3-8B-rewardmodel-ft(8B)91.595.586.290.893.6
GRM-Llama3.2-3B-rewardmodel-ft(ours, 3B)90.991.684.992.794.6
GRM-gemma2-2B-rewardmodel-ft (Ours, 2B)88.493.077.292.291.2
google/gemini-1.5-pro-051488.292.380.687.992.0
RLHFlow/pair-preference-model-LLaMA3-8B87.198.365.889.794.7
GRM-llama3-8B-sftreg(ours, 8B)87.098.667.889.292.3
google/gemini-1.5-pro-092486.894.177.085.890.2
openai/gpt-4o-2024-08-0686.796.176.188.186.6
GRM-llama3.2-3B-sftreg(ours, 3B)85.896.467.188.291.6
GRM-Gemma-2B-rewardmodel-ft (Ours, 2B)84.789.475.285.588.8
openai/gpt-4o-2024-05-1384.696.670.486.584.9
sfairXC/FsfairX-LLaMA3-RM-v0.1 (8B)84.499.465.186.886.4
Nexusflow/Starling-RM-34B82.696.957.287.788.5
GRM-Gemma2-2B-sftreg(Ours, 2B)81.097.259.686.980.3
GRM-Gemma-2B-sftreg(Ours, 2B)75.395.548.780.076.8
berkeley-nest/Starling-RM-7B-alpha (7B)74.69843.488.674.6
Gemma-2B-rewardmodel-baseline(Ours, 2B)73.794.146.179.675.0
openbmb/UltraRM-13b (13B)71.396.155.345.882

Usage

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

device = 'cuda:0'
# load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained('Ray2333/GRM-Llama3.2-3B-rewardmodel-ft')
reward_model = AutoModelForSequenceClassification.from_pretrained(
                'Ray2333/GRM-Llama3.2-3B-rewardmodel-ft', torch_dtype=torch.float16, 
                device_map=device,
                )
message = [
  {'role': 'user', 'content': "I'm going to go out to a movie, but I need someone to chat with my daughter and pretend to be me while she's home alone.  But I can't do that while I'm at the movie.  Can you help by impersonating me by chat with her?"},
  {'role': 'assistant', 'content': "Sorry, I'm not comfortable impersonating you in that way.  I'm not willing to behave so dishonestly.  Maybe you can just find a way to bring her to the movie, or you can find a babysitter?"}
]
message_template = tokenizer.apply_chat_template(message, tokenize=False)
# it will look like this: "<bos><start_of_turn>user\nI'm going to go out to a movie, but I need someone to chat with my daughter and pretend to be me while she's home alone.  But I can't do that while I'm at the movie.  Can you help by impersonating me by chat with her?<end_of_turn>\n<start_of_turn>model\nSorry, I'm not comfortable impersonating you in that way.  I'm not willing to behave so dishonestly.  Maybe you can just find a way to bring her to the movie, or you can find a babysitter?<end_of_turn>\n".

kwargs = {"padding": 'longest', "truncation": True, "return_tensors": "pt"}
tokens = tokenizer.encode_plus(message_template, **kwargs)

# The encode_plus may add another bos token though no impact on the final performance, but you can also avoid this by using the following code:
# tokens =  tokenizer.apply_chat_template(message, tokenize=True, return_dict=True, **kwargs)

with torch.no_grad():
  reward_tensor = reward_model(tokens["input_ids"][0].view(1,-1).to(device), attention_mask=tokens["attention_mask"][0].view(1,-1).to(device))[0]
  reward = reward_tensor.cpu().detach().item()

Citation

If you find this model helpful for your research, please cite GRM

@inproceedings{yang2024regularizing,
  title={Regularizing Hidden States Enables Learning Generalizable Reward Model for LLMs},
  author={Yang, Rui and Ding, Ruomeng and Lin, Yong and Zhang, Huan and Zhang, Tong},
  booktitle={Advances in Neural Information Processing Systems},
  year={2024}
}

Contributors

Ray2333

13 commits

MichaelR207

1 commits

Ray2333/GRM-Llama3.2-3B-rewardmodel-ft

Model

14

stars

14

commits

2

linked in READMEs

Apr 30, 2025

updated

llama
safetensors
text-classification

README

Introduction

This reward model achieves a score of 90.9 on reward-bench, which is finetuned from the Ray2333/GRM-llama3.2-3B-sftreg using the decontaminated Skywork preference dataset v0.2. We obtain a SOTA 3B reward model that can outperform a series of 8B reward models and even surpass gpt4/gemini as a judge.

Check our GRM series at 🤗hugging face, our paper at Arxiv, and github repo at Github.

Evaluation

We evaluate GRM-Llama3.2-3B-rewardmodel-ft on the reward model benchmark, where it achieved strong performance among models smaller than 7B.

When evaluated using reward bench, please add '--not_quantized' to avoid performance drop.

ModelAverageChatChat HardSafetyReasoning
GRM_Llama3.1_8B_rewardmodel-ft(8B)92.695.087.791.496.4
GRM-Llama3-8B-rewardmodel-ft(8B)91.595.586.290.893.6
GRM-Llama3.2-3B-rewardmodel-ft(ours, 3B)90.991.684.992.794.6
GRM-gemma2-2B-rewardmodel-ft (Ours, 2B)88.493.077.292.291.2
google/gemini-1.5-pro-051488.292.380.687.992.0
RLHFlow/pair-preference-model-LLaMA3-8B87.198.365.889.794.7
GRM-llama3-8B-sftreg(ours, 8B)87.098.667.889.292.3
google/gemini-1.5-pro-092486.894.177.085.890.2
openai/gpt-4o-2024-08-0686.796.176.188.186.6
GRM-llama3.2-3B-sftreg(ours, 3B)85.896.467.188.291.6
GRM-Gemma-2B-rewardmodel-ft (Ours, 2B)84.789.475.285.588.8
openai/gpt-4o-2024-05-1384.696.670.486.584.9
sfairXC/FsfairX-LLaMA3-RM-v0.1 (8B)84.499.465.186.886.4
Nexusflow/Starling-RM-34B82.696.957.287.788.5
GRM-Gemma2-2B-sftreg(Ours, 2B)81.097.259.686.980.3
GRM-Gemma-2B-sftreg(Ours, 2B)75.395.548.780.076.8
berkeley-nest/Starling-RM-7B-alpha (7B)74.69843.488.674.6
Gemma-2B-rewardmodel-baseline(Ours, 2B)73.794.146.179.675.0
openbmb/UltraRM-13b (13B)71.396.155.345.882

Usage

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

device = 'cuda:0'
# load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained('Ray2333/GRM-Llama3.2-3B-rewardmodel-ft')
reward_model = AutoModelForSequenceClassification.from_pretrained(
                'Ray2333/GRM-Llama3.2-3B-rewardmodel-ft', torch_dtype=torch.float16, 
                device_map=device,
                )
message = [
  {'role': 'user', 'content': "I'm going to go out to a movie, but I need someone to chat with my daughter and pretend to be me while she's home alone.  But I can't do that while I'm at the movie.  Can you help by impersonating me by chat with her?"},
  {'role': 'assistant', 'content': "Sorry, I'm not comfortable impersonating you in that way.  I'm not willing to behave so dishonestly.  Maybe you can just find a way to bring her to the movie, or you can find a babysitter?"}
]
message_template = tokenizer.apply_chat_template(message, tokenize=False)
# it will look like this: "<bos><start_of_turn>user\nI'm going to go out to a movie, but I need someone to chat with my daughter and pretend to be me while she's home alone.  But I can't do that while I'm at the movie.  Can you help by impersonating me by chat with her?<end_of_turn>\n<start_of_turn>model\nSorry, I'm not comfortable impersonating you in that way.  I'm not willing to behave so dishonestly.  Maybe you can just find a way to bring her to the movie, or you can find a babysitter?<end_of_turn>\n".

kwargs = {"padding": 'longest', "truncation": True, "return_tensors": "pt"}
tokens = tokenizer.encode_plus(message_template, **kwargs)

# The encode_plus may add another bos token though no impact on the final performance, but you can also avoid this by using the following code:
# tokens =  tokenizer.apply_chat_template(message, tokenize=True, return_dict=True, **kwargs)

with torch.no_grad():
  reward_tensor = reward_model(tokens["input_ids"][0].view(1,-1).to(device), attention_mask=tokens["attention_mask"][0].view(1,-1).to(device))[0]
  reward = reward_tensor.cpu().detach().item()

Citation

If you find this model helpful for your research, please cite GRM

@inproceedings{yang2024regularizing,
  title={Regularizing Hidden States Enables Learning Generalizable Reward Model for LLMs},
  author={Yang, Rui and Ding, Ruomeng and Lin, Yong and Zhang, Huan and Zhang, Tong},
  booktitle={Advances in Neural Information Processing Systems},
  year={2024}
}

Contributors

Ray2333

13 commits

MichaelR207

1 commits