Skip to content
Senior183 viewsAsked at 2 companies

How to measure throughput vs latency in LLM serving?

Practice

AI answer

Throughput and latency are key metrics when evaluating the performance of LLM serving (Large Language Model).

  • Latency — the response time of the model to a single request, usually measured in milliseconds or seconds. It includes the time to process the request, generate a response, and transfer data.
  • Throughput — the number of requests the model can handle per unit of time (e.g., requests per second).

To measure:

  1. Latency

    • Send a single request to the model and measure the time from sending to receiving the response.
    • For a more accurate assessment, make several requests and take the average or a percentile (e.g., 95th).
  2. Throughput

    • Run load testing with parallel requests.
    • Measure the total number of successfully processed requests over a fixed period.

It is important to note that increasing load can cause latency to grow due to queues and resource limitations.

To optimize serving, it is common to balance between latency and throughput, for example, by batching requests, caching, or scaling infrastructure.