<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ragie</title>
    <description>The latest articles on Forem by Ragie (@ragieai).</description>
    <link>https://forem.com/ragieai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F9705%2F86a62532-1e97-4264-ac2d-317af68e399f.png</url>
      <title>Forem: Ragie</title>
      <link>https://forem.com/ragieai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ragieai"/>
    <language>en</language>
    <item>
      <title>How Ragie Outperformed the FinanceBench Test</title>
      <dc:creator>Ibrahim Salami</dc:creator>
      <pubDate>Wed, 23 Oct 2024 16:22:01 +0000</pubDate>
      <link>https://forem.com/ragieai/how-ragie-outperformed-the-financebench-test-cph</link>
      <guid>https://forem.com/ragieai/how-ragie-outperformed-the-financebench-test-cph</guid>
      <description>&lt;p&gt;In this article, we’ll walk you through how &lt;a href="https://ragie.ai/?utm_source=dev.to&amp;amp;utm_medium=organic-posts&amp;amp;utm_campaign=financebench"&gt;Ragie&lt;/a&gt; handled the ingestion of over 50,000+ pages in the &lt;a href="https://github.com/patronus-ai/financebench/tree/main/pdfs" rel="noopener noreferrer"&gt;FinanceBench dataset&lt;/a&gt; (360 PDF files, each roughly 150-250 pages long) in just 4 hours and outperformed the benchmarks in key areas like the Shared Store configuration, where we beat the benchmark by 42%.&lt;/p&gt;

&lt;p&gt;For those unfamiliar, the FinanceBench is a rigorous benchmark designed to evaluate RAG systems using real-world financial documents, such as &lt;a href="https://www.investopedia.com/terms/1/10-k.asp" rel="noopener noreferrer"&gt;10-K filings&lt;/a&gt; and earnings reports from public companies. These documents are dense, often spanning hundreds of pages, and include a mixture of structured data like tables and charts with unstructured text, making it a challenge for RAG systems to ingest, retrieve, and generate accurate answers.&lt;/p&gt;

&lt;p&gt;In the FinanceBench test, RAG systems are tasked with answering real-world financial questions by retrieving relevant information from a dataset of 360 PDFs. The retrieved chunks are fed into a large language model (LLM) to generate the final answer. This test pushes RAG systems to their limits, requiring accurate retrieval across a vast dataset and precise generation from complex financial data.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Complexity of Document Ingestion in FinanceBench&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Ingesting complex financial documents at scale is a critical challenge in the FinanceBench test. These filings contain crucial financial information, legal jargon, and multi-modal content, and they require advanced ingestion capabilities to ensure accurate retrieval.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Document Size and Format Complexity&lt;/strong&gt;: Financial datasets consist of structured tables and unstructured text, requiring a robust ingestion pipeline capable of parsing and processing both data types. &lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Handling Large Documents&lt;/strong&gt;: The 10-K can be overwhelming as the document often exceeds 150 pages, so your RAG system must efficiently manage thousands of pages and ensure that ingestion speed does not compromise accuracy (a tough capability to build). &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ‍&lt;strong&gt;How we Evaluated Ragie using the FinanceBench test&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The RAG system was tasked with answering 150 complex real-world financial questions. This rigorous evaluation process was pivotal in understanding how effectively Ragie could retrieve and generate answers compared to the gold answers set by human annotators. &lt;/p&gt;

&lt;p&gt;Each entry features a question (e.g., "Did AMD report customer concentration in FY22?"), the corresponding answer (e.g., “Yes, one customer accounted for 16% of consolidated net revenue”), and an evidence string that provides the necessary information to verify the accuracy of the answer, along with the relevant document's page number. &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Grading Criteria:&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Accuracy&lt;/strong&gt;: Matching the gold answers for correct responses.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Refusals&lt;/strong&gt;: Cases where the LLM avoided answering, reducing the likelihood of hallucinations.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Inaccurate Responses&lt;/strong&gt;: Instances where incorrect answers were generated.
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ragie’s Performance vs. FinanceBench Benchmarks&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We evaluated Ragie across two configurations:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Single-Store Retrieval:&lt;/strong&gt; In this setup, the vector database contains chunks from a single document, and retrieval is limited to that document. Despite being simpler, this setup still presents challenges when dealing with large, complex financial filings. &lt;/p&gt;

&lt;p&gt;We matched the benchmark for Single Vector Store retrieval, achieving 51% accuracy using the setup below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Top\_k=32, No rerank&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjf6stbwmbolep2ovl1h2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjf6stbwmbolep2ovl1h2.png" width="800" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shared Store Retrieval:&lt;/strong&gt; In this more complex setup, the vector database contains chunks from all 360 documents, requiring retrieval across the entire dataset. Ragie had a 27% accuracy compared to the benchmark of 19% for Shared Store retrieval, outperforming the benchmark by 42% using this setup:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Top\_k=8, No rerank&lt;/code&gt;  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbis5mk04tstd5fbto4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbis5mk04tstd5fbto4p.png" width="800" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Shared Store retrieval is a more challenging task since retrieval happens across all documents simultaneously; ensuring relevance and precision becomes significantly more difficult because the RAG system needs to manage content from various sources and maintain high retrieval accuracy despite the larger scope of data.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Key Insights:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In a second Single Store run with top_k=8, we ran two tests with rerank on and off: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Without rerank, the test was 50% correct, 32% refusals, and 18% incorrect answers.
&lt;/li&gt;
&lt;li&gt;With rerank on, the test was 50% correct, but refusals increased to 37%, and incorrect answers dropped to 13%.&lt;/li&gt;
&lt;li&gt;Conclusion: Reranking effectively reduced hallucinations by 16% &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;There was no significant difference between GPT-4o and GPT-4 Turbo’s performance during this test.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Ragie Outperforms: The Technical Advantages&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Advanced Ingestion Process:&lt;/strong&gt; Ragie's advanced extraction in &lt;a href="https://docs.ragie.ai/reference/createdocument" rel="noopener noreferrer"&gt;&lt;code&gt;hi_res&lt;/code&gt;&lt;/a&gt; mode enables it to extract all the information from the PDFs using a multi-step extraction process described below:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Text Extraction&lt;/strong&gt;: Firstly, we efficiently extract text from PDFs during ingestion to retain the core information.**
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tables and Figures&lt;/strong&gt;: For more complex elements like tables and images, we use advanced optical character recognition (OCR) techniques to extract structured data accurately.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM Vision Models&lt;/strong&gt;: Ragie also uses LLM vision models to generate descriptions for images, charts, and other non-text elements. This adds a semantic layer to the extraction process, making the ingested data richer and more contextually relevant.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hybrid Search:&lt;/strong&gt; We use hybrid search by default, which gives you the power of semantic search (for understanding context) and keyword-based retrieval (for capturing exact terms). This dual approach ensures precision and recall. For example, financial jargon will have a different weight in the FinanceBench dataset, significantly improving the relevance of retrievals.  &lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalable Architecture:&lt;/strong&gt; While many RAG systems experience performance degradation as dataset size increases, Ragie’s architecture maintains high performance even with 50,000+ pages. Ragie also uses &lt;a href="https://docs.ragie.ai/docs/summary-index" rel="noopener noreferrer"&gt;summary index&lt;/a&gt; for hierarchical and hybrid hierarchical search; this enhances the chunk retrieval process by processing chunks in layers and ensuring that context is preserved to retrieve highly relevant chunks for generations. &lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before making a Build vs Buy decision, developers must consider a range of performance metrics, including scalability, ingestion efficiency, and retrieval accuracy. In this rigorous test against FinanceBench, Ragie demonstrated its ability to handle large-scale, complex financial documents with exceptional speed and precision, outperforming the Shared Store accuracy benchmark by 42%.&lt;/p&gt;

&lt;p&gt;If you’d like to see how Ragie can handle your own large-scale or multi-modal documents, you can try &lt;a href="https://secure.ragie.ai/sign-up" rel="noopener noreferrer"&gt;Ragie’s Free Developer Plan.&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Feel free to reach out to us at &lt;a href="//mailto:support@ragie.ai"&gt;support@ragie.ai&lt;/a&gt; if you're interested in running the FinanceBench test yourself.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>ai</category>
      <category>showdev</category>
      <category>llm</category>
    </item>
    <item>
      <title>How to Build Smarter AI Apps and Reduce Hallucinations with RAG</title>
      <dc:creator>Ibrahim Salami</dc:creator>
      <pubDate>Thu, 10 Oct 2024 21:20:15 +0000</pubDate>
      <link>https://forem.com/ragieai/how-to-build-smarter-ai-apps-and-reduce-hallucinations-with-rag-79i</link>
      <guid>https://forem.com/ragieai/how-to-build-smarter-ai-apps-and-reduce-hallucinations-with-rag-79i</guid>
      <description>&lt;p&gt;With the rise of AI-powered apps, developers are continuously looking for ways to enhance the accuracy and relevance of AI-generated content. One of the most effective methods for achieving this is through &lt;a href="https://blogs.nvidia.com/blog/what-is-retrieval-augmented-generation" rel="noopener noreferrer"&gt;Retrieval-Augmented Generation (RAG)&lt;/a&gt;, which combines the power of LLMs with real-time access to external data sources. RAG makes AI applications more reliable, intelligent, and context-aware. Additionally, RAG can mitigate &lt;a href="https://www.ibm.com/topics/ai-hallucinations" rel="noopener noreferrer"&gt;hallucination&lt;/a&gt;&lt;strong&gt;,&lt;/strong&gt; which is when AI models generate false or misleading information.&lt;/p&gt;

&lt;p&gt;In this blog, we’ll explore how developers can use RAG to build smarter AI apps and reduce hallucinations.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What Is Retrieval-Augmented Generation (RAG)?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;RAG is an advanced technique that enhances LLMs by allowing them to pull real-time, relevant information from external databases, knowledge bases, or other sources. Traditional LLMs rely solely on the data they were trained on, which can lead to inaccurate or outdated results, especially when faced with complex, domain-specific questions. RAG provides a retrieval mechanism that can tap into live data sources, enabling LLMs to generate more accurate and relevant responses.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Why Use RAG to Build Smarter AI Applications?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;RAG has several key benefits that make it ideal for developers looking to build more intelligent AI applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Real-Time Data Access&lt;/strong&gt;: Traditional LLMs are limited by their training data, which can become outdated. RAG addresses this issue by retrieving real-time data from external sources, ensuring responses are up-to-date and accurate.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Improved Accuracy and Reliability&lt;/strong&gt;: While LLMs are proficient at generating text, they can sometimes fabricate information when solid factual information isn’t present in their training data. RAG ensures responses are grounded in real, curated data, making it ideal for tasks where correctness is critical, such as research, journalism, or technical documentation.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Context-Aware Responses&lt;/strong&gt;: RAG’s retrieval mechanism selects information relevant to the input query, ensuring that the responses are accurate and contextually aligned with the specific question or task at hand.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Fast and Efficient Retrieval&lt;/strong&gt;: RAG utilizes vector and other specialized databases to quickly retrieve information based on semantic similarity, ensuring that the right information is available to the LLM in fractions of a second.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Increased Response Precision&lt;/strong&gt;: The combination of RAG with LLMs results in answers that are not only more coherent but also more precise and informative, allowing AI to generate more comprehensive responses across text and multi-modal formats.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Avoiding AI Hallucinations with RAG&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;One of the biggest challenges developers face when using LLMs is dealing with &lt;strong&gt;hallucinations&lt;/strong&gt;. Hallucinations occur when AI systems generate content that is factually incorrect, irrelevant, or misleading, often because the model attempts to fill gaps in its knowledge. Hallucination is a common problem with LLMs, RAG significantly reduces its occurrence by ensuring that responses are anchored in real, external data sources.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;How RAG Reduces Hallucinations:&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Real-time Data Retrieval:&lt;/strong&gt; By accessing a continuously updated knowledge base, RAG allows models to generate responses based on current, factual data rather than outdated or incomplete training sets. This real-time retrieval ensures that AI-generated answers remain relevant and accurate.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Factual Consistency:&lt;/strong&gt; RAG encourages models to produce responses that are aligned with the factual data retrieved. Instead of relying on the model’s built-in knowledge, which might contain inaccuracies or contradictions, it conditions the generation process on accurate and structured information from external sources.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Improved Contextual Understanding:&lt;/strong&gt; One of the key benefits of RAG is its ability to retrieve contextually relevant information to the input query. It provides the AI with access to relevant and targeted data, enabling the model to generate more coherent and contextually appropriate responses. This helps avoid hallucinations where the AI might otherwise improvise.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How Ragie Helps Developers Build Smarter Generative AI Apps&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Ragie is a fully managed RAG-as-a-service platform that simplifies the process of building smarter, RAG-powered AI applications. Developers can easily use Ragie APIs to index and retrieve multi-modal data (text, images, PDFs, etc.) to ensure factual accuracy and minimize hallucinations.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Key Features of Ragie that Help Reduce Hallucinations&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Easily Sync Data:&lt;/strong&gt; Ragie allows developers to &lt;a href="https://www.ragie.ai/connectors" rel="noopener noreferrer"&gt;connect&lt;/a&gt; their AI systems to external data sources like &lt;a href="https://www.ragie.ai/connectors/google-drive" rel="noopener noreferrer"&gt;Google Drive&lt;/a&gt;, &lt;a href="https://www.ragie.ai/connectors/notion" rel="noopener noreferrer"&gt;Notion&lt;/a&gt;, and &lt;a href="https://www.ragie.ai/connectors/confluence" rel="noopener noreferrer"&gt;Confluence&lt;/a&gt;. This ensures that the AI system always has real-time access to up-to-date and relevant information, reducing the chances of generating outdated or inaccurate responses.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Summary Index:&lt;/strong&gt; Ragie’s advanced “&lt;a href="https://www.ragie.ai/blog/intoducing-ragie-fully-managed-rag-as-a-service" rel="noopener noreferrer"&gt;Summary Index&lt;/a&gt;” feature helps prevent document affinity problems, where the AI might disproportionately rely on a small subset of documents that have high semantic similarity when key facts may be distributed across many documents. It helps the AI retrieve the most relevant sections from multiple diverse documents.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Entity Extraction for Structured Data:&lt;/strong&gt; Ragie offers &lt;a href="https://www.ragie.ai/blog/intoducing-ragie-fully-managed-rag-as-a-service" rel="noopener noreferrer"&gt;entity extraction&lt;/a&gt; capabilities, allowing developers to retrieve structured data from unstructured sources like PDFs or scanned documents. This feature helps AI systems understand and contextualize the information better, reducing the chances of hallucinating incorrect information.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Advanced Chunking and Retrieval:&lt;/strong&gt; Ragie uses advanced &lt;a href="https://www.ragie.ai/blog/our-approach-to-table-chunking" rel="noopener noreferrer"&gt;chunking&lt;/a&gt; methods to break down large documents into manageable parts. This ensures that the AI retrieves only the most relevant chunks of information, providing a more focused and accurate response.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Scalable and Fast Pipelines:&lt;/strong&gt; With Ragie, developers don’t need to worry about building and maintaining a complex data ingest and retrieval pipelines. Ragie’s fully managed service is scalable, reliable, and highly performant, allowing developers to focus on delivering their AI products without any compromises.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;It is critical to ensure that AI-generated content is accurate. &lt;strong&gt;RAG&lt;/strong&gt; helps developers build smarter and more context-aware AI applications, significantly reducing the risk of hallucinations.&lt;/p&gt;

&lt;p&gt;Whether you’re building a &lt;a href="https://mearsheimer.ai/" rel="noopener noreferrer"&gt;chatbot&lt;/a&gt;, a knowledge-base, an agent, or an enterprise-grade AI solution, Ragie’s fully managed RAG-as-a-Service platform provides the tools and infrastructure necessary to ensure your AI applications are smarter, faster, and, most importantly, accurate. Ragie SDKs are open-source, please &lt;a href="https://github.com/ragieai" rel="noopener noreferrer"&gt;star us on GitHub&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://ragie.ai/?utm_source=dev.to&amp;amp;utm_medium=blogposts&amp;amp;utm_campaign=organic_content"&gt;&lt;strong&gt;Try Ragie for free —-&amp;gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;‍&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>llm</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
