S1-07 · 进阶S1-07 · Advanced

点积 · 把方向对齐压成一个数Dot Product · Compress Alignment into One Number

matching components → sum → one alignment score

点积把两个向量对应分量相乘再相加,用一个数衡量方向对齐程度。注意力分数和余弦相似度都建立在它上面。A dot product multiplies matching components and adds them, producing one number for directional alignment. Attention scores and cosine similarity build on it.

01 · 两个人一起推箱子01 · Two people push a crate

同样用力时,同向、垂直和反向,真正帮上忙的程度会一样吗?With equal effort, do pushing together, sideways, and against each other help by the same amount?

02方向对齐盘Alignment Dial

双箭头旋转型Rotate two arrows
最小夹角Smallest angle
35°
θ
投影长度Projection
2.46
|b| cos θ
点积Dot product
9.83

03一次点积的 4 个零件Four Parts of One Dot Product

乘、乘、再相加Multiply, multiply, add
PART 01

对应分量Matching components

ax 只与 bx 相乘,ay 只与 by 相乘。ax pairs with bx; ay pairs with by.

PART 02

乘积Products

每一维贡献一个正、零或负的对齐量。Each dimension contributes positive, zero, or negative alignment.

PART 03

求和Sum

把所有维度贡献合成一个标量分数。All dimensional contributions collapse into one scalar score.

PART 04

投影直觉Projection intuition

b 在 a 方向上的影子越长且同向,点积越大。The longer b's same-direction shadow on a, the larger the dot product.

04最小机制:分量算法与夹角直觉是同一件事Minimal Mechanism: Component Math and Angle Intuition Agree

a · b
a · b = axbx + ayby = |a||b| cos θ
上方固定 |a| = 4、|b| = 3。旋转时只有 cos θ 改变,因此点积随夹角从正到零再到负。Above, |a| = 4 and |b| = 3. Rotation changes only cos θ, so the dot product moves from positive to zero to negative.
旋转箭头Rotate an arrow夹角 θ 改变Angle θ changes
投影改变Projection changes同向影子缩短或反向The aligned shadow shrinks or reverses
点积改变Dot product changes一个数记录对齐One number records alignment

05边界实验:长度都为正,点积就为正?Boundary Test: Positive Lengths Mean a Positive Dot Product?

主动制造失败Create a failure

把 b 旋到完全反向Turn b directly backward

两支箭头长度仍为 4 和 3,都是正数。点击后夹角变 180°,投影反向,点积应为负。Both lengths remain positive at 4 and 3. At 180°, the projection reverses and the dot product must be negative.

尚未执行。长度描述大小,点积还要看方向。Not run yet. Length measures size; a dot product also depends on direction.
两个非零向量的点积一定非零。Two nonzero vectors must have a nonzero dot product. → ✓ 垂直向量的点积等于零。Perpendicular vectors have a zero dot product.
点积越大,只说明两个向量越像。A larger dot product only means greater similarity. → ✓ 点积同时受方向与长度影响。Dot product depends on both direction and length.
负点积表示计算出错。A negative dot product means the calculation failed. → ✓ 负值表示总体方向超过 90°,更偏反向。A negative value means the directions differ by more than 90°.
06 · 一句话带走06 · One line to keep

点积把对应分量相乘再相加,用一个数衡量方向对齐;旋转箭头即可检验同向为正、垂直为零、反向为负。A dot product multiplies matching components and adds them into one alignment score. Rotate the arrows to verify positive together, zero perpendicular, and negative opposite.