Skip to content

Commit c2de0fa

Browse files
committed
Update IQ2/IQ3_NL multiplicative err_estimate rationale
1 parent 346379f commit c2de0fa

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/test-backend-ops.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,11 +2405,12 @@ struct test_set_rows : public test_case {
24052405
// which is roughly 0.25 times the number of elements.
24062406
double err_estimate = 1.0f/8.0f;
24072407
if (type == GGML_TYPE_IQ2_NL) {
2408-
// iq2_nl has only 4 non-linear levels (coarsest quant) so we increase error estimate
2408+
// Using iq4_nl as reference, iq2_nl has only 4 non-linear levels (coarsest quant)
2409+
// so we increase error estimate to keep the same ratio (4 non-linear levels * 4.0f)
24092410
err_estimate *= 4.0f;
24102411
}
24112412
if (type == GGML_TYPE_IQ3_NL) {
2412-
// iq3_nl has 8 non-linear levels: coarser than the 16-level iq4_nl
2413+
// iq3_nl has 8 non-linear levels: coarser than the 16-level iq4_nl (8 non-linear levels * 2.0f)
24132414
err_estimate *= 2.0f;
24142415
}
24152416
if (type == GGML_TYPE_Q5_0 || type == GGML_TYPE_Q5_1) {

0 commit comments

Comments
 (0)