How Long Does a Reader Wait for a Five-Word Answer?
My four-bit model could write about 934 tokens a second on a desktop CPU. At that speed a five-token answer takes a little over five milliseconds to write. When I timed entire reading questions, the average was 37 milliseconds. Most of the time went into reading the question and its passage before there was a first word to show.
Timing the two parts of a request
I exported the SQuAD reader to GGUF, the file format I used with llama.cpp. I first checked that the full-precision export gave the same validation loss as the original on the CPU. Then I compressed the weights to eight, five and four bits. For the smaller two files I kept the shared word embedding and output weights at eight bits. I checked reading quality on the same six outside question sets as before.
I used six threads on an i5-12600K and sent one request at a time. For the first-token column I used a fixed 512-token prompt. For the last column I timed 100 real questions, averaging 197 input tokens and about six answer tokens. The two columns describe different prompt lengths.
| Format | File size | Change in outside-source F1 | First token, 512-token prompt | Each following token | Whole reading question |
|---|---|---|---|---|---|
| Full precision | 203.2 MB | baseline | 106.3 ms | 5.40 ms | 65 ms |
| Eight bits | 54.2 MB | −0.15 | 116.6 ms | 1.68 ms | 49 ms |
| Five bits | 37.2 MB | −0.46 | 143.7 ms | 1.26 ms | 59 ms |
| Four bits | 31.5 MB | −0.67 | 91.6 ms | 1.07 ms | 37 ms |
Five bits looked attractive when I timed only the words being written. It decoded faster than eight bits and came in a smaller file. For someone waiting on a short answer, the order flipped. The five-bit kernels took longer to process the passage, and six answer tokens gave them little chance to make up the difference. Eight bits kept almost all the measured quality. Four bits gave me the shortest wait on this CPU, at a cost of 0.67 F1 points on the six sources and about 2.1 on questions where I had swapped a fact in the passage.
A browser timing that was too good
The same files could run on the CPU in a browser through WebAssembly. My first timing came in around 25 milliseconds per question. SQuAD has several questions about each passage, and the runtime had quietly kept the part of the previous prompt it had already processed. On average it read only about 21 new tokens per request. That timing described someone asking a follow-up about a familiar passage.
I turned off prefix caching and timed the first 50 questions again. Those prompts averaged 245 tokens. With eight browser threads, four bits took 118 milliseconds per question, and eight bits took 117. With one thread they took 658 and 632 milliseconds. A different set of prompts and a different thread count keep this from being a direct race with the native numbers. It does show how two files with quite different download sizes can give a reader much the same wait once loaded.
I used the original SQuAD reader for those controlled measurements. The public demo uses the later reader trained on casual questions and missing answers, with both four- and eight-bit downloads. When I try it, I care about three separate waits now. The first is downloading the model, the second is reading a fresh passage, and the third is writing the few words I asked for. Try the browser reader · Quantization and timing results