Forecasting LLM Inference Performance via Hardware-Agnostic Analytical Modeling

Rajeev Patwari, Devleena Das, Ashish Sirasao

TL;DR

The paper introduces LIFE (LLM Inference Forecast Engine), a lightweight, hardware-agnostic analytical framework that predicts LLM inference performance metrics like Time-to-First-Token (TTFT) and tokens-per-second. By using only high-level hardware specs (TOPS and memory bandwidth) and model configurations, LIFE bypasses the need for physical hardware benchmarking or complex machine-learning predictors while accurately capturing the dynamic bottlenecks of heterogeneous local processors (CPUs, NPUs, and GPUs).

What Problem Does This Paper Address?

Deploying Large Language Models (LLMs) locally on consumer devices (laptops, phones) means dealing with highly heterogeneous hardware architectures containing mixed combinations of CPUs, NPUs, and integrated GPUs (iGPUs). Predicting how a model will perform on these devices is incredibly challenging.

LLM inference is highly dynamic: the prefill phase (processing the prompt) is heavily compute-bound, while the decode phase (generating tokens one by one) is severely memory-bandwidth bound. Furthermore, modern deployment tricks—like weight quantization, KV cache compression, chunked prefill, and LoRA adapters—constantly shift these compute and memory demands. Existing performance predictors either rely on slow hardware simulators, require physical access to the hardware for empirical benchmarking, or use machine learning models that fail to generalize to new hardware architectures.

Methods

The authors present LIFE, an analytical framework built on a modular, operator-level approach. Instead of executing actual tensor operations or running heavy simulations, LIFE mathematically models the compute and memory requirements of foundational operators (like GEMM, BMM, and element-wise additions) and derived operators (like Multi-Head Attention and MLP layers).

Overview of the LIFE framework

The workflow operates as follows:

  1. Configuration Input: A user provides a model configuration file (specifying layer dimensions, attention mechanisms, etc.) and hardware specs (peak TOPS, memory bandwidth).
  2. Workload Simulation: LIFE simulates the prefill and decode loops, accumulating hardware-agnostic metrics such as total compute operations, memory read/write bytes, and the number of operator dispatch calls.
  3. Performance Forecasting: Using simple analytical equations that factor in operator efficiencies, LIFE translates these raw workloads into concrete performance metrics like TTFT, Time-Per-Output-Token (TPOT), and Tokens-Per-Second (TPS).

Crucially, LIFE natively models the mathematical impacts of optimizations like 4-bit weight/KV quantization, Flash Attention (operator fusion), chunked prefill, and dynamic LoRA adapter merging.

Datasets

LIFE is entirely dataset-agnostic because it models tensor shapes and operator types rather than actual data values or weights. To evaluate and validate the framework, the authors configured and analyzed several optimized variants of the Llama2-7B architecture.

Key Insights and Ideas

  • The Shifting Attention Bottleneck: Traditional single-line roofline models are insufficient for LLMs because hardware efficiency varies drastically based on prompt lengths. For short prompts, linear projections dominate compute. However, as prompt lengths scale up, the Batch Matrix Multiplication (BMM) within attention mechanisms scales quadratically and completely takes over the compute profile.
Prompt Length vs TOPs for Llama2-7B variants in Prefill
  • The Hidden Cost of LoRA: If LoRA adapters are merged inline with matrix multiplications during every single GEMM call at runtime, the compute overhead can increase the TTFT for small prompts by up to 2x. This highlights why ahead-of-time adapter merging is vital for latency-sensitive local applications.
  • Chunked Prefill Dynamics: While chunked prefill effectively mitigates memory capacity limits for long prompts, smaller chunk sizes drastically increase memory pressure and dispatch calls. LIFE demonstrates that as long as compute time remains higher than memory access time ($t_c > t_m$), chunking does not degrade overall prefill performance.

Key Results

The authors validated LIFE's forecasts against physical measurements across three distinct hardware environments: an AMD Ryzen 9 CPU, an AMD Ryzen AI Max+ NPU/iGPU, and an NVIDIA V100 GPU.

  • High Forecast Accuracy: LIFE's performance projections closely mirrored real-world hardware behavior. For example, on the Ryzen 9 CPU running a standard bf16 Llama2-7B model with a prompt length of 2048, the physically measured TTFT was 186.15 ms, closely aligning with LIFE's 50% efficiency forecast of 179.47 ms.
  • Quantization is King for Decode: During the decode phase, LIFE quantified that 4-bit weight quantization provides the most substantial boost to token throughput (TPS) across all platforms by directly alleviating the memory bandwidth bottleneck.

Limitations and Future Work

While LIFE proves highly accurate for standard transformer architectures, the current framework is primarily tailored to dense LLMs. The authors note that future iterations will expand LIFE to support more complex paradigms, including Vision Language Models (VLMs), Mixture-of-Experts (MoEs) architectures, and advanced decoding schemes like Speculative Decoding.

Summary updated

BibTeX
@misc{patwari2025forecasting,
  author = {Rajeev Patwari and Devleena Das and Ashish Sirasao},
  title = {{Forecasting LLM Inference Performance via Hardware-Agnostic Analytical Modeling}},
  year = {2025},
  eprint = {2508.00904},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.00904},
}
Figure