Skip to main content

LLM benchmarking tools for the LLM CLI

Project description

LLM Benchmarking Plugin

This is a plugin for the llm tool that adds a benchmark command to compare the performance of different language models.

The commands runs a prompt with optional system prompt for several models and compares the performance between models.

Installation

You can install the plugin using pip:

pip install llm-profile

or using llm

llm install llm-profile

Metrics

  • Total time - The time taken from the request to the end of the final chunk
  • Time to First Chunk - The time taken from the request to the first chunk of the response
  • Length of Response - The length of the response text
  • Number of Chunks - The number of chunks in the response
  • Chunks per Second - The number of chunks divided by the total time taken

Benchmark Usage

To run a benchmark, provide the prompt along with any number of models using the llm alias (from llm models):

$ llm benchmark -m azure/ant-grok-3-mini -m azure/ants-gpt-4.1-mini -s "Respond in emoji" "Give me a friendly hello message" --markdown

For a single pass (no repeats) you will get a summary table:

Benchmark Total Time Time to First Chunk Length of Response Number of Chunks Chunks per Second
azure/ant-grok-3-mini 7.79 7.76 112 30 3.85
azure/ants-gpt-4.1-mini 2.99 2.80 78 19 6.36

To repeat each benchmark and get an average of times, use the --repeat argument:

Benchmark Total Time Time to First Chunk Length of Response Number of Chunks Chunks per Second
azure/ant-grok-3-mini 2.59 <-> 8.39 (x̄=5.49) 2.57 <-> 8.36 (x̄=5.47) 65 <-> 109 (x̄=87.00) 18 <-> 30 (x̄=24.00) 2.15 <-> 11.58 (x̄=6.86)
azure/ants-gpt-4.1-mini 0.54 <-> 2.88 (x̄=1.71) 0.26 <-> 2.69 (x̄=1.47) 76 <-> 78 (x̄=77.00) 19 <-> 19 (x̄=19.00) 6.60 <-> 35.17 (x̄=20.89)

The printout is a range (min <-> max (x̄=mean))

Providing options

You can provide key/value options for all models using the --option flag. This can be useful for setting parameters like temperature, max tokens, etc.

Example:

$ llm benchmark -m gpt-4.1-mini -m gpt-4.1-nano --option temperature 0.7 --option max_tokens 100 "Give me a friendly hello message"

This feature is also helpful for setting the seed option for reproducibility and isolating variances in time to first chunk and time to completion with the same prompt and result.

Markdown formatted results

By default, tables are printed with color showing the fastest and slowest metric in a benchmark:

benchmark screenshot

If you want to customize the output, you can use the --markdown flag to get the results in a Markdown-friendly format.

Non-Streaming models

If you want to benchmark models that do not support streaming, you can use the --no-stream flag. This will disable streaming and provide a single response time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_profile-0.3.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_profile-0.3.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file llm_profile-0.3.0.tar.gz.

File metadata

  • Download URL: llm_profile-0.3.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_profile-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ab6b0d26a8b28e856fdd5152efe12047e9a2ea9a4a14b45dc85581917b2b8a78
MD5 0d964028f5e4a812602e7636cae8d25b
BLAKE2b-256 2d0ef6247a21086391a1ee218466c12ff90383dc1baf10bd642456714afc6c32

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_profile-0.3.0.tar.gz:

Publisher: python-publish.yml on tonybaloney/llm-profile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_profile-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: llm_profile-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_profile-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36d4eab5f902297c7d07578e1a6839d8e4c6a56fc61ebe8b57befa3480dc1f03
MD5 9754dc627764a4b9afb0d709c1d08fa3
BLAKE2b-256 a8f434e8d1fc400a2c5942c1683f65fcf6c3c8391c40f4373110adc0c46668d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_profile-0.3.0-py3-none-any.whl:

Publisher: python-publish.yml on tonybaloney/llm-profile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page