TL;DR
This paper introduces Neural Attentive Circuits (NACs), a novel general-purpose neural architecture that combines modularity with learned sparse connectivity. NACs demonstrate improved performance in low-shot adaptation and out-of-distribution robustness compared to non-modular baselines, while also offering significant computational efficiency gains through adaptive module usage.
What Problem Does This Paper Address?
The field of deep learning has seen a rise in "general-purpose" neural architectures (like Perceivers) that can handle diverse data modalities with minimal assumptions. While powerful, these models often struggle with sample efficiency and robustness to out-of-distribution data. On the other hand, modular architectures offer potential benefits in these areas, but often require domain-specific assumptions and face challenges in jointly learning module behavior and their interconnections. This paper aims to bridge this gap by proposing a general-purpose, yet modular architecture that can learn both module parameterization and sparse connectivity without domain knowledge.
Methods
The core of Neural Attentive Circuits (NACs) lies in its two main components:
- Circuit Generator: This module learns to create a "circuit design" which dictates how neural modules should be connected and how they should behave. This design includes:
- Signatures: Vectors that determine the connectivity pattern between modules.
- Codes: Vectors that condition the computation performed by each module.
- The generator can be unconditional (learning a fixed design) or conditional (generating a design specific to each input sample).
- Circuit Executor: This module takes the circuit design and an input, then processes it through a series of modules. Key components include:
- Tokenizer: Converts input data into a set of vectors.
- Read-In Layer: Attentively reads input data into the processor modules.
- Propagator Layers: Iteratively update module states through learned attention (SKMDPA) and computation (ModFFN).
- Read-Out Layers: Extract the final output from the processor modules.
A novel attention mechanism, Stochastic Kernel Modulated Dot-Product Attention (SKMDPA), is introduced. It allows modules to communicate based on the similarity of their learned signatures, enabling sparse and learned connectivity. Modulated Fully-Connected (ModFC) layers are used to condition module computations on learned codes.
Datasets
The paper evaluates NACs on a variety of datasets across different modalities:
- Image Classification: Tiny-ImageNet, Tiny-ImageNet-R (for OOD robustness), CIFAR, CUB-2011 (for few-shot adaptation).
- Point Cloud Classification: A benchmark without additional data augmentation.
- Symbolic Processing: ListOps.
- Text Classification: Raw ASCII bytes.
- Multi-modal Reasoning: Natural Language for Visual Reasoning for Real (NLVR2).
Key Insights and Ideas
- Jointly Learning Modularity and Connectivity: NACs uniquely learn both what modules do (parameterization via ModFFNs) and how they connect (sparse graph via signatures) end-to-end.
- Sparse Connectivity as a Regularizer: The learned sparse connectivity is crucial for improving out-of-distribution robustness and sample efficiency, preventing the model from collapsing into a fully connected graph.
- Adaptive Computation for Efficiency: NACs can achieve significant inference speedups (up to 8x) by dropping modules or connections without substantial performance degradation, allowing for flexible computational budgets.
- Conditional Circuit Design: The ability to generate input-specific circuit designs (conditional NACs) shows promise for complex reasoning tasks, as demonstrated on NLVR2 where sentence structure influences graph topology.
- General-Purpose Nature: NACs demonstrate competitive performance across a wide range of tasks and data modalities, confirming their general-purpose applicability.
Key Results
- Few-Shot Adaptation: NACs improve low-shot adaptation on CIFAR and CUB datasets by approximately 10% compared to Perceiver IO.
- OOD Robustness: NACs show about 2.5% improvement in out-of-distribution robustness on Tiny-ImageNet-R.
- Computational Efficiency: NACs can achieve an 8x speedup at inference time while losing less than 3% performance by dropping modules.
- Point Cloud Classification: Achieved 83.0% test accuracy without specialized tokenization or pre-training, outperforming Perceiver IO.
- Symbolic Processing & Text Classification: NACs achieved competitive results on ListOps (41.40%) and text classification (68.18%), outperforming Perceiver IO on ListOps.
- NLVR2 Reasoning: Conditional NACs achieved approximately 64% validation accuracy, improving upon a strong CLIP baseline.
Limitations and Future Work
- Pre-training Scope: Large-scale pre-training on natural language and multi-modal datasets was out of scope for this work. Future work could explore this.
- Circuit Generator Implementation: While the current conditional circuit generator (using cross-attention) is effective, exploring auto-regressive models and GFlowNets could yield better configurations.
- Scaling Laws Analysis: A thorough analysis of scaling properties compared to homogenous general-purpose modules would be beneficial.
- Train-time Sparsity: Incorporating train-time sparsity (where only a subset of modules are updated per step) is a promising avenue.
- Sparse Attention Kernels: Further exploration of sparse attention kernels and their implementation for efficiency is suggested.
- Predictive Module Subnetworks: Learning a predictive model to identify subnetworks for conditional computation is a future direction.
- Hard-Coded Problem Solving: Learning to solve specific hard-coded problems and then learning how to wire them is another potential research path.
Summary updated