LADDER : Language-Driven Slice Discovery and Error Rectification in Vision Classifiers (2025)

Abstract: Slice discovery refers to identifying systematic biases in the mistakes of pre-trained vision models. Current slice discovery methods in computer vision rely on converting input images into sets of attributes and then testing hypotheses about configurations of these pre-computed attributes associated with elevated error patterns. However, such methods face several limitations: 1) they are restricted by the predefined attribute bank; 2) they lack the common sense reasoning and domain-specific knowledge often required for specialized fields radiology; 3) at best, they can only identify biases in image attributes while overlooking those introduced during preprocessing or data preparation. We hypothesize that bias-inducing variables leave traces in the form of language (logs), which can be captured as unstructured text. Thus, we introduce ladder, which leverages the reasoning capabilities and latent domain knowledge of Large Language Models (LLMs) to generate hypotheses about these mistakes. Specifically, we project the internal activations of a pre-trained model into text using a retrieval approach and prompt the LLM to propose potential bias hypotheses. To detect biases from preprocessing pipelines, we convert the preprocessing data into text and prompt the LLM. Finally, ladder generates pseudo-labels for each identified bias, thereby mitigating all biases without requiring expensive attribute annotations.Rigorous evaluations on 3 natural and 3 medical imaging datasets, 200+ classifiers, and 4 LLMs with varied architectures and pretraining strategies – demonstrate that ladder consistently outperforms current methods. Code is available: https://github.com/batmanlab/Ladder .

## introduction error slices are data subsets on which vision classifiers systematically fail. discovering such slices is critical for improving model robustness. identifying such slices is challenging in vision classifers where biases are pervasive and can be traced through textual artifacts such as image captions, metadata, and medical imaging headers e.g., di-coms. however, their unstructured nature makes manual analysis impractical. natural language, with its inherent flexibility, offers a powerful tool for capturing subtle biases beyond predefined attribute sets. llms, equipped with advanced reasoning capabilities and latent domain knowledge, excel at analyzing such free-form text to detect complex relationships and domain-specific biases. however, existing slice discovery methods often rely on predefined attribute banks or unsupervised clustering, both of which lack the reasoning ability to identify nuanced and domain-specific biases. this paper proposes ladder, that leverages llms to systematically identify and mitigate error slices in vision classifiers by analyzing captions, metadata, and beyond -without relying on fixed attribute sets or clustering methods. prior slice discovery methods e.g., @xcite ) use text encoders to mitigate biases in clip by closing the modality gap through crossmodal transfer, which limits their applicability to non-multimodal models. plus, drml relies on user-defined prompts with fixed attribute sets, introducing human bias into the mitigation process. similarly, facts @xcite amplifies the spuriousness in the initial training stage by setting large weight decay, deviating from standard supervised learning practices. methods like classifier age: [ ….] blood pressure: […] lab test: [….] … manufacturer: [ ….] x-ray dosage: […] aperture setting: [….] … metadata (e.g, dicoms) patient data (ehr) 1. there is little change in the 3 left chest tubes with area of hydro pneumothorax 2. with chest tube remaining in place and no striking change h2: fluid levels domino @xcite and facts discover slices by clustering samples with similar attributes within the vision-language representation (vlr) space. however, the slices often exhibit semantic inconsistencies -attributes within slices lack coherence, leading to unreliable interpretations of model errors. prime @xcite relies on expensive tagging models, limited to detecting the presence/absence of a fixed set of attributes. all these methods lack the reasoning capabilities and domain knowledge required to capture complex error patterns, limiting their effectiveness in specialized tasks. also, their dependence on preexisting semantic labels (e.g., visual tags) hinders the detection of biases in the metadata or domainspecific fields such as dicom headers. prior mitigation methods @xcite @xcite rely on expensive and incomplete attributes. while they improve worst group accuracy (wga), they amplify errors in other groups @xcite . although @xcite addresses errors across multiple biases, it assumes prior knowledge of the number and types of biases to design specific data augmentations. this reveals a critical gap: the need for an automated method to discover and mitigate multiple biases without prior knowledge/annotations. this paper proposes ladder with the following contributions: 1. using language for error slice discovery: ladder uses image captions/radiology reports to retrieve sentences indicative of model errors, utilizing the flexibility of natural language to capture deeper insights beyond the simple presence or absence of attributes, unlike tagging models. 2. using llms' reasoning capabilities and latent domain knowledge: to identify biases, ladder leverages llms' advanced reasoning to generate testable hypotheses from these sentences, unlike traditional methods. for instance, in a synthetic dataset @xcite , where class 0 images consistently feature a yellow box to the left of a red box (fig 1 ), the classifier exhibits poor performance on test data without this bias. ladder correctly identifies this reliance on spatial positioning by analyzing textual descriptions through llm (fig 11 ). note, llm in ladder processes only text inputs without images (total cost of ∼$28). in medical images, ladder uses llms' domain knowledge to identify fine-grained biases, including disease subtypes and pathological patterns. 3. slice discovery from any off-the-shelf model: it detects slices from any supervised model, regardless of architecture/pretraining, overcoming specific training requirements of facts and drml. 4. detecting biases beyond captions: ladder uses llm to analyze metadata, such as electronic health records (ehr) or dicom headers, discovering biases beyond captions. 5. mitigating multiple biases w/o any annotation: ladder mitigates biases by generating pseudo-labels for each hypothesis and fine-tuning the classifier's linear head through attribute rebalancing. by ensembling debiased model predictions, ladder corrects multiple biases without requiring attribute annotations/prior knowledge of their number and type. additionally, we explore the use of instruction-tuning models (e.g., llava) in applicable domains to reduce lad-der's reliance on captions. rigorous evaluations on 6 datasets with 200+ classifiers and 4 llms across architectures and pretraining strategies show that ladder outperforms slice discovery and mitigation baselines. 2 related work slice discovery. initial methods @xcite @xcite on slice discovery utilize dimensionality reduction, lacking comprehensive evaluation. recent methods e.g., @xcite projects data into vlr space, identifies slices via a mixture model, and captions them. facts @xcite amplifies spurious correlations in the initial training phase by increasing weight decay and discovering slices in vlr space. both approaches compromise visual semantics, resulting in attribute inconsistencies within slices. drml @xcite probes only clip-based classifiers using modality gap geometry and userdefined prompts, introducing potential human biases. also, facts and drml are restricted to specific training setups, limiting generalizability to standard erm classifiers. prime @xcite uses expensive tagging models to discover attributes for slice discovery. hibug (chen et al., 2024a) prompts llm to suggest biases for model errors without any textual context from the data. thus, it results in superficial keyword-based attributes derived purely from general user prompts, lacking the deeper contextual grounding needed for bias detection. recently, openbias (d' @xcite detects biases in t2i models via llm-driven keyword queries but is not designed for posthoc classifier error analysis. b2t @xcite extracts keywords from captions. all these methods are limited by incomplete tags or keyword-based attributes and lack reasoning or latent domain knowledge, essential in fields e.g., radiology. bias mitigation. mitigation methods e.g., groupdro @xcite optimizes for worst-performing groups, while jtt @xcite reweights minority groups. dfr @xcite retrains the final layer using a balanced validation set. all of them require group annotations and focus on mitigating errors in the worst-performing group, amplifying errors in other subgroups. @xcite mitigates multiple biases using an ensemble-based approach but relies on predefined bias types, which limits its adaptability to unknown biases. lad-der overcomes all these limitations. for discovery, ladder incorporates the domain knowledge of llms, reason about model errors, and generates hypotheses identifying biases from any pretrained model without external attributes, unlike existing methods. for mitigation, ladder leverages pseudo-labels for each bias to finetune the classifier's last layer -without any group annotations, predefined bias types, or human intervention. followup work. our work is extended by @xcite , which adapts mitigation strategies for self-supervised learning on tabular data. ## method assume the classifier @xmath0, where φ and g are the representation and classification head, respectively. {ψ i , ψ t } denote the image and text encoders of the joint vlr space. for a set of images x y of a class @xmath1, ladder identifies error slices where f underperforms and mitigates it. throughout the paper, ⟨•, •⟩ denotes the dot product to estimate the similarity between two representations. fig. 2 shows the schematic of ladder. we do not rely on sample-specific paired annotations, human-generated prompts, or prior knowledge of bias types or their numbers. we utilize a text corpus t val from radiology reports or image captions from the validation dataset to discover and mitigate errors. error slice. an error slice for a class y includes subsets x y where the model performs significantly worse than its overall performance on the entire class y , formally defined as: ## experiments we perform experiments to answer the research questions: rq1. how does ladder perform in discovering error slices compared to baselines? rq2. how does ladder leverage reasoning and latent domain knowledge of llms for slice discovery? rq3. how does ladder discover biased attributes with different architectures and pretraining methods? rq4. how does ladder mitigate biases using the discovered attributes? rq5. can ladder operate w/o captions? rq6. can ladder detect biases beyond captions/reports? datasets. we evaluate ladder on 6 datasets (appendixa.1 for details): 1) waterbirds @xcite : bird classification where background correlates with bird type. 2) celeba @xcite : blond hair classification with gender as a spurious feature. 3) metashift: cat vs. dog classification with background correlation. 4) nih chest-x-ray (cxr) @xcite : pneumothorax detection with chest tubes as a shortcut (docquier and rapoport, 2012). 5) rsna-mammo and 6) vindr-mammo (nguyen et al., 2023): breast cancer and abnormality detection from mammograms, with calcifications as a shortcut @xcite . experimental details. for natural images and cxrs, we use an imagenet1k (in1k)-initialized resnet50 (rn sup in1k) as the model f that lad-der aims to probe, trained with a standard supervised loss. for mammograms, we use efficientnet-b5 (en-b5) as f . for the text corpus (t val ), we use blip-captioner @xcite , radiol-ogy reports from mimic-cxr @xcite and the radiology texts from mammo-factor (ghosh et al., 2024a) for natural images, cxrs and mammograms, respectively. for vlr space ({ψ i , ψ t }), we use clip @xcite , cxr-clip @xcite , and mammo-clip (ghosh et al., 2024a) for natural images, cxr and mammograms, respectively. we use 200 and 100 sentences as topk for natural and medical images (cxr and mammo). we use gpt-4o @xcite as the llm. error slices are defined as subsets where the error rate exceeds the overall class error by at least 10%. refer to appendix a.10 for further experimental details. all reported results are obtained from experiments conducted over 3 random seeds. baselines. for slice discovery, we compare lad-der with domino and facts (appendix a.2). for mitigation, we compare with the baselines, including erm @xcite , groupdro @xcite , jtt @xcite , dfr @xcite , @xcite and lff @xcite evaluation metrics. we use precision@10 (appendix a.5) @xcite to evaluate the slice discovery methods and the clip score @xcite to quantify the effect of biased attributes. for mitigation, we report worst group accuracy (wga) for mitigation for natural images. we report mean auroc and wga for medical images, where wga refers to model performance on pneumothorax patients w/o chest tubes (nih) and cancer or abnormal patients w/o calcifications (rsna & vindr-mammo). figure 9 shows that ladder, leveraging llmdriven reasoning and domain knowledge, consistently identifies similar biases across different architectures, pretraining methods, and datasets. in the nih dataset, ladder identifies mostly key attributes such as chest tubes, fluid levels etc. also, in the waterbirds dataset, ladder detects attributes e.g., ocean and bamboo forest consistently, showing the correlation of the spurious backgrounds with class labels and the ground truth biases. appendix a.12.8 lists more results. rq4: mitigating biases using ladder. tab. 2 shows that ladder outperforms other bias mitigation baselines in estimating wga, without requiring the expensive ground truth shortcut attributes, for both training and validation datasets across cnn models (en-b5 for mammograms and rn sup in1k for the rest). ladder achieves a wga of 91.4%, 76.4% and 82.5% -a 3.6%, 7.3% and 21.1% improvement (↑) over dfr in the waterbirds, rsna, and vindr datasets, respectively. for nih, ladder outperforms jtt and dfr by 8.2% and 7.4%, respectively. appendix a.12.4 illustrates further analysis with an additional 9 baselines. fig. 15 shows ladder's consistent performance gain across various architectures and pre-training methods. tab. 11 in appendix a.12.7 shows that ladder outperforms li et al. (2023b) on multishortcut benchmark urbancars. leveraging llms' advanced reasoning, ladder accurately derives pseudo labels for the biased attributes from hypotheses to identify true model biases. ladder then applies targeted bias mitigation by fine-tuning the last layer, resulting in a systematic debiased model per hypothesis. this efficient strategy effectively enhances model performance across the biases, modalities, and architectures. 6 (b) evaluates the wga metric, evaluating the bias discovery and mitigation quantitatively, respectively. for natural images, ladder with instruction-tuned models perform comparably to the standard pipeline using captions. for cxrs, the retrieval-based approach utilizing actual reports outperforms methods using chexagent and radialog, highlighting the importance of domainspecific reports in medical imaging. thus, using models e.g., llava can eliminate ladder's need for captions. however, this approach is challenging for 2d mammograms and dermatology imaging @xcite etc.where robust instruction-tuned models are lacking. in such cases, ladder's retrieval pipeline remains highly adaptable and shows broad applicability. thus, a tradeoff emerges: models can either leverage explicit radiology reports for bias identification or develop robust vlrs to reduce dependence on reports. ## conclusion we introduce ladder, a novel llm-driven method for error slice discovery and bias mitigation for vision classifiers. unlike prior methods that rely on predefined attributes or unsupervised clustering, ladder leverages llm's reasoning to detect coherent error slices without requiring explicit annotations from any off-the-shelf pretrained classifier. next, it mitigates multiple biases through pseudo-label generation and attribute rebalancing. extensive evaluations on 6 datasets show ladder 's effectiveness, outperforming existing baselines.