Files
dela 9f635d358b feat: add superderive stepwise derivation figures
A third sibling toolkit: rewrite steps, justification rails,
cancel/substitute highlights, and lint-on-warning builds.
2026-08-17 10:05:03 +08:00

21 lines
694 B
TeX

% Golden example -- a scale rewrite that must be seen, not just aligned.
% ../scripts/build.sh rewrite-cancel.tex
\documentclass[border=10pt]{standalone}
\usepackage[cjk]{superderive}
\begin{document}
\begin{tikzpicture}
\sdstage{D1}{缩放来自方差,不是装饰}
\sdrow{R1}
\sdstep[role=rewrite]{s1}{QK^{\top}}{QK^{\top}/\sqrt{d_k}}
\sdreason{s1}{§3.2.1,避免 softmax 饱和}
\sdrowend
\sdbbox{all}
\sdtopformula{F}{$\mathrm{Attention}(Q,K,V)=\mathrm{softmax}(QK^{\top}/\sqrt{d_k})V$}
\sdmeaningbox{mb}{120mm}{all}
{点积方差随 $d_k$ 线性涨}
{缩放是改写,不是新算子}
{没有缩放,softmax 进饱和区,梯度消失}
\end{tikzpicture}
\end{document}