liveBook · Manning

Sparse vector semantic search

As explained in AI-Powered Search

Sparse vector search retrieves documents by matching nonzero textual features represented in sparse vectors, typically through an inverted index.

Sparse-vector semantic search represents queries and documents as mostly zero-valued term features, then retrieves and ranks documents through lexical matches. Unlike ordinary term matching, expansion models can add related terms and context-sensitive weights, giving lexical search a broader representation of query meaning. section 7.4.3 section 13.2.1

The retrieval foundation is an inverted index: normalized tokens point to document identifiers and positions. At query time, the system tokenizes and normalizes the query, looks up matching postings, and applies BM25 to score and rank the results. This is fast and relevant, but it mainly measures the presence and frequency of query-term strings rather than document meaning. section 13.2.1

Expansion models extend the sparse representation before it becomes search-engine syntax:

  • SPLADE weights tokens using the complete query or document context and tends to suit longer, general documents. section 7.4.3
  • SKG can contextualize token weights and classify queries, making it useful for shorter, domain-specific queries and query-sense disambiguation. section 7.4.3
  • Both approaches preserve a lexically oriented, sparse representation while introducing related terms that may not appear literally in the original query. section 7.4.3

Expanding a query with SPLADE++

A Python expander can process queries such as "kimchi", "bbq", and "korean bbq" and return Lucene-formatted sparse features. The expansion for "korean bbq" assigns high weights to terms including "korean", "korea", "grill", "dish", "restaurant", and "barbecue", illustrating how one query produces weighted lexical signals beyond its original strings.

How AI-Powered Search covers it

How deep it goes
Explains token normalization, postings lookup, BM25 ranking, contextual expansion, and the limits of query-term dependence.
Examples
Uses SPLADE++ expansions for food, entertainment, and travel queries, including weighted features for “korean bbq.”
What it assumes
Assumes tokenization, normalization, inverted indexes, postings, and BM25, while contrasting them with dense vector similarity.
What you can do after
Apply it via SPLADE++ to generate weighted Lucene-compatible sparse query features.
How it connects
Links inverted indexes and BM25 with query expansion, SPLADE, SKG, and dense vector search.

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.