---
title: 'JudiFair: Judicial Fairness in LLM Decision-Making'
url: https://www.emergentmind.com/topics/judifair
type: topic
---

# JudiFair: Judicial Fairness in LLM Decision-Making

Searching arXiv for JudiFair and related judicial fairness papers.
JudiFair is a benchmark and evaluation framework for assessing **judicial fairness** in large language models (LLMs) when they are deployed as decision-making or decision-support systems in legal contexts. It was introduced in “LLMs on Trial: Evaluating Judicial Fairness for Large Language Models” [2507.10852] to address the claim that existing fairness benchmarks are insufficient for judicial settings because they are typically narrow, emphasize demographic factors, and lack legal grounding and statistical rigor. In this formulation, judicial fairness is treated as a multidimensional property encompassing stability under counterfactual changes, systematic directional bias, and disparities in predictive accuracy across groups. JudiFair combines a legally structured label taxonomy, a large counterfactually generated dataset, and a statistical auditing methodology designed for robust inference [2507.10852].

## 1. Conceptual scope and motivation

JudiFair was created for the setting in which LLMs function as judges or judge-like evaluators in high-stakes legal tasks. The underlying premise is that fairness in judicial decision-making cannot be reduced to a single demographic-bias test. Instead, fairness must be assessed across both **substance** and **procedure**, and across both **demographic** and **non-demographic** factors [2507.10852].

The framework distinguishes two major axes. The first is **substance vs. procedure**. Substance factors concern case facts and characteristics of the offense and the people involved. Procedure factors concern the judicial process, including attributes such as court level, open trial, broadcasting, defender type, recusal, judicial committee, pretrial conference, litigation duration, and immediate judgment [2507.10852]. The second is **demographic vs. non-demographic**. Demographic factors include attributes such as gender, ethnicity, age, sexual orientation, religion, and wealth, while non-demographic factors include variables such as crime date, location, court level, whether the trial was public, and whether the judgment was immediate [2507.10852].

This structure reflects a broader conception of judicial fairness than conventional fairness benchmarks. A central claim of the benchmark is that prior work often ignored **procedural fairness**, even though procedure-related variables can materially affect judicial outcomes [2507.10852]. This suggests that JudiFair is designed not merely as a bias-detection dataset, but as a legal auditing framework aimed at exposing fairness failures that would remain invisible under narrower demographic-only protocols.

## 2. Framework architecture and label system

The judicial fairness framework in JudiFair leads to **65 labels** and **161 corresponding values** [2507.10852]. These labels are organized into four broad groups: **Substance and demographic**, **Substance and non-demographic**, **Procedure and demographic**, and **Procedure and non-demographic** [2507.10852].

The label system expands the LEEC base source and includes labels that are often absent from judicial records but are regarded as relevant to fairness analysis. The benchmark explicitly includes labels such as **sexual orientation**, and also covers attributes of actors beyond defendants, including **judges, prosecutors, defenders, and victims** [2507.10852]. Procedure-oriented labels include **court level, court location, collegial panel, assessor, pretrial conference, online broadcast, open trial, defender type, recusal applied, judicial committee, litigation duration, immediate judgment, compulsory measure** [2507.10852].

The following table summarizes the framework organization.

| Axis | Categories | Illustrative labels from the benchmark |
|---|---|---|
| Substance / Procedure | Substance factors; Procedure factors | crime time/location; court level; pretrial conference; immediate judgment |
| Demographic / Non-demographic | Demographic factors; Non-demographic factors | gender, ethnicity, religion, wealth; open trial, online broadcast, litigation duration |
| Actor coverage | Multiple legal participants | defendant, victim, defender, prosecutor, judge |

The benchmark’s taxonomy is legally motivated rather than purely data-driven. It is intended to support analyses of whether an LLM’s sentencing output is altered by changes in attributes that should be irrelevant, or whether prediction quality is uneven across values of a given label [2507.10852]. A plausible implication is that the framework can support both normative fairness analysis and descriptive diagnosis of which legal or extra-legal variables most strongly perturb model behavior.

## 3. Dataset construction and counterfactual methodology

JudiFair comprises **177,100 unique case facts** and is built from **1,100 judicial documents** derived from Chinese judicial materials [2507.10852]. The benchmark construction process relies on **counterfactual prompting**. For each case and label, legal experts identify the relevant **trigger sentence** in the judicial document, construct a baseline prompt from the original case facts, replace the selected label value with alternative values, and submit each counterfactual as a separate query to the model [2507.10852].

The defining methodological principle is that **only the label value changes**, while the remainder of the case description is held fixed [2507.10852]. This is designed to isolate the effect of the selected label on the model’s judgment. The paper states that the prompting scheme is minimally altered from the original judicial documents in order to preserve legal realism [2507.10852].

The prompt format is a role-play instruction in which the model is told to act as a judge familiar with Chinese law, is given sentencing rules, receives the case facts, and returns a **JSON sentencing result** [2507.10852]. The authors also report a prompt validation stage involving **420 queries**, with **each query run three times**, to check compliance with the desired format and the stability of outputs [2507.10852].

Counterfactual prompting is central to the benchmark’s epistemic design. It is used because it tests whether the model remains neutral when irrelevant facts change, reduces reliance on simple data patterns, and helps expose systematic fairness issues [2507.10852]. This design also separates JudiFair from evaluation paradigms based solely on static test sets with demographic annotations. In JudiFair, fairness is probed through controlled perturbation of legally situated narratives rather than by comparing aggregate subgroup scores in isolation.

## 4. Fairness metrics and statistical evaluation

JudiFair evaluates fairness using three metrics: **Inconsistency**, **Bias**, and **Imbalanced inaccuracy** [2507.10852]. These metrics are intentionally not collapsed into a single scalar. Instead, fairness is assessed as a multidimensional profile across labels, models, and metric types [2507.10852].

### Inconsistency

Inconsistency measures how often the model changes its output when only a label value changes. For one LLM, the paper defines:

$$
Inconsistency = \frac{\sum_{l=1}^{N} w_l \cdot p_l}{\sum_{l=1}^{N} w_l}
$$

where \(N\) is the total number of labels, \(w_l\) is the weight for label \(l\) calculated as its effective sample size, and \(p_l\) is the proportion of judicial documents for which the model’s prediction changes when the value of label \(l\) changes [2507.10852]. Higher inconsistency indicates lower stability, but the paper explicitly notes that inconsistency is not automatically equivalent to bias [2507.10852].

### Bias

Bias is defined as a **systematic directional effect** of label values on sentence length. The paper estimates this through a high-dimensional fixed-effects regression:

$$
Ln(Sentence) = \gamma + \sum_{j=1}^{j-1} \alpha_j \cdot \text{Treated}_{j} + \sum_{i=1}^{i-1} \beta_i \cdot \text{ID}_{i} + \varepsilon
$$

Here, `Treated` denotes the label of interest, one value serves as the reference group, \(\text{ID}_i\) are fixed effects for each judicial document, and the dependent variable is the **natural log of sentencing length + 1**. The main outcome is limited imprisonment length in months [2507.10852]. Estimation uses **high-dimensional fixed-effect linear regression** with **cluster-robust standard errors at the ID level** [2507.10852].

To aggregate significance across many tested label values, the paper counts how many values are significant at a chosen threshold such as \(p \le 0.1\) or \(p \le 0.05\), then applies a Bernoulli/binomial tail test:

$$
p_{\text{bernoulli} \;=\; \sum_{l=k}^{N} \binom{N}{l}\,\tau^{\,l}\!\bigl(1-\tau\bigr)^{\,L-l}
$$

The paper notes that the formula text contains a typesetting inconsistency in the exponent notation, but states that the intended meaning is the right-tail probability under the binomial/Bernoulli null [2507.10852]. This test is applied both within each model and across all models collectively [2507.10852].

### Imbalanced inaccuracy

Imbalanced inaccuracy captures group disparities in predictive error. JudiFair reports **MAE** and **MAPE**, then uses a regression analogous to the bias regression, with absolute error as the dependent variable:

$$
Abs\_Dif = \gamma + \sum_{j=1}^{J} \alpha_j \cdot \text{Treated}_{j} + \sum_{i=1}^{I} \beta_i \cdot \text{ID}_{i} + \varepsilon
$$

The same Bernoulli test is then used to determine whether the number of labels with significant error disparities exceeds what would be expected by chance [2507.10852]. The paper emphasizes that bias and imbalanced inaccuracy are distinct: a model can exhibit one without the other, or both simultaneously [2507.10852].

This tripartite structure is one of JudiFair’s defining features. It operationalizes judicial fairness as a combination of output stability, directional neutrality, and equality of predictive performance, rather than assuming that any single dimension is sufficient.

## 5. Experimental protocol and empirical findings

The main experiment evaluates **16 LLMs** drawn from different countries and spanning both open and closed models [2507.10852]. The listed models include **GLM-4, GLM-4 Flash, Qwen2.5 72B Instruct, Qwen2.5 7B Instruct, Gemini Flash 1.5, Gemini Flash 1.5 8B, LFM 40B MoE, LFM 7B, Nova Lite 1.0, Nova Micro 1.0, Mistral Small 3, Mistral NeMo, Llama 3.1 8B Instruct, Phi 4, DeepSeek V3, DeepSeek R1-32B Qwen** [2507.10852]. The selection is intended to cover different **parameter sizes**, **release dates**, and **countries of origin** [2507.10852].

The primary evaluation uses **temperature = 0** to reduce randomness, with a secondary condition at **temperature = 1** to study the role of decoding variability [2507.10852]. The analysis highlights **25 substance labels** and **40 procedure labels**, and further distinguishes demographic from non-demographic labels [2507.10852].

Several aggregate findings are reported. First, inconsistency is widespread: at temperature 0, the **average inconsistency** across models is **over 15%**, and it becomes higher at temperature 1 [2507.10852]. Second, bias is pervasive: at temperature 0, **14 out of 15** models show significant overall bias under Bernoulli testing, and the combined sample shows strong significance with \(p\)-values below 0.01; the same overall pattern persists at temperature 1 [2507.10852]. Third, imbalanced inaccuracy is also widespread: at temperature 0, **14 out of 15** models show significant unfairness in prediction error, and the pattern remains significant across the sample at temperature 1 [2507.10852].

The paper also reports mean weighted average error statistics across models: **64.871 MAE** and **219% MAPE** [2507.10852]. The text interprets this as indicating that LLM predictions deviate by more than five years in sentence length on average and are often much harsher than human sentences [2507.10852].

These results are presented as evidence of severe LLM judicial unfairness. The benchmark’s design makes this claim stronger than a simple subgroup performance comparison because the reported disparities emerge under tightly controlled counterfactual variation and are evaluated with document fixed effects and clustered uncertainty estimates.

## 6. Interpretation of bias patterns, robustness, and practical significance

JudiFair reports that **demographic labels** produce the most pronounced fairness issues [2507.10852]. At the same time, **procedure labels** are also highly consequential and are described as slightly more biased overall than substance factors, with **judge characteristics** identified among the most biased groups [2507.10852]. The labels **Compulsory_measure** and **Court_level** are singled out as two of the most biased labels [2507.10852]. Non-demographic factors such as **court level, open trial, online broadcast, litigation duration, immediate judgment, recusal, compulsory measures** also produce significant effects [2507.10852].

The paper further identifies a fairness–accuracy tension. Models with **higher bias** tend to have **lower prediction error**, meaning that more accurate models may replicate real-world sentencing patterns more closely while also inheriting or amplifying existing social and judicial biases [2507.10852]. This is described as an “accuracy-equity trade-off” [2507.10852]. The study also finds a negative correlation between inconsistency and bias count: more random outputs may conceal systematic bias, but that does not imply greater justice [2507.10852].

Temperature affects these trade-offs. Higher temperature **increases inconsistency**, but **reduces the number of statistically significant bias labels** and **reduces unfair inaccuracy counts** [2507.10852]. The interpretation offered is that randomness can obscure measurable bias while degrading output stability [2507.10852].

The study reports that **model size**, **release date**, and **country of origin** do not show significant effects on judicial fairness [2507.10852]. Newer models do not reliably exhibit lower bias; larger models do not consistently reduce bias or imbalanced inaccuracy and may even show more inconsistency; and there is no consistent fairness advantage associated with country of development in the reported sample [2507.10852].

To support robustness, the paper uses **fixed-effect regressions**, **cluster-robust standard errors**, **Bernoulli/binomial tests**, and robustness checks with **heteroskedasticity-robust standard errors**, **crime-category clustered errors**, **full-sentence-length regressions**, and **excluding pre-2014 cases** [2507.10852]. These checks are reported to generally confirm the main findings [2507.10852]. This suggests that JudiFair is intended not only as a benchmark dataset but also as an inference protocol for fairness auditing under legal-style evidentiary standards.

## 7. Toolkit, limitations, and relation to adjacent fairness research

The accompanying toolkit is called **JustEva**, with the paper also referencing a public GitHub repository [2507.10852]. The toolkit is intended to support **model API integration**, **flexible label expansion**, and **streamlined fairness evaluation**, enabling researchers to reproduce the benchmark, run fairness tests, extend the label set, and evaluate new models [2507.10852].

The paper explicitly notes several limitations. The benchmark is based primarily on the **Chinese legal system**, so the resulting fairness findings may not transfer directly to other jurisdictions [2507.10852]. Most experiments use **small or mid-scale non-reasoning models**, and the authors identify larger and more advanced models as a future target [2507.10852]. They also state that, although the prompting method is effective, the study does not systematically test more advanced prompting strategies such as **CoT** or **RAG** [2507.10852].

JudiFair belongs to a broader research program on fairness-aware evaluation, but its domain-specific contribution is distinctive. In information retrieval, “FAIR: Fairness-Aware Information Retrieval Evaluation” integrates utility and fairness of exposure into a single metric [2106.08527]. In LLM evaluation, “FairJudge: An Adaptive, Debiased, and Consistent LLM-as-a-Judge” formulates judging as a learnable policy and focuses on adaptivity, debiasing, and cross-mode consistency [2602.06625]. JudiFair differs from both by centering **judicial fairness** as a legally grounded, counterfactual, and statistically audited property of sentencing behavior rather than a generic property of ranking systems or LLM evaluators [2507.10852]. This suggests that JudiFair’s primary contribution is domain-specific rigor: it operationalizes fairness in a way that is sensitive to legal procedure, legally relevant actors, and the inferential demands of high-stakes adjudication.

In summary, JudiFair is a large-scale, legally informed benchmark for auditing LLMs as judges. Its defining elements are the **177,100 unique case facts**, the **65-label / 161-value** judicial fairness framework, the **counterfactual prompting** methodology, and the three-metric evaluation suite of **inconsistency, bias, and imbalanced inaccuracy** [2507.10852]. Its empirical results argue that LLM judicial unfairness is severe, multidimensional, and not resolved by larger scale, more recent release dates, or country of origin alone [2507.10852].

Source: https://www.emergentmind.com/topics/judifair