Choose your answers and select “Check”. Numbers accept a decimal point, comma, or simple fraction. Answers and drafts are saved in this browser and shared between RU/EN.
Enable JavaScript for automatic checking. Questions and expandable answers are available below.
Checked: 0 / 20 · Correct: 0
Reset progress Question 2.1.1 2.1. Definition and properties
Which quantity is the surprisal of a particular outcome x x x relative to a distribution P P P ?
A) − ∑ x p ( x ) log 2 p ( x ) -\sum_xp(x)\log_2p(x) − ∑ x p ( x ) log 2 p ( x )
B) ∑ x p ( x ) 2 \sum_xp(x)^2 ∑ x p ( x ) 2
C) − log 2 p ( x ) -\log_2p(x) − log 2 p ( x )
D) 2 − log 2 p ( x ) 2^{-\log_2p(x)} 2 − l o g 2 p ( x )
Answer and explanation Correct answer: C. Surprisal refers to one outcome. Option A is entropy, the expectation of surprisal, and option D simplifies back to p(x) itself.
Question 2.1.2 2.1. Definition and properties
A random variable has an alphabet of n n n symbols, but only m < n m<n m < n have positive probability. What is the sharpest general upper bound on its entropy?
A) H ( X ) ≤ log 2 ( n − m ) H(X)\le\log_2(n-m) H ( X ) ≤ log 2 ( n − m )
B) H ( X ) ≤ log 2 n H(X)\le\log_2n H ( X ) ≤ log 2 n , attained by the uniform distribution on the m m m symbols
C) H ( X ) ≤ m / n H(X)\le m/n H ( X ) ≤ m / n
D) H ( X ) ≤ log 2 m H(X)\le\log_2m H ( X ) ≤ log 2 m , attained by the uniform distribution on the support
Answer and explanation Correct answer: D. Entropy cannot exceed the logarithm of the positive support size. The bound log₂ n is also true but weaker, and it cannot be attained when m < n, which is exactly why option B is wrong about the equality case.
Question 2.1.3 2.1. Definition and properties
Which inequality correctly states concavity of entropy?
A) H ( λ p + ( 1 − λ ) q ) ≥ λ H ( p ) + ( 1 − λ ) H ( q ) H(\lambda p+(1-\lambda)q)\ge\lambda H(p)+(1-\lambda)H(q) H ( λ p + ( 1 − λ ) q ) ≥ λ H ( p ) + ( 1 − λ ) H ( q )
B) H ( λ p + ( 1 − λ ) q ) ≤ λ H ( p ) + ( 1 − λ ) H ( q ) H(\lambda p+(1-\lambda)q)\le\lambda H(p)+(1-\lambda)H(q) H ( λ p + ( 1 − λ ) q ) ≤ λ H ( p ) + ( 1 − λ ) H ( q )
C) H ( λ p + ( 1 − λ ) q ) = H ( p ) + H ( q ) H(\lambda p+(1-\lambda)q)=H(p)+H(q) H ( λ p + ( 1 − λ ) q ) = H ( p ) + H ( q )
D) H ( λ p + ( 1 − λ ) q ) ≥ max { H ( p ) , H ( q ) } H(\lambda p+(1-\lambda)q)\ge\max\{H(p),H(q)\} H ( λ p + ( 1 − λ ) q ) ≥ max { H ( p ) , H ( q )}
Answer and explanation Correct answer: A. The entropy of a mixture is no smaller than the average entropy of its components. It need not exceed every component, so option D claims more than concavity gives.
Question 2.2.1 2.2. Joint and conditional entropy
What is the chain rule for three random variables?
One correct option A H ( X , Y , Z ) = H ( X ) + H ( Y ) + H ( Z ) H(X,Y,Z)=H(X)+H(Y)+H(Z) H ( X , Y , Z ) = H ( X ) + H ( Y ) + H ( Z ) for all X , Y , Z X,Y,Z X , Y , Z B H ( X , Y , Z ) = H ( X ) + H ( Y ∣ X ) + H ( Z ∣ X , Y ) H(X,Y,Z)=H(X)+H(Y\mid X)+H(Z\mid X,Y) H ( X , Y , Z ) = H ( X ) + H ( Y ∣ X ) + H ( Z ∣ X , Y ) C H ( X , Y , Z ) = H ( X ) + H ( Y ∣ X ) + H ( Z ∣ Y ) H(X,Y,Z)=H(X)+H(Y\mid X)+H(Z\mid Y) H ( X , Y , Z ) = H ( X ) + H ( Y ∣ X ) + H ( Z ∣ Y ) D H ( X , Y , Z ) = H ( X ) H ( Y ∣ X ) H ( Z ∣ X , Y ) H(X,Y,Z)=H(X)H(Y\mid X)H(Z\mid X,Y) H ( X , Y , Z ) = H ( X ) H ( Y ∣ X ) H ( Z ∣ X , Y ) Check
A) H ( X , Y , Z ) = H ( X ) + H ( Y ) + H ( Z ) H(X,Y,Z)=H(X)+H(Y)+H(Z) H ( X , Y , Z ) = H ( X ) + H ( Y ) + H ( Z ) for all X , Y , Z X,Y,Z X , Y , Z
B) H ( X , Y , Z ) = H ( X ) + H ( Y ∣ X ) + H ( Z ∣ X , Y ) H(X,Y,Z)=H(X)+H(Y\mid X)+H(Z\mid X,Y) H ( X , Y , Z ) = H ( X ) + H ( Y ∣ X ) + H ( Z ∣ X , Y )
C) H ( X , Y , Z ) = H ( X ) + H ( Y ∣ X ) + H ( Z ∣ Y ) H(X,Y,Z)=H(X)+H(Y\mid X)+H(Z\mid Y) H ( X , Y , Z ) = H ( X ) + H ( Y ∣ X ) + H ( Z ∣ Y )
D) H ( X , Y , Z ) = H ( X ) H ( Y ∣ X ) H ( Z ∣ X , Y ) H(X,Y,Z)=H(X)H(Y\mid X)H(Z\mid X,Y) H ( X , Y , Z ) = H ( X ) H ( Y ∣ X ) H ( Z ∣ X , Y )
Answer and explanation Correct answer: B. Each new variable is added conditioned on all previous ones, not just the most recent. Conditioning only on Y, as in option C, drops information that X may still carry about Z.
Question 2.2.2 2.2. Joint and conditional entropy
Which statement about conditional entropy is correct?
A) For every x x x , necessarily H ( Y ∣ X = x ) ≤ H ( Y ) H(Y\mid X=x)\le H(Y) H ( Y ∣ X = x ) ≤ H ( Y )
B) Always H ( Y ∣ X ) = H ( Y ) − H ( X ) H(Y\mid X)=H(Y)-H(X) H ( Y ∣ X ) = H ( Y ) − H ( X )
C) Always H ( Y ∣ X ) < H ( Y ) H(Y\mid X)<H(Y) H ( Y ∣ X ) < H ( Y ) unless Y Y Y is constant
D) Always H ( Y ∣ X ) ≤ H ( Y ) H(Y\mid X)\le H(Y) H ( Y ∣ X ) ≤ H ( Y ) , but for an individual x x x it may happen that H ( Y ∣ X = x ) > H ( Y ) H(Y\mid X=x)>H(Y) H ( Y ∣ X = x ) > H ( Y )
Answer and explanation Correct answer: D. The inequality concerns the average over X. A particular observation can reveal a more ambiguous regime, and under independence the inequality is an equality, which rules out option C.
Question 2.2.3 2.2. Joint and conditional entropy
When does
H ( X , Y ) = H ( X ) + H ( Y ) H(X,Y)=H(X)+H(Y) H ( X , Y ) = H ( X ) + H ( Y )
hold?
A) For all discrete X X X and Y Y Y
B) If and only if X = Y X=Y X = Y
C) If and only if X X X and Y Y Y are independent
D) Whenever X X X and Y Y Y are uncorrelated
Answer and explanation Correct answer: C. By the chain rule, equality is equivalent to H(Y|X) = H(Y), which happens exactly under independence. Zero correlation is a much weaker condition and does not suffice.
Question 2.2.4 2.2. Joint and conditional entropy
Suppose data are generated by a distribution P P P , while an autoregressive model defines Q θ Q_\theta Q θ . What does
E X 1 : n ∼ P [ − log 2 q θ ( X 1 : n ) ] \mathbb E_{X_{1:n}\sim P}\!\left[-\log_2q_\theta(X_{1:n})\right] E X 1 : n ∼ P [ − log 2 q θ ( X 1 : n ) ]
compute?
A) The entropy of P P P for every model
B) The cross-entropy of source P P P relative to model Q θ Q_\theta Q θ
C) The entropy of the parameters θ \theta θ
D) The predictive entropy of Q θ Q_\theta Q θ
Answer and explanation Correct answer: B. Whose distribution sits inside the logarithm and whose supplies the averaging are different questions. This equals the entropy of P only when the model and source conditionals agree P-almost surely, and it is not the model's own predictive entropy, which averages under Q.
Question 2.3.2 2.3. A coin, entropy rate, and English text
For a stationary process on a finite alphabet, the entropy rate can be written as
One correct option A h = lim n → ∞ H ( X n ) \displaystyle h=\lim_{n\to\infty}H(X_n) h = n → ∞ lim H ( X n ) B h = ∑ n = 1 ∞ H ( X n ) \displaystyle h=\sum_{n=1}^{\infty}H(X_n) h = n = 1 ∑ ∞ H ( X n ) C h = lim n → ∞ 1 n H ( X n ∣ X 1 , … , X n − 1 ) \displaystyle h=\lim_{n\to\infty}\frac1nH(X_n\mid X_1,\ldots,X_{n-1}) h = n → ∞ lim n 1 H ( X n ∣ X 1 , … , X n − 1 ) D h = lim n → ∞ H ( X n ∣ X 1 , … , X n − 1 ) = lim n → ∞ 1 n H ( X 1 , … , X n ) \displaystyle h=\lim_{n\to\infty}H(X_n\mid X_1,\ldots,X_{n-1})=\lim_{n\to\infty}\frac1nH(X_1,\ldots,X_n) h = n → ∞ lim H ( X n ∣ X 1 , … , X n − 1 ) = n → ∞ lim n 1 H ( X 1 , … , X n ) Check
A) h = lim n → ∞ H ( X n ) \displaystyle h=\lim_{n\to\infty}H(X_n) h = n → ∞ lim H ( X n )
B) h = ∑ n = 1 ∞ H ( X n ) \displaystyle h=\sum_{n=1}^{\infty}H(X_n) h = n = 1 ∑ ∞ H ( X n )
C) h = lim n → ∞ 1 n H ( X n ∣ X 1 , … , X n − 1 ) \displaystyle h=\lim_{n\to\infty}\frac1nH(X_n\mid X_1,\ldots,X_{n-1}) h = n → ∞ lim n 1 H ( X n ∣ X 1 , … , X n − 1 )
D) h = lim n → ∞ H ( X n ∣ X 1 , … , X n − 1 ) = lim n → ∞ 1 n H ( X 1 , … , X n ) \displaystyle h=\lim_{n\to\infty}H(X_n\mid X_1,\ldots,X_{n-1})=\lim_{n\to\infty}\frac1nH(X_1,\ldots,X_n) h = n → ∞ lim H ( X n ∣ X 1 , … , X n − 1 ) = n → ∞ lim n 1 H ( X 1 , … , X n )
Answer and explanation Correct answer: D. Under stationarity the next-symbol conditional entropies are non-increasing and converge, and normalized block entropy has the same limit as a Cesàro mean. Note that the conditional entropy is not divided by n, which is the error in option C.
Question 2.3.3 2.3. A coin, entropy rate, and English text
What is the most accurate reading of Shannon's 1951 result for English text?
A) In a particular prediction experiment he obtained roughly 0.6 to 1.3 bits per symbol as lower and upper bounds at long context, and concluded the magnitude was about one bit
B) He measured the loss of a language model on a test corpus
C) He proved a universal constant of exactly 1 bit for every English character
D) He established the entropy rate of English independently of the alphabet and the preprocessing
Answer and explanation Correct answer: A. Shannon emphasized the limits of the sample and the method. The result is historically important, but it is not an exact constant, and it is stated for a specific 27-symbol alphabet and protocol.
Question 2.3.4 2.3. A coin, entropy rate, and English text
What does bits per character computed from a particular LLM on a fixed corpus primarily measure?
A) The number of model parameters per character
B) A universal entropy of English independent of corpus and model
C) A model-dependent cross-entropy, that is a coding rate under the specified evaluation setup
D) A lower bound on the entropy rate of the source
Answer and explanation Correct answer: C. The result depends on corpus, preprocessing, available context, model, and possible leakage. Expected cross-entropy is no smaller than the corresponding source entropy. Average NLL on one finite corpus can fluctuate in either direction and does not by itself certify an upper or lower bound on entropy rate.
Question 2.4.1 2.4. Applications in ML/NLP/LLMs
Low predictive entropy of an LLM at a fixed context means that
A) probability mass is concentrated on a small number of tokens
B) the most probable token is factually correct
C) the model is well calibrated
D) the loss on the observed token will be small
Answer and explanation Correct answer: A. Entropy measures concentration and nothing else. A model can be confidently wrong, which is exactly the case where the entropy is low and the loss on the observed token is large.
Question 2.4.4 2.4. Applications in ML/NLP/LLMs
What is the general relationship between mean loss L ^ b \widehat L_b L b and perplexity?
A) PPL = log b L ^ b \operatorname{PPL}=\log_b\widehat L_b PPL = log b L b , independent of tokenization
B) PPL = b L ^ b \operatorname{PPL}=b^{\widehat L_b} PPL = b L b , and its numerical value also depends on tokenization
C) PPL = b L ^ b \operatorname{PPL}=b^{\widehat L_b} PPL = b L b , and it is comparable across tokenizers
D) PPL = 1 − L ^ b \operatorname{PPL}=1-\widehat L_b PPL = 1 − L b
Answer and explanation Correct answer: B. The base must match the base the loss was measured in: e for nats, 2 for bits. The tokenizer defines the prediction events themselves, so perplexities from different tokenizers are not directly comparable.
Question 2.1.4 Optional mathematical and engineering deepening
Why is it convenient to restrict to the support S = { x : p ( x ) > 0 } \mathcal S=\{x:p(x)>0\} S = { x : p ( x ) > 0 } in the Jensen proof of H ( X ) ≤ log 2 n H(X)\le\log_2n H ( X ) ≤ log 2 n ?
A) Because entropy is defined only for strictly positive probabilities
B) To change the logarithm base from 2 to e e e
C) To avoid the undefined expression 1 / p ( x ) 1/p(x) 1/ p ( x ) when p ( x ) = 0 p(x)=0 p ( x ) = 0
D) Because Jensen's inequality requires a finite support
Answer and explanation Correct answer: C. The convention 0 log 0 = 0 defines entropy correctly on the boundary of the simplex, so entropy itself is fine there. It is the intermediate expression inside the Jensen step that breaks at zero probability.
Question 2.3.1 Optional mathematical and engineering deepening
Why does the module denote binary entropy by h 2 ( p ) h_2(p) h 2 ( p ) rather than H 2 ( p ) H_2(p) H 2 ( p ) ?
A) Lowercase marks a quantity measured in nats
B) Uppercase H H H is reserved for continuous random variables
C) The notation changes the logarithm base from 2 to e e e
D) Lowercase h 2 h_2 h 2 avoids confusion with Rényi entropy of order 2
Answer and explanation Correct answer: D. The subscript 2 means two outcomes here, while in H₂ it usually means the Rényi order. The case of the letter is the only thing separating the two conventions.
Question 2.4.2 Optional mathematical and engineering deepening
Let q T ( v ) ∝ exp ( z v / T ) q_T(v)\propto\exp(z_v/T) q T ( v ) ∝ exp ( z v / T ) for fixed logits. How does entropy vary with T T T ?
A) It is non-increasing
B) It is non-decreasing; in nats, d H ( q T ) d T = Var q T ( z ) T 3 ≥ 0 \displaystyle \frac{dH(q_T)}{dT}=\frac{\operatorname{Var}_{q_T}(z)}{T^3}\ge0 d T d H ( q T ) = T 3 Var q T ( z ) ≥ 0
C) It is always constant
D) It is non-decreasing, and the same argument covers top-k k k and top-p p p filtering
Answer and explanation Correct answer: B. Unless all logits are equal, entropy increases strictly with temperature. The statement is specific to pure temperature scaling: truncation methods first change the support and then renormalize, so they need a separate argument.
Question 2.4.3 Optional mathematical and engineering deepening
In basic one-step exact speculative decoding, the mean probability of accepting a draft token is
A) ∑ v min { p ( v ) , q ( v ) } = 1 − TV ( p , q ) \sum_v\min\{p(v),q(v)\}=1-\operatorname{TV}(p,q) ∑ v min { p ( v ) , q ( v )} = 1 − TV ( p , q )
B) H ( p ) + H ( q ) H(p)+H(q) H ( p ) + H ( q )
C) 1 − TV ( p , q ) 1-\operatorname{TV}(p,q) 1 − TV ( p , q ) only when p p p and q q q have equal entropy
D) 1 − H ( q ) 1-H(q) 1 − H ( q )
Answer and explanation Correct answer: A. Acceptance is determined by the overlap of the draft and target distributions. Two drafts with identical entropy can have completely different acceptance rates, because entropy says nothing about where the mass lies.
Question 2.C.1 Computational block
Compute the entropy of q B = ( 0.40 , 0.30 , 0.20 , 0.10 ) q_B=(0.40,0.30,0.20,0.10) q B = ( 0.40 , 0.30 , 0.20 , 0.10 ) in bits. (tolerance 0.002)
Answer Absolute tolerance: ±0.002
Check
Answer and explanation Numeric answer: 1.846 (tolerance 0.002). The classifier q_A = (0.97, 0.01, 0.01, 0.01) from §2.1 has the same argmax but an entropy of only 0.242 bits. Entropy is what separates them; the decision does not.
Question 2.C.2 Computational block
For the same q B q_B q B , compute the effective number of alternatives 2 H 2^{H} 2 H . (tolerance 0.005)
Answer Absolute tolerance: ±0.005
Check
Answer and explanation Numeric answer: 3.596 (tolerance 0.005). Four outcomes with these probabilities carry as much uncertainty as about 3.6 equally likely ones. The number need not be an integer and is not the size of the support.
Question 2.C.3 Computational block
A biased die has p = ( 1 / 2 , 1 / 4 , 1 / 8 , 1 / 16 , 1 / 32 , 1 / 32 ) p=(1/2,1/4,1/8,1/16,1/32,1/32) p = ( 1/2 , 1/4 , 1/8 , 1/16 , 1/32 , 1/32 ) . Compute its entropy in bits. (tolerance 0.002)
Answer Absolute tolerance: ±0.002
Check
Answer and explanation Numeric answer: 1.9375 (tolerance 0.002). Every probability is a power of two, so each surprisal is a whole number of bits and the entropy comes out exactly. A fair die would cost log₂ 6 = 2.585 bits, so the bias saves about 0.647 bits per roll.
Question 2.C.4 Computational block
(optional)
A target distribution is p = ( 0.9 , 0.1 ) p=(0.9,0.1) p = ( 0.9 , 0.1 ) and a draft is q = ( 0.1 , 0.9 ) q=(0.1,0.9) q = ( 0.1 , 0.9 ) . Compute the mean acceptance probability in one-step exact speculative decoding. (tolerance 0.005)
Answer Absolute tolerance: ±0.005
Check
Answer and explanation Numeric answer: 0.2 (tolerance 0.005). The overlap is min(0.9, 0.1) + min(0.1, 0.9) = 0.2. A draft equal to p would give 1.0 at exactly the same entropy, which is why acceptance depends on agreement rather than on sharpness.