feat: land superpaper v1 notes scaffold

Add the ledger schema, class router, lint codes, ingest/build
pipeline, and three work-tree examples: align derivation,
superfig delegation, and supertensor delegation.
This commit is contained in:
dela
2026-08-17 10:01:30 +08:00
parent c2bec6f55a
commit 3a322aa8dc
89 changed files with 3522 additions and 11 deletions
+47
View File
@@ -0,0 +1,47 @@
schema: superpaper.ledger/v1
retired_ids: []
paper:
id: tensor-delegate
title: Head scores
authors: ["Fixture"]
notes_language: zh
source: {kind: excerpt}
coverage:
mode: excerpt
questions:
- {id: Q1, text: "每头打分沿哪一维收缩?", source: "excerpt"}
claims:
- id: C1
text: "每头打分沿 d_h 收缩;K^T 必须物理换面"
kind: theoretical
status: core
supports: [Q1]
definitions: []
assumptions: []
lemmas: []
symbols:
- {name: Q, latex: "Q", meaning: "query", kind: value}
- {name: K, latex: "K", meaning: "key", kind: value}
- {name: S, latex: "S", meaning: "score", kind: score}
- {name: dh, latex: "d_h", meaning: "头维", kind: "shape parameter"}
derivations:
- id: DER1
claim: C1
title: "打分"
expand: true
figure: null
steps:
- {id: S1, from: "Q K", to: "Q K^{\\top}", rule: rearrange}
figures:
- id: F2
claim: C1
title: "每头打分"
grammar: tensor-face
toolkit: supertensor
signals: [axis, shape, transpose, contraction, face]
request: figures/F2/F2.request.md
include: figures/F2/build/F2.pdf
status: included
evidence: []
terms: []
source_assets: []
@@ -0,0 +1 @@
$S^{(i)}=Q^{(i)}K^{(i)\top}$。收缩维 $d_h$ 在两个操作数上同一边长;$K^\top$ 换面。
@@ -0,0 +1,25 @@
# Figure request F2
toolkit: supertensor
language: cjk
claim: 每头打分沿 d_h 收缩;K^T 必须物理换面。
grammar: tensor-face
work_rel_dir: figures/F2
## Roles
- {role: q, color: stTeal}
- {role: k, color: stOrange}
- {role: s, color: stCoral}
## Geometry
- {axis: T, cells: 6}
- {axis: dh, cells: 3}
## Flow
stage: {name: SA, text: "每头打分:沿 $d_h$ 收缩"}
row: {name: rowA, height: T}
in_row:
- {macro: ststack, name: Q, role: q, coord: "", rows: T, cols: dh, sheets: 3, bracket: true}
- {macro: stglyph, name: mA, coord: "", glyph: "$\\times$"}
- {macro: ststack, name: KT, role: k, coord: "", rows: dh, cols: T, sheets: 3, bracket: true}
- {macro: stglyph, name: eA, coord: "", glyph: "$=$"}
- {macro: ststack, name: S, role: s, coord: "", rows: T, cols: T, sheets: 3}
@@ -0,0 +1,31 @@
\documentclass[border=10pt]{standalone}
\usepackage[cjk]{supertensor}
\stsetrole{q}{stTeal}
\stsetrole{k}{stOrange}
\stsetrole{s}{stCoral}
\stdim{T}{6}
\stdim{dh}{3}
\begin{document}
\begin{tikzpicture}
\ststage{SA}{每头打分:沿 $d_h$ 收缩}
\strow{rowA}{T}
\ststack[role=q, bracket=true]{Q}{}{T}{dh}{3}
\stglyph{mA}{$\times$}
\ststack[role=k, bracket=true]{KT}{}{dh}{T}{3}
\stglyph{eA}{$=$}
\ststack[role=s]{S}{}{T}{T}{3}
\strowend
\stcaption{Q}{$\mathbf Q^{(i)}$}{$h\times T\times d_h$}
\stcaption{KT}{$\mathbf K^{(i)\top}$}{$h\times d_h\times T$}
\stcaption{S}{$\mathbf S^{(i)}$}{$h\times T\times T$}
\sttopformula{F}{$S^{(i)}=Q^{(i)}K^{(i)\top}$}
\stbbox{all}
\stmeaningbox{mb}{120mm}{all}
{$T$ 时间;$d_h$ 头维;$h$ 头数画成 stack 深度}
{$Q/K$ 是 value;$S$ 是 score,不是 mask}
{沿 $d_h$ 收缩;$K^\top$ 换面,收缩边等长}
\end{tikzpicture}
\end{document}
Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 213 KiB

+14
View File
@@ -0,0 +1,14 @@
\documentclass[a4paper]{article}
\input{notes-macros}
\renewcommand{\notetitle}{每头打分沿 $d_h$ 收缩}
\renewcommand{\notepaper}{Head scores}
\begin{document}
\tableofcontents
\newpage
\input{sections/sec-01.tex}
\input{sections/sec-02.tex}
\input{sections/sec-03.tex}
\appendix
\section{符号表}
\input{sections/symbols.tex}
\end{document}
@@ -0,0 +1,2 @@
\section{这篇论文在问什么}
每头的 $Q$ 和 $K$ 沿哪一条边收缩,$K^\top$ 要不要真的换面?
@@ -0,0 +1,20 @@
\section{主张与贡献}
\splabel{C1}
打分是 $(T\times d_h)(d_h\times T)\to(T\times T)$。$K^\top$ 必须物理换面,收缩边等长。
先用中文说完,再写式子:
\[
S^{(i)}=Q^{(i)}K^{(i)\top}.
\]
\begin{itemize}
\item $Q^{(i)}$ — 第 $i$ 头 query,$T\times d_h$
\item $K^{(i)\top}$ — 转置后的 key,$d_h\times T$
\item $S^{(i)}$ — 分数,不是 mask
\end{itemize}
\spfig{F2}{每头打分沿 $d_h$ 收缩。}{重绘自 fixture;toolkit: \texttt{supertensor};ledger id: F2。}
\subsection{本章小结}
轴长是这张图的主张,所以走 supertensor,不走 superfig。
@@ -0,0 +1,2 @@
\section{总结与延伸}
形状对齐的公式图只交给 supertensor。
+14
View File
@@ -0,0 +1,14 @@
# Outline: Head scores
## Lecture map
| file | lecture_title | paper_sections | ledger_ids |
|---|---|---|---|
| sec-01.tex | 这篇论文在问什么 | 1 | Q1 |
| sec-02.tex | 主张与贡献 | 1 | C1, F2 |
| sec-03.tex | 总结与延伸 | 1 | C1 |
| sec-app-a.tex | 符号表 | — | |
## Locked
- 首节标题必须是「这篇论文在问什么」
- 末节(appendix 前)必须是「总结与延伸」