feat(bench): convenient benchmark tool #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
Recently I was comparing the running speed of the
mlx
framework and thellama.cpp
framework. I found that the llama.cpp repository provides a tool like llama-bench to allow the community to easily perform fast and multiple benchmarks with different models, seqlen..., while mlx does not seem to have a tool with similar functions.I also found that there are related issues in the community that mentioned this, such as issue 126 in old repo.
I think a good, convenient benchmarking tool would give the community more motivation to provide more benchmark data on their platforms, similar to what llama.cpp does, we can also maintain detailed data provided by the community on different models on their Apple devices.
Inspired by gauri-nagavkar/mlxlm_bench, I wrote this benchmark suite so that the community can directly perform detailed evaluation similar to llama-bench with the mlx_lm.bench command.
For example, use
mlx_lm.bench -m $HOME/Files/mlx/Qwen/Qwen2.5-3B-Instruct-Q4,$HOME/Files/mlx/Qwen/Qwen2.5-7B-Instruct-Q4 -p 1 -n 16,32 -r 2
will generate below information:
Which gives some information like the Prompt TPS, Response TPS and so on.
I hope this module can bring more vitality to the community, because I have observed that there are still many discussions on the benchmark discussion of llama.cpp.
Regards,
B1ACK917