Friday, March 18, 2022

Attempts to implement biologically plausible combined learners

 This article is a summary of the past three articles (A, B, C) and a translation of an article in Japanese.

Abstract

Brain-inspired cognitive architecture is one of the options for the realization of AGI.  While backpropagation has been widely used in artificial neural networks, it is not considered to be used in the brain, especially across brain regions.  This paper reports the implementation of the following cognitive architectures consisting of multiple learners without backpropagation between modules:

  1. A minimal architecture consisting of multiple learners without inter-module backpropagation

  2. A model of cortical, basal ganglia, and thalamic loops

  3. A model of a working memory with an attention mechanism.


Introduction

In recent years, progress has been made in the field of machine learning using artificial neural networks (ANNs).  In agent learning with ANNs, end-to-end deep reinforcement learning with backpropagation is the mainstream.  Meanwhile, it is hoped that cognitive architectures inspired by animal brains will serve as an approach to AGI.  Since backpropagation may not occur in the animal brain (at least not across brain regions), I have attempted to implement three cognitive architectures consisting of learners without inter-module backpropagation.


In the implementations, modules modeled after the cerebral cortex and basal ganglia were incorporated.  The cortex is thought to process input into forms useful for making survival decisions and making predictions and control outputs.  The basal ganglia are thought to control the timing of the cortex's external outputs with reinforcement learning.


The cortex is composed of multiple regions, and there is a hierarchy among the regions, especially in sensory areas.  In "deep learning," learning is performed in a hierarchical manner that mimics the hierarchy, based on the assumption that errors are propagated backward across regions.  However, in the animal brain, there is no way for errors to propagate across regions.  A more biologically plausible hypothesis is that each region learns to minimize prediction errors (predictive coding).


Regular (deep) reinforcement learning assumes that a single learner controls task-specific outputs.  In the brain, multiple cortical areas with their corresponding basal ganglia are in charge of controlling motions and brain areas.  Thus, brain-inspired cognitive architectures would have to incorporate multiple reinforcement learners.


With the consideration above, this article reports the three implementations:

  1. a minimal architecture incorporating multiple learners

  2. the cortio-BG-thalamic loop

  3. working memory with attention mechanism


Implementation frameworks

The following frameworks were used.

Environment framework

Open AI Gym, a widely used environment framework, was used.

Cognitive Architecture Description Framework

BriCA (Brain-inspired Computing Architecture), a computing platform for developing brain-inspired software, was used to describe the cognitive architecture (agent definition) [1]. BriCA has a mechanism for modules to exchange numerical vector signals in a token passing manner.  Modules can also be nested.

Machine learning framework

PyTorch was used as the ANN implementation framework, and TensorForce was used as the reinforcement learning framework.  With TensorForce, internal environments are easily set up.


Implementation attempt

Verifying the working of a minimal architecture with multiple learners

(main article)

An architecture with BriCA was implemented consisting of two modules: a module containing a simple autoencoder (with PyTorch) as the cortical part, and a module containing a reinforcement learner (with TensorForce) with an internal environment set up as the basal ganglia part.  The Cart-Pole task of the Gym (input is a 4-dimensional numerical vector) was used for testing.  The autoencoder was pre-trained with environment input obtained from random output.

Since the token-passing cycle of BriCA is not the same as that of the external environment, tokens corresponding to the cycles of the external environment were set in the internal implementation so that the internal processing proceeds according to the cycles of the external environment.  Specifically, the internal processing is performed as the value of the token increases by one.

See the GitHub page for the code and results.


Fig. 1

Implementation of the cortico-BG-thalamic loop

(main article)

The implementation is an attempt to realize the action selection and execution thought to be realized by the cortico-BG-thalamic circuit with minimal mechanisms. The mechanisms to be implemented are based on the following hypotheses.

Hypotheses

The cortex selects (predicts) actions. The basal ganglia make judgments about whether the cortex's choices are suitable for execution (and disinhibit the thalamus).  The basal ganglia, as a reinforcement learner, receives information on the input to the cortex (State) and the choice being made (Action), selects Go/NoGo, and then receives a reward to learn the policy of State+Action ⇒ Go/NoGo.  Meanwhile, the cortex learns from the executed State-Action pairs and predicts (selects) the appropriate State ⇒ Action.

The following provide background that corroborates the hypotheses.

  • On the fact that the basal ganglia do not make action choices:

    • The thalamic matrix subject to basal ganglia inhibition may not be "fine grained" enough to accommodate choices (e.g., mini-columns).

    • The number of GPi cells in the basal ganglia that inhibit (deinhibit) the thalamus may be fewer than the number of minicolumns in the cortex (whether the minicolumns are coding choices is arguable).

  • The basal ganglia are said to control the timing of action initiation.

  • Reinforcement learning in the basal ganglia is necessary to cope with delayed reward.

  • The hypotheses reconcile the role of reinforcement learning in the basal ganglia with prediction in the cortex.

Implementation

The outline of the implementation is described below.
See the GitHub page for the code and results.

Cerebral cortex part

Receives observation input and outputs action selection (prediction).

Output prediction layer: learns to predict an action from "observed input" using the action selected in the basal ganglia as the teacher signal.  A three-layer perceptron was used for implementation.

Output adjustment layer: calculates outputs using the outputs from the output prediction layer and noise as inputs.  The noise creates random output.  The contribution of noise decreases as the output prediction layer learns to make correct predictions (the task correctness rate was used as the probability of using output prediction).

Output gating layer: The largest of the output adjustment layer outputs was selected (winner-take-all) and gated with a Go/NoGo signal from the basal ganglia.

Thalamus part

In this implementation, the Go/NoGo from the basal ganglia was directly transmitted to the output gate layer in the cortex, and the implementation was omitted.

Basal ganglia part

Reinforcement learning of the Go/NoGo decision was performed using the observed input + output layer output (binarized by threshold) as states.

Overall Architecture

Figure 2 shows the implementation outline and the connections between parts.

Figure 2

Test task

A minimal delayed reward task was set up in which the reward was given a few steps after the cue-observed action selection.

Learning in the Basal Ganglia part 

Though TensorForce reinforcement learning algorithms (Vanilla Policy Gradient, Actor-Critic, and Proximal Policy Optimization) were tried, learning was not stable or did not occur.  Thus, a frequency-based learning algorithm was implemented, which resulted in learning convergence after about 1,000 episodes.

Learning in the Cortex part

A three-layer perceptron was used to learn the cortical output when the basal ganglia part produced a Go with the external environmental input.  The correct response rate for the task was used as the probability of using predictions as the output candidate for which the basal ganglia part makes a Go/NoGo decision (if predictions are not used, the output candidate is randomly determined).  Loss values (cross-entropy) converged around 0.25 after about 1000 episodes (the reason for this would be that randomness remains in the selection of actions in the setting.)

Implementation of working memory with attention mechanism

(main article)

Remembering items in a task (working memory) is necessary for cognitive tasks.  Since animals (including humans) can only memorize a limited number of items at a time, it is thought that attention is used to narrow down the number of items.  Here an implementation of working memory was made with a minimal form of attention mechanism using a simplified delayed match-to-sample task.

The implementation here is based on the following hypotheses about working memory.

  1. The decision of which input the working memory should retain is an action selected by the PFC (prefrontal cortex) (action that directs attention to a specific item).

  2. Which input the working memory should retain is selected by the PFC⇔Th loop (PFC-Th-BG loop), which is controlled by the BG as in other actions, and is then put into action.

  3. The selection of which working memory to keep is exclusive, as in other actions, and only one is executed at a time in the dlPFC (dorso-lateral PFC).

  4. Working memories are retained for a certain period of time by the activity of bi-stable neurons or other neurons in the PFC, and for longer retention, "reselection" by the PFC-Th-BG loop is required.

  5. The frontal cortex uses the information retained in working memory and the sensory information to predict and execute actions to solve the task.

While PBWM [2] is known as a model of working memory, it was not adopted here as it may not be so biologically plausible:

  • It states that the basal ganglia gate sensory input, but it is the cortical output to the thalamic loop that is gated by the basal ganglia.

  • It states that working memory is retained during NoGo, which is the default state for the basal ganglia, but if that is the case, working memory retention becomes the default.

Specific mechanism

The implementation consists of three modules: an input register, a register controller, and an action determiner.  The input register is the core part of working memory that does not learn. The other two modules learn.

See the GitHub page for details on the code and results.

Input register

Its input is an observation input and input holding signal (attention signal).  When an input holding signal is given, the specified portion of the observation input is held for a specified period of time, and the output is whether the specified portion of new observation input matches the held content (recognition).

The implementation is simply a "register" with a comparator added.  It corresponds to short-term memory in the prefrontal cortex.

Register controller

It determines the observed inputs (attributes) of the input register to be retained from the observed inputs and sends an attention signal to the corresponding input register (only once per episode).

The cortico-BG-thalamic loop implementation described in the previous section was used for learning.

Action determiner

It determines the action to be output to the external environment (only once per episode) from the reaffirmation signal.

The cortico-BG-thalamic loop implementation described in the previous section was used for learning.

Architecture

Figure 3

Learning

Learning based on rewards from the external environment took place at two locations: the action determiner and the register controller.

It was hoped that the two learnings would increase task success in a bootstrapping fashion, but since this did not work, curriculum learning was attempted.  Specifically, first, one learner was replaced with a "stub" that outputs the correct solution to train the other learner.  And then, the trained learner was used to train the former learner.  The reward per action and the percentage of correctly set working memories barely exceeded 0.5, whether the action determiner or the register controller was used as the stub first.

The number of episodes required for learning exceeded 10,000.

Discussion

Here, attempts to implement architectures that incorporate multiple learners that learn in a non-end-to-end fashion were reported.

Three implementations of an architecture encompassing multiple learners with BriCA were examined.  Currently a tool that wraps the cumbersome coding with BriCA is being prepared.

The current implementation of the hypothesis of working memory control by attention did not perform adequately.  Since more complex tasks require a larger search space, it would be better to think of a way in which learning occurs over a biologically plausible range of episodes.

The search space should be reduced to improve learning efficiency.  For diachronic multiple-action learning, a (biologically plausible) mechanism that memorizes a series of observations/actions that led to success and uses them as hypotheses to test similar cases should be devised.

A mechanism such as the one attempted here will be incorporated into a whole-brain architecture that follows the connections between regions of the whole brain (connectome), and the above issues must be resolved to guarantee its working.

References

[1] Koichi Takahashi, et al., (2015) A Generic Software Platform for Brain-inspired Cognitive Computing, Procedia Computer Science, Volume 71,
DOI: 10.1016/j.procs.2015.12.185

[2] O'Reilly, R., Frank, M. (2006) “Making working memory work: a computational model of learning in the prefrontal cortex and basal ganglia.” Neural Comput., DOI: 10.1162/089976606775093909

Saturday, February 12, 2022

Report on the Implementation of a Minimal Working Memory Agent

This article reports an attempt to implement working memory, a basic cognitive function essential for AGI, in a minimal form, taking biological plausibility into account.

The implementation is based on the following hypotheses:

  1. The choice of a part of the input to be retained in the working memory is driven by attention, which is an action carried out by the PFC (prefrontal cortex).

  2. The attending action is made by the PFC⇔Th loop controlled by BG (PFC-Th-BG loop) like any other actions.

  3. The attending action is exclusive as in any other action, and only one of them is executed in dlPFC at a time.

  4. Working memory is retained for a certain period of time with the activity of neurons such as bi-stable neurons in the PFC, and WM should be "reselected" by the PFC-Th-BG loop for longer retention.

  5. The PFC uses the information stored in the working memory and sensory information to predict and execute the action to cope with tasks.

The Task

The task used in the implementation is a Match-to-Sample task simplified as much as possible, whose input is a low-dimensional binary vector consisting of the following:

  • Choice of the attribute to be used for comparing the sample to the target (task switch)
    (a one-hot vector whose dimension is the number of attributes)

  • Attribute list (each attribute is represented as a two-dimensional binary vector.)

  • Control vector (sample presentation phase [1, 0], target presentation phase [1, 1], others [0, 0])

The task consists of five phases: sample presentation, pause (delay), target presentation, pause (delay), and reward presentation.  The task switch is given only during the sample presentation phase. In the target presentation phase, if the attributes of the sample and targets specified by the task switch match, the task accepts 2 ([0, 1]), and if they do not match, the task accepts 1 ([1, 0]) as the correct answer, respectively.  If the answer is correct, the task returns reward 1, otherwise reward 0 after a delay.
In executing the task, the following assumptions were made on the agent side:

  • No prior knowledge of the composition of the input vector is given.

  • It does not memorize all the attributes.

How it works

Input Register

Input:
    • observation input
    • attention signal: instructs the attribute (a part of the observation input) to be retained 

Output: whether the retained observation input attribute and the corresponding attribute of a new observation input match (recognition)

Function: When an attention signal is given, the specified portion of the observation input is retained for a certain period of time, where a new observation input comes in, it outputs whether the specified portion of the retained content matches the portion of the input.

Implementation: Simple register + comparator

Neural Correspondence: the short-term memory layer of the PFC

Register Controller

Input: observation input

Output: attention signal

Function: determines the attribute to be retained in the input, and sends an attention signal to the input register (once per episode).

Implementation: 👉 A Minimal Cortex-Basal Ganglia Architecture

Neural Correspondence: (dl) PFC-Th-BG loop

Action Determiner

Input: observation input + recognition signal (from the Register)

Output: action selection

Function: determines the action to be output from the input (once per episode).

Implementation:  👉 A Minimal Cortex-Basal Ganglia Architecture

Neural Correspondence: PFC-Th-BG loop

Learning

Reward-based learning took place in two locations, i.e., the action determiner and the register controller.  Both were implemented with the Minimal Cortex-Basal Ganglia Architecture.

Though it was expected that the two learnings would bootstrap the task successes, it did not work, and it was found that curriculum learning barely worked (see the Results section for details).

Architecture

Fig. 1

Implementation

Frameworks used

  • Cognitive Architecture Description Framework: BriCA BriCA (Brain-inspired Computing Architecture), a computational platform for brain-based software development, was used.
  • Environment description framework: OpenAI Gym OpenAI Gym is a widely used framework for agent learning environments.

Delayed reward learner

A Minimal Cortex-Basal Ganglia Architecture was used.  BriCA is also used in the learner.  It also uses PyTorch to model the cortex.  For delayed reward learning (the basal ganglia part), a frequency-based learning algorithm was used.

Results

Though the above implementation was used to train the task, the performance did not improve even after 400,000 episodes of trials.  So it was given up and curriculum learning was tried instead, where one learner was trained while another learner was replaced with a "stub" that output correctly, and subsequently the training data was used to train the agent without the stub (with the two learners).

When a stub is used for the Register Controller

Fig. 2 Training Action Determiner when a stub is used for Register Controller

Horizontal axis: episodes (x 100; 40,000 episodes learned)

avr. reward: average reward

reward per go: reward per action output


Fig. 3 Training the two learners with the learning data of Action Determiner
learned with a stub for Register Controller

Horizontal axis: episodes (x 100)

avr. reward: average reward

reward per go: reward per action output

go in sample phase: Register Controller output performed in the sample phase

correct wm: correctly set working memory

go in target phase: actions performed in the target phase


The reward per action output and the percentage of correctly set working memories barely exceeded 0.5.  Phase selection was relatively successful.

When a stub is used for Action Determiner
Fig. 4 Training Register Controller when a stub is used for Action Determiner

Horizontal axis: episodes (x 100)

avr. reward: average reward

reward per go: reward per action output

go in sample phase: Register Controller output performed in the sample phase

correct wm: correctly set working memory

go in target phase: actions performed in the target phase

The proportion of correctly set working memories did not approach to 1, because even if the working memory is not set correctly, it can be rewarded by the random selection of the Action Determiner.


Training the two learners with the learning data of Register Controller learned with a stub for Action Determiner

Horizontal axis: episodes (x 100)

avr. reward: average reward

reward per go: reward per action output

go in sample phase: Register Controller output performed in the sample phase

correct wm: correctly set working memory

go in target phase: actions performed in the target phase

The reward per action output and the percentage of correctly set working memories barely exceeded 0.5.  Meanwhile, the percentage of correctly set working memories was on a downward trend over 10,000 episodes.  Phase selection was relatively successful.

Discussions

Existing model

While PBWM is known as a model of working memory, it was not adopted because of the following "unnaturalness" on biological plausibility:

  • While it assumes that the basal ganglia (BG) gate sensory input, they are supposed to gate the cortical output-thalamus loop.
    cf. Benarroch, E. (2008) The midline and intralaminar thalamic nuclei Fig.2

  • While it assumes working memory is retained during NoGo, the default state for the BG, if this is the case, then working memory retention becomes the default state.

Meanwhile, it would be worthwhile to try the 1-2-AX working memory task used in the PBWM paper for comparison.

Learning Performance

The two choices, attentional selection of attributes to be remembered and action selection based on the working memory, could not be learned from scratch in this implementation.  The original expectation was that the correct attentional choice would provide more information for the correct action choice via the working memory, and thus the performance of the action choice would improve, and with it the learning of the correct attentional choice would improve in a "bootstrapping" way.  However, it was not observed.  While it was not proved that this strategy would not work in other implementations, since the search space is larger in more complex tasks, it would be better to consider other strategies that allow learning to take place in a biologically reasonable number of episodes.

Though the curriculum learning "barely" worked this time, the results were not satisfactory.  It took about 10,000 episodes for the stub-based learning to converge, which is also beyond the biologically reasonable range.  This point may be improved by changing parameters in the Minimal Cortex-Basal Ganglia Architecture.

Prospects

In order to improve learning efficiency, the search space should be smaller.  For diachronic learning of multiple actions, it would be worthwhile to devise a (biologically plausible) mechanism that memorizes series of observations/actions that lead to success and examines similar cases while regarding them as hypotheses.


Saturday, December 4, 2021

A Minimal Cortex-Basal Ganglia Architecture

I have implemented a minimal decision learning mechanism inspired by the cortex-basal ganglia-thalamus loop as part of my effort to create brain-inspired cognitive architecture.

It is based on the following hypothesis:

  • The cortex predicts the decision.
  • The basal ganglia (BG) determines the execution of the decision.
In this implementation, the cortex part initially makes random decisions and the BG part judges if a decision is appropriate for execution.  In terms of learning, while the BG part learns Go/NoGo policy, the cortex part learns (to predict) action from the input and decisions actually executed by the BG part's Go.

Reasons for the hypothesis

The hypothesis would be corroborated from the following:

  • As for the cerebral cortex making action choices (predictions):
    • Thalamic matrices that undergo inhibition from the BG may not be "fine grained" enough for choices made by cortical regions such as mini-columns.
    • The GPi of the BG to (de-)inhibit the thalamus may also not be "fine grained" enough for choices made by cortical regions.
  • The BG has been said to control the timing of action initiation.
  • The hypothesis reconciles the role of reinforcement learning in the BG and prediction in the cerebral cortex in action selection.
  • Reinforcement learning in the basal ganglia is necessary to cope with delayed reward.

Specifications

The Cortical part

The cortical part receives "observation input" and outputs action selection.

Output predictor: learns to predict action from the observed inputs and the executed action as supervisory signals.
A two-layer perceptron was used for the implementation.

Output moderator: calculates its output with the output of the predictor and noise input.  As the predictor learns to make correct predictions, the contribution of the noise decreases.  Specifically, the rate of correct task answers was used as the probability of using output prediction.

Output selector: selects the largest output (winner-take-all) from the moderator and gates its output with the Go/NoGo signal from the BG.

Thalamus

The thalamus was not implemented and Go/NoGo signals from the BG were directly passed to the output selector of the cortical part.
In the brain, the thalamus receives inhibitory signals from the BG (NoGo) and when the inhibitory signal from the basal ganglia is lost, the Go signal is sent to the cortex.

The BG part

Reinforcement learning for the Go/NoGo decision was performed with the cortical input and its potential output as states.

Overall architecture


Fig.1

The task for testing

Delayed Reward Task

Task Environment (CBT1Env.py)

Action is accepted while a cue is presented for a certain amount of time.
The cue can be one of the following: [1,1,0], [0,0,1], [0,1,1], [1,0,0].
The observation value out of the presentation period is [0,0,0].
If the relationship between the cue and action satisfies the following conditions, reward 1 will be given after a certain delay.
Cue [1,1,0] or [0,0,1] and action [1,0]
Cue [0,1,1] or [1,0,0] and action [0,1]

Penalty

If action other than [0,0] is made within the presentation period without meeting the reward condition above, a negative reward is given for the "wrong try."

Implementation and Evaluation

Frameworks used

Cognitive Architecture Description Framework: BriCA

BriCA (Brain-inspired Computing Architecture) was used to construct the architecture.  BriCA is a computational platform for brain-based software development (see [1] for its significance).

Environment description framework: OpenAI Gym

OpenAI Gym is a widely used framework for agent learning environments.

Machine learning framework: PyTorch

PyTorch is widely used as a machine learning framework.

Reinforcement Learning Framework: TensorForce

TensorForce is a reinforcement learning framework also widely used.

For learning the basal ganglia, a frequency-based method was also used.

The ideas in "Minimal Cognitive Architecture" (in this blog) was used to combine BriCA, Gym, PyTorch, and TensorForce.

Training the BG part

Reinforcement learner

The BG part has an internal environment, whose observation values are the observation input and output selector states, and reward is from the external environment, and decides whether to let the agent take an action (Go/NoGo).

Debugging to synchronize BriCA with the external environment, internal environment, and reinforcement learner was an onerous task.

Initially, the internal environment used the time steps of the external environment as its time steps.  However, it turned out that learning was not stable because the learner was rewarded for producing different outputs before the agent decided on an action.  So, the architecture has changed so that the agent has only one action choice for an episode, and the internal environment has only one time step for the presentation period (the biological implication of this is to be examined).

Fig. 2 shows the results of the training.  As for RL algorithms, VPG (Vanilla Policy Gradient), A2C (Actor-Critic), and PPO (Proximal Policy Optimization) are used as they are available in TensorForce.

Fig.2
Horizontal axis: The number multiplied by 100 is the number of episodes.
Vertical axis: Average reward for Go
Penalty = -0.7
For VPG and A2C, the average reward approached 1 after 4,000 trials.
In PPO, there was no apparent learning (reason unknown).

When no penalty was given, RL algorithms always chose Go, so learning was not successful.

Supplementary Result at 2023-10

In October 2023, an additional experiment with Deep-Q Network (TensorForce) turned out to work fine.


Fig.2'
Legends are the same as Fig.2
Green line shows the result for DQN.

Frequency-based learner

Mechanism: It calculates the probability of receiving a positive reward for the Go decision with each observed value, and to perform a coin toss (binomial distribution) with the probability to determine Go/NoGo.  The probability distribution of the N coin tosses is a beta distribution (with the parameters a and b), and the average is a/(a+b) = k+1/(k+1 + n-k+1) = k+1/(n+2), where k is the number of heads and n-k is the number of tails.  The frequency-based learner has an advantage in probabilistic interpretability.

Results: The results converged to a/(a+b) = number of co-occurrences of Go and reward ÷ (number of co-occurrences of Go and reward + number of occurrences of Go).  As in the case of reinforcement learning, this value does not become 1 even after learning progresses, leaving room for trial and error (thus resulting errors).  Fig. 3 shows a graph of the results.  The average reward for Go approaches to 1 faster than in reinforcement learning.

Fig.3
Horizontal axis: The number multiplied by 100 is the number of episodes.
Vertical axis: Average reward for Go

Comparison with Reinforcement Learning

The results of learning the task with reinforcement learners are shown in Fig. 4.
As the number of actions per episode was set to one with the results in Fig.3, the experiment was conducted with only one step for the presentation period and no reward delay.
As reinforcement learning algorithms, VPG, A2C, and PPO in TensorForce, were used.

Test program: CBT1EnvRLTest.py


Fig.4
Horizontal axis: The number multiplied by 100 is the number of episodes.
Vertical axis: Average reward
Penalty = -0.7

In Fig. 4, VPG performed better.  However, learning was not generally stable (e.g.,  PPO also worked when the presentation period was set to 3 steps and the reward delay was set to 2 steps).

Training the cortical part

A two-layer perceptron (with PyTorch) was trained with the observation and the executed action choices.  The task performance rate was used as the probability to use cortical output prediction for Go/No judgment in the BG part (if prediction is not used, the output candidates are randomly determined).

Since the learning rate of the perceptron was small compared to that of the reinforcement learner, the input was multiplied with epoch loops by hundred, which resulted in proper learning (Fig. 5).

As a loss function, Binary Cross Entropy (which is considered to be suitable for binary classification tasks) was used.  As the optimization algorithm, Stochastic Gradient Descent (SGD) was used, and its learning coefficient was set to 0.5 (through trial and error).

Fig. 5 plots the change in the loss value with the frequency-based learning for training the BG part.  The loss value decreases in a manner that follows the BG learning.

Fig.5
Horizontal axis: The number multiplied by 100 is the number of episodes
Vertical Axis: The average reward or loss value for Go
Penalty = -0.7
Blue line: Average reward for frequency learning
Red line: Loss for frequency learning

Biological plausibility

The interior mechanisms of the basal ganglia and the thalamus were not implemented, so they cannot not be evaluated.

While the cortical implementation consists of three parts (output predictor, output moderator, and output selector), there is no evidence for their biological plausibility.  Nonetheless, as the cerebral cortex codes output, input-output mapping must take place somewhere inside, and output is related to at least Layer 5.  There are also findings that output is gated by Go/NoGo signals via the basal ganglia and thalamus.  In the implementation of the output moderator, random selection of noise and prediction was used.  It could be a homework for neuroscience to find a functionally similar mechanism in the brain.

If action choices are coded in (mini-) columns, inter-column lateral inhibition (for winner-takes-all) could be found, which I have not found in literature.

The task performance was used as the probability to decide whether to use prediction in the implementation of the cortical part.  This assumption would not be unreasonable, as dopaminergic signals are provided to the biological cortex.

As for the connection between the cortex and the basal ganglia, the implementation passed the input for the cortical part and the output to be selected in the cortical part to the BG part.  The former corresponds to the connection from the cortex to the striatum patch in Figure 1.3 of [2], and the latter corresponds to the connection from the cortex to the striatum matrix in the same figure.

Issues

A question to be asked is whether the mechanism works in more complex tasks.  It will be tested in tasks requiring working memory or with more practical perceptual input, for which an architecture that includes models of particular cortical areas and other brain regions will be required.

It is said that accumulation of evidence takes place in action decisions in the basal ganglia [3][4].  When dealing with uncertain input or multiple types of evidence, the accumulation mechanism should be introduced.

In addition, the Drift-Diffusion model discussed in the literature [5][6], modeling the trade-off between taking action and understanding the situation (making a choice at the expense of accuracy under time pressure), will also need to be implemented.

References

[1] Takahashi, K. et al.: A Generic Software Platform for Brain-Inspired Cognitive Computing, Procedia Computer Science 71:31-37, doi: 10.1016/j.procs.2015.12.185 (2015)

[2] Tomohiko Yoshizawa, A Physiological Study of the Striatum Based on Reinforcement Learning Models of the Basal Ganglia, Doctoral Dissertation, NAIST-IS-DD1461011 (2018)
doi: 10.3951/sobim.25.167 (2001)

[3] Agarwal, A. et al.: Better Safe than Sorry: Evidence Accumulation Allows for Safe Reinforcement Learning. arXiv:1809.09147 [cs.LG] (2018)

[4] Bogacz, R. et al. The Basal Ganglia and Cortex Implement Optimal Decision Making Between Alternative Actions. Neural computation. 19. 442-77.
doi: 0.1162/neco.2007.19.2.442 (2007).

[5] Dunovan, K. et al.: Believer-Skeptic Meets Actor-Critic: Rethinking the Role of Basal Ganglia Pathways during Decision-Making and Reinforcement Learning, doi.org/10.3389/fnins.2016.00106  (2016)

[6] Ratcliff, R. and McKoon, G.: The Diffusion Decision Model: Theory and Data for Two-Choice Decision Tasks. doi: 10.1162/neco.2008.12-06-420 (2008)

        Tuesday, July 27, 2021

        Visual Task and Architectures (2021)

        This article describes an implementation plan for a brain-inspired cognitive architecture to solve visual working memory tasks.

        The Task

        A visual working memory task (the delayed match-to-sample task, in particular) will be used.

        The reasons are as follows:

        • Sensory input is essential for embodied AI.
        • Vision is a sensory modality widely used in AI tasks.
        • Working memory is an essential cognitive function in the performance of complex tasks (as required by AGI).
        • Match-to-sample tasks are used in the 5th WBA hackathon, and resources (a task environment and sample code) are available.

        Visual system

        The human visual system

        The features of the human visual system listed below shall be reproduced as much as possible.

        • Central and peripheral visions
          The center of the visual field (fovea) and the periphery have different resolutions.  It is also known that they have different color and motion perceptions.
        • Active vision
          Since the peripheral vision does not have sufficient resolution, eye movements (saccades) are necessary for collecting information with the central vision.
          Information integration from different points in time-space is regarded as a case of the binding problem.
        • What vs. Where Paths
          The mammalian visual system has the what pathway, which identifies objects, and the where pathway, which codes the location and movement of objects.
          The two pathways originate in the small (parvo-) and large (magno-) cells of the LGN (lateral geniculate nucleus), respectively.
        • Receptive field hierarchy
          The hierarchy of the visual cortex (V1⇒V2...) has a hierarchy of receptive fields.
        • Saliency map
          It is coded in the superior colliculus (SC) to guide the saccades.
        • Binocular vision

        Visual system implementation

        • Central and peripheral visions
          While separate pathways were used in the 4th & 5th WBA hackathons, they can be combined into one with the log-polar coordinate used in the mammalian visual system.
        • Monocular and binocular visions
          As binocular vision is not necessary for the current task, the monocular vision shall be used.
        • The What Path
          The implementation will use logarithmic polar coordinate images as input.
          Edges and blob detection shall be considered in pre-processing.
        • The Where Path
          In the tasks concerned, it will be sufficient to obtain only the gaze position for the where path.
        • Receptive field hierarchy
          The way to implement the receptive field hierarchy with existing machine learners should be studied.
        • Saliency Map
          Time integral and winner-take-all circuits shall be implemented.
          Signal strength and its time derivative shall be used for bottom-up saliency.
          Spatial filters (detection of feature points like corners and blobs) shall also be considered.
          For scanning, the saliency of the most recently visited locations will be suppressed.
        • Active vision
          Saccades move the gaze to the most salient coordinates in the saliency map when a certain saccade condition is met.  Training is required to calibrate the saccade destination.
          Recognition of figures that are too large to fit in the fovea requires image learning with active vision, in which the higher-order visual cortex should require gaze position information.

        Implementation of visual cortices

        The visual processing described here differs from the conventional image processing of deep learners in the following points.

        • Central and peripheral visions
        • Active vision
        • Receptive field hierarchy

        Some of assumed image processing will be dealt with an off-the-shelf image processing library such as OpenCV:

        • Logarithmic polar coordinate conversion
        • Spatial filters (e.g., edge & blob detection)

        The design of the receptive field hierarchy should be done carefully.  It is also necessary to consider whether and how to use convolutional networks (CNNs).

        Back-propagation and supervised learning between layers will not be used, as they are not biologically plausible.  Learning will be carried out with auto-encoders within layers.

        The design choice must be made between a static and dynamic model.  As active vision requires the integration of eye movements and image input sequences, a dynamic model such as RSM will be considered.

        The figure below summarizes the design.

        Fig. 1 Visual System Architecture
        While the eye position information is assumed to be a top-down input
        from MTL in the figure, it might as well be a bottom-up input.

        Training Vision

        STEP1: Training the Saccade Driver (Fig. 1)

        Saccade calibration will be performed with the difference between the fovea position after saccade and the center of saliency as the error.

        STEP2: Training of the visual cortex

        Two possible training methods are auto-encoding with log-polar coordinate images (output of the spatiotemporal filters in Fig. 1) as input and training with the output of the Saccade Driver (Fig. 1) with the difference between the prediction of the t+1 image and the actual image as error.  The latter is optional.

        Working memory

        It is known that the dorsolateral prefrontal cortex (dlPFC) is involved in working memory, but there is no established theory on the mechanism.  Here, the implementation of a proposed model of working memory (2021-07) is considered.

        The basic idea is as follows:

        • The prefrontal cortex has recurrent loops that hold short-term memory.
        • The short-term memory at a cortical region (columnar structure) starts to be retained when the thalamic gate is disinhibited by the basal ganglia (Go).
        • The short-term memory is released after a certain time period unless it is reselected as Go.

        The prefrontal cortex (dlPFC) and the corresponding basal ganglia receive the following information (via MTL)

        • The output from the visual what path
        • Eye position (Positional Coding in Fig. 1)
        • Keyboard selection (action)
        • Reward signals

        Task execution

        The premotor cortex is hypothesized here to perform the task execution (keyboard selection).

        The premotor cortex and the corresponding basal ganglia receive the following information

        • Short-term memory contents (from dlPFC)
        • Keyboard selection (action)
        • Reward signals

        Gaze control

        The FEF (Frontal Eye Field) controls the gaze.

        The FEF and the corresponding basal ganglia receive the following information.

        • Short-term memory contents (from dlPFC)
        • Eye position (Positional Coding in Fig. 1)
        • Reward signals

        Control by FEF is optional.

        Implementation of the cortico-thalamo-BG control

        The basal ganglia is supposed to control the cortico-thalamic loop by inhibiting nuclei in the thalamus.

        An Actor-Critic function from an off-the-shelf RL library will be used to implement the control by the basal ganglia. 

        Whether the lateral inhibitory and triggering circuits for winner-take-all control are located in the cortex or thalamus needs to be investigated.

        The accumulator model will be employed.  Accumulation in the cortico-thalamic loop will be hypothesized to occur while the basal ganglia circuit is Go.

        cf. Agarwal, A. et al.: Better Safe than Sorry: Evidence Accumulation Allows for Safe Reinforcement Learning. arXiv:1809.09147 [cs.LG].

        Learning in the executive cortex

        The executive cortices (prefrontal cortex, premotor cortex, and FEF) should also be learning and make predictions.  It is conceivable that prediction is used for reinforcement learning or that the results of reinforcement learning are used for prediction.  However, as the need of such learning in the current task is not clear, the implementation will be optional.

        Summary: the architecture

        The non-optional architecture of the current plan is shown in Fig. 2.

        Fig. 2 
        SC: superior colliculus, BG: basal ganglia, preMotor: premotor cortex

        It is simpler than the sample architecture for the 5th WBA Hackathon (i.e., LIP: lateral interparietal area, FEF: frontal eye field, and the motor cortex are omitted).  Meanwhile, Spatio-Temporal Filters have been added.  In the neural system, the filtering is supposed to be realized in the optic nerve system between the retina and the primary visual cortex, including the LGN.