Given a list of per-token negative log-likelihoods (natural log), compute the perplexity of a language model's predictions.
Signature: def perplexity(neg_log_likelihoods: list) -> float
Formula: exp(mean(nlls)). Use np.exp and np.mean.
Note: NLLs are assumed to use the natural logarithm (base e).
Math
Asked at
Test Results