Downloads · 30 days
25
11% of all-time downloads
s-nlp/bart_large_pseudoparadetox_llama3_70b_10shot_patched
bart_large_pseudoparadetox_llama3_70b_10shot_patched is a text generation model from s-nlp. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as openrail++.
This model is a BART-large sequence-to-sequence model fine-tuned for English Text Detoxification (style transfer from toxic to neutral). It was trained on the PseudoParaDetox dataset, which was synthetically generated…
Downloads · 30 days
25
11% of all-time downloads
All-time downloads
223
Public
Parameters
406M
1.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.6 GB · 100%
From the Hugging Face model README
This model is a BART-large sequence-to-sequence model fine-tuned for English Text Detoxification (style transfer from toxic to neutral). It was trained on the PseudoParaDetox dataset, which was synthetically generated using the Llama 3 70B Instruct LLM in a 10-shot setting, leveraging Activation Patching to bypass safety alignment during the data generation phase.
The resulting detoxification model demonstrates high fluency and content preservation scores, outperforming models trained on the original human-annotated ParaDetox dataset in manual human evaluation.
facebook/bart-largeThe model is intended for the automatic rewriting of toxic, offensive, or rude English input text into a polite or neutral tone, while maintaining the original semantic meaning and fluency.
This model can be integrated into larger content moderation pipelines, specifically handling the mitigation step after toxicity detection.
The model is trained strictly for English detoxification. It should not be used for:
This model inherits typical limitations of text style transfer models:
We recommend systematic testing on new domain data before deployment. Users should implement a post-processing toxicity classifier to confirm that the detoxified output is truly non-toxic, as detoxification is not guaranteed in 100% of cases.
Use the code below to get started with the model:
from transformers import pipeline
# Note: Replace 'Model ID' with the actual Hugging Face path once available
detoxifier = pipeline("text2text-generation", model="s-nlp/bart-large-pseudoparadetox-llama3-70b-10shot")
toxic_text = "You are dumb idiot!"
result = detoxifier(toxic_text, max_length=128)
print(result[0]['generated_text'])
# Expected Output: You are wrong! (or similar neutral rewrite)
The model was fine-tuned on PseudoParaDetox, a synthetic dataset generated by the Llama 3 70B Instruct model. The source texts were derived from the toxic side of the ParaDetox corpus. The generation utilized a 10-shot prompt setup to guide the LLM's rewriting process. This generation was facilitated by an Activation Patching technique to prevent the LLM from refusing to generate detoxified output for highly toxic inputs.
The BART-large model was fine-tuned using the following key parameters:
The final model performance was assessed using a combination of automatic metrics (on the ParaDetox test set) and side-by-side comparisons using GPT-4o, followed by manual human evaluation.
ParaDetox private test split (671 texts).
The results below reflect the performance of BART fine-tuned on the Llama 3 70B A.P. 10-shot data, compared against the baseline BART trained on the original human-annotated ParaDetox data.
| Metric | BART (Original ParaDetox) | BART (PseudoParaDetox 70B AP 10-shot) |
|---|---|---|
| STA (Auto) | 0.876 | 0.842 |
| SIM (Auto) | 0.616 | 0.594 |
| FL (Auto) | 0.824 | 0.866 |
| Joint Score (J) | 0.444 | 0.434 |
| Manual J Score | 0.661 | 0.762 |
| GPT-4o Win Rate vs. Baseline | - | 65% |
While automatic metrics show comparable performance, the superior Manual Joint Score (J=0.762) and high GPT-4o side-by-side win rate (65%) indicate that the data generated using the patched LLM results in subjectively higher-quality detoxification compared to the original crowdsourced data.
BibTeX:
@inproceedings{moskovskiy-etal-2024-llms,
title = "{LLM}s to Replace Crowdsourcing For Parallel Data Creation? The Case of Text Detoxification",
author = "Moskovskiy, Daniil and
Pletenev, Sergey and
Panchenko, Alexander",
editor = "Al-Onaizan, Yaser and
Bansal, Mohit and
Chen, Yun-Nung",
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2024",
month = nov,
year = "2024",
address = "Miami, Florida, USA",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2024.findings-emnlp.839/",
doi = "10.18653/v1/2024.findings-emnlp.839",
pages = "14361--14373",
abstract = "The lack of high-quality training data remains a significant challenge in NLP. Manual annotation methods, such as crowdsourcing, are costly, require intricate task design skills, and, if used incorrectly, may result in poor data quality. From the other hand, LLMs have demonstrated proficiency in many NLP tasks, including zero-shot and few-shot data annotation. However, they often struggle with text detoxification due to alignment constraints and fail to generate the required detoxified text. This work explores the potential of modern open source LLMs to annotate parallel data for text detoxification. Using the recent technique of activation patching, we generate a pseudo-parallel detoxification dataset based on ParaDetox. The detoxification model trained on our generated data shows comparable performance to the original dataset in automatic detoxification evaluation metrics and superior quality in manual evaluation and side-by-side comparisons."
}
APA: Moskovskiy, D., Pletenev, S., & Panchenko, A. (2024, November). Llms to replace crowdsourcing for parallel data creation? the case of text detoxification. In Findings of the Association for Computational Linguistics: EMNLP 2024 (pp. 14361-14373).