Intelligent operation and maintenance method and system based on offline tag generation and query enhancement
Patent Information
- Application Number
- CN202511450980.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-11
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2045-10-11
AI Technical Summary
但构建高质量的工业领域标注数据集通常需要依赖与专业人员,标注成本高昂,成为限制系统优化的关键瓶颈
降低数据构建成本:通过利用大规模语言模型自动生成多视角查询增强短语,减少对专业人员人工标注的依赖,降低了工业领域高质量数据集构建的时间和经济成本。
Smart Images

Figure CN121388096B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent operation and maintenance of industrial faults, and particularly relates to an intelligent operation and maintenance RAG method and system based on offline tag generation and query enhancement. Background Technology
[0002] Fault repair of industrial equipment plays a crucial role in ensuring the safe and stable operation of production systems, protecting the personal safety of operators, and improving production efficiency and economic benefits. Because industrial systems involve various equipment and complex operating conditions, fault diagnosis and repair often rely on interdisciplinary and cross-domain expertise. Training qualified fault repair personnel and ensuring the standardization and correctness of repair work typically requires a significant investment of resources and costs.
[0003] In recent years, large-scale language models (LLMs) have shown significant potential in handling knowledge-intensive tasks such as question answering and dialogue generation. However, because they are primarily pre-trained on general internet corpora, the distribution of the pre-trained text data differs from the specialized corpora in industrial operations and maintenance. This difference makes the models prone to "illusion" phenomena in industrial scenarios, where the generated results do not match the actual domain knowledge. To mitigate the illusion problem, it is usually necessary to fine-tune the pre-trained model or introduce a retrieval-enhanced generation (RAG) mechanism. Compared to fine-tuning, RAG can retrieve domain knowledge bases in real time during the generation process and answer questions based on relevant documents, thus achieving a "reliable" generation method. This not only reduces the risk of illusion but also improves the traceability and credibility of the results, making it more suitable for industrial operations and maintenance scenarios with high reliability requirements.
[0004] However, due to the differences in expression and knowledge structure between general corpora and industrial texts, pre-trained text retrieval models in traditional RAG systems often perform poorly in industrial applications, struggling to effectively align query and target text blocks. Therefore, it is necessary to introduce relevant domain datasets to improve recall performance through policy optimization or model training. However, constructing high-quality industrial labeled datasets typically requires specialized personnel, resulting in high annotation costs and becoming a key bottleneck limiting system optimization. Summary of the Invention
[0005] The purpose of this invention is to solve the problems existing in the prior art and to provide an intelligent operation and maintenance RAG method and system based on offline tag generation and query enhancement.
[0006] To achieve the above-mentioned objectives, the present invention specifically adopts the following technical solution: In a first aspect, the present invention provides an intelligent operation and maintenance RAG method based on offline tag generation and query enhancement, which includes the following steps: S1. Acquire text data related to the target industrial equipment and perform unified text processing, then divide the processed document into several text blocks using a sliding window method; S2. Use the first large-scale language model to label the text blocks obtained in step S1 with query questions that match their content, and build an initial dataset based on the generated query questions and their corresponding text blocks; S3. The initial dataset in step S2 is further processed using the first large-scale language model to automatically generate query augmentation phrases for text blocks as offline labels. The query augmentation phrases are then concatenated before the corresponding text blocks to form augmented text blocks. The final question-text pair dataset is constructed from the augmented text blocks and the query questions. S4. Obtain a pre-trained dual-tower text embedding model and train the dual-tower text embedding model on a question-text pair dataset using the information noise contrastive estimation loss function of contrastive learning. S5. Using the query augmentation phrases generated in step S3 and the dual-tower text embedding model trained in step S4, construct an offline text vector library based on FAISS. S6. Obtain the natural language question raised by the user as the user query. The trained dual-tower text embedding model transforms the user query into a query semantic vector. Calculate the similarity between the query semantic vector and each text embedding vector in the text vector library. Retrieve the candidate text block with the highest similarity and input it as context into the second large-scale language model. Generate the answer by referencing the candidate text block.
[0007] Based on the above scheme, each step can be implemented in the following preferred manner.
[0008] As a preferred embodiment of the first aspect mentioned above, when performing text segmentation, S1 additionally sets two types of symbols: the first symbol is used as a statement segmentation mark, and the second symbol is used as a table or code block segmentation mark; after presetting the maximum segmentation length, the first statement segmentation mark position not exceeding the length is located as the end point of the segmentation, and the table or code block enclosed by the second symbol is regarded as a separate text block, while an overlapping interval is provided between adjacent text blocks.
[0009] As a preferred embodiment of the first aspect mentioned above, in S2, the specific process of constructing the initial dataset is as follows: after selecting a preset number of text blocks and manually annotating them, the manually annotated query questions and corresponding text blocks are used as standardized examples and input together with the unannotated text blocks into the first large-scale language model. A corresponding query question is generated for each unannotated text block, and finally, the initial dataset is constructed from all the generated query questions and text blocks.
[0010] As a preferred embodiment of the first aspect mentioned above, in S4, the information noise contrast estimation loss function... The calculation method is as follows: in, This indicates the first loss that the query question points to in the text block; This indicates that the text block points to the second loss of the query problem; This indicates the number of sample pairs contained in a training batch, where each sample pair consists of an augmented text block and its corresponding query question; Indicates and The corresponding set of positive samples of text blocks Indicates the first The query problem in the sample pair; Indicates and The corresponding set of positive samples for the query questions. Indicates the first Enhanced text blocks in the sample pair; , and Both represent sample pair indices; Indicates the natural index; express and Similarity; express and Similarity; express The query embedding vector obtained after the dual-tower text embedding model; express The query embedding vector obtained after the dual-tower text embedding model Indicates the first The query problem in the sample pair; express The text embedding vector obtained after the dual-tower text embedding model Indicates the first Enhanced text blocks in the sample pair.
[0011] As a preferred embodiment of the first aspect mentioned above, the similarity between the query embedding vector and the text embedding vector is calculated using the following formula. and : in, It is a temperature coefficient used to adjust the smoothness of the distribution.
[0012] As a preferred embodiment of the first aspect mentioned above, in S5, the specific process of constructing the text vector library is as follows: the query enhancement phrase is concatenated before the corresponding text block to form an enhanced text block, and then the enhanced text block is input into the trained dual-tower text embedding model to obtain the final semantic vector representation of the text block. The final semantic vector representations of all text blocks are uniformly stored in the FAISS-based vector retrieval engine, thereby forming an offline text vector library.
[0013] Secondly, the present invention provides an intelligent operation and maintenance RAG system based on offline tag generation and query enhancement, which includes one or more processors for executing computer program instructions stored in non-volatile memory to implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement described in any of the solutions of the first aspect above.
[0014] Thirdly, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, can implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in any of the solutions of the first aspect above.
[0015] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in any of the solutions of the first aspect.
[0016] Fifthly, the present invention provides a computer electronic device, which includes a memory and a processor; The memory is used to store computer programs; The processor is configured to implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in any of the solutions of the first aspect above when executing the computer program.
[0017] Compared with the prior art, the present invention has the following advantages: Reduce data construction costs: By leveraging large-scale language models to automatically generate multi-perspective query-enhanced phrases, the reliance on manual annotation by professionals is reduced, thus lowering the time and economic costs of building high-quality datasets in the industrial sector.
[0018] Improving text recall accuracy: The contrastive learning InfoNCE loss function is introduced to train a dual-tower text embedding model, which enables multiple queries on the same text block to maintain semantic consistency in the vector space, effectively improving the accuracy and robustness of retrieval in the industrial field.
[0019] Enhanced retrieval capabilities: Query enhancement phrases, as multi-angle semantic condensations of text blocks, can strengthen semantic feature expression without increasing the redundancy of the original text, thereby improving the matching effect in the knowledge retrieval process.
[0020] Addressing the issue of domain distribution discrepancies: The method of this invention can alleviate the problem of decreased recall accuracy caused by the inconsistency between the distribution of text in the industrial field and the corpus of general pre-trained models, thereby improving the adaptability and practicality of the RAG system in professional fields.
[0021] Improve overall system performance: Based on FAISS, an efficient vector retrieval library was built, and combined with the trained embedding model, an efficient and low-latency industrial operation and maintenance retrieval enhancement generation question-answering system was realized, which can provide operation and maintenance personnel with more accurate and reliable auxiliary decision support. Attached Figure Description
[0022] Figure 1 This is a schematic diagram of the steps of the method of the present invention; Figure 2 This is a schematic diagram illustrating the data set generation method of the present invention. Figure 3 This is a schematic diagram of the training of the dual-tower text embedding model of the present invention; Figure 4 This is a schematic diagram illustrating the generation of RAG responses using the method of the present invention. Figure 5 This is a schematic diagram of the system of the present invention. Detailed Implementation
[0023] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. Technical features in the various embodiments of the present invention can be combined accordingly without mutual conflict.
[0024] In the description of this invention, it should be understood that the terms "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include at least one of those features.
[0025] like Figure 1As shown, in a preferred embodiment of the present invention, the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement includes the following steps S1 to S6. The specific implementation process of each step is described in detail below.
[0026] S1. Document Data Collection and Preprocessing The system acquires text data related to the target industrial equipment and performs unified text processing. The processed document is then divided into several text blocks using a sliding window method.
[0027] It should be noted that in S1 of this invention, text data such as maintenance manuals, typical fault handling cases, and training materials for operation and maintenance personnel related to the target industrial equipment are first collected. For text data in the form of PDF documents or image data, optical character recognition (OCR) technology is further used for text extraction. The extracted documents are initially formatted and converted by a document parsing program (such as converting tables in Word to Markdown format blocks) to ensure that each document is semantically complete, for example, a complete case containing "fault phenomenon - measuring point alarm - handling measures". Then, the converted documents are segmented based on a sliding window.
[0028] It should be noted that when performing text segmentation, the present invention S1 additionally sets two types of symbols. The first type of symbol is used as a statement segmentation mark, and the second type of symbol is used as a table or code block segmentation mark. After the maximum segmentation length is preset, the position of the first statement segmentation mark that does not exceed the length is located as the end point of the segmentation. The table or code block enclosed by the second type of symbol is regarded as a separate text block. At the same time, there is an overlapping interval between adjacent text blocks.
[0029] In this embodiment S1, to adapt to the characteristics of Chinese text processing, the Chinese punctuation mark—the period "."—is used as a statement segmentation marker; the symbol "```" is used as a table or code block segmentation symbol to indicate the boundary of the table or code block. In specific operation, the method of the present invention locates the first statement segmentation mark that does not exceed the preset maximum block length, and uses it as the end point of the block, thereby avoiding semantic breaks. For tables or code blocks enclosed by the "```" symbol, to ensure their integrity, the method of the present invention treats them as a single text block, not subject to the maximum block length limit. In addition, to avoid information loss caused by the segmentation of knowledge points across paragraphs, overlapping intervals are provided between adjacent text blocks to enhance the coherence and integrity of the context.
[0030] S2. Query Question Labeling and Initial Dataset Construction The first large-scale language model is used to annotate the text blocks obtained in step S1 with query questions that match their content, and an initial dataset is constructed based on the generated query questions and their corresponding text blocks.
[0031] It should be noted that in S2 of this invention, one of the challenges in utilizing text data in the industrial field based on the text block obtained in step S1 is how to transform existing text data into labeled data for model evaluation and training at a controllable cost. To address this, this invention deploys a first large-scale language model (LLM), combined with a small number of manually labeled examples as input, to construct query questions based on text content for subsequent recall performance testing, thereby transforming the original document labeling process into an automated generation task. This approach allows for different perspectives and questioning methods to ensure effective recall detection.
[0032] It should be noted that in S2 of the present invention, as Figure 2 As shown, the specific process of constructing the initial dataset is as follows: After selecting a preset number of text blocks and manually annotating them, the manually annotated query questions and corresponding text blocks are used as standardized examples and input together with the unannotated text blocks into the first large-scale language model. A corresponding query question is generated for each unannotated text block, and finally, the initial dataset is constructed from all the generated query questions and text blocks.
[0033] In the specific implementation process, this embodiment uses DeepSeek-V3 (following the MIT open-source license agreement) as the first large-scale language model used for data annotation, and forms text blocks through S1 ( Figure 2 After the document chunking function in the dataset, a small number of text blocks are first manually annotated as standardized examples to unify the format and language style of the queries. Then, a portion of these manually annotated text blocks and queries are retained as the test set, while the remainder is used as standardized examples input into the first large-scale language model. Based on this, the first large-scale language model automatically generates a large number of candidate queries through context learning, and combines this with manual selection to filter out queries that match the text blocks, aligning them with the corresponding text blocks. This achieves efficient expansion of training data and ultimately constructs the initial dataset.
[0034] Through the above process, the query questions generated in this embodiment have the following characteristics: the questions are clearly targeted, avoiding vague or ambiguous questions; the query questions have clear references to equipment, components, and operating conditions. For example, in the turbine-related case of this embodiment, the query question generated based on the text block is: "What is the relationship between the vibration of turbine bearing #7 and the excitation current and active power, and what are the specific manifestations?" This type of query can target a clear text block, improving the accuracy of subsequent recall evaluation.
[0035] S3. Offline Tagging and Enhanced Query Phrase Generation The initial dataset in step S2 is further processed using the first large-scale language model to automatically generate query augmentation phrases for text blocks as offline labels. The query augmentation phrases are then concatenated before the corresponding text blocks to form augmented text blocks. The final question-text pair dataset is constructed from the augmented text blocks and the query questions.
[0036] It should be noted that, in S3 of this invention, based on the text block obtained in step S1, a significant feature of this invention is that, before the text block is embedded, a first large-scale language model is introduced to perform feature enhancement processing. Specifically, this invention automatically generates multi-angle query enhancement phrases as offline tags through the first large-scale language model to expand the semantic expressive power of the original text block. The query enhancement phrases condense the semantic summary of the text block in a multi-angle and multi-level manner, and their length is much shorter than the text block obtained in S1. During text embedding, the query enhancement phrases are concatenated before the corresponding text block to generate a text embedding vector, thereby enhancing the semantic expressive power during retrieval.
[0037] In the specific implementation of this embodiment, considering that the same text block often contains information at multiple different levels, such as multiple knowledge points, the present invention, when generating examples using the first large-scale language model, requires the generation of multiple different query enhancement phrases for the same text block based on the prompt words and the given examples. Each query enhancement phrase points to a different information point within the text block. For example... Figure 2 As shown, Figure 2 Segment 1 in the text corresponds to enhancement set 1, which contains multiple query enhancement phrases generated around segment 1. This ensures that in subsequent searches, regardless of which aspect of the text block the query focuses on, effective recall can be achieved.
[0038] For example, in step S2, given the example text block "vibration of turbine bearing #7", the model generates multiple query enhancement phrases with different focuses, including: "vibration of bearing #7 is strongly correlated with excitation current" and "poor expansion of generator coil leads to high-level vibration". These phrases cover multiple aspects of information within the same text block and are concatenated with the original text block in S1 as input to the dual-tower text embedding model. In this way, each text block is supplemented with multi-faceted semantic cues during vectorization, thereby significantly enhancing the semantic relevance matching effect during vector retrieval.
[0039] Experimental results show that even without additional retraining of the text embedding model, relying solely on offline-generated query enhancement phrases can significantly improve the accuracy of text retrieval in industrial operation and maintenance scenarios. This demonstrates that the offline enhancement mechanism of this invention effectively improves the comprehensiveness and reliability of retrieval while reducing the cost of manual annotation and training.
[0040] S4. Training of a Dual-Tower Text Embedding Model We obtain a pre-trained dual-tower text embedding model and fine-tune the model on a question-text pair dataset using a contrastive learning method and an information-noise contrastive estimation loss function.
[0041] It should be noted that in S4 of this invention, the dual-tower text embedding model used in this embodiment is the pre-trained language model bge-large-zh-v1.5 released by the Beijing Academy of Artificial Intelligence (BAAI), used to generate text embedding features corresponding to each text block. Specifically, this model has been publicly released on open-source platforms and is licensed under the MIT License.
[0042] It should be noted that in step S4 of this invention, based on the enhanced text block from step S3, step S4 trains the dual-tower text embedding model by introducing the Information Noise Contrastive Estimation (InfoNCE) loss function from contrastive learning. This invention considers that the same batch of training samples may contain different query questions from the same text block (i.e., the problem of text block information diversity). Therefore, during training, this invention introduces the idea of contrastive learning, using text blocks as the category basis, treating the text block and all its corresponding queries as positive samples of the same class, and distinguishing between positive and negative samples. The goal is to make the vector representation of the query question and its corresponding text block in the embedding space as close as possible, thereby achieving semantic matching, optimizing the vector representation in the embedding space, and improving the representation ability of the query enhancement phrase in the final vectorization and the model's ability to discriminate under multi-perspective queries. This approach ensures that the model can learn the multi-angle semantic features of the text block, improving the recall comprehensiveness and robustness of the model in industrial scenarios.
[0043] It should be noted that in S4 of this invention, the information noise contrast estimation loss function The calculation method is as follows: in, This indicates the first loss that the query question points to in the text block; This indicates that the text block points to the second loss of the query problem; This indicates the number of sample pairs contained in a training batch, where each sample pair consists of an augmented text block and its corresponding query question; Indicates and The corresponding set of positive samples of text blocks Indicates the first The query problem in the sample pair; Indicates and The corresponding set of positive samples for the query questions. Indicates the first Enhanced text blocks in the sample pair; , and Both represent sample pair indices; Indicates the natural index; express and Similarity; express and Similarity; express The query embedding vector obtained after the dual-tower text embedding model; express The query embedding vector obtained after the dual-tower text embedding model Indicates the first The query problem in the sample pair; express The text embedding vector obtained after the dual-tower text embedding model Indicates the first Enhanced text blocks in the sample pair.
[0044] Furthermore, the loss function is calculated using the following formula. Query the similarity between the embedding vector and the text embedding vector. and : in, It is a temperature coefficient used to adjust the smoothness of the distribution.
[0045] In embodiment S4 of the present invention, as Figure 3 As shown, samples containing questions and texts were sampled from the question-text pair dataset. For a training batch of sample pairs, where the first... For sample pairs From enhanced text blocks and query issues Composition. The first... After passing the sample pairs through the dual-tower text embedding model, we obtain the results with... Corresponding query embedding vector (Right now Figure 3 (query vector in) and with Corresponding text embedding vector (Right now Figure 3 (text vectors in the text). This represents the dimension of the embedding vector. To ensure distribution stability, the embedding vector needs to be normalized. For the above training batches, the embedding vectors are normalized based on the vector inner product according to the above formula. and similarity as well as and similarity For the same text block It should correspond to a set of positive samples for a query question. ,same, The set of positive samples corresponding to the text blocks in the training batch The final information-noise contrast estimation loss function during training is: point to as well as point to The average of the two losses, as described above.
[0046] In embodiment S4 of this invention, the optimization objective of the contrastive learning loss function is: on the one hand, to maximize the similarity between positive sample pairs, making the representation of the query question and its corresponding text block in the embedding space closer, corresponding to the numerator of the loss function; on the other hand, to reduce the similarity between negative sample pairs, ensuring that the query question does not produce incorrect matches with irrelevant text blocks, corresponding to the denominator of the loss function. Furthermore, in this embodiment, The setting is slightly higher than that of typical contrastive learning, with the aim of making the distribution smoother under training with multiple positive samples and preventing the training from being too concentrated on a few hard-to-distinguish negative samples.
[0047] S5. Text Vector Library Construction Using the query augmentation phrases generated in step S3 and the dual-tower text embedding model trained in step S4, an offline text vector library is constructed based on FAISS.
[0048] It should be noted that in S5 of this invention, the specific process of constructing the text vector library is as follows: the query enhancement phrase is concatenated before the corresponding text block to form an enhanced text block, and then the enhanced text block is input into the trained dual-tower text embedding model to obtain the final semantic vector representation of the text block. The final semantic vector representations of all text blocks are uniformly stored in the vector retrieval engine based on FAISS (Facebook AI Similarity Search). FAISS has efficient similarity search capabilities and can support low-latency recall in large-scale industrial knowledge base scenarios, thereby forming an offline text vector library.
[0049] In this embodiment, after the text vector library is constructed, the recall effect can be verified based on the dataset in step S2, and key indicators such as the accuracy and recall rate of the text vector library can be evaluated to ensure its effectiveness in practical application scenarios.
[0050] Application of S6.RAG method The system obtains the natural language question posed by the user as the user query. The trained dual-tower text embedding model transforms the user query into a query semantic vector. The similarity between the query semantic vector and each text embedding vector in the text vector library is calculated. The candidate text block with the highest similarity is retrieved and used as context input to the second large-scale language model. The answer is generated by referencing the candidate text block.
[0051] It should be noted that in S6 of this invention, after completing the construction of the text vector library in step S5, this invention further designs a retrieval augmentation generation (RAG) question answering method for industrial intelligent operation and maintenance scenarios based on the trained dual-tower text embedding model and text vector library, so as to achieve accurate retrieval and answer generation of equipment operation and maintenance questions, thereby improving the efficiency and reliability of intelligent operation and maintenance knowledge question answering.
[0052] like Figure 4 As shown. The core process of this method includes the following aspects: User query input: Natural language questions raised by maintenance personnel in their actual work, such as "What are the possible causes of the sudden increase in vibration of bearing #7?" and "What impact will the increase in hydrogen temperature have on the operation of the steam turbine?".
[0053] Offline text enhancement and recall: Before text vectorization, this invention utilizes a second large-scale language model to generate query enhancement phrases and concatenates them to the corresponding text blocks to enrich their semantic representation. Subsequently, based on the dual-tower text embedding model trained in step S4, the user query is transformed into a query semantic vector. In the text vector library constructed in step S5, the most relevant candidate text blocks (i.e., the recalled text blocks) are retrieved based on the similarity between the query semantic vector and the text embedding vector of the enhanced text block.
[0054] Answer generation and fusion: The recalled text blocks are used as context input to the second large-scale language model. During the process of generating answers in the second large-scale language model, this invention can reference the recalled text blocks to reduce model illusion problems in a traceable way, improve the reliability and interpretability of the answers, avoid relying solely on model output, and enable better application in industrial fields.
[0055] In this embodiment, Qwen2.5-7B is selected as the second large-scale language model. Qwen2.5-7B is a large-scale pre-trained language model open-sourced by Alibaba Group, following the Apache 2.0 open-source license. In practical applications, it can be replaced with other open-source or commercial models according to the needs of the scenario. As long as it has the ability to receive recall context and perform natural language generation, it can achieve the same technical effect as this invention.
[0056] In summary, this invention combines offline label generation, multi-positive sample embedding training, and the RAG framework to construct an efficient, low-cost, and scalable intelligent operation and maintenance RAG method, which can provide reliable knowledge support and decision assistance for industrial equipment operation and maintenance. This invention has the following advantages in practical industrial intelligent operation and maintenance scenarios: Accuracy: By combining multi-view enhanced phrases with multi-positive sample pairs for training, the system can more accurately recall target text blocks when faced with diverse query expressions.
[0057] Reliability: Based on the "evidence-based" retrieval mechanism, the system effectively reduces the illusion risk of large models in industrial operation and maintenance Q&A. The system supports traceable results, which improves the credibility and interpretability of the model's answers.
[0058] Efficiency: The offline data augmentation and embedding model training used in this invention are both completed in the preprocessing stage, which adds almost no additional computational overhead to the system's online inference.
[0059] Low cost: This invention uses language model-assisted annotation, which reduces the cost of model training in industrial applications.
[0060] To better demonstrate the specific implementation and technical effects of the present invention, the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement shown in steps S1 to S6 of the above preferred implementation is applied to a specific example.
[0061] Example The implementation process of the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement used in this embodiment is as described above and will not be repeated here.
[0062] After the vector library is constructed, this invention uses the test set partitioned in step two to verify the recall effect. During the verification process, for each query, the most relevant text block is retrieved from the vector library and compared with manually annotated correct answers. The following key indicators are calculated: Tok-k accuracy: measures whether at least one correct document is included in the top k ranked results of a search. MRR (Mean Reciprocal Rank): For each query, calculate the reciprocal of the rank of the first relevant document (1 / rank), and then average it across all queries. This metric evaluates the overall prominence of correct documents in search results.
[0063] nDCG (Normalized Discounted Cumulative Gain): Taking into account the number of relevant documents and their ranking position in the results, it gives higher weight to the relevant documents ranked higher through a discount function and performs normalization processing to comprehensively measure the ranking quality.
[0064] On the test set of this invention, comparative experiments were conducted based on the bge-large-zh-v1.5 model to compare the performance of three schemes: ordinary embedding model versus no recall augmentation data; ordinary embedding model versus recall augmentation data; and post-trained embedding model versus recall augmentation data. Specifically, as shown in Table 1, when multiple documents are contained under the same title, this invention concatenates the original titles in all comparison schemes. Furthermore, the offline generated paragraph tags and query augmentation phrases still achieved improvements in various metrics. This indicates that the offline semantic enhancement mechanism proposed in this invention can generate more specific and comprehensive semantic information in text retrieval tasks than document titles.
[0065] Table 1. Comparative Experimental Results Corresponding to the above method embodiments, the present invention also provides an intelligent operation and maintenance RAG system based on offline tag generation and query enhancement. See also Figure 5 The system includes one or more processors for executing computer program instructions stored in non-volatile memory to implement the steps in the above method embodiments.
[0066] The aforementioned system can be implemented through software, hardware, or a combination of both. In the software implementation, the processor loads program instructions from non-volatile memory and executes them in memory, thereby completing the execution of the intelligent operation and maintenance (RAG) method. From a hardware perspective, the computing device housing the system typically includes basic components such as a processor, memory, network interface, and non-volatile memory, and can be expanded with other hardware modules according to actual functional requirements. The implementation process of each unit corresponds to the steps in the method embodiment.
[0067] It should be noted that the system embodiments and method embodiments are basically corresponding, and they can be referred to each other in terms of function and process. The various units in the system do not necessarily need to be physically separated; they can be implemented centrally on a single computing device or distributed across multiple network nodes to complete collaboratively. Those skilled in the art can understand and implement this invention without any creative effort.
[0068] It is understood that the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement described in S1-S6 above can essentially be implemented by a computer program. Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer program product corresponding to the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement provided in the above embodiments. This product includes a computer program / instruction that, when executed by a processor, can implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in the above embodiments.
[0069] Similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer electronic device corresponding to the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement provided in the above embodiment, which includes a memory and a processor; The memory is used to store computer programs; The processor is configured to implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement in the above embodiments when executing the computer program.
[0070] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0071] Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer-readable storage medium corresponding to the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement provided in the above embodiments. The storage medium stores a computer program, which, when executed by a processor, can implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement in the above embodiments.
[0072] Specifically, in the computer-readable storage medium of the above three embodiments, the stored computer program is executed by a processor, which can perform the aforementioned steps S1 to S6.
[0073] It is understood that the aforementioned storage media may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Furthermore, the storage media may also be various media capable of storing program code, such as USB flash drives, external hard drives, magnetic disks, or optical discs.
[0074] It is understood that the processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0075] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.
Claims
1. A smart operation and maintenance RAG method based on offline tag generation and query enhancement, characterized in that, Includes the following steps: S1. Acquire text data related to the target industrial equipment and perform unified text processing, then divide the processed document into several text blocks using a sliding window method; S2. Use the first large-scale language model to label the text blocks obtained in step S1 with query questions that match their content, and build an initial dataset based on the generated query questions and their corresponding text blocks; S3. The initial dataset in step S2 is further processed using the first large-scale language model to automatically generate query augmentation phrases for text blocks as offline labels. The query augmentation phrases are then concatenated before the corresponding text blocks to form augmented text blocks. The final question-text pair dataset is constructed from the augmented text blocks and the query questions. S4. Obtain a pre-trained dual-tower text embedding model and train the dual-tower text embedding model on a question-text pair dataset using the information noise contrastive estimation loss function of contrastive learning. S5. Using the query augmentation phrases generated in step S3 and the dual-tower text embedding model trained in step S4, construct an offline text vector library based on FAISS. S6. Obtain the natural language question raised by the user as the user query. The trained dual-tower text embedding model transforms the user query into a query semantic vector. Calculate the similarity between the query semantic vector and each text embedding vector in the text vector library. Retrieve the candidate text block with the highest similarity and input it as context into the second large-scale language model. Generate the answer by referencing the candidate text block.
2. The intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in claim 1, characterized in that, When performing text segmentation, S1 sets two additional symbols: the first symbol is used as a statement segmentation mark, and the second symbol is used as a table or code block segmentation mark. After setting the maximum segmentation length, it locates the first statement segmentation mark position that does not exceed the length as the end point of the segmentation, and treats the table or code block enclosed by the second symbol as a separate text block. At the same time, there is an overlap interval between adjacent text blocks.
3. The intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in claim 1, characterized in that, In S2, the specific process of constructing the initial dataset is as follows: After selecting a preset number of text blocks and manually annotating them, the manually annotated query questions and corresponding text blocks are used as standardized examples and input together with the unannotated text blocks into the first large-scale language model. A corresponding query question is generated for each unannotated text block, and finally the initial dataset is constructed from all the generated query questions and text blocks.
4. The intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in claim 1, characterized in that, In S4, the information-noise contrast estimation loss function The calculation method is as follows: ; in, This indicates the first loss that the query question points to in the text block; This indicates that the text block points to the second loss of the query problem; This indicates the number of sample pairs contained in a training batch, where each sample pair consists of an augmented text block and its corresponding query question; Indicates and The corresponding set of positive samples of text blocks Indicates the first The query problem in the sample pair; Indicates and The corresponding set of positive samples for the query questions. Indicates the first Enhanced text blocks in the sample pair; , and Both represent sample pair indices; Indicates the natural index; express and Similarity; express and Similarity; express The query embedding vector obtained after the dual-tower text embedding model; express The query embedding vector obtained after the dual-tower text embedding model Indicates the first The query problem in the sample pair; express The text embedding vector obtained after the dual-tower text embedding model Indicates the first Enhanced text blocks in the sample pair.
5. The intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in claim 4, characterized in that, In S4, the similarity between the query embedding vector and the text embedding vector is calculated using the following formula. and : ; in, It is a temperature coefficient used to adjust the smoothness of the distribution.
6. The intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in claim 1, characterized in that, In S5, the specific process of building a text vector library is as follows: the query enhancement phrase is concatenated before the corresponding text block to form an enhanced text block, and then the enhanced text block is input into the trained dual-tower text embedding model to obtain the final semantic vector representation of the text block. The final semantic vector representations of all text blocks are uniformly stored in the FAISS-based vector retrieval engine, thus forming an offline text vector library.
7. A smart operation and maintenance RAG system based on offline tag generation and query enhancement, characterized in that, It includes one or more processors for executing computer program instructions stored in non-volatile memory to implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in any one of claims 1 to 6.
8. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it can implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in any one of claims 1 to 6.
10. A computer electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to implement the intelligent operation and maintenance RAG method based on offline tag generation and query enhancement as described in any one of claims 1 to 6 when executing the computer program.
Citation Information
Patent Citations
Text similarity calculation method for searching scene and double-tower model training method
CN116070614A
Text data enhancement method, electronic equipment and storage medium
CN116227431A