Commit 90f58ae
committed
Fix critical TTQ double-scaling bug
Bug: TTQ quantized weights are ALREADY scaled by wp/wn:
w_quant = {-wn_pos, 0, +wp_pos}
But we were applying beta = (wp_pos + wn_pos) / 2 in dequantization,
scaling AGAIN! This is double-scaling.
BitNet comparison:
- BitNet: quantize to {-1,0,+1}, then scale with beta
- TTQ: quantize to {-wn,0,+wp} (already scaled!), beta should be 1.0
Fix: Set beta = 1.0 since TTQ weights are pre-scaled.
This was causing the model to be stuck at 10% accuracy.1 parent 28594ae commit 90f58ae
2 files changed
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
0 commit comments