Retrieval optimization strategy based on large model knowledge base, device and storage medium

By combining Dify and RAGFlow, a dynamic knowledge graph and multimodal retrieval optimization strategy are constructed, which solves the limitations of large language models in knowledge updating and retrieval efficiency, realizes accurate knowledge retrieval and efficient business orchestration, and provides flexible expansion and security.

CN121166943BActive Publication Date: 2026-03-27CRRC CHANGCHUN RAILWAY VEHICLES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-20
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Traditional large language models have limitations in terms of knowledge update timeliness, domain knowledge adaptability, and the reliability of generated content. They also suffer from insufficient document parsing capabilities, semantic fragmentation due to segmentation strategies, decreased recall due to a single retrieval mechanism, data silos due to difficulties in framework integration, and delays in cross-framework information exchange.

Method used

We construct a retrieval optimization strategy based on a large model knowledge base. By combining Dify and RAGFlow, we adopt dynamic knowledge graphs, adaptive weight fusion, multimodal reflection verification, incremental knowledge distillation, and generative adversarial network optimization to build an enterprise-level RAG knowledge system. This system supports multimodal retrieval and account isolation, achieves modular decomposition and interface standardization, and integrates intelligent document processing and hybrid retrieval.

Benefits of technology

It enables accurate and traceable knowledge retrieval, improves business orchestration efficiency, provides flexible scalability and security, reduces the illusion of large models, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166943B_ABST
    Figure CN121166943B_ABST
Patent Text Reader

Abstract

The application provides a retrieval optimization strategy based on a large model knowledge base, equipment and a storage medium, and belongs to the technical field of retrieval based on a large model, comprising the following steps: constructing a question control flow; constructing a system layered architecture; integrating RagFlow into the workflow of Dify by using the plug-in system and the self-defined tool of Dify; creating, connecting and recall testing of the knowledge base are realized by Dify and RAGFlow; a workflow is created in Dify, the application type, function block and tool component are selected; innovative RAG strategies are implemented, including dynamic knowledge graph construction, adaptive weight fusion, dynamic block strategy, multi-modal reflection verification, incremental knowledge distillation and generative adversarial network optimization; the architecture design principle is followed, modularization is adopted, RESTful API interaction, fault avoidance and data verification are adopted; and an enterprise-level RAG knowledge system is constructed, etc. The application reduces the large model illusion, improves the fault disposal efficiency and supports quick access to new business scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of large model-based retrieval, and in particular relates to a retrieval optimization strategy based on a large model knowledge base, a device and a storage medium. BACKGROUND

[0002] With the rapid development of artificial intelligence technology, large models have been widely used in knowledge question and answer, information retrieval and other fields. However, traditional large language models gradually show limitations in knowledge update timeliness, domain knowledge adaptability and generated content reliability, etc., which are manifested in the problems of easy illusion, disconnection between output content and specific domain knowledge, etc. To cope with these challenges, the retrieval augmented generation (RAG) architecture emerges as the times require, but it faces the following technical bottlenecks in actual landing. Firstly, the document parsing capability is limited, the traditional system has insufficient processing capability for unstructured data such as PDF and scanned documents, and the OCR recognition accuracy is often lower than 85%, resulting in the loss of key information such as charts and formulas; secondly, the semantic rupture caused by fixed block strategy, the fixed granularity block technology solution describes the cross-block rupture, which reduces the retrieval recall rate; then, the single retrieval mechanism limits, the keyword retrieval exists "lexical gap", the recall rate in professional field is low, and the vector retrieval has lower accurate matching rate for low-frequency professional terms; finally, the framework integration and large-scale bottleneck, the functions of Dify and RAGFlow are complementary but difficult to integrate, and the enterprise needs to deploy multiple systems to cause data silos, and the cross-framework information interconnection delay is up to seconds. SUMMARY

[0003] The present application aims to solve the above-mentioned shortcomings of the prior art, and provides a retrieval optimization strategy based on a large model knowledge base, which is developed on our own platform, innovates the Rag strategy, and combines Dify with RagFlow, which is suitable for complex document and unstructured data processing, as well as multi-model collaboration and complex business process scenarios.

[0004] To achieve the above-mentioned application purposes, the present application provides a retrieval optimization strategy based on a large model knowledge base, comprising the following steps:

[0005] (1) Constructing a question control flow for managing the interaction process between the user and the large model;

[0006] (2) Constructing a system layered architecture, which divides the intelligent question system into 7 layers including an interaction layer, a business core processing layer, a data processing layer, a data storage layer, an environment configuration layer, a tool layer and a test layer, each layer independently realizes the preset function and cooperates through data flow and function call;

[0007] (3) Integrating RagFlow into the workflow of Dify by using the plug-in system and custom tools of Dify;

[0008] (4) Collaborate with RAGFlow to build a knowledge base, create, connect, and recall test;

[0009] (5) Create a workflow in Dify, select application types, functional blocks, and tool components;

[0010] (6) Implement innovative RAG strategies, including dynamic knowledge graph construction, adaptive weight fusion, dynamic partitioning strategy, multi-modal reflection verification, incremental knowledge distillation, and generative adversarial network optimization;

[0011] (7) Follow the architecture design principles, adopt modularization, RESTful API interaction, fault avoidance, and data validation;

[0012] (8) Build an enterprise-level RAG knowledge system, implement account isolation, intelligent document processing, and hybrid retrieval;

[0013] (9) Build AI application development modules, support drag-and-drop process design, LLM invocation, and session caching;

[0014] (10) Implement model and permission management, access local / third-party models, and configure RBAC permission systems;

[0015] (11) Deploy Zhi Da Wan Juan, Dify, front-end, and data layer components;

[0016] (12) Implement security protection, including full-link encryption, API authentication, and container security;

[0017] (13) Establish data backup and recovery mechanisms, support real-time backup and version rollback;

[0018] (14) Ensure system scalability and upgrade, through micro-service splitting, API gateway, and gray upgrade;

[0019] (15) Perform system initialization verification, check environment, service status, and function test.

[0020] Further, the specific construction of the system layered architecture includes:

[0021] Interaction layer: Develop user interface modules to receive user natural language query requests and return formatted results;

[0022] Business core processing layer: Including semantic analysis module, query routing module and execution plan generation module, used for extracting user intent, judging data source type and generating execution scheme;

[0023] Data processing layer: Including vector conversion module and data cleaning and writing module, used for text vector conversion and data standardization processing;

[0024] Data storage layer: Deploy MySQL, Milvus, HBase and Elasticsearch to store structured business data, vector data and support distributed data storage and retrieval;

[0025] Environment configuration layer: Integrate Docker containerization technology to create independent containers for each layer component and configure network, resources and dependent environment;

[0026] Tool layer: Develop a library of tool functions for system-wide reuse, including data formatting, user input filtering, vector processing and configuration parsing tools;

[0027] Test layer: Including unit testing and integration testing, to verify the correctness of the functions of each layer core module and the overall synergy of the system.

[0028] Further, the integration of Dify and RAGFlow specifically includes:

[0029] Deploy RAGFlow and Dify using Docker, and implement port isolation by modifying docker-compose.yml;

[0030] Create an independent Docker Compose project namespace to avoid dependency conflicts between services;

[0031] Modify the default port of RAGFlow and implement load balancing through Nginx reverse proxy;

[0032] Append API version control path to the Base URL of RAGFlow to support multiple versions running in parallel;

[0033] Implement API authentication through OAuth 2.0 JWT token to support high-concurrency requests and error retry mechanism;

[0034] Connect external knowledge base in Dify, perform recall test and create ChatBot.

[0035] Further, the innovative RAG strategy includes:

[0036] Build a dynamic knowledge graph based on graph neural networks, with edge weights dynamically adjusted by the correlation confidence generated by LLM;

[0037] Adopt adaptive weight fusion algorithm to combine graph vector BM25 feature vector for retrieval result fusion;

[0038] A Q-learning algorithm is designed to dynamically adjust the chunking strategy. The state space includes document semantic density and entity density. The action space includes chunk size and overlap ratio. The reward function is based on retrieval quality indicators.

[0039] A multi-modal reflection verification mechanism is designed to calculate a joint confidence score through text and image paths.

[0040] An incremental knowledge distillation training is designed to build a teacher model and a student model, optimized through a knowledge distillation loss function.

[0041] A generative adversarial network is constructed to optimize the retrieval process. The generator is based on the T5 architecture, and the discriminator evaluates the retrieval quality.

[0042] Further, the enterprise-level RAG knowledge system construction includes:

[0043] A knowledge base management module with account isolation is built.

[0044] An intelligent document processing module is developed to support OCR extraction, intelligent chunking, and multi-modal vectorization of formats such as Word, Excel, and PDF.

[0045] Based on Elasticsearch, hybrid retrieval is deployed, combining vector, BGE, and BM25 retrieval, with multi-path recall and Reranker sorting.

[0046] Historical dialog injection optimizes retrieval results.

[0047] Further, the AI application development module includes:

[0048] A drag-and-drop visual flow design interface is developed based on ReactFlow.

[0049] LLM calling and RAG retrieval nodes are integrated.

[0050] Redis is used to cache sessions, enabling dynamic context transfer and long-term memory for multi-round dialogues.

[0051] Further, the model and permission management implementation includes:

[0052] An LLM standard interface is developed to access local and third-party models.

[0053] Model parameters and versions are visualized for configuration.

[0054] Based on the RBAC model, a permission system is built to support document-level and function-level fine-grained permission control.

[0055] Permission verification is integrated into all operational aspects.

[0056] Further, the security protection implementation includes:

[0057] Full-link TLS 1.3 encryption and static data AES-256 encryption;

[0058] API uses 32-bit Key and JWT double token authentication;

[0059] Containers use read-only file systems and network isolation;

[0060] Local deployment does not access public networks.

[0061] Further, the data backup and recovery includes:

[0062] MySQL real-time binlog and daily full backup;

[0063] Elasticsearch daily snapshot;

[0064] MinIO cross-region replication;

[0065] Monthly test recovery, record change history support version backtracking.

[0066] Further, the system scalability and upgrade includes:

[0067] Microservice split module, plug-in encapsulation optional function;

[0068] API gateway unified entrance, realize authentication, flow limiting and monitoring;

[0069] Formulate RESTful interface specification;

[0070] Test before upgrading the dependent framework, and avoid business interruption through gray upgrade.

[0071] The application also provides an electronic device, including a memory and a processor, the memory stores a computer program, and the processor realizes the steps of the above search optimization strategy when executing the computer program.

[0072] The application also provides a computer readable storage medium, which stores a computer program, and the computer program realizes the steps of the above search optimization strategy when executed by a processor.

[0073] The application has the following advantages compared with the prior art:

[0074] Precise knowledge retrieval: the RAG knowledge system of Zhi Da Wanjuan provides precise and traceable knowledge, reducing the illusion of large models;

[0075] Efficient business orchestration: Dify's visual workflow quickly orchestrates business logic, improving fault handling efficiency;

[0076] Flexible expansion capability: modular split and interface standardization design, supporting rapid access to new business scenarios;

[0077] Security assurance: multi-level protection system such as full-link encryption and container security;

[0078] User experience optimization: natural language interaction reduces the operation threshold and improves the use efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0079] Figure 1 is a whole architecture diagram;

[0080] Figure 2 is a Dify knowledge base management interface. DETAILED DESCRIPTION

[0081] In order to better understand the purpose, structure and function of the present application, the present application of a retrieval optimization strategy based on a large model knowledge base, equipment and storage medium will be further described in detail below in combination with the drawings.

[0082] Reference Figure 1 A retrieval optimization strategy based on a large model knowledge base includes the following steps.

[0083] 1) Construct a question control flow for effectively managing the interaction process between the user and the large model.

[0084] 2) Construct a system layered architecture: divide the intelligent question system into 7 layers of interaction layer, business core processing layer, data processing layer, data storage layer, environment configuration layer, tool layer and test layer, each layer independently realizes the preset function and cooperates through data flow and function call to form a modular and maintainable system architecture system, providing framework support for subsequent function landing of each layer, and the specific architecture of each layer is as follows.

[0085] 2.1) Interaction layer construction: develop a user interface module to have the function of receiving user input natural language query request, and support generating and returning formatted results such as text and chart data; set the core data transmission logic, the interaction layer immediately transmits the query text to the business core processing layer after receiving the user request, and then returns the result to the user after receiving the processing result feedback from the business core processing layer, completing the interaction closed loop of "receiving request-transmitting request-feedback result".

[0086] 2.2) The business core processing layer includes semantic analysis, query routing and execution plan:

[0087] a) Semantic analysis: Develop a semantic analysis module based on a pre-set prompt template (Prompt) to extract intent information (such as data query requirements, statistical analysis requirements) and constraints (such as time range, data dimension limit) from user natural language queries through template matching and semantic recognition algorithms, and output structured intent and constraint results to provide the basis for subsequent query routing;

[0088] b) Query routing: Build a query routing module with pre-set routing judgment rules to determine the type of data source corresponding to the user request based on the intent and constraint results output by the semantic analysis module. If the request requires calling external data interfaces, it is determined as HTTP interface calling type. If the request requires querying system internal stored data, it is determined as database query type, and the routing judgment result is output.

[0089] c) Execution plan: Build an execution plan generation module to generate corresponding execution schemes based on query routing results. If it is HTTP interface calling type, generate HTTP request parameters including interface address, request parameters, and request method. If it is database query type, generate cross-database SQL statements that adapt to multiple databases. At the same time, develop a calling module to call corresponding database clients (such as MySQL client) or interface clients to execute the generated execution plan and obtain the original query result.

[0090] 2.3) Data processing layer includes vector conversion, data cleaning and writing two aspects:

[0091] a) Vector conversion: Develop a text vector conversion module using a pre-set vector embedding algorithm (such as BERT model) to convert text data (such as user historical query text, dictionary data) in the system into fixed-dimension vector embeddings, ensuring that the vector data meets the retrieval format requirements of Milvus vector database, and providing data basis for vector retrieval;

[0092] b) Data cleaning and writing: Build a data cleaning and formatting module to clean (such as remove invalid characters, correct data format) and standardize the original text data and vector data. Develop a data writing module to insert the cleaned and formatted data and vector data into Milvus vector database, providing high-quality data support for subsequent semantic matching retrieval and dictionary data recall functions of the system.

[0093] 2.4) Data storage layer component deployment: Deploy MySQL relational database, configure database table structure and index, used to store structured business data in the system (such as user query log, interface meta information); Deploy Milvus vector database, set vector dimension, index type (such as IVF_FLAT index) and metric method (such as Euclidean distance), used to store vector data and support semantic similarity retrieval; Deploy HBase and Elasticsearch, configure storage and retrieval parameters according to specific scene requirements (such as mass unstructured data storage, full-text retrieval requirements), used for distributed data storage and efficient retrieval in specific scenarios.

[0094] 2.5) Environment configuration layer implementation: Integrate Docker containerization technology, develop system deployment and environment configuration platform; Create independent Docker containers for data storage layer (Milvus, MySQL, HBase, Elasticsearch), business core processing layer, and interaction layer, configure network parameters (such as IP address, port mapping) of each container, resource allocation (such as CPU core number, memory size), and dependent environment (such as operating system version, software dependency package), to ensure stable operation of each component in a unified container environment.

[0095] 2.6) Tool layer implementation: Develop a tool function library for system-wide reuse, including data formatting tools (for converting raw query results to text, chart format), user input filtering tools (for filtering invalid or illegal user query inputs), vector processing tools (for vector data normalization, dimension adjustment), and configuration parsing tools (for parsing system global configuration files); Establish tool calling interfaces, so that business core processing layer (semantic analysis, result formatting section), data processing layer (vector generation, data cleaning section) can directly call functions in the tool function library through interfaces, improving system function reuse.

[0096] 2.7) Test layer includes unit testing and integration testing:

[0097] a) Unit testing: Write unit test cases for each layer core module - for business core processing layer, write semantic analysis accuracy test cases and query routing correctness test cases; for data processing layer, write vector generation precision test cases and data cleaning effectiveness test cases; for data storage layer, write data query accuracy test cases; Execute test cases through unit testing framework to verify the correctness of individual module functions;

[0098] b) Integrated testing: Design cross-layer integrated test cases to cover the complete data flow conversion link of "interaction layer - business core processing layer - data processing layer - data storage layer", simulate real user query scenarios (such as input natural language query "query sales data in the past 30 days"), verify the correctness of data transmission and function collaboration between modules, and ensure that the system functions are not in conflict and data flow is normal during overall operation.

[0099] 2.8) System full-process data flow conversion: The user initiates a natural language query through the interaction layer, and the interaction layer passes the query request to the business core processing layer; the business core processing layer performs semantic analysis, query routing, execution plan generation and execution operation in turn, if the query routing result is vector retrieval requirement, triggers the data processing layer to call the vector conversion module to process the query text, and interacts with the Milvus vector library to obtain the retrieval result; the business core processing layer receives the original results returned by each data source, calls the data formatting tool of the tool layer to process the results, and then passes the formatted results to the interaction layer; the interaction layer feeds back the results to the user, completing the full process; during the process, the environment configuration layer ensures the stable operation of each component through containerization technology, and the test layer verifies the correctness of each function in real time.

[0100] 3) Use the plug-in system and custom tools of Dify to integrate RagFlow into the workflow of Dify, the specific implementation steps are as follows:

[0101] 3.1) RAGFlow and Dify are deployed using Docker;

[0102] 3.2) Based on the Docker network namespace isolation technology, by modifying the host port mapping parameter (such as 8080:80) in docker-compose.yml, realize the port isolation of RAGFlow and Dify, avoid the traditional port preemption problem;

[0103] 3.3) Save the modified docker-compose.yml file and restart the container to make the new configuration take effect;

[0104] 3.4) Restart the service using docker-compose down and docker-compose up -d.

[0105] 4) Dify+RAGFlow collaborative construction detailed operation specific implementation steps are as follows:

[0106] 4.1) Create an independent Docker Compose project namespace through the docker compose -p dify_docker up -d parameter, isolate the network and volume configuration, and avoid service dependency conflicts;

[0107] 4.2) Access http: / / localhost:8080 in the browser to check if RAGFlow is running normally. If the service starts normally, the Web interface of RAGFlow can be seen;

[0108] 4.3) Modify the default port of RAGFlow from 80 to 8080 to avoid conflict with the default API port of Dify, and realize load balancing through Nginx reverse proxy;

[0109] 4.4) Append / api / v1 / dify after the Base URL of RAGFlow to adopt the RESTful API version control strategy (RFC 6585), support multiple versions running in parallel, and specify the protocol version through the request header Accept: application / vnd.dify.v1+json;

[0110] 4.5) In the knowledge base page corresponding to RAGFlow, copy the complete external knowledge base ID on the suffix of the address bar through the browser;

[0111] 4.6) After completing the API connection of Dify and RAGFlow, click the "Connect external knowledge base" button to create a knowledge base;

[0112] 4.7) Input the external knowledge base ID just copied;

[0113] 4.8) Perform recall test;

[0114] 4.9) Implement commercial API authentication through OAuth 2.0 JWT token, encapsulate RESTful interface adaptation layer in Dify plug-in system, support concurrent requests with QPS≥500, and use exponential backoff algorithm for error retry mechanism;

[0115] 4.10) Enter the system prompt word in Studio;

[0116] 4.11) Bind the created knowledge base;

[0117] 4.12) Select the used model to perform question and answer test, and create ChatBot.

[0118] 5) The specific implementation steps of creating workflow are as follows:

[0119] 5.1) Select the required core functions of different application types in the Studio module of Dify;

[0120] 5.2) Select the function block (Block);

[0121] 5.3) Select Tool component.

[0122] 6) The innovative Rag strategy scheme is as follows:

[0123] 6.1) Construct a dynamic knowledge graph based on graph neural network (GNN), and the edge weight is dynamically adjusted by the correlation confidence generated by LLM. When retrieving, perform the following operations in parallel: vector semantic retrieval (embedding model: Sentence-BERT), graph traversal retrieval (based on 2-hop relationship expansion), and BM25 keyword retrieval;

[0124] 6.2) Adopt adaptive weight fusion algorithm , where is the Sigmoid function, is the graph vector BM25 feature vector;

[0125] 6.3) Design a Q-learning algorithm to dynamically adjust the block strategy, and the specific strategy is as follows:

[0126] a) State space: document semantic density (TF-IDF variance), entity density (NER count);

[0127] b) Action space: block size (128-1024 characters), overlap ratio (0-30%);

[0128] c) Reward function: , optimize the policy network through PPO algorithm to generate the optimal block scheme;

[0129] 6.4) Design a multi-modal reflection verification mechanism, introduce a visual-semantic dual-path verification module, and the mechanism is as follows:

[0130] a) Text path: LLM generates explanation generation;

[0131] b) Image path: OCR extracts document charts, and CLIP model calculates the matching degree of text and images;

[0132] c) Design joint confidence score, , is the number of supporting arguments, and are calculated by SBERT and ResNet-50;

[0133] 6.5) Design incremental knowledge distillation training, construct a two-stage training framework, and the specific construction scheme is as follows:

[0134] a) Teacher model: multi-query retrieval strategy based on RAG-Fusion, and adopt 3-layer cross-attention query rewriting;

[0135] b) Student mode: 4-layer Transformer (number of heads = 4), training data is divided into 8:2 teacher supervision and reinforcement learning stage;

[0136] 6.6) Design knowledge distillation loss function: , where is the temperature coefficient, dynamically adjusting the knowledge transfer strength;

[0137] 6.7) Construct a generative adversarial network (GAN) optimization retrieval process as follows:

[0138] a) Generator: adversarial query rewriter (based on T5 architecture);

[0139] b) Discriminator: hybrid retrieval quality evaluator (vector similarity + semantic coherence).

[0140] Design training objectives, , through gradient penalty terms to enhance robustness.

[0141] 7) Architecture design principles: modularize core business (RAG knowledge system, model management) and extension business, and interact between modules through RESTful API loose coupling; configure MySQL master-slave replication, service hot switching to avoid single point of failure, and establish data and business flow verification rules to ensure data correctness.

[0142] 8) Enterprise-level RAG knowledge system construction: build an account-isolated knowledge base management module, develop an intelligent document processing module (OCR extraction + intelligent segmentation + multi-modal vectorization) supporting Word / Excel / PDF; deploy hybrid retrieval (vector + BGE + BM25) based on Elasticsearch8.7.1, configure multi-path recall + Reranker sorting, and inject 3 rounds of historical dialogue optimization results.

[0143] 9) AI application development module construction: develop a drag-and-drop visual flow design interface based on ReactFlow, integrate LLM calling (GLM-32B-0414), RAG retrieval, etc. nodes; use Redis to cache sessions to realize dynamic context transmission of workflow nodes, and support long-term memory for multi-turn dialogue.

[0144] 10) Model and permission management implementation: develop LLM standard interface to access local / third-party models, and visualize configuration of model parameters and versions; build a permission system based on RBAC model, support document-level / functional-level fine-grained permission control, and integrate permission verification into all operation links.

[0145] 11) Zhi Da Wanjuan deployment: Server meets CPU 32 cores / memory 64G / hard disk 1T, Ubuntu 20.04, Docker >= 24.0.3; decompress the service package to / data, modify the config.env configuration model / vector service address, execute init_services.sh, and then start with docker compose, and the front-end code is mounted to Nginx.

[0146] 12) Dify deployment: decompress the service package to / data / dify-1.1.3, import the image, and then start with docker compose; configure tts / asr, Reranker interface, and link Zhi Da Wanjuan search module.

[0147] 13) Front-end and data layer deployment: Nginx is configured to point to each front-end directory, and Nginx is started; deploy MySQL 8.0 (user / system data), Elasticsearch 8.7.1 (document / question and answer pair), Neo4j (knowledge graph), Redis (cache), and MinIO (document storage).

[0148] 14) Security implementation: full-link TLS1.3 encryption, static data AES-256 encryption; API uses 32-bit Key+JWT double Token (Access Token 2 hours / Refresh Token 7 days); container uses read-only file system+network isolation, and local deployment does not access public network.

[0149] 15) Data backup and recovery: MySQL real-time binlog+daily full backup, Elasticsearch daily snapshot, MinIO cross-region replication; monthly test recovery, record change history to support version backtracking.

[0150] 16) Scalability and upgrade: micro-service split module, plug-in encapsulation of optional functions; API gateway unified entry (authentication / rate limiting / monitoring), RESTful interface specification; test before upgrading dependent framework, and avoid business interruption during gray upgrade.

[0151] 17) System initialization verification: check Conda / Docker / port / video card environment; use docker ps to confirm service status, and check logs for no ERROR; simulate manual upload, query fault, and workflow arrangement to verify full functionality.

[0152] Embodiment: In the actual operation and maintenance scene of the 400 km / h high-speed train intelligent operation and maintenance technology digital twin scene large model application technology research project platform, the overall architecture of the application is as follows: Figure 1As shown, when the maintenance engineer faces a fault of a certain core system of the EMU (such as voltage fluctuation, module alarm), a natural language query request can be input through the Web interface of the platform interaction layer. After user authentication, the request is transmitted to the business core processing layer via the RESTful API. The business core processing layer first extracts the core intent of "troubleshooting + disposal guidance" and the constraint condition of "auxiliary power supply system" based on the preset Prompt template with the help of the semantic analysis module, and then determines the calling of the RAG knowledge system of Zhi Da Wanjuan and the workflow arrangement capability of Dify through query routing. Subsequently, Zhi Da Wanjuan starts hybrid retrieval (combining vector retrieval, full-text retrieval, and keyword retrieval), retrieves the knowledge such as maintenance manual fragments and historical fault cases of the system from the Elasticsearch of the data layer, Dify calls the locally deployed large model to generate structured disposal guidance combining the retrieved knowledge, the data layer stores the query log of this time into MySQL, updates the association relationship between faults and disposal solutions in the Neo4j knowledge graph, and caches the high-frequency retrieval results through Redis, and finally the interaction layer feeds back the formatted guidance book (including text explanation and visual process) to the engineer. After the engineer executes the disposal, the feedback data can be fed back to the engineer. Based on the feedback data, the knowledge accuracy is optimized in Zhi Da Wanjuan, and the Dify knowledge base management interface is as shown in Figure 2 The process fully embodies the advantages of the platform, relies on the "Zhi Da Wanjuan + Dify" dual-engine fusion architecture in the document, the RAG knowledge system of Zhi Da Wanjuan can provide accurate and traceable knowledge and reduce the illusion of large models; the visual workflow of Dify can quickly arrange business logic and improve fault disposal efficiency; the modularization splitting and interface standardization design in accordance with the document design principle make it only need to develop corresponding modules when adding other system fault operation and maintenance scenes in the future, without changing the core architecture; the hierarchical architecture supports modularized upgrade and maintenance. Through full-link TLS1.3 protocol transmission encryption, AES-256 storage encryption, and other security strategies such as container read-only file system (such as Docker read-only volume mounting), a multi-level protection system is built. The natural language interaction and visual display function further reduce the operation threshold of engineers, and the design strictly follows the three core targets of openness, high reliability, and security in the system requirement webpage, providing effective support for the intelligent operation and maintenance business of EMU.

[0153] The application is directed to intelligent operation and maintenance of a high-speed train set, takes LLM+RAG as a technical route, constructs a double-engine platform of "Zhidu Wanjuan + Dify", divides 7-layer architecture, covers core functions such as knowledge management, AI application development, model and permission management, is deployed through Docker, is matched with security strategies such as full-link encryption, supports modular extension, aims at automatically generating operation and maintenance disposal guidance, and improves maintenance efficiency and user experience. Overcome the multiple difficulties of traditional operation and maintenance of the train set: 1. The problem of low efficiency and slow fault disposal of manual consultation of manual, the efficiency is improved through the automatic generation of operation and maintenance guidance book by LLM+RAG technology; 2. The problem of difficult integration and inaccurate retrieval of multi-format operation and maintenance knowledge, the document intelligent block and mixed retrieval are realized by Zhidu Wanjuan; 3. Data security risk is guaranteed by full-link encryption and fine-grained permission control. The operation and maintenance disposal guidance book is automatically generated, the knowledge is accurately managed, the modular extension is realized, the full-link security guarantee and the multi-system collaborative operation are realized.

Claims

1. A retrieval optimization strategy based on a large model knowledge base, characterized in that, Includes the following steps: (1) Construct a question control process to manage the interaction process between users and the large model; (2) Construct a layered architecture for the system, dividing the intelligent data query system into seven layers: interaction layer, business core processing layer, data processing layer, data storage layer, environment configuration layer, tool layer and test layer. Each layer independently implements preset functions and works together through data flow and function calls. (3) Integrate RagFlow into Dify’s workflow using Dify’s plugin system and custom tools; (4) Through the collaborative construction of Dify and RAGFlow, the creation, connection and recall testing of the knowledge base are realized; (5) Create a workflow in Dify, selecting the application type, function block, and tool component; (6) Implement innovative RAG strategies, including dynamic knowledge graph construction, adaptive weight fusion, dynamic block strategy, multimodal reflection verification, incremental knowledge distillation and generative adversarial network optimization; (7) Follow the architectural design principles, adopt modular decomposition, RESTful API interaction, fault avoidance and data verification; (8) Construct an enterprise-level RAG knowledge system to achieve account isolation, intelligent document processing, and hybrid retrieval; (9) Build an AI application development module to support drag-and-drop process design, LLM calls and session caching; (10) Implement model and permission management, connect to local / third-party models, and configure the RBAC permission system; (11) Deploy Zhida Wanjuan, Dify, front-end and data layer components; (12) Implement security protection, including end-to-end encryption, API authentication and container security; (13) Establish a data backup and recovery mechanism to support real-time backup and version rollback; (14) Ensure system scalability and upgradeability through microservice decomposition, API gateway, and canary upgrades; (15) Perform system initialization verification, check the environment, service status and functional testing; The innovative RAG strategy includes: A dynamic knowledge graph based on graph neural networks is constructed, and the edge weights are dynamically adjusted through the association confidence generated by LLM; An adaptive weighted fusion algorithm is used to fuse retrieval results by combining graph vector BM25 feature vectors. The Q-learning algorithm is designed to dynamically adjust the chunking strategy. The state space includes document semantic density and entity density, the action space includes chunk size and overlap ratio, and the reward function is based on retrieval quality indicators. Design a multimodal reflection verification mechanism to calculate joint confidence scores using text paths and image paths; Design incremental knowledge distillation training, construct teacher and student models, and optimize them through the knowledge distillation loss function; A generative adversarial network is constructed to optimize the retrieval process. The generator is based on the T5 architecture, and the discriminator evaluates the retrieval quality.

2. The retrieval optimization strategy according to claim 1, characterized in that, The specific construction of the system's layered architecture includes: Interaction layer: Develop the user interface module to receive user natural language query requests and return formatted results; The core business processing layer includes a semantic parsing module, a query routing module, and an execution plan generation module, which are used to extract user intent, determine data source type, and generate execution plans. Data processing layer: includes a vector transformation module and a data cleaning and writing module, used for text vector transformation and data standardization processing; Data storage layer: Deploys MySQL, Milvus, HBase, and Elasticsearch to store structured business data, vector data, and support distributed data storage and retrieval; Environment configuration layer: Integrates Docker containerization technology to create independent containers for each component and configure network, resources and dependency environment; Tool layer: Develop a reusable utility function library for the entire system, including data formatting, user input filtering, vector processing, and configuration parsing tools; Test layer: Includes unit tests and integration tests, used to verify the functional correctness of core modules in each layer and the overall system synergy.

3. The retrieval optimization strategy according to claim 1, characterized in that, The integration of Dify with RAGFlow specifically includes: RAGFlow and Dify are deployed using Docker, and port isolation is achieved by modifying docker-compose.yml. Create a separate Docker Compose project namespace to avoid dependency conflicts between services; Modify the default port of RAGFlow to achieve load balancing through Nginx reverse proxy; Append the API version control path to the RAGFlow Base URL to support parallel execution of multiple versions; API authentication is achieved through OAuth 2.0 JWT tokens, supporting high-concurrency requests and error retry mechanisms; Connect to an external knowledge base in Dify, conduct recall tests, and create a ChatBot.

4. The retrieval optimization strategy according to claim 1, characterized in that, The construction of the enterprise-level RAG knowledge system includes: Build an account-isolated knowledge base management module; Develop an intelligent document processing module that supports OCR extraction, intelligent segmentation, and multimodal vectorization of Word, Excel, PDF, and other formats; Deploy hybrid search based on Elasticsearch, combining vector, BGE and BM25 search, and configure multi-path recall and Reranker ranking; Injecting historical conversations optimizes search results.

5. The retrieval optimization strategy according to claim 1, characterized in that, The AI ​​application development module includes: Develop a drag-and-drop visual workflow design interface based on ReactFlow; Integrates LLM calls and RAG retrieval nodes; Using Redis to cache sessions enables dynamic context passing between workflow nodes and long-term memory for multi-turn conversations.

6. The retrieval optimization strategy according to claim 1, characterized in that, The implementation of the model and access control includes: Develop LLM standard interfaces to integrate local and third-party models; Visualize the configuration model parameters and version; A permission system based on the RBAC model is built, supporting fine-grained permission control at both the document and function levels. Integrate permission verification into all operational processes.

7. The retrieval optimization strategy according to claim 1, characterized in that, The security protection measures include: End-to-end TLS 1.3 encryption and AES-256 encryption for data at rest; The API uses a dual-token authentication system consisting of a 32-bit key and a JWT token. Containers use read-only file systems and network isolation; Local deployments do not connect to the public network.

8. The retrieval optimization strategy according to claim 1, characterized in that, The data backup and recovery includes: Real-time MySQL binlog and daily full backup; Elasticsearch daily snapshot; MinIO cross-region replication; Monthly testing and recovery, recording change history to support version rollback.

9. The retrieval optimization strategy according to claim 1, characterized in that, The system scalability and upgradeability include: Microservices are broken down into modules, and optional functions are encapsulated in a plug-in manner. The API gateway provides a unified entry point for authentication, rate limiting, and monitoring. Define RESTful API specifications; Test before upgrading the dependency framework, and use canary rollouts to avoid business interruptions.

10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the retrieval optimization strategy according to any one of claims 1 to 9.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the retrieval optimization strategy according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Government information consultation system based on large language model

    CN120653787A