A meta-evaluation on the relationship between the different components in a RAG system and the social biases presented in the generated text across three languages.
Python
1
6 commits
updated Jan 22, 2026
This repository contains the code and data for the paper:
Evaluating the Effect of Retrieval Augmentation on Social Biases
We study how Retrieval-Augmented Generation (RAG) affects social biases in Large Language Models (LLMs) across multiple bias types (gender, age, race, religion) and languages (English, Chinese, Japanese), using the BBQ benchmark.
This guide explains how to prepare the datasets and reproduce the experimental results in the paper.
Download the Dataset
Obtain the dataset files from the dataset folder (or the provided release link).
Extract the Dataset
Unzip the downloaded files and move all contents into the code directory, while preserving the original folder structure.
After this step, you should see directories such as addressed_dataset/ and addressed_corpus/ under the project root.
Before running any RAG-based evaluation, you must first retrieve documents for each bias subtype.
This is done using context_rag.py.
context_rag.pybias (stereotypical)anti (anti-stereotypical)full (mixed)python context_rag.py \
--question_path addressed_dataset/Gender.jsonl \
--retrieved_info_path retrieved_info/gender \
--corpus bias \
--retriever VectorIndexRetriever \
--top_k 10
After running this script, the retrieved documents will be saved as:
retrieved_info/<bias_type>/<corpus>_corpus.jsonl
⚠️ This step is mandatory. main.py assumes retrieved documents already exist.
After document retrieval is completed, you can reproduce the experimental results reported in the paper by running main.py.
main.pyaddressed_datasetretrieved_infopython main.py \
--question_path addressed_dataset/Gender.jsonl \
--retrieved_info_path retrieved_info/gender/retrieved_ten \
--model_name gpt-3.5-turbo \
--corpus bias \
--if_retrieve True
@article{zhang2025evaluating,
title={Evaluating the Effect of Retrieval Augmentation on Social Biases},
author={Zhang, Tianhui and Zhou, Yi and Bollegala, Danushka},
journal={arXiv preprint arXiv:2502.17611},
year={2025}
}
A meta-evaluation on the relationship between the different components in a RAG system and the social biases presented in the generated text across three languages.
Python
1
6 commits
updated Jan 22, 2026
This repository contains the code and data for the paper:
Evaluating the Effect of Retrieval Augmentation on Social Biases
We study how Retrieval-Augmented Generation (RAG) affects social biases in Large Language Models (LLMs) across multiple bias types (gender, age, race, religion) and languages (English, Chinese, Japanese), using the BBQ benchmark.
This guide explains how to prepare the datasets and reproduce the experimental results in the paper.
Download the Dataset
Obtain the dataset files from the dataset folder (or the provided release link).
Extract the Dataset
Unzip the downloaded files and move all contents into the code directory, while preserving the original folder structure.
After this step, you should see directories such as addressed_dataset/ and addressed_corpus/ under the project root.
Before running any RAG-based evaluation, you must first retrieve documents for each bias subtype.
This is done using context_rag.py.
context_rag.pybias (stereotypical)anti (anti-stereotypical)full (mixed)python context_rag.py \
--question_path addressed_dataset/Gender.jsonl \
--retrieved_info_path retrieved_info/gender \
--corpus bias \
--retriever VectorIndexRetriever \
--top_k 10
After running this script, the retrieved documents will be saved as:
retrieved_info/<bias_type>/<corpus>_corpus.jsonl
⚠️ This step is mandatory. main.py assumes retrieved documents already exist.
After document retrieval is completed, you can reproduce the experimental results reported in the paper by running main.py.
main.pyaddressed_datasetretrieved_infopython main.py \
--question_path addressed_dataset/Gender.jsonl \
--retrieved_info_path retrieved_info/gender/retrieved_ten \
--model_name gpt-3.5-turbo \
--corpus bias \
--if_retrieve True
@article{zhang2025evaluating,
title={Evaluating the Effect of Retrieval Augmentation on Social Biases},
author={Zhang, Tianhui and Zhou, Yi and Bollegala, Danushka},
journal={arXiv preprint arXiv:2502.17611},
year={2025}
}