Mathematical Foundations

II.19 · Linear Algebra

Every linear map has perpendicular input and output stories.

Turn the input, scale perpendicular axes, then turn the output. Inspect four synchronized views as a circle becomes an ellipse, a segment or a point, and compare the composed transformation with the original matrix.

Reconstruct A through three inspectable transformations

Input: the unit circle

Exact rank 2: the unit circle becomes an ellipse. Singular values are sorted and nonnegative. All reconstruction and orthogonality checks pass the documented binary64 tolerance. The selected vector is approximately (1, 1). All four panes use the same coordinate scale.

1. Vᵀ: rotate / reflect

Exact rank 2: the unit circle becomes an ellipse. Singular values are sorted and nonnegative. All reconstruction and orthogonality checks pass the documented binary64 tolerance. The selected vector is approximately (1.284831, 0.590939). All four panes use the same coordinate scale.

2. Σ: perpendicular scaling

Exact rank 2: the unit circle becomes an ellipse. Singular values are sorted and nonnegative. All reconstruction and orthogonality checks pass the documented binary64 tolerance. The selected vector is approximately (4.085233, 0.557562). All four panes use the same coordinate scale.

3. U: rotate / reflect

Exact rank 2: the unit circle becomes an ellipse. Singular values are sorted and nonnegative. All reconstruction and orthogonality checks pass the documented binary64 tolerance. The selected vector is approximately (4.000000, 1). All four panes use the same coordinate scale. The dashed teal segment is the image of the unit circle under the rank-one approximation. Its teal connector to the selected output shows the discarded component.

Exact rank (no threshold)
2
Strongest singular value
3.179587
Weakest singular value
0.943519
2-norm condition number
3.369924
Left singular frame
[0.994029, −0.109117; 0.109117, 0.994029]
Right frame transpose
[0.937885, 0.346946; −0.346946, 0.937885]
Frobenius reconstruction error
2.54384×10⁻¹⁶
U orthogonality error
3.14018×10⁻¹⁶
V orthogonality error
0
Measured companion error (Frobenius)
0.943519
Pseudoinverse companion
[0.333333, −0.333333; 2.77556×10⁻¹⁷, 1]
Minimum-norm recovered input
(1.000000, 1)

Exact values use =; numerical companions use ≈. Rank and zero decisions are exact.

Exact rank 2: the unit circle becomes an ellipse. Singular values are sorted and nonnegative. All reconstruction and orthogonality checks pass the documented binary64 tolerance.

A=[3101],A≈UΣVTA=\begin{bmatrix}3&1\\0&1\end{bmatrix},\quad A\approx U\Sigma V^T
U≈[0.994029−0.1091170.1091170.994029],Σ≈[3.179587000.943519]U\approx\begin{bmatrix}0.994029&-0.109117\\0.109117&0.994029\end{bmatrix},\quad\Sigma\approx\begin{bmatrix}3.179587&0\\0&0.943519\end{bmatrix}
VT≈[0.9378850.346946−0.3469460.937885]V^T\approx\begin{bmatrix}0.937885&0.346946\\-0.346946&0.937885\end{bmatrix}
UΣVT≈[31−5.55112×10−171]U\Sigma V^T\approx\begin{bmatrix}3&1\\-5.55112\times 10^{-17}&1\end{bmatrix}
A1=σ1u1v1T≈[2.9642811.0965590.3253960.120372]A_1=\sigma_1u_1v_1^T\approx\begin{bmatrix}2.964281&1.096559\\0.325396&0.120372\end{bmatrix}
∥A−A1∥F=σ2≈0.943519\|A-A_1\|_F=\sigma_2\approx0.943519
A+=VΣ+UT,σj+={1/σjσj>00σj=0A^+=V\Sigma^+U^T,\quad\sigma_j^+=\begin{cases}1/\sigma_j&\sigma_j>0\\0&\sigma_j=0\end{cases}

Right directions from AᵀA

AᵀA is symmetric and positive semidefinite. Its orthogonal eigen-directions are the right singular directions; squared singular values are its eigenvalues.

ATA=[9332]A^TA=\begin{bmatrix}9&3\\3&2\end{bmatrix}

from −4 to 4, up to 2 decimal places

from −4 to 4, up to 2 decimal places

from −4 to 4, up to 2 decimal places

from −4 to 4, up to 2 decimal places

from −4 to 4, up to 2 decimal places

from −4 to 4, up to 2 decimal places

Follow the input, Vᵀ, Σ, and U panes in order. The solid final curve is UΣVᵀ acting on the circle; the thin dashed overlay is A acting directly. The teal dashed segment is the rank-one image, and its connector to the selected output is the discarded component.

Drag the input vector, change a matrix entry, then replay the factor actions. Choose Rank one to collapse the ellipse to a segment, Zero to collapse everything to the origin, and Reflection to see why an orthogonal factor can reverse orientation. All four panes use the same coordinate scale, so a change of length is visible rather than hidden by independent zooms.

Intuition: choose axes that separate the action

A shear seems to mix coordinates. But some perpendicular input directions have perpendicular output images. Measure the strength along those directions, and the map becomes three simple actions: read coordinates in the right input frame, scale those coordinates, then assemble them in the left output frame.

The unit circle contains every unit input direction. Its image is an ellipse for a full-rank map, a segment for rank one, or a point for rank zero. The ellipse’s longest and shortest radii are the singular values. They measure lengths, so they cannot be negative. Reversals belong to the orthogonal frames.

Definition

For a real square 2×2 matrix, an SVD is

A=UΣVT,UTU=VTV=I,Σ=[σ100σ2],σ1≥σ2≥0.A=U\Sigma V^T,\qquad U^TU=V^TV=I,\qquad \Sigma=\begin{bmatrix}\sigma_1&0\\0&\sigma_2\end{bmatrix},\qquad \sigma_1\geq\sigma_2\geq0.

The columns vjv_j of VV are right singular directions, and the columns uju_j of UU are left singular directions. They satisfy Avj=σjujAv_j=\sigma_ju_j. The relation defines a direction in the output only when σj>0\sigma_j>0; a zero singular value maps its right direction to zero. Completing UU orthogonally in an unused output direction is a choice.

The exact rank is the number of mathematically nonzero singular values. The explorer decides that rank from the entered rational matrix first, then constructs approximate spectral companions. A numerical cutoff does not redefine the entered map.

Mechanics: follow one vector through all three factors

The first pane shows xx and the unit circle. The second shows VTxV^Tx: coordinates in the orthogonal right frame. Length is preserved. The third applies Σ\Sigma, stretching each coordinate along a perpendicular axis. The fourth applies UU and reconstructs the output.

x⟼VTx⟼ΣVTx⟼UΣVTx=Ax.x\longmapsto V^Tx\longmapsto\Sigma V^Tx\longmapsto U\Sigma V^Tx=Ax.

The input pane draws v1,v2v_1,v_2; the output pane draws σ1u1,σ2u2\sigma_1u_1,\sigma_2u_2. A very weak axis can be smaller than a screen pixel at the shared scale; the positive inspector value still distinguishes it from an exact zero. The trace contains actual factors, vector states and sampled circle states. Numeric fields and keyboard arrows update the same canonical state as dragging. Read the inspector’s approximate factors and their reconstruction and orthogonality errors together.

Derivation: why perpendicular directions exist

For any input vv, ∥Av∥2=vTATAv\|Av\|^2=v^TA^TAv. The Gram matrix G=ATAG=A^TA is symmetric and positive semidefinite, since this squared length is nonnegative. Its orthonormal eigenvectors v1,v2v_1,v_2 have nonnegative eigenvalues σ12,σ22\sigma_1^2,\sigma_2^2.

If both singular values are positive, define uj=Avj/σju_j=Av_j/\sigma_j. Then

uiTuj=viTATAvjσiσj=σj2viTvjσiσj.u_i^Tu_j=\frac{v_i^TA^TAv_j}{\sigma_i\sigma_j} =\frac{\sigma_j^2v_i^Tv_j}{\sigma_i\sigma_j}.

This is one when i=ji=j and zero otherwise, so the output directions are orthonormal. As AV=UΣAV=U\Sigma and V−1=VTV^{-1}=V^T, multiplying on the right gives A=UΣVTA=U\Sigma V^T. For a zero singular value, do not use that division: complete the surviving orthogonal direction instead. The zero map permits any orthogonal input and output frames.

For G=[g11g12g12g22]G=\begin{bmatrix}g_{11}&g_{12}\\g_{12}&g_{22}\end{bmatrix}, its eigenvalues are

g11+g22±(g11−g22)2+4g1222.\frac{g_{11}+g_{22}\pm\sqrt{(g_{11}-g_{22})^2+4g_{12}^2}}2.

The pedagogical implementation uses a symmetric 2×2 Jacobi angle to obtain a right frame. It measures σ1=∥Av1∥\sigma_1=\|Av_1\|, and for exact full rank obtains σ2=∣det⁡A∣/σ1\sigma_2=|\det A|/\sigma_1. Computing the determinant exactly before conversion avoids subtracting nearly equal Gram eigenvalues to obtain a weak axis. A repeated spectrum uses equal values and a convenient coordinate frame.

Worked examples: signs, collapse and ambiguity

For A=diag⁡(3,−1)A=\operatorname{diag}(3,-1), take V=IV=I, Σ=diag⁡(3,1)\Sigma=\operatorname{diag}(3,1) and U=diag⁡(1,−1)U=\operatorname{diag}(1,-1). An input (2,1)(2,1) becomes (2,1)(2,1), then (6,1)(6,1), then (6,−1)(6,-1). The singular values are 3,13,1, while the eigenvalues are 3,−13,-1. These answer different questions: lengths along perpendicular input/output frames versus gains on preserved lines.

For the opening shear A=[3101]A=\begin{bmatrix}3&1\\0&1\end{bmatrix}, the Gram matrix is [9332]\begin{bmatrix}9&3\\3&2\end{bmatrix}. Its eigenvalues are (11±85)/2(11\pm\sqrt{85})/2. Taking their nonnegative square roots gives approximately 3.179593.17959 and 0.9435190.943519. Replay the actual factor actions and compare the last vector with the direct output (4,1)(4,1).

Replay the worked derivation

Right directions from AᵀA

AᵀA is symmetric and positive semidefinite. Its orthogonal eigen-directions are the right singular directions; squared singular values are its eigenvalues.

ATA=[9332]A^TA=\begin{bmatrix}9&3\\3&2\end{bmatrix}
Replay the Gram construction, each vector/factor state, reconstruction checks, then the low-rank and pseudoinverse consequences.

For A=[1224]A=\begin{bmatrix}1&2\\2&4\end{bmatrix}, the singular values are 5,05,0. The right direction (1,2)/5(1,2)/\sqrt5 survives; (−2,1)/5(-2,1)/\sqrt5 disappears. Inputs that differ by a multiple of (−2,1)(-2,1) have identical outputs.

For 2I2I, both singular values equal two. Every unit input is stretched by the same amount, so no direction is preferred. Any orthogonal QQ gives 2I=Q(2I)QT2I=Q(2I)Q^T. The displayed axes are one choice; they can change abruptly near a repeated spectrum without the original transformation changing abruptly.

Derivation: keep the strongest term

The decomposition is a sum of perpendicular outer products:

A=σ1u1v1T+σ2u2v2T,A1=σ1u1v1T.A=\sigma_1u_1v_1^T+\sigma_2u_2v_2^T, \qquad A_1=\sigma_1u_1v_1^T.

The Frobenius norm is ∥B∥F=∑ijBij2\|B\|_F=\sqrt{\sum_{ij}B_{ij}^2}. A unit-vector outer product has Frobenius norm one, so here ∥A−A1∥F=σ2\|A-A_1\|_F=\sigma_2. This is a best approximation of rank at most one in that norm; for the zero map it still has rank zero.

To see why no rank-one competitor BB can do better, choose a unit vector in ker⁡B\ker B. Then ∥(A−B)v∥=∥Av∥≥σ2\|(A-B)v\|=\|Av\|\geq\sigma_2, and the Frobenius norm bounds the length of the action on any unit vector. The truncated SVD attains that bound. For a general matrix, dropping all but the first kk terms gives Frobenius error ∑j>kσj2\sqrt{\sum_{j>k}\sigma_j^2}. Equal singular values can make the best approximation nonunique.

Pseudoinverse: fit what is reachable, recover the smallest input

Invert each nonzero strength and leave zero strengths at zero:

A+=VΣ+UT,σj+={1/σjσj>00σj=0.A^+=V\Sigma^+U^T,\qquad \sigma_j^+=\begin{cases}1/\sigma_j&\sigma_j>0\\0&\sigma_j=0.\end{cases}

For bb, A+bA^+b minimizes ∥Ax−b∥\|Ax-b\|, and among all those minimizers it has the smallest input norm. AA+bAA^+b is the projection onto the column space. A+AxA^+Ax is the projection of an input onto the row space, so it recovers xx only when xx has no lost null-space component.

For A=diag⁡(2,0)A=\operatorname{diag}(2,0) and b=(4,3)b=(4,3), A+b=(2,0)A^+b=(2,0). Every input (2,t)(2,t) has the same residual (0,−3)(0,-3); choosing t=0t=0 minimizes input length. No inverse reconstructs the erased coordinate. The explorer reports A+(Ax)A^+(Ax) and withholds numerical recovery when conditioning exceeds its documented accuracy budget.

Rectangular dimensions and executable code

For an m×nm\times n matrix with k=min⁡(m,n)k=\min(m,n), a thin decomposition has UU of shape m×km\times k, Σ\Sigma of shape k×kk\times k and VTV^T of shape k×nk\times n. The products have shape m×nm\times n. In a full decomposition, UU and VV are square orthogonal matrices and Σ\Sigma is rectangular. Thin factors have orthonormal columns/rows rather than necessarily being square invertible maps.

The small Python reference exposes the 2×2 mechanics. NumPy supplies a practical rectangular decomposition, low-rank reconstruction and least-squares pseudoinverse. Its explicit rcond is a numerical modeling policy; it may report a numerical rank different from the exact rank of entered rationals.

code/python/svd.py
"""Educational 2×2 decomposition: symmetric Jacobi angle, scale, orthogonal output frame."""
from fractions import Fraction as F
from math import atan2,cos,sin,hypot

def svd2(a):
    p,q,r,s=[F(str(x)) for row in a for x in row]
    det=p*s-q*r
    if not any((p,q,r,s)):
        return [[1.,0.],[0.,1.]],[0.,0.],[[1.,0.],[0.,1.]]
    g11,g12,g22=p*p+r*r,p*q+r*s,q*q+s*s
    angle=.5*atan2(2*float(g12),float(g11-g22))
    v1=(cos(angle),sin(angle));v2=(-v1[1],v1[0])
    mapped=(float(p)*v1[0]+float(q)*v1[1],float(r)*v1[0]+float(s)*v1[1])
    sigma1=hypot(*mapped)
    sigma2=(sigma1 if g11==g22 and g12==0 else abs(float(det))/sigma1) if det else 0.
    u1=(mapped[0]/sigma1,mapped[1]/sigma1)
    orientation=-1 if det<0 else 1
    U=[[u1[0],-orientation*u1[1]],[u1[1],orientation*u1[0]]]
    Vt=[list(v1),list(v2)]
    return U,[sigma1,sigma2],Vt

U,s,Vt=svd2([[3,0],[0,-1]])
assert s==[3.,1.]
for i in range(2):
    for j in range(2):
        reconstructed=sum(U[i][k]*s[k]*Vt[k][j] for k in range(2))
        assert abs(reconstructed-[[3,0],[0,-1]][i][j])<1e-12
assert svd2([[1,2],[2,4]])[1][1]==0
assert svd2([[0,0],[0,0]])[1]==[0.,0.]
repeated=svd2([[.01,.02],[-.02,.01]])[1]
assert repeated[0]==repeated[1]
# This bounded reference exposes mechanics; production numerical work should use an established SVD.
code/python/svd_numpy.py
import numpy as np
# Rectangular thin SVD: (3×2) = (3×2)(2×2)(2×2).
A=np.array([[1.,0.],[0.,1.],[1.,1.]])
U,s,Vt=np.linalg.svd(A,full_matrices=False)
assert U.shape==(3,2) and s.shape==(2,) and Vt.shape==(2,2)
assert np.allclose(U@np.diag(s)@Vt,A)
A1=s[0]*np.outer(U[:,0],Vt[0])
assert np.isclose(np.linalg.norm(A-A1,'fro'),s[1])
b=np.array([1.,2.,4.])
x=np.linalg.pinv(A,rcond=1e-12)@b  # Explicit numerical cutoff, not an exact-rank claim.
assert np.allclose(A.T@(A@x-b),0)
# For singular A, pinv gives the minimum-norm least-squares solution.
# PCA centers data first; right singular vectors identify feature directions.

Explore and numerical considerations

Change a matrix entry until the determinant vanishes. Compare a lost axis with an extremely weak but nonzero one. Use the ill-conditioned preset and inspect its exact rank, positive weak singular value and condition number κ2(A)=σ1/σ2\kappa_2(A)=\sigma_1/\sigma_2. Perturb the input: undoing a weak axis can amplify a tiny output error enormously.

All entered matrix/vector values in the explorer lie in [−4,4][-4,4] with two decimal places. Exact rational rank and repeated-value classifications have no epsilon. All spectral factors and geometry use binary64 companions marked ≈\approx.

The checks require relative Frobenius reconstruction error ∥A−UΣVT∥F/max⁡(1,∥A∥F)\|A-U\Sigma V^T\|_F/\max(1,\|A\|_F) and both Frobenius orthogonality errors to be at most 256ε256\varepsilon, about 5.68×10−145.68\times10^{-14}, with ε\varepsilon the binary64 machine epsilon. This budget allows roundoff in short products, trigonometric normalization and reconstruction. NumPy SVD and 100-digit Decimal spectra provide independent reference values for comparisons, including ill-conditioned matrices. A check failure is disclosed and suppresses the geometry’s claim of a faithful decomposition.

The conditioning cue appears when κ2⋅256ε>10−8\kappa_2\cdot256\varepsilon>10^{-8}. Numerical pseudoinverse recovery is withheld if that conservative error budget reaches 10−410^{-4}. These accuracy policies never truncate the small singular value or change exact rank. Reconstruction can be accurate even when inverse recovery is unreliable. Rounded factor entries cannot serve as exact identities or certify the relative precision of a tiny singular value.

The inspector’s measured companion error compares AA with the binary64 reconstruction of A1A_1. It can show a tiny roundoff residual even when the ideal theorem gives ∥A−A1∥F=σ2=0\|A-A_1\|_F=\sigma_2=0. The theorem and the measured numerical check answer distinct questions.

Common mistakes

Singular directions need not be eigenvectors of AA. Orthogonal includes reflections as well as rotations. A pseudoinverse cannot recover lost information. Small singular values can indicate uncertainty or a useful low-rank model, but discarding them is an explicit approximation. A repeated spectrum supplies a subspace without uniquely named axes.

Engineering and ML connections

Compression stores a few outer products instead of every matrix entry; storage savings depend on rank and dimensions. PCA applies SVD to a centered observations-by-features matrix: right singular vectors identify feature directions, and squared singular values divided by the appropriate sample normalization describe variance. Scaling features changes that analysis. Low-rank embeddings retain strong shared patterns; their quality depends on the data, centering, objective and rank choice, rather than on a universal interpretation of “importance.”

Exercises

calculation

Strength without a sign

A = diag(3, −1). Give its sorted singular values.

calculation

Discard one axis

For A = diag(3, −1), keep only its strongest singular term. Find the Frobenius error ‖A − A₁‖F.

calculation

A minimum-norm input

A = diag(2, 0), b = (4, 3). Give A⁺b.

prediction

Repeated strength

A = 2I. Are its singular directions uniquely determined?

Choose one answer

prediction

A very weak direction

An exact 2×2 input has nonzero determinant but an extremely small σ₂. What follows?

Choose one answer

Summary and checkpoints

Follow a vector through VTV^T, Σ\Sigma and UU; predict an ellipse, segment or point; check approximate factors against exact rank; derive the rank-one Frobenius error; and explain what the pseudoinverse can recover. Part II is complete: elimination, rank, preserved directions, projection and SVD now describe complementary views of the same linear map.

The map of the book

97 of 97 chapters written · eight Parts

demo Foundation demo Try the live vector example Open as a page

Part I

Mathematical Language

The notation and mental objects everything else uses.

9 of 9 chapters written

  1. I.1 Scalars, quantities, units, powers and roots available
  2. I.2 Coordinates and points available
  3. I.3 Vectors: components, magnitude, and direction reference chapter available
  4. I.4 Algebraic expressions, equations and inequalities available
  5. I.5 Functions as input → transformation → output available
  6. I.6 Essential function families available
  7. I.7 Sets, intervals, and relations available
  8. I.8 Indexed quantities and summation available
  9. I.9 The notation map for ML available

Part II

Linear Algebra

Matrices as transformations: the strongest foundation in the book.

19 of 19 chapters written

  1. II.1 Vector addition and subtraction available
  2. II.2 Scalar multiplication and vector scaling available
  3. II.3 Norms, magnitude, and normalization available
  4. II.4 Dot product, angle, and orthogonality available
  5. II.5 Projection and distance to a direction available
  6. II.6 Linear combinations and span available
  7. II.7 Linear independence, basis, and coordinates available
  8. II.8 Matrices as linear transformations available
  9. II.9 Matrix × vector available
  10. II.10 Matrix × matrix as composition available
  11. II.11 Transpose and orthogonality available
  12. II.12 Determinant: orientation and area/volume scaling available
  13. II.13 Linear systems as intersecting constraints available
  14. II.14 Gaussian elimination and row operations available
  15. II.15 Rank and invertibility available
  16. II.16 Inverse matrices available
  17. II.17 Eigenvalues and eigenvectors available
  18. II.18 Orthogonal bases and least-squares geometry available
  19. II.19 Singular Value Decomposition available

Part III

Calculus

Change, local approximation, and sensitivity made visible.

15 of 15 chapters written

  1. III.1 Limits through approach available
  2. III.2 Continuity and local behavior available
  3. III.3 Derivative as secant → tangent available
  4. III.4 Derivative as rate of change and local linear model available
  5. III.5 Derivative rules available
  6. III.6 Chain rule available
  7. III.7 Multivariable functions and partial derivatives available
  8. III.8 Gradient and directional derivatives available
  9. III.9 Jacobian available
  10. III.10 Computational graphs and automatic differentiation available
  11. III.11 Hessian and curvature available
  12. III.12 Integrals as accumulation available
  13. III.13 Fundamental derivative/integral connection available
  14. III.14 Numerical differentiation available
  15. III.15 Numerical integration available

Part IV

Probability

Uncertainty through sample spaces, evidence, and repetition.

16 of 16 chapters written

  1. IV.1 Random experiments, outcomes, and sample spaces available
  2. IV.2 Events and probability mass available
  3. IV.3 Counting and finite probability where needed available
  4. IV.4 Conditional probability as restricted sample space available
  5. IV.5 Independence available
  6. IV.6 Bayes' theorem as probability-mass update available
  7. IV.7 Random variables available
  8. IV.8 PMF, PDF, and CDF available
  9. IV.9 Bernoulli and Binomial distributions available
  10. IV.10 Uniform and Gaussian distributions available
  11. IV.11 Expectation available
  12. IV.12 Variance and standard deviation available
  13. IV.13 Joint, marginal, and conditional distributions available
  14. IV.14 Covariance and correlation available
  15. IV.15 Law of Large Numbers available
  16. IV.16 Central Limit Theorem available

Part V

Statistics

From observed data to estimates, intervals, and likelihood.

10 of 10 chapters written

  1. V.1 Data summaries: mean, median, mode available
  2. V.2 Spread: variance, standard deviation, robust interpretation available
  3. V.3 Population, sample, and sampling variability available
  4. V.4 Estimators and estimation available
  5. V.5 Confidence intervals through repeated sampling available
  6. V.6 Covariance matrices and multivariate spread available
  7. V.7 Regression fundamentals available
  8. V.8 Likelihood available
  9. V.9 Maximum Likelihood Estimation available
  10. V.10 Maximum A Posteriori estimation available

Part VI

Optimization

Learning as repeated parameter updates governed by an objective.

10 of 10 chapters written

  1. VI.1 Objective functions and optimization landscapes available
  2. VI.2 Local vs global optima and stationary points available
  3. VI.3 Convexity available
  4. VI.4 Gradient descent flagship chapter available
  5. VI.5 Learning rate and convergence behavior available
  6. VI.6 Momentum available
  7. VI.7 Stochastic and mini-batch gradient descent available
  8. VI.8 Adam intuition available
  9. VI.9 Constraints and projected/penalized intuition available
  10. VI.10 Numerical stopping and optimization diagnostics available

Part VII

Information Theory

Logarithms, entropy, and the loss behind token prediction.

8 of 8 chapters written

  1. VII.1 Logarithms and log probabilities in computation available
  2. VII.2 Self-information available
  3. VII.3 Entropy available
  4. VII.4 Cross entropy and negative log-likelihood available
  5. VII.5 KL divergence available
  6. VII.6 Logits and softmax available
  7. VII.7 Numerical stability: log-sum-exp and stable softmax available
  8. VII.8 From token logits to language-model loss available

Part VIII

Numerical Computing

Why equivalent expressions behave differently on real machines.

10 of 10 chapters written

  1. VIII.1 Floating-point representation available
  2. VIII.2 Rounding and representation error available
  3. VIII.3 Error propagation and conditioning available
  4. VIII.4 Catastrophic cancellation available
  5. VIII.5 Overflow and underflow available
  6. VIII.6 Stable algorithms available
  7. VIII.7 Numerical linear algebra realities available
  8. VIII.8 Sparse matrices and sparse structure available
  9. VIII.9 Vectorized computation available
  10. VIII.10 Reproducibility, random seeds, and nondeterminism available