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
- Sarvam AI Launches Token Factory: India-Hosted Inference for Open Models — itsOmSarraf_ · 2026-11-16
- BIS Issues Interim Final Rule Addressing Remote Access to Advanced AI Chips — apples_jimmy · 2026-11-16
- Jailbroken PS4 runs a 9B open-source model at up to 43 tok/s by talking directly to its 2013-era GPU — AIFlow_ML · 2026-11-16
- Mobile AI Factory: agents auto-build on-device SLMs with 19x less GPU time — pmttyji · 2026-11-16
- Stratechery's Fictional Obituary: Imagining Jensen Huang's 2026 Exit From Nvidia — Gregory_C_Allen · 2026-11-16
- vLLM serves DeepSeek V4.1-Flash at 954K tokens/s per GPU, $38.96/GPU-hour on GB300 NVL72 — bookwormengr · 2026-11-16