RESEARCH STORY / LITERATURE & REPRODUCTION
Grid cells and TEM: what we studied and what we built
A look at entorhinal spatial representations, Whittington et al. 2020 (TEM) and Kawahara & Fujisawa 2025 (Spiking TEM), our rate-coded and spiking re-implementations, stability fixes, and spatial evaluation toolkit.
Last updated: 2026-11-02. Grounded in Results report ↗, docs/TEM.md ↗, and codebase modules.
01 / BACKGROUND
Grid Cells in One Screen
Grid cells are specialized neurons located in the medial entorhinal cortex (MEC) that fire at multiple locations forming a periodic, hexagonal lattice tiling the environment. Discovered in rodents and humans, they provide a metric, internal coordinate system for physical and abstract space.
Why they matter: they suggest that the brain computes spatial relationships and relational structures using low-dimensional manifold representations. The core question we study is whether neural network models trained to learn relational structure shared across diverse environments organically develop grid-like representations or whether spatial periodicity requires structural constraints.
02 / LITERATURE REVIEW
The Two Papers We Studied
Whittington et al. 2020 (Cell 183) — Tolman-Eichenbaum Machine (TEM)
Question: How does the hippocampal-entorhinal system maintain and generalize cognitive maps across environments?
Architecture: Factorisation of relational structure g (where am I on the graph) and sensory identity x (what do I see), combined into conjunctive representation p = g ⊙ x, stored in a fast Hebbian memory M reset per world, while slow transition weights (graph dynamics) are learned across worlds via backpropagation.
What they report: Generalisation of predictive inference to novel routes in new environments; emergence of grid-like rate maps and place-like fields in factorised units.
Limits: Relies on low-rank graph approximations and idealized training schedules; evaluated primarily on abstract graph worlds.
Kawahara & Fujisawa 2025 (bioRxiv) — Spiking TEM
Question: Can spiking neural networks implement TEM principles in biologically plausible dynamics?
Architecture: TensorFlow 2 spiking network implementation featuring spiking neuron models and a theta oscillation term in SpikingDense.
What they report: Implementation of spiking TEM dynamics and spatial representation analyses.
Limits: In our public code audit (one run, 40k iterations, 8x8 worlds), prediction loss remained near chance (2.1-2.5); spatial probes show strong within-world position tuning (CA1 spatial info 2.614) but no evidence of shared cross-world structure (map corr near zero, RSA near zero), population distances follow sensory identity rather than grid distance, gridness is unresolvable at 8x8, and no phase precession machinery is present.
03 / OUR IMPLEMENTATION & AUDIT
What We Did with Them
We ran the authors' public Spiking TEM code (one run) and audited its checkpoints (see findings table in Results report ↗). In parallel, we built a clean, modular re-implementation of rate-coded and spiking TEM in PyTorch (src/neurosush/tem/).
Spatial Probe of Our Models: Spatial probes of our trained models (v2 s0 and v1 s0, one seed, 8x8 worlds) are now complete and published in the Results report ↗ (Section 6.1). Across three training seeds each, the cross-world RSA of g (0.64-0.81 for v2, 0.79-0.93 for v1) never clears the 95th percentile of path-integration controls by the required 0.15 (margins -0.24 to +0.01), so it is not evidence of learning or of a world-independent position code. p follows sensory identity. Caveats: one training run per seed, 8x8 worlds (gridness not resolvable), signed spatial info is a diagnostic not bits/spike, not grid distance (not grid cells), not a paper ranking.
The Four Stability Fixes: Training TEM from scratch at reference scale required four key stability innovations:
- Missing L_p_x term and mis-scaled objective: Supervise sensory-cued memory and calibrate loss reductions.
- Reliability-blind fusion ->
reliable_fusion: Weight memory correction by retrieval reliability. - Unbounded attractor activation -> bounded activation: Prevents exploding gradients.
- Compressed memory curriculum: Gradual memory introduction.
Spatial Evaluation Toolkit: We developed a rigorous evaluation suite in src/neurosush/spatial/ implementing rate maps, spatial information with shuffle nulls, gridness scoring (evaluating hexagonal and square periodicities separately), theta-phase regression, position probes, and rigorous control models.
04 / VERIFICATION & RIGOUR
Tests and Rigour
neuroSush maintains rigorous testing across the codebase:
- Total test suite: 1,629 tests passing.
- TEM tests: 120 tests in
tests/tem/. - Spatial evaluation tests: 77 tests in
tests/spatial/. - Golden fixtures: Compared against measured tolerances (maximum float noise 1.2e-7 on tensor outputs).
- JS parity: Interactive Atlas teaching plates verified against Python models.
- PASS rule: Strict validation criteria (n >= 3, mean >= best baseline + 0.05, every seed > frequency, CI lower bound > mean frequency).
05 / VISUALISATIONS & DEMOS
What We Can Show You
Explore the live models and interactive visualisations across the repository:
- Atlas Gallery: Open Atlas ↗ featuring 14 live plates covering spiking neurons, dendrites, STDP, connectivity, waves, encoding, memory, HTM/Thousand Brains, recording, transforms, and TEM teaching models.
- TEM Teaching Plate: Plate T01: TEACHING: position imposed ↗.
- Results Report: Results & Reproducibility ↗ with variant comparison chart and tables.
- neuroSush Studio: Project persistence, revisions, and simulation runs (preview, in development).
Live demos: Spatial probe results for v2 s0 and v1 s0 are now published in the Results report ↗ (Section 6.1). Next: seeds 1-2, 16x16 worlds, and recorded-run demo.
06 / HONEST STATUS
What We May and May Not Claim
Not a paper reproduction. Grid-cell emergence not shown. Structure imposed. Spatial probe results for v2 s0 and v1 s0 (one seed, 8x8 worlds) are now in the Results report ↗ (Section 6.1). Caveats: one seed, 8x8 worlds, signed spatial info is a diagnostic not bits/spike, shared geometry is not grid distance, not a paper ranking, and random-init p decodes position.
May Say
- A clean, tested TEM implementation that trains stably at reference-scale and clearly beats baselines on our internal metric.
- Better than our earlier model (v0).
- Their public-default run stayed near chance in prediction loss; ours does not (different code/worlds, one seed).
May NOT Say
- "Better than the paper" (we never scored their model on our metric; no remapping/gridness comparison).
- "Grid cells emerged" (periodicity in v3 is structure imposed; gridness is unresolved at 8x8; grid-cell emergence not shown).
- Theta phase precession as emergent (theta is imposed).
- Any number not in section 2 or 3 of the results report.