Zing Forum

Reading

llm-psychology: A Research Toolkit for Simulating Cognitive Processes and Memory Mechanisms Using Large Language Models

A Python toolkit designed specifically for neuroscience and psychology researchers, supporting the simulation of cognitive processes—especially memory encoding, retrieval, and consolidation mechanisms—using large language models, and providing features like model training, representation visualization, and RAG compression.

大型语言模型认知科学记忆建模神经科学Python工具包LoRA微调RAG表示可视化GPT-2计算心理学
Published 2026-05-28 18:14Recent activity 2026-05-28 18:18Estimated read 5 min
llm-psychology: A Research Toolkit for Simulating Cognitive Processes and Memory Mechanisms Using Large Language Models
1

Section 01

[Introduction] llm-psychology: A Memory Modeling Toolkit Linking LLMs and Cognitive Science

llm-psychology is a Python toolkit designed specifically for neuroscience and psychology researchers, aiming to simulate cognitive processes—especially memory encoding, retrieval, and consolidation mechanisms—using large language models (LLMs). This toolkit provides features like model training, representation visualization, and RAG compression, bridging cognitive neuroscience and modern deep learning, and opening up new possibilities for cognitive modeling.

2

Section 02

Project Background: Limitations of Traditional Cognitive Models and New Opportunities with LLMs

Computational models used by traditional psychology researchers are often limited by hand-designed rules and limited expressive power. Large language models, with their strong pattern learning capabilities and vast parameter spaces, bring new possibilities to cognitive modeling. The llm-psychology project was born to turn this possibility into an actionable research tool, connecting the fields of cognitive neuroscience and deep learning.

3

Section 03

Core Function Modules: Four Technical Pillars Supporting Cognitive Research

The toolkit includes four core modules:

  1. End-to-end training: Supports training from scratch (e.g., GPT-2) or parameter-efficient fine-tuning via LoRA, allowing fine-tuning of large models like Mistral 7B on a single A100 GPU;
  2. Representation and attention visualization: Provides tools like PCA dimensionality reduction and attention heatmaps to analyze the hierarchical structure of model representations;
  3. RAG demonstration: Implements a hybrid architecture combining parametric and non-parametric memory, simulating the division of labor between human short-term and long-term memory;
  4. xRAG memory compression: Based on cutting-edge embedding models, supports compressed storage and recall of memory, inspiring research on human memory mechanisms.
4

Section 04

Tutorial Examples and Technical Details: Interactive Research Support

The project provides 4 Jupyter Notebook tutorials covering the entire workflow from basic training to xRAG compression, including explanations of cognitive science backgrounds. Technically, it uses a modular architecture with core code distributed in the src/llm_psychology submodule, and test coverage ensures reliability. 92.7% of the code consists of Notebooks, emphasizing interactive exploration; Python code accounts for 7.3%, implementing core algorithms.

5

Section 05

Application Prospects: Driving Innovation in Cognitive Science Research and Practice

This toolkit marks the evolution of cognitive science research methods:

  • Basic research: Can test computational theories of memory encoding, consolidation, and retrieval;
  • Application level: Provides support for cognitive assistive tools, educational technology, and clinical interventions;
  • Associated with the hippocampal-neocortical-RAG project, demonstrating the developers' continuous investment in the field of computational neuroscience.
6

Section 06

Conclusion: A New Paradigm of LLM-Driven Cognitive Modeling

llm-psychology represents an emerging research paradigm: using LLMs as computational models of cognitive processes, it retains the rigor and interpretability of traditional computational psychology while introducing the expressive power and data efficiency of deep learning. It is an open-source project worth attention in the intersection of AI and cognitive science.