DeepLLM Quiz
Machine Learning

Entropy: measuring uncertainty and surprise

10 questions on information, surprise, bits, entropy of uniform and uneven distributions, differential entropy and the maximum-entropy Gaussian.

  • 10 questions
  • Stopwatch
  • Instant feedback

Shown publicly with your score. Don’t use your full real name.

Sample questions

Play now ↑

Answers stay hidden. Start the quiz to play them.

  1. Sample 1

    A variable has eight equally likely states. Roughly how many yes-or-no answers, or bits, does it take on average to say which state occurred?

    • Eight
    • Three
    • Two
  2. Sample 2

    Over a fixed number of possible states, which distribution has the highest entropy?

    • The one with a single dominant state
    • The uniform distribution, with every state equally likely
    • The one with two dominant states

How it works

  • One question per screen. An answer is final once sent.
  • You see right away whether you were right, with a short explanation.
  • The stopwatch runs: on equal scores, the faster player ranks first.
  • Only your best attempt counts, so replaying is never risky.

About this quiz

If someone tells you the sun rose this morning, you learn almost nothing. If they tell you it did not, you have received a great deal of information. That intuition, that rare events are more informative than common ones, is the starting point of information theory, and entropy is the number that turns it into a measurement. The idea came from the study of sending messages down a wire, but it now shows up in machine learning every time a model is trained to predict a category or a next word, because the standard loss function is built from it.

This quiz introduces entropy step by step. It begins with the idea of surprise: how much you learn from seeing an outcome, and why that must be large for rare outcomes and nothing at all for certain ones. It then asks about the average surprise of a whole distribution, which is the entropy, and tests your sense of when it is high and when it is low. A small coding example shows what entropy means in practice: the fewer bits per message you need on average, the more predictable the source. A deep result says you can never do better than the entropy.

The quiz also looks at entropy from two other angles. In the physics view, a spread-out distribution corresponds to a huge number of ways of arranging things, while a sharply peaked one corresponds to very few. For continuous variables there is a variant called differential entropy, which behaves in a surprising way and can even be negative. And finally you will meet the principle of maximum entropy, which says that when you know only an average and a spread, the least committal distribution you can choose is the Gaussian.

Common confusions are worth knowing in advance. Entropy is not the same as the number of possible outcomes, because a variable with many outcomes, one of which almost always occurs, has low entropy. It is not a measure of how large the values are, only of how unpredictable they are. And the discrete and continuous versions are not interchangeable: the second can be negative, which the first never is. Afterwards you will be better placed to read about cross-entropy loss, about compression and about generative models, where entropy and its relatives appear in nearly every explanation of why a particular training objective makes sense. You will leave with a working sense of why a model that is confident and wrong is penalised so heavily by the loss functions built on these ideas.

The quiz suits students in machine learning, data science and engineering, and anyone who has met cross-entropy loss without a clear picture of where it comes from. No mathematics is required beyond simple arithmetic. There are 10 questions with explanations, and it takes about four minutes.

Questions and answers

›How long does the quiz take?

About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. An explanation appears after every answer.

›Do I need to know logarithms?

No. Logarithms are what make the measurement work, but the quiz only uses the consequences, such as the fact that a choice among sixteen equally likely options needs four yes-or-no answers. The explanations use plain counting.

›What is information in this sense?

It is the degree of surprise on learning the outcome of a random event. A rare event carries a lot of it, a very likely event carries little, and an event that was certain carries none. When two unrelated events both occur, the information adds up, which is why the measure is based on a logarithm.

›What is entropy?

Entropy is the average amount of information you receive when you learn the outcome of a random variable. It is high when the outcomes are hard to predict and low when one outcome dominates. Its smallest possible value is zero, which happens when the outcome is certain. A useful mental picture is a guessing game. The entropy tells you roughly how many well-chosen yes-or-no questions you would need to identify the outcome, so a fair coin needs one question and sixteen equally likely options need four, while a loaded die with one very likely face needs fewer on average. Thinking in questions per outcome makes the formulas easier to remember.

›What are bits and nats?

They are units of information. Bits are used when the logarithm is taken to base two, so one bit is the answer to a single yes-or-no question. Nats are used with natural logarithms, which is more convenient in machine learning mathematics. The two differ only by a fixed conversion factor.

›What does the noiseless coding theorem say?

It says that entropy is a lower bound on the average number of bits needed to transmit the outcomes of a random variable. Clever codes can approach it by using short codewords for common outcomes and long ones for rare outcomes, but no code can beat it on average.

›What is the maximum entropy principle?

It says that, given only certain facts about a distribution, you should choose the one with the highest entropy, because it assumes nothing more than you know. For a continuous variable with a known mean and variance, that distribution is the Gaussian.

›Why can differential entropy be negative?

For continuous variables, entropy depends on how finely the values are measured, and the continuous version drops that dependence. A very narrow distribution, with its probability crammed into a tiny range, then has a value below zero. Only differences in differential entropy are generally meaningful, not its absolute value. Entropy is also the reason a very confident model that turns out to be wrong is punished so severely in training: the surprise attached to an outcome the model thought almost impossible is very large.

More quizzes