Articles / Viewpoints and methods
10 minFor system designers

Four Retrieval Methods to Compare Before Choosing RAG

Compare vector search, BM25, hybrid search, and knowledge graphs by how they retrieve information, the problems they fit, and the trade-offs they introduce.

Aaron HuangSystems, product and AI practice

This analysis organizes four Retrieval Methods to Compare Before Choosing RAG into a practical comparison of evidence, decisions and current limits.

Read the evidence below as a decision trail: what changed, why it matters, which trade-offs shaped the result, and where the conclusion still depends on context.

Before you want to import RAG, first understand what is going on under the hood. Vector search, BM25, Hybrid Search, Knowledge Graph - a complete comparison of the principles, applicable scenarios and trade-off of the four data retrieval methods. Conclusion: Hybrid Search is enough for most enterprise scenarios.

Why do we need to understand the principles of retrieval?

The term Retrieval-Augmented Generation (RAG) is heard everywhere now, but most people’s understanding of it is “allowing AI to search data.” The problem is that there are many different methods of "checking information", and the effects of each method vary greatly.

You don’t need to write your own algorithm, but you need to know the strengths and weaknesses of each search method in order to make correct judgments when selecting technology. This article clearly explains the principles of the four mainstream methods in vernacular.

Vector Search: compare "meaning" rather than "text"

core concepts

Traditional search compares the text itself—how many words the query and document have in common. However, "server overheating" and "cooling module needs maintenance" have nothing in common, and traditional methods would consider them unrelated.

Vector search takes a different approach:Don't compare words, compare meanings.

The method is to convert the text into a set of numbers. This set of numbers is called an embedding vector. After a piece of text is processed by the embedding model, it will become a high-dimensional number array, such as 768 numbers. These 768 numbers represent the coordinate position of this text in the "meaning space".

Texts with similar meanings will have closer coordinates. The vector coordinates of "server overheating" and "cooling module maintenance" are very close, but "what to eat for lunch today" are far from them. When searching, the question is also converted into a vector, and then the text with the closest coordinates is found in the database. "Recently" uses cosine similarity, which essentially calculates the angle between two vectors - the smaller the angle, the more similar they are.

How does Embedding Model learn to understand "meaning"?

The Embedding model is a neural network trained on large amounts of text. The training method is roughly: show it a large number of examples of "these two sentences have similar meanings" and "these two sentences have different meanings", and let it learn to map similar sentences to close coordinates. Different embedding models have different training materials, so their effects on different languages ​​and fields are also different. This is why choosing an embedding model is a meaningful decision, not just picking one at random.

Accelerating searches in vector databases: from seconds to milliseconds

If you only have 100 paragraphs of text, just compare them one by one for each search. But when there are 1 million segments, comparing them one by one is too slow. What the vector database does is to create an index so that searches can skip most irrelevant vectors and directly find the nearest few. Common indexing methods such as HNSW (Hierarchical Navigable Small World, hierarchical navigable small world graph) can increase the search speed from seconds to milliseconds.

ChromaDB, Pinecone, and FAISS all do this. The difference lies in the deployment mode: FAISS is a pure library (you need to manage the storage yourself), ChromaDB is a lightweight database (runs locally and manages the storage for you), and Pinecone is cloud hosting (you don’t need to manage the infrastructure but you need to pay).

BM25 keyword search: strong exact matching, weak semantic understanding

Core logic: word frequency + rarity weighting

BM25 (Best Matching 25) is an algorithm invented in 1994 and is still widely used today. The logic is: the more times a word appears in a document, the more likely it is that the document is relevant to queries containing that word. But there are two key corrections:

First, inverse document frequency (IDF, Inverse Document Frequency).If a word is common in all documents (like "de", "is", "one"), its degree of distinction is very low and its weight will be reduced. The rarer the words, the more distinguishing value they have.

Second, length regularization.The longer the file, the more words it naturally contains. It needs to be regularized to prevent long files from taking advantage.

Core differences between BM25 vs vector search

BM25 compares the words themselves. If there is "deployment" in the query, it will find paragraphs containing the word "deployment". If the file says "online process" instead of "deployment", BM25 cannot find it.

Vector search compares semantics. The embedding of "deployment" and "online process" will be very close, so they can be found.

But on the other hand, if you are looking for a specific noun, such as "ChromaDB" or "v1.0-pre-migration", vector search may find paragraphs that have similar semantics but are not this thing, and BM25's exact match will be more accurate.

Vector search wins in "understanding the meaning", and BM25 wins in "exact matching".The two complement each other, which is why Hybrid Search is needed.

Hybrid Search: vector semantics + BM25 exact matching, using RRF to merge rankings

Merge logic: Reciprocal Rank Fusion (RRF, Reciprocal Rank Fusion)

Vector search found the top-10 paragraphs, and BM25 also found the top-10 paragraphs. The two lists partly overlap and partly differ. How to combine them into one final list?

The most commonly used method is called RRF. The logic is very intuitive: the higher a paragraph ranks in a certain search result, the higher the score. If it ranks high in both search results at the same time, the score will be higher.

The specific formula isscore = 1 / (k + rank), k is a constant (usually set to 60), and rank is the ranking. Add the scores of the two search results, reorder them, and take top-K.

The advantage of this method isNo need to calibrate the scores of the two searches. The cosine similarity of vector search is completely different from the score of BM25, and the direct comparison is meaningless. RRF uses only rankings to merge, bypassing this problem.

Knowledge Graph: Good at multi-hop reasoning, but the construction cost is extremely high

Core concepts: triples + relational reasoning

Knowledge graph breaks information into triples:subject → relationship → object. For example, you can extract from a pile of files:

  • gwarket → Working with technologies → Next.js
  • gwarket → Deployed on → Cloudflare Pages
  • Blog-Writer → Split into → Article Writer
  • Article Writer → Output Format → WordPress HTML

These triples form a graph, with nodes being entities and edges being relationships. When querying, you can walk along the edges - for example, asking "What technology does gwarket use?" It starts from the gwarket node and finds all the edges that "use technology".

Knowledge graph vs vector search

Vector search is good at "Does this text resemble the question?" but not good at "What is the relationship between A and B?" Knowledge graphs are good at relational reasoning and multi-hop reasoning - for example, "gwarket uses Next.js → Next.js is deployed on Cloudflare Pages → so gwarket is deployed on Cloudflare Pages". This kind of reasoning across multiple nodes cannot be done by vector search.

But the cost of the knowledge graph is: you need to extract the triples from the unstructured text first. The quality extracted by LLM in this step is unstable, and there will be missed and wrong extractions. And the query language for graphs is much more complex than vector search.

The concept of GraphRAG is attractive, but the ROI cannot be calculated for most teams

Because the cost of building a map is high (each document must be processed by LLM to extract entities and relationships, and this step itself consumes a lot of API tokens), the maintenance cost is also high (new files must be re-extracted when they come in). For most enterprise question and answer scenarios, vector search + BM25 can already handle 80-90% of the questions.Knowledge graphs solve the last 10-20% of scenarios that require multi-hop reasoning.

In most enterprise scenarios, Hybrid Search is the right choice — comparison of four methods

Dimensions vector search BM25 keyword Hybrid Search Knowledge graph
good at Semantic understanding, synonyms Exact noun, code search Taking into account semantics and precision Multi-hop reasoning, relational query
Weakness Certain nouns may be inaccurate Semantic ambiguity is a serious problem Two sets of indexes need to be maintained Construction and maintenance costs are extremely high
Construction cost Medium (requires embedding + vector DB) Low (many mature tools) Middle to high High (LLM decimation + graph DB)
Applicable scale Medium and large knowledge base any size Medium and large knowledge base Large, relationship-intensive
Typical scenario Customer service Q&A, document search Program code search, log query Enterprise Knowledge Base RAG Medical, Legal, Supply Chain

What this means

For most enterprise scenarios,Hybrid Search is the most pragmatic choice. It uses vector search to make up for the semantic blind spots of BM25, and uses BM25 to make up for the lack of exact matching of vector search. The RRF merging logic is simple and does not require parameter adjustment.

The knowledge graph is conceptually attractive, but the current construction cost and maintenance complexity make it only suitable for specific scenarios—for example, medical diagnosis requires reasoning along the path of symptoms → disease → drug, or legal provisions need to trace the reference relationships between provisions. If your scenario is "employees ask questions and the system finds answers from the document library", Hybrid Search is enough.

The biggest fear in technology selection is not the wrong choice, but over-design. There is no need to jump to the knowledge graph until you verify that Hybrid Search is really not enough.

Practical questions and boundaries

How to choose Embedding Model?

Depends on your language and field. If the knowledge base is a mixture of Chinese and English, choose a multilingual model (such as Voyage AI's multilingual version or OpenAI's text-embedding-3). If it is a specific field (medical, legal), it is preferred to choose a model trained with data in that field. There is no absolute best model, only the model that best suits the characteristics of your data.

Which vector database should I choose?

Depends on your deployment needs. ChromaDB is used for prototype verification (local running, easy to set up). If you don’t want to worry about infrastructure in the production environment, use Pinecone or Weaviate Cloud. If the team has DevOps capabilities and a large amount of data, build Qdrant or Milvus yourself. FAISS is sufficient for small projects.

How to adjust the weight of vector and BM25 in Hybrid Search?

The advantage of using RRF is that there is less need to adjust the weights. If you really want to adjust, you can add a coefficient before the RRF formula, such asα * vector_score + (1-α) * bm25_score, α is set to 0.5 and fine-tuned according to the actual retrieval effect. But in most cases, the preset RRF is sufficient.

What to take away

The article's value is in the evidence and trade-offs behind four Retrieval Methods to Compare Before Choosing RAG, not in treating the conclusion as universal.