True/False or Yes/No Question-answering?

How can I perform a Question-Answering system that returns Yes or No to my questions?

For example, I give the context “Machine Learning is lorem ipsum etc etc”, and I ask a question “Does it talks about Machine Learning?” and returns to me “Yes”. Is it possible to do this? If so, what path I need to follow to perform this? Is there any good model to do this?

This kind of problem is a task in the SuperGLUE benchmark.

Generally, the approach is to fine-tune a BERT-like model with question/context pairs with a SEP token (or equivalent) separating them. Accordingly, labels correspond to yes/no answers.

You can use BERT for sequence classification model to do so.

Do note though, that the objective of the BoolQ dataset is to give a yes/no answer to a question given a text that an answer may inferred from. It’s not expected to figure out whether that text is actually relevant to the question or contains the answer, so the BoolQ formulation may not be directly applicable for your task at hand.

1 Like