Multi-level subject-based retrieval enhancement generation method and system for industry large models
Through the enhanced generation method of multi-level topic retrieval for large industry models, we build a long text segmentation model and multi-level topic similarity retrieval for semantic topic evolution learning, which solves the problem of new employees not being familiar with the power industry knowledge and realizes a large language model. The efficiency, accuracy and completeness of knowledge question and answer in the power field improve the efficiency of knowledge management and retrieval.
Patent Information
- Application Number
- CN202410939092.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-15
AI Technical Summary
In low-code application development for industry fields, new employees are not familiar with the power industry knowledge, which leads to difficulty in understanding requirements, unreasonable design solutions, low system development efficiency, and difficulty in testing. Traditional knowledge retrieval methods are difficult to capture the fine-grainedness of document knowledge. Semantics leads to information fragmentation and incoherence, which affects the professionalism of large language models in knowledge question and answer in industry fields.
A multi-level topic-based retrieval enhancement generation method for large industry models is adopted. By constructing a long text segmentation model based on semantic topic evolution learning, effective segmentation of document knowledge and topic content generation are achieved. Combined with multi-level topic similarity retrieval, a local-oriented The topic vector knowledge base optimizes the knowledge management and retrieval process of large language models.
It improves the accuracy and completeness of the large language model in knowledge question and answer in the industry field, enhances the efficiency of knowledge management and retrieval, ensures the pertinence and reliability of the answers, and makes the application of the large language model in the target industry field more flexible and intelligent.
Smart Images

Figure CN118484516B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of large language models and information retrieval, and specifically relates to a multi-level thematic retrieval enhancement generation method and system for industry large models. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] In low-code application development platforms for industry fields, the user's own professional knowledge level is a key factor affecting the efficiency of application development. For example, in the power sector, the development of application systems involves complex power systems, digital-analog relationships, equipment operation and maintenance, and other professional knowledge. The uneven level of professional knowledge leads to large differences in developers' understanding and application of professional knowledge in the power field. Some developers may have little knowledge of the power field, resulting in communication barriers and misunderstandings during the development process, reducing the overall development efficiency of the team. For example, a power company is developing a new power supply chain management system that involves all aspects of the power supply chain, including power generation, transmission, and distribution. New employees join the development team, but because they are unfamiliar with the business processes and specifications of the power industry, the following situations may affect the overall progress of the project:
[0004] (1) Difficulty in understanding demand: New employees are unfamiliar with the terminology and business processes of the power industry and may not be able to accurately understand user needs, resulting in increased time spent in the demand analysis phase;
[0005] (2) Unreasonable design plan: Due to lack of understanding of the characteristics of the power industry, new employees may propose unrealistic system design plans that require frequent revisions and adjustments, affecting the progress of the system design phase;
[0006] (3) Inefficient system development: Due to lack of business knowledge about the power industry, new employees may not be able to accurately convert business logic into program logic when developing systems, resulting in more time spent on completing tasks;
[0007] (4) Testing difficulties: Due to their unfamiliarity with the business processes of the power industry, new employees may not be able to conduct system testing effectively and accurately identify potential problems and defects, resulting in increased time spent in the testing phase.
[0008] Therefore, there is an urgent need for a method to integrate industry domain knowledge to facilitate developers to quickly and efficiently query and obtain relevant industry knowledge and business logic relationships during the application development process.
[0009] Due to the complexity, professionalism and density of industry domain knowledge, which usually involves complex knowledge logic, traditional knowledge retrieval methods often take a lot of time and cost to integrate information, resulting in low work efficiency. In addition, traditional retrieval methods are difficult to capture the fine-grained semantics in document knowledge, resulting in fragmentation and incoherence of information. The emergence of large language models provides low thresholds and high efficiency for knowledge retrieval and question answering, and users can get relatively accurate answers through simple natural language descriptions. However, for vertical or target industry fields, due to the limitations of the corpus, general large language models often have inaccurate or incomplete information when generating answers. In order to improve the professionalism of large language models in industry domain knowledge question answering, the industry provides prompt information to large language models through retrieval-augmented generation (RAG), thereby enhancing the knowledge capabilities of large language models in specific fields. In simple terms, RAG means that in addition to the knowledge that the large language model has learned itself, it enhances its own capabilities by combining information from external data sources (such as local knowledge bases). The specific process is to first retrieve relevant content from external data sources based on user questions, then combine the two to generate prompt content, input them into the large language model together, and finally the large language model outputs the answer based on its own capabilities. However, it is crucial to build a local knowledge base and perform efficient knowledge management. At present, the conventional practice is to divide or segment documents and other content, and then store them in a vector database through vectorization to achieve external knowledge management. This text segmentation solution has many problems, and it is easy to lose the complete semantics of the text and have abnormal sentence patterns, which greatly limits the effect of RAG technology on enhancing knowledge expression of large language models. Summary of the invention
[0010] In order to solve the above problems, the present invention proposes a multi-level topic-based retrieval enhancement generation method and system for industry large models. The present invention fully improves the relevance of external knowledge by constructing a local topic vector knowledge base and hierarchical topic similarity retrieval, so that the large language model can answer more accurate answers. First, the present invention constructs a long text segmentation model based on semantic topic evolution learning, which realizes the effective segmentation of document knowledge and avoids the loss of paragraph semantics and the appearance of abnormal sentences. At the same time, based on the generation ability of the topic model, the topic content is generated at the document level, the semantic association of the two levels of "document-paragraph" is realized, and the knowledge is better managed. On this basis, the present invention constructs a multi-level topic similarity retrieval method, performs similarity retrieval of target questions at the two levels of "document-paragraph", reduces the appearance of noise paragraphs, and optimizes the candidate set content in the large language model prompt project, thereby improving the professionalism and reliability of the knowledge question and answer system in which the large language model is applied in the target industry field.
[0011] According to some embodiments, the present invention adopts the following technical solutions:
[0012] The multi-level subject-based retrieval enhancement generation method for industry large models includes the following steps:
[0013] Acquire existing document knowledge in relevant industry fields, perform data preprocessing, and unify them into standard text formats;
[0014] At the document level, the document content is themed using the document topic generation model to obtain the topic content of the document;
[0015] At the sentence level, the sentences and sentence interval identifiers in the document are used as input, and the topic encoder is used to obtain the vectorized sentence topic representation;
[0016] The vectorized sentence topic representation is used as input, and the bidirectional long short-term memory network is used for post-processing to obtain the implicit vector representation of each time step. The implicit vectors of adjacent time steps are selected and the feature representation of the sentence interval points is obtained by vector concatenation.
[0017] Taking the obtained feature representation of the sentence interval point as input, the sigmoid layer is used to calculate the segmentation prediction score of the sentence interval point;
[0018] The long text segmentation model is composed of topic encoder, bidirectional long short-term memory network and sigmoid layer;
[0019] Based on the long text segmentation model, the document content is segmented into semantic topics. Combined with the generated document content, the text is vectorized and stored in the local vector library to form a multi-level subject industry knowledge base.
[0020] In response to the questions raised by users, we access the multi-level subject industry knowledge base, and after multi-level subject similarity retrieval, we obtain a list of candidate knowledge related to the Top-k semantic topics. Combined with the questions, they are input into the target large language model together to obtain the optimized result output.
[0021] As an optional implementation, the process of data preprocessing includes data cleaning, word segmentation, sentence segmentation and segmentation operations.
[0022] As an optional implementation method, at the document level, the document content is themed using a document topic generation model, and the process of obtaining the topic content of the document includes: further processing the document content, converting it into a format suitable for the document topic generation model input, and using the document topic generation model to model the processed document content. The document topic generation model performs multi-level self-attention calculations on the document to understand the document content and generate the topic content of the document.
[0023] As an optional implementation, at the sentence level, the process of obtaining a vectorized sentence topic representation using a topic encoder with sentences and sentence interval identifiers in a document as input includes: performing data preprocessing on each sentence, including word segmentation, stop word removal, and stemming operations, to obtain a processed document representation; inputting the processed sentences and sentence interval identifiers into the topic encoder, which encodes the sentences through a multi-layer Transformer structure to capture the semantic information and contextual associations of the sentences, and generates a vectorized sentence topic representation.
[0024] As an optional implementation, the vectorized sentence topic representation is used as input, and a bidirectional long short-term memory network is used for post-processing to obtain an implicit vector representation of each time step. By selecting implicit vectors of adjacent time steps and using vector concatenation, the process of obtaining the feature representation of the sentence interval point includes:
[0025] The vectorized sentence topic representations are input into the bidirectional long short-term memory network in sequence;
[0026] The bidirectional long short-term memory network models the input sentence topic representation from the forward and backward directions to obtain the forward latent vector and backward latent vector at each time step;
[0027] For each time step, select the forward latent vector and the backward latent vector, concatenate them, and get a complete vector representation;
[0028] For the implicit vectors of adjacent time steps, vector concatenation is performed to obtain the feature vector representation of the sentence interval point.
[0029] As an optional implementation, the feature representation of the obtained sentence interval point is used as input, and a sigmoid layer is used to calculate the segmentation prediction score of the sentence interval point. The feature representation will be converted into the segmentation prediction score of the sentence interval point to determine whether each position is suitable as a segmentation point.
[0030] As an optional implementation, the long text segmentation model is trained in advance, a cross entropy loss function is used as a loss function, and the long text segmentation model is continuously optimized during the training process.
[0031] As an optional implementation method, in response to the questions raised by the user, a multi-level subject industry knowledge base is accessed, and a Top-k list of candidate knowledge related to the semantic topics is obtained through multi-level subject similarity retrieval. The candidate knowledge lists are combined with the questions and input into the target large language model to obtain the optimized result output process, which includes:
[0032] For questions raised by users, vectorized questions are obtained through text preprocessing and vectorization operations;
[0033] Access a multi-level subject-based industry knowledge base, and use the vector similarity calculation method to calculate the semantic relevance between the question and each topic in the knowledge base at the topic level; calculate the relevance between the question and each paragraph in the knowledge base at the paragraph level to obtain the hierarchical topic similarity distribution;
[0034] According to the similarity of topic level distribution, the candidate knowledge list related to the Top-k semantic topics is calculated;
[0035] The candidate knowledge list and the question are used together as inputs of the target large language model to obtain an optimized result.
[0036] A multi-level subject-based retrieval enhancement generation system for industry large models, including:
[0037] The data preprocessing module is configured to obtain relevant document knowledge in existing industry fields, perform data preprocessing, and unify it into a standard text format;
[0038] The document level processing module is configured to generate thematic content of the document using the document theme generation model at the document level to obtain the theme content of the document;
[0039] A sentence level processing module is configured to obtain a vectorized sentence topic representation using a topic encoder at the sentence level, taking sentences and sentence interval identifiers in a document as input;
[0040] The feature representation module is configured to use the obtained vectorized sentence topic representation as input, perform post-processing using a bidirectional long short-term memory network to obtain an implicit vector representation of each time step, and obtain a feature representation of the sentence interval point by selecting implicit vectors of adjacent time steps and using a vector concatenation method;
[0041] The segmentation prediction module is configured to take the obtained feature representation of the sentence interval point as input and calculate the segmentation prediction score of the sentence interval point using a sigmoid layer;
[0042] The model building module is configured to construct a long text segmentation model with a topic encoder, a bidirectional long short-term memory network, and a sigmoid layer;
[0043] The industry domain knowledge base construction module is configured to perform semantic topic segmentation on the document content based on the long text segmentation model, combine the generated document's topic content, use text vectorization operations, store it in the local vector library, and form a multi-level topic industry domain knowledge base;
[0044] The retrieval module is configured to access the multi-level subject industry knowledge base in response to the questions raised by the user, and obtain a list of candidate knowledge related to the Top-k semantic topics through multi-level subject similarity retrieval. Combined with the questions, they are input into the target large language model together to obtain optimized result output.
[0045] An electronic device comprises a memory and a processor, and computer instructions stored in the memory and executed on the processor. When the computer instructions are executed by the processor, the steps in the above method are completed.
[0046] Compared with the prior art, the present invention has the following beneficial effects:
[0047] In the target industry field, the present invention can provide a rich prompt corpus for the large language model to help it better understand and answer questions related to the professional knowledge of the industry field. The multi-level thematic retrieval enhancement generation method for the industry large model proposed in the present invention realizes the effective segmentation of document knowledge by constructing a long text segmentation model based on semantic theme evolution learning, avoiding the loss of paragraph semantics and the appearance of abnormal sentences. At the same time, through the hierarchical theme similarity retrieval method, semantic analysis and matching can be performed at two levels: document-level theme and paragraph-level theme, helping the large language model to better understand the problem and generate more accurate answers. Therefore, when generating answers, the large language model can specifically retrieve information on relevant semantic topics from the theme vector library, thereby improving the accuracy and completeness of the answers.
[0048] The present invention fully improves the ability to integrate external domain knowledge and realizes thematic knowledge management. By building a local theme-oriented vector knowledge base based on a long text segmentation model based on semantic theme evolution learning, external knowledge can be managed and organized more efficiently. This effect will make the application of large language models in the target industry more flexible and intelligent, and better adapt to different application scenarios and needs.
[0049] The present invention can significantly improve the efficiency of general large language models in knowledge retrieval in target industry fields. Traditional knowledge base retrieval methods are often difficult to meet the needs of specific fields, while local subject-oriented vector knowledge bases and multi-level subject similarity retrieval methods can more accurately locate relevant knowledge, further optimizing the ability of retrieval enhancement generation technology to enhance knowledge expression in large language models, thereby improving the efficiency of knowledge retrieval and making the application of large language models in target industry fields more efficient and reliable.
[0050] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0052] Figure 1 It is an overall flow chart of a multi-level subject-based retrieval enhancement generation method for an industry large model according to an embodiment;
[0053] Figure 2 A flowchart of building a multi-level thematic industry domain knowledge base in one embodiment;
[0054] Figure 3 A diagram of a long text segmentation model based on topic semantic evolution learning according to an embodiment;
[0055] Figure 4 A schematic diagram of a bidirectional long short-term memory network (BiLSTM) structure of an embodiment;
[0056] Figure 5 A diagram of a multi-level topic similarity search according to an embodiment;
[0057] Figure 6 This is an overall application architecture diagram of a multi-level thematic retrieval enhancement generation system for an industry big model according to an embodiment. DETAILED DESCRIPTION
[0058] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0059] It should be noted that the following detailed descriptions are all illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0060] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0061] In the absence of conflict, the embodiments in this application and the features in the embodiments may be combined with each other.
[0062] Embodiment 1
[0063] The purpose of this method is to improve the efficiency of general large language models in knowledge question and answer in the industry field, and further optimize the ability of RAG technology to enhance the knowledge expression of large language models. The present invention constructs a long text segmentation model based on semantic theme evolution learning to achieve effective segmentation of document knowledge, and then constructs a local theme-oriented vector knowledge base. Subsequently, through a multi-level theme similarity retrieval method, the relevance of external knowledge is fully improved, and the theme management of external knowledge is realized, so as to better empower the large language model in specific fields and improve the generation quality of the large language model.
[0064] This embodiment takes the power field as an example, and is implemented based on the internal low-code development platform of a power company of State Grid. The data collection content includes many fields such as power system planning, power grid dispatching, new energy technology, etc. The knowledge content covers multiple disciplines such as power engineering and electronic information, and is highly professional.
[0065] Of course, it does not mean that the technical solution of the present invention can only be used in this field.
[0066] like Figure 1 As shown, the specific implementation process, the steps are as follows:
[0067] A. Based on the relevant document knowledge in the existing power knowledge training system, after data preprocessing, mainly including data cleaning, word segmentation, sentence segmentation, segmentation and other operations, it is uniformly processed into a standard text format and data is summarized , (i=1,2,…,N) is the corresponding document, N represents the total number of documents;
[0068] The knowledge training system collected power knowledge documents from a power company of State Grid from 2016 to 2022, with 5350 valid documents, including text documents, PDF and other types of files. The main contents include basic knowledge of power system, power equipment and technology, power safety and protection, power market and policy, energy efficiency and energy conservation and emission reduction, etc. After summarization and analysis, some examples of initial selected feature data are shown in Table 1.
[0069] Of course, the data and files mentioned in this embodiment are just examples, and other data and files may be selected in other embodiments. The content of the data and the content and quantity of the files may be adjusted.
[0070] Table 1
[0071]
[0072] B. For the preprocessed text content, such as Figure 2As shown, at the document level, the document topic generation model LongFormer is used to generate topics for the document content to obtain the topic content of the document. Specifically, first, the document content is further processed and converted into a format suitable for model input to facilitate subsequent topic modeling and summary generation. Then, the document topic generation model LongFormer is used to model the processed document content. LongFormer is a deep learning model based on the self-attention mechanism that can model long texts and capture topic information in documents. The LongFormer model can better understand the document content by performing multi-level self-attention calculations on the document, thereby generating the topic content of the document.
[0073] C. At the sentence level, the sentences and intervals in the document are input into the Topic Encoder to obtain vectorized sentence topic representations.
[0074] Specifically, first, data preprocessing is performed on each sentence, including word segmentation, stop word removal, stemming, etc., so as to facilitate the subsequent topic encoder input and obtain the processed document representation. , K represents the number of sentences in document d, si is the corresponding sentence, and ii is the corresponding sentence interval identifier. Then, the processed sentences and sentence interval identifiers are input into the topic encoder. BERT is used as the topic encoder here. BERT is a pre-trained language model based on Transformer that can deeply encode and understand text. The BERT model encodes sentences through a multi-layer Transformer structure to capture the semantic information and contextual association of the sentence and generate a vectorized sentence topic representation. , ti (i=1,2,…,K) is the corresponding sentence topic vector.
[0075] D. Based on the sentence topic vector sequence obtained in step C, input it into the BiLSTM network, such as Figure 4 As shown in the figure, the implicit vector representation of each time step is obtained. The BiLSTM network can better capture the bidirectional semantic dependency of sentences. On this basis, by selecting the implicit vectors of adjacent time steps and using vector concatenation, the feature representation of the sentence interval points is obtained.
[0076] D1. For sentence topic vector sequence , are input into the BiLSTM network in sequence;
[0077] D2. The BiLSTM network models the input sequence from the forward and backward directions to obtain the forward latent vector for each time step and the backward latent vector , the specific calculation formula is as follows:
[0078] ;
[0079] ;
[0080] is the current time step.
[0081] D3. For each time step, select the forward latent vector and the backward latent vector, concatenate them, and get a complete vector representation ;
[0082] D4. For the implicit vectors of adjacent time steps, vector concatenation is also performed to obtain the feature vector representation of the sentence interval point .
[0083] The feature representation of the sentence interval point obtained in step D is input into the sigmoid layer to calculate the segmentation prediction score of the sentence interval point. In the sigmoid layer, these feature representations will be converted into the segmentation prediction score of the sentence interval point to determine whether each position is suitable as a segmentation point.
[0084] like Figure 3 As shown in the figure, the long text segmentation model consists of a topic encoder, a BiLSTM network, and a sigmoid layer.
[0085] In order to design a loss function suitable for the long text segmentation task, this embodiment uses the cross entropy loss function to help the model continuously optimize during the training process to better understand the semantic topics and perform accurate text segmentation.
[0086] Through repeated iterative training and optimization of the model, it is finally fitted and converged, its model parameters and corresponding environment configuration are fixed, and the pre-trained long text segmentation model is output for subsequent text segmentation tasks;
[0087] Based on the pre-trained long text segmentation model, the document content is segmented into semantic topics to achieve a deep and fine-grained semantic understanding of documents in the power field. At the same time, combined with the document topics generated in step B, the text vectorization operation is used to convert the document topics into vector representations and store them in the local vector library to achieve efficient storage and retrieval of document content. In addition, by combining the pre-trained model, document topic generation and text vectorization, a multi-level thematic power knowledge base is formed, which contains rich semantic information and topic structure.
[0088] like Figure 6 As shown, the multi-level subject power knowledge base can also be called the power domain knowledge base.
[0089] For the question Q raised by the user, we access the multi-level subject power knowledge base, and after multi-level subject similarity retrieval, we get the Top-k semantic subject-related candidate knowledge list. Then, we combine the question Q and input them into the target large language model to get the optimized result output, such as Figure 5 shown.
[0090] G1. For the question Q raised by the user, a vectorized question Q is obtained through text preprocessing and vectorization. Question Q is converted into a vectorized form so that it can be matched and retrieved with the content in the knowledge base. Question Q can be used for subsequent similarity calculation and information retrieval;
[0091] G2. By accessing the multi-level thematic power knowledge base and using the vector similarity calculation method, the semantic relevance between question Q and each document topic in the knowledge base is first calculated at the document topic level. Secondly, the relevance between question Q and each paragraph in the above document is calculated at the paragraph level to obtain the hierarchical topic similarity distribution. This step can help the system understand the semantic features of the question and find the knowledge content related to it. Specifically, in this embodiment, cosine similarity is used to calculate the relevance of two vectors, and the specific calculation formula is as follows:
[0092] ;
[0093] in, represents the dot product of vector A and vector B, and Respectively represent the norms (i.e., the lengths of the vectors) of vector A and vector B. By calculating the dot product of two vectors divided by the product of their norms, we can get the cosine similarity between them. The value range is between [-1, 1]. The closer the value is to 1, the higher the similarity.
[0094] G3. Based on the topic level distribution similarity, calculate and obtain the candidate knowledge list related to the Top-k semantic topics. This embodiment uses the weighted summation method to calculate the multi-level topic similarity, and the specific calculation is as follows:
[0095] ;
[0096] in, is the weight, indicating the importance of the corresponding similarity. A vector representation of document-level topics, The vector representation of the topic at the paragraph level of the document. By adjusting the weights, different levels of topic vectors can be given different emphasis, resulting in a more reasonable similarity evaluation.
[0097] G4. Based on the candidate knowledge list and combined with question Q, these candidate knowledge and the question can be input into the target large language model (such as ChatGLM3-6B) to obtain the optimized result output.
[0098] This processing approach can combine the information in the power field knowledge base and the context of the problem to generate more accurate and effective answers or solutions.
[0099] In this embodiment, based on the power knowledge training system, power training knowledge documents of a certain power company of State Grid from 2016 to 2022 were collected. The number of valid files is 5350, including text documents, PDF and other types of files. Among them, 200 valid documents are selected as test documents.
[0100] After the above steps, a multi-level thematic power knowledge vector library is formed.
[0101] The specific description of the vector library is shown in Table 2.
[0102] Table 2
[0103]
[0104] At the same time, 300 experimental questions are collected based on the electric power knowledge training test question bank.
[0105] First, we selected the remaining 200 test documents from the power training knowledge documents for paragraph-level topic segmentation, and selected several commonly used document segmentation methods for comparative experiments to verify the effect of the long text segmentation model based on semantic topic evolution learning proposed in this embodiment. The specific baseline methods and evaluation indicators are shown in Table 3.
[0106] Table 3
[0107]
[0108] As can be seen from the table, the long text segmentation model based on semantic theme evolution learning proposed in this embodiment performs better in precision, recall and F1 score than other baseline methods. This shows that the long text segmentation model based on semantic theme evolution learning can perform long text segmentation tasks more efficiently and realize the effective segmentation of power knowledge documents according to paragraph themes.
[0109] Next, based on 300 experimental questions collected from the electric power knowledge training test question bank, and selecting commonly used retrieval enhancement generation methods for comparative experiments, the effects of the multi-level thematic retrieval enhancement generation method and system for industry large models proposed in this invention are verified. Specifically, these experimental questions are respectively input into the knowledge question-answering system based on the target large language model (such as ChatGLM3-6B) to obtain the output results of the question-answering system. The evaluation indicators BLEU and ROUGE-L are used for performance evaluation. BLEU can measure the quality of the text from the perspective of precision, while ROUGE can measure the quality of the text from the perspective of recall. The specific experimental results are shown in Table 4.
[0110] Table 4
[0111]
[0112] As can be seen from the table, the multi-level topic-based retrieval enhancement generation method for industry-oriented large models proposed in this embodiment performs well in both BLEU and ROUGE-L evaluation indicators compared with other baseline question-answering systems. This shows that, on the one hand, through the long text segmentation model based on semantic topic evolution learning, it is possible to effectively segment document knowledge based on paragraph topics; on the other hand, through the multi-level topic similarity retrieval method, it is possible to effectively retrieve relevant knowledge from the local power knowledge base. Therefore, this embodiment can better empower the large language model in specific fields and improve the generation quality of knowledge questions and answers in related fields by the large language model.
[0113] Embodiment 2
[0114] A multi-level subject-based retrieval enhancement generation system for industry large models, including:
[0115] The data preprocessing module is configured to obtain relevant document knowledge in the existing target industry field, perform data preprocessing, and unify it into a standard text format;
[0116] The document level processing module is configured to generate thematic content of the document using the document theme generation model at the document level to obtain the theme content of the document;
[0117] A sentence level processing module is configured to obtain a vectorized sentence topic representation using a topic encoder at the sentence level, taking sentences and sentence interval identifiers in a document as input;
[0118] The feature representation module is configured to use the obtained vectorized sentence topic representation as input, perform post-processing using a bidirectional long short-term memory network to obtain an implicit vector representation of each time step, and obtain a feature representation of the sentence interval point by selecting implicit vectors of adjacent time steps and using a vector concatenation method;
[0119] The segmentation prediction module is configured to take the obtained feature representation of the sentence interval point as input and calculate the segmentation prediction score of the sentence interval point using a sigmoid layer;
[0120] The model building module is configured to construct a long text segmentation model with a topic encoder, a bidirectional long short-term memory network, and a sigmoid layer;
[0121] The industry domain knowledge base construction module is configured to perform semantic topic segmentation on the document content based on the long text segmentation model, combine the generated document's topic content, use text vectorization operations, store it in the local vector library, and form a multi-level topic industry domain knowledge base;
[0122] The retrieval module is configured to access the multi-level subject industry knowledge base in response to the questions raised by the user, and obtain a list of candidate knowledge related to the Top-k semantic topics through multi-level subject similarity retrieval. Combined with the questions, they are input into the target large language model together to obtain optimized result output.
[0123] Embodiment 3
[0124] An application platform for large models in the power industry, such as Figure 6 As shown, it includes an application access layer, an application layer, a control chain, a large model service layer and an electric power field knowledge base, wherein the control chain is used to execute the steps of the method provided in Example 1, or includes the modules of the system provided in Example 2.
[0125] The other layers can adopt the existing architecture and will not be described in detail here.
[0126] The application platform can provide users with services such as knowledge retrieval, relevant knowledge download, and statistical analysis in the field of the power industry.
[0127] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made by those skilled in the art within the spirit and principle of the present invention without creative labor shall be included in the protection scope of the present invention.
Claims
1. A multi-level subject-based retrieval enhancement generation method for industry large models, characterized by: The following steps are involved: Obtain relevant document knowledge in the existing target industry field, perform data preprocessing, and unify it into a standard text format; At the document level, the document content is themed using the document topic generation model to obtain the topic content of the document; At the sentence level, the sentences and sentence interval identifiers in the document are used as input, and the topic encoder is used to obtain the vectorized sentence topic representation; The vectorized sentence topic representation is used as input, and the bidirectional long short-term memory network is used for post-processing to obtain the implicit vector representation of each time step. The implicit vectors of adjacent time steps are selected and the feature representation of the sentence interval points is obtained by vector concatenation. Taking the obtained feature representation of the sentence interval point as input, the sigmoid layer is used to calculate the segmentation prediction score of the sentence interval point; The long text segmentation model is composed of topic encoder, bidirectional long short-term memory network and sigmoid layer; Based on the long text segmentation model, the document content is segmented into semantic topics. Combined with the generated document content, the text is vectorized and stored in the local vector library to form a multi-level subject industry knowledge base. In response to the questions raised by users, we access the multi-level subject industry knowledge base, and after multi-level subject similarity retrieval, we obtain the Top-k candidate knowledge lists related to semantic topics. Combined with the questions, we input them into the target large language model to obtain the optimized result output. Specifically: For questions raised by users, vectorized questions are obtained through text preprocessing and vectorization operations; Access a multi-level subject-based industry knowledge base, and use the vector similarity calculation method to calculate the semantic relevance between the question and each topic in the knowledge base at the topic level; calculate the relevance between the question and each paragraph in the knowledge base at the paragraph level to obtain the hierarchical topic similarity distribution; According to the similarity of topic level distribution, the candidate knowledge list related to the Top-k semantic topics is calculated; The candidate knowledge list and the question are used together as inputs of the target large language model to obtain an optimized result.
2. The multi-level subject-based retrieval enhancement generation method for industry large models as claimed in claim 1 is characterized in that: The process of data preprocessing includes data cleaning, word segmentation, sentence segmentation and segmentation operations.
3. The multi-level subject-based retrieval enhancement generation method for industry large models as described in claim 1 is characterized in that: At the document level, the document content is themed using the document topic generation model. The process of obtaining the topic content of the document includes: further processing the document content, converting it into a format suitable for the input of the document topic generation model, and using the document topic generation model to model the processed document content. The document topic generation model performs multi-level self-attention calculations on the document to understand the document content and generate the topic content of the document.
4. The multi-level subject-based retrieval enhancement generation method for industry large models as claimed in claim 1 is characterized in that At the sentence level, the process of using the topic encoder to obtain the vectorized sentence topic representation using the sentences and sentence interval identifiers in the document as input includes: performing data preprocessing on each sentence, including word segmentation, stop word removal and stemming operations, to obtain the processed document representation; inputting the processed sentences and sentence interval identifiers into the topic encoder, and the topic encoder encodes the sentences through a multi-layer Transformer structure to capture the semantic information and contextual association of the sentences and generate a vectorized sentence topic representation.
5. The multi-level subject-based retrieval enhancement generation method for industry large models as claimed in claim 1 is characterized in that: The vectorized sentence topic representation is used as input, and the bidirectional long short-term memory network is used for post-processing to obtain the implicit vector representation of each time step. The process of obtaining the feature representation of the sentence interval point by selecting the implicit vectors of adjacent time steps and using vector concatenation includes: The vectorized sentence topic representations are input into the bidirectional long short-term memory network in sequence; The bidirectional long short-term memory network models the input sentence topic representation from the forward and backward directions to obtain the forward latent vector and backward latent vector at each time step; For each time step, select the forward latent vector and the backward latent vector, concatenate them, and get a complete vector representation; For the implicit vectors of adjacent time steps, vector concatenation is performed to obtain the feature vector representation of the sentence interval point.
6. The multi-level subject-based retrieval enhancement generation method for industry large models as claimed in claim 1 is characterized in that: Taking the obtained feature representation of the sentence interval point as input, the sigmoid layer is used to calculate the segmentation prediction score of the sentence interval point. The feature representation will be converted into the segmentation prediction score of the sentence interval point to determine whether each position is suitable as a segmentation point.
7. The multi-level subject-based retrieval enhancement generation method for industry large models as claimed in claim 1 is characterized in that: The long text segmentation model is trained in advance, a cross entropy loss function is used as a loss function, and the long text segmentation model is continuously optimized during the training process.
8. A multi-level subject-based retrieval enhancement generation system for industry large models, characterized by: include: The data preprocessing module is configured to obtain relevant document knowledge in the existing target industry field, perform data preprocessing, and unify it into a standard text format; The document level processing module is configured to generate thematic content of the document using the document theme generation model at the document level to obtain the theme content of the document; A sentence level processing module is configured to obtain a vectorized sentence topic representation using a topic encoder at the sentence level, taking the sentences and sentence interval identifiers in the document as input; The feature representation module is configured to use the obtained vectorized sentence topic representation as input, perform post-processing using a bidirectional long short-term memory network to obtain an implicit vector representation of each time step, and obtain a feature representation of the sentence interval point by selecting implicit vectors of adjacent time steps and using a vector concatenation method; The segmentation prediction module is configured to take the obtained feature representation of the sentence interval point as input and calculate the segmentation prediction score of the sentence interval point using a sigmoid layer; The model building module is configured to construct a long text segmentation model with a topic encoder, a bidirectional long short-term memory network, and a sigmoid layer; The industry domain knowledge base construction module is configured to perform semantic topic segmentation on the document content based on the long text segmentation model, combine the generated document's topic content, use text vectorization operations, store it in the local vector library, and form a multi-level topic industry domain knowledge base; The retrieval module is configured to access the multi-level subject industry knowledge base based on the questions raised by the user, obtain the candidate knowledge list related to the top-k semantic topics through multi-level subject similarity retrieval, and input them into the target large language model together with the questions to obtain the optimized result output. Specifically: For questions raised by users, vectorized questions are obtained through text preprocessing and vectorization operations; Access a multi-level subject-based industry knowledge base, and use the vector similarity calculation method to calculate the semantic relevance between the question and each topic in the knowledge base at the topic level; calculate the relevance between the question and each paragraph in the knowledge base at the paragraph level to obtain the hierarchical topic similarity distribution; According to the similarity of topic level distribution, the candidate knowledge list related to the Top-k semantic topics is calculated; The candidate knowledge list and the question are used together as inputs of the target large language model to obtain an optimized result.
9. An electronic device, characterized in that: The method comprises a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the steps in the method according to any one of claims 1 to 7 are completed.
