NeuralQA: Question Answering on Large Datasets
Project description
NeuralQA: A Usable Library for Question Answering on Large Datasets with BERT
NeuralQA (still in alpha) provides a visual interface for end-to-end question answering (passage retrieval, query expansion, document reading, model explanation), on large datasets. Passage retrieval is implemented using ElasticSearch and Document Reading is implemented using pretrained BERT models via the Huggingface transformers api.
How Does it Work?
NeuralQA is comprised of several high level modules:
-
Retriever: For each search query (question), scan an index (elasticsearch), and retrieve a list of candidate matched passages.
-
Document Reader: For each retrieved passage, a BERT based model predicts a span that contains the answer to the question. In practice, retrieved passages may be lengthy and BERT based models can process a maximum of 512 tokens at a time. NeuralQA handles this in two ways. Lengthy passages are chunked into smaller sections with an configurable stride. Secondly, NeuralQA offers the option of extracting a subset of relevant snippets (RelSnip) which a BERT reader can then scan to find answers. Relevant snippets are portions of the retrieved document that contain exact match results for the search query.
-
User Interface: NeuralQA provides a visual user interface for performing queries (manual queries where question and context are provided as well as queries over a search index), viewing results and also sensemaking of results (reranking of passages based on answer scores, highlighting keyword match, model explanations).
Usage
Create a folder you would like to use for NeuralQA. Run the following command line interface from within that folder.
pip3 install neuralqa
neuralqa ui --host localhost --port 4000
navigate to http://127.0.0.1:4000/#/.
Note: You can specify configuration for a retriever (host, port). To use NeuralQA with a retriever such as ElasticSearch, follow the instructions here to download, install, and launch a local elasticsearch instance.
Configuration [In Progress]
Neuralqa provides an interface to specify properties of each module (ui, retriever, reader, expander) via a yaml configuration file. When you launch the ui, you can specify the path to your config file --config-path
. If this is not provided, NeuralQA will search for a config.yaml in the current folder or create a default copy) in the current folder. Sample configuration for the UI is shown below:
ui:
queryview:
intro:
title: "NeuralQA: Question Answering on Large Datasets"
subtitle: "Subtitle of your choice"
views: # select sections of the ui to hide or show
intro: True
advanced: True
samples: False
passages: True
explanations: True
allanswers: True
options: # values for advanced options
model: # list of models the user can select from
title: QA models
selected: distilbertsquad2
options:
- name: DistilBERT SQUAD2
value: distilbertsquad2
- name: BERT SQUAD2
value: bertsquad2
index: # search indices the user can select from
title: Search Index
selected: manual
options:
- name: Manual
value: manual
- name: Case Law
value: cases
stride: ..
maxpassages: ..
highlightspan: ..
header: # header tile for ui
appname: NeuralQA
appdescription: Question Answering on Large Datasets
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for neuralqa-0.0.17a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf085d35c1d5a4e6c183b324c6dfd17c964a38a0a867ce0164393618cbc921b |
|
MD5 | 6f5206624723427ef3af657862c4661f |
|
BLAKE2b-256 | 8fc54085ad33a27cf77066528385adfbbbd32ab3076a3e871b3dfc9cb031f46c |