Capabilities for Better ML Engineering

Chenyang Yang, Rachel A. Brower-Sinning, Grace A. Lewis, Christian Kästner, Tongshuang Wu

Abstract

Machine learning (ML) engineering currently lacks unified specifications, often resulting in models that perform well in controlled environments but fail under real-world conditions. This paper introduces a "capability-based" framework—utilizing fine-grained behavioral specifications—to unify ML engineering practices across debugging, collaboration, quality assurance, and maintenance. Through an exploratory experiment, the authors demonstrate that testing these capabilities can strongly predict a model's ability to generalize to out-of-distribution (OOD) data, offering a more robust approach to model evaluation than traditional aggregate metrics.

The Problem: Fragmented ML Engineering

Most ML models are developed under idealized assumptions, such as static datasets and identically distributed training and test data. Consequently, these models often fail "in the wild" due to unforeseen edge cases, distribution shifts, or fairness issues. For example, a pedestrian detector might fail to recognize a person in a wheelchair because that specific "capability" was never explicitly specified or tested.

While the industry recognizes the need for robust ML engineering, current efforts remain fragmented. Academic research often focuses narrowly on model debugging for data scientists, while industry efforts prioritize pipeline automation (MLOps). There is a distinct lack of a shared language or unifying specification framework that connects the entire ML lifecycle—from requirements gathering to deployment—allowing diverse stakeholders like software engineers, data scientists, and regulators to communicate expectations and track model quality systematically.

The Capability-Based Framework

The authors propose centering ML engineering around capabilities: fine-grained specifications of expected model behavior. Unlike traditional software specifications, which use deductive reasoning where a single failure is a bug, ML capabilities act as "soft lower bound specifications." Since ML relies on inductive reasoning, capabilities are measured by failure rates over curated suites of test cases, known as instantiations.

Examples of capabilities, their instantiations, and theoretical origins.

These capabilities serve as "boundary objects," facilitating communication between teams. For instance, a software engineer can report a failure using an abstract capability (e.g., "fails on double negatives") without needing to share sensitive production data, enabling data science teams to understand the requirement and improve the model effectively.

Experimental Validation

To validate this framework, the authors conducted an experiment to determine if capability testing could predict OOD generalizability. Using the AMAZON-WILDS dataset, they fine-tuned 100 BERT models with different random seeds for sentiment analysis. They instantiated eight linguistic capabilities (e.g., negation, modality, amplifiers) by slicing validation data based on keywords. Linear regression was then used to see if performance on these capability slices could predict accuracy on ten unseen, shifted target domains (e.g., moving from Home-and-kitchen reviews to Movie-and-tv reviews).

Key Results

The experiment yielded two primary insights:

  1. Strong Signal for Generalizability: Adding capability test results as variables significantly improved the prediction of OOD accuracy on 50% of the target domains (5 out of 10). As shown below, this approach far outperformed baselines relying on random data slices or random noise.
  2. Predictive Power and Domain Distance: The helpfulness of capabilities in predicting performance correlates positively with the distribution shift (measured by $\mathcal{A}$-distance) between the source and target domains. Essentially, the further the target distribution is from the training data, the more valuable capability testing becomes.
Percentage of target domains where predictive power significantly improved using capabilities vs. baselines.

Limitations and Future Outlook

While promising, the design space for capabilities is vast. Simple keyword slicing can sometimes produce uninformative test suites that are too similar to the source data. The authors suggest a future research agenda focused on:

  • Discovery: Automating the identification of domain-specific capabilities.
  • Assessment: Determining the optimal granularity and importance of different capabilities.
  • Communication: Building shared vocabularies to resolve conflicting requirements.
  • Instantiation: Finding cost-effective strategies, such as counterfactual generation or templating, to turn abstract capabilities into concrete test cases.

By shifting the focus from aggregate accuracy to specific behavioral capabilities, ML engineering can move toward a more disciplined and communicative practice.

Summary updated

BibTeX
@inproceedings{yang2023capabilities,
  author = {Chenyang Yang and Rachel A. Brower-Sinning and Grace A. Lewis and Christian Kästner and Tongshuang Wu},
  title = {{Capabilities for Better ML Engineering}},
  booktitle = {SafeAI @ AAAI},
  year = {2023},
}
Figure