File size: 2,688 Bytes
0dc2d4f
 
 
 
225b0fa
bf2a609
3c3b257
 
0dc2d4f
 
9c11183
 
 
 
 
 
 
 
565b84c
9c11183
 
 
 
 
 
 
 
 
 
 
 
 
 
f59a374
565b84c
444a686
9c11183
444a686
 
 
 
 
 
 
 
9c11183
 
 
f89d9aa
9c11183
 
 
 
 
f89d9aa
9c11183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c3b257
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
language: en
license: cc-by-4.0
widget:
- context: "Yes. No. I'm looking for a cheap flight to Boston."
- text: "Is the user looking to book a flight?"
datasets:
- atis
---

# Question Answering NLU

Question Answering NLU (QANLU) is an approach that maps the NLU task into question answering, 
leveraging pre-trained question-answering models to perform well on few-shot settings. Instead of 
training an intent classifier or a slot tagger, for example, we can ask the model intent- and 
slot-related questions in natural language: 

```
Context : Yes. No. I'm looking for a cheap flight to Boston.

Question: Is the user looking to book a flight?
Answer  : Yes

Question: Is the user asking about departure time?
Answer  : No

Question: What price is the user looking for?
Answer  : cheap

Question: Where is the user flying from?
Answer  : (empty)
```

Note the "Yes. No. " prepended in the context. Those are to allow the model to answer intent-related questions (e.g. "Is the user looking for a restaurant?").

Thus, by asking questions for each intent and slot in natural language, we can effectively construct an NLU hypothesis. For more details, please read the paper: [Language model is all you need: Natural language understanding as question answering](https://assets.amazon.science/33/ea/800419b24a09876601d8ab99bfb9/language-model-is-all-you-need-natural-language-understanding-as-question-answering.pdf).

## Model training

Instructions for how to train and evaluate a QANLU model, as well as the necessary code for ATIS are in the [Amazon Science repository](https://github.com/amazon-research/question-answering-nlu).

## Intended use and limitations

This model has been fine-tuned on ATIS (English) and is intended to demonstrate the power of this approach. For other domains or tasks, it should be further fine-tuned 
on relevant data.

## Use in transformers:

```python
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
  
tokenizer = AutoTokenizer.from_pretrained("AmazonScience/qanlu", use_auth_token=True)

model = AutoModelForQuestionAnswering.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
```

## Citation
If you use this work, please cite:

```
@inproceedings{namazifar2021language,
  title={Language model is all you need: Natural language understanding as question answering},
  author={Namazifar, Mahdi and Papangelis, Alexandros and Tur, Gokhan and Hakkani-T{\"u}r, Dilek},
  booktitle={ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
  pages={7803--7807},
  year={2021},
  organization={IEEE}
}
```

## License

This library is licensed under the CC BY NC License.