This repository contains the code for experiments investigating the emotional dynamics of language model (LLM) agents in economic games. Our experiments are designed to simulate human-like behavior by analyzing the mood transitions of LLM agents in response to economic game scenarios.
Before you can run the experiments, you'll need to ensure your system meets the following requirements:
- Python 3.10
- pip
-
Clone this repository to your local machine:
git clone https://github.com/leiyu0210/FairMindSim.git cd FairMindSim -
Install the required Python packages:
conda create -n llm_psy python=3.10 conda activate llm_psy pip install -r requirements.txt
We'll make our data public later, because it needs to be vetted.
To set up and run the experiments, use the following command:
python examples/agent_trust/all_game_person.py
The workflow of the experiments is as follows:
-
Initialization: An LLM agent is given a psychological scale to simulate the personality of the experimenter.
-
Data Input: The experiment begins by inputting real human experimental data to the agent.
-
Mood Assessment: The agent outputs its mood based on a predefined question table.
-
Decision Making: The agent completes the same mood table before making any decisions.
-
Post-Decision Mood Assessment: The mood table is completed once again after the decision-making process.
-
Analysis: The mood transitions are analyzed to understand how the agent's mood changes throughout the experiment.
-
Output: The mood transition tables are outputted using OpenAI's function calls.
- BERM/: This directory contains the core implementation of the BREM.
berm.py: Core script implementing the BREM methodology.berm_vis.ipynb: Jupyter Notebook for visualizing the results generated by the BREM model.
We welcome contributions to improve the experiments or the analysis methods. If you're interested in contributing, please fork the repository and submit a pull request with your changes.
Our code is based on the Camel Project. Special thanks to the Camel Project team for their foundational work that has significantly contributed to this project.