CN119003742B - Digital intelligent power regulation question-answering method and system based on large language model - Google Patents
Digital intelligent power regulation question-answering method and system based on large language model Download PDFInfo
- Publication number
- CN119003742B CN119003742B CN202411469462.8A CN202411469462A CN119003742B CN 119003742 B CN119003742 B CN 119003742B CN 202411469462 A CN202411469462 A CN 202411469462A CN 119003742 B CN119003742 B CN 119003742B
- Authority
- CN
- China
- Prior art keywords
- text
- vector
- question
- power regulation
- similarity
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
- G06N3/0455—Auto-encoder networks; Encoder-decoder networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
- G06N5/041—Abduction
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- Evolutionary Computation (AREA)
- Databases & Information Systems (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A digital intelligent power regulation question-answering method and system based on a large language model belong to the technical field of power automation, and the method comprises the steps of collecting power regulation field texts, obtaining vector codes of the power regulation field texts by using an embedded model, and storing the vector codes into a vector knowledge base; when a user puts out a question, receiving a user question text and preprocessing the user question text, inputting the preprocessed user question text into a search tool, searching and matching in a vector knowledge base to obtain a text with comprehensive similarity meeting the requirement, and adopting a large language model to post-process the text with the comprehensive similarity meeting the requirement and generate a corresponding answer. According to the invention, a large model technology, a retrieval enhancement generation technology, a memory mechanism and a chain workflow mechanism are introduced into the field of electric power regulation, a vector knowledge base is established to construct a chain workflow and an intelligent question-answering chain workflow, the question-answering accuracy can be improved, more natural language interaction can be realized, and the question-answering experience is improved.
Description
Technical Field
The invention belongs to the technical field of power automation, and particularly relates to a digital intelligent power regulation question-answering method and system based on a large language model.
Background
With the rapid development of information technology, especially the breakthrough of artificial intelligence and big data technology, automatic question-answering systems are gradually matured. The informatization and intelligent level improvement of the power regulation technology has important significance for ensuring the safe and stable operation of the power grid and improving the power service quality. Traditional power regulation question-answering systems rely on rule matching and simple keyword searching, which makes it difficult to process complex queries and provide deeply personalized services.
In the development process of the intelligent electric power regulation question-answering system, the existing technical scheme mainly depends on rule matching and keyword searching, for example, a method proposed in a Bert model-based electric power safety regulation intelligent question-answering method and system of patent application CN117407511A is mainly used for matching user questions through a preset rule base and retrieving answers related to keywords from a static knowledge base. The patent application with publication number CN117407511a represents one prior art scheme of a question-answer system in the power regulation field, and the technical scheme involves performing lexical, syntactic analysis and semantic understanding on text data in the power dispatching field, so as to realize automatic analysis and understanding of the text of the power safety regulations. The main content of the scheme comprises the steps of configuring question and answer pairs of the FAQ module, matching questions input by a user, text segmentation of an electric power safety procedure document, generating an index file, establishing an index based on the output index file by using the Anserini module, extracting paragraphs, generating paragraph scores, adopting a pretrained Bert model, training by using a professional data set and the like.
The question-answer pair of the FAQ module is configured to be used for filtering high-frequency questions, the FAQ module is used for matching the questions input by the user with the questions in the preset question-answer pair, if the questions are matched, answers corresponding to the matched questions are returned, if no return result or the matching score is lower than a threshold value, the next step is carried out, namely, a preprocessing mode is used for carrying out text segmentation on the electric power safety procedure document, and text data of Chinese wikipedia is added to generate an index file. Then, establishing an index based on the output index file by using a Anserini module, extracting paragraphs to generate paragraph scores, further adopting a pretrained Bert model, training by using CMRC2018 data and electric power safety regulation examination questions as a professional data set, then adjusting parameters in an algorithm of the trained Bert model according to the structure and characteristics of the regulation documents, extracting candidate answers in a Anserini module by using the Bert model, giving reading understanding scores, wherein the candidate answers are accurate answers of the extracted N paragraphs, further carrying out comprehensive weighting scores and score ordering on the candidate answers, finally outputting answers with highest scores, and giving the names and specific chapter information of the original documents where the answers are output. The prior art has at least the following disadvantages:
(1) The FAQ module matching method is very sensitive to the expression mode of the questions, and once the questions of the user deviate from the preset expression, the system can hardly give accurate answers.
(2) Along with the continuous updating and expanding of the knowledge in the electric power regulation field, the static knowledge base needs frequent manual updating and maintenance, which is time-consuming and labor-consuming and is easy to make mistakes.
(3) The method lacks the understanding capability of dialogue context, and can not process the problems of coherent dialogue or history-dependent interaction.
(4) The method has limited retrieval capability, is difficult to provide personalized retrieval schemes and answers according to the specific situation of the user, and tends to give universal and standardized answers.
(5) In the method, the interactivity of the user interaction with the system through natural language is weak, so that the satisfaction degree of the user is influenced.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a digital intelligent power regulation question-answering method and system based on a large language model, which can improve question-answering accuracy, can interact in a more natural language and can improve question-answering experience of users.
In order to achieve the above purpose, the present invention has the following technical scheme:
in a first aspect, a method for digital intelligent power regulation question-answering based on a large language model is provided, including:
Acquiring a power regulation field text, acquiring a vector code of the power regulation field text by using an embedded model, and storing the vector code into a vector knowledge base;
When a user gives a question, receiving a user question text and preprocessing the user question text;
Inputting the preprocessed user problem text into a retrieval tool, and retrieving and matching the user problem text in a vector knowledge base through the retrieval tool to obtain a text with comprehensive similarity meeting the requirement;
and (5) performing post-processing on the text with the comprehensive similarity meeting the requirement by adopting a large language model, and generating a corresponding answer.
The method for acquiring the text of the power regulation field comprises the steps of preprocessing the acquired text of the power regulation field, wherein the preprocessing comprises document analysis and conversion of a document in a non-text format into a plain text format;
And after preprocessing, carrying out segmentation slicing to divide the text content into paragraphs or sentences.
As a preferred solution, the step of obtaining the vector code of the text in the power regulation field by using the embedded model and storing the vector code in the vector knowledge base includes:
The vector coding of the text after the segmentation and slicing is obtained by adopting a bi-directional encoder BERT model, and the expression is as follows:
Wherein, And establishing a relation between the text in the power regulation field and the corresponding vector by adopting an index form, and storing the relation in a vector knowledge base.
As a preferred scheme, in the step of receiving and preprocessing the user question text when the user presents the question, the preprocessing operation includes format conversion, noise removal and question reformulation of the user question text by using the large model and the corresponding prompt word;
Specifically, a regular expression is adopted to remove noise of a user problem text, irrelevant characters and interference information in the text are removed, and the problem restation refers to the step of carrying out standardization restation on the user problem text by utilizing a large model, wherein the expression is as follows:
In the formula, LLM () represents large model calculation, prompt represents Prompt words, original_question represents Original text of user problem, θ represents parameters of large model, and processed_question represents user problem after restatement.
The search tool carries out vector embedding on the user problem text, converts the user problem text into a vector, and then searches and matches the most similar vector in a vector knowledge base by utilizing the vector similarity, the text similarity and the information loss index;
The vector similarity index is characterized by cosine similarity, and the expression is as follows:
wherein X, Y represents a vector formed by embedding two text segments;
The text similarity index is characterized by using Jaccard similarity, and the expression is as follows:
wherein A and B are word sets of two sections of texts X and Y respectively, |A n B| represents the size of the intersection of two sets, |A n B| represents the size of the union of two sets;
the information loss index is characterized by using the difference between the information entropy and the mutual information, and the expression is as follows:
Wherein H (X) and H (Y) are information entropy of two vectors, and I (X; Y) is mutual information between the two vectors;
based on cosine similarity, jaccard similarity and information loss index, the comprehensive similarity is calculated according to the following formula:
Where λ C、λJ and λ I are parameters that are adjusted according to the text type differences in the power regulation domain.
As a preferred solution, the step of post-processing the text with the integrated similarity meeting the requirement by using the large language model includes:
The method comprises the steps of adopting a large language model to carry out prompt compression, text rearrangement, text summarization and text fusion on texts with comprehensive similarity meeting requirements, wherein the prompt compression is used for reducing noise in information by compressing information retrieved from a knowledge base, the text rearrangement is used for rearranging retrieved text fragments to enable the text fragments to meet logic or semantic sequences better, the text summarization is carried out through the large language model to generate formula summarization, a section of continuous words is summarized from extracted pieces of text information, the text fusion is used for carrying out information integration through the large language model, and similar or complementary information in the pieces of text information is combined.
As a preferred scheme, the text rearrangement rearranges the retrieved text segments using a Cohere Rerank model, and the expression is as follows:
In the formula, For the sequence of vectors prior to the rearrangement,The method comprises the steps of obtaining a rearranged vector sequence, wherein N represents the number of vectors, reranker represents a Cohere Rerank model, S represents a standard adopted by rearrangement, θ represents a parameter of a Cohere Rerank model, and S and θ are adjusted according to different texts in the electric power regulation field.
As a preferable scheme, the intelligent electric power regulation question-answering method based on the large language model further comprises the step of storing the text of the question-answer into a memory component for calling, and the large language model generates corresponding answers according to the text information after text rearrangement, text summarization and text fusion by combining preset prompt words and calling of the memory component.
In a second aspect, a digital intelligent power regulation question-answering system based on a large language model is provided, including:
the text acquisition coding module is used for acquiring the text of the power regulation field, acquiring the vector codes of the text of the power regulation field by using the embedded model, and storing the vector codes into the vector knowledge base;
the problem text preprocessing module is used for receiving the user problem text and preprocessing the user problem text when the user gives a problem;
the retrieval matching module is used for inputting the preprocessed user problem text into a retrieval tool, and retrieving and matching the user problem text in a vector knowledge base through the retrieval tool to obtain a text with comprehensive similarity meeting the requirement;
And the answer generation module is used for carrying out post-processing on the texts with the comprehensive similarity meeting the requirements by adopting the large language model and generating corresponding answers.
In a third aspect, a computer-readable storage medium is provided, where at least one instruction is stored that, when executed by a processor, implements the large language model-based digital intelligent power regulation question-answering method.
Compared with the prior art, the first aspect of the invention has at least the following beneficial effects:
By combining an advanced large language model with the retrieval function of a text vector knowledge base in the power regulation field, when a user puts forward a problem, the user can understand and process the complex natural language problem and provide more accurate and relevant answers. According to the invention, the text with the comprehensive similarity meeting the requirement is post-processed by adopting the large language model, and the corresponding answer is generated, and the answers of multiple angles and crossing multiple power regulation sub-fields can be generated due to the language understanding and generating capability and the strong generalization performance of the large language model, so that the generalization performance of the power regulation question-answer is obviously improved. The intelligent power regulation question-answering method based on the large language model is not only suitable for conventional question-answering tasks, but also can cope with emergency consultation in power regulation, and increases the application range and flexibility of the system. By adopting the power regulation question-answering method provided by the invention, the dependence on professionals can be reduced, so that non-professional users can also quickly acquire power regulation related information, and the operation and maintenance cost is reduced.
Furthermore, the invention introduces a large model technology, a retrieval enhancement generation technology, a memory mechanism and a chained workflow mechanism into the field of electric power regulation, establishes a vector knowledge base to construct chained workflow and intelligent question-answer chained workflow, sequentially connects all modules by chained structure, constructs the chained workflow to complete text analysis and preprocessing, semantic-based segmentation slicing, language model-based vector embedding and index-based vector storage of the electric power regulation field text, and sequentially completes preprocessing such as format conversion, noise removal, question re-expression and the like of a user text, vector embedding based on a language model, iteration 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 a prompt word and the like. The question-answering method has higher independence, flexibility and expandability, and can reduce the development and maintenance cost of the system. Meanwhile, the memory component is utilized, so that the system has the capability of memorizing and reading the question-answering context, and the memory component is used as an independent component to be introduced into the intelligent question-answering chain type workflow for electric power regulation, thereby enhancing the continuity of conversation and improving the user interaction experience.
Furthermore, the invention provides the comprehensive similarity measurement consisting of text similarity, vector similarity and information loss, and the accuracy of vector retrieval and matching is greatly improved by utilizing the comprehensive similarity measurement, so that the effect of the whole question-answering system is improved.
It will be appreciated that the advantages of the second to third aspects may be found in the relevant description of the first aspect, and are not described in detail herein.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of the design principle of a digital intelligent power control question-answering method based on a large language model in the embodiment of the invention;
FIG. 2 is a schematic flow chart of a chain workflow constructed by a vector knowledge base according to an embodiment of the invention;
FIG. 3 is a schematic flow diagram of an intelligent question-answering chain workflow according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The embodiment of the invention provides a digital intelligent power control question-answering method based on a large language model, belongs to the application of the technical field of artificial intelligence in the technical field of power automation, and particularly relates to the improvement of the performance of an automatic question-answering system in the power control industry by using the large pre-training language model and a vector retrieval method through introducing a natural language processing technology. The technology ensures that the automatic question-answering system in the electric power regulation field has higher answer accuracy and response efficiency when processing the query with strong specialization and high real-time requirement, and meets the requirement of the industry on intelligent service in the informatization and digital transformation process.
Description of search enhancement generation method (abbreviated as RAG in english) the search enhancement generation method (RETRIEVAL-Augmented Generation, RAG) is a natural language processing technique that combines information search and text generation. In the method, the system first retrieves relevant context information or documents from a knowledge base using a pre-trained retrieval component. The retrieved information is then provided to a generation model that incorporates the information into its generated text to improve the accuracy of answering the questions, generate an interpretation, or enhance the output quality of the language model. The RAG method is particularly applicable to tasks requiring external knowledge, such as open domain questions and answers, factual content generation, or any scenario requiring reference to a specific knowledge point. In this way, the generated text is richer, more accurate and more informative.
Description of a large language model (or called large model, english abbreviated LLM) the large language model (Large Language Models) is a deep learning-based natural language processing technique that is widely used for understanding and generating natural language text. These models are based on the transformer architecture, have a large number of parameters, and can handle large-scale data sets. The large model learns the complex patterns and structures of languages through pre-training on a large amount of texts, and therefore can perform excellently on various language tasks including text generation, translation, question-answering, abstract, emotion analysis and the like.
The intelligent power regulation question-answering method based on the large language model mainly comprises the following steps that the large language model, such as a generated pre-training transformer GPT and a bi-directional encoder BERT, is pre-trained on a large-scale data set by utilizing a deep learning network to understand and generate human language, so that the intelligent power regulation question-answering method has rich semantic understanding and answer generating capability. The method for generating the search enhancement combines the information search technology and the language generation model, and generates answers by searching related documents and using the document auxiliary language model, thereby improving the accuracy and the reliability of the question-answering system. Vector embedding refers to converting text into a mathematical vector form, such that a machine can retrieve information by computing the similarity between vectors. Vector similarity calculation refers to measuring the similarity degree of two vectors by using mathematical methods such as cosine similarity, euclidean distance and the like, and finding the best match between a question and an answer. The memory component is then used to enhance the contextual understanding capabilities of the question-answering system, and is capable of memorizing and reading previous question-answering scenarios in order to provide a more consistent and accurate answer.
Referring to fig. 1, the digital intelligent power regulation question-answering method based on a large language model in the embodiment of the invention includes:
S1, acquiring a power regulation field text, acquiring a vector code of the power regulation field text by using an embedded model, and storing the vector code into a vector knowledge base;
s2, when a user gives a problem, receiving a user problem text and preprocessing the user problem text;
S3, inputting the preprocessed user problem text into a search tool, and searching and matching in a vector knowledge base through the search tool to obtain a text with comprehensive similarity meeting the requirement;
S4, performing post-processing on the text with the comprehensive similarity meeting the requirement by adopting a large language model, and generating a corresponding answer.
In one possible implementation manner, the step of collecting the text of the power regulation field in step S1 includes:
Preprocessing the acquired text in the power regulation field, wherein the preprocessing operation comprises document analysis and conversion of a document in a non-text format into a plain text format, for example, text materials exist in the non-text format (such as PDF or Word document) and need to be converted into the plain text format, and the embodiment of the invention is realized through PyPDF and Python-docx libraries in Python programming software. And after preprocessing, segmentation slicing is carried out to divide the text content into smaller paragraphs or sentences. In the embodiment of the invention, the clauses and the segmentation are realized through NLTK libraries in Python programming software and semantic analysis technology.
In one possible implementation manner, the step of obtaining the vector code of the text of the power regulation field using the embedded model and storing the vector code in the vector knowledge base in step S1 includes:
And acquiring the vector codes of the text after the segmented slicing by adopting a bi-directional encoder BERT model, and acquiring the vector codes of the segmented slicing text by adopting the bi-directional encoder BERT model. For more complex power regulation contexts, BERT can process whole pieces of text, capturing more rich context information. The bi-directional encoder BERT model obtains the expression of vector coding as follows:
Wherein, And establishing a relation between the text in the power regulation field and the corresponding vector by adopting an index form, and storing the relation in a vector knowledge base.
In order to modularly and extendably combine the various flows of the system together, embodiments of the present invention introduce a chained workflow structure to sequentially and independently perform the various steps. Step S1 is to construct a chained workflow for the vector knowledge base, as shown in FIG. 2.
In a possible implementation manner, when a user presents a problem, step S2, a preprocessing module in the intelligent question-answering chain workflow performs format conversion, noise removal and problem reformulation on a user problem text by using a large model and corresponding prompt words through a format conversion component, specifically, a regular expression is adopted to perform noise removal on the user problem text, extraneous characters and interference information in the text are removed, the problem reformulation refers to standardized reformulation on the user problem text by using the large model for subsequent processing, and the expression of the process is as follows:
In the formula, LLM () represents large model calculation, prompt represents Prompt words, original_question represents Original text of user problem, θ represents parameters of large model, and processed_question represents user problem after restatement.
Steps S2 to S5 of the embodiment of the present invention are the flow of the intelligent question-answering chain workflow, as shown in fig. 3.
In a possible implementation manner, step S3, the step of inputting the preprocessed user question text into a search tool, and searching and matching the user question text in a vector knowledge base through the search tool to obtain a text with comprehensive similarity meeting the requirement includes that the search tool adopts a bi-directional encoder BERT embedding network to perform vector embedding on the user question text, converts the user question text into a vector, and then searches and matches the most similar vector in the vector knowledge base by using vector similarity, text similarity and information loss index;
The vector similarity index is characterized by cosine similarity, and the expression is as follows:
wherein X, Y represents a vector formed by embedding two text segments;
The text similarity index is characterized by using Jaccard similarity, and the expression is as follows:
wherein A and B are word sets of two sections of texts X and Y respectively, |A n B| represents the size of the intersection of two sets, |A n B| represents the size of the union of two sets;
the information loss index is characterized by using the difference between the information entropy and the mutual information, and the expression is as follows:
Wherein H (X) and H (Y) are information entropy of two vectors, I (X; Y) is mutual information between the two vectors, and the smaller the information difference between the two vectors is, the more similar the two vectors are.
Based on cosine similarity, jaccard similarity and information loss index, the comprehensive similarity is calculated according to the following formula:
Where λ C、λJ and λ I are parameters that are adjusted according to the text type differences in the power regulation domain.
And S3, obtaining texts with the comprehensive similarity meeting the requirement, namely a plurality of texts with the highest comprehensive similarity, and if the texts with the high comprehensive similarity cannot be searched, returning information of the searched results.
Where vector similarity refers to a characterization of how similar two vectors are. In machine learning and data analysis, data points are often represented as vectors, which may be points in a multidimensional space, representing various features. Vector similarity is used to determine how close or similar these vectors or points are.
And text similarity refers to the degree of similarity in content, semantics, or context of two pieces of text. It is a basic concept in the field of natural language processing for measuring and comparing similarity between documents, sentences or phrases. The measurement of text similarity may be based on a variety of methods including lexical similarity, structural similarity, semantic similarity, similarity based on vector space, similarity based on language models, and the like. Text similarity plays an important role in applications such as information retrieval, document classification, text clustering, plagiarism detection, question-answering systems and the like.
Information loss is an important concept in information theory, and refers to the phenomenon that part of information is lost in the processes of data processing, compression, transmission or conversion, and can also be used for measuring the similarity of two groups of information.
The similarity measure is a function or criterion used to evaluate the degree of similarity between two objects (e.g., numbers, text, images, etc.). In the field of machine learning and data analysis, such metrics may be used to compare data points, feature vectors, or complex objects, and for various applications, including clustering, classification, recommendation systems, and information retrieval.
In one possible implementation manner, step S4 performs post-processing on the several texts with highest searched similarity by using a large language model, that is, performs prompt compression, text rearrangement, text summarization and text fusion on the texts with comprehensive similarity meeting the requirement by using the large language model, so as to generate more complete and rich answers. The prompt compression is used for reducing noise in information and improving the generation efficiency of a subsequent large model by compressing information retrieved from a knowledge base, the text rearrangement is used for rearranging retrieved text fragments according to a certain rule or algorithm to enable the text fragments to more accord with logic or semantic sequences, the text summarization is used for generating type summarization through a large language model, a section of continuous words is summarized from a plurality of extracted text information, the text fusion is used for integrating information through the large language model, and similar or supplementary information in the plurality of text information is combined.
In a possible implementation manner, the text rearrangement according to the embodiment of the present invention rearranges the retrieved text segments using a Cohere Rerank model, where the expression is as follows:
In the formula, For the sequence of vectors prior to the rearrangement,The method comprises the steps of obtaining a rearranged vector sequence, wherein N represents the number of vectors, reranker represents a Cohere Rerank model, S represents a standard adopted by rearrangement, θ represents a parameter of a Cohere Rerank model, and S and θ are adjusted according to different texts in the electric power regulation field.
In a possible implementation manner, the intelligent power regulation question-answering method based on the large language model further comprises the step of storing the text of the question-answer into a memory component for calling, and the large language model generates corresponding answers according to the text information after text rearrangement, text summarization and text fusion by combining preset prompt words and calling of the memory component.
Thereafter, the text of the question and answer is saved in the memory component for later recall.
And finally, outputting the generated answer through a user interface to complete interaction with a user.
A Prompt term (Prompt) in the context of a large language model refers to a word or a group of words or sentences used to guide or excite the model to generate a particular type of response. In the field of machine learning, and in particular when using pre-trained language models for tasks, a prompt word is used as part of the input to assist the model in understanding the desired task or output format.
Memory components refer to modules or subsystems for storing, maintaining, and retrieving information. In large models, the introduction of a memory component enables the model to remember and utilize contextual input and learned information.
The intelligent power regulation question-answering method based on the large language model solves the defects of the automatic question-answering technology in the existing power regulation field, and is mainly characterized in the following aspects:
(1) And the question and answer accuracy is improved by constructing a vector knowledge base of the text in the electric power regulation field, so that the system can understand and process more complicated and professional electric power regulation problems, and the question and answer accuracy is improved.
(2) The system can provide accurate answers, can interact in a more natural language and improves the question and answer experience of users by combining a large language model.
(3) Memorizing the context of questions and answers by introducing a memorizing component, the system can memorize and read the context of questions and answers, thereby providing support for coherent conversations.
(4) And the generalization of the question and answer is improved, namely, the generalization of the question and answer of the system is improved through optimizing a search algorithm and enhancing a generation method, so that the question and answer can respond to more diversified and more complex queries of users.
(5) The information loss is reduced by carrying out vector embedding processing on the user problem text and the power regulation text and carrying out similarity calculation by utilizing various measurement indexes, so that the loss in the information processing process is reduced, and the integrity and the accuracy of the information are ensured.
The invention also provides a digital intelligent power regulation question-answering system based on a large language model, which comprises the following steps:
the text acquisition coding module is used for acquiring the text of the power regulation field, acquiring the vector codes of the text of the power regulation field by using the embedded model, and storing the vector codes into the vector knowledge base;
the problem text preprocessing module is used for receiving the user problem text and preprocessing the user problem text when the user gives a problem;
the retrieval matching module is used for inputting the preprocessed user problem text into a retrieval tool, and retrieving and matching the user problem text in a vector knowledge base through the retrieval tool to obtain a text with comprehensive similarity meeting the requirement;
And the answer generation module is used for carrying out post-processing on the texts with the comprehensive similarity meeting the requirements by adopting the large language model and generating corresponding answers.
The invention combines a large language model with a search enhancement generation method, and the main idea is that text data in the power regulation field is processed by using an embedded model to obtain vector codes and store the vector codes in a vector knowledge base, and then preprocessing such as format conversion is carried out on a user problem text and the text is input into a search tool. In the search tool, vector embedding processing is carried out on the text of the user problem, the most similar vector is inquired in a vector knowledge base by utilizing indexes such as vector similarity, text similarity, information loss and the like, and then, the text corresponding to the vector and a prompt word written in advance are combined, and the large language model is used for generating and outputting and returning to the user.
In some possible implementations, knowledge maps may be used instead of vector knowledge bases, but doing so may result in reduced performance. The large language models used in the present invention can be replaced with each other, which can result in a change in system performance. Furthermore, a fine tuning technique of a large language model may be used instead of the search enhancement generation technique, but doing so requires more computational effort and may cause a decrease in performance.
Another embodiment of the present invention also proposes an electronic device including a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the large language model-based digital intelligent power regulation question-answering method.
Another embodiment of the present invention also proposes a computer-readable storage medium storing at least one instruction that, when executed by a processor, implements the large language model-based digital intelligent power regulation question-answering method.
The computer program comprises computer program code which may be in source code form, object code form, executable file or in some intermediate form, etc. The computer readable storage medium may include any entity or device capable of carrying the computer program code, a medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, an electrical carrier wave signal, a telecommunication signal, a software distribution medium, etc. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals. For convenience of description, the foregoing disclosure shows only those parts relevant to the embodiments of the present invention, and specific technical details are not disclosed, but reference is made to the method parts of the embodiments of the present invention. The computer readable storage medium is non-transitory and can be stored in a storage device formed by various electronic devices, and can implement the execution procedure described in the method according to the embodiment of the present invention.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flowchart and/or block of the flowchart illustrations and/or block diagrams, and combinations of flowcharts and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Finally, it should be noted that the above embodiments are only for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the specific embodiments of the present invention without departing from the spirit and scope of the present invention, and any modifications and equivalents are intended to be included in the scope of the claims of the present invention.
Claims (8)
1. A digital intelligent power regulation question-answering method based on a large language model is characterized by comprising the following steps:
Acquiring a power regulation field text, acquiring a vector code of the power regulation field text by using an embedded model, and storing the vector code into a vector knowledge base;
When a user gives a question, receiving a user question text and preprocessing the user question text;
Inputting the preprocessed user problem text into a retrieval tool, and retrieving and matching the user problem text in a vector knowledge base through the retrieval tool to obtain a text with comprehensive similarity meeting the requirement;
Performing post-processing on texts with comprehensive similarity meeting requirements by adopting a large language model, and generating corresponding answers;
the step of post-processing the text with the comprehensive similarity meeting the requirement by adopting the large language model comprises the following steps:
the method comprises the steps of adopting a large language model to carry out prompt compression, text rearrangement, text summarization and text fusion on texts with comprehensive similarity meeting requirements, wherein the prompt compression is used for reducing noise in information by compressing information retrieved from a knowledge base, the text rearrangement is used for rearranging retrieved text fragments so that the text fragments more meet logic or semantic sequences, the text summarization is carried out through the large language model to generate a summary, and a section of continuous words is summarized from extracted pieces of text information;
The method comprises the steps of inputting the preprocessed user problem text into a search tool, searching and matching the user problem text in a vector knowledge base through the search tool, wherein the step of obtaining the text with the comprehensive similarity meeting the requirement comprises the steps of carrying out vector embedding on the user problem text by the search tool, converting the user problem text into a vector, and searching and matching the most similar vector in the vector knowledge base by utilizing the vector similarity, the text similarity and the information loss index;
The vector similarity index is characterized by cosine similarity, and the expression is as follows:
wherein X, Y represents a vector formed by embedding two text segments;
The text similarity index is characterized by using Jaccard similarity, and the expression is as follows:
wherein A and B are word sets of two sections of texts X and Y respectively, |A n B| represents the size of the intersection of two sets, |A n B| represents the size of the union of two sets;
the information loss index is characterized by using the difference between the information entropy and the mutual information, and the expression is as follows:
Wherein H (X) and H (Y) are information entropy of two vectors, and I (X; Y) is mutual information between the two vectors;
based on cosine similarity, jaccard similarity and information loss index, the comprehensive similarity is calculated according to the following formula:
Where λ C、λJ and λ I are parameters that are adjusted according to the text type differences in the power regulation domain.
2. The method for learning and answering the intelligent power regulation and control based on the large language model as set forth in claim 1, wherein the step of collecting the power regulation and control field text includes preprocessing the collected power regulation and control field text, the preprocessing operation including document parsing and converting the document in a non-text format into a plain text format;
And after preprocessing, carrying out segmentation slicing to divide the text content into paragraphs or sentences.
3. The method for learning and answering digital intelligent power regulation based on large language model according to claim 2, wherein the step of obtaining the vector code of the text of the power regulation field by using the embedded model and storing the vector code in the vector knowledge base comprises the steps of:
The vector coding of the text after the segmentation and slicing is obtained by adopting a bi-directional encoder BERT model, and the expression is as follows:
Wherein, And establishing a relation between the text in the power regulation field and the corresponding vector by adopting an index form, and storing the relation in a vector knowledge base.
4. The method for digital intelligent power control question-answering based on large language model according to claim 1, wherein in the step of receiving and preprocessing user question text when a user presents a question, the preprocessing operation includes format conversion of user question text, noise removal and question reformulation using large model and corresponding prompt word;
Specifically, a regular expression is adopted to remove noise of a user problem text, irrelevant characters and interference information in the text are removed, and the problem restation refers to the step of carrying out standardization restation on the user problem text by utilizing a large model, wherein the expression is as follows:
In the formula, LLM () represents large model calculation, prompt represents Prompt words, original_question represents Original text of user problem, θ represents parameters of large model, and processed_question represents user problem after restatement.
5. The large language model based digital intelligent power regulation question-answering method according to claim 1, wherein the text rearrangement rearranges the retrieved text fragments using Cohere Rerank model, and the expression is as follows:
In the formula, For the sequence of vectors prior to the rearrangement,The method comprises the steps of obtaining a rearranged vector sequence, wherein N represents the number of vectors, reranker represents a Cohere Rerank model, S represents a standard adopted by rearrangement, θ represents a parameter of a Cohere Rerank model, and S and θ are adjusted according to different texts in the electric power regulation field.
6. The intelligent power regulation question-answering method based on the large language model according to claim 1, further comprising the step of storing the text of the question-answer into a memory component for calling, wherein the large language model generates corresponding answers according to the text information after text rearrangement, text summarization and text fusion by combining preset prompt words and calling to the memory component.
7. A digital intelligent power regulation question-answering system based on a large language model is characterized by comprising:
the text acquisition coding module is used for acquiring the text of the power regulation field, acquiring the vector codes of the text of the power regulation field by using the embedded model, and storing the vector codes into the vector knowledge base;
the problem text preprocessing module is used for receiving the user problem text and preprocessing the user problem text when the user gives a problem;
the retrieval matching module is used for inputting the preprocessed user problem text into a retrieval tool, and retrieving and matching the user problem text in a vector knowledge base through the retrieval tool to obtain a text with comprehensive similarity meeting the requirement;
The answer generation module is used for carrying out post-processing on the texts with the comprehensive similarity meeting the requirements by adopting a large language model and generating corresponding answers, and the step of carrying out post-processing on the texts with the comprehensive similarity meeting the requirements by adopting the large language model comprises the following steps:
the method comprises the steps of adopting a large language model to carry out prompt compression, text rearrangement, text summarization and text fusion on texts with comprehensive similarity meeting requirements, wherein the prompt compression is used for reducing noise in information by compressing information retrieved from a knowledge base, the text rearrangement is used for rearranging retrieved text fragments so that the text fragments more meet logic or semantic sequences, the text summarization is carried out through the large language model to generate a summary, and a section of continuous words is summarized from extracted pieces of text information;
The method comprises the steps of inputting the preprocessed user problem text into a search tool, searching and matching the user problem text in a vector knowledge base through the search tool, wherein the step of obtaining the text with the comprehensive similarity meeting the requirement comprises the steps of carrying out vector embedding on the user problem text by the search tool, converting the user problem text into a vector, and searching and matching the most similar vector in the vector knowledge base by utilizing the vector similarity, the text similarity and the information loss index;
The vector similarity index is characterized by cosine similarity, and the expression is as follows:
wherein X, Y represents a vector formed by embedding two text segments;
The text similarity index is characterized by using Jaccard similarity, and the expression is as follows:
wherein A and B are word sets of two sections of texts X and Y respectively, |A n B| represents the size of the intersection of two sets, |A n B| represents the size of the union of two sets;
the information loss index is characterized by using the difference between the information entropy and the mutual information, and the expression is as follows:
Wherein H (X) and H (Y) are information entropy of two vectors, and I (X; Y) is mutual information between the two vectors;
based on cosine similarity, jaccard similarity and information loss index, the comprehensive similarity is calculated according to the following formula:
Where λ C、λJ and λ I are parameters that are adjusted according to the text type differences in the power regulation domain.
8. A computer-readable storage medium storing at least one instruction that when executed by a processor implements the large language model-based digital intelligent power regulation question-answering method according to any one of claims 1 to 6.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411469462.8A CN119003742B (en) | 2024-10-21 | 2024-10-21 | Digital intelligent power regulation question-answering method and system based on large language model |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411469462.8A CN119003742B (en) | 2024-10-21 | 2024-10-21 | Digital intelligent power regulation question-answering method and system based on large language model |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN119003742A CN119003742A (en) | 2024-11-22 |
| CN119003742B true CN119003742B (en) | 2025-02-14 |
Family
ID=93484532
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411469462.8A Active CN119003742B (en) | 2024-10-21 | 2024-10-21 | Digital intelligent power regulation question-answering method and system based on large language model |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN119003742B (en) |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119415661A (en) * | 2024-11-28 | 2025-02-11 | 中国人寿保险股份有限公司 | Method, device, equipment, medium and program product for responding to user question information |
| CN119808910B (en) * | 2024-11-28 | 2025-11-28 | 贵州电网有限责任公司 | General knowledge base method for power security industry based on large model construction |
| CN119646154B (en) * | 2024-11-28 | 2025-11-28 | 贵州电网有限责任公司 | Security analysis path generation method and system based on essence of power industry |
| CN119415640A (en) * | 2025-01-06 | 2025-02-11 | 北京可利邦信息技术股份有限公司 | Method and device for improving the retrieval accuracy of specific industry knowledge |
| CN120104779A (en) * | 2025-01-08 | 2025-06-06 | 深圳大学 | Electric power safety knowledge question-answering method, device and storage medium |
| CN119441446A (en) * | 2025-01-13 | 2025-02-14 | 湖南湘能创业项目管理有限公司 | A question-answering method and system in the bidding field based on retrieval-enhanced generation architecture |
| CN119988573A (en) * | 2025-04-15 | 2025-05-13 | 卓智网络科技有限公司 | Intelligent question answering method, system, electronic device, and intelligent question answering large model |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118227734A (en) * | 2024-03-19 | 2024-06-21 | 湖大粤港澳大湾区创新研究院(广州增城) | An intelligent voice query method for industrial manual content |
| CN118467595A (en) * | 2024-05-10 | 2024-08-09 | 厦门大学 | Search method, device, equipment, and medium for target domain based on large language model |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10664527B1 (en) * | 2019-01-18 | 2020-05-26 | PolyAI Limited | Response retrieval system and method |
| US11971914B1 (en) * | 2023-07-21 | 2024-04-30 | Cure A1, LLC | Artificial intelligence systems and methods |
| CN117076653B (en) * | 2023-10-17 | 2024-01-02 | 安徽农业大学 | Knowledge base question-answering method based on thinking chain and visual lifting context learning |
-
2024
- 2024-10-21 CN CN202411469462.8A patent/CN119003742B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118227734A (en) * | 2024-03-19 | 2024-06-21 | 湖大粤港澳大湾区创新研究院(广州增城) | An intelligent voice query method for industrial manual content |
| CN118467595A (en) * | 2024-05-10 | 2024-08-09 | 厦门大学 | Search method, device, equipment, and medium for target domain based on large language model |
Also Published As
| Publication number | Publication date |
|---|---|
| CN119003742A (en) | 2024-11-22 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN119003742B (en) | Digital intelligent power regulation question-answering method and system based on large language model | |
| CN118093834B (en) | AIGC large model-based language processing question-answering system and method | |
| CN113672708B (en) | Language model training method, question-answer pair generation method, device and equipment | |
| CN117648429B (en) | Question answering method and system based on multimodal adaptive retrieval-enhanced large model | |
| CN118377844B (en) | Text generation enhancement method and device applied to search enhancement generation | |
| CN118170894A (en) | A knowledge graph question answering method, device and storage medium | |
| CN117951249A (en) | Knowledge base response method and system based on large language model | |
| CN115495555A (en) | A method and system for document retrieval based on deep learning | |
| CN118377888B (en) | Question-answering processing method, system, equipment and medium based on large language model | |
| CN119025643A (en) | A method to improve the accuracy of large models in answering emergency knowledge questions | |
| CN110390049B (en) | Automatic answer generation method for software development questions | |
| CN114238595A (en) | A method and system for question answering of metallurgical knowledge based on knowledge graph | |
| CN118210889A (en) | Method and device for generating prompt words for vector similarity search based on knowledge graph | |
| CN117575026B (en) | Large model reasoning analysis method, system and product based on external knowledge enhancement | |
| CN119669530B (en) | Knowledge graph generation-assisted teaching question answering method and system based on LLM | |
| CN117828024A (en) | A plug-in search method, device, storage medium and equipment | |
| CN114153946A (en) | Intelligent retrieval method, device, equipment and storage medium | |
| CN112989829A (en) | Named entity identification method, device, equipment and storage medium | |
| CN119577064A (en) | An open domain question answering method and system based on knowledge retrieval generation | |
| CN118095297B (en) | Multi-round man-machine dialogue method and device based on entity ambiguity recognition and classification recommendation | |
| CN117216226B (en) | A knowledge location method, apparatus, storage medium, and device | |
| CN117972044B (en) | Visual question answering method and platform based on knowledge enhancement | |
| CN114153947B (en) | A document processing method, apparatus, device, and storage medium | |
| CN111881695A (en) | Audit knowledge retrieval method and device | |
| CN117973533A (en) | Help information acquisition method and device, electronic equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |