Selected query row Attention weight (matrix) · Gaussian theory curve (histogram)

Scaled Dot-Product Attention (2D): Score Matrix & √d_k Distribution

This 2D companion isolates the same √d_k scaling mechanic as the 3D version, but represents it as two native-2D fields instead of a rotatable 3D beam scene: a full 9×9 query-by-key attention heatmap, and a live histogram of the raw dot-product score distribution overlaid with its theoretical Normal(0, d_k) curve. Widening the key dimension d_k with scaling switched off visibly spreads the histogram and collapses matrix rows onto a single bright cell — exactly the vanishing-gradient failure mode the √d_k term exists to prevent — while switching scaling back on keeps both the histogram width and the matrix's row-wise weight distribution well-behaved at any dimension.