/ Модель

Характеристики

Контекст
8 192 токена
Параметры
7,5 млрд
Размер весов
15 ГБ
Лицензия
MIT
Архитектура
llama · dense
Опубликована
5 июл 2024

GRM-llama3-8B-distill

Классификация текстаТекст → label3 профессии

Модель вознаграждения на основе Llama 3 для оценки и сравнения ответов языковых моделей.

69скачиваний за 30 дней6лайковвеса обновлены5 фев 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Ray2333/GRM-llama3-8B-distill — модель вознаграждения для оценки ответов языковых моделей, разработанная авторами Generalizable Reward Model (GRM). Она основана на Llama 3 с архитектурой LlamaForSequenceClassification и предназначена для сравнения качества ответов и присвоения им оценок в сценариях обучения и оценки LLM. Веса основной модели зафиксированы; на датасете hendrydong/preference_700K дообучена только случайно инициализированная линейная голова вознаграждения.

Модель содержит 7,5 млрд параметров, поддерживает контекст до 8192 токенов и распространяется в формате safetensors. В README сообщается о среднем результате 86,1 на бенчмарке reward-моделей. Лицензия — MIT. При загрузке Llama 3 в 8-битном режиме возможно снижение качества.

Сценарии применения

  • оценка качества ответа языковой модели
  • ранжирование нескольких ответов на один запрос
  • подготовка оценок предпочтений для обучения LLM
  • проверка ответов по критериям безопасности и качества
  • оценивание диалоговых и рассуждающих ответов

Ограничения

В README отмечено, что загрузка модели Llama 3 в 8-битном режиме может ухудшить качество. Заявленный результат относится к указанному бенчмарку и сам по себе не гарантирует качество на других данных.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Introduction

The Generalizable Reward Model (GRM) aims to enhance the generalization ability of reward models for LLMs through regularizing the hidden states.

Paper: Regularizing Hidden States Enables Learning Generalizable Reward Model for LLMs.

This reward model uses the fixed model weights from Ray2333/GRM-llama3-8B-sftreg and only finetunes a randomly initilized linear reward head on the hendrydong/preference_700K dataset. This reward is easy to use if users want to directly use the AutoModelForSequenceClassification class.

Evaluation

We evaluate this reward model on the reward model benchmark, which also improves the SOTA 8B Bradley–Terry model's average score from 84.7 to 86.1, showing the effectiveness of the hidden states learned by GRM.

ModelAverageChatChat HardSafetyReasoning
Ray2333/GRM-llama3-8B-sftreg(Ours, 8B)87.098.667.889.492.3
Ray2333/GRM-llama3-8B-distill(Ours, 8B)86.198.368.486.191.3
openai/gpt-4-0125-preview85.995.374.387.286.9
sfairXC/FsfairX-LLaMA3-RM-v0.1 (8B)84.799.465.187.886.4

Usage

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

# load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained('Ray2333/GRM-llama3-8B-distill')
reward_model = AutoModelForSequenceClassification.from_pretrained(
                'Ray2333/GRM-llama3-8B-distill',
                num_labels=1, torch_dtype=torch.float16,
                device_map=0,
                )
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: "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\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?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\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?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n".

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

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

Note: loading llama3 model into 8 bit could lead to performance degradation.

Citation

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

@article{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},
  journal={arXiv preprint arXiv:2406.10216},
  year={2024}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · text-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
LlamaForSequenceClassification
Ревизия весов
5fdf90c

0 моделей