The Static Input Problem

This post describes a subtle flaw in the Temporal Memory algorithm and suggests a way to fix it.

Background

When the temporal memory (TM) encounters a sequence that it has never seen before, it assigns a unique set of cells to represent each element of the sequence. These cells grow new synapses so that in the future the TM will recognize the sequence. Under normal conditions, once a cell starts growing synapses it becomes a permanent part of the sequence and the cell remains active for as long as that element of the sequence is in the TM’s input.

Consider when the TM creates a new segment and populates it with synapses from the previously active cells. Assume that the input is changing slowly. If the input is changing slowly then the active cells will also change slowly. On the next time-step after we create the new segment: most of our new synapses will activate again because most of the previously active cells are still active. And then the segment will activate and grow even more synapses to keep up with the slowly changing activity. The active cells grow synapses in an all-to-all pattern to form a clique. The segment learns to detect both the previous element of the sequence as well as the element that it is part of.

In this way, the TM can recognize sequences even if you speed them up or slow them down. You can even pause and resume the sequence and the TM will retain its state while you give it a constant input.

Speed_Invariance

Figure 1. A Temporal Memory is given the same waveform at different speeds. In all three cases the cellular activity is identical at corresponding points in the waveform.

The Flaw

However if the input moves very fast, then mini-columns are only active for one time-step and so the co-active cells do not grow synapses between each other. They learn to recognize the previous element of the sequence but not the the element that they are part of.

Consider a very fast moving input that suddenly stops and becomes stationary, for example a square wave. On the first time-step of the stationary input, the TM assigns winner cells to represent the new element and grows new synapses from the previous winner cells. However the previously active cells will not activate again because they correspond with the fast moving part of the sequence. On the second time-step of the stationary input none of the segments grown on the first time-step will activate and the mini-column will burst. Then the TM algorithm chooses all new winner cells and grows new synapses from the previous time-step’s now all inactive winner cells. In this situation the TM is incapable of creating stable activity. The exact sequence of events is outlined below:

Step 0) Move the TM’s input quickly and unpredictably, or reset the TM. Then give the TM a constant input. In all of the following steps the same mini-columns are active, and patterns refer to subsets of the cells in those mini-columns.
Step 1) Burst, new winners are pattern “A”.
Step 2) Burst, new winners are pattern “B”, grow new synapses from A → B.
Step 3) Burst, detect matching segments from A → B and reinforce them, winners are pattern “B”.
Step 4) Activate pattern “B”.
Step 5) Burst, new winners “C”, grow new synapses from B → C.
Step 6) Activate pattern “B”.
Step 7) Burst, detect matching segments from B → C and reinforce them, winners C
Step 8) Activate B & C
Step 9) Activate C (as a result of the synapses from B → C)
Step 10) Burst, new winners D, grow new synapses from C → D
Step 11) Activate B & C
Step 12) Activate C (as a result of the synapses from B → C)
Step 13) Burst, detect matching segments from C → D and reinforce them, winners D
Step 14) Activate B & C & D
Step 15) Activate C & D
Step 15) Activate D
Step 16) Burst …

And the cycle continues until all of the cells in the active mini-columns are incorporated into the pattern, at which point the pattern becomes stable (but highly undesireable).

Initial_Static_Pattern_Test
Final_Static_Pattern_Test

The Solution

The way to fix this problem is to change how the TM algorithm chooses a new winner cell when a mini-column bursts. Instead of simply making an arbitrary cell into the winner cell, the TM should check if in the previous time-step there was a winner cell in that mini-column and use it if possible.

Solved_Static_Pattern_Test

This solves the static input problem without significantly altering the TM algorithm. It is fast to compute and biologically plausible.

7 Likes

That seems like a step towards the object layer, because object layer cells are biased to activate if they were active during the prior time step. I think it’s cool how similar the object layer and TM are.

2 Likes

Do you observe this phenomene on ApicalTierbreakTM?

1 Like

htm.core now implements the proposed solution to this issue.


Casey, I didn’t discuss that in the write up BC I didn’t want to complicate things too much, but your reasoning is spot on! The logic for time-invariance is the same in the TM and in the object layer.


Thanh Binh, I did not test the ApicalTierbreakTM. I only focused on the regular TM. I assume that this issue can happen in the ApicalTiebreakTM because IIRC it uses mostly the same logic to determine which cells become winner cells. On the other hand, the ApicalTiebreakTM should encounter this issue much less often because it allows synapses from other areas, which could provide the stability that the TM needs.

2 Likes

thanks you very much for your opinion. Personally, I use ApicalTiebreakTM more often than the regular TM.

1 Like

There is information in the “length” of the static input that you are “ignoring”.

Silencing the input if the sequence is longer than a certain number might be a better solution. I suspect something like this is done by the triadic circuitry [1] of the thalamus. Simply silence the synapses in the relevant first-order thalamic nuclei (MGN, LGN, etc.) If the input is “too” persistent.

This is very important when the number of different input values is very small.

[1] Interneurons and triadic circuitry of the thalamus - PubMed

2 Likes

Awesome @dmac! Was it just recently added in a newer release, or has been in there? Also does it need to be activated somehow or it’s implemented by default?

Thanks!!

1 Like

Sheiser,

It is on by default, and there is no way to turn it off.

It was merged into master branch a few days ago.
You will want to pull the latest source code from the github repo and recompile & install your version of htm.core.

2 Likes