What is under the hood of Marusya's \"question answering\"?

Roosh10 Feb 2023

Problem

A voice assistant in a smart speaker must answer factual questions from open web search. Span-extraction QA models trained on public data (SQuAD-style) fit poorly. Large ones are slow and need costly GPUs, smaller ones lose quality, and the product needs a full sentence (sometimes several) so the user can tell the question was understood. Each search document has 200 to 1000 sentences, too many to score with a large model.

Example from the article: for "How long do hamsters live?", the span "Two to three years" is too short; "The average lifespan of a hamster is two to three years" works.

Solution in brief

Classify or rank whole sentences instead of extracting spans. A cascade of growing models (bag-of-embeddings network, small transformer, roberta-large cross-encoder) narrows hundreds of sentences to a few. The smaller models are distilled from the large one, and a separate model picks how many top sentences to join.

Questions this case answers
  • How to extract a short answer from a ranked list of long documents under a strict latency and hardware budget when only a large model is accurate enough
  • How to label and filter training data for an answer-selection model when public datasets differ from the real query distribution
  • How to find a short, voiceable answer to a factual question inside the top 10 web search results within a voice assistant's latency budget?
  • How to avoid running a large transformer over hundreds of sentences per document?

Tools and methods

  • RoBERTa-large cross-encoder — final classifier of question and sentence pairs
  • Small RoBERTa (4 blocks, hidden 256) — second-level filter
  • Bag-of-embeddings network with max-pooling — cheap first-level filter
  • Knowledge distillation — passes the large model's labels to smaller models
  • Active learning and hard negatives — choose what to label
  • Query classifier — picks the answer strategy (top-1 or top-1 to top-3)
Continue reading — it's free

Google or a one-time email code. No password.