Local AI hardware

How to measure Ollama tokens per second without mixing timings

Divide eval_count by eval_duration in seconds for generation tokens per second. Divide prompt_eval_count by prompt_eval_duration in seconds for prompt processing throughput. The Ollama API reports durations in nanoseconds, so divide duration values by 1,000,000,000 before computing either rate. Time to first visible text requires its own client-side observation. [1]

Read the three stages of a single request
  1. LoadBring weights into memoryload_duration
  2. Process promptPrepare the input contextprompt_eval_count and duration
  3. GenerateProduce output tokenseval_count and duration
Hypothetical timing example, independent of any GPU
StageAPI counts and durationCalculated result
Prompt1,200 tokens in 3,000,000,000 ns400 tokens/s
Generation160 tokens in 4,000,000,000 ns40 tokens/s
Cold load2,000,000,000 ns2 seconds of load time

Record cold and warm cases separately

For a cold case, check that the model is not resident with ollama ps before starting and record the first request. For a warm case, repeat while the model stays loaded. Preserve the model tag, quantization, context, API options, runtime version, prompt input and device placement. Repeated prompts can use cached work. Report the actual prompt count recorded by the API for each test when comparing prompt throughput. [1] [2]

Measure the user-visible delay independently

Use a streaming request for a separately timed run. Record elapsed wall-clock time from sending the request to receiving the first chunk containing visible response text. State whether you count reasoning text, and keep that rule the same. Capture the final response timing fields as well. Network and application overhead can show up on the client clock even when model generation is unchanged. If a timing denominator is zero or absent, leave that rate blank. [1]

Compare only the differences you meant to change

Alternate multiple runs across configurations. Record a median and range with the sample count. Keep model, prompt, context, output cap and placement policy constant to test a hardware change. Use long prompts and short prompts as separate workloads. A llama.cpp benchmark can isolate prompt or generation test modes, while your actual application includes layers such as conversation history and networking. Pick the test that matches the decision you need to make. [3]

Put it into practice

Related guides

Sources

Source review . Research and writing prepared with AI assistance.

  1. Ollama generate endpoint timing fields
  2. Ollama FAQ: device placement, concurrency and KV cache
  3. llama.cpp benchmark tooling and test modes

Choose a part

Make it yours

Your hardware studio.

Saved in this browser. Your parts stay the same.