AI fundamentals

Latency

AI-assisted editorial review:

Latency is the time an AI request takes to produce a response. Distinguish time to first token (TTFT), when output begins, from time to last token (TTLT), when generation completes.[1]

What does Latency mean in simple terms?

After you send a question, there is a wait before text starts appearing, and another interval while the answer is generated. TTFT measures the first wait; TTLT measures the total time until completion. Streaming can show output as it arrives and improve the experience of waiting, but does not mean all computation finishes sooner.[1]

How can Latency be explained with an analogy?

It is the time between sending a quotation request and receiving the first reply.

Where is Latency used?

Case 1

Chat interface

Measure when a request is sent, when the first token appears, and when generation ends. Compare TTFT and TTLT separately instead of treating them as one number.[1]

Case 2

Input and output length

Test representative prompts and response lengths. Model choice, prompt size, generated token count, and service load can affect latency, so compare like-for-like workloads.[1]

Case 3

Streaming

Enable streaming when the interface can display incremental output. Evaluate when users see useful text as well as when the full response completes.[1]

Case 4

Batch work

For bulk jobs, measure completion time and throughput alongside individual-request latency. The best operating configuration depends on the workload and service requirements.

Learning steps, limitations and developments

  1. Record request start, first-token, and completion times.
  2. Monitor TTFT and TTLT separately, using a distribution rather than one average.
  3. Compare the same workload before and after changing a model, prompt, output limit, or streaming configuration.
  4. Define targets appropriate to chat, voice, or batch work using measurements from your own workflow. Include tool time when measuring an end-to-end agent.
  5. Recheck under representative load before deciding whether a configuration meets your requirements.

Latency depends on multiple factors. Microsoft’s official guidance discusses model selection, token counts, workload and service characteristics, and streaming.[1] A fast first token and fast total completion are different goals. Avoid comparing timings from different models or workloads as though they were controlled measurements.

Which concepts are related to Latency?

  • Similar concept
    ThroughputA concept that often appears alongside it within the same basics category.
  • Similar concept
    SWE-benchA concept that often appears alongside it within the same basics category.
  • Similar concept
    BenchmarkA concept that often appears alongside it within the same basics category.

Which sources explain Latency?

  1. Azure OpenAI in Microsoft Foundry Models performance and latency — Official documentation · Microsoft Learn — https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/latency