Fairness Testing in Retrieval-Augmented Generation: How Small Perturbations Reveal Bias in Small Language Models

📅 2025-09-30
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This study uncovers a novel fairness risk in Retrieval-Augmented Generation (RAG) systems when deployed with small language models (SLMs): the external retrieval component can amplify biases triggered by sensitive demographic cues—such as race—exacerbating fairness violations beyond hallucination. We propose the first framework systematically applying metamorphic testing (MT) to assess RAG fairness, conducting sentiment analysis experiments on Llama and Mistral SLMs under controlled demographic perturbations. Results show that approximately one-third of metamorphic relations are violated by minor demographic perturbations; a hierarchical bias structure emerges with race as the top-level attribute; and all three evaluated SLMs exhibit significant fairness vulnerabilities. This work pioneers the integration of metamorphic testing with RAG fairness analysis, delivering a reproducible, empirically grounded methodology for bias detection in trustworthy RAG systems.

Technology Category

Application Category

📝 Abstract
Large Language Models (LLMs) are widely used across multiple domains but continue to raise concerns regarding security and fairness. Beyond known attack vectors such as data poisoning and prompt injection, LLMs are also vulnerable to fairness bugs. These refer to unintended behaviors influenced by sensitive demographic cues (e.g., race or sexual orientation) that should not affect outcomes. Another key issue is hallucination, where models generate plausible yet false information. Retrieval-Augmented Generation (RAG) has emerged as a strategy to mitigate hallucinations by combining external retrieval with text generation. However, its adoption raises new fairness concerns, as the retrieved content itself may surface or amplify bias. This study conducts fairness testing through metamorphic testing (MT), introducing controlled demographic perturbations in prompts to assess fairness in sentiment analysis performed by three Small Language Models (SLMs) hosted on HuggingFace (Llama-3.2-3B-Instruct, Mistral-7B-Instruct-v0.3, and Llama-3.1-Nemotron-8B), each integrated into a RAG pipeline. Results show that minor demographic variations can break up to one third of metamorphic relations (MRs). A detailed analysis of these failures reveals a consistent bias hierarchy, with perturbations involving racial cues being the predominant cause of the violations. In addition to offering a comparative evaluation, this work reinforces that the retrieval component in RAG must be carefully curated to prevent bias amplification. The findings serve as a practical alert for developers, testers and small organizations aiming to adopt accessible SLMs without compromising fairness or reliability.
Problem

Research questions and friction points this paper is trying to address.

Testing fairness vulnerabilities in small language models using RAG pipelines
Assessing how demographic perturbations reveal bias in sentiment analysis
Investigating bias amplification through retrieval-augmented generation components
Innovation

Methods, ideas, or system contributions that make the work stand out.

Metamorphic testing introduces demographic perturbations in prompts
Evaluates fairness in sentiment analysis using RAG pipelines
Reveals bias hierarchy with racial cues causing most violations
🔎 Similar Papers
2024-09-29International Conference on Computational LinguisticsCitations: 4
M
Matheus Vinicius da Silva de Oliveira
Faculty of Computing - Federal University of Mato Grosso do Sul
J
Jonathan de Andrade Silva
Faculty of Computing - Federal University of Mato Grosso do Sul
A
Awdren de Lima Fontao
Faculty of Computing - Federal University of Mato Grosso do Sul