Facilitating NSFW Text Detection in Open-Domain Dialogue Systems via Knowledge Distillation

Zhenzhong LanarXiv 2023 · DOI · arXiv

TL;DR

This paper introduces CENSORCHAT, a novel dataset and methodology for detecting Not Safe For Work (NSFW) content in open-domain dialogue systems. By leveraging knowledge distillation from powerful LLMs like GPT-4 and ChatGPT, they create a cost-effective and accurate NSFW text detector, addressing a critical gap in current AI safety research.

What Problem Does This Paper Address?

As open-domain dialogue systems become more prevalent, ensuring user safety and well-being is paramount. A significant challenge arises when these systems encounter or generate NSFW content, which can have detrimental effects on users. While NSFW detection exists for static content like online posts, its application within dynamic, multi-turn dialogues has been significantly underdeveloped. Existing methods often struggle with the nuances of conversational context and can be prohibitively expensive to scale. This paper tackles this gap by proposing a practical and efficient approach to NSFW text detection specifically tailored for dialogue systems.

Methods

The core of the proposed solution lies in knowledge distillation and a self-criticism strategy.

  1. Data Annotation: The process begins by collecting real-life human-machine interaction data. This data is then split into individual utterances and single-turn dialogues (where the chatbot delivers the final utterance).
  2. Knowledge Distillation:
    • Training Set: ChatGPT is used to annotate a large portion of the unlabeled data, creating pseudo-labeled data for training.
  3. Validation & Test Sets: Both GPT-4 and ChatGPT are employed as annotators for the validation and test sets.
  4. Self-Criticism Strategy: To resolve discrepancies in labeling between GPT-4 and ChatGPT, a self-criticism strategy is employed. This involves prompting the LLMs to review and correct their own annotations, significantly improving label agreement. The paper notes that Cohen's Kappa values increase substantially with this strategy, indicating near-perfect agreement.
  5. Model Training: A BERT model is then fine-tuned as a text classifier on the pseudo-labeled data generated through this process.

Datasets

The paper introduces CENSORCHAT, a new large-scale dialogue monitoring dataset specifically designed for NSFW dialogue detection. This dataset is constructed from real-life human-machine interactions and is split into utterance-level and context-level data. The statistics show a significant number of SFW examples (31,966 for utterance-level, 36,370 for context-level) compared to NSFW examples (7,783 for utterance-level, 11,257 for context-level) across training, validation, and test sets.

Key Insights and Ideas

  • Cost-Effective Annotation: Knowledge distillation from powerful LLMs like GPT-4 and ChatGPT offers a significantly more cost-effective and time-efficient alternative to traditional crowdsourcing for creating large NSFW detection datasets.
  • The Power of Self-Criticism: The self-criticism strategy is crucial for improving the reliability and agreement of LLM-generated labels, especially when dealing with nuanced or ambiguous content. This highlights the potential of LLMs to not only generate but also critically evaluate data.
  • Dialogue Context Matters: The paper emphasizes the importance of context-level detection, as an utterance's NSFW status can heavily depend on the preceding conversation.
  • Bridging the Gap: CENSORCHAT directly addresses the under-researched area of NSFW detection within dialogue systems, moving beyond static text analysis.

Key Results

The fine-tuned BERT classifier achieved promising results:

  • NSFW Precision: 0.59
  • NSFW Recall: 0.96
  • Overall Accuracy: 0.91

The paper notes that while there are some NSFW instances misclassified as SFW, the model demonstrates a strong ability to identify NSFW content, with fewer SFW instances being incorrectly flagged. The self-criticism strategy significantly improved inter-annotator agreement (Cohen's Kappa > 0.8) between GPT-4 and ChatGPT.

Limitations and Future Work

  • Limitations: The paper acknowledges that even with the self-criticism strategy, there are instances where the model might misclassify NSFW content as SFW, and vice-versa. The "Undeterminable" responses from ChatGPT for some inputs were manually corrected, indicating that LLMs are not infallible.
  • Future Work: The authors suggest that the CENSORCHAT dataset and the knowledge distillation approach pave the way for developing more effective and efficient NSFW dialogue detection systems, aligning with evolving user protection needs in AI. Further research could explore more sophisticated distillation techniques or investigate the ethical implications of such detection systems.

Summary updated

BibTeX
@misc{lan2023facilitating,
  author = {Zhenzhong Lan},
  title = {{Facilitating NSFW Text Detection in Open-Domain Dialogue Systems via Knowledge Distillation}},
  year = {2023},
  eprint = {2309.09749},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.09749},
}
Figure