1#!/usr/bin/env bash
2
3RESULTS="bench-models-results.txt"
4: > "$RESULTS"
5
6ARGS_BB="-c 270336 -npp 512,4096,8192 -npl 1,2,4,8,16,32 -ntg 32"
7ARGS_B="-d 0,4096,8192,16384,32768 -p 2048 -n 32"
8
9QUICK=0
10DIO=0
11while (( "$#" )); do
12 case "$1" in
13 --quick) QUICK=1; shift ;;
14 --dio) DIO=1; shift ;;
15 *) shift ;;
16 esac
17done
18
19if (( QUICK )); then
20 ARGS_BB="-c 20480 -npp 512,4096 -npl 1,2,4 -ntg 32"
21 ARGS_B="-d 0 -p 2048 -n 32"
22fi
23
24if (( DIO )); then
25 ARGS_BB="${ARGS_BB} --no-mmap --direct-io"
26 ARGS_B="${ARGS_B} -mmp 0 -dio 1"
27fi
28
29run_model() {
30 local HFR=$1
31 local HFF=$2
32
33 printf "## ${HFR}\n" | tee -a "$RESULTS"
34 printf "\n" | tee -a "$RESULTS"
35 printf "Model: https://huggingface.co/${HFR}\n" | tee -a "$RESULTS"
36 printf "\n" | tee -a "$RESULTS"
37
38 printf -- "- \`llama-batched-bench\`\n" | tee -a "$RESULTS"
39 printf "\n" | tee -a "$RESULTS"
40
41 ./bin/llama-batched-bench \
42 -hfr "${HFR}" -hff "${HFF}" \
43 -m "${HFF}" -fa 1 -ub 2048 \
44 ${ARGS_BB} | tee -a "$RESULTS"
45
46 printf "\n" | tee -a "$RESULTS"
47
48 printf -- "- \`llama-bench\`\n" | tee -a "$RESULTS"
49 printf "\n" | tee -a "$RESULTS"
50
51 ./bin/llama-bench \
52 -m "${HFF}" -fa 1 -ub 2048 \
53 ${ARGS_B} | tee -a "$RESULTS"
54
55 printf "\n" | tee -a "$RESULTS"
56
57 printf "\n"
58}
59
60run_model "ggml-org/gpt-oss-20b-GGUF" "gpt-oss-20b-mxfp4.gguf"
61run_model "ggml-org/gpt-oss-120b-GGUF" "gpt-oss-120b-mxfp4-00001-of-00003.gguf"
62run_model "ggml-org/Qwen3-Coder-30B-A3B-Instruct-Q8_0-GGUF" "qwen3-coder-30b-a3b-instruct-q8_0.gguf"
63run_model "ggml-org/Qwen2.5-Coder-7B-Q8_0-GGUF" "qwen2.5-coder-7b-q8_0.gguf"
64run_model "ggml-org/gemma-3-4b-it-qat-GGUF" "gemma-3-4b-it-qat-Q4_0.gguf"
65run_model "ggml-org/GLM-4.7-Flash-GGUF" "GLM-4.7-Flash-Q8_0.gguf"
66
67if [[ -f models-extra.txt ]]; then
68 while read -r HFR HFF; do
69 [[ -z "$HFR" ]] && continue
70 run_model "$HFR" "$HFF"
71 done < models-extra.txt
72fi
73
74printf "\n=====================================\n"
75printf "\n"
76
77cat "$RESULTS"
78
79printf "\n"
80printf "Done! Results are written to $RESULTS\n"
81printf "\n"
82