Introduction
As Large Language Models (LLMs) become central to modern software, understanding the fundamental tradeoff between a model's capabilities (accuracy) and its inference costs (latency, financial cost, and energy) is critical. However, comparing models from different providers is currently an "apples-to-oranges" nightmare.
When querying a black-box API like OpenAI’s, a fast response might not indicate an inherently efficient model architecture. Instead, it could be the result of aggressive caching, specialized hardware, or clever batching techniques. Furthermore, raw API latency is "noisy," fluctuating based on server load and network congestion. This makes it nearly impossible for researchers to determine which architectural decisions—such as layer count or hidden size—actually lead to better long-term efficiency.
To address this, the authors propose a method to strip away these external variables, allowing researchers to measure the intrinsic efficiency of the models themselves without exhaustive and expensive benchmarking.
The Core Idea: Idealized Runtime
To enable fair comparisons across different providers, the authors introduce a new metric called Idealized Runtime.
Idealized runtime estimates how a model would perform if it were served on a standardized hardware and software stack (e.g., NVIDIA A100 GPUs using the Megatron-LM framework) without performance contention. This contrasts with raw runtime, which includes transient noise, and denoised runtime, which filters out noise but still includes proprietary API optimizations.
The Cost Model
The authors derive a cost model based on the two distinct phases of autoregressive Transformer inference:
- Prompt Encoding: This phase processes the input tokens in parallel. It is typically compute-bound, meaning performance is limited by the processor's speed.
- Token Generation: This phase generates output tokens sequentially. It is typically memory-bandwidth bound, meaning performance is limited by how fast data can move from memory to the processor.
The resulting cost model expresses runtime as a sum of a piecewise linear function of the number of prompt tokens ($p$) and a linear function of the number of output tokens ($o$).
By profiling just a few points, this estimation procedure can predict the cost of an entire benchmark with approximately 50x less computational effort than running the full suite. The proposed cost model is remarkably accurate, achieving a coefficient of determination ($R^2$) greater than 0.9 across various models.
Key Insights and Results
Using these metrics, the authors evaluated ten prominent LLMs from 2022 across four scenarios from the HELM (Holistic Evaluation of Language Models) benchmark. Several key insights emerged:
- API Optimizations vs. Model Efficiency: While
OpenAI/davincioften sits on the "Pareto frontier" (the best balance of speed and accuracy) for raw API runtime, it falls off that frontier when measured by idealized runtime. This suggests OpenAI’s superior speed is largely a product of highly optimized serving infrastructure rather than a fundamentally more efficient underlying model. - FLOPs are Insufficient: Researchers often use "Total FLOPs" (floating-point operations) as a proxy for efficiency. The authors demonstrate this is misleading because it ignores the memory-bandwidth bottlenecks inherent in the token generation phase.
- Hardware Tradeoffs: Using older hardware (like NVIDIA V100s) is often more expensive than newer A100s. Even if the hourly rental rate is lower, the smaller memory capacity of older chips requires doubling the number of GPUs just to fit the model.
- The "Grande" Problem: API noise can severely distort efficiency metrics. For example, the
AI21/J1-Grandemodel (17B parameters) sometimes showed worse raw runtime than the much largerJumbo(178B) model due to high performance variance in the API, highlighting the necessity of denoising metrics.
Limitations and Future Work
The current cost model is designed specifically for dense Transformer architectures. It would require modifications to accurately reflect Mixture-of-Experts (MoE) models, which activate only a fraction of their parameters per token. Additionally, the study focuses on small-to-medium context windows (<10k tokens). For extremely long contexts, the quadratic complexity of standard attention would force the cost function to transition from linear to quadratic. Finally, these metrics focus strictly on the cost of inference, excluding the massive energy and financial investments required during the model training phase.
Summary updated