AKP Anthropic Kernel Path

0/21 read · no cycles yet

Month 3 — FA1 in Triton, Hopper intro, a tiny GPT that trains, CAI from memory

Continues month 2. Resources: 03-kernels/curriculum.md Layer 2–3 (GEMM already started; FA1 is the job this month), 04-llm-theory/curriculum.md §C + §E procedure, 04-llm-theory/high-to-low.md L2.

Month goals

  • Implement FlashAttention-1-style forward in Triton (tiled, online softmax, never materialize S). Correct vs F.scaled_dot_product_attention on random QKV (fp32 first, then fp16). Causal. Head dim 64 or 128.
  • Hopper intro from docs, even without an H100: TMA, WGMMA, 228 KB SMEM, clusters. 3-page note. (03-kernels L1 resources 5, 9.)
  • Tiny GPT trains to a real loss curve and samples. Not a notebook dump of Karpathy.
  • Constitutional AI flowchart from memory (SL-CAI + RLAIF). Recite, then check Bai 2022.
  • Take-home < 2,000.

Week 9 — FA1 forward, correctness first

DayDeep 1Deep 2Paper / bookFri / Sat
MonTriton FA1: Q-tile loop, KV-tile loop, online m/ℓ, O rescale. Tiny shapes only (S=128).Unit test harness vs SDPA. First mismatch dump.Dao 2022 reread algorithm only.
TueCausal mask without wrecking occupancy.GQA path: repeat KV heads.None.
WedDebug day. Numerical: fp32 vs fp16, row-max range 0 / 20 / 80 (02-foundations module 5 softmax lab).Take-home.Milakov & Gimelshein 2018 online softmax if the rescale is lying.
ThuSRAM budget on paper: what tiles fit.Tiny GPT: train loop clean enough someone else can run.Hopper in-depth blog (read; do not pretend you ran TMA).
FriTake-home. Target < 2,500.
SatLong build: grow FA1 to S=1024, head=64, causal. Table of errors vs SDPA.
SunOff-ish.

Week 9 exit: FA1 forward exists and is correct on small tensors.


Week 10 — Make it a kernel, not a prototype

DayDeep 1Deep 2Paper / bookFri / Sat
MonAutotune BLOCK_M/N + num_warps. Heatmap (03-kernels L4 ex. 2 energy).Hopper note: contrast mma.sync / wgmma / (later) tcgen05. Cite PTX ISA + Colfax, not vibes.None.
TueProfile FA1. Name the limiter. Compare to flash_attn if you can install it; else vs SDPA math-path.Tiny GPT: checkpoint + sample + val loss.FlashDecoding blog (decode ≠ prefill).
WedDebug / correctness on more shapes (non-multiple-of-block S).Take-home.None.
ThuFused RMSNorm or RoPE if FA1 is waiting on compile.Interview drill 60 min.Bai 2022 CAI — write flowchart then open the paper.
FriTake-home. Target < 2,200.
SatLong build: public writeup draft of FA1 (tiles, SRAM, what broke).
SunOff-ish.

Week 10 exit: FA1 profiled; Hopper note exists; CAI flowchart exists.


Week 11 — GPT that trains + CAI as procedure

DayDeep 1Deep 2Paper / bookFri / Sat
MonTiny GPT: finish train to a curve you would show. Tokens/sec logged.KV-cache decode on this model (month 1 loop, now on the trained net).None.
TueFA1: one more correctness or speed pass, not a rewrite.DPO vs PPO contrast (04-llm-theory §E). Rafailov 2023 enough to derive the loss shape.InstructGPT (Ouyang 2022) skim of the procedure.
WedDebug day.Take-home.None.
ThuBlank-page: CAI two stages. Record 8 min voice memo.Why-Anthropic 200 words, throw away if generic.2026 constitution (https://www.anthropic.com/news/claude-new-constitution) — priority order only.
FriTake-home. Target < 2,000.
SatLong build: CAI Stage-1 toy (04-llm-theory Lab E4 energy) or improve FA1 writeup. Pick one.
SunOff-ish.

Week 11 exit: trained GPT + samples; CAI from memory; take-home approaching 2k.


Week 12 — Close month 3

DayDeep 1Deep 2Paper / bookFri / Sat
MonFA1 vs SDPA full harness; freeze the kernel.Re-derive attention backward (prep for month 4 FA2).FA2 paper: algorithm changes only (Dao 2023).
TuePMPP / CUDA leftover from month 2.Interview: KV-cache bytes for a named 70B-class GQA config.None.
WedDebug / measure.Take-home polish.None.
ThuBlank-page exam: FA1 algorithm, CAI flowchart, Hopper three nouns (TMA, WGMMA, mbarrier).Timed 90 min incremental system.None.
FriTake-home. Official month target < 2,000.
SatMonth 3 artifact.
SunOff.

Month 3 exit criteria

Artifact

Public repo: triton_fa1/ + tests + error table + Hopper note + train loss plot + CAI flowchart image or markdown + take-home cycles. 1000–1500 word Greenhouse-shaped paragraph update.

If FA1 is correct but slow, ship correct. Speed is month 4–5.