An NLP research project investigating whether monetary priming affects decision-making in Large Language Models (LLMs).
This project explores whether exposure to money-related concepts influences LLM behavior in strategic decision-making scenarios, specifically testing if LLMs become more selfish or cooperative when primed with different framings of money.
money_games/
├── NLP_group_20_Project_Runner.ipynb # Reference notebook (end-to-end example)
├── requirements.txt # Project dependencies
└── src/
├── experiment/
│ ├── main.py # CLI entry point to run experiments
│ └── runner.py # Experiment orchestration logic
├── models/
│ ├── config.py # Model constants
│ ├── model_manager.py # Model loading and management
│ ├── open_source_model.py # Open source model wrapper
│ └── gemini.py # Gemini API wrapper
├── prompts/
│ ├── prompt_builder.py # Prompt construction utilities
│ └── configs/ # Constants for the prompts
│ ├── money.py
│ └── games.py
└── analysis/
└── token_probs.py # Token probability analysis tools
It's recommended to use a virtual environment.
Windows (PowerShell):
python -m venv venv
./venv/Scripts/Activate.ps1
pip install -r requirements.txtmacOS/Linux (bash/zsh):
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtRun using module execution with the venv's Python:
- Run both open-source and Gemini experiments (saves results to
results/experiment_results.csv):
python -m src.experiment.main --hf-token YOUR_HF_TOKEN --gemini-key YOUR_GEMINI_KEY- Run only open-source models:
python -m src.experiment.main --experiment open_source --hf-token YOUR_HF_TOKEN --output open_source_results.csv- Run only Gemini:
python -m src.experiment.main --experiment gemini --gemini-key YOUR_GEMINI_KEY --output gemini_results.csv- Dry run (print plan without executing):
python -m src.experiment.main --experiment both --hf-token YOUR_HF_TOKEN --gemini-key YOUR_GEMINI_KEY --dry-runpython -m src.experiment.main --experiment open_source --hf-token YOUR_HF_TOKEN --gemini-key aa --output open_source_results.csv--experiment|-e:open_source|gemini|both(default:both)--hf-token|-t: HuggingFace token (required foropen_sourceorboth)--gemini-key|-g: Gemini API key (required forgeminiorboth)--output|-o: Output CSV filename (default:experiment_results.csv)--output-dir: Output directory (default:results)--models: Optional list to override models (uses defaults insrc/models/config.pyif omitted)--clear-results: Clear in-memory results before running--dry-run: Show configuration without executing--verbose|-v: Verbose error output
Environment variables are set automatically for the run, but you can also pre-set them:
HUGGINGFACE_TOKENGEMINI_API_KEY
- A tabular summary of results:
model,prefix_type,paraphrase_index,response - Counts per model/prefix and overall totals
- Decision token probability analysis for open-source models (if available)
- Response pattern analysis (samples by prefix and by model)
- Results saved as CSV to
--output-dir/--output
You can still follow the full end-to-end example in NLP_group_20_Project_Runner.ipynb. The CLI mirrors the same flow (setup → run → summarize → analyze → save) and is better suited for automation.