Abstract
Large language models (LLMs) often struggle with balanced class accuracy in text classification tasks using in-context learning (ICL), hindering some practical uses due to user dissatisfaction or safety risks caused by misclassifications. Retraining LLMs to address root causes in data or model priors is neither easy nor cost-effective. This paper delves deeper into the class accuracy imbalance issue, identifying that it arises because certain classes consistently receive disproportionately high ICL probabilities, causing under-prediction and lower accuracy for others. More importantly, probability ranges affect the imbalance differently, allowing for precise, range-specific corrections. We introduce FuRud (Fuzzy Rule Optimization-based Debiasing), a method for sample-level class probability correction. FuRud tackles interpretability challenges by determining why certain classes need corrections and tailoring adjustments for each instance's class probabilities which is powered by fuzzy sets with triangular membership functions, transforming a class probability based on the range it belongs to. By solving a nonlinear integer programming problem with a labeled set of ICL class probabilities to minimize class accuracy bias (COBias) and maximize overall accuracy, each class selects an optimal correction function from 19 triangular membership functions without updating an LLM, and the selected functions correct test instances at inference. Across seven benchmark datasets, FuRud reduces COBias by over half (56%) and improves overall accuracy by 21% relatively, outperforming state-of-the-art debiasing methods.
Introduction
In-context learning (ICL) has revolutionized how we interact with Large Language Models (LLMs), enabling them to perform complex text classification tasks with only a handful of examples. However, these models frequently exhibit significant class accuracy imbalance. For instance, a model might achieve near-perfect accuracy on a "Sports" category while failing miserably on "Business" news, often due to inherent biases in training data or prompt phrasing.
Existing debiasing techniques typically apply a uniform correction factor to an entire class. This "blunt instrument" approach fails to account for the fact that bias is often range-specific; a model's prediction when it is 10% certain requires a different adjustment than when it is 40% certain. Furthermore, many current methods operate as "black boxes," offering little insight into why a specific correction was applied. This paper introduces FuRud (Fuzzy Rule Optimization-based Debiasing) to address these challenges through range-specific, interpretable corrections.
The FuRud Methodology
FuRud conceptualizes debiasing as a fuzzy logic problem. Instead of a single multiplier, the system assigns each class one of 19 distinct triangular membership functions. These functions serve as "rules" that transform raw output probabilities based on their specific range (e.g., low, medium, or high).
The framework operates in two primary phases:
- Fuzzy Rule Selection & Optimization: Using a small labeled set, FuRud employs Simulated Annealing to solve a multi-objective nonlinear integer programming problem. The goal is to find the optimal combination of membership functions that maximizes overall accuracy while minimizing COBias (the average difference in accuracy between class pairs) and penalizing extreme class-level failures.
- Inference-Time Correction: The selected optimal functions are applied to the LLM's output probabilities for new test instances. This allows for "surgical" corrections—for example, amplifying the medium-range probabilities of an under-predicted class while leaving high-confidence predictions untouched.
Experimental Results
FuRud was evaluated across seven diverse benchmarks, including AGNews, DBpedia, SST-5, and RTE, using models such as Llama-2 (7B and 13B) and GPT-2-XL. The results demonstrate a substantial improvement over standard ICL and existing state-of-the-art debiasing methods:
- Accuracy: Average accuracy across benchmarks rose from 59.4% to 72.0%, a 21% relative increase.
- Bias Reduction: COBias was reduced from 40.5% to 17.8%, representing a 56% relative reduction.
- Efficiency: The system remains highly effective with as few as 10 optimization examples, making it ideal for low-resource scenarios.
Discussion and Interpretability
A key advantage of FuRud is its inherent interpretability. By examining which fuzzy rule was selected for a class, researchers can understand the nature of the model's bias. For example, if the optimizer selects the "Don't Change" identity function for a specific class, it serves as a diagnostic indicator that the LLM has already learned an accurate and unbiased representation for that category. This transparency allows engineers to move beyond black-box corrections toward a more granular understanding of model behavior.
Conclusion
FuRud offers a powerful, interpretable, and efficient solution to the persistent problem of class accuracy imbalance in ICL. By leveraging fuzzy logic for range-specific probability correction, it achieves state-of-the-art performance without the need for costly model retraining. Future work will explore scaling these fuzzy rules to frontier models like GPT-4 and extending the framework to more complex reasoning and multi-modal tasks.
Summary updated