Skip to content

Anantaverma20/AI-Judge-Alignment-Checker

Repository files navigation

AI Judge Alignment Checker

A meta-evaluation system that detects bias, inconsistency, and hallucinated rationales in automated LLM judges. Uses the PubMedQA medical QA dataset to stress-test whether AI evaluators can actually be trusted.

Live Dashboard: Streamlit App


Key Findings

Finding Value
Gemini positional bias 61.5% (threshold: 10%)
Gemini hallucinated rationale 96.9% (threshold: 5%)
Krippendorff's Alpha (cross-judge) -0.15 (judges agree less than chance)
Gemini vs Human expert correlation -0.13 (anti-correlated with ground truth)

What It Does

  1. Runs 5 judges (Gemini LLM, ROUGE-like, BERTScore-like, Regex Tripwire, Human Gold Labels) on 200 PubMedQA examples
  2. Generates adversarial test variants (position-swap, paraphrase, length, tripwire) — 6 variants per example, 6000 total evaluations
  3. Detects 6 bias types: positional bias, verbosity bias, self-enhancement, inconsistency, hallucinated rationale, calibration failure
  4. Computes cross-judge agreement (Cohen's Kappa, Krippendorff's Alpha)
  5. Produces a Judge Health Report with composite trust scores and a Streamlit dashboard

Setup

git clone https://github.com/Anantaverma20/AI-Judge-Alignment-Checker.git
cd AI-Judge-Alignment-Checker

python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

pip install -r requirements.txt

Optional — set a Gemini API key for live LLM judging (free from aistudio.google.com):

export GOOGLE_API_KEY="your-key-here"

Without a key, Gemini falls back to a deterministic offline scorer.


Usage

# Process PubMedQA data
python main.py --process-data

# Run full pipeline (judges + detectors + reports)
python main.py --run-all

# Launch the dashboard
streamlit run app/streamlit_app.py

Project Structure

├── judges/          # 5 judge implementations (LLM, rule-based, human gold)
├── detectors/       # 6 bias detectors + adversarial test suite
├── reports/         # Agreement metrics, health report, disagreement map
├── alignment/       # LoRA fine-tuning pipeline scaffold
├── app/             # Streamlit dashboard
├── data/            # PubMedQA loader and processing
├── outputs/         # Pre-computed results (JSON)
├── tests/           # Regression tests
├── main.py          # CLI entry point
└── technical_design.md  # Full TDD with experiment + decision logs

Tech Stack

Python, Streamlit, Plotly, scikit-learn, SciPy, Google Generative AI (Gemini), Hugging Face Datasets, Krippendorff


License

MIT

About

Meta-evaluation system that detects bias, inconsistency, and hallucinated rationales in LLM judges using PubMedQA

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages