Discovering the Hidden Role of Gini Index In Prompt-based Classification
Organizations: Independent Researcher
Abstract
In classification tasks, the long-tailed minority classes usually offer the predictions that are most important. Yet these classes consistently exhibit low accuracies, whereas a few high-performing classes dominate the game. We pursue a foundational understanding of the hidden role of Gini Index as a tool for detecting and optimizing (debiasing) disparities in class accuracy, focusing on the case of prompt-based classification. We introduce the intuitions, benchmark Gini scores in real-world LLMs and vision models, and thoroughly discuss the insights of Gini not only as a measure of relative accuracy dominance but also as a direct optimization metric. Through rigorous case analyses, we first show that weak to strong relative accuracy imbalance exists in both prompt-based, text and image classification results and regardless of whether the classification is high-dimensional or low-dimensional. Then, we harness the Gini metric to propose a post-hoc model-agnostic bias mitigation method. Experimental results across few-shot news, biomedical, and zero-shot image classification show that our method significantly reduces both relative and absolute accuracy imbalances, minimizing top class relative dominance while elevating weakest classes.
Figures & tables
| Eval. Metric | [1, 0, 0, 0] | [0.8, 0.2, 0, 0] | [1, 1, 0, 0] |
|---|---|---|---|
| Mean Acc. ( ) | 0.25 | 0.25 | 0.50 |
| Gini ( ) | 0.75 | 0.65 | 0.50 |
| COBias | 0.50 | 0.43 | 0.67 |
| Property | Gini Index | COBias |
|---|---|---|
| Normalization | Relative: divided by | Absolute: no mean normalization |
| Scale dependence | Scale-invariant (homogeneous of degree 0) | Scale-dependent (homogeneous of degree 1) |
| Peak value condition | Maximal when one dominant class holds all mass ( , others ) | Maximal when values split between extremes (e.g., half at , half at ) |
| Sensitivity | Relative inequality (proportional gaps) | Absolute dispersion magnitude |
| Interpretation | “Fraction of mean separating random pairs” | “Expected absolute gap between random distinct pairs” |
| Optimization Outcome | Gini is minimized when class performance is proportionally balanced | COBias is minimized when absolute differences between all class pairs are small. |
| Eval. Metric | World | Sports | Business | Tech | Interpretation |
| Class Acc. (4 Classes) | [0.85, | 0.98, | 0.97, | 0.19] | - |
| Mean Acc. ( ) | 0.75 | Average performance across all 4 classes. | |||
| Relative Dominance of the Top Class to the Mean ( ) | 1.31 | Top class (0.98) is 1.31× the mean, showing weak relative dominance | |||
| COBias | 0.42 | High value because large absolute gaps exist (e.g., 0.79 between 0.98 and 0.19), so absolute disparity is significant. | |||
| Gini ( ) | 0.21 | Low value (close to 0) because the top class (0.98) is only 1.31× the mean (not 4× like in [1, 0, 0, 0]), so the system is relatively balanced given the average performance. | |||
| Eval. Metric | Neg. | Eff. | Mech. | Adv. | Int. | Interpretation |
|---|---|---|---|---|---|---|
| Class Acc. (4 Classes) | [0, | 0.87, | 0.03, | 0.04, | 0.20] | - |
| Mean Acc. ( ) | 0.23 | Average performance across all 5 classes. | ||||
| Relative Dominance of the Top Class to the Mean ( ) | 3.8 | Top class (0.87) is 3.8× the mean, showing strong relative dominance. | ||||
| COBias | 0.38 | Moderate value because large absolute gaps exist, so absolute disparity is significant. | ||||
| Gini ( ) | 0.67 | High value (>0.4) because the top class is 3.8× the mean, so the system is highly imbalanced given the average performance. | ||||
| Original | Debiased (Opt. Metric: Gini) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Evaluation Metric | World | Sports | Business | Tech | World | Sports | Business | Tech | Relative Improvement |
| Class Acc. (4 Classes) | 0.85 | 0.98 | 0.97 | 0.19 | 0.85 | 0.98 | 0.85 | 0.85 | - |
| Mean Acc. ( ) | 0.75 | 0.88 | 17% | ||||||
| Relative Dominance of the Top Class to the Mean ( ) | 1.31 | 1.11 | 15% | ||||||
| COBias ( ) | 0.42 | 0.06 | 86% | ||||||
| Gini ( ) | 0.21 | 0.03 | 86% | ||||||
| Original | Debiased (Opt. Metric: Gini) | ||||||||||
| Evaluation Metric | Neg. | Eff. | Mech. | Adv. | Int. | Neg. | Eff. | Mech. | Adv. | Int. | Relative Improvement |
| Class Acc. (4 Classes) | 0 | 0.87 | 0.03 | 0.04 | 0.20 | 0.30 | 0.45 | 0.32 | 0.27 | 0.52 | - |
| Mean Acc. ( ) | 0.23 | 0.37 | 61% | ||||||||
| Relative Dominance of the Top Class to the Mean ( ) | 3.8 | 1.4 | 63% | ||||||||
| COBias ( ) | 0.38 | 0.13 | 66% | ||||||||
| Gini ( ) | 0.67 | 0.14 | 79% | ||||||||
| Evaluation Metric | Original | Debiased (Opt. Metric: Gini) | Relative Improvement |
|---|---|---|---|
| Mean Acc. ( ) | 0.67 | 0.69 | 3% |
| Relative Dominance of the Top Class to the Mean ( ) | 1.47 | 1.42 | 3% |
| COBias ( ) | 0.24 | 0.10 | 58% |
| Gini ( ) | 0.18 | 0.07 | 61% |
| Original | Debiased (Opt. Metric: COBias) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Evaluation Metric | World | Sports | Business | Tech | World | Sports | Business | Tech | Relative Improvement |
| Class Acc. (4 Classes) | 0.85 | 0.98 | 0.97 | 0.19 | 0.86 | 0.98 | 0.85 | 0.84 | - |
| Mean Acc. ( ) | 0.75 | 0.88 | 17% | ||||||
| Relative Dominance of the Top Class to the Mean ( ) | 1.31 | 1.11 | 15% | ||||||
| COBias ( ) | 0.42 | 0.07 | 83% | ||||||
| Gini ( ) | 0.21 | 0.03 | 86% | ||||||
Classification
Classification maps observations to discrete labels, including familiar, unknown, hierarchical, or multiple categories.
See all 408 papers