A benchmark of one small model at three precisions on your own machine, with the numbers you'd need to pick one for real traffic.
Download Qwen2.5-0.5B-Instruct as an F16 GGUF file, and make Q8_0 and Q4_K_M copies with llama.cpp's llama-quantize.
Score each file's quality with llama-perplexity on the WikiText-2 test set, and its prefill and decode speed with llama-bench.
Work out the KV cache size by hand from the model's config, then start llama-server with 8 slots of 4,096 tokens and compare with the size it prints.
Write a load script that streams from llama-server's OpenAI-compatible endpoint and records time to first token, time per output token and total time for every request.
Send the same 100 prompts at 1, 2, 4 and 8 requests at once, and work out p50 and p99 time to first token and total tokens per second at each level.
Give every prompt the same 1,500-token system prompt, and time the first token with prompt caching on and off.
How you'll know it worksA table giving each file's size, perplexity, prefill and decode speed, and p50 and p99 time to first token at every load level (medians of three runs), with your KV cache figure within 5% of llama-server's.
llama.cpp (Metal on a Mac, CPU elsewhere), Python with the openai package pointed at your own server, and matplotlib. No GPU or API key needed. Uses lessons 01 to 25.
Project: A serving benchmark on your laptop
From insideout, Inference and Serving: A benchmark of one small model at three precisions on your own machine, with the numbers you'd need to pick one for real traffic.
Steps:
1. Download Qwen2.5-0.5B-Instruct as an F16 GGUF file, and make Q8_0 and Q4_K_M copies with llama.cpp's llama-quantize.
2. Score each file's quality with llama-perplexity on the WikiText-2 test set, and its prefill and decode speed with llama-bench.
3. Work out the KV cache size by hand from the model's config, then start llama-server with 8 slots of 4,096 tokens and compare with the size it prints.
4. Write a load script that streams from llama-server's OpenAI-compatible endpoint and records time to first token, time per output token and total time for every request.
5. Send the same 100 prompts at 1, 2, 4 and 8 requests at once, and work out p50 and p99 time to first token and total tokens per second at each level.
6. Give every prompt the same 1,500-token system prompt, and time the first token with prompt caching on and off.
How you'll know it works: A table giving each file's size, perplexity, prefill and decode speed, and p50 and p99 time to first token at every load level (medians of three runs), with your KV cache figure within 5% of llama-server's.
Runs on: llama.cpp (Metal on a Mac, CPU elsewhere), Python with the openai package pointed at your own server, and matplotlib. No GPU or API key needed.
Help me build this on my machine, one step at a time. Ask what I've tried first, give hints before full answers, and check my work against "How you'll know it works".