AI Insights: Visualizing a computer program in the human brain

JAN 03, 2023

MIT researchers found that the brain's numerous demand and language systems, which perform diverse cognitive tasks, encode certain code features and uniquely correspond with machine-learned code representations.

Functional magnetic resonance imaging (fMRI), which measures cerebral blood flow, has been utilised for "functional anatomy"—determining which brain regions are active when a person performs a task—for the past two decades. fMRI has been used to examine the brains of people functioning in various tasks, including solving math problems, learning foreign languages, playing chess, improvising on the piano, solving crossword puzzles, and even watching "Curb Your Enthusiasm."

Research contribution

The new paper builds on a 2020 study by many of the same scientists, in which fMRI was used to monitor the brain activity of programmers as they "comprehended" short fragments of code. Looking at a snippet and accurately recognising the result of the computation done by the snippet constitutes comprehension. Fedorenko, a professor of brain and cognitive sciences (BCS) and co-author of the earlier study, adds that the 2020 study demonstrated that code comprehension did not consistently engage the language system, the brain regions responsible for language processing. In contrast, the multiple demand network was highly active and linked to broad reasoning and supports disciplines such as mathematical and logical reasoning. She explains that the latest research, which also employs MRI scans of programmers, "goes deeper" to get more granular data.

Consider a loop, an instruction within a programme that causes the computer to repeat a given operation until the intended result is reached, or a branch. This specific programming instruction causes the computer to transition from one process to another. The scientists could detect whether someone was analysing a code involving a loop or a branch based on brain activity patterns. The researchers could also see if the code was related to words or mathematical symbols and if the reader was reading actual code or a written description of that code.

That answered the first question an investigator would have about whether or not something is encoded. If the answer is affirmative, the following question is where it is encoded. Brain activation levels were equivalent in the language system and the multiple demand network in the above scenarios — loops or branching, words or math, code or a description. However, there was a substantial difference when it came to code features relating to what is known as dynamic analysis.

The team conducted a second series of experiments using machine learning models called neural networks that the researchers trained on computer programmes. In recent years, these approaches have effectively assisted programmers in writing code. The scientists aimed to determine if the brain signals detected in their study when people examined code fragments reflected the activation patterns observed when neural networks examined the identical code fragment. The conclusion they reached was a qualified yes.


Scientists at MIT are undoubtedly interested in the links they've discovered, which provide light on how to separate computer programme components encoded in the brain. However, it is still being determined what these newly acquired insights can tell us about how people execute more complex strategies in the actual world.

This type of operation, such as going to the movies, needs checking showtimes, arranging transportation, purchasing tickets, etc., which cannot be handled by a single piece of code and a single algorithm. Instead, successfully implementing such a strategy would involve "composition" – connecting many samples and algorithms into a logical sequence that leads to something new, like composing a song or even a symphony from individual musical bars. But, unfortunately, creating models of code composition is currently out of our reach, according to O'Reilly, a prominent research scientist at CSAIL.

Nivash Jeevanandam is a senior research writer at INDIAai. He is a senior researcher and seasoned technology journalist who writes about everything from data science to machine learning and artificial intelligence. He looks at trends, problems, ideas, and changes in the industry

Similar articles you can read