RAG Reranking King

At Pandorabot.io, we understand the challenges that organizations face when it comes to efficiently accessing and utilizing the knowledge contained within their extensive collections of technical documents. We specialize in delivering custom-made KnowledgeBots that are specifically designed to solve the knowledge retrieval challenge, even in the most complex situations.

4/21/20246 min read

In this article, we will explore how advanced techniques such as Retrieval-Augmented Generation (RAG), embeddings, similarity search, and reranking can revolutionize knowledge retrieval in technical domains.

Retrieval-Augmented Generation (RAG): Retrieval-Augmented Generation (RAG) is a powerful approach that combines information retrieval with language generation models. In the context of technical documents, RAG allows knowledge retrieval systems to not only find relevant passages but also generate coherent and informative responses based on the retrieved information. By leveraging the strengths of both retrieval and generation, RAG enables more accurate and context-aware knowledge retrieval from technical documents.

Embeddings and Similarity Search: Embeddings are dense vector representations of text that capture semantic meaning and relationships between words or passages. By converting technical documents and diagrams into embeddings, we can perform efficient similarity searches to find relevant information based on the semantic similarity between the query and the embedded documents. This approach goes beyond keyword matching and enables the retrieval of documents that are conceptually related to the query, even if they do not contain the exact same terms.

The Power of Reranking: While embeddings and similarity search provide a strong foundation for knowledge retrieval, reranking techniques can further enhance the accuracy and relevance of the retrieved documents. During a recent project with an engineering firm, where over 2,000 technical documents were ingested and vectorized, the need for reranking became evident during the User Acceptance Testing (UAT) phase. The technical director of the firm expressed the desire for even more precise document retrieval. To address this, we extensively tested the following reranking options by asking the same question:

Technical Question: input and output for preheat perkins 1306

  1. Gemini 1.5: Gemini 1.5 is a state-of-the-art reranking model that combines the strengths of multiple language models. It takes into account various factors such as relevance, coherence, and diversity to provide a well-rounded reranking of the retrieved documents. Gemini 1.5 has shown promising results in improving the quality of knowledge retrieval in technical domains.

Here's a possible order of relevance based on the provided documents:

1. Document 0 (4008 TAG1A 644 - 882 kWm): This document seems highly
relevant as it specifically discusses the Perkins 1306 engine model
and provides detailed technical data, including sections on "General
installation" and "Cooling system," which directly relate to preheating.
2. Document 2 (General installation 4008TAG1A - Temperate): This
document provides specific information about the general installation of
the 4008TAG1A engine, which likely includes details relevant to
preheating procedures.
3. Document 3 (4008TAG2A - Temperate Designation): While focusing on
the 4008TAG2A model, this document might offer insights into preheating
procedures applicable to the Perkins 1306 series due to potential
similarities between the models.
4. Document 1 (DSE P810 for Windows ™ Software Manual): This document,
although related to the DSE controller, might contain information about
preheating settings and configurations that could be helpful.
5. Document 4 (4008TAG2A - Tropical Designation): Similar to document 3,
this document might offer some relevant information due to shared
characteristics within the Perkins 1306 series.
6. Document 5 (Energy balance 4008TAG1A - Temperate Designation):
This document likely focuses on energy consumption and distribution,
which may not be directly related to preheating.
7. Document 6 (Noise Data Noise levels): This document seems to
be about noise levels and is unlikely to contain information about preheating.
8. Document 7 (4008TAG1A and 4008TAG2A - Left side view (Temperate)):
This document, while providing a visual representation of the engine,
may not offer specific details about preheating.
9. Document 8 (4008TAG1A and 4008TAG2A - Front view (Tropical)):
Similar to document 7, this document may not directly address preheating
10. Document 9 (4008TAG1A and 4008TAG2A - Right side view (Tropical)):
This document, like documents 7 and 8, is unlikely to be a primary
source of preheating information.
11. Document 10 (4008TAG1A and 4008TAG2A - Rear view (Tropical)):
Similar to documents 7, 8, and 9, this document may not be directly
relevant to preheating.
12. Document 11 (CEA6 controller unit):
This document, while related to a different controller model,
may not provide specific details about preheating for the Perkins 1306.

[0, 2, 3, 1]

2. Cohere Reranker: Cohere’s rerank-multilingual-v3.0 reranking model leverages advanced natural language understanding to reorder the retrieved documents based on their relevance to the query. By considering the semantic context and relationships between the query and the documents, Cohere Reranker can significantly improve the accuracy of the retrieved results.

Cohere reranking

RerankResponseResultsItem(document=None, index=3, relevance_score=0.6087685),
RerankResponseResultsItem(document=None, index=2, relevance_score=0.2961451),
RerankResponseResultsItem(document=None, index=1, relevance_score=0.2791402),
RerankResponseResultsItem(document=None, index=6, relevance_score=0.07450026),
RerankResponseResultsItem(document=None, index=5, relevance_score=0.02092419),
RerankResponseResultsItem(document=None, index=0, relevance_score=0.016090874),
RerankResponseResultsItem(document=None, index=4, relevance_score=0.009196552)], meta=ApiMeta(api_version=ApiMetaApiVersion(version='1', is_deprecated=None, is_experimental=None), billed_units=ApiMetaBilledUnits(input_tokens=None, output_tokens=None, search_units=1, classifications=None), tokens=None, warnings=None))

3. Claude Opus: Claude Opus is a reranking model specifically designed for technical documents. It incorporates domain-specific knowledge and understands the intricacies of technical language and concepts. By leveraging its understanding of technical jargon and context, Claude Opus can effectively rerank the retrieved documents to prioritize the most relevant and informative results.

Claude Opus 3

Based on the given user question and the provided list of documents,
here is my ranking of the documents from most relevant to least relevant to answer the question "input and output for preheat perkins 1306":

1. The most relevant document appears to be document 1, as
it specifically mentions the Perkins 1306 engine and describes
the inputs and outputs related to the preheat system, including the
preheat switch input and the preheat relay output.

2. Document 0 would be the next most relevant, as it discusses the
preheat system in general terms for Perkins engines, though it does
not specifically mention the 1306 model.

3. Document 2 mentions Perkins engines but does not contain any
information about preheating or inputs/outputs, so it is less relevant
than documents 1 and 0.

4. Document 3 is not relevant at all, as it is about a different
engine manufacturer (Cummins) and does not mention preheating.

So in summary, my ranking from most relevant to least relevant to answer
the question "input and output for preheat perkins 1306" is:

[1, 0, 2, 3]

The combination of RAG, embeddings, similarity search, and reranking techniques has the potential to revolutionize knowledge retrieval in technical domains. By leveraging these advanced approaches, organizations can unlock the full potential of their technical documents and diagrams, enabling faster access to relevant information and facilitating better decision-making. As we continue to refine and optimize these techniques, we can expect even more accurate and efficient knowledge retrieval systems that empower engineering firms and other technical organizations to stay ahead in today’s competitive landscape.

4. Claude Haiku: RAG draws deep insights, Opus stands sleek, streamlined, swift — but lets weight Haiku’s depth low cost / high speed:

Based on the given user question "input and output for preheat perkins 1306"
and the list of documents, I would rank the relevance of the
documents as follows:

The reasoning is:

0. This document is likely the most relevant as it specifically
mentions "Perkins 1306" and discusses input and output information,
which is directly related to the user's question.

2. This document also mentions "Perkins 1306" and discusses engine
specifications, which could be relevant to answering the question.

1. While this document discusses Perkins engines, it does not specifically
mention the 1306 model, so it is less directly relevant than the top
two documents.

3. This document discusses Perkins engine maintenance, but does not appear
to have specific information about the 1306 model input and output.

4. This document discusses Perkins engine troubleshooting, but again does
not seem to have direct information about the 1306 model.

5. This document discusses Perkins engine parts, but does not appear to
have information directly relevant to the user's question.

[0, 2, 1, 3, 4, 5]

The Role of Pandorabot.io in Elevating Chatbot Experiences

🧠 KnowledgeBot 💰SalesB

ot 🛠️ ​ServiceBot 👁️‍🗨️VisionBot

For businesses seeking to leverage the full potential of AI in customer interactions, Pandorabot.io stands as a premier solution. Specializing in creating custom, tailor-made chatbots, Pandorabot.io offers a platform where businesses can develop chatbots that are not only aligned with their specific needs but also capable of evolving with them. Our chatbots are designed to offer nuanced, industry-specific interactions, seamless integration with business systems, and state-of-the-art data security measures. With Pandorabot.io, businesses can ensure a chatbot experience that enhances customer engagement, reinforces brand reputation, and drives operational efficiency.