In natural language processing, perplexity is a way of evaluating language models. Models with a lower perplexity for test examples (drawn from the same distribution as the training examples) are better and will be more confident about their predictions. Perplexity tells you how confident the model was about the sequence is predicted.
Perplexity is defined as: If the perplexity is low, then the model is not very “surprised” by the sequence and has assigned on average a high probability to each subsequent token in the sequence.