Learning Compositional Latent Structure with Vector Networks

Niclas Pokel, Benjamin F GreweNeurIPS 2026

TL;DR

Standard deep neural networks cram every skill they learn into giant, shared weight matrices, making it remarkably hard for them to mix and match familiar concepts in new ways. This paper introduces Vector Networks (VNs), an architecture that swaps static weight matrices for a library of reusable, rank-1 "weight atoms" that assemble on the fly into custom transformations for each input. The payoff? Models that match top-tier baselines on familiar data, while cutting out-of-distribution (OOD) error by roughly an order of magnitude when forced to recombine known building blocks.

What Problem Does This Paper Address?

Imagine trying to build a new LEGO castle, except every piece from your previous builds has been melted together into one giant plastic brick. That is essentially what happens inside standard neural networks trained with backpropagation—a phenomenon the authors call weight entanglement.

Because gradients wash through the entire network at once, distinct features and skills get written into overlapping directions of the same dense weight matrices. Updating one behavior inevitably nudges parameters used by others. While humans easily recombine known rules (like imagining how gravity and wind affect a falling leaf simultaneously after seeing each force alone), entangled networks struggle with out-of-distribution (OOD) compositional generalization. Instead of recombining modular mechanisms, they awkwardly interpolate within one monolithic mapping. To truly compose concepts, the authors argue we need addressable responsibility in weight space—reusable functional pieces that can be isolated, recombined, and updated independently.

Methods

Instead of applying a fixed weight matrix $W$ to every input, a Vector Network layer maintains a dictionary of rank-1 weight atoms. Each atom is simply the outer product of an input-sensing vector and an output-interface vector ($A = u s^\top$).

Vector Networks compose input-specific functions from sparse weight atoms instead of using a single monolithic weight matrix.

Processing an input happens on two distinct timescales—without end-to-end backpropagation:

  1. Fast Inference (Settling): For every input sample, the network runs a few iterative upward and downward sweeps using standard proximal-gradient steps (ISTA/FISTA, borrowed from classical sparse coding). Each layer minimizes a local energy function to find a sparse set of scalar coefficients ($g$) that simultaneously reconstruct the input from below, match top-down feedback predictions from above, and stay sparse via an $\ell_1$ penalty. Once settled, those active atoms sum together to form a bespoke, low-rank weight matrix $W^\star(x) = \sum_i g^\star_i(x) A^{(i)}$ tailored specifically to that sample.
  2. Slow Learning (Atomic-Hebb): Once inference converges, inference is treated as a black box. Only the atoms that were actually selected ($g^\star_i \neq 0$) get updated, driven by local reconstruction residuals scaled by each atom's inferred responsibility. Inactive atoms remain completely untouched, structurally preventing unrelated updates from overwriting one another.

Datasets

Models are trained strictly in-distribution (ID) on isolated factors and tested OOD on unseen combinations across five benchmarks (grouped into four experimental suites):

  • Spatial Composition: Adapted from Liang et al. (2025), mapping 2D coordinates to a $28\times28$ Gaussian bump image, holding out a central square region for OOD testing.
  • 1D Function Composition: Reconstructing or predicting masked 512-D signals built from four primitive families (sine, cosine, polynomial, Gaussian). ID sees single primitives; Easy-OOD tests cross-family sums; Hard-OOD tests nested nonlinear functions.
  • N-Body Force Composition: Predicting 2D accelerations for $n=5$ bodies under isolated forces (gravity, drag, Lorentz, or spring) during training, then testing OOD on 2–4 simultaneous forces and fewer bodies ($n=5, 4, 3$).
  • Compositional MNIST & Dynamic RTS (Newly Constructed): Two vision benchmarks built from MNIST. The first tests static multi-digit compositions (Add/Subtract mixtures, Max projections, inversions) and corruptions (noise, occlusion) after training on single digits. The second (Rotation/Translation/Scaling) trains on single motion frames and tests OOD on combined, larger-step, and multi-digit motions.

Key Insights and Ideas

  • Composing operators, not just features or outputs: Predictive coding selects features inside a fixed matrix, and Mixture-of-Experts blends the final outputs of dense sub-networks. VN sums rank-1 operators before applying them, synthesizing a genuinely new linear map per input.
  • Depth helps VNs, whereas it hurts standard CNNs off-support: In spatial decoding, making a standard CNN deeper actively worsens its OOD-to-ID error ratio because deeper layers become more entangled. VNs remain stable and actually improve slightly with depth.
  • Sequence models take "identity shortcuts" on reconstruction: On 1D signals, Transformers and Mamba beat VN on Hard-OOD pure reconstruction simply by copying/continuing visible input context. Once parts of the signal are masked out—forcing true latent structure recovery—baselines degrade sharply while VN takes first place across the board.
  • Sparsity and low-rank structure alone aren't the magic: Autoencoders matched to VN's exact bottleneck sparsity, as well as hand-factorized low-rank decoders, still underperform VN. The secret sauce is pairing sparse operator selection with localized learning.

Key Results

Across domains, VN matches strong baselines on ID data while slashing OOD compositional error—frequently by roughly an order of magnitude:

  • Spatial Decoding: Eliminates the sharp error spike inside the unseen center zone suffered by CNN and VAE decoders, maintaining uniformly low MSE across the $28\times28$ grid and a near-flat OOD/ID ratio across 2 to 16 layers.
  • 1D Signals: Ranks #1 in every single Hard-OOD masked prediction regime, outperforming Transformers, Mamba, NeuralODEs, and RNNs.
  • N-Body Physics: Achieves the lowest OOD acceleration MSE when combining 2, 3, and 4 physical forces under body dropout, beating GNNs, MLPs, FiLM, Transformers, Mamba, and even a hand-crafted "Factorized" control network.
  • Compositional Vision: Achieves ~10x lower reconstruction MSE than capacity- and sparsity-matched convolutional autoencoders and VAEs on the toughest multi-digit MNIST compositions, and degrades far more gracefully on combined RTS motions.

Limitations and Future Work

  • Inference is computationally expensive: Because iterative settling evaluates the entire atom dictionary over $T_{\max}$ sweeps (5 sweeps for physics/signals, up to 15 for spatial, and up to 120 for MNIST), VN is currently slower than a standard feedforward pass—sparsity adds representational capacity rather than compute savings. Restricting late sweeps to active supports, warm-starting, adaptive halting, or amortizing sparse inference are promising next steps.
  • Conditional theoretical guarantees: Exact compositional recovery requires inputs to stay within the active atom budget $k$, dictionaries to remain sufficiently incoherent (avoiding duplicate atoms), and compositions to be additive—deeply nested nonlinearities (like Hard-OOD signals) fall outside theoretical guarantees.
  • Manual sizing & continual learning: Dictionary sizes ($K$) and sparsity caps ($k$) are currently tuned by hand. Dynamically growing the atom library for continual learning—refining or adding a few atoms for new tasks without catastrophic forgetting—is highlighted as a natural, untested frontier.

Summary updated

Abstract

Deep networks are powerful function approximators, but they typically store many different computations in shared weight matrices, making it difficult to selectively reuse or adapt parts of them when a familiar structure appears in novel combinations. We introduce the Vector Network (VN), a hierarchical recurrent architecture in which each layer replaces a fixed weight matrix with a library of reusable rank-1 weight atoms. For each input, VN minimizes a layer-local energy to infer a sparse set of active weight atoms and their coefficients, jointly constrained by bottom-up input reconstruction and top-down feedback consistency. These weight atom coefficients then compose an input-specific low-rank weight matrix for that sample. After convergence, slow learning updates only the selected weight atoms through local residual signals scaled by the inferred coefficients. We evaluate VN on four compositional benchmarks spanning 1D signals, 2D spatial decoding, N-body dynamics, and compositional MNIST. VN matches strong baselines in distribution while often achieving out-of-distribution error about an order of magnitude lower when familiar factors must be recombined in novel ways. Vector networks thus make compositional generalization a structural property of the architecture and inference process rather than a brittle byproduct of fitting many behaviors into one shared dense parameter substrate.
BibTeX
@inproceedings{pokel2026learning,
  author = {Niclas Pokel and Benjamin F Grewe},
  title = {{Learning Compositional Latent Structure with Vector Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=C8agNRzT7b},
}
Figure