A digital power control question-answering method and system based on a large language model
By adopting a large language model and vector knowledge base in the power regulation question-and-answer system, the existing system has insufficient flexibility and weak context understanding ability when dealing with complex problems, and achieves higher question-and-answer accuracy and user experience.
Patent Information
- Application Number
- CN202411469462.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-21
AI Technical Summary
The existing power regulation question and answer system is not flexible enough when dealing with complex and professional problems, and it is difficult to understand the user's natural language, and has weak context understanding ability, making it difficult to provide personalized and coherent answers.
The large language model is used to combine the vector knowledge base, and the understanding and processing of complex problems is achieved through vector embedding and synthesis of similarity measurements, and a more natural and personalized answer is generated through the post-processing of the large language model.
It improves the accuracy and generalization performance of the Q&A system, can interact with users more naturally, provide more coherent and personalized answers, reduces dependence on professionals, and reduces operation and maintenance costs.
Smart Images

Figure CN119003742B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electric power automation, and specifically relates to a digital electric power control question-answering method and system based on a large language model. Background Art
[0002] With the rapid development of information technology, especially the breakthroughs in artificial intelligence and big data technology, automatic question-answering systems are gradually maturing. The improvement of the informationization and intelligence level of power control technology is of great significance for ensuring the safe and stable operation of the power grid and improving the quality of power services. Traditional power control question-answering systems mostly rely on rule matching and simple keyword searches, which makes it difficult to handle complex queries and provide deeply personalized services.
[0003] In the development process of digital power control question-answering system, the existing technical solutions mainly rely on rule matching and keyword search. For example, the method proposed in the patent application "A method and system for intelligent question-answering of power safety regulations based on Bert model" with publication number CN117407511A matches the user's questions through a pre-set rule base and retrieves answers related to keywords from a static knowledge base. The patent application with publication number CN117407511A represents an existing technical solution for the question-answering system in the field of power control, which involves lexical, syntactic analysis and semantic understanding of text data in the field of power dispatching, thereby realizing automatic parsing and understanding of the text of power safety regulations. Specifically, the main contents of the solution include: configuring the question-answer pair of the FAQ module, matching the questions input by the user, text segmentation of the power safety regulations document, generating index files, using the Anserini module to establish indexes based on the output index files and extract paragraphs, generating paragraph scores, using pre-trained Bert models, and using professional data sets for training.
[0004] Configuring the FAQ module's question-answer pair means using the question-answer pair to filter high-frequency questions. For the questions input by the user, the FAQ module is used to match the questions input by the user with the questions in the preset question-answer pair. If they match, the answer corresponding to the matched question is returned. If no result is returned or the matching score is lower than the threshold, the next step is performed: the text of the power safety regulations document is segmented using the preprocessing method, and the text data of the Chinese Wikipedia is added to generate an index file. Then, the Anserini module is used to establish an index based on the output index file, extract paragraphs, and generate paragraph scores; then the pre-trained Bert model is used, and the CMRC2018 data and the power safety regulations examination questions are used as professional data sets for training; then, according to the structure and characteristics of the regulatory documents, the parameters in the algorithm of the trained Bert model are tuned; then, the Bert model is used to extract candidate answers in the Anserini module and give reading comprehension scores. The candidate answers are the accurate answers to the questions extracted from the extracted N paragraphs; then the candidate answers are comprehensively weighted and ranked by score, and finally the answer with the highest score is output, and the original document name and specific chapter information of the answer source are given. The prior art has at least the following disadvantages:
[0005] (1) Lack of flexibility: The FAQ module matching method is very sensitive to the way the question is expressed. Once the user’s question deviates from the preset expression, it is difficult for the system to give an accurate answer.
[0006] (2) Poor scalability: With the continuous updating and expansion of knowledge in the field of power regulation, static knowledge bases require frequent manual updating and maintenance, which is not only time-consuming and labor-intensive, but also prone to errors.
[0007] (3) Weak context understanding ability: This method lacks the ability to understand the conversation context and cannot handle coherent conversations or problems that rely on historical interactions.
[0008] (4) Limited retrieval capabilities: This method is difficult to provide personalized retrieval solutions and answers based on the user’s specific circumstances, but tends to give general, standardized answers.
[0009] (5) Weak interactivity: In this method, the interactivity between users and the system through natural language is weak, which affects user satisfaction. Summary of the invention
[0010] The purpose of the present invention is to address the problems in the above-mentioned prior art and provide a digital power control question and answer method and system based on a large language model to improve the accuracy of question and answer, enable more natural language interaction, and enhance the user's question and answer experience.
[0011] In order to achieve the above object, the present invention has the following technical solutions:
[0012] In the first aspect, a digital electric power control question-answering method based on a large language model is provided, comprising:
[0013] Collect texts in the field of power regulation, use the embedding model to obtain the vector encoding of the texts in the field of power regulation, and store them in the vector knowledge base;
[0014] When a user asks a question, the user's question text is received and pre-processed;
[0015] Input the preprocessed user question text into the search tool, and use the search tool to search and match in the vector knowledge base to obtain the text with the comprehensive similarity meeting the requirements;
[0016] A large language model is used to post-process texts that meet the requirements for comprehensive similarity and generate corresponding answers.
[0017] As a preferred solution, the step of collecting texts in the field of power regulation includes: preprocessing the collected texts in the field of power regulation, the preprocessing operations including document parsing and converting documents in non-text format into plain text format;
[0018] And, after preprocessing, segmentation and slicing are performed to divide the text content into paragraphs or sentences.
[0019] As a preferred solution, the step of using the embedding model to obtain the vector encoding of the text in the field of power regulation and control and storing it in the vector knowledge base includes:
[0020] The bidirectional encoder BERT model is used to obtain the vector encoding of the text after segmentation and slicing. The expression is as follows:
[0021]
[0022] in, Represents the input segmented slice text, s represents the vector representation of the corresponding text, θ Represents the BERT model parameters; establishes a relationship between the text in the field of power regulation and the corresponding vector in the form of an index and stores it in the vector knowledge base.
[0023] As a preferred solution, when the user asks a question, in the step of receiving the user's question text and preprocessing the user's question text, the preprocessing operation includes using the large model and the corresponding prompt words to convert the format of the user's question text, remove noise and reformulate the question;
[0024] Specifically, regular expressions are used to remove noise from user question texts and remove irrelevant characters and interference information in the texts. Question reformulation refers to the standardized restatement of user question texts using a large model. The expression is as follows:
[0025]
[0026] In the formula, LLM() represents the large model calculation, Prompt represents the prompt word, Original_Question represents the original text of the user question, θ represents the parameters of the large model, and Processed_Question represents the reformulated user question.
[0027] As a preferred solution, the pre-processed user question text is input into a search tool, and the search tool is used to search and match in a vector knowledge base to obtain a text whose comprehensive similarity meets the requirements, which includes: the search tool performs vector embedding on the user question text, converts the user question text into a vector, and then uses vector similarity, text similarity and information loss index to search and match the most similar vector in the vector knowledge base;
[0028] The vector similarity index is characterized by cosine similarity, which is expressed as follows:
[0029]
[0030] In the formula, X , Y Represents the vector formed by embedding two pieces of text;
[0031] The text similarity index is characterized by Jaccard similarity, which is expressed as follows:
[0032]
[0033] In the formula, A and B Two paragraphs of text X and Y The word collection, | A ∩ B | represents the size of the intersection of two sets, | A ∪ B | represents the size of the union of two sets;
[0034] The information loss index is characterized by the difference between information entropy and mutual information, and the expression is as follows:
[0035]
[0036] In the formula, H ( X ),H ( Y ) is the information entropy of the two vectors, I ( X ; Y ) is the mutual information between two vectors;
[0037] Based on cosine similarity, Jaccard similarity and information loss index, the comprehensive similarity is calculated as follows:
[0038]
[0039] In the formula, λ C , λ J and λ I Parameters adjusted according to differences in text types in the field of power regulation.
[0040] As a preferred solution, the step of post-processing the texts whose comprehensive similarity meets the requirements by using a large language model comprises:
[0041] A large language model is used to perform prompt compression, text rearrangement, text summary and text fusion on texts that meet the requirements of comprehensive similarity; the prompt compression is to reduce the noise in the information by compressing the information retrieved from the knowledge base; the text rearrangement is to rearrange the retrieved text fragments to make the text fragments more consistent with the logical or semantic order; the text summarization is to perform generative summarization through a large language model to summarize a continuous text from several extracted text information; the text fusion is to integrate information through a large language model to merge similar or supplementary information in several text information.
[0042] As a preferred solution, the text rearrangement uses the Cohere Rerank model to rearrange the retrieved text fragments, and the expression is as follows:
[0043]
[0044] In the formula, is the vector sequence before rearrangement, is the rearranged vector sequence; N represents the number of vectors, Reranker represents the Cohere Rerank model, S The criteria used for rearrangement, θ are the parameters of the CohereRerank model; S and θ Adjustments will be made based on different texts in the field of power regulation.
[0045] As a preferred solution, the digital power control question and answer method based on a large language model also includes the step of storing the text of the question and answer into a memory component for calling, and using the text information after text rearrangement, text summarization and text fusion, combined with preset prompt words and the call to the memory component, the large language model generates corresponding answers based on this information.
[0046] In the second aspect, a digital intelligent power control question-answering system based on a large language model is provided, including:
[0047] The text collection and encoding module is used to collect text in the field of power regulation, use the embedding model to obtain the vector encoding of the text in the field of power regulation, and store it in the vector knowledge base;
[0048] The question text preprocessing module is used to receive the user's question text and preprocess the user's question text when the user asks a question;
[0049] The retrieval and matching module is used to input the pre-processed user question text into the retrieval tool, and use the retrieval tool to search and match in the vector knowledge base to obtain the text with comprehensive similarity that meets the requirements;
[0050] The answer generation module is used to use a large language model to post-process the texts that meet the requirements of comprehensive similarity and generate corresponding answers.
[0051] In a third aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the digital power control question and answer method based on a large language model is implemented.
[0052] Compared with the prior art, the first aspect of the present invention has at least the following beneficial effects:
[0053] By combining the advanced large language model with the retrieval function of the text vector knowledge base in the field of power regulation, when users ask questions, it is able to understand and process complex natural language questions and provide more accurate and relevant answers. The present invention uses a large language model to post-process the text whose comprehensive similarity meets the requirements and generates corresponding answers. Due to the language understanding and generation capabilities of the large language model and its powerful generalization performance, it is able to generate answers from multiple angles and across multiple power regulation sub-fields, thereby significantly improving the generalization performance of power regulation questions and answers. The digital power regulation question and answer method based on the large language model of the present invention is not only suitable for conventional question and answer tasks, but also can cope with emergency consultations in power regulation, increasing the application scope and flexibility of the system. By adopting the power regulation question and answer method proposed by the present invention, the dependence on professionals can be reduced, so that non-professional users can also quickly obtain information related to power regulation, thereby reducing operation and maintenance costs.
[0054] Furthermore, the present invention introduces large model technology, retrieval enhancement generation technology, memory mechanism and chain workflow mechanism into the field of power regulation, establishes a vector knowledge base construction chain workflow and an intelligent question and answer chain workflow, connects each module in sequence with a chain structure, and the vector knowledge base construction chain workflow completes text parsing and preprocessing, semantic-based segmentation and slicing, language model-based vector embedding and index-based vector storage for the text in the field of power regulation in sequence; the intelligent question and answer chain workflow completes format conversion, noise removal, question reformulation and other preprocessing for the user text in sequence, as well as language model-based vector embedding, iterative and recursive retrieval based on comprehensive similarity measurement, post-processing including prompt compression, text rearrangement, text summarization and text fusion, answer generation based on a large language model and prompt words, etc. The question and answer method of the present invention has high independence, flexibility and scalability, and can reduce the development and maintenance costs of the system. At the same time, the present invention utilizes memory components to enable the system to have the ability to remember and read the question and answer context, and introduces the memory component as a separate component into the power regulation intelligent question and answer chain workflow, thereby enhancing the continuity of the dialogue and improving the user interaction experience.
[0055] Furthermore, the present invention proposes a comprehensive similarity measurement composed of text similarity, vector similarity and information loss. The use of the comprehensive similarity measurement greatly improves the accuracy of vector retrieval and matching, thereby improving the effect of the entire question-answering system.
[0056] It can be understood that the beneficial effects of the second to third aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0058] Figure 1 Schematic diagram of the design principle of the digital power control question-answering method based on the large language model in an embodiment of the present invention;
[0059] Figure 2 A schematic diagram of a process of constructing a chain workflow of a vector knowledge base according to an embodiment of the present invention;
[0060] Figure 3 A flowchart of an intelligent question-answer chain workflow according to an embodiment of the present invention. DETAILED DESCRIPTION
[0061] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0062] The embodiment of the present invention proposes a digital electric power control question-answering method based on a large language model, which belongs to the application of the field of artificial intelligence technology in the field of electric power automation technology. By introducing natural language processing technology, especially involving the use of large pre-trained language models and vector retrieval methods, the performance of the automatic question-answering system in the electric power control industry is improved. This technology enables the automatic question-answering system in the field of electric power control to have higher answer accuracy and response efficiency when processing highly professional and real-time queries, meeting the industry's demand for intelligent services during the process of informatization and digital transformation.
[0063] A note about Retrieval-Augmented Generation (RAG): Retrieval-Augmented Generation (RAG) is a natural language processing technique that combines information retrieval and text generation. In this method, the system first uses a pre-trained retrieval component to retrieve relevant contextual information or documents from a knowledge base. This retrieved information is then provided to a generative model, which incorporates this information into the text it generates to improve the accuracy of answering questions, generate explanations, or enhance the output quality of the language model. The RAG method is particularly suitable for tasks that require external knowledge, such as open-domain question answering, factual content generation, or any scenario that requires citing specific knowledge points. In this way, the generated text is richer, more accurate, and more informative.
[0064] About Large Language Models (LLMs): Large Language Models are a natural language processing technology based on deep learning, which is widely used to understand and generate natural language text. These models are based on the transformer architecture, have a large number of parameters, and can handle large-scale data sets. Large models learn the complex patterns and structures of language through pre-training on a large amount of text, so they can perform well in a variety of language tasks, including text generation, translation, question answering, summarization, sentiment analysis, etc.
[0065] The embodiment of the present invention is based on a digital electric power control question-answering method of a large language model. The main applied technologies include: a large language model, such as a generative pre-trained transformer GPT and a bidirectional encoder BERT, which uses a deep learning network to pre-train on a large-scale data set to understand and generate human language, thereby having rich semantic understanding and answer generation capabilities. The retrieval enhancement generation method combines information retrieval technology and a language generation model to improve the accuracy and reliability of the question-answering system by retrieving relevant documents and using these documents to assist the language model in generating answers. Vector embedding refers to converting text into a mathematical vector form so that the machine can retrieve information by calculating the similarity between vectors. Vector similarity calculation refers to the use of mathematical methods such as cosine similarity and Euclidean distance to measure the similarity between two vectors and find the best match between questions and answers. The memory component is used to enhance the contextual understanding ability of the question-answering system, and can remember and read previous question-answering situations to provide more coherent and accurate answers.
[0066] See also Figure 1 The digital electric power control question-answering method based on a large language model in an embodiment of the present invention includes:
[0067] S1. Collect texts in the field of power regulation, use the embedding model to obtain the vector encoding of the texts in the field of power regulation, and store them in the vector knowledge base;
[0068] S2. When a user asks a question, receiving the user's question text and preprocessing the user's question text;
[0069] S3, input the preprocessed user question text into the search tool, and use the search tool to search and match in the vector knowledge base to obtain the text whose comprehensive similarity meets the requirements;
[0070] S4. Use a large language model to post-process the texts that meet the comprehensive similarity requirements and generate corresponding answers.
[0071] In a possible implementation manner, the step of collecting texts in the field of power regulation in step S1 includes:
[0072] The collected text in the field of power regulation is preprocessed. The preprocessing operation includes document parsing and converting documents in non-text format into plain text format. For example, text materials exist in non-text format (such as PDF or Word documents) and need to be converted into plain text format. The embodiment of the present invention is implemented by PyPDF2 and python-docx libraries in Python programming software. And, after preprocessing, segmentation and slicing are performed to divide the text content into smaller paragraphs or sentences. In an embodiment of the present invention, sentence segmentation and word segmentation are achieved through the NLTK library and semantic analysis technology in Python programming software.
[0073] In a possible implementation, the step of using the embedding model to obtain the vector encoding of the text in the field of power regulation and control and storing it in the vector knowledge base in step S1 includes:
[0074] The bidirectional encoder BERT model is used to obtain the vector encoding of the text after segmentation and slicing. For more complex power regulation contexts, BERT can process the entire text and capture richer contextual information. The expression for obtaining the vector encoding of the bidirectional encoder BERT model is as follows:
[0075]
[0076] in, Represents the input segmented slice text, s represents the vector representation of the corresponding text, θ Represents the BERT model parameters; establishes a relationship between the text in the field of power regulation and the corresponding vector in the form of an index and stores it in the vector knowledge base.
[0077] In order to combine the various processes of the system in a modular and scalable manner, the embodiment of the present invention introduces a chain workflow structure to execute each step in an orderly and independent manner. Step S1 is to construct a chain workflow for the vector knowledge base, such as Figure 2 shown.
[0078] In a possible implementation, in step S2, when a user asks a question, the preprocessing module in the intelligent question-answering chain workflow uses the format conversion component to convert the user's question text, remove noise, and reformulate the question using the large model and corresponding prompt words; specifically, regular expressions are used to remove noise from the user's question text to remove irrelevant characters and interference information in the text; question reformulation refers to using the large model to standardize the user's question text for subsequent processing. The expression of this process is as follows:
[0079]
[0080] In the formula, LLM() represents the large model calculation, Prompt represents the prompt word, Original_Question represents the original text of the user question, θ represents the parameters of the large model, and Processed_Question represents the reformulated user question.
[0081] Steps S2 to S5 of the embodiment of the present invention are the process of the intelligent question-answering chain workflow. Figure 3 shown.
[0082] In a possible implementation, in step S3, the preprocessed user question text is input into a search tool, and the search tool is used to search and match in a vector knowledge base to obtain a text whose comprehensive similarity meets the requirements, including: the search tool uses a bidirectional encoder BERT embedding network to embed the user question text into a vector, converts the user question text into a vector, and then uses vector similarity, text similarity, and information loss indicators to search and match the most similar vector in the vector knowledge base;
[0083] The vector similarity index is characterized by cosine similarity, which is expressed as follows:
[0084]
[0085] In the formula, X , Y Represents the vector formed by embedding two pieces of text;
[0086] The text similarity index is characterized by Jaccard similarity, which is expressed as follows:
[0087]
[0088] In the formula, A and B Two paragraphs of text X and Y The word collection, | A ∩ B | represents the size of the intersection of two sets, | A ∪ B | represents the size of the union of two sets;
[0089] The information loss index is characterized by the difference between information entropy and mutual information, and the expression is as follows:
[0090]
[0091] In the formula, H ( X ), H ( Y ) is the information entropy of the two vectors, I ( X ; Y ) is the mutual information between two vectors; the smaller the information difference between two vectors, the more similar they are.
[0092] Based on cosine similarity, Jaccard similarity and information loss index, the comprehensive similarity is calculated as follows:
[0093]
[0094] In the formula, λ C , λ J and λ I Parameters adjusted according to differences in text types in the field of power regulation.
[0095] Step S3 obtains texts whose comprehensive similarity meets the requirements, that is, several texts with the highest comprehensive similarity. If no text with high comprehensive similarity can be found, the information that no results are found is returned.
[0096] Vector similarity is a measure of the similarity between two vectors. In machine learning and data analysis, data points are often represented as vectors, which can be points in a multidimensional space and represent various features. Vector similarity is used to determine how close or similar these vectors or points are.
[0097] Text similarity refers to the degree of similarity between two texts in terms of content, semantics or context. It is a basic concept in the field of natural language processing, used to measure and compare the similarity between documents, sentences or phrases. The measurement of text similarity can be based on a variety of methods, including lexical similarity, structural similarity, semantic similarity, similarity based on vector space, similarity based on language model, etc. Text similarity plays an important role in applications such as information retrieval, document classification, text clustering, plagiarism detection and question-answering systems.
[0098] Information loss is an important concept in information theory, which refers to the phenomenon of losing some information during data processing, compression, transmission or conversion. It can also be used to measure the similarity between two sets of information.
[0099] A similarity measure is a function or criterion used to evaluate the degree of similarity between two objects (such as numbers, text, images, etc.). In the field of machine learning and data analysis, such a measure can be used to compare data points, feature vectors, or complex objects, and is used in various applications including clustering, classification, recommendation systems, and information retrieval.
[0100] In a possible implementation, step S4 uses a large language model to post-process the retrieved texts with the highest similarity, that is, the large language model is used to perform prompt compression, text rearrangement, text summary and text fusion on the texts that meet the comprehensive similarity requirements, so as to generate a more complete and rich answer. The prompt compression is to compress the information retrieved from the knowledge base to reduce the noise in the information and improve the subsequent large model generation efficiency; the text rearrangement is to rearrange the retrieved text fragments according to certain rules or algorithms to make the text fragments more logical or semantic order; the text summary is to perform generative summarization through a large language model to summarize a continuous text from the extracted text information; the text fusion is to integrate information through a large language model to merge similar or supplementary information in several text information.
[0101] In a possible implementation manner, the text rearrangement described in the embodiment of the present invention uses the Cohere Rerank model to rearrange the retrieved text segments, and the expression is as follows:
[0102]
[0103] In the formula, is the vector sequence before rearrangement, is the rearranged vector sequence; N represents the number of vectors, Reranker represents the Cohere Rerank model, S The criteria used for rearrangement, θ are the parameters of the CohereRerank model; S and θ Adjustments will be made based on different texts in the field of power regulation.
[0104] In a possible implementation, the digital electric power control question and answer method based on a large language model in an embodiment of the present invention also includes the step of storing the text of the question and answer into a memory component for calling, and using the text information after text rearrangement, text summarization and text fusion, combined with preset prompt words and the call to the memory component, the large language model generates corresponding answers based on this information.
[0105] Afterwards, the text of this question and answer is stored in the memory component for later retrieval.
[0106] Finally, the generated answer is output through the user interface to complete the interaction with the user.
[0107] In the context of a large language model, a prompt refers to one or a group of words or sentences used to guide or stimulate the model to generate a specific type of response. In the field of machine learning, especially when using a pre-trained language model for a task, prompts are used as part of the input to help the model understand the desired task or output format.
[0108] A memory component is a module or subsystem used to store, maintain, and retrieve information. In a large model, the introduction of a memory component enables the model to remember and utilize contextual input and learned information.
[0109] The digital and intelligent power control question-answering method based on a large language model in the embodiment of the present invention solves the shortcomings of the existing automatic question-answering technology in the field of power control, which is mainly reflected in the following aspects:
[0110] (1) Improving the accuracy of question answering: By constructing a vector knowledge base of text in the field of power regulation, the system can understand and handle more complex and professional power regulation problems, thereby improving the accuracy of question answering.
[0111] (2) Highly digitalized responses: Combined with a large language model, the system can not only provide accurate answers, but also interact in a more natural language, improving the user's question-and-answer experience.
[0112] (3) Remembering the question-answer context: By introducing a memory component, the system can remember and read the context of questions and answers, providing support for coherent conversations.
[0113] (4) Improving the generalization of questions and answers: By optimizing the retrieval algorithm and enhancing the generation method, the system's generalization of questions and answers can be improved so that it can respond to more diverse and complex queries from users.
[0114] (5) Reduce information loss: By performing vector embedding processing on user question text and power control text, and using multiple metrics to calculate similarity, the loss in the information processing process is reduced, ensuring the integrity and accuracy of the information.
[0115] Another embodiment of the present invention further provides a digital intelligent power control question-answering system based on a large language model, comprising:
[0116] The text collection and encoding module is used to collect text in the field of power regulation, use the embedding model to obtain the vector encoding of the text in the field of power regulation, and store it in the vector knowledge base;
[0117] The question text preprocessing module is used to receive the user's question text and preprocess the user's question text when the user asks a question;
[0118] The retrieval and matching module is used to input the pre-processed user question text into the retrieval tool, and use the retrieval tool to search and match in the vector knowledge base to obtain the text with comprehensive similarity that meets the requirements;
[0119] The answer generation module is used to use a large language model to post-process the texts that meet the requirements of comprehensive similarity and generate corresponding answers.
[0120] The present invention combines a large language model with a search enhancement generation method. The main idea is to first use the embedded model to process the text data in the field of power regulation, obtain vector encoding and store it in the vector knowledge base; then perform pre-processing such as format conversion on the user's question text and input it into the search tool. In the search tool, the user's question text is vector-embedded, and the most similar vector is queried in the vector knowledge base using indicators such as vector similarity, text similarity, and information loss; then, the large language model generates an output based on the text corresponding to the vector and the pre-written prompt words and returns it to the user.
[0121] In some possible implementations, a knowledge graph may be used instead of a vector knowledge base, but this may result in reduced performance. The large language models used in the present invention may also be substituted for each other, which may result in changes in system performance. In addition, the fine-tuning technology of the large language model may be used instead of the retrieval enhancement generation technology, but this requires more computing power and may result in reduced performance.
[0122] Another embodiment of the present invention further proposes an electronic device, including a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the digital power control question and answer method based on a large language model.
[0123] Another embodiment of the present invention further proposes a computer-readable storage medium, which stores at least one instruction. When the at least one instruction is executed by a processor, the digital power control question and answer method based on a large language model is implemented.
[0124] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, USB flash drive, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals. For ease of explanation, the above content only shows the part related to the embodiment of the present invention. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer-readable storage medium is non-temporary and can be stored in a storage device formed by various electronic devices, which can realize the execution process recorded in the method of the embodiment of the present invention.
[0125] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0126] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0127] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A digital power control question-answering method based on a large language model, characterized in that: include: Collect texts in the field of power regulation, use the embedding model to obtain the vector encoding of the texts in the field of power regulation, and store them in the vector knowledge base; When a user asks a question, the user's question text is received and pre-processed; Input the preprocessed user question text into the search tool, and use the search tool to search and match in the vector knowledge base to obtain the text with the comprehensive similarity meeting the requirements; Use a large language model to post-process texts that meet the requirements for comprehensive similarity and generate corresponding answers; The step of post-processing the texts whose comprehensive similarity meets the requirements by using the large language model comprises: The large language model is used to perform prompt compression, text rearrangement, text summarization and text fusion on the texts that meet the requirements of comprehensive similarity; the prompt compression is to reduce the noise in the information by compressing the information retrieved from the knowledge base; the text rearrangement is to rearrange the retrieved text fragments to make the text fragments more logical or semantically ordered; the text summarization is to perform generative summarization through the large language model to summarize a continuous text from several extracted text information; the text fusion is to integrate information through the large language model to merge similar or supplementary information in several text information; The pre-processed user question text is input into a search tool, and the search tool is used to search and match in a vector knowledge base to obtain a text whose comprehensive similarity meets the requirements, including: the search tool performs vector embedding on the user question text, converts the user question text into a vector, and then uses vector similarity, text similarity and information loss index to search and match the most similar vector in the vector knowledge base; The vector similarity index is characterized by cosine similarity, which is expressed as follows: In the formula, X , Y Represents the vector formed by embedding two pieces of text; The text similarity index is characterized by Jaccard similarity, which is expressed as follows: In the formula, A and B Two paragraphs of text X and Y The word collection, | A ∩ B | represents the size of the intersection of two sets, | A ∪ B | represents the size of the union of two sets; The information loss index is characterized by the difference between information entropy and mutual information, and the expression is as follows: In the formula, H ( X ), H ( Y ) is the information entropy of the two vectors, I ( X ; Y ) is the mutual information between two vectors; Based on cosine similarity, Jaccard similarity and information loss index, the comprehensive similarity is calculated as follows: In the formula, λ C , λ J and λ I Parameters adjusted according to differences in text types in the field of power regulation.
2. According to the digital intelligent power control question-answering method based on large language model according to claim 1, it is characterized in that: The step of collecting texts in the field of power regulation includes: preprocessing the collected texts in the field of power regulation, wherein the preprocessing operation includes document parsing and converting documents in non-text format into plain text format; And, after preprocessing, segmentation and slicing are performed to divide the text content into paragraphs or sentences.
3. The digital and intelligent power control question-answering method based on a large language model according to claim 2 is characterized in that: The step of using the embedding model to obtain the vector encoding of the text in the field of power regulation and control and storing it in the vector knowledge base includes: The bidirectional encoder BERT model is used to obtain the vector encoding of the text after segmentation and slicing. The expression is as follows: in, Represents the input segmented slice text, s represents the vector representation of the corresponding text, θ Represents the BERT model parameters; establishes a relationship between the text in the field of power regulation and the corresponding vector in the form of an index and stores it in the vector knowledge base.
4. According to claim 1, the digital intelligent power control question-answering method based on a large language model is characterized in that: In the step of receiving the user's question text and preprocessing the user's question text when the user asks a question, the preprocessing operation includes using the large model and corresponding prompt words to convert the user's question text into a format, remove noise, and reformulate the question; Specifically, regular expressions are used to remove noise from user question texts and remove irrelevant characters and interference information in the texts. Question reformulation refers to the standardized restatement of user question texts using a large model. The expression is as follows: In the formula, LLM() represents the large model calculation, Prompt represents the prompt word, Original_Question represents the original text of the user question, θ represents the parameters of the large model, and Processed_Question represents the reformulated user question.
5. According to the digital intelligent power control question-answering method based on large language model in claim 1, it is characterized in that: The text rearrangement adopts the Cohere Rerank model to rearrange the retrieved text fragments, and the expression is as follows: In the formula, is the vector sequence before rearrangement, is the rearranged vector sequence; N represents the number of vectors, Reranker represents the Cohere Rerank model, S The criteria used for rearrangement, θ are the parameters of the CohereRerank model; S and θ Adjustments will be made based on different texts in the field of power regulation.
6. The digital and intelligent power control question-answering method based on a large language model according to claim 1 is characterized in that: It also includes the step of storing the text of the question and answer into the memory component call, using the text information after text rearrangement, text summary and text fusion, combined with preset prompt words and the call of the memory component, the large language model generates corresponding answers based on this information.
7. A digital electric power control question-answering system based on a large language model, characterized in that: include: The text collection and encoding module is used to collect text in the field of power regulation, use the embedding model to obtain the vector encoding of the text in the field of power regulation, and store it in the vector knowledge base; The question text preprocessing module is used to receive the user's question text and preprocess the user's question text when the user asks a question; The retrieval and matching module is used to input the pre-processed user question text into the retrieval tool, and use the retrieval tool to search and match in the vector knowledge base to obtain the text with the comprehensive similarity meeting the requirements; The answer generation module is used to use a large language model to post-process the texts that meet the requirements of comprehensive similarity and generate corresponding answers; The step of post-processing the texts whose comprehensive similarity meets the requirements by using the large language model comprises: The large language model is used to perform prompt compression, text rearrangement, text summarization and text fusion on the texts that meet the requirements of comprehensive similarity; the prompt compression is to reduce the noise in the information by compressing the information retrieved from the knowledge base; the text rearrangement is to rearrange the retrieved text fragments to make the text fragments more logical or semantically ordered; the text summarization is to perform generative summarization through the large language model to summarize a continuous text from several extracted text information; the text fusion is to integrate information through the large language model to merge similar or supplementary information in several text information; The pre-processed user question text is input into a search tool, and the search tool is used to search and match in a vector knowledge base to obtain a text whose comprehensive similarity meets the requirements, including: the search tool performs vector embedding on the user question text, converts the user question text into a vector, and then uses vector similarity, text similarity and information loss index to search and match the most similar vector in the vector knowledge base; The vector similarity index is characterized by cosine similarity, which is expressed as follows: In the formula, X , Y Represents the vector formed by embedding two pieces of text; The text similarity index is characterized by Jaccard similarity, which is expressed as follows: In the formula, A and B Two paragraphs of text X and Y The word collection, | A ∩ B | represents the size of the intersection of two sets, | A ∪ B | represents the size of the union of two sets; The information loss index is characterized by the difference between information entropy and mutual information, and the expression is as follows: In the formula, H ( X ), H ( Y ) is the information entropy of the two vectors, I ( X ; Y ) is the mutual information between two vectors; Based on cosine similarity, Jaccard similarity and information loss index, the comprehensive similarity is calculated as follows: In the formula, λ C , λ J and λ I Parameters adjusted according to differences in text types in the field of power regulation.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by the processor, it implements the digital power control question and answer method based on the large language model as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Bert model-based intelligent questioning and answering method and system for electric power safety regulations
CN117407511A
Intelligent voice query method for content of industrial manual
CN118227734A
Method, device and equipment for searching target domain based on large language model, and medium
CN118467595A
Cited By
Man-machine interaction language model output post-processing system supporting field-level score comparison and rule engine and optimization method
CN121598935A
Multi-factor scenario-based power operation safety measure intelligent generation method and system thereof
CN122711895A
Carbon energy intelligent analysis method and system based on AI agent and dynamic data access
CN122797567A