github weaviate/weaviate v1.3.0
v1.3.0 - Question & Answer module, various fixes

latest releases: v1.24.11, v1.25.0-rc.0, v1.24.10...
3 years ago

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 all text and string 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 searcher ask{} is introduced alongside the existing near... 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 called answer. It contains the following fields:

    • hasAnswer (boolean): could an answer be found?
    • result (nullable string): An answer if one could be found. null if hasAnswer==false
    • certainty (nullable float): The certainty of the answer returned. null if hasAnswer==false
    • property (nullable string): The property which contains the answer. null if hasAnswer==false
    • startPosition (int): The character offset where the answer starts. 0 if hasAnswer==false
    • endPosition (int): The character offset where the answer ends 0 if hasAnswer==false

    Note: There are some limitations to the fields property, startPosition and endPostion, 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 the semitechnologies/qna-transformers:custom base image. Make sure that your model is compatible with Huggingfaces's transformers.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 with text2vec-contextionary. However, we expect that you will receive the best results by combining it will a well-fitting transformers model by using the appropriate configured text2vec-transformers module.

    Limitations

    • startPosition, endPosition and property 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 the ask { } searcher, but the result is only a beacon to the object containing the answer. It is thus not any different from performing a nearText 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.

Don't miss a new weaviate release

NewReleases is sending notifications on new releases.