The 1-2-AX working memory task is a task which requires working memory to be solved, it can be used as a test case for learning algorithms to test their ability to remember some old data. This task can be used to demonstrate the working memory abilities of algorithms like PBWM or Long short-term memory.[1]

It is an extension of the A-X version of the continuous performance task.

## Description

The input of the task is a sequence of the numbers/letters 1, 2, A, X, B, Y. And additional C and Z which should be ignored.

The output is a sequence of the letters L and R — one letter for each input letter (except for C or Z).

The output R should be returned if and only if there is a matching of any trailing part of the input sequence to the regular expression "1[AXBYCZ]*A[CZ]*X" or "2[AXBYCZ]*B[CZ]*Y".

Otherwise (except for C or Z), an L should be returned.

In other words, C and Z are completely ignored, the sequence A-X or B-Y is accepted (with an R) depending if the most recent number was a 1 or a 2. Otherwise, an L is returned.

### Examples

• "21AAXBYAX" → "LLLLRLLLR"
• "12CBZY" → "LLLR"

## Requirements

To solve this task, an algorithm must be able to both remember the last number 1 or 2 and the last letter A or B independently. We refer to this memory as the working memory, this memory must persist all other input.

In addition, the algorithm must be able to strip out and ignore the letters C and Z.

## Solutions

### Pseudo code

For traditional computer models, both requirements are easy to solve. Here is some Python code (kind of pseudo code but works) where the function nextOutput gets one single number/letter as input and returns either a letter or nothing. nextOutputs is there for convenience to operate on a whole sequence.

lastNum = ""
lastLetter = ""

def nextOutput(nextInput):
global lastNum, lastLetter
if nextInput in ["1","2"]:
lastNum = nextInput
lastLetter = ""
return "L"
elif nextInput in ["A","B"]:
lastLetter = nextInput
return "L"
elif nextInput in ["X","Y"]:
seq = lastNum + lastLetter + nextInput
lastLetter = nextInput
if seq in ["1AX","2BY"]: return "R"
return "L"
return None

def nextOutputs(nextInputs):
return [ nextOutput(c) for c in nextInputs ]

### Finite state machine

Similarly, this task can be solved in a straightforward way by a finite state machine with 7 states (call them ---, 1--, 2--, 1A-, 2B-, 1AX, 2BY).

### Neural network

This task is much more difficult for neural networks, for simple feedforward neural networks, this task is not solveable because feedforward networks don't have any working memory.

After all, including working memory into neural networks is a difficult task. There have been several approaches like PBWM or Long short-term memory which have working memory, this 1-2-AX task is good task for these models and both are able to solve the task.

## References

1. ^ O'Reilly, R.C. & Frank, M.J (2006). "Making Working Memory Work: A Computational Model of Learning in the Frontal Cortex and Basal Ganglia. Neural". Neural Computation. 18: 283–328. doi:10.1162/089976606775093909. PMID 16378516. Retrieved 2010-05-30.