The official codes for the paper: Yahui Fu, Chenhui Chu, Tatsuya Kawahara. "StyEmp: Stylizing Empathetic Response Generation via Multi-Grained Prefix Encoder and Personality Reinforcement." SIGDIAL 2024.
Recent approaches for empathetic response generation mainly focus on emotional resonance and user understanding, without considering the system’s personality. Consistent personality is evident in real human expression and is important for creating trustworthy systems. To address this problem, we propose StyEmp, which aims to stylize the empathetic response generation with a consistent personality. Specifically, it incorporates a multi-grained prefix mechanism designed to capture the intricate relationship between a system’s personality and its empathetic expressions. Furthermore, we introduce a personality reinforcement module that leverages contrastive learning to calibrate the generation model, ensuring that responses are both empathetic and reflective of a distinct personality. Automatic and human evaluations on the EMPATHETICDIALOGUES benchmark show that StyEmp outperforms competitive baselines in terms of both empathy and personality expressions.
mamba env create -f env.yml -n styemp
conda activate styemp
python signals_predictor/train_personality.py
python signals_predictor/rain_empathy_intent.py
The best checkpoints for predictors can be downloaded from here, which will be further used as the custom evaluation metrics, please put them into the folder src/custom_eval/pretrained_signals.
python src/train_generator.py
The best checkpoints can be downloaded from here.
python src/inference.py
To use the Multi-grained Prefix Encoder with DialoGPT for response generation only, set the calibration
argument to False
.
Setting calibration
to True
will generate multiple candidate responses, as demonstrated in the Personality Reinforcement module, which is needed for the following training.
Please download the bleurt for the evaluation from here.
python src/train_generator_calibration.py
The best checkpoint can be downloaded from here.
python src/inference_calibration.py
If you find this repository or paper useful, please kindly cite our paper:
@inproceedings{fu2024styemp,
title={StyEmp: Stylizing Empathetic Response Generation via Multi-Grained Prefix Encoder and Personality Reinforcement},
author={Fu, Yahui and Chu, Chenhui and Kawahara, Tatsuya},
booktitle={Proceedings of the 25th Annual Meeting of the Special Interest Group on Discourse and Dialogue},
pages={172--185},
year={2024}
}
For any questions related to the paper or this repository, feel free to contact Yahui Fu at [email protected].