What Is Wrong with My Model? Identifying Systematic Problems with Semantic Data Slicing

Chenyang Yang, Yining Hong, Grace A. Lewis, Tongshuang Wu, Christian Kästner

Introduction

When a machine learning model fails, it is rarely a random occurrence. More often, these failures follow systematic patterns—such as a toxicity classifier disproportionately flagging specific demographic groups or a sentiment analyzer struggling with nuanced sarcasm. To diagnose these issues, practitioners use data slicing, a process of partitioning datasets into subsets to identify where performance degrades.

Traditionally, data slicing has been a programmatic exercise, relying on metadata (e.g., timestamps) or simple keyword matching (e.g., regex). However, these methods fail to capture semantic nuances. A keyword search for "Muslim" might miss references to "Saudi Arabia" or "mosque," and it certainly cannot identify abstract concepts like "power imbalances" or "passive-aggressive tone." Currently, developers must choose between shallow, automated slices or expensive, slow human annotation. This paper introduces SemSlicer, a framework that leverages Large Language Models (LLMs) to automate semantic data slicing with high accuracy and low cost.

The SemSlicer Framework

SemSlicer transforms natural language criteria into high-quality data slices using a two-stage "Teacher-Student" pipeline. This architecture is designed to balance the need for sophisticated reasoning with the practicalities of processing large datasets.

Stage 1: Prompt Construction (The Teacher Phase)

In the first stage, a high-capability "Teacher" LLM (such as GPT-4) acts as an expert annotator. The user provides a high-level criterion, and the Teacher generates and refines classification instructions. To ensure the slice is robust, the system samples examples from the dataset and uses the Teacher to label them, creating a "few-shot" prompt. If the target concept is rare in the original data, the system can synthesize examples to balance the slice, ensuring the model understands the boundaries of the category.

Stage 2: Data Slicing (The Student Phase)

To maintain efficiency, the heavy lifting of annotating the entire dataset is handed off to a "Student" LLM—a smaller, more efficient model like Flan-T5-XXL. The Student uses the refined prompt generated by the Teacher to label the data. This configuration allows users to tune the system based on their specific needs for accuracy, latency, and compute cost.

Evaluation and Benchmarking

The authors evaluated SemSlicer across four diverse datasets encompassing 26 ground-truth slices:

  • CivilComments: Toxicity data with human-annotated demographic attributes.
  • HateCheck: A synthetic suite for testing hate speech detection.
  • AdaTest: A sentiment analysis suite focused on specific hotel review aspects (e.g., price, location).
  • Amazon: Product reviews categorized by metadata.

Key Results

SemSlicer demonstrated that LLMs are not just viable for data slicing, but often superior to traditional methods:

  • High Accuracy: The framework achieved an average F1 score of 75.9% in its optimal configuration.
  • Reliable Bug Identification: SemSlicer successfully identified all seven statistically significant under-performing slices across the test datasets, proving its utility as a practical debugging tool.
  • Massive Cost Savings: Annotating a 6,000-row dataset cost between $0.26 and $1.70 per slice. Compared to the estimated $432 required for human crowdworkers, this represents a cost reduction of 44x to 1661x.
  • Operational Speed: On standard workstation hardware (2x A6000 GPUs), the system processed between 6 and 14 examples per second.

Insights: Discovery vs. Validation

One of the most significant findings is that SemSlicer can be used for discovery, not just validation. In one case study, a researcher initially hypothesized that a model struggled with "gender." However, by analyzing SemSlicer’s output, they realized the model actually struggled with "power imbalances" in text. This allowed the researcher to refine their hypothesis and create a more precise slice that captured the true nature of the model's failure.

Furthermore, SemSlicer occasionally outperformed human ground truth. During manual audits, the authors found that the framework identified nuanced examples—such as the word "Pride" referring to the LGBTQ+ community—that human annotators had missed during the original dataset creation.

Limitations and Future Work

While SemSlicer is highly effective for datasets in the thousands, scaling to multi-million-row production environments remains a challenge due to cumulative costs and processing time. Future iterations may incorporate retrieval-based methods to filter data before slicing. Additionally, while the Teacher model mitigates prompt sensitivity, LLM-generated instructions can still be less stable than rigid templates.

The authors envision a future "agentic" framework where the system automatically iterates on slicing criteria by identifying where error rates are highest, further automating the path from model failure to model fix.

Summary updated

BibTeX
@inproceedings{yang2024what,
  author = {Chenyang Yang and Yining Hong and Grace A. Lewis and Tongshuang Wu and Christian Kästner},
  title = {{What Is Wrong with My Model? Identifying Systematic Problems with Semantic Data Slicing}},
  booktitle = {ASE},
  year = {2024},
  doi = {10.1145/3691620.3695033},
}
Figure