/ Модель

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

Параметры
3,8 млрд
Лицензия
BigScience BLOOM RAIL 1.0
Архитектура
bloom · dense
Базовая модель
bloomz-3b-sft-chat
Опубликована
1 дек 2023

bloomz-3b-guardrail

Классификация текстаТекст → label

Модель оценивает текст на токсичность по пяти категориям и подходит для модерации контента и контроля ответов генеративных моделей.

32скачиваний за 30 дней5лайковвеса обновлены26 окт 2024

Бенчмарки

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

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

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

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

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

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

Bloomz-3b-guardrail — дообученная модель на базе cmarkea/bloomz-3b-sft-chat, разработанная для оценки токсичности текста по пяти категориям: непристойный контент, откровенно сексуальный контент, атаки на идентичность, оскорбления и угрозы. Она возвращает отдельные оценки для каждой категории и предназначена, в частности, для мониторинга и фильтрации выходов генеративных моделей.

Модель построена на архитектуре BLOOM и содержит 3,8 млрд параметров. Её обучали на англоязычных и франкоязычных комментариях с оценками выраженности токсичности; карточка также приводит результаты оценки на французском и английском языках. Для получения вероятностных оценок всех категорий в Transformers рекомендуется включить возврат всех оценок и sigmoid.

В опубликованном бенчмарке качество различается по языкам и категориям, поэтому оценки следует проверять на данных конкретного применения. Французские обучающие комментарии были переведены Google Translate, а обучение опиралось на датасет Jigsaw, что может ограничивать переносимость результатов. Лицензия — BigScience BLOOM RAIL 1.0.

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

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

Ограничения

Бенчмарк показывает различия качества между языками и категориями; приведённые результаты не гарантируют качество на данных конкретного применения. Французские обучающие комментарии были переведены Google Translate, что может влиять на переносимость оценок.

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

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

Открыть на Hugging Face

Bloomz-3b-guardrail

We introduce the Bloomz-3b-guardrail model, which is a fine-tuning of the Bloomz-3b-sft-chat model. This model is designed to detect the toxicity of a text in five modes:

  • Obscene: Content that is offensive, indecent, or morally inappropriate, especially in relation to social norms or standards of decency.
  • Sexual explicit: Content that presents explicit sexual aspects in a clear and detailed manner.
  • Identity attack: Content that aims to attack, denigrate, or harass someone based on their identity, especially related to characteristics such as race, gender, sexual orientation, religion, ethnic origin, or other personal aspects.
  • Insult: Offensive, disrespectful, or hurtful content used to attack or denigrate a person.
  • Threat: Content that presents a direct threat to an individual.

This kind of modeling can be ideal for monitoring and controlling the output of generative models, as well as measuring the generated degree of toxicity.

Training

The training dataset consists of 500k examples of comments in English and 500k comments in French (translated by Google Translate), each annotated with a probablity toxicity severity. The dataset used is provided by Jigsaw as part of a Kaggle competition : Jigsaw Unintended Bias in Toxicity Classification. As the score represents the probability of a toxicity mode, an optimization goal of cross-entropy type has been chosen: $$loss=l_{\mathrm{obscene}}+l_{\mathrm{sexual_explicit}}+l_{\mathrm{identity_attack}}+l_{\mathrm{insult}}+l_{\mathrm{threat}}$$ with $$l_i=\frac{-1}{\vert\mathcal{O}\vert}\sum_{o\in\mathcal{O}}\mathrm{score}{i,o}\log(\sigma(\mathrm{logit}{i,o}))+(\mathrm{score}{i,o}-1)\log(1-\sigma(\mathrm{logit}{i,o}))$$ Where sigma is the sigmoid function and O represents the set of learning observations.

Benchmark

Pearson's inter-correlation was chosen as a measure. Pearson's inter-correlation is a measure ranging from -1 to 1, where 0 represents no correlation, -1 represents perfect negative correlation, and 1 represents perfect positive correlation. The goal is to quantitatively measure the correlation between the model's scores and the scores assigned by judges for 730 comments not seen during training.

ModelLanguageObsecene (x100)Sexual explicit (x100)Identity attack (x100)Insult (x100)Threat (x100)Mean
Bloomz-560m-guardrailFrench647472705868
Bloomz-560m-guardrailEnglish636362705162
Bloomz-3b-guardrailFrench718284777778
Bloomz-3b-guardrailEnglish747679767977

With a correlation of approximately 65 for the 560m model and approximately 80 for the 3b model, the output is highly correlated with the judges' scores.

Opting for the maximum of different modes results in a score extremely close to the target toxicity of the original dataset, with a correlation of 0.976 and a mean absolute error of 0.013±0.04. Therefore, this approach serves as a robust approximation for evaluating the overall performance of the model, transcending rare toxicity modes. Taking a toxicity threshold ≥ 0.5 to create the target, we have 240 positive cases out of 730 observations. Consequently, we will determine the Precision-Recall AUC, ROC AUC, accuracy, and the F1-score.

ModelLanguagePR AUC (%)ROC AUC (%)Accuracy (%)F1-score (%)
Bloomz-560m-guardrailFrench77857860
Bloomz-560m-guardrailEnglish77847962
Bloomz-3b-guardrailFrench82898472
Bloomz-3b-guardrailEnglish80888270

How to Use Bloomz-3b-guardrail

The following example utilizes the API Pipeline of the Transformers library.

from transformers import pipeline

guardrail = pipeline("text-classification", "cmarkea/bloomz-3b-guardrail")

list_text: List[str] = [...]
result = guardrail(
    list_text,
    return_all_scores=True, # Crucial for assessing all modalities of toxicity!
    function_to_apply='sigmoid' # To ensure obtaining a score between 0 and 1!
)

Citation

@online{DeBloomzGuard,
  AUTHOR = {Cyrile Delestre},
  ORGANIZATION = {Cr{\'e}dit Mutuel Ark{\'e}a},
  URL = {https://huggingface.co/cmarkea/bloomz-3b-guardrail},
  YEAR = {2023},
  KEYWORDS = {NLP ; Transformers ; LLM ; Bloomz},
}

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
BloomForSequenceClassification
Ревизия весов
062fca2

0 моделей