Generating Computational Cognitive models using Large Language Models

Milena Rmus, Akshay Kumar Jagadish, Marvin Mathony, Tobias Ludwig, Eric Schulz

Introduction

Researchers have developed GeCCo (Guided generation of Computational Cognitive Models), a novel pipeline that leverages Large Language Models (LLMs) to automatically write Python code explaining human behavior. In rigorous tests across four classic cognitive domains, these AI-generated models didn't just match the "gold standard" models hand-crafted by scientists over decades—they frequently outperformed them.

The Bottleneck in Cognitive Modeling

In cognitive science, researchers strive to understand the mind by building mathematical models that predict how people make decisions, learn, or remember. Traditionally, this is a painstaking, manual process. A scientist must analyze behavioral data, conceptualize a theory, write the corresponding code, fit the parameters, and repeat the cycle.

This "hand-crafting" approach suffers from two major flaws:

  1. Efficiency: It requires months or years of domain expertise and coding effort.
  2. Bias: Researchers often default to established theories they are comfortable with, potentially ignoring better, more parsimonious explanations that lie outside their specific sub-field.

The authors ask a compelling question: Can we use the coding and reasoning abilities of LLMs to automate this "scientist-in-the-loop" process, exploring a wider space of possible theories more quickly and objectively?

The GeCCo Pipeline

To address these challenges, the authors introduce GeCCo, a structured pipeline that treats the LLM as an automated hypothesis generator.

The GeCCo Pipeline

The process follows a systematic loop:

  1. Prompting: The LLM (e.g., Llama 3.1, Qwen 2.5, or DeepSeek-R1) is provided with a natural language description of a task, a snippet of actual human behavioral data, and a basic Python code template.
  2. Generation: The LLM proposes three unique cognitive models as executable Python functions.
  3. Fitting & Evaluation: These models are fitted to a "validation" set of human data using traditional optimization tools (like SciPy). Performance is measured using the Bayesian Information Criterion (BIC), a metric that rewards predictive accuracy but penalizes unnecessary mathematical complexity.
  4. Iterative Refinement: The LLM receives feedback on how its models performed (including BIC scores and parameter values) and is prompted to improve them over 10 iterations.
  5. Final Test: The best-performing model is evaluated on a completely "held-out" test set to ensure it generalizes to new, unseen data.

Experimental Evaluation

The pipeline was benchmarked across four distinct cognitive paradigms using human behavioral data:

  • Decision Making: A multi-attribute choice task where people choose between products based on expert ratings.
  • Learning: A "two-armed bandit" task where participants learn which actions lead to rewards.
  • Planning: A two-stage task designed to distinguish between "habitual" and "goal-directed" behavior.
  • Memory: A task examining how working memory limits affect reinforcement learning.

To verify that GeCCo could successfully recover ground-truth logic, the authors also utilized synthetic datasets (simulated data where the "true" underlying model is known).

Key Findings

Outperforming the Experts

Across the board, LLM-generated models rivaled or surpassed established literature. In the Decision Making task, the LLM-generated model achieved a BIC of ~39.4, significantly beating the best literature model (pWADD), which scored ~52.0.

Decision Making Task Results and Generated Code

Capturing Human Nuance

In the Learning task, the LLM model was vastly more likely to be the "correct" explanation for the data, achieving an Exceedance Probability (EP) of 0.97 compared to the standard literature model's EP of 0.03. Furthermore, when compared to massive foundation models specifically trained on cognitive data (like CENTAUR), GeCCo’s tiny, readable Python functions captured nearly as much—and sometimes more—explainable variance.

Interpretable AI and Novel Theories

Unlike "black-box" neural networks, GeCCo produces readable Python code. This allows scientists to inspect the actual "theory" the AI synthesized. For instance, in the planning task, the LLM-generated model didn't strictly separate "model-based" and "model-free" systems as traditional textbooks do. Instead, it found a more parsimonious way to integrate transition learning, aligning with cutting-edge debates in neuroscience.

Crucially, ablation studies revealed that iterative feedback was the most critical component of this success. Without knowing how its previous guesses performed, the LLM’s ability to find a winning model dropped significantly. The authors also confirmed via LogProber that the LLMs were genuinely synthesizing these models in-context, rather than just regurgitating memorized models from their training data.

Limitations and Future Work

While GeCCo represents a major leap forward, the authors note several limitations:

  • Dimensionality: The current approach was tested on relatively simple tasks. It remains to be seen if GeCCo can handle high-dimensional inputs like raw video or complex natural language instructions.
  • Template Bias: Although LLMs can generate their own templates, the initial structure provided by humans likely steers the LLM toward certain "types" of models.
  • Human Oversight: GeCCo automates the generation of models, but a human scientist is still required to verify if the resulting mathematical code makes biological or psychological sense.

Future directions may include expanding the pipeline to feature "multi-agent" feedback, where one LLM critiques the code of another based on theoretical plausibility, further automating the scientific method.

Summary updated

BibTeX
@inproceedings{rmus2025generating,
  author = {Milena Rmus and Akshay Kumar Jagadish and Marvin Mathony and Tobias Ludwig and Eric Schulz},
  title = {{Generating Computational Cognitive models using Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=QKICx7eSMJ},
}
Figure