Forming memories, generating predictions based on memories, and updating memories when predictions no longer match actual experience are fundamental brain functions. Dopaminergic neurons provide a so-called “teaching signal” that drives the formation and updates of associative memories across the animal kingdom. Many theoretical models propose how neural circuits could compute the teaching signals, but the actual implementation of this computation in real nervous systems is unknown. This project will discover the basic principles by which neural circuits compute the teaching signals that drive memory formation and updates using a tractable insect model system, the Drosophila larva. We will generate the following essential datasets for a distributed, multilayered, recurrent learning circuit, the mushroom body (MB)-related circuitry in the larval brain. First (Aim 1): provide a structural and functional connectivity map of the learning circuit, including all feedforward and feedback pathways upstream of all dopaminergic neurons. Second (Aim 2): discover the features encoded by the neurons in the circuit (e.g. predictions, actual reinforcement, and prediction errors) by recording their activity before, during and after memory formation. Third (Aim 3), we will develop a model of the circuit constrained by these datasets and test the predictions about the necessity and sufficiency of uniquely identified circuit elements for implementing learning algorithms by selectively manipulating their activity. Understanding the basic functional principles of an entire multilayered recurrent learning circuit in an animal has the potential to revolutionize, not only neuroscience and medicine, but also machine-learning and robotics.