Extra Bits Per Token

Information Theory & Stochastic ProcessesMedium+20 XP+20

Extra Bits Per Token

A tagger sorts every token of a corpus into one of three buckets: noun, verb, other. Counting over the whole corpus gives the true distribution

P=[ 0.7, 0.2, 0.1 ]P = [\,0.7,\ 0.2,\ 0.1\,]P=[0.7, 0.2, 0.1]

A crude baseline model, which never looks at context, always predicts

Q=[ 0.5, 0.25, 0.25 ]Q = [\,0.5,\ 0.25,\ 0.25\,]Q=[0.5, 0.25, 0.25]

You want to know how many extra bits per token this baseline wastes compared with a coder that knew PPP exactly — that is, the KL divergence DKL(P∥Q)D_{KL}(P \parallel Q)DKL​(P∥Q) measured in bits.

Base-2 logarithms (you will not need all of them):

vvv0.10.10.10.20.20.20.250.250.250.50.50.50.70.70.7
log⁡2v\log_2 vlog2​v−3.3219-3.3219−3.3219−2.3219-2.3219−2.3219−2.0000-2.0000−2.0000−1.0000-1.0000−1.0000−0.5146-0.5146−0.5146

What is DKL(P∥Q)D_{KL}(P \parallel Q)DKL​(P∥Q), in bits? Round your answer to 3 decimal places.

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.

bits