Two-Armed Bandit Task

Apr 29, 2021


Janet Wallace, program coordinator in the Sabatini and Datta labs at Harvard Medical School, has shared a new Two-Arm Bandit behavioral project, including the task protocol and corresponding build instructions, developed by Michael L. Wallace, Lynne Chantranupong, and Bernardo Sabatini:

The two armed bandit task (2ABT) is an open source behavioral box used to train mice on a task that requires continued updating of action/outcome relationships. Furthermore, the 2ABT permits investigation of a motivated behavior that requires flexible relationships between sensory stimuli and motor action. This includes the design of the behavioral chamber, bill of materials (BOM) for chamber construction, design and BOM for a prefabricated printed circuit board (PCB), and Matlab and Ardunio code for running the box and collecting data all available on GitHub.

In the 2ABT box, water restricted mice are trained to initiate a trial by nose poking into the center of three available nose ports. Mice are alerted that the center port is active by illumination of an LED above the center port. After the mouse pokes the center port, LEDs above each of the side ports are lit and the mouse can choose to go left or right to nose poke one of the side ports. If the animal pokes a side port within an allotted time window, the port will probabilistically deliver a water reward. Reward probabilities are typically set asymmetrically and the mouse will learn to favor the port that delivers a higher probability of rewards. After a random (or predetermined) number of rewarded trials earned by the mouse, the reward probabilities on the two side ports will switch without any signal to the mouse. The mouse will then have change its behavior to gain the maximum number of rewards.

The behavioral box uses an Ardunio Uno to coordinate detection of when a mouse pokes its nose into a port, delivery of rewards by triggering the opening of a valve that delivers water, and lighting the LEDs at appropriate times. A GUI in Matlab is used to set the parameters for the behavioral experiment and record behavioral data. The PCB is designed to easily send behavioral data in real time to additional Digital Acquisition Devices (DAQs) for synchronization of behavioral events with neural recording data. The 2ABT allows scientists to run behavioral experiments and collect data using open source code and low-cost products.


This research tool was created by your colleagues. Please acknowledge the Principal Investigator, cite the article in which the tool was described, and include an RRID in the Materials and Methods of your future publications.  RRID:SCR_021483

GitHub Repository

Get access to necessary files, designs, and code for the 2ABT project from their GitHub repository!

Sabatini Lab Website

Check out other projects from the Sabatini Lab here!

Have questions? Send us an email!