Md. Asif Uddin
    I.12.X06

    Weight decay fixes the axes

    symbolic▲▲▲

    Add the penalty γ(∥E∥F2+∥D∥F2)\gamma(\|\mat E\|_F^2+\|\mat D\|_F^2), with γ>0\gamma>0, to the loss of (I.12.2).

    (a) Write the two stationarity conditions and prove that DTD=EET\mat D^{\mathsf T}\mat D=\mat E\mat E^{\mathsf T} at every stationary point.

    (b) Let D=UkC\mat D=\mat U_k\mat C and E=DT\mat E=\mat D^{\mathsf T} with C=diag⁡(c1,…,ck)\mat C=\operatorname{diag}(c_1,\ldots,c_k). Show that this pair is stationary when ci2=1−γ/λic_i^2=1-\gamma/\lambda_i, and find the end-to-end map.

    (c) For the four points, with k=2k=2 and γ=0.5\gamma=0.5, find the gains, the decoder and the value of the objective. Compare it with the identity.

    (d) Explain why the principal axes can be read from this decoder and not from an unpenalised one.

    (e) What happens to a direction with λi≤γ\lambda_i\leq\gamma?

    Hint

    For (b), use SUk=UkΛk\mat S\mat U_k=\mat U_k\mat\Lambda_k and UkTUk=I\mat U_k^{\mathsf T}\mat U_k=\mat I, where Λk=diag⁡(λ1,…,λk)\mat\Lambda_k=\operatorname{diag}(\lambda_1,\ldots,\lambda_k).

    Solution

    (a) The penalty adds 2γD2\gamma\mat D and 2γE2\gamma\mat E to the gradients of (I.12.2). Setting both to zero:

    (I−DE) S ET=γD,DT(I−DE) S=γE.\begin{aligned} (\mat I-\mat D\mat E)\,\mat S\,\mat E^{\mathsf T}&=\gamma\mat D,\\ \mat D^{\mathsf T}(\mat I-\mat D\mat E)\,\mat S&=\gamma\mat E. \end{aligned}

    Multiply the first on the left by DT\mat D^{\mathsf T} and the second on the right by ET\mat E^{\mathsf T}. Both left-hand sides become DT(I−DE)SET\mat D^{\mathsf T}(\mat I-\mat D\mat E)\mat S\mat E^{\mathsf T}, so γDTD=γEET\gamma\mat D^{\mathsf T}\mat D=\gamma\mat E\mat E^{\mathsf T}. Divide by γ\gamma.

    (b) Here DE=UkC2UkT\mat D\mat E=\mat U_k\mat C^2\mat U_k^{\mathsf T}. Using the hint,

    (I−DE) S ET    =(I−UkC2UkT) UkΛkC    =Uk(I−C2)ΛkC.\begin{aligned} &(\mat I-\mat D\mat E)\,\mat S\,\mat E^{\mathsf T}\\ &\;\;=(\mat I-\mat U_k\mat C^2\mat U_k^{\mathsf T})\,\mat U_k\mat\Lambda_k\mat C\\ &\;\;=\mat U_k(\mat I-\mat C^2)\mat\Lambda_k\mat C. \end{aligned}

    This equals γD=γUkC\gamma\mat D=\gamma\mat U_k\mat C when (1−ci2)λi=γ(1-c_i^2)\lambda_i=\gamma for every ii, that is, ci2=1−γ/λic_i^2=1-\gamma/\lambda_i. Since DE\mat D\mat E and S\mat S are both symmetric and share eigenvectors, they commute, and the second condition is the transpose of the first. The end-to-end map is

    DE=Ukdiag⁡(1−γ/λi) UkT.\mat D\mat E=\mat U_k\operatorname{diag}(1-\gamma/\lambda_i)\, \mat U_k^{\mathsf T}.

    Replacing D\mat D by DOT\mat D\mat O^{\mathsf T} and E\mat E by OE\mat O\mat E for an orthogonal O\mat O changes neither condition nor either norm. That gives the family (I.12.6).

    (c) The gains are 1−0.5/4=0.8751-0.5/4=0.875 and 1−0.5/1=0.51-0.5/1=0.5, so c=(0.935414,  0.707107)c=(0.935414,\;0.707107). The decoder’s columns are

    0.935414[0.80.6]=[0.7483310.561249],0.707107[−0.60.8]=[−0.4242640.565685].\begin{aligned} 0.935414\begin{bmatrix}0.8\\0.6\end{bmatrix} &=\begin{bmatrix}0.748331\\0.561249\end{bmatrix},\\[2pt] 0.707107\begin{bmatrix}-0.6\\0.8\end{bmatrix} &=\begin{bmatrix}-0.424264\\0.565685\end{bmatrix}. \end{aligned}

    The reconstruction term is ∑i(1−gi)2λi=0.0625+0.25=0.3125\sum_i(1-g_i)^2\lambda_i=0.0625+0.25=0.3125. The penalty is γ⋅2∑ici2=0.5⋅2⋅1.375=1.375\gamma\cdot2\sum_ic_i^2=0.5\cdot2\cdot1.375=1.375. The objective is 1.68751.6875. The identity, E=D=I\mat E=\mat D=\mat I, reconstructs exactly and pays 0.5⋅4=20.5\cdot4=2. With weight decay, copying is no longer the best answer even at full width.

    (d) The expression D=UkCOT\mat D=\mat U_k\mat C\mat O^{\mathsf T} is a singular value decomposition of the decoder: left singular vectors ui\vec u_i, singular values cic_i. When the λi\lambda_i are distinct, so are the cic_i, and the left singular vectors are determined up to sign and come out in order of λi\lambda_i. The unknown rotation O\mat O sits on the right and does not disturb them.

    Without the penalty the decoder is UkG\mat U_k\mat G for an arbitrary invertible G\mat G. Its left singular vectors are Uk\mat U_k times those of G\mat G, which can be any orthonormal basis of the subspace.

    (e) In this family the contribution of one direction to the objective is (1−c2)2λ+2γc2(1-c^2)^2\lambda+2\gamma c^2. Its derivative with respect to c2c^2 is −2(1−c2)λ+2γ-2(1-c^2)\lambda+2\gamma, which is non-negative for all c2≥0c^2\geq0 when λ≤γ\lambda\leq\gamma. The best choice is then c=0c=0: the direction is not learned at all. Weight decay sets a floor on the variance a direction needs before it is worth representing.

    For the four points with γ=1\gamma=1, the second direction has λ2=γ\lambda_2=\gamma and is dropped. The first has gain 0.750.75, the decoder is 0.75 u1=(0.692820,  0.519615)\sqrt{0.75}\,\vec u_1=(0.692820,\;0.519615), and the objective is 0.25+1+1.5=2.750.25+1+1.5=2.75.

    The script checks the stationarity of (c) to machine precision, confirms that sixteen small perturbations all raise the objective, and confirms that rotating the code leaves it unchanged.

    Draws on