Cheaply Evaluating Inference Efficiency Metrics for Autoregressive Transformer APIs

Deepak Narayanan, Keshav Santhanam, Peter Henderson, Rishi Bommasani, Tony Lee, Percy LiangarXiv 2023 · DOI

TL;DR

This paper introduces "idealized runtime," a new metric to fairly compare the inference efficiency of large language models (LLMs) served via black-box APIs. By accounting for hardware and software optimizations, it reveals that some API performance gains come from the infrastructure, not the model itself, and provides a crucial tool for understanding true cost-capability trade-offs.

What Problem Does This Paper Address?

Deploying large language models (LLMs) is computationally expensive, especially during inference. A key question for developers and researchers is when the increased capabilities of a larger model justify its higher cost. However, comparing LLMs through black-box APIs is problematic because raw inference times are influenced by factors beyond the model itself, such as API-specific optimizations (like caching) and shared infrastructure leading to performance contention. This makes it difficult to get a true, apples-to-apples comparison of model efficiency, hindering informed decisions about model selection and investment.

Methods

The authors propose a new metric called idealized runtime. This metric aims to measure inference efficiency as if all models were run on a uniform, dedicated hardware and software stack, free from performance contention. They achieve this by:

  1. Parameterizing Autoregressive Inference Runtime: They derive a mathematical model for the runtime of autoregressive LLMs, showing it's a sum of a piecewise linear function of prompt size and a linear function of the number of generated output tokens.
  2. Efficient Estimation Procedure: Instead of exhaustive profiling, they use linear regression on a small set of "configuration" queries to estimate the parameters of this runtime model. This allows for efficient estimation of the idealized runtime for any given prompt and output length.
  3. Cost-Aware Variants: They extend the idealized runtime to include idealized dollar cost and energy cost by incorporating the number of accelerators and their associated costs/power draw.

Datasets

Not discussed in the paper. The paper focuses on evaluating existing LLMs through their APIs and a controlled experimental setup, rather than training on specific datasets.

Key Insights and Ideas

  • "Idealized Runtime" is Crucial: Raw API runtimes are misleading. They are heavily influenced by external factors like caching and load balancing, masking the true efficiency of the underlying model.
  • API Optimizations vs. Model Efficiency: The paper demonstrates that superior performance observed in some black-box APIs is often due to infrastructure-level optimizations rather than inherent model efficiency. This is a significant finding for understanding where performance gains truly originate.
  • Cost-Capability Tradeoffs are Nuanced: When evaluating LLMs across various tasks, the models that perform best on the efficiency-capability frontier change depending on the metric used (e.g., raw runtime vs. idealized runtime). This highlights the importance of using appropriate metrics for fair comparisons.
  • Scaling Isn't Everything: The study suggests that model size alone doesn't guarantee superior capability or efficiency, especially when comparing different model families.
  • Hardware and Software Matter: The methodology allows for direct comparison of different hardware and software stacks, revealing that older hardware (like V100 GPUs) can be both slower and more expensive due to needing more accelerators to fit models.

Key Results

  • The proposed methodology for estimating idealized runtime is shown to be accurate, with high coefficients of determination (R²) for linear regression models fitting the runtime data.
  • Idealized runtimes are often significantly lower than raw black-box API runtimes, especially for models where API providers have implemented substantial optimizations. For instance, OpenAI models showed idealized runtimes greater than denoised runtimes 64.2% of the time, suggesting heavy API-level optimization.
  • The paper compares ten state-of-the-art LLMs and finds that the Pareto frontier of efficiency-capability tradeoffs shifts when using idealized metrics compared to raw runtimes.
  • The cost of running inference using idealized metrics (e.g., on A100 GPUs) can be up to an order of magnitude lower than the costs charged by black-box API providers.

Limitations and Future Work

  • Transformer-Centric: The methodology for efficient estimation is currently confined to Transformer models, although the authors believe it's a reasonable compromise given their prevalence.
  • Hardware/Software Assumptions: While the idealized runtime aims for uniformity, the specific hardware and software stack chosen (NVIDIA A100 GPUs with Megatron) might not perfectly represent all potential future stacks.
  • Future Work: The authors suggest further exploration into the implications of different objective functions for combining accuracy and efficiency, and extending the methodology to other model architectures. They also highlight the need for more systematic reporting of inference costs and the impact of model architecture design on efficiency.

Summary updated

BibTeX
@misc{narayanan2023cheaply,
  author = {Deepak Narayanan and Keshav Santhanam and Peter Henderson and Rishi Bommasani and Tony Lee and Percy Liang},
  title = {{Cheaply Evaluating Inference Efficiency Metrics for Autoregressive Transformer APIs}},
  year = {2023},
  eprint = {2305.02440},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.02440},
}
Figure