• Stars
    star
    186
  • Rank 207,316 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A dialogue bot for information access

KB-InfoBot

This repository contains all the code and data accompanying the paper Towards End-to-End Reinforcement Learning of Dialogue Agents for Information Access.

Prerequisites

See requirements.txt for required packacges. Also download nltk data:

python -m nltk.downloader all

IMPORTANT: Download the data and pretrained models from here, unpack the tar and place it at the root of the repository.

Code Organization

Interact with the pre-trained InfoBot!

$ python interact.py

This will launch the command line tool running the RL-SoftKB infobot trained on the "Medium-KB" split. Instructions on how to interact the system are displayed within the tool itself. You can also specify other agents to test:

$ python interact.py --help
usage: interact.py [-h] [--agent AGENT]

optional arguments:
  -h, --help     show this help message and exit
  --agent AGENT  Agent to run -- (rule-no / rl-no / rule-hard / rl-hard /
                 rule-soft / rl-soft / e2e-soft

Training

To train the RL agents, call train.py with the following options:

$ python train.py --help
usage: train.py [-h] [--agent AGENT_TYPE] [--db DB] [--model_name MODEL_NAME]
                [--N N] [--max_turn MAX_TURN] [--nlg_temp NLG_TEMP]
                [--max_first_turn MAX_FIRST_TURN] [--err_prob ERR_PROB]
                [--dontknow_prob DONTKNOW_PROB] [--sub_prob SUB_PROB]
                [--reload RELOAD]

optional arguments:
  -h, --help            show this help message and exit
  --agent AGENT_TYPE    agent to use (rl-no / rl-hard / rl-soft / e2e-soft)
  --db DB               imdb-(S/M/L/XL) -- This is the KB split to use, e.g.
                        imdb-M
  --model_name MODEL_NAME
                        model name to save
  --N N                 Number of simulations
  --max_turn MAX_TURN   maximum length of each dialog (default=20, 0=no
                        maximum length)
  --nlg_temp NLG_TEMP   Natural Language Generator softmax temperature (to
                        control noise)
  --max_first_turn MAX_FIRST_TURN
                        Maximum number of slots informed by user in first turn
  --err_prob ERR_PROB   the probability of the user simulator corrupting a
                        slot value
  --dontknow_prob DONTKNOW_PROB
                        the probability that user simulator does not know a
                        slot value
  --sub_prob SUB_PROB   the probability that user simulator substitutes a slot
                        value
  --reload RELOAD       Reload previously saved model (0-no, 1-yes)

Example:

python train.py --agent e2e-soft --db imdb-M --model_name e2e_soft_example.m

Testing

To evaluate both RL and Rule agents, call sim.py with the following options:

$ python sim.py --help
usage: sim.py [-h] [--agent AGENT_TYPE] [--N N] [--db DB]
              [--max_turn MAX_TURN] [--err_prob ERR_PROB]
              [--dontknow_prob DONTKNOW_PROB] [--sub_prob SUB_PROB]
              [--nlg_temp NLG_TEMP] [--max_first_turn MAX_FIRST_TURN]
              [--model_name MODEL_NAME]

optional arguments:
  -h, --help            show this help message and exit
  --agent AGENT_TYPE    agent to use (rule-no / rl-no / rule-hard / rl-hard /
                        rule-soft / rl-soft / e2e-soft)
  --N N                 Number of simulations
  --db DB               imdb-(S/M/L/XL) -- This is the KB split to use, e.g.
                        imdb-M
  --max_turn MAX_TURN   maximum length of each dialog (default=20, 0=no
                        maximum length)
  --err_prob ERR_PROB   the probability of the user simulator corrupting a
                        slot value
  --dontknow_prob DONTKNOW_PROB
                        the probability that user simulator does not know a
                        slot value
  --sub_prob SUB_PROB   the probability that user simulator substitutes a slot
                        value
  --nlg_temp NLG_TEMP   Natural Language Generator softmax temperature (to
                        control noise)
  --max_first_turn MAX_FIRST_TURN
                        Maximum number of slots informed by user in first turn
  --model_name MODEL_NAME
                        model name to evaluate (This should be the same as
                        what you gave for training). Pass "pretrained" to use
                        pretrained models.

Run without the --model_name argument to test on pre-trained models. Example:

python sim.py --agent rl-soft --db imdb-M

Hyperparameters

The default hyperparameters for each KB split are in settings/config_<db_name>.py. These include:

  1. RL agent options-
  • nhid: Number of hidden units
  • batch: Batch size
  • ment: Entropy regularization parameter
  • lr: Learning rate for initial supervised learning of policy. RL learning rate is fixed to 0.005.
  • featN: Only for end-to-end RL agent, n for n-gram feature extraction
  • pol_start: Number of supervised learning updates before switching to RL
  • input: Input type to the policy network - full/entropy
  • sl: Only for end-to-end RL agent, Type of supervised learning (bel-only belief tracker, pol-only policy, e2e (default)-both)
  • rl: Only for end-to-end RL agent, Type of reinforcement learning (bel-only belief tracker, pol-only policy, e2e (default)-both)
  1. Rule agent options-
  • tr: Threshold for databse entropy to inform
  • ts: Threshold for slot entropy to request
  • max_req: Maximum requests allowed per slot
  • frac: Ratio to initial slot entropy, below which if the slot entropy falls it is not requested anymore
  • upd: Update count for bayesian belief tracking

Note

Make sure to add THEANO_FLAGS=device=cpu,floatX=float32 before any command if you are running on a CPU.

Contributors

If you use this code please cite the following:

Dhingra, B., Li, L., Li, X., Gao, J., Chen, Y. N., Ahmed, F., & Deng, L. (2017). Towards End-to-end reinforcement learning of dialogue agents for information access. ACL.

@inproceedings{dhingra2017towards,
  title={Towards End-to-end reinforcement learning of dialogue agents for information access},
  author={Dhingra, Bhuwan and Li, Lihong and Li, Xiujun and Gao, Jianfeng and Chen, Yun-Nung and Ahmed, Faisal and Deng, Li},
  booktitle={Proceddings of ACL},
  year={2017}
}

Report bugs and missing info to bdhingraATandrewDOTcmuDOTedu (replace AT, DOT appropriately).

More Repositories

1

Taiwan-LLM

Traditional Mandarin LLMs for Taiwan
Python
1,209
star
2

TC-Bot

User Simulation for Task-Completion Dialogues
OpenEdge ABL
806
star
3

SlotGated-SLU

Slot-Gated Modeling for Joint Slot Filling and Intent Prediction
Python
304
star
4

DDQ

Deep Dyna-Q: Integrating Planning for Task-Completion Dialogue Policy Learning
OpenEdge ABL
150
star
5

DuaLUG

The implementation of the papers on dual learning of natural language understanding and generation. (ACL2019,2020; Findings of EMNLP 2020)
Python
66
star
6

PLM-ICD

PLM-ICD: Automatic ICD Coding with Pretrained Language Models
Python
55
star
7

DialSum

Dialogue Summarization
Python
53
star
8

E2EMathSolver

Implementation of NAACL 2019 paper "Semantically-Aligned Equation Generation for Solving and Reasoning Math Word Problem"
Python
46
star
9

PersonaLLM-Survey

42
star
10

SalesBot

Transitioning from Open-Domain Chit-Chat to Task-Oriented Dialogues
Python
40
star
11

FlowDelta

FlowDelta: Modeling Flow Information Gain in Reasoning for Conversational Machine Comprehension
Python
36
star
12

HNLG

Natural Language Generation by Hierarchical Decoding with Linguistic Patterns (NAACL-HLT 2018), Investigating Linguistic Pattern Ordering in Hierarchical Natural Language Generation (SLT 2018)
Python
33
star
13

TaylorGAN

Python
31
star
14

MUSE

Modularizing Unsupervised Sense Embedding
Python
29
star
15

D3Q

Discriminative Deep Dyna-Q: Robust Planning for Dialogue Policy Learning
OpenEdge ABL
26
star
16

SpokenVec

Learning ASR-Robust Contextualized Embeddings for Spoken Language Understanding
Python
24
star
17

QAInfomax

Python
22
star
18

Time-Decay-SLU

How Time Matters: Learning Time-Decay Attention for Contextual Spoken Language Understanding in Dialogue
Python
20
star
19

Lattice-ELMo

Source code for ACL 2020 paper "Learning Spoken Language Representations with Neural Lattice Language Modeling"
Python
18
star
20

Spk-Dialogue

Speaker Role Contextual Model for Dialogues
Python
14
star
21

PE-Study

Study of Pre-Trained Positional Embeddings
Python
14
star
22

PairDistill

Source code of our paper "PairDistill: Pairwise Relevance Distillation for Dense Retrieval", EMNLP 2024 Main.
Jupyter Notebook
14
star
23

Time-SLU

Dynamic Time-Aware Attention to Speaker Roles and Contexts for Spoken Language Understanding
Python
12
star
24

SalesAgent

SalesBot 2.0
Python
12
star
25

Lattice-Transformer-SLU

Source code for ASRU 2019 paper "Adapting Pretrained Transformer to Lattices for Spoken Language Understanding"
Python
11
star
26

LLM-Eval

Python
11
star
27

GenDef

Probing task; contextual embeddings -> textual definitions (EMNLP19)
Python
11
star
28

SpokenCSE

Contrastive Learning for Improving ASR Robustness in Spoken Language Understanding
Python
9
star
29

FastMTL

Efficient Multi-Task Auxiliary Learning
Python
8
star
30

CONVERSER

CONVERSER: Few-Shot Conversational Dense Retrieval with Synthetic Data Generation, SIGDIAL 2023
Python
8
star
31

ZeroShotRationale

Zero-Shot Rationalization by Multi-Task Transfer Learning from Question Answering
Python
8
star
32

E2EDialog

OpenEdge ABL
8
star
33

CLUSE

Cross-Lingual Unsupervised Sense Embeddings
Python
8
star
34

web-speech-api-demo

Web Speech API demo
JavaScript
8
star
35

SynData-Survey

8
star
36

DialogDQN-Variants

OpenEdge ABL
7
star
37

ICD-Correlation

Source code for our NAACL 2021 paper "Modeling Diagnostic Label Correlation for Automatic ICD Coding".
Python
7
star
38

CQA-Study

Python
7
star
39

LION-Net

LIghtweight ONtology-independent Networks for Schema-Guided Dialogue State Generation
Python
7
star
40

RCT-Gen

Generating RCT Conclusion
Python
5
star
41

TREND

TREND: Trigger-Enhanced Relation Extraction Network for Dialogues
Python
5
star
42

MVAE_Music

Modularized Variational Auto-Encoder
Python
5
star
43

FactAlign

Source code of our EMNLP 2024 paper "FactAlign: Long-form Factuality Alignment of Large Language Models"
Jupyter Notebook
5
star
44

CUDA-DST

Controllable User Dialogue Act Augmentation for Dialogue State Track
Python
4
star
45

EditLLM-Survey

4
star
46

BCWS

Bilingual Contextual Word Similarity (English-Chinese)
4
star
47

GenIR-Survey

4
star
48

UMR

Source code of our paper "Unsupervised Multilingual Dense Retrieval via Generative Pseudo Labeling", Findings of EACL 2024.
Python
4
star
49

LLMEval-Survey

3
star
50

ConvADR-QA

Open-Domain Conversational Question Answering with Historical Answers
Python
3
star
51

InstUPR

Source code of our paper "InstUPR: Instruction-based Unsupervised Passage Reranking with Large Language Models"
Python
3
star
52

TMLU

Taiwanese Mandarin Language Modeling
Python
3
star
53

VisualDialog

Visualizing Dialogues: Enhancing Image Selection through Dialogue Understanding with Large Language Models
Python
3
star
54

ImplicitBot

Zero-Shot Prompting for Implicit Intent Prediction and Recommendation with Commonsense Reasoning
Python
2
star
55

VisualLU

Visually-Enhanced Language Understanding
Python
1
star
56

xSense

Explainable Sense Word Embeddings
Python
1
star
57

UnseenDRE

Zero-Shot Dialogue Relation Extraction by Relating Explainable Triggers and Relation Names
Python
1
star
58

ASMR

Augmenting Life Scenario using Large Generative Models for Robotic Action Reflection
Python
1
star