Quality at the Tail

Zhengxin Yang, Wanling Gao, Chunjie Luo, Lei Wang, Jianfeng ZhanarXiv 2022 · DOI

TL;DR

This paper introduces "tail quality," a new metric to evaluate deep learning inference quality that accounts for fluctuations in inference time, especially critical for safety-sensitive applications like autonomous driving. They propose a flexible evaluation framework to predict and analyze these tail quality phenomena, demonstrating it's more efficient than existing benchmarks.

What Problem Does This Paper Address?

In real-world applications, especially those with strict timing requirements like autonomous driving or critical systems, both inference quality (e.g., accuracy) and inference time are paramount. However, current evaluation methods often focus on one aspect while neglecting the other, or they assume inference quality is static once a model is trained. This paper highlights a critical gap: deep learning inference quality can fluctuate significantly even for the same input if inference time varies, particularly when inference times approach their upper bounds (the "tail" of latency). This "tail quality" phenomenon can lead to severe consequences, such as accidents, if not properly understood and managed. The authors aim to address the lack of a comprehensive metric and evaluation framework that captures this crucial interplay between inference time and quality.

Methods

The core contribution is the introduction of "tail quality," defined as the inference quality at a specific percentile of inference time. For example, "tail quality @99%=t" refers to the inference quality when the inference time is constrained to the 99th percentile of latency, t.

To analyze this, they propose a novel evaluation framework with two main components:

  1. Inference Time Probability Model: This component estimates the probability distribution of inference times for each instance. It uses a heuristic algorithm (Algorithm 1) that iteratively performs inference, records times, and fits probability density functions (PDFs) using kernel density estimation (KDE). A sliding window approach with a convergence check (Jensen-Shannon Divergence) is used to determine when the distribution is sufficiently stable.
  2. Tail Quality Calculation Model: This component uses the estimated inference time distributions to calculate tail quality. Algorithm 2 simulates inference under a given time threshold (θ), marking instances exceeding the threshold as invalid. The quality is then evaluated based on the valid instances.

This framework aims to be flexible, allowing researchers to adjust granularity and components considered.

Datasets

The paper uses the following datasets for evaluation:

  • COCO (5K): For object detection tasks.
  • ImageNet (50K): For image classification tasks.
  • MMLU (≈ 13B): For dialogue systems (chatbot) tasks.

The paper does not introduce new datasets but utilizes established ones to evaluate their proposed framework.

Key Insights and Ideas

  • "Tail Quality" is Crucial: Inference quality isn't static; it degrades as inference time approaches its limits. This is a critical, often overlooked, aspect for real-time and safety-critical systems.
  • Counterintuitive Fluctuations: Even with fixed inputs and models, inference quality can vary significantly due to subtle changes in inference time.
  • Predictive Framework: The proposed evaluation framework can predict tail quality, allowing for proactive optimization and risk assessment before deployment.
  • Efficiency Gains: The proposed framework requires significantly fewer inference rounds (e.g., ~62% of MLPerf Inference) to achieve comparable or better results, making it more computationally efficient.
  • Input Data Matters: Larger input instances (e.g., image size, prompt length) generally lead to longer inference times and can influence tail quality.
  • Hardware/Software Influence: Different hardware (servers) and software (frameworks) impact inference time distributions, which in turn affect tail quality.

Key Results

  • Validation of Tail Quality: Experiments showed significant drops in inference quality (e.g., accuracy) as inference time thresholds became stricter. For instance, a worst-case tail quality @90% dropped by ~13 percentage points in one experiment.
  • Framework Effectiveness: The evaluation framework demonstrated good performance in fitting inference time probability distributions, with average rJSD values below 0.05.
  • Prediction Accuracy: The framework showed an average discrepancy of -0.07 in predicting worst-case tail quality (@99%, @95%, @90%), indicating its ability to reasonably forecast these values.
  • Computational Efficiency: The framework achieved an average reduction of approximately 37.74% in computational workload compared to MLPerf Inference for estimating analysis models.
  • Correlation with Input Size: Linear regression confirmed a positive correlation between input instance size (pixels for images, tokens for text) and inference time across different models and systems.

Limitations and Future Work

  • Scope of Analysis: While the paper mentions the influence of hardware and software systems, a detailed analysis of these components' granular effects was beyond the scope of this work.
  • Complexity of "Tail Quality" Calculation: Deriving an analytical model for tail quality directly from inference time analysis is challenging due to the variety of evaluation metrics. The proposed framework relies on simulation and statistical estimation.
  • Future Work: The authors call for establishing innovative methodologies and tools based on their proposed framework to tackle the "tail quality" challenge. They emphasize the need for further research into the underlying causes of these fluctuations and the development of more robust prediction and mitigation strategies.

Summary updated

Abstract

Machine learning inference should be subject to stringent inference time constraints while ensuring high inference quality, especially in safety-critical (e.g., autonomous driving) and mission-critical (e.g., emotion recognition) contexts. Neglecting either aspect can lead to severe consequences, such as loss of life and property damage. Many studies lack a comprehensive consideration of these metrics, leading to incomplete or misleading evaluations. The study unveils a counterintuitive revelation: deep learning inference quality exhibits fluctuations due to inference time. To depict this phenomenon, the authors coin a new term, "tail quality," providing a more comprehensive evaluation, and overcoming conventional metric limitations. Moreover, the research proposes an initial evaluation framework to analyze factors affecting quality fluctuations, facilitating the prediction of the potential distribution of inference quality. The effectiveness of the evaluation framework is validated through experiments conducted on deep learning models for three different tasks across four systems.
BibTeX
@misc{yang2022quality,
  author = {Zhengxin Yang and Wanling Gao and Chunjie Luo and Lei Wang and Jianfeng Zhan},
  title = {{Quality at the Tail}},
  year = {2022},
  eprint = {2212.13925},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.13925},
}
Figure