mlsanityData to 7 Oct 2026

Legilimens: Practical and Unified Content Moderation for Large Language Model Services

arXiv 2408.15488 ↗First posted 28 Aug 2024cs.CLcited by 13

On the map: LLM safety and security → Safety alignment, refusal and guardrails

Abstract (arXiv)

Given the societal impact of unsafe content generated by large language models (LLMs), ensuring that LLM services comply with safety standards is a crucial concern for LLM service providers. Common content moderation methods are limited by an effectiveness-and-efficiency dilemma, where simple models are fragile while sophisticated models consume excessive computational resources. In this paper, we reveal for the first time that effective and efficient content moderation can be achieved by extracting conceptual features from chat-oriented LLMs, despite their initial fine-tuning for conversation rather than content moderation. We propose a practical and unified content moderation framework for LLM services, named Legilimens, which features both effectiveness and efficiency. Our red-team model-based data augmentation enhances the robustness of Legilimens against state-of-the-art jailbreaking. Additionally, we develop a framework to theoretically analyze the cost-effectiveness of Legilimens compared to other methods. We have conducted extensive experiments on five host LLMs, seventeen datasets, and nine jailbreaking methods to verify the effectiveness, efficiency, and robustness of Legilimens against normal and adaptive adversaries. A comparison of Legilimens with both commercial and academic baselines demonstrates the superior performance of Legilimens. Furthermore, we confirm that Legilimens can be applied to few-shot scenarios and extended to multi-label classification tasks.

Key facts. Cited by 13 papers in the map (data through 7 Oct 2026). Placed in Safety alignment, refusal and guardrails, one of 12 directions in LLM safety and security. Builds on 50 of its 92 references that are in the map. First posted on arXiv 28 Aug 2024.

Builds on

50 of 92 references.

Closest ancestors · 2

Same direction, newest first

  1. 2023Robust Safety Classifier for Large Language Models: Adversarial Prompt Shield31 Oct
  2. 2023Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!5 Oct

Other references · 48

  1. 2017Attention Is All You Needcited by 59,932
  2. 2015Deep Residual Learning for Image Recognitioncited by 51,809
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  5. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  6. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  7. 2016Layer Normalizationcited by 5,579
  8. 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,634
  9. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
  10. 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
  11. 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
  12. 2020GLU Variants Improve Transformercited by 1,724
36 more
  1. 2023Jailbroken: How Does LLM Safety Training Fail?cited by 1,565
  2. 2019Generating Long Sequences with Sparse Transformerscited by 1,523
  3. 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,330
  4. 2023Jailbreaking Black Box Large Language Models in Twenty Queriescited by 1,326
  5. 2021A General Language Assistant as a Laboratory for Alignmentcited by 1,023
  6. 2021Ethical and social risks of harm from Language Modelscited by 957
  7. 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Datasetcited by 828
  8. 2023The RefinedWeb Dataset for Falcon LLM: Outperforming Curated Corpora with Web Data, and Web Data Onlycited by 755
  9. 2017Automated Hate Speech Detection and the Problem of Offensive Languagecited by 724
  10. 2019Universal Adversarial Triggers for Attacking and Analyzing NLPcited by 709
  11. 2019Fast Transformer Decoding: One Write-Head is All You Needcited by 700
  12. 2016Language Modeling with Gated Convolutional Networkscited by 688
  13. 2019Unified Language Model Pre-training for Natural Language Understanding and Generationcited by 668
  14. 2023Tree of Attacks: Jailbreaking Black-Box LLMs Automaticallycited by 619
  15. 2023Jailbreaking ChatGPT via Prompt Engineering: An Empirical Studycited by 478
  16. 2023GPT-4 Is Too Smart To Be Safe: Stealthy Chat with LLMs via Ciphercited by 401
  17. 2021A Survey of Transformerscited by 399
  18. 2022A Holistic Approach to Undesired Content Detection in the Real Worldcited by 337
  19. 2018Adversarial Example Generation with Syntactically Controlled Paraphrase Networkscited by 282
  20. 2017Generating Natural Adversarial Examplescited by 182
  21. 2019Build it Break it Fix it for Dialogue Safety: Robustness from Adversarial Human Attackcited by 176
  22. 2024COLD-Attack: Jailbreaking LLMs with Stealthiness and Controllabilitycited by 162
  23. 2024AdvPrompter: Fast Adaptive Adversarial Prompting for LLMscited by 146
  24. 2019Text Processing Like Humans Do: Visually Attacking and Shielding NLP Systemscited by 99
  25. 2020Toxicity Detection: Does Context Really Matter?cited by 93
  26. 2023Identifying and Mitigating the Security Risks of Generative AIcited by 90
  27. 2024JailbreakRadar: Comprehensive Assessment of Jailbreak Attacks Against LLMscited by 87
  28. 2020OpenAttack: An Open-source Textual Adversarial Attack Toolkitcited by 84
  29. 2020Measuring a hate speech spectrum with faceted Rasch item response theory and perspective-aware, explainable-by-design deep learningcited by 67
  30. 2024Risk Taxonomy, Mitigation, and Assessment Benchmarks of Large Language Model Systemscited by 63
  31. 2022Transcending Scaling Laws with 0.1% Extra Computecited by 55
  32. 2023Evaluating GPT-3 Generated Explanations for Hateful Content Moderationcited by 44
  33. 2023Adapting Large Language Models for Content Moderation: Pitfalls in Data Engineering and Supervised Fine-tuningcited by 28
  34. 2024GPT-4 Jailbreaks Itself with Near-Perfect Success Using Self-Explanationcited by 24
  35. 2021Automatically Exposing Problems with Neural Dialog Modelscited by 5
  36. 2023Analyzing Norm Violations in Live-Stream Chatcited by 3

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 3; 2025: 4; 2026: 6.

13 papers.

Sort:

By area: