Functorial Neural Architectures from Higher Inductive Types
About
Neural networks often learn the parts of a task but fail on novel combinations of those parts. We argue that this failure is architectural: a decoder generalizes compositionally only when it respects the algebraic laws of the task, i.e. when it descends from freely generated sequences to the quotient determined by those laws. We make this principle constructive by compiling Higher Inductive Type (HIT) specifications into neural architectures. Basepoints, path constructors, and 2-cells are mapped to base constraints, generator networks, structural concatenation, and learned homotopies. The resulting transport decoders are strict monoidal functors by construction: decoding a concatenated word is concatenation of independently generated loop segments. In contrast, we prove that softmax self-attention cannot simultaneously satisfy strict monoidal composition and descent to any non-trivial compositional quotient. Experiments on the torus, wedge of circles, and Klein bottle validate the predicted hierarchy: functorial decoders outperform non-functorial alternatives by $2$--$10\times$, and a learned 2-cell closes a $46\%$ error gap precisely on words exercising the Klein-bottle relation. These results suggest that compositional generalization should be enforced as functorial structure in the architecture, rather than learned from examples alone.
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Geometric loop generation | Torus T^2 L=2 (test) | Per-segment Chamfer Distance1.68 | 5 | |
| Geometric loop generation | Torus T^2 L=4 (test) | Per-segment Chamfer Distance0.86 | 5 | |
| Geometric loop generation | Torus T^2 L=6 (test) | Per-segment Chamfer Distance0.74 | 5 | |
| Geometric loop generation | Torus T^2 L=8 (test) | Chamfer Distance (Per-segment)0.73 | 5 | |
| Geometric loop generation | Torus T^2 L=10 (test) | Per-segment Chamfer Distance0.77 | 5 | |
| Geometric path generation | Klein bottle Canonical words L=10 | Per-segment Chamfer Distance0.82 | 4 | |
| Geometric path generation | Klein bottle Non-canonical words L=10 | Chamfer Distance (Per-Segment)0.82 | 4 | |
| Geometric generation | Wedge of circles S^1 ∨ S^1 L=2 | Per-seg Chamfer Distance0.002 | 3 | |
| Geometric generation | Wedge of circles S^1 ∨ S^1 L=6 | Per-segment Chamfer Distance0.018 | 3 | |
| Geometric generation | Wedge of circles S^1 ∨ S^1 L=10 | Per-segment Chamfer Distance0.054 | 3 |