HAPI: A Large-scale Longitudinal Dataset of Commercial ML API Predictions

Lingjiao Chen, Zhihua Jin, Sabri Eyuboglu, Christopher Ré, Matei Zaharia, James Zou

Abstract

Commercial ML APIs offered by providers such as Google, Amazon and Microsoft have dramatically simplified ML adoption in many applications. Numerous companies and academics pay to use ML APIs for tasks such as object detection, OCR and sentiment analysis. Different ML APIs tackling the same task can have very heterogeneous performance. Moreover, the ML models underlying the APIs also evolve over time. As ML APIs rapidly become a valuable marketplace and a widespread way to consume machine learning, it is critical to systematically study and compare different APIs with each other and to characterize how APIs change over time. However, this topic is currently underexplored due to the lack of data. In this paper, we present HAPI (History of APIs), a longitudinal dataset of 1,761,417 instances of commercial ML API applications (involving APIs from Amazon, Google, IBM, Microsoft and other providers) across diverse tasks including image tagging, speech recognition and text mining from 2020 to 2022. Each instance consists of a query input for an API (e.g., an image or text) along with the API's output prediction/annotation and confidence scores. HAPI is the first large-scale dataset of ML API usages and is a unique resource for studying ML-as-a-service (MLaaS). As examples of the types of analyses that HAPI enables, we show that ML APIs' performance change substantially over time--several APIs' accuracies dropped on specific benchmark datasets. Even when the API's aggregate performance stays steady, its error modes can shift across different subtypes of data between 2020 and 2022. Such changes can substantially impact the entire analytics pipelines that use some ML API as a component. We further use HAPI to study commercial APIs' performance disparities across demographic subgroups over time. HAPI can stimulate more research in the growing field of MLaaS.

Introduction

Machine Learning as a Service (MLaaS) has exploded, allowing developers to integrate complex tasks like speech recognition or sentiment analysis via simple API calls. However, these APIs are proprietary "black boxes." Providers update their underlying models frequently to improve performance or incorporate new data, but they rarely disclose when these updates happen or how they alter the model's behavior.

For a developer, this is a major reliability risk. A pipeline optimized for a specific API in 2020 might fail in 2022 because the model's error modes have shifted, even if its aggregate accuracy remains the same. Until now, there was no large-scale, systematic way to track these changes over time.

Methods and Dataset

The authors introduce HAPI (History of APIs), a massive longitudinal dataset tracking over 1.7 million predictions from commercial ML APIs between 2020 and 2022. HAPI utilizes 21 diverse benchmark datasets to query APIs across tasks including Spoken Command Recognition (SCR), Sentiment Analysis (SA), Facial Emotion Recognition (FER), and Image Classification.

To characterize "API shifts," the study focuses on four key metrics:

  • Model Accuracy: The standard measure of correct predictions.
  • Prediction Overlap (PO): Measures how often an API gives the exact same answer for the same input at two different points in time.
  • Confidence Movement (CM): Tracks whether the API is becoming more or less "certain" about its predictions over time.
  • Group Disparity (GD): Evaluates fairness by measuring the performance gap between different demographic subgroups.
Longitudinal trends in accuracy, prediction overlap, and group disparity across major ML APIs.

Key Insights

Analysis of the HAPI dataset reveals that API rankings are not static. We identify several critical phenomena:

  • The "Accuracy Cross": Choosing the "best" API is a recurring task. For example, in 2020, EPixel outperformed Google on the COCO dataset, but a subsequent 20% drop in EPixel's performance allowed Google to take the lead.
  • Silent Churn: Accuracy can be deceptive. Cases were found where an API's accuracy stayed steady, but its Prediction Overlap was low. This means the model was fixing old mistakes but introducing an equal number of new errors—a significant challenge for debugging downstream systems.
  • Confidence Decoupling: Confidence scores do not always track reality. For instance, the Microsoft speech API's confidence jumped by over 30% in a year while its actual accuracy decreased.
  • Volatile Bias: Updates don't automatically fix fairness. In some cases, as models became more accurate overall, their bias against specific subgroups actually worsened.

Key Results

More than 60% of the 63 evaluated API-dataset pairs encountered significant performance shifts over the two-year period. Vision APIs showed high volatility; the EPixel API saw its accuracy on the COCO dataset drop from 47% (Fall 2020) to 27% (Spring 2022). Conversely, Google's speech API showed massive improvement, with accuracy on the DIGIT dataset increasing by 20% between 2020 and 2021.

Comparison of performance metrics between 2020 and 2022, highlighting the dramatic accuracy drop and shifting disparity for the EPixel API.

Conclusion

The HAPI dataset demonstrates that commercial ML APIs are moving targets. Silent model updates frequently cause significant shifts in behavior, potentially breaking the applications that rely on them. The research team plans to maintain HAPI as a living resource, updating it every six months to provide a "weather report" for the MLaaS ecosystem and stimulate further research into model reliability and transparency.

Summary updated

BibTeX
@inproceedings{chen2022hapi,
  author = {Lingjiao Chen and Zhihua Jin and Sabri Eyuboglu and Christopher Ré and Matei Zaharia and James Zou},
  title = {{HAPI: A Large-scale Longitudinal Dataset of Commercial ML API Predictions}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=6j-DC38XvPJ},
}
Figure