-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Additional KL-divergence statistics #5081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
std::sort(kld_values.begin(), kld_values.end()); | ||
|
||
printf("===== KL-divergence statistics\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf("===== KL-divergence statistics\n"); | |
printf("===== KL-divergence statistics =====\n"); |
Was this intentional? I usually see prints like this.
examples/perplexity/perplexity.cpp
Outdated
const int n_1percent = nearest_int(0.01f*kld_values.size()); | ||
printf("KLD_01 : %10.6f\n", kld_values[n_1percent]); | ||
printf("KLD_99 : %10.6f\n", kld_values[kld_values.size()-1-n_1percent]); | ||
const int n_5percent = nearest_int(0.05f*kld_values.size()); | ||
printf("KLD_05 : %10.6f\n", kld_values[n_5percent]); | ||
printf("KLD_95 : %10.6f\n", kld_values[kld_values.size()-1-n_5percent]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the correct way to calculate percentiles (due to integer rounding errors) but if the number of tokes is >> 100 it should be fine.
* perplexity: add top-token probability * perplexity: add additional KL-divergence statistics * perplexity: a better organized KL-divergence statistics output --------- Co-authored-by: Iwan Kawrakow <[email protected]>
* perplexity: add top-token probability * perplexity: add additional KL-divergence statistics * perplexity: a better organized KL-divergence statistics output --------- Co-authored-by: Iwan Kawrakow <[email protected]>
I have added:
I'll keep it as a draft PR for a bit.
Please express your wishes for additional things one may want to know.
Here is an example of what you currently get: