29/32
Part 6 of 6 · What interviewers ask nextLearn and do

Layer norm's backward mixes every feature in a row

Layer norm and batch norm both subtract a mean and divide by a spread. They differ only in the axis. Layer norm takes the mean across each row, axis 1. Batch norm takes it down each column, axis 0:

Layer norm reads across a row, batch norm down a columnInteractive
x.mean(axis=1, keepdims=True)
feature 0feature 1feature 2feature 3meanexample 0→example 1→example 2→
shape(3, 4)→(3, 1)the 4 features squash to 1, and the axis stays
example 0: (1 + 3 + 2 + 6) / 4 = 3. It stands beside example 0's row.
Predict

Layer norm rescales one example across its features. Which inputs does one of its outputs depend on?

Pick an answer above to see the rest
Predict

Why does each row of layer norm's dx sum to zero?

Pick an answer above to see the rest