LoRA · 用两个窄矩阵近似一张大更新LoRA · Approximate One Large Update with Two Narrow Matrices
freeze W + train B·A where rank r ≪ dimension → fewer trainable
parameters
低秩适配(LoRA)冻结原权重并训练两个低秩增量矩阵,以近似任务所需的权重更新。秩
r 决定增量容量、参数量与近似误差。LoRA freezes the original weight matrix and trains two low-rank
matrices that approximate the task update. Rank r controls delta
capacity, parameter count, and approximation error.
01 · 一张大改动能否拆成两条窄通道01 · Can one large change travel through two narrow
channels?
要改 16×16 个权重,必须训练 256 个新数,还是能用
16×r 与 r×16 两张窄矩阵表达主要变化?To update a 16×16 weight matrix, must we train 256 new values, or
can 16×r and r×16 narrow matrices capture the important
change?
B×A
02拖低秩
r,看两窄矩阵、可训练参数与近似误差同步变化Drag Rank r and Watch Both Narrow Matrices, Parameter Count, and
Error Change
唯一变量:rank rone variable: rank r
状态 AMetric A
—
—
状态 BMetric B
—
—
状态 CMetric C
—
—
所有概率、得分与输出均为固定种子的教学模拟,不代表真实模型。拖回主变量即可复核结论。All probabilities, scores, and outputs are fixed-seed teaching
simulations, not real model output. Move the main variable back
to verify the conclusion.
03把刚才的变化拆成 4 个零件Break the Change into Four Parts
LoRA
W
冻结原权重Frozen weight W
预训练大矩阵不直接更新。The pretrained matrix is not updated directly.
A
降维矩阵 ADown projection A
把更新方向压进 r 维通道。Compress update directions into an r-dimensional channel.
B
升维矩阵 BUp projection B
再把低秩通道映回原维度。Map the low-rank channel back to the original dimension.
RANK
低秩 rLow rank r
r 越大容量越高,参数与资源也越多。Higher r adds capacity along with parameters and resource
use.
04最小机制:主交互能逐项验证Minimal Mechanism: Verify Each Link in the Interaction
MECHANISM
W′ = W + ΔW,ΔW ≈ Bd×rAr×k
主交互只改 r;B 的宽度与 A
的高度同步变,玩具误差曲线随容量增加而下降。Only r changes. B grows wider, A grows taller, and toy
approximation error falls as capacity increases.
冻结 WFreeze W保留原基座retain the base
训练 A、BTrain A and B只更新低秩增量update only the low-rank delta
合成 ΔWCompose ΔW推理时叠加或合并add or merge at inference
05把 rank r 拖到 1Drag Rank r Down to 1
主动制造失败Create a failure
边界实验Boundary experiment
两个矩阵最窄时参数最少,但任务更新只能经过一条方向;观察近似误差怎样升高。The narrowest matrices use the fewest parameters, but the task
update has only one direction. Watch approximation error
rise.
尚未执行。先在主交互中观察正常机制。Not run yet. Observe the normal mechanism in the main interaction
first.
✗ LoRA 会量化基座模型。LoRA quantizes the base model.→ ✓ LoRA
解决低秩增量;量化是另一条精度杠杆。LoRA controls a low-rank delta; quantization is a separate
precision lever.
✗ r 越小,效果一定越好。A lower r always works better.→ ✓ 更低 r 省参数,也可能欠表达。Lower r saves parameters but can underfit the
update.
✗ 冻结 W 就完全不会影响原模型行为。Freezing W means base behavior cannot
change.→ ✓ 叠加 ΔW 后整体输出仍会变化。Adding ΔW still changes the combined model
output.
06 · 一句话带走06 · One line to keep
LoRA 把大权重更新近似为 B×A 两个窄矩阵;r
决定省多少参数,也决定增量能表达多少方向。LoRA approximates a large weight update with two narrow matrices
B×A. Rank r controls both parameter savings and how many update
directions the delta can express.