Beyond Surface Forms: A Comprehensive, Mechanism-Oriented Taxonomy of Indirect Linguistic Encoding for LLM-Based Coded Language Detection
By Hamid Reza Firoozfar, Mohammadsadegh Abolhasani, Reza Mousavi, Paul Jen-Hwa Hu
"Proposes a mechanism-oriented taxonomy of indirect linguistic encoding to improve LLM-based detection of coded language on social media, achieving 4.7% accuracy gain over baselines."
Abstract
To avoid moderation and surveillance on social media, some users routinely invent indirect linguistic expressions (ILE) that camouflage sensitive meanings. Such expressions surface as algospeak, euphemisms, and adversarial obfuscation, depending on intent and context, and they involve recurring encoding mechanisms. We propose a comprehensive, mechanism-oriented taxonomy of ILE that abstracts away from communicative goals and instead categorizes the underlying operations through which meaning is encoded and recovered. We evaluate the taxonomy by incorporating it into LLM prompts and comparing it with four existing taxonomies and a no-taxonomy baseline, using 2,000 manually annotated TikTok and Bluesky posts. The proposed taxonomy attains the strongest document- and span-level performance across the three LLMs, achieving an improvement of 4.7% in accuracy and 5.4% in F1 over the best-performing benchmark. The empirical results reveal the importance of a comprehensive, mechanism-oriented taxonomy as a stable scaffold for detecting emerging coded language and a useful input to content moderation. Disclaimer: This paper contains content that may be profane, vulgar, or offensive.
Technical Analysis & Implementation
Methodology§
The paper introduces a comprehensive, mechanism-oriented taxonomy of Indirect Linguistic Expressions (ILE) for detecting coded language in social media posts. The taxonomy categorizes underlying operations (e.g., euphemism, metaphor, abbreviation) rather than surface forms. It is integrated into LLM prompts to guide the model's reasoning about encoding and decoding of sensitive meanings.
Core Innovation§
Instead of using a fixed list of coded terms, the taxonomy provides a structured set of mechanisms:
$$\text{ILE Mechanisms} = \{M_1, M_2, \dots, M_k\}$$
Each mechanism $M_i$ is a transformation (e.g., substitution, deletion) applied to a target meaning. The LLM is prompted to classify posts and identify spans using these mechanisms as reasoning anchors.
Evaluation§
Tested on 2,000 manually annotated posts from TikTok and Bluesky. Three LLMs (e.g., GPT-4, Llama-2, Mistral) were evaluated with five conditions: no taxonomy, four existing taxonomies (binary, topical, pragmatic, mixed), and the proposed taxonomy. Metrics:
- Document-level accuracy: $$\text{Acc} = \frac{\# \text{correct detections}}{\# \text{total posts}}$$
- Span-level F1: $$F_1 = 2 \cdot \frac{P \cdot R}{P + R}$$
The proposed taxonomy achieved 4.7% higher accuracy and 5.4% higher F1 than the best baseline.
Practical Implementation§
A prompt template includes the taxonomy definition and instructions:
# Example prompt construction for ILE detection
prompt = f"""You are a coded language detection system. Use the following taxonomy of encoding mechanisms:
{', '.join(taxonomy_mechanisms)}
Classify the post below. If it contains ILE, list the spans and their mechanisms.
Post: {post_text}
"""
response = llm.generate(prompt)For span-level prediction, a simple PyTorch evaluation loop:
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("model-name")
model = AutoModelForSequenceClassification.from_pretrained("model-name")
def evaluate_span(posts, spans_true, taxonomy_prompt):
preds = []
for post in posts:
prompt = f"{taxonomy_prompt}\nPost: {post}"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model(**inputs)
# ... parse logits to detect spans ...
preds.append(parsed_spans)
return classification_report(spans_true, preds)Implications§
The taxonomy acts as a stable scaffold, enabling LLMs to generalize to emerging coded language without retraining. It highlights the importance of explicit encoding mechanisms over surface-form lists for content moderation.
Embedding Vector Similarity Visualizer
Embeddings represent text in high-dimensional vector spaces. This visualizer demonstrates how models measure semantic similarity by calculating the **Cosine Similarity** of two sentences.
Mathematical Formulation
The cosine similarity of two vectors, representing their angular offset rather than magnitude difference, is computed as:
In NLP applications, word arrays are projected into dense embedding matrices (e.g. 1536 dimensions). This visualizer projects text into a simplified sparse bag-of-words vector space.
Accelerate your workflow with Feedalyze
AI churn detection for SaaS. Know which customers will leave before they do.
Free plan available · Connects to HubSpot, Intercom, Zendesk