Giter VIP home page Giter VIP logo

wxl1999 / cfcrs Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 3.0 10.7 MB

[KDD23] Official PyTorch implementation for "Improving Conversational Recommendation Systems via Counterfactual Data Simulation".

License: MIT License

Python 95.54% Shell 4.46%
conversation conversational-ai conversational-bots conversational-recommendation conversational-recommender-system data-augmentation data-augmentation-strategies data-augmentations dialog dialogue dialogue-systems recommendation recommendation-system recommender-system pretrained-language-model pretrained-models pretraining

cfcrs's Introduction

CFCRS

This is the official PyTorch implementation for the paper:

Xiaolei Wang, Kun Zhou, Xinyu Tang, Wayne Xin Zhao, Fan Pan, Zhao Cao, Ji-Rong Wen. Improving Conversational Recommendation Systems via Counterfactual Data Simulation. KDD 2023.

Overview

Conversational recommender systems (CRSs) aim to provide recommendation services via natural language conversations. Although a number of approaches have been proposed for developing capable CRSs, they typically rely on sufficient training data for training. Since it is difficult to annotate recommendation-oriented dialogue datasets, existing CRS approaches often suffer from the issue of insufficient training due to the scarcity of training data.

To address this issue, in this paper, we propose a CounterFactual data simulation approach for CRS, named CFCRS, to alleviate the issue of data scarcity in CRSs. Our approach is developed based on the framework of counterfactual data augmentation, which gradu-ally incorporates the rewriting to the user preference from a real dialogue without interfering with the entire conversation flow. To develop our approach, we characterize user preference and organize the conversation flow by the entities involved in the dialogue, and design a multi-stage recommendation dialogue simulator based on a conversation flow language model. Under the guidance of the learned user preference and dialogue schema, the flow language model can produce reasonable, coherent conversation flows, which can be further realized into complete dialogues. Based on the sim-ulator, we perform the intervention at the representations of the interacted entities of target users, and design an adversarial training method with a curriculum schedule that can gradually optimize the data augmentation strategy.

model

Requirements

  • python == 3.8
  • pytorch == 1.8.1
  • cudatoolkit == 11.1.1
  • transformers == 4.21.3
  • pyg == 2.0.1
  • accelerate == 0.12
  • nltk == 3.6

You can also see requirements.txt.

We only list the version of key packages here.

Quick-Start

We run all experiments and tune hyperparameters on a GPU with 24GB memory, you can adjust per_device_train_batch_size and per_device_eval_batch_size in the script according to your GPU, and then the optimization hyperparameters (e.g., learning_rate) may also need to be tuned.

The number after each command is used to set CUDA_VISIBLE_DEVICES.

You can change save_dir_prefix in the script to set your own saving directory.

Training Recommendation Dialogue Simulator

  • dataset: [redial, inspired]
bash script/simualtor/{dataset}/train_FLM.sh 0
bash script/simualtor/{dataset}/train_schema.sh 0

Training CRS models

  • model: [KBRD, BARCOR, UniCRS]
  • dataset: [redial, inspired]
bash script/{model}/{dataset}/train_pre.sh 0  # only for UniCRS
bash script/{model}/{dataset}/train_rec.sh 0
bash script/{model}/{dataset}/train_cf.sh 0
bash script/{model}/{dataset}/train_conv.sh 0

Contact

If you have any questions for our paper or codes, please send an email to [email protected].

cfcrs's People

Contributors

wxl1999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.