Deep Learning 101: Lesson 26: Question Answering Systems in NLP

Muneeb S. Ahmad
6 min readSep 3, 2024

--

This article is part of the “Deep Learning 101” series. Explore the full series for more insights and in-depth learning here.

Question answering systems represent a more complex and interactive application of NLP. These systems are designed to understand questions posed in natural language and provide accurate, contextually relevant answers.

The process involves several steps, starting with parsing the question to understand its structure and intent. The system breaks down the question into key components-often identifying the subject, object, and other critical elements of the query.

Once the question is analyzed, the system searches its knowledge base or the Web for information relevant to the question. This search process is not just about finding keywords, but understanding the context and nuance of the question. For example, if someone asks, “What is the tallest building in the world?” the system must recognize that the answer should be the name of a building and its height.

The final step is to generate an answer. In some cases, this may be as simple as retrieving a piece of information, as in the example above. In more complex scenarios, the system may need to synthesize information from multiple sources or perform calculations.

Question answering systems are becoming increasingly sophisticated, often using advanced AI models such as deep learning to improve understanding and response accuracy. They are widely used in virtual assistants, customer service chatbots, and information retrieval systems, making information access more efficient and user-friendly.

Question and Answer example

Below is an example of how the pre-trained Question and Answer model deftly navigates through the intricate details of Nikola Tesla’s life as presented in the context provided. Leveraging its advanced NLP capabilities, the model accurately pinpoints and prioritizes answers to questions about Tesla’s birthplace, famous achievements, and educational background. This demonstrates not only the model’s ability to sift through and analyze large amounts of textual information, but also its ability to identify and present the most relevant facts in response to specific questions, exemplifying the latest advances in the field of NLP-based question answering systems.

The above description of the Question and Answer model gives an overview of its purpose and design. This model, categorized under NLP Question Answering, is tailored to provide answers based on a given text passage. Using the MobileBERT language model fine-tuned on the SQuAD 2.0 dataset, it demonstrates a remarkable ability to understand and extract specific information from a predefined context. The model, accessible from its home page, is a prime example of advanced NLP applications in the field of knowledge extraction and automated question-answering systems.

Predefined Context

The following context provided for the Question and Answer model provides a comprehensive overview of Nikola Tesla’s life and achievements. It describes Tesla’s background as a Serbian-American inventor, his significant contributions to the alternating current power system, and his journey through various phases of his career, from his work in telephony and electric power to his experiments with wireless communication and power transmission. This rich and detailed narrative sets the stage for the model to demonstrate its ability to accurately answer questions related to Tesla’s life and work.

Nikola Tesla was a Serbian-American inventor, electrical engineer, mechanical
engineer, and futurist who is best known for his contributions to the design of
the modern alternating current (AC) electricity supply system.

Born and raised in the Austrian Empire, Tesla studied engineering and physics
in the 1870s without receiving a degree, and gained practical experience in the
early 1880s working in telephony and at Continental Edison in the new electric
power industry. He emigrated in 1884 to the United States, where he would
become a naturalized citizen. He worked for a short time at the Edison Machine
Works in New York City before he struck out on his own. With the help of
partners to finance and market his ideas, Tesla set up laboratories and
companies in New York to develop a range of electrical and mechanical devices.
His alternating current (AC) induction motor and related polyphase AC patents,
licensed by Westinghouse Electric in 1888, earned him a considerable amount of
money and became the cornerstone of the polyphase system which that company
would eventually market.

Attempting to develop inventions he could patent and market, Tesla conducted a
range of experiments with mechanical oscillators/generators, electrical
discharge tubes, and early X-ray imaging. He also built a wireless-controlled
boat, one of the first ever exhibited. Tesla became well known as an inventor
and would demonstrate his achievements to celebrities and wealthy patrons at
his lab, and was noted for his showmanship at public lectures. Throughout the
1890s, Tesla pursued his ideas for wireless lighting and worldwide wireless
electric power distribution in his high-voltage, high-frequency power
experiments in New York and Colorado Springs. In 1893, he made pronouncements
on the possibility of wireless communication with his devices. Tesla tried to
put these ideas to practical use in his unfinished Wardenclyffe Tower project,
an intercontinental wireless communication and power transmitter, but ran out
of funding before he could complete it.

After Wardenclyffe, Tesla experimented with a series of inventions in the 1910s
and 1920s with varying degrees of success. Having spent most of his money,
Tesla lived in a series of New York hotels, leaving behind unpaid bills. He
died in New York City in January 1943. Tesla's work fell into relative obscurity
following his death, until 1960, when the General Conference on Weights and
Measures named the SI unit of magnetic flux density the tesla in his honor.
There has been a resurgence in popular interest in Tesla since the 1990s.

Sample Questions and Answers

Below is an example of how the pre-trained Question and Answer model works in the context of the information provided about Nikola Tesla. When asked specific questions about Tesla’s birthplace, fame, and academic background, the model successfully identifies and ranks relevant answers with appropriate scores. These responses, derived from the detailed context, demonstrate the model’s ability to understand complex text and extract accurate and relevant information, reflecting the advanced state of NLP in question answering applications.

The question/answer example above with the pre-trained model illustrates its impressive ability to extract accurate answers from complex textual context. Using its advanced NLP framework, the model deftly navigates through a detailed narrative of Nikola Tesla’s life, responding accurately to questions about his birthplace, famous contributions, and educational background. These correctly identified and scored responses not only validate the model’s effectiveness in understanding and processing intricate details, but also highlight its utility in educational and informational applications.

Summary

Question answering systems represent a more complex and interactive application of NLP, designed to understand questions posed in natural language and provide accurate, contextually relevant answers. The process involves parsing the question to understand its structure and intent, breaking it down into key components. The system then searches its knowledge base or the Web for relevant information, understanding the context and nuance of the question. Finally, the system generates an answer, which may involve simple retrieval of information or synthesizing data from multiple sources. These systems use advanced AI models, such as deep learning, to improve understanding and accuracy, and are widely used in virtual assistants, customer service chatbots, and information retrieval systems. The pre-trained Question and Answer model, leveraging advanced NLP capabilities, demonstrates its ability to accurately pinpoint and prioritize answers to questions about Nikola Tesla’s life, exemplifying the latest advances in NLP-based question answering systems.

4 Ways to Learn

1. Read the article: Question Answering Systems

2. Play with the visual tool: Question Answering Systems

Play with the visual tool: Question Answering Systems

3. Watch the video: Question Answering Systems

4. Practice with the code: Question Answering Systems

--

--

Muneeb S. Ahmad

Muneeb Ahmad is a Senior Microservices Architect and Recognized Educator at IBM. He is pursuing passion in ABC (AI, Blockchain, and Cloud)