/ Модель

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

Контекст
512 токенов
Параметры
124 млн
Лицензия
Apache 2.0
Архитектура
t5 · dense
Базовая модель
t5-base
Библиотека
transformers
Опубликована
20 сен 2026

t5-base-paradetox-detox

Генерация текстаТекст → текст3 профессии

Модель на базе T5 переписывает короткие англоязычные токсичные высказывания в более нейтральную форму, стараясь сохранить их смысл.

477скачиваний за 30 дней0лайковвеса обновлены20 сен 2026

Бенчмарки

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

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

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

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

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

thealper2/t5-base-paradetox-detox — модель преобразования текста, разработанная на основе google-t5/t5-base и дообученная на парах токсичных и нейтральных фраз из набора s-nlp/paradetox. Она переписывает английский оскорбительный или токсичный текст в более нейтральной форме, стараясь сохранить исходный смысл. Для генерации требуется префикс `detoxify: `.

Модель использует архитектуру T5 encoder-decoder и содержит 123,8 млн параметров по метаданным. Она принимает текст и генерирует текст; контекст — до 512 токенов, хотя обучение было ориентировано на короткие предложения, а длинные входы ограничиваются 64 токенами. В тестировании модель снижала долю выходов, распознанных классификатором как токсичные, но качество оценивалось автоматическими метриками, которые имеют собственные ограничения и смещения.

Модель предназначена для англоязычных коротких фраз. Она преимущественно удаляет или смягчает явно оскорбительные фрагменты и хуже справляется с косвенной токсичностью, сарказмом, угрозами и эвфемизмами; при этом может терять часть смысла. Это модель перефразирования, а не классификатор токсичности или фильтр безопасности. Лицензия — Apache-2.0.

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

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

Ограничения

Модель рассчитана на короткие английские фразы, требует префикса `detoxify: ` и может усекать длинный ввод. Она хуже обрабатывает косвенную токсичность, сарказм и угрозы, может терять смысл и не предназначена для классификации или фильтрации контента.

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

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

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

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

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

Открыть на Hugging Face

t5-base fine-tuned for text detoxification (ParaDetox)

Sequence-to-sequence text style transfer: rewrites English toxic/offensive text into neutral text while preserving the propositional content. Fine-tuned from google-t5/t5-base on s-nlp/paradetox.

Task formulation

Single-direction conditional generation with an explicit T5 task prefix:

input : detoxify: <toxic sentence>
target: <neutral sentence>

The prefix detoxify: is applied identically during training, evaluation and inference.

Model

Base modelgoogle-t5/t5-base
ArchitectureT5 encoder-decoder, ~223M parameters
Mixed precisionbf16
Max source length64 tokens
Max target length64 tokens

Training data

s-nlp/paradetox ships a single train split of parallel toxic/neutral sentence pairs. Validation and test splits were carved out of it.

Because a toxic sentence can carry up to three different crowd-written neutral paraphrases, the split is computed over unique source sentences, not over rows. A row-level random split would place two paraphrases of the same sentence in train and test and inflate every test metric.

SplitRows
train17760
validation1001
test983

Split strategy: group-aware over unique source sentences, seed 42. Split fingerprints (sha256 over the sorted unique sources, first 16 hex chars): train=5107f460c600b24a, validation=1553707e06c53e22, test=110b37a06c3c22fb.

Training hyperparameters

Optimizeradamw_torch
Learning rate0.0001
LR schedulerlinear
Warmup166 steps (0.06 ratio)
Weight decay0.01
Gradient clipping1.0
Per-device train batch16
Gradient accumulation2
Effective batch size32
Epochs5
Steps completed2220
Seed42
Training time13.1 min
Hardwarecuda:0 (NVIDIA GeForce RTX 5060 Ti, 15.9 GiB)

Checkpoint selection: best validation loss (eval_loss). The test split was not used for model or hyperparameter selection.

Best validation loss: 0.7999.

Generation configuration

Deterministic beam search; identical settings were used for every number below.

num_beams5
max_new_tokens64
length_penalty1.0
no_repeat_ngram_size3
early_stoppingTrue
do_sampleFalse

Evaluation

Held-out test split: 596 unique toxic inputs, 962 human references (multi-reference scoring).

1. Reference-based metrics

Measures overlap with human detoxifications. Necessary but not sufficient: a correct detoxification worded differently from the reference is penalised here. The copy-input column scores the unchanged toxic input against the same references and shows how much of any BLEU/ROUGE is simply rewarded for copying.

MetricFine-tuned t5-baseCopy-input baseline
bleu65.154354.6411
rouge184.665478.8245
rouge275.152964.9939
rougeL84.270278.4225
bertscore_precision95.474393.2649
bertscore_recall95.73995.8614
bertscore_f195.552794.5023

2. Classifier-based toxicity

Classifier: s-nlp/roberta_toxicity_classifier, threshold 0.5.

Detoxification rate = among inputs the classifier calls toxic, the share whose generated output the classifier calls non-toxic.

MeasurementValue
Input toxicity rate (%)100
Generated toxicity rate (%)13.59
Human reference toxicity rate (%)6.21
Mean P(toxic), input0.9903
Mean P(toxic), generated0.1319
Detoxification rate (%)86.41
Remaining-toxic rate (%)13.59
Newly-toxic rate (%)n/a
Reference detoxification rate (%)93.79

The classifier is a noisy proxy, not ground truth: false positives on quoted speech and reclaimed slurs, false negatives on implicit toxicity. The human references themselves do not reach a 0% toxicity rate, which bounds how much of the remaining rate is really model error.

3. Semantic preservation

Embeddings: sentence-transformers/all-MiniLM-L6-v2.

MeasurementValue
cos(input, generated) mean0.8744
cos(input, generated) median0.904
cos(input, generated) p100.7215
cos(input, human reference) mean0.7873
cos(generated, human reference) mean0.8366
Share of outputs below cos 0.5 (%)1.01

cos(input, human reference) is the practical ceiling: human annotators also drop content when they remove toxic spans.

4. Joint diagnostic

Among the 596 inputs classified toxic, 83.56% produced an output that is both classified non-toxic and stays within cosine 0.6 of the input.

This is an intersection of two noisy measurements, reported as a diagnostic. It is not an overall model score.

Example outputs

Input (toxic)ReferenceModel output
im glad the moron showed .I am glad he showed upim glad he showed .
and his idiot voters gave this trash the nuclear codes .and his voters gave him the nuclear codes.and his voters gave him the nuclear codes .
i sware i put music on it i dunno wer it went piece of shit ! !i sware i put music on it i dunno wer it wenti sware i put music on it i dunno wer it went bad
and i was not fucking cooking looAnd i was not cooking looand i was not cooking loo
jus becuz i like sex doesn make me ah hoe .jus becuz i like to make love doesn make me ah bad girl .Just because I like sex doesn't make me ah hoe.

Seeded random sample of the test split, not selected for quality.

Usage

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("thealper2/t5-base-paradetox-detox")
model = AutoModelForSeq2SeqLM.from_pretrained("thealper2/t5-base-paradetox-detox")

text = "You are an idiot and nobody likes you."
inputs = tokenizer("detoxify: " + text, return_tensors="pt")
outputs = model.generate(
    **inputs,
    num_beams=5,
    max_new_tokens=64,
    length_penalty=1.0,
    no_repeat_ngram_size=3,
    early_stopping=True,
    do_sample=False,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

The task prefix detoxify: is required. Without it the model is out of distribution.

Limitations

  • English only. ParaDetox is an English corpus of Reddit/Twitter/Jigsaw-style comments.
  • Trained on short, single-sentence inputs (source p99 = 38 tokens). Long or multi-sentence input is truncated at 64 tokens.
  • The dominant training pattern is toxic-span removal. The model deletes or softens offensive spans; it does not reliably rewrite implicit toxicity, sarcasm, dog whistles or threats phrased politely.
  • Detoxification and semantic preservation trade off against each other. Deleting a whole clause maximises the toxicity metric and damages the similarity metric; the two tables above must be read together.
  • Not a content-moderation system. It rewrites text, it does not detect, filter or classify it, and it must not be used as a safety filter.
  • No number here measures fluency or grammaticality.
  • Test metrics are computed with a classifier and an embedding model that have their own biases, including known demographic biases in toxicity classifiers.

Reproduction

python -m src.train
python -m src.evaluate
python -m src.qualitative

Config, dataset split fingerprints and the full training record are stored next to the weights (experiment_config.yaml).

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

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

GPU в ailist

Универсальный рантайм · transformers

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

Подбираем GPU…

Класс архитектуры
T5ForConditionalGeneration
Ревизия весов
8de8855

0 моделей