Modern "general-purpose" architectures, like the Perceiver, are designed to handle diverse data types (images, text, audio) without making strict assumptions about the data's underlying structure. However, these models typically rely on "all-to-all" connectivity. This dense routing is computationally expensive and ignores a fundamental principle of the natural world: most processes are composed of sparsely interacting, independent mechanisms.
While existing modular architectures attempt to exploit this sparsity, they often require domain-specific knowledge—such as hand-crafted layouts or visual scene graphs—to function effectively. Neural Attentive Circuits (NACs) address this challenge by introducing a new class of modular neural architectures that jointly learn both the behavior of individual neural modules and the sparse connectivity between them from scratch.
Architecture: Generator and Executor
NACs achieve their flexibility and efficiency by splitting the computational workload into two distinct systems:
- The Circuit Generator: This component produces a "circuit design." It defines signatures (which modules should communicate with each other) and codes (instructions that dictate how each module should behave). This generation can be "unconditional" (learned globally during training) or "conditional" (dynamically changing the circuit structure based on the specific input).
- The Circuit Executor: This is the engine that processes the data. It uses the circuit design provided by the generator to route information through a series of specialized modules.
Key Innovations
To enable this dynamic, sparse routing without losing end-to-end differentiability, NACs introduce several key technical innovations:
- Stochastic Kernel Modulated Dot-Product Attention (SKMDPA): This is the core mechanism for connectivity. It uses the generated signatures to sample a sparse connectivity matrix. By utilizing the "Concrete distribution" (a continuous relaxation of discrete variables), the model can learn optimal, sparse connections using standard gradient descent.
- ModFC/ModFFN Layers: Instead of relying on fixed weights, the computation in these "modulated" layers is conditioned on the "code" provided by the generator. This allows the exact same physical parameters to perform entirely different functions depending on the circuit's current needs.
- Graph Priors: To prevent the model from lazily defaulting back to dense, all-to-all connectivity, the authors apply regularization inspired by network science (e.g., encouraging scale-free graphs or "ring-of-cliques" structures) to enforce specific sparse patterns.
Experiments and Key Results
The authors tested NACs across a wide range of modalities—including image classification (Tiny ImageNet, CIFAR-100, CUB-2011), 3D point clouds, symbolic/text tasks (ListOps, LRA), and multi-modal reasoning (NLVR2)—to prove their general-purpose nature.
- Sparsity as an Inductive Bias: Forcing the model to use sparse, modular interactions acts as a powerful regularizer. On 8-way CIFAR and CUB datasets, NACs outperformed the non-modular Perceiver IO baseline by approximately 10% in low-shot learning scenarios.
- Out-of-Distribution (OOD) Robustness: NACs demonstrated a 2.5% improvement in OOD robustness on Tiny ImageNet-R (artistic renditions) compared to baselines.
- Adaptive Computation and Efficiency: NACs are highly robust to pruning. At inference time, over 80% of the least-connected modules can be dropped with only a ~3% drop in accuracy, yielding an 8x inference speedup.
- Input-Dependent Logic: In the conditional variant, the model successfully learns to build different "thought circuits" for different types of queries. For instance, on the NLVR2 task, the model generated distinct graph structures for spatial reasoning versus counting tasks.
- Versatility: NACs achieved 83% accuracy on point cloud classification (vs. 77.4% for Perceiver IO) and outperformed standard transformers on long-range symbolic tasks like ListOps.
Limitations and Future Directions
While NACs offer significant advantages, jointly learning structure and parameters is inherently more complex than standard training and requires careful tuning of graph priors. Additionally, while the executor is highly efficient, the generator introduces computational overhead, particularly in the conditional variant.
Future work may explore more sophisticated circuit generators, such as GFlowNets, and apply the architecture to complex reinforcement learning environments where modularity and independent mechanisms are theorized to be crucial for generalization.
Summary updated