Adaptivity and Modularity for Efficient Generalization Over Task Complexity

Samira Abnar, Omid Saremi, Laurent Dinh, Shantel Wilson, Miguel Ángel Bautista, Chen Huang, Vimal Thilak, Etai Littwin, Jiatao Gu, Josh M. Susskind, Samy Bengio · DOI

Abstract

Standard deep learning models, such as the Transformer, typically employ a fixed computational budget for every input, regardless of its inherent difficulty. This leads to inefficiencies on simple tasks and poor generalization on complex ones. We introduce Hyper-UT, an architecture that integrates adaptive computation time with dynamic modularity. By utilizing hyper-networks to synthesize layer weights conditioned on the input state, Hyper-UT can scale its depth and capacity dynamically. Our results demonstrate that Hyper-UT matches Vision Transformer (ViT) performance on ImageNet with 70% less compute and successfully generalizes to reasoning tasks significantly more complex than those encountered during training.

Introduction

A fundamental limitation of current neural architectures is the "complexity mismatch": a 12-layer model processes a simple greeting with the same computational effort as a complex logical proof. This static nature results in two primary drawbacks: computational waste on easy examples and a failure to generalize to out-of-distribution (OOD) task complexities. While Universal Transformers (UT) introduced recurrent depth through weight sharing, they often lacked the representational capacity to solve highly complex problems.

Methods: The Hyper-UT Architecture

Hyper-UT addresses these limitations by combining three core components: recurrent depth, adaptive halting, and dynamic weight generation.

  1. Universal Transformers (UT): The model employs a single shared Transformer block through which data passes iteratively, enabling variable depth.
  2. Adaptive Computation Time (ACT): A learned halting mechanism determines when the model has reached sufficient confidence to stop processing, allowing for input-dependent "pondering."
  3. Hyper-Modules: To overcome the capacity constraints of standard weight sharing, Hyper-UT uses a hyper-network to generate weights for the main Transformer layer at each step.
The Hyper-UT architecture uses an attention-based router to select and compose weights from an embedding pool for each recurrent step.

As shown in Figure 2, the "Weight Embedding Pool" allows the model to dynamically compose different functional modules for each step of computation without the memory overhead of storing unique weights for every potential layer.

Experimental Evaluation

We evaluated Hyper-UT on the Conditional Pointer Value Retrieval (C-PVR) task—a synthetic benchmark requiring multi-step pointer following—and the ImageNet-1K image classification dataset.

Generalization to Task Complexity

In the C-PVR task, models were trained on examples requiring 1 to 4 "hops" of reasoning. We then tested their ability to generalize to up to 9 hops.

Performance comparison on the C-PVR task. Hyper-UT (bottom row, blue) maintains high accuracy and scales its depth as the number of hops increases, far outperforming static baselines.

As illustrated in Figure 3, Hyper-UT demonstrates a strong correlation between task complexity (number of hops) and the number of layers executed. Unlike standard Transformers, which fail as soon as the required reasoning steps exceed their fixed depth, Hyper-UT successfully generalizes to 9-hop problems by dynamically increasing its "thinking time."

Efficiency in Computer Vision

On ImageNet-1K, Hyper-UT matches the accuracy of a standard ViT-B/16. Crucially, while the baseline ViT uses 12 layers for every image, Hyper-UT uses an average of only 2 layers, achieving a 70% reduction in FLOPs through adaptive halting.

Conclusion

Hyper-UT demonstrates that combining modularity with adaptivity is key to building efficient, generalizable models. By decoupling depth from parameter count and allowing the model to determine its own computational path, we move closer to AI that can handle varying task complexities as fluidly as human cognition. Future work will focus on scaling these hyper-network generators to the multi-billion parameter regimes of Large Language Models.

Summary updated

BibTeX
@misc{abnar2023adaptivity,
  author = {Samira Abnar and Omid Saremi and Laurent Dinh and Shantel Wilson and Miguel Ángel Bautista and Chen Huang and Vimal Thilak and Etai Littwin and Jiatao Gu and Josh M. Susskind and Samy Bengio},
  title = {{Adaptivity and Modularity for Efficient Generalization Over Task Complexity}},
  year = {2023},
  eprint = {2310.08866},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.08866},
}
Figure