Power marketing question and answer method and device based on large language model

By using a large language model-based question-and-answer method for electricity marketing and generating prompt word sequences through compressed causal graphs, the problem of existing systems being unable to understand context is solved, resulting in more accurate and faster question-and-answer for electricity marketing.

CN121351985APending Publication Date: 2026-01-16STATE GRID ZHEJIANG ELECTRIC POWER CO MARKETING SERVICE CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511229523.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

The existing electricity marketing Q&A system cannot effectively understand and utilize contextual information, resulting in inaccurate answers.

Method used

A question-and-answer method for electricity marketing based on a large language model is adopted. By generating a sequence of prompt words extracted from a compressed causal graph and combining it with a large language model, more accurate answers are generated.

Benefits of technology

It improves the question-answering system's understanding of the context of questions, thereby increasing the accuracy and speed of responses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121351985A_ABST
    Figure CN121351985A_ABST
Patent Text Reader

Abstract

The invention discloses an electric power marketing question and answer method and device based on a large language model, and a server side method comprises the steps: receiving an electric power marketing question and answer request sent by a client side, wherein the electric power marketing question and answer request carries an electric power description text related to electric power marketing; generating a prompt word sequence according to the electric power description text; wherein the cue word sequence is obtained by traversing a compressed causal graph, the compressed causal graph is obtained by compressing an original causal graph, nodes in the original causal graph represent power keywords, and edges between adjacent nodes represent causal relationships among the power keywords; inputting the prompt word sequence into a pre-fine-tuned question and answer model, outputting an answer result corresponding to the power description text, and sending the answer result to the client; the pre-fine-tuned question and answer model is obtained based on fine tuning of the large language model. Therefore, by adopting the embodiment of the invention, the context information can be effectively understood and utilized, and the answering accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a method and apparatus for answering questions in electricity marketing based on a large language model. Background Technology

[0002] In the field of electricity marketing, with the rapid development of smart grids and digital technologies, electricity marketing Q&A systems have emerged. These systems utilize natural language processing technology to provide customers with real-time and accurate services such as electricity information inquiries, business consultations, and fault reporting. This type of system not only enhances the customer service experience but also helps power companies better understand customer needs.

[0003] In related technologies, power marketing Q&A systems primarily match user questions and provide answers through pre-set question-and-answer rules and templates. However, due to the complex scenarios and multi-step interactions involved in power business, existing systems often fail to effectively understand and utilize contextual information, resulting in inaccurate answers. Summary of the Invention

[0004] This application provides a method and apparatus for electricity marketing question answering based on a large language model. To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its sole purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.

[0005] In a first aspect, embodiments of this application provide a power marketing question-and-answer method based on a large language model, applied to a server-side application. The method includes:

[0006] Receive electricity marketing Q&A requests sent by the client, which carry electricity marketing-related descriptive text;

[0007] Based on the description text of electricity, a sequence of prompt words is generated. The sequence of prompt words is obtained by traversing a compressed causal graph, which is obtained by compressing the original causal graph. The nodes in the original causal graph represent electricity keywords, and the edges between adjacent nodes represent the causal relationships between the electricity keywords.

[0008] The prompt word sequence is input into a pre-tuned question-answering model, which outputs the answer corresponding to the electricity description text and sends it to the client. The pre-tuned question-answering model is obtained by fine-tuning a large language model.

[0009] Optionally, a pre-tuned question-answering model can be generated by following these steps:

[0010] Collect historical Q&A descriptions related to electricity marketing from the databases of power companies;

[0011] Generate a sequence of historical prompt words based on historical electricity Q&A description text;

[0012] For historical prompt word sequences, the corresponding answer results are labeled to obtain fine-tuned samples;

[0013] A question-answering model is created using a large language model;

[0014] The question-answer pairs in the fine-tuning samples are input into the question-answering model for fine-tuning, resulting in a pre-tuned question-answering model.

[0015] Optionally, based on the electricity description text, a sequence of prompt words is generated, including:

[0016] Extract at least one target keyword from the power description text;

[0017] Load the original cause-effect graph;

[0018] Based on the target keyword, a set of prompt word propagation paths is identified from the original causal graph. Each prompt word propagation path in the set consists of a starting node corresponding to the target keyword propagating along the causal edge to the affected node.

[0019] Based on the set of prompt word propagation paths, the original causal graph is compressed to obtain a compressed causal graph.

[0020] Calculate the correlation value between each node in the compressed cause-effect graph and the power description text, and sequentially traverse the sequence of target nodes whose correlation value is greater than a preset correlation threshold;

[0021] The electricity keywords corresponding to the target node sequence obtained by traversing the sequence in turn are used as the prompt word sequence.

[0022] Optionally, based on the target keywords, identify a set of prompt word propagation paths from the original causal graph, including:

[0023] Calculate the semantic similarity between the target keyword and the electricity keywords represented by each node in the original causal graph;

[0024] Use the node with the highest semantic similarity as the starting node for the target keyword;

[0025] Starting from the initial node, a priority traversal algorithm is used to traverse the path from the initial node along the causal edges to the affected node in the original causal graph, which is used as the set of propagation paths for the prompt word; the affected node is the node that has a causal relationship with the initial node.

[0026] Optionally, based on the set of prompt word propagation paths, the original causal graph is compressed to obtain a compressed causal graph, including:

[0027] Obtain the path length, cumulative edge weight, and similarity to the electricity description text for each propagation path in the propagation path set;

[0028] Calculate the path importance score for each prompt word propagation path based on path length, cumulative edge weight, and similarity to the prompt word;

[0029] The propagation paths of prompt words whose path importance scores are greater than a preset score threshold are taken as target paths;

[0030] Calculate the node similarity matrix between nodes in the original causal graph;

[0031] Using the target path as a reference, the original causal graph is compressed by applying a node similarity matrix to obtain a compressed causal graph.

[0032] Optionally, the formula for calculating the path importance score is:

[0033] S(P)=α×L(P)+β×W(P)+γ×sim(P,Prompt);

[0034] Where S(P) is the path importance score of the cue word propagation path P, L(P) is the path length of the cue word propagation path P, W(P) is the cumulative edge weight of the cue word propagation path P, and sim(P,Pro) is the similarity between the cue word propagation path P and the electricity description text.

[0035]

[0036] Where ω(e) is the weight of edge e in the propagation path P of the prompt word, and α, β, and γ are normalization coefficients used to adjust the weight of each factor to ensure that S(P) is within the preset range.

[0037] Optionally, using the target path as a reference, the original causal graph is compressed by applying a node similarity matrix to obtain a compressed causal graph, including:

[0038] Traverse the original causal graph to find the first and second nodes. The first and second nodes are any pair of nodes in the node similarity matrix whose node similarity is greater than a preset threshold.

[0039] Determine whether the first and second nodes exist in the target path;

[0040] If neither the first nor the second node exists in the target path, merge the first and second nodes into a new node; or,

[0041] If the first and second nodes exist in the target path, continue to execute the steps of traversing the first and second nodes from the original causal graph until the traversal is completed, and obtain the compressed causal graph.

[0042] Optionally, calculate the similarity matrix between nodes in the original causal graph, including:

[0043] Obtain the frequency of each edge in all propagation paths of the original causal graph and the importance of those paths;

[0044] The contribution of each edge in the original causal graph is calculated based on its frequency of occurrence and the importance of the path.

[0045] Based on the contribution of each edge in the original causal graph, the node similarity between two nodes on each edge is calculated to obtain the similarity matrix between nodes in the original causal graph.

[0046] Optionally, the contribution of each edge can be calculated using the following formula:

[0047]

[0048] Among them, C(e) ij ) is edge e ij Contribution, side e ij Includes connecting nodes i and j, p is a set of cue word propagation paths, P is a cue word propagation path, Freq(e ij P) is edge e ij Imp(P) represents the frequency of occurrence of path P, and is the importance of path P, which is quantified using the path importance score calculation formula.

[0049] The formula for calculating the node similarity between two nodes on each edge is as follows:

[0050]

[0051] Sim(i,j) represents edge e ij The similarity between nodes i and j is included, where C(i) is the sum of the contributions of all edges connected to node i, and C(j) is the sum of the contributions of all edges connected to node i.

[0052] Secondly, embodiments of this application provide a power marketing question-and-answer device based on a large language model, the device comprising:

[0053] The electricity marketing Q&A request receiving module is used to receive electricity marketing Q&A requests sent by the client. The electricity marketing Q&A requests carry electricity description text related to electricity marketing.

[0054] The prompt word sequence generation module is used to generate a prompt word sequence based on the electricity description text. The prompt word sequence is obtained by traversing a compressed causal graph, which is obtained by compressing the original causal graph. The nodes in the original causal graph represent electricity keywords, and the edges between adjacent nodes represent the causal relationships between the electricity keywords.

[0055] The response sending module is used to input the prompt word sequence into the pre-fine-tuned question-answering model, output the response corresponding to the power description text, and send it to the client; the pre-fine-tuned question-answering model is obtained by fine-tuning a large language model.

[0056] The technical solutions provided in this application embodiment may include the following beneficial effects:

[0057] In this embodiment, on the one hand, by generating a prompt word sequence from the compressed causal graph, the causal relationships of keywords in the original electricity description text can be captured. The prompt word sequence with causal relationships, combined with a large language model, enables the question-answering system to comprehensively understand the contextual information of the question, rather than simply processing keywords in isolation, thereby improving the accuracy of the answer. On the other hand, by compressing the original causal graph with the target path as a reference, the number of nodes in the causal graph can be greatly reduced while ensuring that important nodes of the target path in the causal graph are not lost. The significant reduction in node data can improve the response speed of the prompt word sequence, making the response speed of electricity marketing Q&A faster, and ensuring that important nodes are not lost can improve the accuracy of the prompt word sequence.

[0058] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0059] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0060] Figure 1 This is a flowchart illustrating a power marketing question-and-answer method based on a large language model, as provided in an embodiment of this application.

[0061] Figure 2 This is a schematic diagram of the interaction between a client and a server provided in an embodiment of this application;

[0062] Figure 3 This is a schematic diagram of a power marketing question-and-answer process based on a large language model, provided in an embodiment of this application.

[0063] Figure 4 This is a flowchart illustrating a training method for a question-answering model provided in an embodiment of this application;

[0064] Figure 5 This is a schematic diagram of the structure of a power marketing question-and-answer device based on a large language model provided in an embodiment of this application;

[0065] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0066] The following description and accompanying drawings fully illustrate specific embodiments of this application to enable those skilled in the art to practice them.

[0067] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0068] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0069] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0070] To address the aforementioned problems, this application provides a method and apparatus for electricity marketing question answering based on a large language model, thereby resolving the issues present in the related technical problems. In the embodiments of this application, on the one hand, by generating a prompt word sequence from a compressed causal graph, the causal relationships of keywords in the original electricity description text can be captured. The prompt word sequence with causal relationships, combined with a large language model, enables the question answering system to comprehensively understand the contextual information of the question, rather than simply processing keywords in isolation, thus improving the accuracy of the answer. On the other hand, by compressing the original causal graph with the target path as a reference, the number of nodes in the causal graph can be greatly reduced while ensuring that important nodes of the target path in the causal graph are not lost. The significant reduction in node data can improve the response speed of the prompt word sequence, resulting in a faster response speed for electricity marketing question answering. The accuracy of the prompt word sequence is improved by using exemplary embodiments below.

[0071] The following will be combined with the appendix Figure 1 -Appendix Figure 4 This application provides a detailed description of the electricity marketing question-and-answer method based on a large language model, as provided in the embodiments of this application. This method can be implemented using a computer program and can run on an electricity marketing question-and-answer device based on a von Neumann architecture and a large language model. This computer program can be integrated into an application or run as a standalone utility application.

[0072] Please see Figure 1 This document provides a flowchart illustrating a power marketing question-and-answer method based on a large language model, applicable to the server side. For example... Figure 1 As shown, the method in this application embodiment includes the following steps:

[0073] S101, Receive the electricity marketing Q&A request sent by the client. The electricity marketing Q&A request carries electricity description text related to electricity marketing.

[0074] In this context, the client is the user device or software application that initiates the request. A power marketing Q&A request is a request sent by the client to the Q&A system, containing the user's question or query. Power description text is textual information related to power marketing, describing the user's question or need. Power marketing encompasses marketing activities related to electricity, including the promotion of power services, customer inquiries, and fault handling.

[0075] In some embodiments of this application, the client can be an application on a user's mobile phone, computer, or other device, such as the official app or website of a power company. Users interact with the question-and-answer system through these devices. Users input questions or queries on the client. For example, a user might input "How do I check my electricity bill?" or "How do I report a power outage?". The client sends the user's electricity description text as a question-and-answer request to the server. The server receives the electricity marketing question-and-answer request sent by the client and then extracts the electricity description text related to electricity marketing.

[0076] For example Figure 2 As shown, Figure 2 This is a schematic diagram of the interaction between a client and a server provided in this application. Different clients 1, 2, and 3 can send electricity marketing Q&A requests to the server. The server has a pre-tuned question-and-answer model deployed on it, which can be used for processing.

[0077] S102, Generate a prompt word sequence based on the electricity description text; wherein, the prompt word sequence is obtained by traversing the compressed causal graph, which is obtained by compressing the original causal graph. The nodes in the original causal graph represent electricity keywords, and the edges between adjacent nodes represent the causal relationships between the electricity keywords.

[0078] The prompt word sequence is a set of keywords related to the user's question, used to guide the question-answering model to generate a more accurate answer, such as "electricity bill inquiry," "this month's bill," and "user inquiry." The compressed causal graph is a simplified graph structure obtained by compressing the original causal graph. The compressed causal graph retains the key information of the original causal graph while reducing complexity and improving processing efficiency. The original causal graph is a graph structure where nodes represent electricity keywords, and edges represent the causal relationships between these keywords. For example, there is an edge between the nodes "power outage" and "no electricity available." The original causal graph is a structured representation of knowledge in the electricity domain, used to capture the logical relationships between electricity keywords. Electricity keywords are keywords related to electricity marketing, such as "electricity bill," "power outage," and "repair request." Causal relationships represent the logical connections between electricity keywords, such as "power outage leads to no electricity available."

[0079] In some embodiments of this application, the specific process of generating a prompt word sequence based on the power description text includes: extracting at least one target keyword from the power description text; loading the original causal graph; identifying a set of prompt word propagation paths from the original causal graph based on the target keyword, wherein each prompt word propagation path in the set consists of a starting node corresponding to the target keyword propagating along a causal edge to the affected node; compressing the nodes of the original causal graph based on the set of prompt word propagation paths to obtain a compressed causal graph; calculating the correlation value between each node in the compressed causal graph and the power description text, and sequentially traversing the target node sequence with a correlation value greater than a preset correlation threshold; and using the power keywords corresponding to the sequentially traversed target node sequence as the prompt word sequence.

[0080] The target keywords are keywords extracted from the electricity description text that are relevant to the user's question. The starting node is the node corresponding to the target keyword, serving as the starting point for the prompt word propagation path. Affected nodes are nodes that have a causal relationship with the starting node. The correlation value is a measure of the relevance between the calculated node and the electricity description text. The target node sequence is the sequence of nodes that meet the criteria after being filtered by the correlation value. The target node sequence forms the basis for generating the prompt word sequence, reflecting the core keywords of the user's question.

[0081] In some embodiments of this application, the specific process of identifying the set of prompt word propagation paths from the original causal graph based on the target keyword includes: calculating the semantic similarity between the target keyword and the electricity keywords represented by each node in the original causal graph; taking the node with the highest semantic similarity as the starting node of the target keyword; starting from the starting node, using a priority traversal algorithm to traverse the path from the starting node along the causal edge to the affected node in the original causal graph, as the set of prompt word propagation paths; the affected node is a node that has a causal relationship with the starting node.

[0082] Specifically, semantic similarity can be obtained by calculating the cosine similarity between the target keyword vector and each power keyword vector. By calculating semantic similarity, the node most relevant to the target keyword can be found as the starting point for path recognition. A priority queue is created to store the nodes to be traversed and their path information. The starting node and its path information (initially with a path length of 0) are inserted into the priority queue. Nodes are removed from the priority queue, and a depth-first or breadth-first traversal is performed according to the causal edges. The priority queue can be sorted according to path length or path importance to ensure that more critical paths are traversed first. During the priority traversal, all paths from the starting node to the affected nodes are collected. All collected paths are used as a propagation path set for prompt words.

[0083] In some embodiments of this application, the specific implementation process of compressing nodes in the original causal graph based on the set of prompt word propagation paths to obtain a compressed causal graph includes: obtaining the path length, cumulative edge weight value, and similarity to the power description text of each prompt word propagation path in the set of prompt word propagation paths; calculating the path importance score of each prompt word propagation path based on the path length, cumulative edge weight value, and similarity to the prompt word; taking the prompt word propagation path with a path importance score greater than a preset score threshold as the target path; calculating the node similarity matrix between nodes in the original causal graph; and compressing the nodes in the original causal graph using the node similarity matrix with reference to the target path to obtain the compressed causal graph.

[0084] Specifically, the formula for calculating the path importance score is as follows:

[0085] S(P)=α×L(P)+β×W(P)+γ×sim(P,Prompt);

[0086] Where S(P) is the path importance score of the cue word propagation path P, L(P) is the path length of the cue word propagation path P, W(P) is the cumulative edge weight of the cue word propagation path P, and sim(P,Pro) is the similarity between the cue word propagation path P and the electricity description text.

[0087]

[0088] Where ω(e) is the weight of edge e in the propagation path P of the prompt word, and α, β, and γ are normalization coefficients used to adjust the weight of each factor to ensure that S(P) is within the preset range.

[0089] In some embodiments of this application, the specific process of calculating the similarity matrix between nodes in the original causal graph includes: obtaining the frequency of occurrence of each edge in all prompt word propagation paths and the importance of the path; calculating the contribution of each edge in the original causal graph based on the frequency of occurrence and the importance of the path; and calculating the node similarity between two nodes on each edge based on the contribution of each edge in the original causal graph, thereby obtaining the similarity matrix between nodes in the original causal graph.

[0090] Specifically, the formula for calculating the contribution of each edge is as follows:

[0091]

[0092] Among them, C(e) ij ) is edge e ij Contribution, side e ij Includes connecting nodes i and j, p is a set of cue word propagation paths, P is a cue word propagation path, Freq(e ijP) is edge e ij Imp(P) represents the frequency of occurrence of path P, and is the importance of path P, which is quantified using the path importance score calculation formula.

[0093] The formula for calculating the node similarity between two nodes on each edge is as follows:

[0094]

[0095] Sim(i,j) represents edge e ij The similarity between nodes i and j is included, where C(i) is the sum of the contributions of all edges connected to node i, and C(j) is the sum of the contributions of all edges connected to node i.

[0096] In some embodiments of this application, the specific process of compressing the original causal graph using a node similarity matrix with reference to the target path to obtain a compressed causal graph includes: traversing the first node and the second node from the original causal graph, where the first node and the second node are any pair of nodes in the node similarity matrix whose node similarity is greater than a preset threshold; determining whether the first node and the second node exist in the target path; if the first node and the second node do not exist in the target path, merging the first node and the second node into a new node; or, if the first node and the second node exist in the target path, continuing to traverse the first node and the second node from the original causal graph until the traversal is completed, thus obtaining the compressed causal graph.

[0097] In one possible implementation, the user inputs the text: "I want to check this month's electricity bill and understand how to apply for the energy-saving subsidy." Natural language processing techniques (such as word segmentation, part-of-speech tagging, and keyword extraction algorithms) are used to extract target keywords from the text. The target keywords are "electricity bill" and "energy-saving subsidy." An original causal graph is loaded from the electricity knowledge base. Assume the original causal graph contains the following nodes and edges: Nodes: Electricity bill, Query, This month, Energy-saving subsidy, Application, Policy; Edges: Electricity bill → Query, Query → This month, Energy-saving subsidy → Application, Application → Policy. The semantic similarity between the target keywords "electricity bill" and "energy-saving subsidy" and each node in the original causal graph is calculated. It is assumed that "electricity bill" has the highest similarity (1.0) with the node "electricity bill." It is also assumed that "energy-saving subsidy" has the highest similarity (1.0) with the node "energy-saving subsidy." The node "electricity bill" is used as the starting node for "electricity bill." The node "energy-saving subsidy" is used as the starting node for "energy-saving subsidy." Starting from the "Electricity Bill" node, traverse the path "Electricity Bill → Inquiry → This Month". Starting from the "Energy Saving Subsidy" node, traverse the path "Energy Saving Subsidy → Application → Policy". The final set of prompt word propagation paths is: {"Electricity Bill → Inquiry → This Month", "Energy Saving Subsidy → Application → Policy"}.

[0098] Calculate the importance score for each path, assuming all paths have an importance score higher than a threshold. Based on the path importance scores, compress the nodes in the original cause-effect graph. Assume the compressed cause-effect graph is as follows: Nodes: Electricity Bill, This Month's Inquiry, Energy Saving Subsidy, Application Policy. Edges: Electricity Bill → This Month's Inquiry, Energy Saving Subsidy → Application Policy. Calculate the correlation value between each node in the compressed cause-effect graph and the electricity description text. Assume the correlation value between "Electricity Bill" and the text is 0.9, "This Month's Inquiry" is 0.8, "Energy Saving Subsidy" is 0.9, and "Application Policy" is 0.7. Set the correlation threshold to 0.75. Filter out the node sequence with a correlation value greater than 0.75: Target node sequence: {"Electricity Bill", "This Month's Inquiry", "Energy Saving Subsidy", "Application Policy"}. Use the electricity keywords corresponding to the target node sequence as the prompt word sequence. Prompt word sequence: {"Electricity Bill", "This Month's Inquiry", "Energy Saving Subsidy", "Application Policy"}.

[0099] S103, input the prompt word sequence into the pre-fine-tuned question-answering model, output the answer result corresponding to the power description text, and send it to the client; the pre-fine-tuned question-answering model is obtained by fine-tuning the large language model.

[0100] The pre-tuned question-answering model is a domain-specific data-driven model trained and optimized based on a large language model. Through fine-tuning, the model better adapts to the specific needs of the electricity marketing field, generating more accurate and relevant answers. The large language model is a large-scale pre-trained language model, such as GPT, BERT, or Wenxin Yiyan, with powerful natural language generation and understanding capabilities. The answer result is a natural language response generated by the question-answering model based on the prompt word sequence and the electricity description text. For example, for the user question above, the answer might be: "You can check your electricity bill for this month by logging into the power company's official website or using the mobile app. Regarding energy-saving subsidies, you can submit an application; please refer to the latest notices issued by the power company for specific policies." The client is the terminal device or software application through which the user interacts with the question-answering system. Users send questions through the client and receive answers generated by the system. For example, users can interact with the question-answering system through the power company's official website, mobile app, or customer service hotline.

[0101] For example, if a user enters, "I want to check my electricity bill for this month and learn how to apply for an energy-saving subsidy," the prompt sequence is: {"electricity bill," "check this month," "energy-saving subsidy," "application policy"}. Based on this sequence, the question-answering model generates the response: "You can check your electricity bill for this month by logging into the power company's official website or using the mobile app. Regarding the energy-saving subsidy, you can submit an application; please refer to the latest notices issued by the power company for specific policies."

[0102] In this embodiment of the application, the specific process of generating a pre-tuned question-and-answer model includes: collecting historical electricity question-and-answer description text related to electricity marketing from the database of power companies; generating a historical prompt word sequence based on the historical electricity question-and-answer description text; labeling the corresponding answer results for the historical prompt word sequence to obtain a fine-tuning sample; creating a question-and-answer model using a large language model; and inputting the question-and-answer pairs from the fine-tuning sample into the question-and-answer model for model fine-tuning to obtain a pre-tuned question-and-answer model.

[0103] For example Figure 3 As shown, Figure 3 This application provides a schematic diagram of a power marketing question-and-answer process based on a large language model. The user outputs a question through the client and sends it to the server. The server has a question-and-answer model and a compressed cause-effect graph. The server extracts the power description text from the question, and then combines the power description question and the compressed cause-effect graph to generate a prompt word sequence. Next, the model analyzes the prompt word sequence to obtain the final answer result, which can finally be fed back to the client.

[0104] In this embodiment, on the one hand, by generating a prompt word sequence from the compressed causal graph, the causal relationships of keywords in the original electricity description text can be captured. The prompt word sequence with causal relationships, combined with a large language model, enables the question-answering system to comprehensively understand the contextual information of the question, rather than simply processing keywords in isolation, thereby improving the accuracy of the answer. On the other hand, by compressing the original causal graph with the target path as a reference, the number of nodes in the causal graph can be greatly reduced while ensuring that important nodes of the target path in the causal graph are not lost. The significant reduction in node data can improve the response speed of the prompt word sequence, making the response speed of electricity marketing Q&A faster, and ensuring that important nodes are not lost can improve the accuracy of the prompt word sequence.

[0105] Please see Figure 4 This is a flowchart illustrating a training method for a question-answering model, as provided in an embodiment of this application. Figure 4 As shown, the method in this application embodiment may include the following steps:

[0106] S201, collect historical Q&A descriptions related to electricity marketing from the database of power companies;

[0107] In this context, "power companies" refers to companies or institutions that produce, transmit, and distribute electricity to consumers. These companies are involved in multiple stages, including power generation, transmission, distribution, and sales. A database is a systematic way to store, retrieve, and maintain data. Databases can be relational, such as MySQL and Oracle, or non-relational, such as MongoDB and Cassandra. Historical electricity Q&A description text refers to past records of questions and answers between users and power company customer service representatives. These records may include user inquiries, customer service responses, and related service information.

[0108] S202, Generate a sequence of historical prompt words based on historical electricity Q&A description text;

[0109] The historical prompt word sequence is used to guide the question-answering model in understanding the user's question and generating relevant answers. The generation process of the historical prompt word sequence is the same as that in step S102, and will not be repeated here.

[0110] S203: For historical prompt word sequences, label the corresponding answer results to obtain fine-tuned samples;

[0111] In natural language processing, fine-tuning samples refer to datasets used for further training of models. These samples contain inputs (such as sequences of prompt words) and expected outputs (such as the correct answer). Fine-tuning samples are used to adjust and optimize the parameters of pre-trained models to better suit specific tasks or domains, such as electricity marketing question answering.

[0112] S204 uses a large language model to create a question-answering model;

[0113] Large language models refer to language models with deep neural network structures that are pre-trained on large amounts of text data, such as BERT and GPT-3. Question-answering models are specifically designed to handle question-answering tasks; they can understand user questions and generate corresponding answers.

[0114] S205. Input the question-answer pairs from the fine-tuning samples into the question-answering model for model fine-tuning to obtain the pre-fine-tuned question-answering model.

[0115] Among them, the pre-tuned question-answering model can better understand and answer questions in specific fields, such as electricity marketing, thereby improving the accuracy of the question-answering system and user satisfaction.

[0116] In one possible implementation, customer Q&A records from the past year are extracted from the company's customer service system. These records include questions raised by customers via phone, email, or online chat regarding electricity bills, energy-saving subsidies, power outage reports, etc., along with customer service responses. For example, a dataset containing 5000 question-and-answer pairs, each record including a user question and a customer service answer. Based on the historical electricity Q&A description text, historical prompt word sequences are generated. For example, from the question "How do I apply for an energy-saving subsidy?", prompt words are generated as "apply" and "energy-saving subsidy," with a corresponding prompt word sequence for each question-and-answer pair, such as "[apply, energy-saving subsidy]". Annotators label each prompt word sequence with the correct answer based on the customer service representative's response. For example, for the prompt word sequence "[apply, energy-saving subsidy]", the annotators check the customer service representative's answer and confirm its accuracy, ultimately obtaining a pre-annotated, fine-tuned sample dataset containing the prompt word sequences and their corresponding correct answers. A pre-trained large language model, such as BERT or GPT-3, is chosen as the basis for the question-and-answer model. The pre-trained large language model is further trained using a labeled, fine-tuned sample dataset. The model parameters are adjusted to more accurately understand and answer questions related to electricity marketing. The final result is a pre-tuned question-answering model specifically optimized for questions in the electricity marketing domain.

[0117] In this embodiment, on the one hand, by generating a prompt word sequence from the compressed causal graph, the causal relationships of keywords in the original electricity description text can be captured. The prompt word sequence with causal relationships, combined with a large language model, enables the question-answering system to comprehensively understand the contextual information of the question, rather than simply processing keywords in isolation, thereby improving the accuracy of the answer. On the other hand, by compressing the original causal graph with the target path as a reference, the number of nodes in the causal graph can be greatly reduced while ensuring that important nodes of the target path in the causal graph are not lost. The significant reduction in node data can improve the response speed of the prompt word sequence, making the response speed of electricity marketing Q&A faster, and ensuring that important nodes are not lost can improve the accuracy of the prompt word sequence.

[0118] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0119] Please see Figure 5 This illustration shows a schematic diagram of a large language model-based electricity marketing question-and-answer device provided in an exemplary embodiment of this application. This large language model-based electricity marketing question-and-answer device can be implemented as all or part of an electronic device through software, hardware, or a combination of both. The device 1 includes an electricity marketing question-and-answer request receiving module 10, a prompt word sequence generation module 20, and an answer result sending module 30.

[0120] The electricity marketing Q&A request receiving module 10 is used to receive electricity marketing Q&A requests sent by the client. The electricity marketing Q&A requests carry electricity description text related to electricity marketing.

[0121] The prompt word sequence generation module 20 is used to generate a prompt word sequence based on the electricity description text. The prompt word sequence is obtained by traversing a compressed causal graph, which is obtained by compressing the original causal graph. The nodes in the original causal graph represent electricity keywords, and the edges between adjacent nodes represent the causal relationships between the electricity keywords.

[0122] The response sending module 30 is used to input the prompt word sequence into the pre-fine-tuned question-and-answer model, output the response corresponding to the power description text, and send it to the client; the pre-fine-tuned question-and-answer model is obtained by fine-tuning a large language model.

[0123] It should be noted that the electricity marketing question-and-answer device based on a large language model provided in the above embodiments is only illustrated by the division of the above functional modules when executing the electricity marketing question-and-answer method based on a large language model. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the electricity marketing question-and-answer device based on a large language model provided in the above embodiments and the electricity marketing question-and-answer method embodiments based on a large language model belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0124] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0125] In this embodiment, on the one hand, by generating a prompt word sequence from the compressed causal graph, the causal relationships of keywords in the original electricity description text can be captured. The prompt word sequence with causal relationships, combined with a large language model, enables the question-answering system to comprehensively understand the contextual information of the question, rather than simply processing keywords in isolation, thereby improving the accuracy of the answer. On the other hand, by compressing the original causal graph with the target path as a reference, the number of nodes in the causal graph can be greatly reduced while ensuring that important nodes of the target path in the causal graph are not lost. The significant reduction in node data can improve the response speed of the prompt word sequence, making the response speed of electricity marketing Q&A faster, and ensuring that important nodes are not lost can improve the accuracy of the prompt word sequence.

[0126] This application also provides a computer-readable medium having program instructions stored thereon, which, when executed by a processor, implement the electricity marketing question-and-answer method based on a large language model provided in the above-described method embodiments.

[0127] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the electricity marketing question-and-answer method based on a large language model according to the various method embodiments described above.

[0128] Please see Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 1000 may include: at least one processor 1001, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002.

[0129] The communication bus 1002 is used to realize the connection and communication between these components.

[0130] The user interface 1003 may include a display screen and a camera. Optionally, the user interface 1003 may also include a standard wired interface and a wireless interface.

[0131] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0132] The processor 1001 may include one or more processing cores. The processor 1001 connects to various parts within the electronic device 1000 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and by calling data stored in the memory 1005. Optionally, the processor 1001 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1001 may integrate one or more of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip, rather than integrated into the processor 1001.

[0133] The memory 1005 may include random access memory (RAM) or read-only memory. Optionally, the memory 1005 may include a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 1005 may also be at least one storage system located remotely from the aforementioned processor 1001. Figure 6 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a power marketing Q&A application based on a large language model.

[0134] exist Figure 6 In the illustrated electronic device 1000, the user interface 1003 is mainly used to provide an input interface for the user and to obtain the user's input data; while the processor 1001 can be used to call the electricity marketing question-and-answer application based on a large language model stored in the memory 1005, and specifically perform the following operations:

[0135] Receive electricity marketing Q&A requests sent by the client, which carry electricity marketing-related descriptive text;

[0136] Based on the description text of electricity, a sequence of prompt words is generated. The sequence of prompt words is obtained by traversing a compressed causal graph, which is obtained by compressing the original causal graph. The nodes in the original causal graph represent electricity keywords, and the edges between adjacent nodes represent the causal relationships between the electricity keywords.

[0137] The prompt word sequence is input into a pre-tuned question-answering model, which outputs the answer corresponding to the electricity description text and sends it to the client. The pre-tuned question-answering model is obtained by fine-tuning a large language model.

[0138] In one embodiment, when the processor 1001 generates a pre-tuned question-answering model, it specifically performs the following operations:

[0139] Collect historical Q&A descriptions related to electricity marketing from the databases of power companies;

[0140] Generate a sequence of historical prompt words based on historical electricity Q&A description text;

[0141] For historical prompt word sequences, the corresponding answer results are labeled to obtain fine-tuned samples;

[0142] A question-answering model is created using a large language model;

[0143] The question-answer pairs in the fine-tuning samples are input into the question-answering model for fine-tuning, resulting in a pre-tuned question-answering model.

[0144] In one embodiment, when the processor 1001 generates a sequence of prompt words based on the electricity description text, it specifically performs the following operations:

[0145] Extract at least one target keyword from the power description text;

[0146] Load the original cause-effect graph;

[0147] Based on the target keyword, a set of prompt word propagation paths is identified from the original causal graph. Each prompt word propagation path in the set consists of a starting node corresponding to the target keyword propagating along the causal edge to the affected node.

[0148] Based on the set of prompt word propagation paths, the original causal graph is compressed to obtain a compressed causal graph.

[0149] Calculate the correlation value between each node in the compressed cause-effect graph and the power description text, and sequentially traverse the sequence of target nodes whose correlation value is greater than a preset correlation threshold;

[0150] The electricity keywords corresponding to the target node sequence obtained by traversing the sequence in turn are used as the prompt word sequence.

[0151] In one embodiment, when processor 1001 identifies a set of prompt word propagation paths from the original causal graph based on target keywords, it specifically performs the following operations:

[0152] Calculate the semantic similarity between the target keyword and the electricity keywords represented by each node in the original causal graph;

[0153] Use the node with the highest semantic similarity as the starting node for the target keyword;

[0154] Starting from the initial node, a priority traversal algorithm is used to traverse the path from the initial node along the causal edges to the affected node in the original causal graph, which is used as the set of propagation paths for the prompt word; the affected node is the node that has a causal relationship with the initial node.

[0155] In one embodiment, when processor 1001 performs node compression on the original causal graph based on the set of prompt word propagation paths to obtain a compressed causal graph, it specifically performs the following operations:

[0156] Obtain the path length, cumulative edge weight, and similarity to the electricity description text for each propagation path in the propagation path set;

[0157] Calculate the path importance score for each prompt word propagation path based on path length, cumulative edge weight, and similarity to the prompt word;

[0158] The propagation paths of prompt words whose path importance scores are greater than a preset score threshold are taken as target paths;

[0159] Calculate the node similarity matrix between nodes in the original causal graph;

[0160] Using the target path as a reference, the original causal graph is compressed by applying a node similarity matrix to obtain a compressed causal graph.

[0161] In one embodiment, when the processor 1001 performs node compression on the original causal graph using a node similarity matrix with reference to the target path to obtain a compressed causal graph, it specifically performs the following operations:

[0162] Traverse the original causal graph to find the first and second nodes. The first and second nodes are any pair of nodes in the node similarity matrix whose node similarity is greater than a preset threshold.

[0163] Determine whether the first and second nodes exist in the target path;

[0164] If neither the first nor the second node exists in the target path, merge the first and second nodes into a new node; or,

[0165] If the first and second nodes exist in the target path, continue to execute the steps of traversing the first and second nodes from the original causal graph until the traversal is completed, and obtain the compressed causal graph.

[0166] In one embodiment, when the processor 1001 performs the calculation of the similarity matrix between nodes in the original causal graph, it specifically performs the following operations:

[0167] Obtain the frequency of each edge in all propagation paths of the original causal graph and the importance of those paths;

[0168] The contribution of each edge in the original causal graph is calculated based on its frequency of occurrence and the importance of the path.

[0169] Based on the contribution of each edge in the original causal graph, the node similarity between two nodes on each edge is calculated to obtain the similarity matrix between nodes in the original causal graph.

[0170] In this embodiment, on the one hand, by generating a prompt word sequence from the compressed causal graph, the causal relationships of keywords in the original electricity description text can be captured. The prompt word sequence with causal relationships, combined with a large language model, enables the question-answering system to comprehensively understand the contextual information of the question, rather than simply processing keywords in isolation, thereby improving the accuracy of the answer. On the other hand, by compressing the original causal graph with the target path as a reference, the number of nodes in the causal graph can be greatly reduced while ensuring that important nodes of the target path in the causal graph are not lost. The significant reduction in node data can improve the response speed of the prompt word sequence, making the response speed of electricity marketing Q&A faster, and ensuring that important nodes are not lost can improve the accuracy of the prompt word sequence.

[0171] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The electricity marketing question-and-answer program based on a large language model can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The storage medium for the electricity marketing question-and-answer program based on a large language model can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0172] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A power marketing question and answer method based on a large language model, characterized in that, Applied to a server, the method comprises: Receiving a power marketing question and answer request sent by a client, the power marketing question and answer request carrying a power description text related to power marketing; According to the power description text, a prompt word sequence is generated; wherein the prompt word sequence is obtained by traversing a compressed causal graph, the compressed causal graph being obtained by compressing an original causal graph, the nodes in the original causal graph representing power keywords, and the edges between adjacent nodes representing the causal relationship between the power keywords; The prompt word sequence is input into a pre-tuned question and answer model, and an answer result corresponding to the power description text is output and sent to the client; the pre-tuned question and answer model is obtained by fine-tuning a large language model.

2. The method of claim 1, wherein, The pre-tuned question and answer model is generated according to the following steps, comprising: Collecting historical power question and answer description texts related to power marketing from the database of a power enterprise; According to the historical power question and answer description texts, a historical prompt word sequence is generated; For the historical prompt word sequence, the corresponding answer result is labeled to obtain a fine-tuning sample; Using a large language model, a question and answer model is created; The question and answer pairs in the fine-tuning sample are input into the question and answer model for model fine-tuning to obtain a pre-tuned question and answer model.

3. The method of claim 1, wherein, The power description text includes at least one target keyword; Load the original causal graph; According to the target keyword, a set of prompt word propagation paths is identified from the original causal graph, each prompt word propagation path in the set being composed of a starting node corresponding to the target keyword propagating to an affected node along a causal edge; Based on the set of prompt word propagation paths, the original causal graph is compressed to obtain a compressed causal graph; Calculate the relevance value of each node in the compressed causal graph to the power description text, and sequentially traverse the target node sequence with a relevance value greater than a preset relevance threshold; The power keywords corresponding to the sequentially traversed target node sequence are taken as the prompt word sequence. The target keyword and the power keyword represented by each node in the original causal graph are calculated for semantic similarity; 4. The method of claim 3, wherein, The node with the highest semantic similarity is taken as the starting node of the target keyword; Using a priority traversal algorithm, the path from the starting node to the affected node is traversed from the original causal graph, as a set of prompt word propagation paths; the affected node is a node having a causal relationship with the starting node. The path length, edge weight cumulative value, and similarity between the prompt word propagation path and the power description text are obtained; According to the path length, edge weight cumulative value, and similarity between the prompt word and the prompt word, the path importance score of each prompt word propagation path is calculated; 5. The method of claim 3, wherein, ​ ​ ​ The prompt word propagation path with the path importance score greater than a preset score threshold is taken as a target path; A node similarity matrix between nodes in the original causal graph is calculated; The original causal graph is node-compressed by using the node similarity matrix with reference to the target path, to obtain a compressed causal graph.

6. The method of claim 5, wherein, The calculation formula of the path importance score is: S(P) = a*L(P) + b*W(P) + g*sim(P, Prompt); Wherein, S(P) is the path importance score of the prompt word propagation path P, L(P) is the path length of the prompt word propagation path P, W(P) is the edge weight cumulative value of the prompt word propagation path P, and sim(P, Pro) is the similarity between the prompt word propagation path P and the power description text; Wherein, ω(e) is the weight of the edge e in the prompt word propagation path P, and a, b and g are normalization coefficients for adjusting the weight of each factor to ensure that S(P) is within a preset range.

7. The method of claim 5, wherein, The node-compression of the original causal graph by using the node similarity matrix with reference to the target path to obtain a compressed causal graph comprises: Traverse the first node and the second node from the original causal graph, wherein the first node and the second node are any one group of nodes with node similarity greater than a preset threshold in the node similarity matrix; Determine whether the first node and the second node exist in the target path; In the case that the first node and the second node do not exist in the target path, the first node and the second node are merged into a new node; or In the case that the first node and the second node exist in the target path, the step of traversing the first node and the second node from the original causal graph is continued until the traversal is completed, to obtain a compressed causal graph.

8. The method of claim 5, wherein, The calculation of the similarity matrix between nodes in the original causal graph comprises: Obtain the appearance frequency of each edge in all prompt word propagation paths and the importance of the path in the original causal graph; According to the appearance frequency and the importance of the path, the contribution degree of each edge in the original causal graph is calculated; According to the contribution degree of each edge in the original causal graph, the node similarity between two nodes on the edge is calculated to obtain the similarity matrix between nodes in the original causal graph.

9. The method of claim 8, wherein, The calculation formula of the contribution degree of each edge is: wherein C(e ij ) is the contribution degree of edge e ij , edge e ij includes connecting node i and node j, p is a set of prompt propagation paths, P is a prompt propagation path, Freq(e ij , P) is the occurrence frequency of edge e ij in path P, and Imp(P) is the importance degree of path P, which is quantified by using a calculation formula of path importance score. The calculation formula of the node similarity between two nodes on the edge is: Sim(i,j) is the edge e ij The node similarity between the included connection node i and node j, C(i) is the sum of the contribution degree of all edges connected with node i, and C(j) is the sum of the contribution degree of all edges connected with node i. 10.A power marketing question and answer device based on a large language model, characterized in that, The device comprises: The power marketing question and answer request receiving module is configured to receive a power marketing question and answer request sent by a client, wherein the power marketing question and answer request carries a power description text related to power marketing; The prompt word sequence generation module is configured to generate a prompt word sequence according to the power description text, wherein the prompt word sequence is obtained by traversing a compressed causal graph, the compressed causal graph is obtained by compressing an original causal graph, and the nodes in the original causal graph represent power keywords, and the edges between adjacent nodes represent the causal relationship between the power keywords. The answering result sending module is configured to input the prompt word sequence into a pre-fine-tuned question and answer model, output an answering result corresponding to the power description text, and send the answering result to the client; the pre-fine-tuned question and answer model is obtained based on fine-tuning of a large language model.