Killer write up! Appreciate sharing all your work.
I wanted to raise a couple of points regarding KL Divergence that, based on my understanding, are important to call out:
- It’s mandatory to apply softmax on the logits. The KL Divergence is about the difference between two distributions. Without applying softmax, the logit scores aren’t a valid distribution.
- The KL Divergence only measures the change from baseline, there is zero measure of “correctness,” only a measure difference from the established baseline. It’s important since a baseline model could (statistically speaking) generate an overall incorrect answer, while a quantized model produces a correct answer (unlikely but not impossible). Essentially, it’s important to recognize that it’s an assumption that the baseline is assumed as having the most likely correct next token prediction. Multiple runs make the outlier scenario less consequential.
- The greedy top-1 logit of the next likely token %-difference and the KL Divergence are two different measures. I don’t think it was attempted to assert they’re equivalent here, but it also wasn’t exactly obvious on first read. The greedy top-1 measure is more strict, as it only compares the top candidate, which is also more relevant for what a user ultimately receives as output.
Also, “vocabulary” was mentioned one of the dials, but I think most people would call it the “tokenizer." It’s splitting hairs a bit, but figured it was worth calling out for those who may not know off hand.