liveBook · Manning

Answer span

As explained in AI-Powered Search

An answer span is a contiguous sequence of tokens or words selected from a document as the answer to a question.

An answer span is a contiguous sequence of tokens selected from a document as the answer to a question. Extractive question answering searches a supplied context rather than generating an answer independently. section 14.1.1

The context is divided into smaller spans, and the model assigns each token a probability of being the answer's start and another probability of being its end. These two discrete probability mass functions reduce span selection to two token predictions. section 14.1.1

Minimalist shoes

Given the question “What are minimalist shoes?” and a context containing “Minimalist shoes are shoes intended to closely approximate barefoot running conditions,” the selected answer span is “shoes intended to closely approximate barefoot running conditions.” section 14.1.1

A practical extraction pipeline follows these steps:

  • Tokenize the question and retrieved context, then encode them into model inputs. section 14.1.1
  • Normalize the start and end scores, identify the highest-scoring boundary tokens, and slice the token sequence between them. section 14.1.1
  • At query time, retrieve top-k documents, predict top-n answer spans, and let a reranker sort them by probability before displaying the highest-ranked answer. section 14.1.2
Figure 14.4 Retriever-reader pattern for extractive question answering
figure

Use the architecture diagram to trace how a user question moves through retrieval, reading, answer-span scoring, and reranking. section 14.1.2

How AI-Powered Search covers it

How deep it goes
Explains span boundaries through start and end token probabilities, then connects them to retrieval and reranking.
Examples
Uses the minimalist-shoes question, tokenized context, predicted boundaries, and a retrieved top-k document set.
What it assumes
Assumes familiarity with questions, documents, tokens, and search retrieval while defining span selection and token probabilities.
What you can do after
Apply it via an extractive QA pipeline to retrieve contexts, identify answer boundaries, rank candidate spans, and display an answer.
How it connects
Connects tokens, extractive question answering, search engines, retriever-reader patterns, and reranking.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI-Powered Search. The section links point to the parts of the book it draws on.