Predicting Program Comprehension with Foundation Models of Human Cognition
This paper demonstrates that Centaur, a foundation model of human cognition trained on general psychological data, outperforms its base Llama 3.1 model in predicting developer behavior during program comprehension, suggesting that cognitive regularities learned from broad psychological experiments can effectively transfer to complex software engineering tasks.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you're trying to guess what a friend will say next in a conversation. You could try to memorize every single conversation they've ever had, or you could try to understand the general rules of how humans think, talk, and react. For decades, researchers trying to predict how software developers understand code have been stuck in the first camp: they've built tiny, specific models for specific tasks, or they've tried to measure code "complexity" like counting the number of commas in a sentence. But these methods are like trying to predict a whole movie by only looking at the color of the actors' shoes—they either don't scale up or they just don't match reality very well.
Enter a new idea from the world of psychology. Instead of building a model for just coding, what if we trained a model on how humans act in all kinds of situations? That's exactly what the researchers in this paper did. They took a super-smart AI called Centaur, which had been trained on data from 160 different psychological experiments (like memory games and decision-making puzzles), and asked a big question: Can this "general human brain simulator" understand how developers read code, even though it never saw a line of code during its training?
The Big Discovery
The answer, the paper suggests, is a resounding "yes." When they tested Centaur against 9 different studies involving real developers reading code, Centaur predicted how humans would respond much better than its "parent" model, Llama 3.1, which hadn't been trained on those psychological experiments. In fact, across all the trials, Centaur's predictions were significantly closer to human behavior. Think of it like this: Llama 3.1 is a brilliant student who knows a lot of facts but hasn't learned how people actually think. Centaur is that same student, but after taking a semester of "Human Behavior 101," it suddenly gets how people react, even in a totally new subject like programming.
What It's NOT
Here is the most important part: The paper explicitly rules out a few things.
- It's not just about guessing the answer. The researchers were worried that Centaur might just be good at guessing common answers (like "Yes" or "No") because it saw those a lot in its training. But they proved this wrong. When they removed the code and the task instructions from the test, Centaur didn't just rely on "response biases." It actually got better at using the code itself and the task descriptions to figure out the answer.
- It's not a magic crystal ball. The paper is careful to say this is a "suggestion" and a "transfer" of patterns, not a final, solved theory of the human mind. They found that for some tricky, confusing code patterns (called "Atoms of Confusion"), Centaur wasn't quite as good as Llama. This suggests that while general human thinking helps, there are still some very specific coding quirks that the model hasn't learned yet.
How They Tested It
To be sure, the researchers played a game of "take away." They fed the models the same code and questions but removed different pieces of information:
- The Code: The actual programming snippets.
- The Instructions: The text explaining what to do.
- The History: What the developer did in previous questions.
They found that Centaur relied less on the history of previous answers (which Llama loved to use) and more on the actual code and instructions. This is a huge clue: it means Centaur learned a deeper way of understanding the task, rather than just following a pattern of "what did I say last time?"
The Numbers
The results were measured using a score called "negative log likelihood," where lower is better. Across all the studies, Centaur achieved an average score of 1.63, while Llama 3.1 scored 1.85. In 7 out of the 9 studies they looked at, Centaur was significantly better. The difference wasn't just a tiny fluke; the statistical "effect size" was 0.17, which the paper notes is a real, measurable improvement.
The Takeaway
This paper doesn't claim to have solved the mystery of how developers think. Instead, it suggests a powerful new path forward. It shows that the way humans understand code isn't a weird, isolated superpower; it's built on the same general cognitive rules that help us play memory games or make decisions in other parts of life. By training AI on general human behavior, we might finally get a tool that can predict how developers will struggle with code, not just by counting lines, but by understanding the human mind behind the keyboard. It's a step toward a future where we can build software tools that are truly "human-aware," grounded in the science of how we actually think.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.