<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zuhal Karadavut</title>
    <description>The latest articles on DEV Community by Zuhal Karadavut (@zuhalsicim).</description>
    <link>https://dev.to/zuhalsicim</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4273252%2F0d055197-9d12-4d29-adb2-13096e40ee96.png</url>
      <title>DEV Community: Zuhal Karadavut</title>
      <link>https://dev.to/zuhalsicim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zuhalsicim"/>
    <language>en</language>
    <item>
      <title>The 4-bit loss that 200 test questions could not see</title>
      <dc:creator>Zuhal Karadavut</dc:creator>
      <pubDate>Mon, 30 Nov 2026 03:10:46 +0000</pubDate>
      <link>https://dev.to/zuhalsicim/the-4-bit-loss-that-200-test-questions-could-not-see-49mo</link>
      <guid>https://dev.to/zuhalsicim/the-4-bit-loss-that-200-test-questions-could-not-see-49mo</guid>
      <description>&lt;p&gt;&lt;em&gt;First published on &lt;a href="https://huggingface.co/blog/ZuhalSicim/4-bit-loss-200-questions-could-not-see" rel="noopener noreferrer"&gt;Hugging Face&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I quantized Qwen2.5-Coder-1.5B-Instruct to three llama.cpp precisions and asked each version SQL questions. On 200 questions the 4-bit file looked as good as the 16-bit one. On all 1,034 questions of the Spider dev set it was 3.2 points worse, with p &amp;lt; 0.001.&lt;/p&gt;

&lt;p&gt;The 200-question run was not wrong. It was too small to see a loss of that size, and its own numbers said so. This post shows where.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;The model is &lt;a href="https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct" rel="noopener noreferrer"&gt;Qwen/Qwen2.5-Coder-1.5B-Instruct&lt;/a&gt;, converted to GGUF and run with llama-cpp-python on CPU. f16 is the baseline. q8_0, q5_k_m and q4_k_m are the compressed versions. The four files are 3.09, 1.65, 1.13 and 0.99 GB.&lt;/p&gt;

&lt;p&gt;The questions are the Spider dev set: 1,034 questions over 20 SQLite databases. The prompt holds a fixed instruction, the &lt;code&gt;CREATE TABLE&lt;/code&gt; statements and the question. Decoding is greedy, at most 256 tokens. An answer counts as correct if its first SQL statement returns the same rows as the reference query.&lt;/p&gt;

&lt;p&gt;All runs used GitHub Actions machines with 2 vCPUs and no GPU. Every answer is in the dataset &lt;a href="https://huggingface.co/datasets/ZuhalSicim/sql-under-compression" rel="noopener noreferrer"&gt;ZuhalSicim/sql-under-compression&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  200 questions: no loss shown
&lt;/h2&gt;

&lt;p&gt;f16 got 118 of 200 right, q8_0 119, q5_k_m 123 and q4_k_m 114. So q4_k_m was 2 points behind f16, and the usual reading is "noise, ship it".&lt;/p&gt;

&lt;p&gt;Both versions answered the same questions, so the test should be paired. 109 questions were right in both and 77 wrong in both. They say nothing about the difference. Only the questions where the two disagree do: q4_k_m lost 9 that f16 got right and gained 5 that f16 got wrong. If both versions were equally good, each of these 14 would be a coin toss. The exact two-sided sign test gives p = 0.424 for 9 against 5.&lt;/p&gt;

&lt;p&gt;Here is the number the run did not report. With 14 differing questions, the split has to be at least 12 to 2 to reach p &amp;lt; 0.05. That is a net loss of 10 questions, 5 points. So this run could only flag a loss of 5 points or more. "No significant loss" meant "no loss above 5 points". I would not release a 4-bit model on that.&lt;/p&gt;

&lt;h2&gt;
  
  
  1,034 questions: 3.2 points lost
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;correct of 1,034&lt;/th&gt;
&lt;th&gt;95 % interval&lt;/th&gt;
&lt;th&gt;lost / gained vs f16&lt;/th&gt;
&lt;th&gt;p&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;f16&lt;/td&gt;
&lt;td&gt;647 (62.6 %)&lt;/td&gt;
&lt;td&gt;59.6 to 65.5&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;q8_0&lt;/td&gt;
&lt;td&gt;646 (62.5 %)&lt;/td&gt;
&lt;td&gt;59.5 to 65.4&lt;/td&gt;
&lt;td&gt;6 / 5&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;q5_k_m&lt;/td&gt;
&lt;td&gt;653 (63.2 %)&lt;/td&gt;
&lt;td&gt;60.2 to 66.0&lt;/td&gt;
&lt;td&gt;14 / 20&lt;/td&gt;
&lt;td&gt;0.392&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;q4_k_m&lt;/td&gt;
&lt;td&gt;614 (59.4 %)&lt;/td&gt;
&lt;td&gt;56.4 to 62.3&lt;/td&gt;
&lt;td&gt;59 / 26&lt;/td&gt;
&lt;td&gt;0.00045&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;q4_k_m lost 59 questions and gained 26: 33 fewer correct answers, 3.2 points.&lt;/p&gt;

&lt;p&gt;The Wilson intervals of f16 and q4_k_m overlap. Compared that way, even the full run shows nothing. The paired test is sharper because it drops the 949 questions where both versions agree and looks only at the 85 where they differ.&lt;/p&gt;

&lt;p&gt;For q8_0, with 11 differing questions, a net loss of 9 (0.9 points) would have been significant. For q5_k_m, with 34, it took 14 (1.4 points). So q8_0 has no loss above about 1 point. For q5_k_m a 1-point loss is still possible, although it got more answers right than f16.&lt;/p&gt;

&lt;h2&gt;
  
  
  The small sample was a bit lucky, but mostly small
&lt;/h2&gt;

&lt;p&gt;The 200 questions are part of the 1,034. In the full run, on exactly those 200, q4_k_m lost 10 and gained 6 (p = 0.454). On the other 834 it lost 49 and gained 20 (p = 0.0006). So the first sample had a smaller loss than the rest, but mostly it was too small.&lt;/p&gt;

&lt;p&gt;To measure that, I drew test runs from the 1,034 paired outcomes with replacement, 20,000 per size, and counted how often a run shows the loss at p &amp;lt; 0.05. This assumes the measured rates of lost and gained questions are the true ones.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;questions in the test run&lt;/th&gt;
&lt;th&gt;100&lt;/th&gt;
&lt;th&gt;200&lt;/th&gt;
&lt;th&gt;400&lt;/th&gt;
&lt;th&gt;600&lt;/th&gt;
&lt;th&gt;800&lt;/th&gt;
&lt;th&gt;1,034&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;runs that show the loss&lt;/td&gt;
&lt;td&gt;11 %&lt;/td&gt;
&lt;td&gt;27 %&lt;/td&gt;
&lt;td&gt;54 %&lt;/td&gt;
&lt;td&gt;75 %&lt;/td&gt;
&lt;td&gt;87 %&lt;/td&gt;
&lt;td&gt;94 %&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A 200-question run misses this loss about three times in four. The full dev set still misses it in about 6 % of runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ship, hold or cannot tell
&lt;/h2&gt;

&lt;p&gt;"Not significant" hides two cases. The run could have seen a loss of the size I care about and did not, or it never could have. I now report the second case as its own result.&lt;/p&gt;

&lt;p&gt;I set the allowed loss before the run, for example 1 point. If the sign test shows a loss larger than that, the answer is hold. If no loss is shown, but the smallest net loss the run could call significant is larger than the allowance, the answer is cannot tell. Everything else ships.&lt;/p&gt;

&lt;p&gt;With f16 as the current release and 1 point allowed, q8_0 ships, q4_k_m is held and q5_k_m gets cannot tell. The 200-question run of q4_k_m also gets cannot tell, not ship. With the same share of differing answers it would have needed about 3,000 questions to show a 1-point loss. For q5_k_m, at the share of its full run, the estimate is about 1,500.&lt;/p&gt;

&lt;p&gt;This logic is in &lt;a href="https://github.com/zuhalsicim/release-gate" rel="noopener noreferrer"&gt;release-gate&lt;/a&gt; and in a &lt;a href="https://huggingface.co/spaces/ZuhalSicim/release-gate" rel="noopener noreferrer"&gt;Space&lt;/a&gt;: upload two answer files (an id and right or wrong per question) and get the decision with its reasons.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two side findings
&lt;/h2&gt;

&lt;p&gt;The smaller file needed more memory. On CPU, q4_k_m peaked at 2.03 GB of RAM and q5_k_m at 1.56 GB. While loading q4_k_m, llama.cpp built a second, repacked copy of most of the weights (&lt;code&gt;CPU_REPACK model buffer size = 596.53 MiB&lt;/code&gt;, next to 927.31 MiB mapped from the file). File size is not a memory budget.&lt;/p&gt;

&lt;p&gt;q4_k_m also depends a little on question order. The other three gave the same answer text to all 200 shared questions in both runs. q4_k_m changed 11 answer texts and 2 outcomes. Repeat runs with the same order gave identical answers, on three CPU types. So the order matters, not the machine, and a repeat of the full run gave 614 of 1,034 again. I did not measure why. My guess is the prompt cache: the order decides how many tokens llama.cpp processes in one batch, and the repacked weights may round differently for another batch size.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I do now
&lt;/h2&gt;

&lt;p&gt;I keep both versions' answers per question and test the lost and gained questions, not the two accuracies. Next to the p-value I report the smallest loss the run could have seen. I fix the allowed loss before the run and size the test set for it. A "not significant" from a small run is a cannot tell.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;p&gt;One small model, one dataset, English only. Spider has been public since 2018 and was very likely in the training data, so the absolute accuracies say little about text-to-SQL skill. The comparison between precisions of the same model is the point. Execution accuracy can count a wrong query as right when it happens to return the right rows. Memory comes from one run on one shared machine. The resampling assumes the measured effect is the true one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Files
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Every answer, question by question: &lt;a href="https://huggingface.co/datasets/ZuhalSicim/sql-under-compression" rel="noopener noreferrer"&gt;ZuhalSicim/sql-under-compression&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Browse the answers and rerun the sample-size test: &lt;a href="https://huggingface.co/spaces/ZuhalSicim/sql-under-compression-explorer" rel="noopener noreferrer"&gt;sql-under-compression explorer Space&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The four GGUF files, numbers on the card: &lt;a href="https://huggingface.co/ZuhalSicim/Qwen2.5-Coder-1.5B-Instruct-GGUF" rel="noopener noreferrer"&gt;ZuhalSicim/Qwen2.5-Coder-1.5B-Instruct-GGUF&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Compare two runs of your own: &lt;a href="https://huggingface.co/spaces/ZuhalSicim/release-gate" rel="noopener noreferrer"&gt;release-gate Space&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Code and workflow: &lt;a href="https://github.com/zuhalsicim/sql-under-compression" rel="noopener noreferrer"&gt;github.com/zuhalsicim/sql-under-compression&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;All my results, each number linked to its proof: &lt;a href="https://zuhalsicim.github.io" rel="noopener noreferrer"&gt;zuhalsicim.github.io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>llm</category>
      <category>machinelearning</category>
      <category>python</category>
      <category>statistics</category>
    </item>
  </channel>
</rss>
