Learn how to Use Hybrid Seek for Higher LLM RAG Retrieval | by Dr. Leon Eversberg | Aug, 2024

[ad_1]

Constructing a sophisticated native LLM RAG pipeline by combining dense embeddings with BM25

Code snippet from the hybrid search we’re going to implement on this article. Picture by writer

The fundamental Retrieval-Augmented Era (RAG) pipeline makes use of an encoder mannequin to seek for related paperwork when given a question.

That is additionally known as semantic search as a result of the encoder transforms textual content right into a high-dimensional vector illustration (known as an embedding) through which semantically related texts are shut collectively.

Earlier than we had Giant Language Fashions (LLMs) to create these vector embeddings, the BM25 algorithm was a very fashionable search algorithm. BM25 focuses on vital key phrases and appears for precise matches within the out there paperwork. This strategy is known as key phrase search.

If you wish to take your RAG pipeline to the following stage, you would possibly need to strive hybrid search. Hybrid search combines the advantages of key phrase search and semantic search to enhance search high quality.

On this article, we’ll cowl the speculation and implement all three search approaches in Python.

Desk of Contents

· RAG Retrieval
Key phrase Search With BM25
Semantic Search With Dense Embeddings
Semantic Search or Hybrid Search?
Hybrid Search
Placing It All Collectively
·…

[ad_2]
Dr. Leon Eversberg
2024-08-11 14:38:59
Source hyperlink:https://towardsdatascience.com/how-to-use-hybrid-search-for-better-llm-rag-retrieval-032f66810ebe?source=rss—-7f60cf5620c9—4

Similar Articles

Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular