Change of model behavior because of SP dimension changes


I study unbinding toward a lot of sentences with SPA.
In my model, inputs are sentences. I assign memories each sentences.(For example, if the number of sentences is 20, the number of sentences is 20.) Then, in the case questions come in, my model selects appropreate memory, in which the appropreate sentence is stored, and perform unbinding the selected memory.

under the condition

Input sentences are follows:

sentences = ['U40*H47+Y5*I9+Z3*(U16*I25+P46*A4+R40*B27)',

These are random strings and the number of sentences is 20.
I create SP of these sentences and run my code. (11.8 KB)

In dimensions=800, the results are

This is the good result for me because one memory stores one sentence.

In dimensions=1000, the results are

These result show me multiple sentences rather than one sentence in each memory.
This is not my desire.

The difference between them is dimensions, but my model seems to perform different behavior.


Have you run the model with multiple seeds? For example,

seed = 0
rng = np.random.RandomState(seed)
vocab = spa.Vocabulary(dimensions=dimensions, rng=rng)

model = spa.SPA(label="Simple question answering", vocabs=[vocab], seed=seed)

I ask, because it’s possible the difference between the simulations were not the dimensions, but the seed.

As an aside, @xchoo might have some advice on the type of binding and unbinding you’re doing. I seem to remember him mentioning you should use unitary vectors by setting unitary=True in spa.Vocabulary.

Also, since you’re trying to push the representational power of SPA and you aren’t using any part of the API which will change, I might recommend using nengo_spa instead of


To me it seems that this might be caused by the Basal Ganglia being unable to select a single action for some reason and thus activating all actions at the same time. However, I’m not sure why this happens.


I tried what @Seanny123 said.

First, I conigurate seed value, but it doesn’t work well.
Second, when I use nengo_spa instead of, it works well. (13.7 KB)

These figures are the results in case of dimensions = 960, and I also got the good results in case of dimensions = 786.

As @jgosmann said, I also think the error is caused by the part of Action Selection, but I still don’t understand that.

Thank you.


Yep, @jgosmann is totally right. The problem is the with Basal Ganglia not committing to a single output. My hypothesis for the cause of this is:

  1. Multiple inputs to the basal ganglia are very similar
  2. Neural noise, which is usually insignificant, causes the basal ganglia inputs to change enough to create multiple outputs

I’m not sure how to correct it without knowing more about what exactly you’re trying to achieve with all this parsing.


As mentioned in the first post, I’m interested in question-answering for multiple sentences.

After accumulating the first sentence in memory1, the second sentence in memory2, and so on, the model receives the next two inputs.
One is SP(SP-A) for unbinding, and the other is SP(SP-B) to search for appropriate sentence from sentences.

If the sentence can be selected by the latter SP, the memory in which the corresponding sentence is accumulated can be unbound with the former SP.
In order to obtain appropriate results, each memory must store a single sentence SP.

For example, suppose the sentences are as follows.

Sentence1 = DOG*Agent + CHASE*Verb + BOY*Theme
Sentence2 = CAT*Agent + CHASE*Verb + MOUSE*Theme

Sentence1 is stored in memory1, and Sentence2 is stored in memory2.
If the question is “What does the dog chase?”, SP-A is Theme and SP-B is DOG*Agent + CHASE*Verb.

In order to find the appropriate sentence (Sentence1), the similarity between Sentence1 and SP-B and the similarity between Sentence2 and SP-B are compared. In this case, since the former’s degree of similarity becomes larger than the latter, my model executes memory1 *~SP-A.

If memory1 has two semantics of Sentence1 and Sentence2 for some reason, the result may not be what I want even if memory1 *~SP-A is executed.


I have additional questions about utility (bg.input).

I found the period when no action is selected (not multiple actions are selected), so I observe the utility. And I noticed the period matches one when utility is too large (when larger than 2).

Utility is the maximum value of ‘dot product’ between SPs at a time, right?

I think if utility is too large, a particular inhibitory output from basal ganglia may not be zero for some reason.
Does anyone know why?