Power knowledge question and answer matching method and system based on improved retrieval enhancement generation technology

By fine-tuning the Embedding model in the power field and building a regular expression rule base, and combining large language models for matching and reordering, the problems of deviations in professional term comprehension and insufficient dynamic adaptation of knowledge in the power vertical field are solved, and high-precision power knowledge Q&A is achieved.

CN120470093APending Publication Date: 2025-08-12STATE GRID INFORMATION & TELECOMM BRANCH
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202510602782.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-12
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

The existing intelligent question-and-answer system has problems such as deviation in the power vertical field of professional terminology and insufficient knowledge dynamic adaptability, making it difficult to accurately answer user questions.

Method used

The pre-constructed Embedding model is decomposed and trained by using the training set to build an Embedding fine-tuning model, establish a knowledge base by vectorizing power field files, and match and reordering the regular expression rule base and large language model to improve retrieval accuracy.

Benefits of technology

By constructing a semantic vector space adapted to the power field, accurately representing the context semantics of professional terms, the inaccuracy problem is solved when retrieving a specific ID, and the search accuracy of the retrieval enhancement generation system is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120470093A_ABST
    Figure CN120470093A_ABST
Patent Text Reader

Abstract

The invention relates to the field of power question answering, in particular to a power knowledge question-answer matching method and system based on an improved retrieval enhancement generation technology, and the method comprises the steps: employing a training set to carry out the decomposition of a pre-constructed Embedding model, and carrying out the training of the Embedding model, and obtaining an Embedding fine tuning model; the method comprises the following steps: vectorizing a power field file by adopting an Embedding fine tuning model to obtain a power knowledge base, and constructing a regular expression rule base; the user consultation content is converted into a query vector, the query vector is matched with the regular expression rule base to obtain an accurate matching result, and meanwhile the query vector is matched with the power knowledge base to obtain a fuzzy matching result; semantic correlation sorting is carried out on the accurate matching result and the fuzzy matching result, and then resorting is carried out by adopting a resorter in combination with a service rule; and inputting the reordering result into a large language model to obtain a result corresponding to the user consultation content. The method can effectively solve the problem of inaccuracy during retrieval of a specific ID, and improves the retrieval precision of a retrieval enhancement generation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of question answering in the electric power field, and in particular to a method and system for matching electric power knowledge questions and answers based on improved retrieval enhancement generation technology. Background Art

[0002] The number and business capabilities of existing customer service personnel are difficult to meet the full-service, all-weather needs of users, and the types of user business questions are also becoming diverse. Intelligent question-answering systems have emerged as the times require. However, existing intelligent question-answering systems commonly build knowledge bases based on large model technology.

[0003] The origins of large models can be traced back to the early days of deep learning, particularly the widespread research and application of artificial neural networks (ANNs). With the advancement of computing hardware (especially the popularity of GPUs) and the availability of massive amounts of labeled data, deep learning has gradually become a key technology for realizing artificial intelligence. On this basis, large models—large deep learning models powered by massive amounts of data and computing resources—have rapidly developed, achieving significant breakthroughs in fields such as natural language processing, computer vision, and speech recognition.

[0004] Question answering, a key branch of natural language processing, has evolved from specialized question answering systems based on structured databases to general question answering systems based on large document collections, and finally to question answering systems based on large language models. Throughout this process, large-model question answering technology has gradually demonstrated powerful semantic representation and complex reasoning capabilities, becoming a current research hotspot.

[0005] Early research in large-scale question answering focused on leveraging the powerful generative capabilities of large models to answer a wide range of questions. This phase of research focused on model training and optimization to improve accuracy and generalization. As research progressed, researchers began to realize the limitations of relying solely on the large model's own knowledge base for reasoning. Therefore, they began exploring how to enhance the model's reasoning capabilities by introducing external knowledge. This phase of research focused on knowledge representation, knowledge graphs, and knowledge fusion, aiming to appropriately incorporate external knowledge into large models to improve their reasoning performance and accuracy.

[0006] Embedding technology stems from the core need for semantic representation of words in natural language processing. Its background can be traced back to the limitations of early symbolic and statistical language models. Traditional methods (such as one-hot encoding) represent text only as discrete, sparse, high-dimensional vectors, failing to capture the semantic connections between words. To address this problem, the distributed semantics hypothesis after 2000 gave rise to the concept of word embedding. This involves using machine learning models to map words into a low-dimensional continuous vector space, placing semantically similar words in geometric proximity. The Word2Vec model (based on the Skip-gram and CBOW architectures) proposed by Google in 2013 first demonstrated the practical value of this concept on a large scale. Subsequently, GloVe further optimized vector representations using global word co-occurrence statistics. With the development of deep learning, embedding technology has evolved from static word embeddings to dynamic, context-sensitive models. For example, the Transformer architecture introduced by BERT in 2018 enables adaptive vector generation based on bidirectional context, completely breaking the limitation of one word per meaning. Today, Embedding has gone beyond the scope of text and expanded to multimodal data such as images, knowledge graphs, and user behavior, becoming a basic technology for tasks such as semantic understanding, recommendation systems, and cross-modal retrieval in artificial intelligence. Its core value lies in converting abstract concepts in human cognition into machine-parseable and computable mathematical objects, building a semantic bridge between the symbolic world and the numerical space.

[0007] However, the above traditional search enhancement generation technologies have deviations in the understanding of professional terminology and insufficient dynamic knowledge adaptation capabilities in the power vertical field, making it difficult to accurately answer user questions. Summary of the Invention

[0008] To address the existing issues of misunderstanding of professional terminology and insufficient dynamic knowledge adaptation in the power vertical field, this paper proposes a power knowledge question-answering matching method based on improved retrieval enhancement generation technology, including:

[0009] The training set is used to decompose the pre-built Embedding model to obtain the Embedding fine-tuning model;

[0010] The Embedding fine-tuning model is used to vectorize the power field files to obtain the power knowledge base, and a regular expression rule base is constructed based on the key identifiers of the power field;

[0011] Converting the user's inquiry content into a query vector, matching the query vector with the regular expression rule library to obtain an exact match result, and matching the query vector with the power knowledge library to obtain a fuzzy match result;

[0012] Sort the exact match results and the fuzzy match results by semantic relevance, and then re-sort them using a re-ranker combined with business rules;

[0013] Input the re-ranking results into the large language model to obtain the results corresponding to the user's inquiry content;

[0014] Wherein, the training set is obtained based on historical electricity data.

[0015] Optionally, the training set is obtained in the following manner:

[0016] Crawl electricity-related websites to obtain raw data;

[0017] The original data is divided to obtain a domain entity dictionary related to electric power domain vocabulary, and positive samples and negative samples related to electric power domain sentences. The domain entity dictionary, positive samples and negative samples constitute a training set.

[0018] Optionally, the negative samples include basic negative samples and difficult negative samples, and negative samples whose similarity threshold is greater than a preset threshold are set as difficult negative samples, and the rest are basic negative samples.

[0019] Optionally, the steps of using the training set to decompose the pre-built Embedding model to obtain the Embedding fine-tuning model include:

[0020] Use publicly known power corpus to conduct unsupervised training on the pre-trained language model to initially learn the characteristics of the power field;

[0021] The trained pre-trained language model is embedded in the Sentence-BERT architecture, and the training set is used to perform supervised training on the Sentence-BERT architecture embedded in the pre-trained language model to obtain an Embedding fine-tuning model.

[0022] Optionally, during the supervised training process, a preset learning rate is first used to fine-tune the fully connected layer in the Sentence-BERT architecture, and then a gradually increasing learning rate is used to optimize the parameters in the pre-trained language model.

[0023] Optionally, matching the query vector with the regular expression rule library to obtain an exact matching result is specifically:

[0024] The query vector is subjected to a Boolean search with a regular expression rule library to obtain an exact matching result.

[0025] Optionally, the re-sequencer is built based on the BERT architecture and is trained and fine-tuned using high-frequency conversation data in the power field.

[0026] Optionally, before vectorizing the power field file using the Embedding fine-tuning model, the following steps may also be performed:

[0027] Eliminate stop words from power sector documents and create a combined index for high-frequency query fields.

[0028] Optionally, before sorting the semantic relevance of the exact matching results and the fuzzy matching results, the method further includes:

[0029] Consistency hashing is performed on the exact matching result and the fuzzy matching result to achieve consistency verification.

[0030] In a second aspect, the present invention provides an electric power knowledge question-answering matching system based on an improved retrieval enhancement generation technology, comprising: a training module for training a pre-built Embedding model decomposition using a training set to obtain an Embedding fine-tuning model;

[0031] File library acquisition module: used to use the Embedding fine-tuning model to vectorize the power field files to obtain the power knowledge base, and build a regular expression rule library based on the key identifiers of the power field;

[0032] Matching module: used to convert user consultation content into a query vector, match the query vector with the regular expression rule library to obtain an exact match result, and simultaneously match the query vector with the power knowledge library to obtain a fuzzy match result;

[0033] Sorting module: used to sort the exact matching results and fuzzy matching results according to semantic relevance, and then re-sort them using a re-ranker combined with business rules;

[0034] Result output module: used to input the re-ranking results into the large language model to obtain the results corresponding to the user's consultation content;

[0035] Wherein, the training set is obtained based on historical electricity data.

[0036] Optionally, the training set in the training module is obtained in the following manner:

[0037] Crawl electricity-related websites to obtain raw data;

[0038] The original data is divided to obtain a domain entity dictionary related to electric power domain vocabulary, and positive samples and negative samples related to electric power domain sentences. The domain entity dictionary, positive samples and negative samples constitute a training set.

[0039] Optionally, the negative samples in the training module include basic negative samples and hard negative samples, and negative samples with a similarity threshold greater than a preset threshold are set as hard negative samples, and the rest are basic negative samples. Optionally, the training module uses the training set to decompose the pre-built Embedding model to train the Embedding fine-tuning model, and the steps include:

[0040] Use publicly known power corpus to conduct unsupervised training on the pre-trained language model to initially learn the characteristics of the power field;

[0041] The trained pre-trained language model is embedded in the Sentence-BERT architecture, and the training set is used to perform supervised training on the Sentence-BERT architecture embedded in the pre-trained language model to obtain an Embedding fine-tuning model.

[0042] Optionally, during the supervised training process, the training module first uses a preset learning rate to fine-tune the fully connected layer in the Sentence-BERT architecture, and then uses a gradually increasing learning rate to optimize the parameters in the pre-trained language model.

[0043] Optionally, the file library acquisition module matches the query vector with the regular expression rule library to obtain an exact matching result, specifically:

[0044] The query vector is subjected to a Boolean search with a regular expression rule library to obtain an exact matching result.

[0045] Optionally, the re-ranker in the sorting module is built based on the BERT architecture and is trained and fine-tuned using high-frequency conversation data in the power field.

[0046] Optionally, before the file library acquisition module uses the Embedding fine-tuning model to vectorize the power field files, the module further includes:

[0047] Eliminate stop words from power sector documents and create a combined index for high-frequency query fields.

[0048] Optionally, before the sorting module sorts the exact matching results and the fuzzy matching results by semantic relevance, the method further includes:

[0049] The exact matching result and the fuzzy matching result are subjected to consistent hashing to achieve consistency verification. Compared with the prior art, the beneficial effects of the present invention are as follows:

[0050] The present invention provides a method and system for matching electric power knowledge questions and answers based on improved retrieval enhancement generation technology, comprising: using a training set to decompose a pre-built Embedding model to train an Embedding fine-tuning model; using the Embedding fine-tuning model to vectorize electric power field files to obtain an electric power knowledge base, and building a regular expression rule base based on key identifiers in the electric power field; converting user consultation content into a query vector, matching the query vector with the regular expression rule base to obtain an exact matching result, and matching the query vector with the electric power knowledge base to obtain a fuzzy matching result; matching the exact matching result with the regular expression rule base to obtain a fuzzy matching result; matching the exact matching result with the regular expression rule base to obtain a fuzzy matching result; matching the exact matching result with the regular expression rule base to obtain a fuzzy matching result; matching the exact matching result with the regular expression rule base to obtain a fuzzy matching result; matching the exact matching result with the regular expression rule base to obtain a fuzzy matching result; matching the exact matching result with the regular expression rule base to obtain a fuzzy matching result; matching the exact matching result with the regular expression rule base to obtain a fuzzy matching result; matching the exact matching result with the regular expression rule base to obtain a fuzzy matching result; matching the regular expression rule base ... The semantic relevance of the results and fuzzy matching results is sorted, and then a re-ranker is used in combination with business rules to re-rank them; the re-ranked results are input into a large language model to obtain the results corresponding to the user's consultation content; wherein, the training set is obtained based on historical electricity data; the present invention constructs a semantic vector space adapted to the power field through the Embedding fine-tuning technology, and accurately represents the contextual semantics of professional terms such as "peak and valley electricity prices" and "distributed energy access"; by combining a hybrid search method of precise retrieval, semantic retrieval and re-ranking, it can effectively solve the inaccuracy problem that occurs when retrieving a specific ID, and improve the retrieval accuracy of the retrieval-augmented generation (RAG) system. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 This is a flow chart of the power knowledge question-answer matching method based on the improved retrieval enhancement generation technology proposed by the present invention;

[0052] Figure 2 This is a schematic diagram of the application process of the power knowledge question-answer matching method based on the improved retrieval enhancement generation technology proposed in the present invention;

[0053] Figure 3 This is a structural diagram of the electric power knowledge question-answering matching system based on improved retrieval enhancement generation technology proposed in the present invention. DETAILED DESCRIPTION

[0054] This paper proposes a power knowledge question-answering matching method and system based on improved retrieval-augmented generation (RAG) technology. This method addresses the problems of traditional RAG technology in the power vertical field, such as misunderstanding of professional terminology and insufficient dynamic knowledge adaptation capabilities. By integrating domain-specific embedding fine-tuning technology with hybrid search technology, this method constructs a semantic vector space adapted to the power field, accurately representing the contextual semantics of professional terms such as "peak-valley electricity pricing" and "distributed energy access." By combining precise retrieval, semantic retrieval, and re-ranking, this hybrid search method effectively addresses the inaccuracy problem that occurs when searching for specific IDs, improving the retrieval accuracy of the retrieval-augmented generation (RAG) system. This technology enables the question-answering system to capture complex query intent in power marketing scenarios through semantic associations and generate compliant answers based on the strong rule constraints of the industry knowledge base. This technology promotes the upgrade of power marketing services from passive response to active provision of professional knowledge, providing technical support for the construction of a standardized, professional, and trustworthy intelligent question-answering system in the power field.

[0055] Example 1:

[0056] A power knowledge question-answering matching method based on improved retrieval enhancement generation technology, such as Figure 1 As shown, it includes the following steps S1 to S5:

[0057] S1: Use the training set to decompose the pre-built Embedding model to train the Embedding fine-tuning model;

[0058] S2: Use the Embedding fine-tuning model to vectorize the power field files to obtain the power knowledge base, and build a regular expression rule base based on the key identifiers of the power field;

[0059] S3: Converting the user inquiry content into a query vector, matching the query vector with the regular expression rule library to obtain an exact match result, and matching the query vector with the power knowledge library to obtain a fuzzy match result;

[0060] S4: sorting the exact matching results and the fuzzy matching results by semantic relevance, and then re-sorting them using a re-ranker combined with business rules;

[0061] S5: Input the re-ranking results into the large language model to obtain the results corresponding to the user's inquiry content.

[0062] In a further preferred solution, the training set in step S1 is obtained by using the following steps 1 and 2:

[0063] Step 1: Crawl electricity-related websites to obtain raw data.

[0064] For the power marketing scenario, it is necessary to build a corpus containing vertical field data such as professional terminology, policy documents, user manuals, work order records, etc. Specifically, this can be done by crawling original data such as State Grid policy documents, power marketing business guides, and user frequently asked questions (FAQs).

[0065] Clean and / or structure the raw data.

[0066] Step 2 divides the original data to obtain a domain entity dictionary related to electric power domain vocabulary, and positive samples and negative samples related to electric power domain sentences. The domain entity dictionary, positive samples and negative samples constitute a training set.

[0067] After cleaning and / or structuring, the raw data is segmented, focusing on extracting power industry-specific vocabulary, such as "tiered electricity pricing," "electricity billing cycle," and "distributed photovoltaic grid connection process." This is used to construct a domain entity dictionary of power sector vocabulary. Furthermore, sentences in the raw data are manually categorized as positive or negative samples. Positive samples include semantically equivalent question pairs, such as "How do I apply for electricity fee reductions?" and "Electricity fee reduction application process," which are positive examples. Negative samples include easily confused questions, such as "Electricity bill inquiry" and "Electricity fee dispute appeal," which are negative examples, as well as cross-domain interference items. Power experts are involved in data verification to ensure terminology accuracy and business logic correctness.

[0068] In a further preferred solution, targeting the characteristics of power marketing scenarios, the present invention innovatively introduces a hierarchical negative sampling strategy: negative samples are further divided into basic negative samples and difficult negative samples. Difficult negative samples are obtained by screening through similarity thresholds, such as "industrial and commercial electricity price adjustment policy" and "residential peak and valley electricity price standards" which are semantically similar but with different subjects. The remaining ones are basic negative samples, which generally come from random unrelated problems.

[0069] In a further preferred embodiment, step S1 includes the following steps S11 and S12:

[0070] S11: Use publicly known power corpus to perform unsupervised training on the pre-trained language model to initially learn the characteristics of the power field.

[0071] Unsupervised pre-training is performed on well-known power field corpus, and pre-trained language models such as ELECTRA or RoBERTa are used to learn domain features through the Masked Language Model (MLM).

[0072] S12: Embed the trained pre-trained language model into the Sentence-BERT architecture, and use the training set to perform supervised training on the Sentence-BERT architecture after embedding the pre-trained language model to obtain an Embedding fine-tuning model.

[0073] The pre-trained language model that has learned domain features is embedded in the Sentence-BERT architecture. The training set is then used to perform supervised training on the Sentence-BERT architecture embedded in the pre-trained language model. The Sentence-BERT architecture uses the triplet loss function (Triplet Loss) to optimize the embedding space. The formula of the triplet loss function is defined as:

[0074]

[0075] in, is the value of the triplet loss function, d(A,P) represents the distance between anchor point A and positive sample P (such as Euclidean distance or cosine distance), d(A,N) represents the distance between anchor point A and negative sample N, and margin is a preset boundary threshold (usually 0.2-1.0). When the distance between the anchor point and the positive sample is at least one margin smaller than the distance between the anchor point and the negative sample, the loss value is 0; otherwise, backpropagation is used to adjust the parameters in the Sentence-BERT architecture, forcing d(A,P) to decrease or d(A,N) to increase.

[0076] In a further preferred embodiment, progressive learning rate scheduling is used during supervised training, that is, a lower learning rate (such as 1e-5) is used to fine-tune the fully connected layer in the initial stage, and then a gradually increasing learning rate is used to optimize the parameters in the pre-trained language model.

[0077] In step S2, the fine-tuned Embedding model is deployed as the core component of the retrieval module to build a dual-tower retrieval architecture: the question encoder outputs the query vector, and the power knowledge base document generates a vector index through offline embedding.

[0078] Documents in the power field usually contain structured and unstructured data such as policy documents, equipment manuals, and customer service records. A chunking strategy enhanced with domain knowledge needs to be adopted to establish a regular expression rule library for key identifiers specific to the power industry, such as equipment models (e.g., SG-1000kV transformers), customer numbers (12-digit numerical codes), and meter IDs (e.g., EID-2023-ZJ-0088). When using an Embedding model to vectorize other documents in the power field, domain adaptation training needs to be carried out on power professional corpora (such as the "Power Marketing Business Guide Manual") to ensure that the vector space distributions of terms such as "electricity bill reduction" and "line loss rate calculation" conform to business logic.

[0079] In a further preferred solution, before using the Embedding fine-tuning model to vectorize power field documents, it further includes:

[0080] Removing stop words from power field documents and establishing a composite index for high-frequency query fields therein.

[0081] Specifically, construct a stop word library for the power field, filter common stop words such as "of" and "etc.", while retaining professional terms such as "phase voltage" and "power factor". Use the partial index technology of PostgreSQL to establish a composite index for high-frequency query fields (such as the customer's affiliated power supply station number). For electricity bill data queries with high real-time requirements, design a cache layering strategy: use Redis to cache vector results for static knowledge (such as policies and regulations), and establish a direct connection channel to the in-memory database for dynamic data (such as real-time electricity consumption).

[0082] In a further preferred solution, in the hierarchical retrieval mechanism adopted in step S3, the user's consultation content is converted into a query vector. In the first layer, boolean retrieval and exact matching are implemented through Elasticsearch, etc., and weighted exact matching is set for fields such as power equipment IDs and standard clause numbers (e.g., DL / T448-2016). In the second layer, semantic retrieval based on pgvector is used to process natural language queries, and the query vector is matched with the power knowledge base to obtain fuzzy matching results.

[0083] In a further preferred solution, it further includes performing consistent hashing on the exact matching results and fuzzy matching results to achieve consistency verification.

[0084] Step S4 employs a two-stage reranking strategy: the first stage uses general models like FlashRank for semantic relevance ranking, and the second stage introduces a power sector reranker. This reranker, built on the BERT architecture and fine-tuned on conversational data such as power customer service tickets and technical consultation records, focuses on learning matching patterns for high-frequency questions such as "debt restoration process" and "distributed photovoltaic grid connection application." Business rules are also embedded. For example, queries containing meter numbers are forcibly weighted for exact matches, and policy queries prioritize the latest version of documents (based on document expiration metadata).

[0085] Step S5 is the question-answer generation stage. In the question-answer generation stage, the above-mentioned improved retrieval enhancement production technology is used to coordinate with the large language model adapted to the power field: the user consultation is input into the Embedding fine-tuning model for semantic decoding and vectorization, and then the decoded content is subjected to hybrid search and matching. The power knowledge fragments retrieved by the hybrid search (such as policy terms, equipment parameters, customer work orders) are used as context input, and semantic understanding and logical reasoning are performed through the generation model fine-tuned based on the power work order dialogue (such as Llama-3 power version). The model dynamically integrates the retrieval content and built-in knowledge during generation. For example, when dealing with questions such as "distributed photovoltaic grid-connected application process", the line accurately locks Article 5.2 of the "Distributed Power Grid-Connected Service Specifications" through hybrid search, and then combines the pre-set process decision tree template in the large language model to output a structured answer containing a list of application materials, approval time limit and voltage level requirements. At the same time, a fact verification module is embedded to compare the generated content with the key entities of the retrieved document (such as policy document numbers and meter technical parameters) to ensure that the output does not contain statements that contradict the power industry regulations, and ultimately achieve the generation of power professional questions and answers with the triple guarantee of "retrieval accuracy-semantic coherence-factual correctness".

[0086] A closed-loop feedback learning system was established to collect user click behavior on Q&A results and manually annotated data, and the library of hard-negative examples was regularly updated. The project implemented the ONNX format to optimize the inference speed of the Embedding model. This system also used Redis to cache the Embedding calculation results for high-frequency questions, ensuring sub-second response times for millions of electricity knowledge items. Finally, A / B testing was conducted to verify the effectiveness of the Embedding fine-tuning model in improving business metrics such as customer service ticket conversion rates and user satisfaction scores.

[0087] The application process of the power knowledge question-answer matching method based on the improved retrieval enhancement generation technology of the present invention is as follows: Figure 2 As shown in the figure, the user first inputs a question, the Embedding fine-tuning model fine-tunes the input question into vector form, and then performs precise retrieval and semantic retrieval. After that, the results are re-ranked and input into the large language model to obtain the question-answering result.

[0088] Example 2:

[0089] The present invention based on the same inventive concept also provides an electric power knowledge question-answering matching system based on improved retrieval enhancement generation technology, comprising: a training module: configured to train a pre-built Embedding model decomposition using a training set to obtain an Embedding fine-tuning model;

[0090] File library acquisition module: used to use the Embedding fine-tuning model to vectorize the power field files to obtain the power knowledge base, and build a regular expression rule library based on the key identifiers of the power field;

[0091] Matching module: used to convert user consultation content into a query vector, match the query vector with the regular expression rule library to obtain an exact match result, and simultaneously match the query vector with the power knowledge library to obtain a fuzzy match result;

[0092] Sorting module: used to sort the exact matching results and fuzzy matching results according to semantic relevance, and then re-sort them using a re-ranker combined with business rules;

[0093] Result output module: used to input the re-ranking results into the large language model to obtain the results corresponding to the user's consultation content;

[0094] Wherein, the training set is obtained based on historical electricity data.

[0095] In a further preferred embodiment, the training set in the training module is obtained in the following manner:

[0096] Crawl electricity-related websites to obtain raw data;

[0097] The original data is divided to obtain a domain entity dictionary related to electric power domain vocabulary, and positive samples and negative samples related to electric power domain sentences. The domain entity dictionary, positive samples and negative samples constitute a training set.

[0098] In a further preferred embodiment, the negative samples in the training module include basic negative samples and hard negative samples. Among the negative samples, the negative samples with a similarity threshold greater than a preset threshold are set as hard negative samples, and the rest are basic negative samples. Optionally, the training module uses the training set to decompose the pre-built Embedding model to train the Embedding fine-tuning model, and the steps include:

[0099] Use publicly known power corpus to conduct unsupervised training on the pre-trained language model to initially learn the characteristics of the power field;

[0100] The trained pre-trained language model is embedded in the Sentence-BERT architecture, and the training set is used to perform supervised training on the Sentence-BERT architecture embedded in the pre-trained language model to obtain an Embedding fine-tuning model. Optionally, during the supervised training process, the training module first fine-tunes the fully connected layers in the Sentence-BERT architecture using a preset learning rate, and then optimizes the parameters in the pre-trained language model using gradually increasing learning rates.

[0101] In a further preferred solution, the file library acquisition module matches the query vector with the regular expression rule library to obtain an exact matching result, specifically:

[0102] The query vector is subjected to a Boolean search with a regular expression rule library to obtain an exact matching result.

[0103] In a further preferred solution, the re-ranker in the sorting module is constructed based on the BERT architecture and is trained and fine-tuned using high-frequency conversation data in the power field.

[0104] In a further preferred solution, before the file library acquisition module uses the Embedding fine-tuning model to vectorize the power field files, the following steps are further included:

[0105] Eliminate stop words from power sector documents and create a combined index for high-frequency query fields.

[0106] In a further preferred solution, before the sorting module sorts the exact matching results and the fuzzy matching results by semantic relevance, the method further includes:

[0107] Consistency hashing is performed on the exact matching result and the fuzzy matching result to achieve consistency verification.

[0108] The present invention studies the construction of an electric power marketing knowledge question-and-answer system based on Embedding fine-tuning and hybrid search technology, including using the Embedding fine-tuning model fine-tuned by electric power professional corpus to enhance the semantic representation ability of industry terms, integrating the synergistic advantages of regular expression precise matching and semantic retrieval in the hybrid search framework, solving the problems of false detection and missed detection in the traditional method when accurately retrieving electric power numbers and interpreting complex policies, and achieving the simultaneous guarantee of accurate positioning of equipment IDs and semantic relevance of technical documents when processing hybrid demands. By embedding electric power industry rules to effectively constrain result generation, it is ensured that the question and answer content meets both semantic relevance and electric power business specification requirements.

[0109] The above are merely embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are included in the scope of the claims of the present invention to be approved.

Claims

1. A power knowledge question-answer matching method based on improved retrieval enhancement generation technology, characterized in that: include: The training set is used to decompose the pre-built Embedding model to obtain the Embedding fine-tuning model; The Embedding fine-tuning model is used to vectorize the power field files to obtain the power knowledge base, and a regular expression rule base is constructed based on the key identifiers of the power field; Converting the user's inquiry content into a query vector, matching the query vector with the regular expression rule library to obtain an exact match result, and matching the query vector with the power knowledge library to obtain a fuzzy match result; Sorting the exact matching results and the fuzzy matching results according to semantic relevance, and then reordering them using a re-ranker combined with business rules; Input the re-ranking results into the large language model to obtain the results corresponding to the user's inquiry content; Wherein, the training set is obtained based on historical electricity data.

2. The electric power knowledge question-answer matching method based on improved retrieval enhancement generation technology according to claim 1 is characterized in that: The training set is obtained in the following way: Crawl electricity-related websites to obtain raw data; The original data is divided to obtain a domain entity dictionary related to electric power domain vocabulary, and positive samples and negative samples related to electric power domain sentences. The domain entity dictionary, positive samples and negative samples constitute a training set.

3. The electric power knowledge question-answer matching method based on improved retrieval enhancement generation technology according to claim 2 is characterized in that: The negative samples include basic negative samples and difficult negative samples. Among the negative samples, the negative samples whose similarity threshold is greater than a preset threshold are set as difficult negative samples, and the rest are basic negative samples.

4. The electric power knowledge question-answer matching method based on improved retrieval enhancement generation technology according to claim 2 or 3, characterized in that: The steps of using the training set to decompose the pre-built Embedding model to obtain the Embedding fine-tuning model include: Use publicly known power corpus to conduct unsupervised training on the pre-trained language model to initially learn the characteristics of the power field; The trained pre-trained language model is embedded in the Sentence-BERT architecture, and the training set is used to perform supervised training on the Sentence-BERT architecture embedded in the pre-trained language model to obtain an Embedding fine-tuning model.

5. The electric power knowledge question-answer matching method based on improved retrieval enhancement generation technology according to claim 4 is characterized in that: During the supervised training process, the fully connected layers in the Sentence-BERT architecture are first fine-tuned using a preset learning rate, and then the parameters in the pre-trained language model are optimized using a gradually increasing learning rate.

6. The electric power knowledge question-answer matching method based on improved retrieval enhancement generation technology according to claim 1 is characterized in that: The matching of the query vector with the regular expression rule library to obtain an exact matching result is specifically as follows: The query vector is subjected to a Boolean search with a regular expression rule library to obtain an exact matching result.

7. The electric power knowledge question-answer matching method based on improved retrieval enhancement generation technology according to claim 1 or 6, characterized in that: The re-ranker is built based on the BERT architecture and is trained and fine-tuned using high-frequency conversation data from the power sector.

8. The electric power knowledge question-answer matching method based on improved retrieval enhancement generation technology according to claim 1 is characterized in that: Before using the Embedding fine-tuning model to vectorize the power field file, the following steps are also included: Eliminate stop words from power sector documents and create a combined index for high-frequency query fields.

9. The electric power knowledge question-answer matching method based on improved retrieval enhancement generation technology according to claim 1 is characterized in that: Before sorting the semantic relevance of the exact matching results and the fuzzy matching results, the method further includes: Consistency hashing is performed on the exact matching result and the fuzzy matching result to achieve consistency verification.

10. An electric power knowledge question-answer matching system based on improved retrieval enhancement generation technology, characterized in that: include: Training module: used to train the pre-built Embedding model decomposition using the training set to obtain the Embedding fine-tuning model; File library acquisition module: used to use the Embedding fine-tuning model to vectorize the power field files to obtain the power knowledge base, and build a regular expression rule library based on the key identifiers of the power field; Matching module: used to convert user consultation content into a query vector, match the query vector with the regular expression rule library to obtain an exact match result, and simultaneously match the query vector with the power knowledge library to obtain a fuzzy match result; Sorting module: used to sort the exact matching results and fuzzy matching results according to semantic relevance, and then re-sort them using a re-ranker combined with business rules; Result output module: used to input the re-ranking results into the large language model to obtain the results corresponding to the user's consultation content; Wherein, the training set is obtained based on historical electricity data.

Citation Information

Cited By

  • Intelligent box type recommendation method based on multi-modal retrieval

    CN121071003A

  • Knowledge tracking and evidence labeling combined RAG question and answer system

    CN121092675A

  • Software and hardware cooperative work character matching system and matching method thereof

    CN121415416A

  • A power safety question-answering system based on dual-path retrieval RAG

    CN122507838A