Introduction: Your Data Speaks: Story, Questions, and Answers
Get an overview of what we will cover in this chapter.
We'll cover the following
Reading comprehension requires many skills. When we read a text, we notice the keywords and the main events and create mental representations of the content. We can then answer questions using our knowledge of the content and our representations. We also examine each question to avoid traps and making mistakes.
No matter how powerful they have become, transformers cannot answer open questions easily. An open environment means that somebody can ask any question on any topic, and a transformer would answer correctly. That is difficult but possible to some extent with GPT-3, as we will see in this chapter. However, transformers often use general domain training datasets in a closed question-and-answer environment. For example, critical answers in medical care and law interpretation will often require additional NLP functionality.
However, transformers cannot answer any question correctly regardless of whether the training environment is closed with preprocessed question-answer sequences. A transformer model can sometimes make wrong predictions if a sequence contains more than one subject and compound propositions.
Chapter overview
This chapter will focus on methods to build a question generator that finds unambiguous content in a text with the help of other NLP tasks. The question generator will illustrate some of the ideas applied to implement question-answering.
We will begin by showing how difficult it is to ask random questions and expect the transformer to respond well every time. We will help a DistilBERT
model answer questions by introducing Named Entity Recognition (NER) functions that suggest reasonable questions. In addition, we will lay the ground for a question generator for transformers.
We will add an ELECTRA model that was pretrained as a discriminator to our question-answering toolbox. We will continue by adding semantic role labeling (SRL) functions to the blueprint of the text generator. Then, we will provide additional ideas to build a reliable question-answering solution, including using the RoBERTa model.
Finally, we will go straight to the GPT-3 Davinci engine interface online to explore question-answering tasks in an open environment. Again, no development, no training, and no preparation are required!
By the end of the chapter, you will know how to build your own multi-task NLP helpers or use Cloud AI for question-answering.
This chapter covers the following topics:
Get hands-on with 1200+ tech skills courses.