[Open Source] RAGFlow: Open Source RAG Engine Based on Deep Document Understanding

Written by
Clara Bennett
Updated on:June-13th-2025
Recommendation

The open source RAG engine RAGFlow makes complex data Q&A simple and reliable with its deep document understanding capabilities, and was recognized by 1,000 stars as soon as it was launched on GitHub.

Core content:
1. Intelligent processing system based on deep document understanding, supporting multi-format data analysis
2. Visual text slicing and reference tracing functions, effectively reducing AI illusions
3. Compatible with heterogeneous data sources such as Word/Excel/PDF, providing end-to-end RAG solutions

Yang Fangxian
Founder of 53A/Most Valuable Expert of Tencent Cloud (TVP)

What is RAGFlow?

RAGFlow is an open source RAG (Retrieval-Augmented Generation) engine built on deep document understanding. It provides a streamlined RAG workflow for enterprises and individuals of all sizes, and combines the Large Language Model (LLM) to provide reliable questions and answers and well-reasoned citations for users' various complex format data.

As an end-to-end RAG solution, RAGFlow received 1,000 stars on GitHub on the first day of open source, and is now close to 3,000 stars. It uses a completely redeveloped intelligent document understanding system instead of existing RAG middleware (such as LangChain, LlamaIndex, etc.), ensuring that data is transformed from "Garbage In Garbage Out" to "Quality In Quality Out".

Online Demo

Want to quickly experience the powerful functions of RAGFlow? Please visit the official demo website: https://demo.ragflow.io

Recent Updates

  • •  2025-05-23 : Agent adds Python/JavaScript code executor component
  • •  2025-05-05 : Support cross-language queries
  • •  2025-03-19 : Images in PDF and DOCX can be parsed and described using a multimodal large model
  • •  2025-02-28 : Combined with Internet search (Tavily), it can achieve inference functions similar to Deep Research for any large model
  • •  2024-12-18 : Upgraded DeepDoc’s document layout analysis model
  • •  2024-08-22 : Support the conversion from natural language to SQL statements using RAG technology

Core Features

? "Quality in, quality out"

  • • Based on deep document understanding, it can extract insights from unstructured data in various complex formats
  • • Quickly complete needle-in-the-haystack testing in a truly infinite context (token) scenario
  • • Intelligently recognize document layout, including elements such as titles, paragraphs, line breaks, images and tables
  • • Perform detailed processing on the table and combine the header information to ensure that it is sent to the database in the appropriate form

? Template-based text slicing

  • • Not just intelligence, but more importantly, controllable and explainable
  • • A variety of text templates to choose from, including Q&A, Resume, Paper, Manual, Table, Book, Law, etc.
  • • Provide customized document processing solutions according to different industries and job requirements
  • • Support intelligent and explainable data segmentation to improve processing efficiency and transparency

? Be well-reasoned and minimize hallucinations

  • • Visualization of text slicing process, support for manual adjustment
  • • Well-reasoned: answers provide snapshots of key quotes and support tracing back to the source
  • • Clearly display the source of search results to ensure that the answers generated are based on evidence
  • • Supports visualization of text blocks to facilitate manual intervention and proofreading

? Compatible with various heterogeneous data sources

  • • Supports a wide range of file types, including Word documents, PPT, Excel tables, TXT files, images, PDF, photocopies, copies, structured data, web pages, etc.
  • • Seamlessly handle multiple data formats, making it easy for users to integrate data from different sources
  • • Provide a more comprehensive information base, enhancing the quality of retrieval and generation

? Worry-free, automated RAG workflow

  • • Fully optimized RAG workflows can support a wide range of ecosystems from individual applications to large enterprises
  • • Both large language model LLM and vector model support configuration
  • • Based on multi-way recall and fusion re-ranking, simultaneous keyword full-text search and vector search
  • • Provides easy-to-use API that can be easily integrated into various enterprise systems
  • • Starting from version 0.8, it provides a complete graph-based task orchestration framework, supporting code-free editing of tasks and workflows

System Architecture

The system architecture of RAGFlow consists of the following key components:

  1. 1.  Document parsing layer : automatically recognizes and processes various document formats, and parses out the text, title, paragraph, line break, picture, table and other elements in the document.
  2. 2.  Embedding representation layer : Use the embedding model to convert each text block into a vector representation to capture the semantics and characteristics of the text.
  3. 3.  Index storage layer : Store the generated text block vectors in the vector database and create an index for fast retrieval.
  4. 4.  Similarity retrieval layer : Use the approximate nearest neighbor search algorithm to find the text block most similar to the user's question vector in the vector database.
  5. 5.  Information extraction and screening layer : extract key information and useful content from the retrieved text blocks, and screen and organize them.
  6. 6.  Context construction layer : The extracted and filtered information is integrated with the user’s questions to build an enhanced context that includes external knowledge.
  7. 7.  Model input and text generation layer : The fused context is passed as input to the pre-trained large language model (LLM) to generate the answer text.

Agent Function and Agentic RAG

Starting from version 0.8, RAGFlow officially entered the Agentic era and provided the following important functions:

  • •  Graph-based task scheduling framework : The backend provides a complete graph-based task scheduling system that supports complex workflow design
  • •  Code-free editing of tasks and workflows : The front end supports code-free editing of tasks and workflows, lowering the threshold for use
  • •  Python/JavaScript code executor : supports code execution in a secure sandbox, expanding RAG application capabilities
  • •  Query intent recognition : Introduce query intent to determine how to communicate and improve the quality of interaction
  • •  Self-RAG mechanism : score and rewrite search results to optimize output quality
  • •  Reflective ability : A graph orchestration system that includes "rings" rather than ordinary directed acyclic graph (DAG) workflows

Application Scenario

RAGFlow is widely used in scenarios that require dynamic content generation and rely on external knowledge bases, such as:

  • •  Intelligent customer service : Retrieve relevant information from the enterprise knowledge base in real time to provide customers with accurate and personalized answers
  • •  Contract management : quickly extract key terms and information from contracts to facilitate contract review, risk assessment and management
  • •  Assisted diagnosis : Medical professionals can quickly find relevant medical literature and case data to provide more comprehensive reference for diagnosis and treatment
  • •  Literature review : Students and researchers can quickly locate and analyze relevant academic literature and efficiently complete the writing of literature reviews
  • •  News reporting : Journalists can quickly integrate and refine a large amount of news materials to generate news articles
  • •  Investment analysis : Financial institutions can collect and analyze market data, financial news and other information in real time to generate investment analysis reports
  • •  Legal retrieval and interpretation : Lawyers and legal professionals can quickly retrieve relevant laws, regulations and cases to provide support for case analysis and legal research
  • •  Natural language to SQL : Supports the use of RAG technology to achieve the conversion from natural language to SQL statements, simplifying database queries

Quick Start

Prerequisites

  • • CPU >= 4 cores
  • • RAM >= 16GB
  • • Disk size >= 50GB
  • • Docker >= 24.0.0 & Docker Compose >= v2.26.1
  • • gVisor: Only required if you plan to use the code runner (sandbox) feature of RAGFlow

Start the server

  1. 1.  Make sure vm.max_map_count is not less than 262144
    # Check the current value
    $ sysctl vm.max_map_count

    # If the value is less than 262144, it can be reset
    sudo  sysctl -w vm.max_map_count=262144

    # Permanently modify and add in /etc/sysctl.conf file
    vm.max_map_count=262144
  2. 2.  Clone the repository
    $ git clone https://github.com/infiniflow/ragflow.git
  3. 3.  Start the service using Docker
    cd  ragflow/docker
    # Use CPU for embedding and DeepDoc tasks
    $ docker compose -f docker-compose.yml up -d

    # Use GPU to accelerate embedding and DeepDoc tasks
    # docker compose -f docker-compose-gpu.yml up -d
  4. 4.  Check the server status
    $ docker logs -f ragflow-server

    After a successful startup, you will see the following output:

         ____ ___ ______ ______ __
        / __ \ / | / ____// ____// /____ _ __
       / /_/ // /| | / / __ / /_ / // __ \| | /| / /
      / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ /
     /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/

     * Running

Docker image version

RAGFlow Image Tags
Image size (GB)
Include embedding models?
stability
v0.19.0
≈9
✔️
Stable release
v0.19.0-slim
≈2
Stable release
nightly
≈9
✔️
Unstable nightly builds
nightly-slim
≈2
Unstable nightly builds

Tip: If you encounter the problem that the Docker image cannot be pulled down, you can select the corresponding image of Huawei Cloud or Alibaba Cloud according to the comment prompt of the variable RAGFLOW_IMAGE in the docker/.env file.

  • • Huawei Cloud image name: swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow
  • • Alibaba Cloud image name: registry.cn-hangzhou.aliyuncs.com/infiniflow/ragflow

COMMUNITY & SUPPORT

  • • GitHub repository: https://github.com/infiniflow/ragflow
  • • Technical documentation: https://ragflow.io/docs/dev/
  • • Discord Community: https://discord.gg/4XxujFgUN7
  • • Twitter: https://twitter.com/infiniflowai

RAGFlow vs. other RAG products

RAGFlow has the following unique advantages compared to other RAG products on the market:

  1. 1.  Deep document understanding : RAGFlow does not only rely on simple document retrieval, but also combines semantic understanding of documents. Through in-depth analysis of documents, it can more accurately select content related to user queries.
  2. 2.  Completely redeveloped document processing system : Unlike using ready-made RAG middleware (such as LangChain, LlamaIndex, etc.), RAGFlow has completely redeveloped a set of intelligent document understanding systems to ensure data quality.
  3. 3.  Multi-way recall capability : RAGFlow emphasizes the importance of multi-way recall for RAG, and simultaneously performs keyword full-text search and vector search to improve retrieval accuracy.
  4. 4.  Agentic RAG : Starting from version 0.8, RAGFlow provides a complete graph-based task orchestration framework that supports code-free editing of tasks and workflows, officially entering the Agentic era.
  5. 5.  Diverse document intelligent processing : Provide a variety of templates to meet the document needs of different industries and positions, such as Q&A, Resume, Paper, Manual, Table, Book, Law, etc.

User cases and practices

Case 1: Natural language to SQL query

Through the Agent function of RAGFlow, users can use natural language to describe their needs, and the system can automatically convert them into SQL query statements. For example, if a user enters "query the average score of first-year students", the system can understand the user's intention, analyze the possible database structure, and generate the corresponding SQL query statement:

SELECT AVG (score)  AS  average score 
FROM  Student Grades
WHERE  grade  = 'first grade' 

Case 2: Enterprise Knowledge Base Question Answering System

A company uploaded internal documents (including product manuals, technical documents, training materials, etc.) to RAGFlow and built an enterprise knowledge base. Employees can ask questions in natural language and quickly obtain accurate information, which greatly improves work efficiency and knowledge sharing.

Case 3: Legal Document Analysis

Law firms use RAGFlow to process a large number of legal documents, including contracts, precedents, and regulations. The system can accurately extract key terms and information, helping lawyers quickly locate relevant legal basis and improve the efficiency of case analysis and legal research.

RAG Technology Development Trend

RAG technology is evolving from 1.0 to 2.0, with the following main features:

  1. 1.  Search-centric end-to-end system : The entire RAG is divided into several stages according to the typical search process, including data information extraction, document preprocessing, index building and retrieval.
  2. 2.  AI infrastructure : RAG 2.0 is a typical AI infrastructure, where links are coupled to each other, interfaces are not yet unified, and there are circular dependencies.
  3. 3.  Multiple recall methods : A more comprehensive and powerful database is needed, which provides multiple recall methods and adopts mixed search with multiple methods.
  4. 4.  Full-link optimization : It is necessary to stand on the entire RAG link and optimize each link, including data extraction and cleaning, preprocessing, etc.
  5. 5.  Introducing knowledge graph : Introduce knowledge graph construction in the document preprocessing stage to serve complex question-and-answer scenarios, and introduce improvements such as entity deduplication and token optimization.

As a frontier practitioner of RAG technology, RAGFlow is steadily moving towards RAG 2.0, continuously innovating and optimizing to provide users with higher quality knowledge retrieval and generation services.

Conclusion

As a powerful open source RAG engine, RAGFlow provides a complete set of knowledge retrieval enhancement generation solutions for enterprises and individual users through deep document understanding technology. Whether it is processing documents with complex formats or building a reliable question-answering system, RAGFlow can provide high-quality output results.

As RAGFlow continues to develop and improve, it will play an important role in more fields, helping users better utilize large language models to process and understand complex data and realize truly knowledge-driven AI applications.