Abstract
Neural networks are often criticized as "black boxes" that lack the explicit compositional structure found in symbolic AI. This paper introduces ROLE (Role Learning Networks), a diagnostic framework that demonstrates how recurrent neural networks (RNNs) implicitly learn symbolic, rule-based structures. By decomposing hidden vector representations into interpretable "fillers" and "roles" via Tensor Product Representations (TPRs), the authors show that RNNs trained on compositional tasks naturally converge to symbolic logic. This discovery enables "constituent surgery," where internal vector states are precisely manipulated to alter model behavior, bridging the gap between connectionist and symbolic paradigms.
Introduction
A fundamental tension exists in artificial intelligence between symbolic systems, which rely on explicit rules, and connectionist models, which utilize continuous vector representations. While deep learning models excel at complex tasks, their ability to achieve true "compositionality"—the capacity to combine known components into novel meanings—remains a subject of intense debate. The central challenge is determining whether neural networks succeed by approximating symbolic logic or through sophisticated pattern matching. To address this, the authors propose a method to "see" the underlying structural organization within high-dimensional vector spaces.
Methods: The ROLE Framework
The researchers developed ROLE, a diagnostic model designed to approximate the hidden encodings of a target neural network (specifically a Gated Recurrent Unit, or GRU) using Tensor Product Representations (TPRs). Unlike previous analysis methods that relied on human-defined structural roles (e.g., simple positional indices), ROLE automatically learns the optimal roles for a given task.
The ROLE model consists of an encoder that assigns a "filler" vector (representing word meaning) and a "role" vector (representing structural position) to each input. These are combined using a composition equation: the sum of the outer products of fillers and roles ($Filler \otimes Role$). By training ROLE to minimize the difference between its transparent TPR encoding and the RNN's opaque hidden state, the researchers can test if the RNN has organized its internal representations symbolically.
Experimental Setup and Datasets
The framework was evaluated on two primary benchmarks:
- SCAN (Synthetic Command Navigation): A synthetic dataset requiring models to translate commands (e.g., "run opposite left twice") into action sequences. It serves as a gold standard for testing compositional generalization.
- SNLI (Stanford Natural Language Inference): A large-scale natural language dataset used to determine if common sentence embedding models (like InferSent) exhibit similar compositional structures in less constrained environments.
Results and Key Insights
The most significant finding is that standard RNNs naturally converge to solutions functionally equivalent to symbolic TPRs when the task demands compositionality.
High Fidelity and Interpretable Roles
On the SCAN task, ROLE achieved 94.8% substitution accuracy. This indicates that replacing the RNN’s actual hidden state with ROLE’s symbolic approximation allows the model to produce the correct output in nearly all cases. In contrast, models using hand-crafted roles achieved only 44% accuracy, suggesting that neural networks learn complex, task-specific structures that elude human intuition. For instance, ROLE discovered specific roles for logical operators like "and" and for terminal subcommand positions.
Constituent Surgery
To demonstrate the causal power of these discovered structures, the authors performed "constituent surgery." Using the ROLE equations, they could "subtract" specific symbolic components from an RNN's hidden vector and "add" others.
For example, by taking the vector for "jump and run twice," subtracting the "twice" component, and adding the "thrice" component, the decoder produced the sequence for "JUMP RUN RUN RUN." This proves the vector space is organized with surgical, symbolic precision.
Discussion and Limitations
While ROLE excels on synthetic tasks like SCAN, its performance on "messy" natural language models (trained on SNLI) was comparable to a simple "bag-of-words" model. This suggests that current natural language models may rely more on surface-level statistics than deep structural logic. Additionally, the current framework is tailored for RNNs; adapting ROLE to analyze the variable-sized vector collections used by modern Transformer architectures remains a key area for future research.
Summary updated