Repository navigation
The state of the benchmark that the numbers in the README come from.
What it is
Qwen2.5-Coder-1.5B-Instruct, compressed with pruna 0.3.5 to four llama.cpp precisions (f16, q8_0, q5_k_m, q4_k_m), answers all 1,034 questions of the Spider development set. Every generated query runs on its SQLite database, and an answer is correct if it returns the same rows as the reference query. Decoding is greedy. Each precision is compared with f16 question by question, with an exact two-sided sign test.
The result
4-bit costs answers, 8-bit does not.
| Precision | File | Correct of 1,034 | Against f16, same questions |
|---|---|---|---|
| f16 | 3.09 GB | 647 (62.6 %) | baseline |
| q8_0 | 1.65 GB | 646 (62.5 %) | lost 6, gained 5, p = 1.000 |
| q5_k_m | 1.13 GB | 653 (63.2 %) | lost 14, gained 20, p = 0.392 |
| q4_k_m | 0.99 GB | 614 (59.4 %) | lost 59, gained 26, p = 0.00045 |
My first run with 200 questions did not show the q4_k_m loss: 114 against 118 correct, p = 0.424. On one 2-CPU machine q4_k_m generated 2.6 times as many tokens per second as f16 (20.4 against 7.9), but it needed more RAM than q5_k_m (2.03 against 1.56 GB), because llama.cpp keeps a second, repacked copy of most of its weights.
- Accuracy: run 45529640714, files in
results-full-dev/ - Size, memory and speed: run 45508785082, files in
results/ - Every answer: dataset on Hugging Face, browsable in the explorer Space
- The four GGUF files: ZuhalSicim/Qwen2.5-Coder-1.5B-Instruct-GGUF
- Write-up: the 4-bit loss 200 questions could not see
To reproduce
In your own copy of the repository, open Actions, choose "benchmark" and set questions to 1034, machines to ["f16", "q8_0", "q5_k_m", "q4_k_m"] and second_pass to no. It took 1 hour 41 minutes on four GitHub-hosted 2-CPU machines. The table is in the run summary, or:
python make_table.py results results-full-dev
One precision by hand, on Linux with Python 3.12:
pip install -r requirements.txt
python fetch_spider.py data
python compress.py q4_k_m model
python evaluate.py model data/spider 1034 output/q4_k_m.json
python make_table.py output
The unit tests run anywhere: pip install -r requirements-dev.txt, then pytest.
Known limits
- One small model, one dataset. Each accuracy interval is about 6 points wide, and a loss of about 1 point for q8_0 or 1.4 points for q5_k_m could hide in this run.
- q4_k_m's answers depend a little on the order of the questions. With another order, 11 of 200 answer texts and 2 of 200 outcomes changed. With the same order they repeat exactly (1,034 of 1,034). I have not measured why.
- Speed is one run on one shared machine.
- Spider has been public since 2018 and was very probably in the model's training data, so the absolute accuracies say little about text-to-SQL skill. The comparison between precisions is the point.
- The baseline is the f16 conversion, not the original bfloat16 model.
- Execution accuracy can count a wrong query as right when it returns the right rows by chance.
Also in this release: a small CPU-only experiment with an image model (bk-sdm-base with pruna's deepcache), described in the README.
Code MIT. Model Apache-2.0. Spider CC BY-SA 4.0; no Spider data is in this repository.