TuneShield: Mitigating Toxicity in Conversational AI while Fine-tuning on Untrusted Data

Aravind Cheruvu, Shravya Kanchi, Sifat Muhammad Abdullah, Nicholas Kong, Daphne Yao +2 more
7/8/2025
cs.CRcs.AIcs.CL

No confident code implementation found for this paper.

Abstract

Recent advances in foundation models, such as LLMs, have revolutionized conversational AI. Chatbots are increasingly being developed by customizing LLMs on specific conversational datasets. However, mitigating toxicity during this customization, especially when dealing with untrusted training data, remains a significant challenge. To address this, we introduce TuneShield, a defense framework designed to mitigate toxicity during chatbot fine-tuning while preserving conversational quality. TuneShield leverages LLM-based toxicity classification, utilizing the instruction-following capabilities and safety alignment of LLMs to effectively identify toxic samples, outperforming industry API services. TuneShield generates synthetic conversation samples, termed 'healing data', based on the identified toxic samples, using them to mitigate toxicity while reinforcing desirable behavior during fine-tuning. It performs an alignment process to further nudge the chatbot towards producing desired responses. Our findings show that TuneShield effectively mitigates toxicity injection attacks while preserving conversational quality, even when the toxicity classifiers are imperfect or biased. TuneShield proves to be resilient against adaptive adversarial and jailbreak attacks. Additionally, TuneShield demonstrates effectiveness in mitigating adaptive toxicity injection attacks during dialog-based learning (DBL).

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{cheruvu2025tuneshield,
  title  = {TuneShield: Mitigating Toxicity in Conversational AI while Fine-tuning on Untrusted Data},
  author = {Aravind Cheruvu and Shravya Kanchi and Sifat Muhammad Abdullah and Nicholas Kong and Daphne Yao and Murtuza Jadliwala and Bimal Viswanath},
  year   = {2025},
  eprint = {2507.05660},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.05660v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.05660.svg)](https://codeofpaper.com/paper/2507.05660)

Discussion