The Neural Data Router: Adaptive Control Flow in Transformers Improves Systematic Generalization
Róbert Csordás, Kazuki Irie, Jürgen Schmidhuber
TL;DR
The paper introduces the Neural Data Router (NDR), a Transformer-based architecture augmented with a copy gate and geometric attention to enable adaptive control flow and data routing across Transformer columns. By allowing layers to be skipped when inputs are ready and by biasing attention to the closest matching signals, NDR achieves robust length and depth generalization on CTL, simple arithmetic, and ListOps tasks. Key findings include 100% generalization on CTL, near-perfect results on arithmetic and ListOps, and interpretable gating/attention patterns that align with intuitive neural routing. The work argues for a bottom-up, architecture-driven approach to generalization and provides code to enable replication and further exploration of data routing in transformer networks.
Abstract
Despite progress across a broad range of applications, Transformers have limited success in systematic generalization. The situation is especially frustrating in the case of algorithmic tasks, where they often fail to find intuitive solutions that route relevant information to the right node/operation at the right time in the grid represented by Transformer columns. To facilitate the learning of useful control flow, we propose two modifications to the Transformer architecture, copy gate and geometric attention. Our novel Neural Data Router (NDR) achieves 100% length generalization accuracy on the classic compositional table lookup task, as well as near-perfect accuracy on the simple arithmetic task and a new variant of ListOps testing for generalization across computational depths. NDR's attention and gating patterns tend to be interpretable as an intuitive form of neural routing. Our code is public.
