iwangjian / Color4Dial

Code and data for "Dialogue Planning via Brownian Bridge Stochastic Process for Goal-directed Proactive Dialogue" (ACL Findings 2023).
MIT License
21 stars 2 forks source link
dialogue-planning dialogue-systems goal-directed planning target-oriented

Color4Dial

This repository contains code and data for the paper Dialogue Planning via Brownian Bridge Stochastic Process for Goal-directed Proactive Dialogue accepted by ACL Findings 2023.

Overview

Goal-directed dialogue systems aim to proactively reach a pre-determined target through multi-turn conversations. The key to achieving this task lies in planning dialogue paths that smoothly and coherently direct conversations towards the target. In this work, we propose a coherent dialogue planning approach via Brownian bridge (COLOR) stochastic process, to model the temporal dynamics of dialogue paths. We define a latent space that captures the coherence of goal-directed behavior using a Brownian bridge process, which allows us to incorporate user feedback flexibly in dialogue planning. Based on the derived latent trajectories, we generate dialogue paths explicitly using pre-trained language models. We finally employ these paths as natural language prompts to guide dialogue generation.

Requirements

The required packages are listed in requirements.txt. Suppose you use Anaconda to manage the Python dependencies, you can install them by running:

conda create -n color4dial python=3.10
conda activate color4dial
pip install -r requirements.txt

Datasets

We upload the datasets used in our experiments to the OneDrive cloud. Please download DuRecDial 2.0 and TGConv datasets and put them in the data folder.

cd data
unzip DuRecDial2.zip & rm DuRecDial2.zip
unzip TGConv.zip & rm TGConv.zip

Quickstart

Take the DuRecDial 2.0 dataset as an example, our experiments are divided into three stages.

Stage 1: Brownian Bridge Mapping

In this stage, we learn a mapping in the Brownian bridge latent space that captures coherent temporal dynamics for planning dialogue paths.

bash scripts/durecdial_planning_train_bridge.sh

For more details of parameter settings, please refer to main_planning.py.

Stage 2: Planning Dialogue Paths

Based on the learned Brownian bridge mapping, we train a planner model and use it to plan dialogue paths.

# model training
bash scripts/durecdial_planning_train_planner.sh

# model inference
bash scripts/durecdial_planning_infer_planner.sh

For more details of parameter settings, please refer to main_planning.py.

Stage 3: Generating Dialogue Utterances

Finally, we employ the planned dialogue paths as natural language prompts to guide dialogue generation.

# model training
bash scripts/durecdial_dialog_train.sh

# model inference
bash scripts/durecdial_dialog_test.sh

For more details of parameter settings, please refer to main_dialog.py.

Evaluation

To evaluate the performance dialogue planning, please run:

python eval/eval_planning.py --dataset <dataset_name> \
  --eval_file <path_to_eval> \
  --gold_file <path_to_gold_data>

To evaluate the performance of dialogue generation, please run:

# for DuRecDial 2.0 dataset
python eval/eval_dialog_durecdial.py --eval_file <path_to_eval> \
  --gold_file <path_to_gold_data>

# for TGConv dataset
python eval/eval_dialog_tgconv_selfplay.py --eval_file <path_to_eval>

Acknowledgement

Our code is based on parts of the implementations of Huggingface Transformers and Language Modeling via Stochastic Processes. We thank the authors for their excellent work.

Citation

If you use our data or code in your work, please kindly cite our work as:

@inproceedings{wang-etal-2023-dialogue,
    title = "Dialogue Planning via Brownian Bridge Stochastic Process for Goal-directed Proactive Dialogue",
    author = "Wang, Jian  and
      Lin, Dongding  and
      Li, Wenjie",
    booktitle = "Findings of the Association for Computational Linguistics: ACL 2023",
    month = jul,
    year = "2023",
    address = "Toronto, Canada",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2023.findings-acl.25",
    pages = "370--387"
}