Enhancing Vector Similarity Search with LLM-Based Reranking

grab · Tech · 2024 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Vector search reranking

Grab needed search results that preserve vector search efficiency while handling nuanced queries involving negation, constraints, or conceptual intent that raw similarity search can mis-rank.

Constraints:

Architecture

Grab proposed a two-step retrieval architecture. FAISS and OpenAI embeddings perform efficient vector similarity search to shortlist candidate entities, then GPT-4o reranks the shortlist using the original query and descriptive instructions to select the most contextually relevant results. This keeps vector search as the fast narrowing stage and uses the LLM only for nuanced ranking.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  original-query["Original query"] --> embedding-generator["Embedding generator"]
  embedding-generator --> faiss-vector-search["FAISS vector search"]
  faiss-vector-search --> llm-reranker["LLM reranker"]
  llm-reranker --> final-search-results["Final search results"]
  final-search-results --> experiment-evaluation["Experiment evaluation"]
  experiment-evaluation --> original-query
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Original query Natural-language retrieval request, potentially with negation or conceptual constraints. Embedding generator
Embedding generator Generates vector embeddings for the query and dataset entities. FAISS vector search
FAISS vector search Efficiently shortlists candidate matches from the dataset. LLM reranker
LLM reranker Uses GPT-4o to rank shortlisted results by contextual relevance to the original query. Final search results
Final search results Top-ranked results returned after LLM-assisted reranking. Experiment evaluation
Experiment evaluation Compares raw vector search and LLM-assisted search across synthetic and internal datasets. Original query

Data flow

The query is embedded and sent to FAISS for an initial shortlist of candidates. The shortlist and original query are then passed to GPT-4o, which reasons over context, negation, and constraints to rerank the candidates and return the top matches.

“We first perform a vector similarity search on the dataset to obtain a shortlist of potential matches (e.g., top 10-50 results) for the given query.”article, stated
“The shortlisted results from the vector similarity search are then fed into an LLM, which ranks the results based on their relevance to the original query.”article, stated

Why this architecture

Grab used vector search for the efficient shortlist and LLM reranking for nuanced contextual understanding, giving the system a way to handle negation and conceptual requirements without asking the LLM to search the full dataset.

“the efficiency of vector similarity search for initial shortlisting, and the contextual understanding and ranking capabilities of LLMs for refining the final results.”article, stated
“The LLM’s ability to understand context and capture subtleties in the queries allowed it to filter out irrelevant results”article, stated

Models used: FAISS · text-embedding-ada-002 · GPT-4o

Scale

Alternatives considered (roads not taken)

Use raw vector similarity search only.

Rejected because: Raw vector search struggled on negation and nuanced conceptual constraints.

““I like fishing” and “I do not like fishing” may be quite close to each other, while in reality, they are the exact opposite.”article, stated

Use LLM-assisted reranking for every query regardless of complexity.

Rejected because: Raw similarity search remains viable for simple queries when computational efficiency matters.

“for simpler queries, the raw similarity search remained a viable option, especially when computational efficiency is a concern.”article, stated

Patterns

retrieval-ranking (retrieval)

GPT-4o reranks a FAISS shortlist by contextual relevance to the original query.

“supply the shortlist and the original query to LLM with some descriptive instructions in the prompt to find the top three matches”article, stated

rag-retrieval (retrieval)

FAISS and embeddings perform the initial vector similarity shortlist.

“a Python script for vector similarity search leveraging Facebook AI Similarity Search (FAISS)”article, stated

cost-aware-routing (serving)

The architecture reserves the LLM for reranking a shortlist rather than scanning the full dataset.

“efficiency of vector similarity search for initial shortlisting”article, stated

Tradeoffs

Retrieval architecture

Chose Vector shortlist plus LLM reranking. over Raw vector search only..

Rationale: The two-stage design keeps fast shortlisting while adding natural-language understanding for complex constraints.

“By combining these two steps, we aim to achieve the best of both worlds”article, stated

Shortlist size

Chose Feed 15 candidates to the LLM in the experiment. over Reranking the whole dataset or only the raw top three..

Rationale: The shortlist gives the LLM enough candidates while bounding cost and context.

“we first get a shortlist of 15 entity matches from FAISS for the same query”article, stated

Gotchas (what bit them)

Vector similarity can confuse negation.

Root cause: Semantically adjacent phrases with opposite meanings may be close in vector space.

Resolution: Use an LLM reranker to reason over the original query and candidate context.

“The LLM correctly filtered out dishes containing fish or shrimp, while the raw similarity search failed to do so, presumably due to the presence of negation in the query.”article, stated

The experimental evidence is limited.

Root cause: The published experiment used small synthetic datasets and limited queries.

Resolution: Evaluate on larger and more diverse datasets before broad production use.

“Our experiment was limited to using a small volume of structured data (100 data points in each dataset) with a limited number of queries.”article, stated

LLM reranking can add production latency.

Root cause: The architecture introduces an additional LLM query after vector search.

Resolution: Consider latency implications and reserve the approach for cases where added context is worth it.

“for real world applications, the performance implications in terms of additional latency introduced by the additional LLM query must also be considered.”article, stated

Evaluation

Grab compared raw vector search top-three results with LLM-assisted reranked top-three results on two GPT-4o-generated synthetic datasets and also notes internal deployment on 4500+ relational rows.

Metrics: Top-three relevance · Complex-query relevance · Negation handling · Structured dataset size: 100 rows each · Internal dataset size: 4500+ rows

“With the raw vector search, we get the top three matches for a given query.”article, stated
“LLM-assisted vector search exhibited a clear advantage in handling complex queries”article, stated

Outcomes

Published experiments used two 100-row synthetic datasets and a 15-candidate shortlist; internal use reached 4500+ rows.

“we have witnessed similar enhancement in search result relevance when we deployed this solution internally within Grab for larger datasets”article, stated