Template Post — Duplicate Me
This is a template, not a real post. It exists to demonstrate every Markdown/math/code feature this blog supports and to give you a starting point. Copy this file to a new slug, replace everything below, and set
draft: falsewhen you’re ready to publish. SeeWRITING.mdfor the full workflow.
Inline math
Attention weights are computed as , a normalized dot product between query and key vectors.
Display math
The scaled dot-product attention output for a single head is:
An aligned multi-line block
A matrix
Code
import torch
def scaled_dot_product_attention(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor) -> torch.Tensor:
d_k = q.size(-1)
scores = q @ k.transpose(-2, -1) / d_k**0.5
weights = torch.softmax(scores, dim=-1)
return weights @ v
A footnote
Function vectors compose non-additively in the residual stream1, which is part of what motivates this line of work.
An image reference
(This is a stand-in graphic, not a real figure. Explicit width/height on
the <img> tag avoids layout shift — Markdown’s ![]() syntax can’t set
those, so use raw HTML when you need them. Add real images under
public/images/<slug>/.)
Footnotes
-
Placeholder citation — replace with the real reference when this becomes an actual post. ↩