In Karpathy's video, when calculating the loss of a next-token LLM during pretraining for a datum, the loss is calculated as the sum of the logs of the probability the first token generates the second token, the second token generates the third, the third token generates the fourth, etc. for all tokens in the context window: https://www.youtube.com/watch?v=l8pRSuU81PU&t=14181s However, generalizing the derivation for entropy rate (...
Originally asked by Leo Miao on Stack Exchange (ai) (CC BY-SA 4.0).