logo

BiasScope: Inference-Time Bias Detection and Mitigation for Fair Natural Language Processing (NLP) Using Retrieval-Augmented Generation and Prompt Engineering

Authors
  • Rakeshkumarreddy Ambati

    Author

Keywords:
Retrieval-Augmented Generation (RAG), Natural Language Processing (NLP), Large Language Models (LLMs), Bias Mitigation, Prompt Engineering, Responsible Artificial Intelligence
Abstract

The appearance of social stereotypes in Large Language Models (LLMs) is a crucial concern in research on fairness in the context of Natural Language Processing (NLP). This study focuses on gender bias, occupational stereotypes, gender comparisons, and trait attributions. Numerous mitigation techniques depend on fine-tuning and post-processing, which are typically expensive and difficult to audit. BiasScope is a lightweight framework that uses prompt engineering and RAG to detect and mitigate model biases at inference time without changing weights. We generate responses through the Gemini 2.5 Flash API in our implementation. The system (1) provides a baseline reply, followed by (2) scoring by a lexicon- and pattern-based detector with transparent functioning. When bias is detected, (3) it retrieves fairness guidance, followed by (4) generating a mitigated response from an augmented prompt. The mean composite bias score on the 26-prompt evaluation set is reduced by 72.1% after mitigation. This composite score combines four detector signals: toxicity, counterfactual sensitivity, stereotype co-occurrence, and sentiment and sentiment is treated as one signal among four, not as proof of bias. No formal user study of response quality was conducted; qualitative inspection of the outputs is reported in Section 4. BiasScope is designed to support multiple LLM backends and is fully traceable from detection to mitigation. It provides an effective means of achieving fairness and accountability in production Natural Language Processing (NLP).

References
Cover Image
Downloads
Published
2026-09-25
Section
Articles
License

Copyright (c) 2026 International Journal of Intelligent Systems and Data Science

Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 International License.

How to Cite

[1]
R. Ambati, “BiasScope: Inference-Time Bias Detection and Mitigation for Fair Natural Language Processing (NLP) Using Retrieval-Augmented Generation and Prompt Engineering”, Int. J. Intell. Syst. Data Sci., vol. 1, no. 5, Sep. 2026, doi: 10.67231/xbkga555.