Node.js CLI tool implementation of https://github.com/MinhNgyuen/llm-benchmark for benchmarking language models by running specified prompts and calculating various inference statistics.
- Fetches available models from a local API
- Runs benchmarks on specified models using given prompts
- Calculates and displays inference statistics
- Supports configuration via command line options or a config file
- Saves benchmark results to a specified file
-
Clone the repository:
git clone https://github.com/danmoreng/llm-benchmark-cli.git cd llm-benchmark-cli
-
Install dependencies:
npm install
Run the CLI with default settings:
node index.js
-v, --verbose
: Increase output verbosity-s, --skip-models <models...>
: List of model names to skip-p, --prompts <prompts...>
: List of prompts to use for benchmarking (default: ['Why is the sky blue?'])-c, --config <path>
: Path to an optional configuration file-o, --output <path>
: Path to save benchmark results (default: 'benchmark_results.json')
-
Run with increased verbosity:
node index.js --verbose
-
Skip specific models:
node index.js --skip-models model1 model2
-
Use custom prompts:
node index.js --prompts "What is AI?" "How does it work?"
-
Specify a configuration file:
node index.js --config path/to/config.json
-
Save results to a custom file:
node index.js --output results.json
You can also configure the CLI using a JSON file. The options specified in the config file will be merged with the command line options.
Example config.json
:
{
"skipModels": ["model1", "model2"],
"prompts": ["What is AI?", "How does it work?"]
}
The benchmark results are saved to the specified output file in JSON format. The results include inference statistics such as:
- Prompt tokens per second
- Response tokens per second
- Total tokens per second
- Total duration of the benchmark
This project is licensed under the MIT License - see the LICENSE file for details.