> For the complete documentation index, see [llms.txt](https://www.mlcompendium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.mlcompendium.com/natural-language-processing-nlp/question-answering.md).

# Question Answering

A question answering system takes a question and returns an answer from text, or from an image, and most of the work is in how the answer is found. The notes start with question answering over images, then walk through building a text Q\&A model from scratch, and end with retrieval-backed systems that look answers up in a vector search engine.

Questions do not have to be about text. [Pythia, qna for images](https://github.com/facebookresearch/pythia) is Facebook AI Research's repository, now the modular framework for vision and language multimodal research.

For text, the usual starting point is a model trained on SQuAD, the Stanford Question Answering Dataset. [Building a Q\&A system part 1](https://medium.com/data-science/building-a-question-answering-system-part-1-9388aadff507) is Alvira Swalin's end-of-master's project at USF, a question-answering model built from scratch on SQuAD. [Building a Q\&A model](https://medium.com/data-science/nlp-building-a-question-answering-model-ed0529a68c54) is Priya Dwivedi's final project from Stanford's CS224N course, NLP through Deep Learning, and covers the main building blocks of a question answering model on SQuAD. [Vidhya on Q\&A](https://medium.com/analytics-vidhya/how-i-build-a-question-answering-model-3548878d5db2) is Martin Decombarieu's account of building one, starting from the plain definition: a computer program that answers the questions you ask.

A model that reads one passage at a time still needs a way to find the passage. [Q\&A system using](https://medium.com/voice-tech-podcast/building-an-intelligent-qa-system-with-nlp-and-milvus-75b496702490) NLP and Milvus is the Milvus team's intelligent QA system, and [milvus - An open source embedding vector similarity search engine powered by Faiss, NMSLIB and Annoy](https://github.com/milvus-io/milvus) is the engine itself, now described as a high-performance, cloud-native vector database built for scalable vector ANN search.

The same notes are in [VECTOR SIMILARITY SEARCH](/deep-learning/representations.md#vector-similarity-search).

The last note comes back to the model side of the system. [Q\&A system](https://medium.com/@akshaynavalakha/nlp-question-answering-system-f05825ef35c8) covers the basic building blocks of a QA system with deep learning, built as a modified bi-directional attention flow model for the same Stanford CS224N course.

## Deprecated links

{% hint style="warning" %}
These links and images no longer work. The original wording is kept here. A same-resource copy, when one was checked, is used above.
{% endhint %}

* Building a Q\&A system part 1 This address no longer opens: <https://towardsdatascience.com/building-a-question-answering-system-part-1-9388aadff507>
* Building a Q\&A model This address no longer opens: <https://towardsdatascience.com/nlp-building-a-question-answering-model-ed0529a68c54>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.mlcompendium.com/natural-language-processing-nlp/question-answering.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
