FairPrompt: Efficient Multi-Objective Prompt Optimization for Fairness Testing in Conversational AI Systems
Zunaira Shafqat, Atif Aftab Ahmed Jilani, Nigar Azhar Butt, Shafiq Ur Rehman, Muhammad Usman Khalid, Volker Gruhn · IEEE Access · 2025
As conversational AI systems become integral to real-world applications, ensuring fairness and minimizing social bias has become a critical research challenge. Existing fairness testing approaches often rely on exhaustive or template-based prompt generation, which limits scalability and struggles to capture the diversity of natural language. In this paper, we present FairPrompt, a novel multi-objective prompt optimization framework that leverages the Non-dominated Sorting Genetic Algorithm II (NSGA-II) to efficiently identify a high-quality subset of prompts for bias elicitation. Unlike prior methods, FairPrompt explicitly optimizes for three objectives—semantic diversity, bias detection rate, and prompt uniqueness with balanced demographic coverage—within a large prompt search space. The framework operates in five systematic stages: (1) constructing a bias dataset from social group–bias property tuples, (2) generating yes/no, wh-, and choice-based prompts using NLP techniques, (3) applying n-gram, cosine similarity, and embedding-based methods for bias detection, (4) employing NSGA-II to select an optimized “Prompt Set,” and (5) measuring fairness via Bias Detection Rate and Preference Rate across demographic categories.We evaluate FairPrompt on two state-of-the-art conversational AI systems—BlenderBot (400M parameters) and GPT-3.5 Turbo—using Random Sampling and BiasAsker as baselines. Across 30 experimental runs with a 30% prompt sample size, FairPrompt demonstrates up to 50% reduction in computational cost while achieving significantly higher bias detection rates and broader coverage across multiple social dimensions (e.g., gender, race, body, ability). These results establish FairPrompt as a scalable, model-agnostic framework for fairness testing in conversational AI, offering a more efficient and comprehensive pathway toward building robust and socially responsible AI systems.