Skip to content

joyboseroy/temporal-coding-tbt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

temporal-coding-tbt

Code accompanying the paper:

"Temporal Coding as a Substrate for Sensorimotor Object Inference: A Spiking Reinterpretation of Thousand Brains Architecture" Joy Bose


What this is

The Thousand Brains Project's Monty framework models object recognition through sequential sensorimotor exploration. Its current implementation encodes each contact as a dense feature vector, discarding the temporal order of observations.

This repository proposes replacing dense vectors with rank-order spike packets, where the firing sequence encodes spatial structure implicitly:

  • The most strongly activated neuron fires first
  • The time gap between packets encodes displacement without explicit coordinate transforms
  • An asymmetric STDP rule encodes traversal direction into synaptic weights
  • A learnable context parameter λ adapts the memory horizon to each object's geometry

Key result

On a traversal discrimination task where two objects share identical features but differ in spatial arrangement:

Representation Accuracy
Dense accumulation 51.2% (chance)
Temporal coding 100.0%

Dense accumulation cannot distinguish the objects — their feature vectors sum identically regardless of order. Temporal coding discriminates them perfectly because STDP encodes the direction of traversal into the weight matrix.

Repository structure

src/temporal_coding/
    spike_encoder.py          # rank-order spike packet encoding
    latency_decoder.py        # implicit displacement from inter-packet latency
    stdp.py                   # causal STDP learning rule (Bi & Poo, 1998)
    adaptive_accumulator.py   # evidence accumulator with learnable lambda

experiments/
    traversal_discrimination.py   # reproduces the key result above

tests/
    test_temporal_coding.py       # 17 unit tests

Requirements

numpy
pytest   # for tests only

No GPU, no Habitat-sim, no pretrained models required for the experiment. To integrate with Monty, install the tbp.monty conda environment and copy src/temporal_coding/ into src/tbp/monty/frameworks/models/temporal_coding/.

Run the experiment

git clone https://github.com/joyboseroy/temporal-coding-tbt.git
cd temporal-coding-tbt
python experiments/traversal_discrimination.py

Expected output:

Overall     51.2%         100.0%
Accuracy gap: +48.8 percentage points in favour of temporal coding.

Run the tests

pytest tests/test_temporal_coding.py -v
# 17 passed

How the components fit into Monty

TemporalCodingLM subclasses GraphLM and overrides only the feature encoding and evidence accumulation. Reference frames, voting, the motor policy, and buffer management are all inherited unchanged. See the paper for the full architecture description.

Citation

@misc{bose2025temporal,
  title={Temporal Coding as a Substrate for Sensorimotor Object Inference:
         A Spiking Reinterpretation of Thousand Brains Architecture},
  author={Bose, Joy},
  year={2025}
}

License

MIT. See LICENSE.

About

Temporal Coding as a Substrate for Sensorimotor Object Inference: A Spiking Reinterpretation of Thousand Brains Architecture

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages