Large Language Models (LLMs) have revolutionized open-domain dialogue agents but encounter challenges in multi-character role-playing (MCRP) scenarios. To address the issue, we present Neeko, an innovative framework designed for efficient multiple characters imitation. Unlike existing methods, Neeko employs a dynamic low-rank adapter (LoRA) strategy, enabling it to adapt seamlessly to diverse characters. Our framework breaks down the role-playing process into agent pre-training, multiple characters playing, and character incremental learning, effectively handling both seen and unseen roles. This dynamic approach, coupled with distinct LoRA blocks for each character, enhances Neeko's adaptability to unique attributes, personalities, and speaking patterns. As a result, Neeko demonstrates superior performance in MCRP over most existing methods, offering more engaging and versatile user interaction experiences.
git clone https://github.com/weiyifan1023/Neeko.git
cd Neeko
python shuffle_data.py \
--data_dir /path/to/your/character-llm-data/ \
--out_path /path/to/your/character-llm-data/prompted/shuffle.jsonl
Here, we take S-Bert as an example.
python embd_roles.py \
--encoder_path /path/to/your/s-bert \
--seed_data_path /path/to/your/seed_data \
--save_path /path/to/save/your/role_embds
We take Llama-2-7b as an example, replace some paths in neeko.sh, and then execute:
bash neeko.sh
If you find our paper inspiring and have utilized it in your work, please cite our paper.
@inproceedings{yu-etal-2024-neeko,
title = "Neeko: Leveraging Dynamic {L}o{RA} for Efficient Multi-Character Role-Playing Agent",
author = "Yu, Xiaoyan and
Luo, Tongxu and
Wei, Yifan and
Lei, Fangyu and
Huang, Yiming and
Peng, Hao and
Zhu, Liehuang",
booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing",
month = nov,
year = "2024",
address = "Miami, Florida, USA",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2024.emnlp-main.697",
pages = "12540--12557",
}
xiaoyan.yu@bit.edu.cn && 2748113810@qq.com (Tongxu Luo) && weiyifan2021@ia.ac.cn (Preferred)