Home

Awesome

Learn to play symbolic games with LLM guidances

This repository is implemented based the repo for the paper "Large Language Models Are Neurosymbolic Reasoners" (AAAI 2024).

Before using the repo

1. Install Dependencies:

conda create --name t5-neurosymbolic python=3.9
conda activate t5-neurosymbolic
pip install -r requirements.txt

2. Download Spacy model:

python -m spacy download en_core_web_sm

3. Configure your OpenAI API key Best Practices for api key

Play game with LLM

Now only arithmetic game under the zero-shot setting is implemented.

python play_game_by_LLM.py --agent LLM --game_name ${GameName} --num_variations 100 --max_steps 20 --train_or_eval eval --set ${SetName} --useSymbolicModules ${EnabledModules}
# quickly start: evaluate LLM on dev set of arithmetic game and enable the calc symbolic module
python play_game_by_LLM.py --agent LLM --game_name arithmetic --num_variations 100 --max_steps 20 --train_or_eval eval --set dev --useSymbolicModules calc

Citing

If this AAAI 2024 paper is helpful in your work, please cite the following:

@inproceedings{zhong2023rspt,
  title={Large language models are neurosymbolic reasoners},
  author={Fang, Meng and Deng, Shilong and Zhang, Yudi and Shi, Zijing and Chen, Ling and Pechenizkiy, Mykola and Wang, Jun},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  year={2024}
}