Investigating the Potential Harms of Generative AI in the Justice System
This project examines biases in generative AI within the justice system, specifically evaluating the Gemini API’s fairness across sensitive topics like disability, nationality, ethnicity, and age.
Role
Coding Team Lead
Industry
Artificial Intelligence
Duration
4 months

Goal
This project examines biases in generative AI within the justice system, specifically evaluating the Gemini API’s fairness across sensitive topics like disability, nationality, ethnicity, and age. Using the Amazon Generalized Fairness Metrics dataset, we tested zero-shot, few-shot, and generic prompting techniques to detect bias and improve equitable outcomes. By examining how these biases manifest in the collection and analysis of text, photo, and audio evidence, we aim to ensure equitable outcomes in legal contexts.
Stage 1: Data Preparation
Downloaded the dataset and removed duplicates or missing values.
Created structured CSV files for efficient storage and analysis.
Generated templated sentences for sensitive categories using the dataset.
Stage 2. Modeling & Evaluation
Developed bias detection and sentiment analysis models.
Compared zero-shot, few-shot, and generic prompting techniques.
Used performance metrics like accuracy, F1-score, and precision-recall to evaluate model outcomes.
Tools and Libraries Used
Gemini API for sentiment analysis.
Amazon Generalized Fairness Metrics dataset.
Python libraries for data preprocessing and visualization.


Insights
Few-shot prompting outperformed other techniques, particularly for disability and ethnicity categories.
Zero-shot prompting exceeded expectations but struggled with nuanced interpretation.
Models often overemphasized negative terms, impacting performance.
Limitations
Limited sample size per category due to resource constraints.
Potential human bias in "true" sentiment labels.
Next Steps
Extend analysis to more categories and modalities (e.g., images, speech).
Experiment with advanced prompting methods like Chain of Thought reasoning.
Upgrade resources (e.g., Gemini Pro) to increase sample size.
Investigate real-world applications beyond justice (e.g., credit screening, hiring).
Installation and GitHub Link
Clone the repository:
git clone https://github.com/example/repository.git](https://github.com/alishabose/Relativity-1D)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.



Results and Key Findings
This project showed that prompting strategy meaningfully affects model behavior. Few-shot prompting consistently performed best, especially for disability and ethnicity-related sentiment, while zero-shot prompting worked better than expected but struggled with nuance. Across models, negative terms were often overemphasized, revealing how bias can surface even when technical accuracy appears strong. While the analysis was limited by sample size and the subjectivity of sentiment labels, the results reinforced the importance of careful prompt design and critical evaluation when deploying AI in sensitive contexts. This work highlighted both the potential and the risks of using generative models in real-world decision-making systems, and motivated future exploration into more robust prompting methods and broader application domains.