# LLM Judge Bias Check: Position and Length Swap Test

> Tests whether your LLM judge is biased by answer order or answer length, using a swap test with confidence intervals, and ends with a plain trust verdict, so you do not publish a win rate or train a reward model on a judge that mostly prefers the first or the longest answer.

LLM Judge Bias Check: Position and Length Swap Test is a free AI agent skill on Agensi by Vijay Kumar. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Vijay Kumar](https://www.agensi.io/creators/vijay-kumar-1)
- Version: 1.1.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/llm-judge-bias-check-position-and-length-swap-test
- Tags: llm-as-judge, pairwise-evaluation, position-bias, verbosity-bias, swap-test, win-rate, cohens-kappa, reward-model

## What it does

- Builds both orderings of every A/B pair so the judge sees each answer in each position
- Measures the conflict rate, meaning how often the verdict flips with order, with a 95% interval
- Reports first-slot win rate to expose position bias, and swap-to-tie label shares
- Compares how often the longer answer wins for the judge and for humans, and checks equal-length pairs
- Reports agreement with human labels as exact match and Cohen's kappa, with and without ties
- Runs sanity checks on identical and empty answers and gives a clear trust verdict

## Who it's for

- **ML engineers building evals:** Check your judge before you trust a leaderboard. Try: "Check whether my pairwise judge is biased using this CSV."
- **Teams comparing two models:** Find out if the winner is real. Try: "Model X wins 58% on the judge. Is that real or length bias?"
- **People training preference models:** Clean up the labels first. Try: "Run a swap test on my preference data."

## About this skill

Pairwise judges, where an LLM picks the better of two answers, are cheap and popular. They are also biased in known ways: they tend to favour whichever answer is shown first, and they tend to favour longer answers. If you publish a win rate without checking, the number may be mostly an artifact.

**LLM Judge Bias Check** gives your agent a short, rigorous procedure. First it sanity-checks your data: label balance, identical answers (the judge should say tie), empty answers, and whether one model always sits in slot A. Next, the prepare command writes every pair in both orders so you can run your judge twice. Then the scorer reports the conflict rate with a confidence interval, the first-slot win rate (0.50 means no position bias), how often the longer answer wins for the judge versus your human labels, behaviour at equal length, and agreement with humans as exact match and kappa.

It finishes with a verdict you can quote: usable with swap-averaging, usable only with swap-to-tie, or not trustworthy as-is, and a reminder that a consistent judge can still be biased toward length. A report template and notes on writing a better judge prompt are included.

The script is pure local analysis in standard-library Python: no network, no packages.

**You end up with** numbers and a defensible sentence for your eval write-up, and a clear decision on whether to keep, fix or replace the judge.

## Known limitations

Needs at least 100 pairs for reliable results. It only detects order and length bias, not other style or formatting preferences.

## Technical details

Files: `SKILL.md`, `README.md`, `scripts/swap_test.py` (about 7 KB, standard library only; commands `prepare` and `score`, option `--raw-ba`), `references/report-template.md`, `examples/pairs.csv`, `examples/judged_pairs.csv`. Permissions to expect in the scan: file read only, no network, no subprocess.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the LLM Judge Bias Check: Position and Length Swap Test skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Why should I use this skill instead of just looking at which model won the most?

This skill detects if an AI judge is making unfair decisions based on the order of answers or how long they are. It helps you decide if you can trust a model win rate before you publish it or use it to rank different AI models.

### What files do I need to provide to run a bias check?

You need a CSV file containing the pairs of answers you want to compare. You also need to provide the verdicts from your judge model for both the original and swapped versions of those pairs.

### What kind of report will I receive at the end?

The skill provides a detailed report showing the conflict rate, which is how often the judge changes its mind when the answer order is flipped. It also identifies if the judge favors longer answers and calculates how well the AI judge agrees with human labels.

### Are there any types of bias that this skill cannot detect?

While it identifies if a judge is consistent, it does not catch every type of bias, such as a model preferring its own style or specific formatting. It also requires at least 100 pairs of answers to provide high quality results.

### How do I tell my agent to start the analysis?

You can ask your agent to run a swap test or check your LLM judge for position and verbosity bias. It can also help you prepare two versions of every pair to test the judge or analyze a judged CSV file to generate a trust verdict.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
