Voiced by Amazon Polly |
Overview
Hybrid search is an innovative approach that combines the strengths of multiple search algorithms. It acts like a dream team, leveraging the best of different techniques to deliver highly relevant results for your queries. This is particularly valuable for applications based on Retrieval-Augmented Generation (RAG), where the system needs to understand a wide range of natural language inquiries.
Pioneers in Cloud Consulting & Migration Services
- Reduced infrastructural costs
- Accelerated application deployment
Introduction
Hybrid search combines the best of keyword-based and semantic search. Keyword search finds exact matches, perfect for queries like “capital of France” or specific product codes. Semantic search, on the other hand, focuses on meaning and intent. It can understand synonyms and related concepts, even if the exact keywords aren’t used.
For instance, imagine searching for “healthy recipes for vegetarians.” Keyword search might find recipes containing the word “vegetarian,” but it might miss dishes using terms like “plant-based” or “vegan.” Semantic search, understanding the intent to find healthy vegetarian options, would also include these.
Hybrid search bridges this gap by combining both approaches. It ensures precision by finding exact matches through keywords, while semantic search broadens the scope to include relevant synonyms and concepts. This comprehensive approach is ideal for RAG applications. Keywords can target specific entities in a query, like ingredients or dietary restrictions, while semantics can grasp the overall goal of finding healthy vegetarian recipes.
Hybrid Search
Hybrid search shines in several key scenarios:
- Open Domain Q&A:
Imagine a system that answers questions on any topic. Hybrid search tackles this challenge by looking through massive document collections across various subjects. Website data, for instance, can cover sustainability, leadership, finances, and more. While semantic search grasps meaning, it might struggle with entirely new topics (out-of-domain) lacking specific entities. Here, keyword search steps in, allowing the system to find those unseen entities and narrow down the results for a more accurate answer.
- Contextual Chatbots:
Conversations can take unexpected turns, jumping between topics. Hybrid search helps navigate these open-ended dialogues. It can understand the evolving context and retrieve relevant information, making the chatbot interactions smoother and more natural.
- Personalized Search:
Large-scale web searches with diverse content benefit from a hybrid approach. Semantic search tackles popular, well-defined queries, while keywords handle less common, longer, and more specific ones (long-tail queries). This combination ensures comprehensive search coverage.
Sample Code
The following code shows how to use hybrid using the Retrieve API with Boto3:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import boto3 bedrock_agent_runtime = boto3.client( service_name = "bedrock-agent-runtime" ) def retrieve(query, kbId, numberOfResults=5): return bedrock_agent_runtime.retrieve( retrievalQuery= { 'text': query }, knowledgeBaseId=kbId, retrievalConfiguration= { 'vectorSearchConfiguration': { 'numberOfResults': numberOfResults, 'overrideSearchType': "HYBRID", # optional } } ) response = retrieve(“query”) |
Hybrid Search on Amazon Bedrock console
To use hybrid and semantic search options on the Amazon Bedrock console, complete the following steps:
- On the Amazon Bedrock console, choose Knowledge Base in the navigation pane.
- Choose the knowledge base you created.
- Choose a Test knowledge base.
- Choose the configurations icon.
Benefits of a Hybrid Approach
By combining keyword and semantic search, hybrid search unlocks several advantages:
- Enhanced Accuracy:
The quality of responses generated by your system (FM) relies heavily on the relevance of the retrieved results. Depending on your data, improving accuracy solely with semantic search can be challenging. Hybrid search tackles this by retrieving more relevant information, ultimately leading to more accurate answers from the FM.
- Expanded Search Potential:
Keyword search acts like a wider net, catching potentially relevant documents but lacking a strong semantic structure. This allows you to search based on keywords alongside the text’s meaning, significantly expanding your search capabilities.
Conclusion
It tackles diverse topics, adapts to evolving conversations, and personalizes search results. Additionally, it empowers applications like Retrieval-Augmented Generation (RAG) by providing a richer foundation for accurate and insightful responses.
Drop a query if you have any questions regarding Hybrid search and we will get back to you quickly.
Empowering organizations to become ‘data driven’ enterprises with our Cloud experts.
- Reduced infrastructure costs
- Timely data-driven decisions
About CloudThat
CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.
CloudThat is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, and many more.
To get started, go through our Consultancy page and Managed Services Package, CloudThat’s offerings.
FAQs
1. Why Hybrid Search?
ANS: –
- Improved Accuracy: Hybrid search retrieves more relevant information, leading to more accurate answers in applications like question answering systems.
- Expanded Search Capabilities: It allows searching on both keywords and the meaning of the text, providing a wider range of potential results.
- Better Handling of Complex Queries: Hybrid search more effectively tackles complex queries with various phrasings and open-ended questions.
2. Which regions of Amazon Bedrock are available to use Hybrid Search?
ANS: – East Coast US: Us East (N. Virginia), West Coast US: Us West (Oregon), Asia Pacific: Asia Pacific (Sydney) – Note: Limited features available (model evaluation and continued pre-training of custom models not supported), Asia Pacific: Asia Pacific (Singapore) – Note: Limited features available (model evaluation and continued pre-training of custom models not supported), for more information please visit website.
3. Is Chat Playground available to practice hybrid search on the console?
ANS: – Yes, it is available.
WRITTEN BY Suresh Kumar Reddy
Yerraballi Suresh Kumar Reddy is working as a Research Associate - Data and AI/ML at CloudThat. He is a self-motivated and hard-working Cloud Data Science aspirant who is adept at using analytical tools for analyzing and extracting meaningful insights from data.
Click to Comment