SlangLLM: Dynamic Detection and Contextual Filtering of Slang in NLP Applications
Laksh Patel, Anas Alsobeh · 2025
The inherent speed at which slang evolves and its context-dependent nature make it difficult for Large Language Models (LLMs) to detect poisonous terms They often miss harmful slang and struggle to detect benign uses of such terms. We present SlangLLM1, a flexible framework that tackles these limitations, accomplishing this by combining frequencybased scoring, part-of-speech (PoS) weighting, and crowd-sourced definitions from Urban Dictionary. Dependency relations and semantic similarity ensure contextual filtering to identify toxic prompts correctly. Leveraging a new “slang poison level” metric, SlangLLM both quantifies toxicity and infers prompt permissibility. Experiments show that it is effective at guarding LLMs against poisonous slang prompts, significantly improving over baseline methods for slang-based toxicity while still allowing safe usages. This research contributes to ethical AI practices by improving the resilience of LLMs in conversational and content moderation scenarios. SlangLLM can serve as a preventative measure, used by law enforcement, to avert crime by analyzing social media accurately.0251https://github.com/lakshRP/SlangLLM