Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.1%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: nicoceron
  • Language: Python
  • Default Branch: main
  • Size: 406 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 12 months ago · Last pushed 10 months ago
Metadata Files
Readme Citation

README.md

BIG5Chat

BIG5Chat is a framework designed to generate personality-steered conversational agents based on the Big Five personality traits. The project aims to facilitate psychological studies by allowing AI agents to interact with each other while exhibiting different personality characteristics.

Getting Started

Prerequisites

  • Python 3.8+
  • Ollama installed and running with Gemma models
  • Required Python packages (install via pip install -r requirements.txt)

Installation

  1. Clone this repository:

bash git clone https://github.com/yourusername/big5.git cd big5

  1. Install dependencies:

bash pip install -r requirements.txt

  1. Make sure Ollama is installed and running:

```bash # Check if Ollama is installed ollama --version

# Start the Ollama service if not already running ollama serve ```

  1. Verify available models:

bash ollama list

You should see models like gemma3-openness, gemma3-conscientiousness, etc.

Using BIG5Chat

Testing Personality Traits

Use the scripts/evaluation/run_personality_test.py script to test different personality traits:

```bash

Test with openness trait

python scripts/evaluation/runpersonalitytest.py --trait o

Test with conscientiousness trait

python scripts/evaluation/runpersonalitytest.py --trait c

Test with extraversion trait

python scripts/evaluation/runpersonalitytest.py --trait e

Test with agreeableness trait

python scripts/evaluation/runpersonalitytest.py --trait a

Test with neuroticism trait

python scripts/evaluation/runpersonalitytest.py --trait n

You can also provide a custom prompt

python scripts/evaluation/runpersonalitytest.py --trait o --prompt "How would you approach solving a difficult problem?" ```

Training the RoBERTa Classifier

To train the personality classifier:

```bash

Create sample dataset

python scripts/datapreparation/createdatasets.py sample

Train the classifier

python scripts/training/train.py train-classifier \ --train-dataset data/sampledataset/train \ --val-dataset data/sampledataset/val \ --test-dataset data/sample_dataset/test ```

Running the Full Pipeline

To run the complete pipeline:

bash ./run_all.sh

This will:

  1. Create sample datasets
  2. Train the classifier (if not disabled)
  3. Test the DExpert model using local Ollama models

Project Structure

big5/ ├── data/ # Data files and datasets │ ├── sample_dataset/ # Sample training data │ ├── sft_alpaca/ # SFT data in alpaca format │ ├── soda/ # SODA dialogue dataset │ └── synthetic_psychgenerator/ # Synthetic personality data ├── llm_personality/ # Core personality framework │ ├── classifier/ # RoBERTa-based classifier │ ├── dexpert/ # DExpert model for steering outputs │ └── profile_creation/ # Tools for creating profiles ├── modelfiles/ # Ollama model definitions ├── scripts/ # Organized scripts │ ├── data_preparation/ # Data preparation scripts │ ├── evaluation/ # Evaluation scripts │ ├── training/ # Training scripts │ └── utils/ # Utility scripts ├── external/ # External dependencies ├── eval_results/ # Evaluation result files ├── logs/ # Log files ├── requirements.txt # Python dependencies └── run_all.sh # Main script to run the pipeline

Personality Traits

The Big Five personality traits used in this project are:

  • Openness: Tendency to be open to new experiences, ideas, and creativity
  • Conscientiousness: Tendency to be organized, disciplined, and achievement-oriented
  • Extraversion: Tendency to be outgoing, energetic, and social
  • Agreeableness: Tendency to be cooperative, compassionate, and trusting
  • Neuroticism: Tendency to experience negative emotions and stress

Local Models

This project uses Ollama to run local Gemma3 models tuned for different personality traits:

  • gemma3-openness: Tuned for responses exhibiting high openness
  • gemma3-conscientiousness: Tuned for responses exhibiting high conscientiousness
  • gemma3-extraversion: Tuned for responses exhibiting high extraversion
  • gemma3-agreeableness: Tuned for responses exhibiting high agreeableness
  • gemma3-neuroticism: Tuned for responses exhibiting high neuroticism
  • gemma3:12b: Base model for comparison

Technologies Used

BIG5Chat leverages a stack of modern machine learning and natural language processing technologies:

  • LLMs: Llama3 and Gemma3 models for personality-steered text generation
  • Hugging Face Transformers: Provides access to RoBERTa-large for classifier training and inference
  • PyTorch: Deep learning framework used for model training and inference
  • PEFT: Parameter-Efficient Fine-Tuning for adapting LLMs to personality traits
  • Ollama: Local LLM deployment framework for running personality-tuned models
  • TRL (Transformer Reinforcement Learning): Framework for fine-tuning language models
  • Datasets: Hugging Face's library for working with and processing datasets
  • BitsAndBytes: Quantization library for efficient model inference
  • Accelerate: Library for distributed training
  • Weights & Biases: Used for experiment tracking and visualization
  • scikit-learn: For evaluation metrics and data processing
  • DExpert: Personality steering technique based on model mixtures

The framework is optimized for both CUDA (NVIDIA GPUs) and MPS (Apple Silicon) accelerators, allowing efficient training and inference across different hardware platforms.

Troubleshooting

  • If you encounter errors about missing models, make sure Ollama is running (ollama serve) and you have the required models installed.
  • If you have issues with multiprocessing, try setting environment variable PYTHONPATH=. before running scripts.
  • For MacOS users with Apple Silicon, the code is optimized to use the MPS backend instead of CUDA.

License

MIT License

Owner

  • Name: ceron
  • Login: nicoceron
  • Kind: user

Citation (CITATION.cff)

```yaml
cff-version: 1.2.0
message: "If you use this work in your research, please cite it as follows."
authors:
  - family-names: Li
    given-names: Wenkai
  - family-names: Liu
    given-names: Jiarui
  - family-names: Liu
    given-names: Andy
  - family-names: Zhou
    given-names: Xuhui
  - family-names: Diab
    given-names: Mona
  - family-names: Sap
    given-names: Maarten
title: "BIG5-CHAT: Shaping LLM Personalities Through Training on Human-Grounded Data"
version: "2024"
doi: "10.48550/arXiv.2410.16491"
url: "https://arxiv.org/abs/2410.16491"
date-released: "2024-10-21"

GitHub Events

Total
  • Watch event: 1
  • Delete event: 1
  • Push event: 3
  • Public event: 1
  • Pull request event: 1
  • Create event: 1
Last Year
  • Watch event: 1
  • Delete event: 1
  • Push event: 3
  • Public event: 1
  • Pull request event: 1
  • Create event: 1