Category theory meets deep learning: PyNCD diagrams derive hardware-aware FlashAttention
GioeleZardini · x · 2026-09-28
Researcher Gioele Zardini presents a category-theory-based diagrammatic framework for systematically analyzing deep learning models. Key points:
- Problem: DL models are understood ad-hoc; inference (KV-cache), training (backprop), and hardware mapping are derived independently.
- Approach: Category theory's composition and abstraction tools enable a rigorous diagram language spanning math, training/inference forms, and logical/physical hardware levels.
- Results: Used to systematically derive hardware-aware FlashAttention ("FlashAttention on a Napkin") and quickly generate a kernel for an attention variant.
- Open source: Formalized in the paper "Weaves, Wires, and Morphisms", with two open-source packages, PyNCD and TSNCD; interactive diagrams of full architectures on the site are drawn via these tools.
The author argues that in the era of agentic mathematics, proofs are cheap and what matters is the right language — which category theory provides.
More from Infra
- Anthropic's Contracted Value Exceeds $180B, Per NVIDIA — zephyr_z9 · 2026-09-28
- David Friedberg: Open-Source Models Make Data Centers Unnecessary for 90% of AI Use — MarvinTBaumann · 2026-09-28
- Old-School Infra Engineers on PB-Scale AI Logs: Hadoop Did This on a Tuesday — basedjensen · 2026-09-28
- Power sharing fits 192 GB300 GPUs in 140-GPU power budget, boosting tokens/s by 49% — julsimon · 2026-09-28
- Node.js async zstdCompress() was 23x slower due to missing pledged input size — AI Snake Oil · 2026-09-28
- NVIDIA adds $150B to buyback program, lifting total authorization to $235B — firstadopter · 2026-09-28