Abstract
Traditional world models often decouple spatial compression from temporal prediction, leading to compounding errors in long-horizon tasks. We introduce Grid-like Code Quantization (GCQ), a brain-inspired framework that unifies these processes. GCQ utilizes Continuous Attractor Neural Networks (CANNs) to construct an action-conditioned codebook where latent states are represented as neural activity "bumps" on a toroidal manifold. By performing sequence-level template matching, GCQ ensures temporal consistency and creates a structured "cognitive map" in latent space. Our results demonstrate that GCQ achieves superior long-term stability and enables efficient pathfinding-based planning, mirroring the function of grid cells in biological navigation.
Introduction
In machine learning, "world models" typically follow a two-stage design: a spatial compressor (like a VQ-VAE) turns images into discrete tokens, and a temporal model (like an RNN or Transformer) predicts how those tokens change over time. This separation can lead to instability, especially over long sequences where errors compound.
Biological systems solve a similar challenge using Grid Cells (GCs)—neural patterns that provide a periodic, coordinate-like system for space, time, and abstract concepts. GCQ bridges the gap between these biological grid codes and artificial vector quantization to create more robust, integrated world models.
Methods: Grid-like Code Quantization
The core innovation of GCQ is the replacement of a static codebook of independent vectors with one structured by the dynamics of Continuous Attractor Neural Networks (CANNs).
- Action-Conditioned Codebook: Codewords are "bumps" of neural activity on a toroidal surface. These bumps move in response to actions, providing a built-in transition model.
- Joint Spatiotemporal Compression: Instead of frame-by-frame quantization, GCQ performs "sequence template matching." It identifies the starting codeword in the CANN that, when evolved by a sequence of actions, best matches the entire encoded latent trajectory.
Biological Inspiration and the Cognitive Map
GCQ is grounded in the neuroscientific hypothesis that grid cells emerge from mapping sensory experiences onto pre-existing toroidal attractor structures. As shown in the figure below, the CANN dynamics naturally produce periodic patterns reminiscent of biological grid cells when projected onto a 2D plane. Because the codebook is governed by these attractor dynamics, the latent space inherently becomes a "cognitive map." Moving an agent in the real world corresponds to moving a "bump" in the latent grid.
Key Results and Insights
The model was evaluated on diverse datasets, including Google Street View (GSV) and 2DMaze. Key findings include:
- Long-Horizon Stability: In GSV experiments, GCQ maintained high-quality image predictions over long horizons. While baseline models (VQ+UNet) often failed to complete a 360-degree rotation or became blurry, GCQ remained geometrically consistent.
- Planning as Pathfinding: Goal-directed planning becomes trivial in GCQ. It reduces to finding a sequence of valid "bump transitions" on the latent map that lead from the current state to the goal.
- Zero-Shot Generalization: GCQ demonstrates an ability to predict observations in unseen environments, provided the underlying "rules" of movement (the action-conditioned transitions) remain the same.
- Fixed vs. Learnable Codes: Interestingly, keeping the grid-like codewords fixed (derived from CANN math) performed better than making them learnable, suggesting that the rigid geometric structure is a crucial feature for stability.
Conclusion
GCQ offers a robust framework for building world models that are both computationally efficient and biologically plausible. By unifying spatial and temporal compression through a structured, action-conditioned codebook, it provides a path toward more stable and navigable artificial intelligence. Future work will explore scaling these toroidal attractors to higher dimensions to accommodate more complex action spaces in robotics.
Summary updated