Introduction
Machine learning models are increasingly deployed in high-stakes domains such as credit scoring, hiring, and healthcare. However, these models often inherit or amplify societal biases, leading to unfair treatment based on protected attributes like gender or race. To mitigate this, engineers employ individual fairness testing, which seeks to identify "discriminatory instances"—pairs of individuals who are identical in all respects except for a protected attribute but receive different model outcomes.
Existing testing tools face two primary hurdles. First, they often generate "unnatural" or out-of-distribution data (e.g., a 10-year-old with a PhD) that does not reflect real-world scenarios, making the identified biases less relevant for practical model deployment. Second, many tools require access to model internals (gradients), which is impossible for black-box models. To address these issues, we introduce Latent Imitator (LIMI), a framework that leverages Generative Adversarial Networks (GANs) to find realistic discriminatory instances in a model's latent space.
The LIMI Framework
LIMI shifts the search for bias from the raw input space to the semantic latent space of a GAN. This approach is based on the "Naturalness Hypothesis": decision boundaries are typically surrounded by dense regions of the data distribution. By searching within the latent space that a GAN has learned to represent, LIMI ensures that generated test cases remain realistic.
As illustrated in the framework overview above, LIMI operates in three distinct phases:
- Latent Boundary Approximation: A GAN (such as CTGAN for tabular data) is trained on the original dataset. Random vectors are sampled from the GAN's latent space ($Z$) to generate synthetic data, which is then labeled by the black-box target model ($f_\theta$). This creates an auxiliary dataset used to train a simple linear SVM, which serves as a surrogate decision boundary ($h$) in the latent space.
- Latent Candidates Probing: Rather than using computationally expensive iterative searches, LIMI employs "one-step movement." It takes a random latent vector and mathematically projects it toward the surrogate boundary. To account for the non-linearity of the real boundary, LIMI probes additional candidates ($z_+$, $z_-$) on either side of the projection.
- Generation: These probed latent vectors are passed through the GAN’s generator ($G$) to produce high-quality, realistic test cases. These instances are then verified against the actual target model to confirm if they are truly discriminatory.
Experimental Evaluation
LIMI was evaluated on four standard tabular fairness benchmarks—Adult Income, German Credit, Bank Marketing, and the Medical Expenditure Panel Survey (MEPS)—as well as the CelebA image dataset for facial attribute detection.
Key Results
Compared to six state-of-the-art baselines (including AEQUITAS and ExpGA), LIMI demonstrated superior performance across multiple metrics:
- Effectiveness: LIMI generated 9.42x more discriminatory instances on average.
- Efficiency: The framework operated 8.71x faster, generating roughly 50 instances per second due to its reliance on simple vector arithmetic rather than complex optimization.
- Naturalness: The realism of generated instances improved by 19.65%. As shown in the distribution analysis below, LIMI's generated data closely overlaps with the original data distribution, whereas baselines like ExpGA often produce instances far outside the normal range.
Utility in Model Improvement
Beyond detection, LIMI proves useful for model hardening. When target models were retrained using the discriminatory instances generated by LIMI, individual fairness improved by up to 45.67% with negligible impact on overall predictive accuracy.
Conclusion and Future Work
LIMI demonstrates that searching for bias in a learned latent space is both more efficient and more effective than searching in raw input space. By approximating the decision boundary with a linear surrogate, LIMI bypasses the need for model gradients while maintaining high realism.
Future research will focus on reducing the dependency on GAN quality to avoid issues like mode collapse and extending the framework to Natural Language Processing (NLP), where the sequential nature of text makes latent manipulation more challenging.
Summary updated