Docker image/tag: semitechnologies/weaviate:1.3.0
Breaking Changes
none
New Features
-
New Question Answering (Q&A) Module (#1520, #1527, #1537, #1550)
This release introduces a new module called
qna-transformers
which uses BERT-related models for answer extraction.How it works
Under the hood the model uses a two-step approach. First it performs a semantic search with
k=1
to find the document (e.g. a Sentence, Paragraph, Article, etc.) which is most likely to contain the answer. This step has no certainty threshold and as long as at least one document is present, it will be fetched and selected as the one most likely containing the answer. In a second step a BERT-style answer extraction is performed on alltext
andstring
properties of the document. There are now three possible outcomes: (1) No answer was found because the question can not be answered, (2) An answer was found, but did not meet the user-specified minimum certainty, so it was discarded (typically the case when the document is on topic, but does not contain an actual answer to the question) and (3) An answer was found that matches the desired certainty. It is returned to the user.How to use it
On GraphQL
Get { ... }
queries a new searcherask{}
is introduced alongside the existingnear...
Searchers. It can be configured with a"question"
(required,string
) and two optional filter criteria:"certainty"
(float
between 0..1) and"properties" (
[]string)
. If no properties are set, all are considered. Similarly if no certainty is set, any answer that could be extracted will be returned.The answer is contained in a new
_additional
property calledanswer
. It contains the following fields:hasAnswer
(boolean
): could an answer be found?result
(nullablestring
): An answer if one could be found.null
ifhasAnswer==false
certainty
(nullablefloat
): The certainty of the answer returned.null
ifhasAnswer==false
property
(nullablestring
): The property which contains the answer.null
ifhasAnswer==false
startPosition
(int
): The character offset where the answer starts.0
ifhasAnswer==false
endPosition
(int
): The character offset where the answer ends0
ifhasAnswer==false
Note: There are some limitations to the fields
property
,startPosition
andendPostion
, see below.Example
Some optional parameters omitted for brevity:
{ Get { Paragraph( ask: { question: "what is the population of Berlin?" certainty: 0.8 }) { _additional { answer { result certainty } } text } }
Which produces a result like the following:
{ "data": { "Get": { "Paragraph": [{ "_additional": { "answer" : {"result": "3,769,495 inhabitants", "certainty": 0.85} }, "text": "Berlin is the capital and largest city of Germany by both area and population. Its 3,769,495 inhabitants, as of 31 December makes it the most-populous city of the European Union, according to population within city limits." }] } } }
Custom transformers models
You can use the same approach as for
text2vec-transformers
, i.e. either pick one of the pre-built containers or build your own container from your own model using thesemitechnologies/qna-transformers:custom
base image. Make sure that your model is compatible with Huggingfaces'stransformers.AutoModelForQuestionAnswering
Dependencies
The module performs a semantic search under the hood, so a
text2vec-...
module is required. It does not need to be transformers-based and you can also combine it withtext2vec-contextionary
. However, we expect that you will receive the best results by combining it will a well-fitting transformers model by using the appropriate configuredtext2vec-transformers
module.Limitations
startPosition
,endPosition
andproperty
in the response are not guaranteed to be present. They are caluclated by a case-insensitive string matching function against the input text. If the transformer model formats the output differently (e.g. by introducing spaces between tokens which were not present in the original input), the calculation of the position and determining the property fails.Explore { }
does support theask { }
searcher, but the result is only a beacon to the object containing the answer. It is thus not any different from performing anearText
semantic search with the question. No extraction is happening.
-
New Meta Information for all transformer-based modules (#1552)
A
GET /v1/meta
request will now also contain meta information about the transformer models used in the respective modules.
Fixes
- fixes an issue where nested cross-references might sometimes not appear in search results (#1489)
- fixes various performance bugs in the HNSW implementation which were most present with really high
efConstruction
values. Note that more performance improvements will follow shortly, this fix only contains the most urgent fixes. (#1543) - The default vector cache size was increased from 500k to 2M objects (#1574). Note that the implementation of the vector cache is likely to change in the future, as it is currently a performance bottleneck.