Brains and AI Think Alike When Coding—More Than When Writing
Your brain on code looks a lot like an AI's inner workings.
What if the AI that helps you write code thinks the way your brain does? A new study from Vanderbilt University suggests that, at least when programming, human brains and large language models (the tech behind ChatGPT and coding assistants) line up surprisingly well.
Researchers put 23 people in an MRI machine and had them write both computer code and regular sentences. As participants typed, the scientists tracked blood flow in the brain (a proxy for brain activity). Then they compared those brain maps to the internal patterns generated by an AI language model at each keystroke. The result: AI patterns predicted brain activity significantly better during code writing than during prose writing.
The strongest match appeared in the right frontal pole, an area near the front of the brain linked to planning and problem-solving. The researchers also found that the best-matched brain locations for code writing stayed 66% consistent across different layers of the AI model, though they varied a lot from person to person. This suggests the brain-to-AI similarity is tied to structured, rule-based thinking rather than general language use.
Why does this matter? AI coding assistants are already everywhere, but they still make mistakes like inserting security flaws. If we know how human brains represent code, we can design AI tools that align better with how programmers actually think. It also gives educators a new window into how people learn to program—and could eventually lead to personalized teaching methods or brain-inspired AI that writes safer code.
- Brain scans showed AI's internal patterns match brain activity better when writing code than when writing regular sentences.
- The strongest brain-AI match was in the right frontal pole, a region tied to planning and problem-solving.
- Better understanding of how brains process code could lead to smarter, safer AI coding assistants and new ways to teach programming.
Why It Matters
If AI coding tools understand how your brain works, they can become more natural, safer, and easier to use.