passdrill
AI & LLM Engineering · RAG & Embeddings · Card 032/032 easy

A team building a RAG system needs to choose an embedding model for two different scenarios: (1) matching a short user question against long, several-paragraph reference documents, and (2) matching one previously-asked question against a database of other previously-asked questions to detect duplicates. According to guidance from Sentence-Transformers (SBERT) on choosing a semantic search model, why should these two scenarios not necessarily use the same kind of pre-trained embedding model?

  1. Scenario 1 is asymmetric semantic search, since the query and the matching text are of very different length and character (reversing them would not make sense), while scenario 2 is symmetric semantic search, since query and matching text are of comparable length and structure (reversing them would still make sense); using a model trained for the wrong one of these two cases can produce misaligned embeddings and degrade search quality
  2. Scenario 1 requires a model trained only on English text, while scenario 2 requires a model trained only on question-formatted text, and no model can ever be trained on both kinds of text at once
  3. Scenario 2 cannot be done with embeddings at all and must instead use a plain keyword search, while scenario 1 is the only one of the two that embeddings can ever be used for
  4. There is no real difference between the two scenarios once cosine similarity is used for comparison, since cosine similarity is defined identically regardless of what the two compared texts represent
Next card → Shuffle