Zing Forum

Reading

LLM-Psychology: A Research Toolkit for Simulating Human Cognitive and Memory Processes Using Large Language Models

An open-source toolkit designed specifically for neuroscience and psychology researchers, supporting the simulation of cognitive processes such as memory encoding, retrieval, and consolidation using large language models, along with model training, representation analysis, and visualization functions.

大语言模型认知科学神经科学记忆模拟心理学研究机器学习表征学习注意力机制检索增强生成计算模型
Published 2026-05-28 18:14Recent activity 2026-05-28 18:18Estimated read 9 min
LLM-Psychology: A Research Toolkit for Simulating Human Cognitive and Memory Processes Using Large Language Models
1

Section 01

LLM-Psychology: A Research Toolkit for Simulating Human Cognitive and Memory Processes Using Large Language Models (Introduction)

Core Information

  • Toolkit Name: LLM-Psychology
  • Target Users: Neuroscience and psychology researchers
  • Core Functions: Simulate cognitive processes like memory encoding, retrieval, and consolidation using large language models; provide model training, representation analysis, and visualization functions
  • Open-Source Nature: Open-source toolkit
  • Source: GitHub (Author/Maintainer: ellie-as, Release Date: May 28, 2026, Link: https://github.com/ellie-as/llm-psychology)

Introduction

This toolkit provides a new paradigm for cognitive science research. By using LLMs as computational subjects, it helps researchers verify cognitive theories, explore underlying mechanisms, and address the limitations of traditional human subject experiments.

2

Section 02

Research Background and Motivation

Traditional cognitive psychology research relies on behavioral experiments with human subjects, but it has the following limitations:

  1. High Cost: Significant time and financial costs for recruiting and managing subjects
  2. Long Cycle: Long cycles for experimental design and data collection
  3. Difficult Variable Control: Hard to fully control individual differences of subjects and environmental interference

The emergence of LLM-Psychology provides a new research paradigm—by training and observing the internal mechanisms of LLMs, it helps understand and verify theoretical hypotheses about human memory and cognition, compensating for the shortcomings of traditional methods.

3

Section 03

Core Functional Modules and Methods

1. Model Training and Fine-tuning

  • End-to-end Training: Supports training small models like GPT-2 from scratch using custom psychological stimulus materials, facilitating observation of learning dynamics
  • LoRA Parameter-Efficient Fine-tuning: For large models like Mistral 7B, only a small number of parameters are trained, which can be done with a single A100 GPU, lowering the experimental threshold

2. Representation Extraction and Analysis

  • Hidden State Extraction: Obtain hidden state vectors from each layer of the model to analyze information flow
  • Attention Visualization: Generate heatmaps to observe the model's selective attention mechanism
  • PCA Dimensionality Reduction: Reduce the dimensionality of token representations to reveal semantic structures (e.g., number sequences, spatial relationship encoding)

3. Memory Mechanism Simulation

  • Parametric Memory: Corresponding to human long-term implicit knowledge, stored in model weights, supporting learning of statistical rules (e.g., word order rules)
  • Non-parametric Memory: Corresponding to working/episodic memory, enabling external knowledge retrieval via RAG
  • Memory Compression and Reconstruction: Compress and reconstruct memory using xRAG technology to simulate human memory storage mechanisms
4

Section 04

Tutorials and Examples (Application Evidence)

The toolkit includes 4 Jupyter Notebook tutorials to verify its practicality:

  1. Statistical Learning Example: Based on the experiment by Durrant et al. (2011), train GPT-2 to learn statistical rules of artificial languages and analyze attention patterns
  2. Representation Visualization: Use the spatial reasoning/family tree task from Spens & Burgess (2026) to demonstrate the hierarchical representation structure of the model
  3. Retrieval-Augmented Generation: Combine parametric and non-parametric memory to simulate human cognitive strategies
  4. Memory Compression Experiment: Use the ROCStories dataset and xRAG to compress and reconstruct memory, studying storage efficiency
5

Section 05

Research Significance and Application Prospects

Research Significance

  • New Paradigm: Initiates Computational Cognitive Modeling 2.0, using LLMs as computational subjects
  • Theory Verification: Quickly verify cognitive theories (e.g., "Humans master grammar through statistical learning")
  • Mechanism Exploration: Obtain finer-grained internal data than human experiments to reveal underlying cognitive mechanisms

Application Prospects

  • Interdisciplinary Bridge: Connects AI and cognitive science, promoting cross-field communication
  • Educational Tool: Used in psychology/neuroscience teaching to help students understand abstract theories
  • AI Optimization: Provides insights into cognitive mechanisms for developing more intelligent and human-like AI systems
6

Section 06

Technical Implementation and Usage Threshold

Technical Stack

  • Developed in Python, relying on mainstream libraries like PyTorch, Transformers, and PEFT
  • Easy Installation: Execute pip install . to configure the environment

Usage Threshold

  • Hardware Requirements: Training large models requires at least one A100 GPU; small models/exploratory analysis can run on ordinary GPUs or CPUs
  • User-Friendly: The API is designed to be concise, with encapsulated functions for training, representation extraction, and visualization, reducing the usage difficulty for researchers without a computer science background
7

Section 07

Summary and Outlook

Summary

LLM-Psychology is an important advancement in the interdisciplinary field of AI and cognitive science. By simulating human cognitive processes using LLMs, it provides researchers with an efficient computational tool.

Outlook

  • Future Potential: As LLM capabilities improve, it is expected to build more refined cognitive models and discover previously unnoticed cognitive patterns
  • Suggestions: Psychology/neuroscience researchers should master such tools; AI researchers can optimize systems through cognitive mechanism research

This toolkit opens up new paths for interdisciplinary research, promoting the bidirectional development of cognitive science and AI.