Large model prompt thinking chain construction method for electric power customer service and related device

By identifying the target topic type and similarity of electricity customer service questions and selecting fusion thought chains, and combining multi-thought chain example fusion analysis with graph attention networks, the high cost and low efficiency of constructing large model thought chains in the field of electricity customer service are solved, achieving more efficient and accurate reasoning results.

CN120975236APending Publication Date: 2025-11-18CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD +3
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511098180.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Existing methods for constructing large-scale model thought chains are computationally expensive and inefficient in the power customer service field, making it difficult to achieve stability and accuracy in complex tasks.

Method used

By acquiring customer service questions related to electricity, the target topic type is determined, and a comprehensive representation of each fusion thought chain is obtained. Based on similarity, the fusion thought chain with the highest similarity is selected as the prompt thought chain for the large model. A topic type-based selection strategy and a multi-thought chain example fusion analysis strategy using graph attention networks are adopted.

Benefits of technology

It effectively reduces the complexity of selection strategies, improves selection efficiency and the quality of prompts, and enhances the stability and accuracy of reasoning by integrating thought chains.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120975236A_ABST
    Figure CN120975236A_ABST
Patent Text Reader

Abstract

The invention belongs to the crossing field of artificial intelligence and an electric power system, and discloses an electric power customer service oriented large model prompt thinking chain construction method and related device.Firstly, a target topic type is determined according to an electric power customer service problem, and then comprehensive representation of all fused thinking chains of the target topic type is obtained; and selecting a fusion thinking chain corresponding to the comprehensive representation with the highest similarity based on the similarity, and taking the fusion thinking chain as a large model prompt thinking chain of the electric power customer service problem for the electric power customer service. According to the method, the selection strategy based on the topic type is adopted, the complexity of the selection strategy is effectively reduced, and the selection efficiency and the cue word quality are improved. Meanwhile, the comprehensive representation of each fusion thinking chain of the target topic type adopts a multi-thinking chain example fusion analysis strategy based on a graph attention network, and the reasoning process information of multiple thinking chain examples is integrated, so that the reasoning stability and accuracy of the finally selected fusion thinking chain are improved; the problem of instability caused by reasoning based on a single thinking chain example is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the cross field of artificial intelligence and power systems, and relates to a large model prompt thinking chain construction method for power customer service and a related device. BACKGROUND

[0002] In the field of power customer service, researchers fine-tune the field data and construct specific prompt templates to enable the power customer service large model to have better question and answer capabilities and certain reasoning and explanation capabilities.

[0003] The reasoning method based on the thinking chain prompt shows the intermediate steps of reasoning, guides the large model to gradually reason and generate answers, and effectively improves the performance of the large model in complex tasks. How to automatically and efficiently construct a large model thinking chain prompt suitable for complex scenarios of power customer service and realize the stability and accuracy of the reasoning process of the power customer service large model has become one of the key problems to be solved in the field of power customer service.

[0004] At present, when the existing large model thinking chain construction method selects a better thinking chain example for prompt template construction from several thinking chain examples, it usually selects based on reinforcement learning or complex optimization strategies, resulting in high computational cost, low selection efficiency, and difficulty in popularization to specific field applications such as the field of power customer service. SUMMARY

[0005] The purpose of the present application is to overcome the shortcomings of the prior art and provide a large model prompt thinking chain construction method for power customer service and a related device.

[0006] To achieve the above-mentioned purpose, the following technical solutions are adopted:

[0007] In a first aspect, the present application provides a large model prompt thinking chain construction method for power customer service, comprising: obtaining a power customer service question and determining a target topic type according to the power customer service question; obtaining a comprehensive representation of each fusion thinking chain of the target topic type; obtaining a fusion thinking chain corresponding to the comprehensive representation with the highest similarity to the power customer service question in the comprehensive representation of each fusion thinking chain of the target topic type as the large model prompt thinking chain for the power customer service question of the power customer service; wherein the comprehensive representation of each fusion thinking chain of the target topic type is constructed by: obtaining a plurality of thinking chain examples of the target topic type and constructing a thinking chain graph of the target topic type according to the plurality of thinking chain examples, and obtaining each fusion thinking chain of the target topic type and the comprehensive representation of each fusion thinking chain of the target topic type through a pre-trained graph attention network according to the thinking chain graph of the target topic type.

[0008] Optionally, the determining the target topic type according to the power customer service question comprises: obtaining a preset topic type in each topic type whose representation vector has the highest similarity with the power customer service question, as the target topic type determined by the power customer service question.

[0009] Optionally, the representation vector of the topic type is obtained by: counting the word frequency of each feature word of each thinking chain example of the topic type; calculating the c-TF-IDF weight of each feature word using the category-based term frequency-inverse document frequency c-TF-IDF algorithm according to the word frequency of each feature word; and selecting the first preset number of feature words in the order from large to small according to the c-TF-IDF weight, as the representation vector of the topic type.

[0010] Optionally, the obtaining of the several thinking chain examples of the target topic type comprises: obtaining several power customer service question samples; generating several thinking chain examples of each power customer service question sample by a large model based on a preset thinking chain generation prompt template according to the several power customer service question samples; classifying all the thinking chain examples based on the topic type to obtain the thinking chain examples of each topic type, and obtaining the several thinking chain examples of the target topic type according to the thinking chain examples of each topic type.

[0011] Optionally, the classifying all the thinking chain examples based on the topic type comprises: classifying all the thinking chain examples based on the topic type by using a topic modeling method based on bidirectional encoder representation.

[0012] Optionally, before the classifying all the thinking chain examples based on the topic type, the method further comprises: screening the thinking chain examples by:

[0013] S pool ={c i |Sim(a i ,t i )≥θ,c i ∈C}

[0014]

[0015] wherein, S pool is the screened thinking chain example set; c i is the i-th thinking chain example before screening; Sim(a i ,t i ) is the similarity of a i and t i ; θ is the similarity threshold; C is the thinking chain example set before screening; a i is the generated answer q i of the power customer service big model based on c i ; t iThe true answer for q i The true answer for q i The true answer for c i The corresponding power customer service problem sample; Embedding (*) represents an embedding vector.

[0016] Optionally, the constructing the thought chain graph of the target topic type according to the plurality of thought chain examples comprises: constructing the thought chain graph of the target topic type according to the plurality of thought chain examples, taking the reasoning steps in the thought chain examples as nodes, and taking the connection relationship between the reasoning steps as edges; wherein, the continuous reasoning steps in the same thought chain example in the thought chain graph are connected, and for the reasoning steps in different thought chain examples: when the similarity between the reasoning steps is not less than a preset semantic similarity threshold, the reasoning steps are connected; otherwise, the reasoning steps are not connected.

[0017] Optionally, before the constructing the thought chain graph of the target topic type according to the plurality of thought chain examples, the method further comprises: adopting a maximum marginal correlation method, and performing cyclic screening of the plurality of thought chain examples of the target topic type by the following formula, until the screened thought chain examples reach a specified number or reach a maximum similarity limit, and taking the screened thought chain examples as the thought chain examples for constructing the thought chain graph of the target topic type:

[0018]

[0019] Wherein, d i is an embedding vector of the i-th thought chain example of the target topic type; T j is the target topic type; S is a set of screened thought chain examples; Sim(q,d i ) is the similarity between d i and q; Sim(d i ,d k ) is the similarity between d i and d k ; λ is a balance parameter; q is an embedding vector of the power customer service question; d k is the k-th screened thought chain example.

[0020] In a second aspect, the present application provides a large model prompt thinking chain construction system for power customer service, comprising: a type determination module configured to obtain a power customer service question and determine a target topic type according to the power customer service question; a comprehensive representation module configured to obtain comprehensive representations of each fusion thinking chain of the target topic type; and a selection module configured to obtain a fusion thinking chain corresponding to a comprehensive representation with the highest similarity to the power customer service question from the comprehensive representations of each fusion thinking chain, as a large model prompt thinking chain for the power customer service question of the power customer service; wherein the comprehensive representations of each fusion thinking chain of the target topic type are constructed by: obtaining a plurality of thinking chain examples of the target topic type and constructing a thinking chain graph of the target topic type according to the plurality of thinking chain examples, and obtaining each fusion thinking chain of the target topic type and the comprehensive representations of each fusion thinking chain according to the thinking chain graph of the target topic type through a pre-trained graph attention network.

[0021] Optionally, the target topic type is determined according to the power customer service question by: obtaining a topic type with a representation vector of each topic type in a plurality of preset topic types that is most similar to the power customer service question, as the target topic type determined according to the power customer service question.

[0022] Optionally, the representation vector of the topic type is obtained by: counting the word frequency of each feature word of each thinking chain example of the topic type; calculating the c-TF-IDF weight of each feature word using a category-based term frequency-inverse document frequency c-TF-IDF algorithm according to the word frequency of each feature word; and selecting the first preset number of feature words in descending order of c-TF-IDF weight as the representation vector of the topic type.

[0023] Optionally, the plurality of thinking chain examples of the target topic type are obtained by: obtaining a plurality of power customer service question samples; generating a plurality of thinking chain example of each power customer service question sample through a large model based on a preset thinking chain generation prompt template according to the plurality of power customer service question samples; classifying all thinking chain examples based on topic types to obtain thinking chain examples of each topic type, and obtaining the plurality of thinking chain examples of the target topic type according to the thinking chain examples of each topic type.

[0024] Optionally, the classification of all thinking chain examples based on topic types comprises: classifying all thinking chain examples based on topic types using a topic modeling method based on bidirectional encoder representation.

[0025] Optionally, before the classification of all thinking chain examples based on topic types, the method further comprises: screening the thinking chain examples by:

[0026] S pool ={c i |Sim(a i ,ti ) >= theta, c i e C

[0027]

[0028] wherein S pool is the set of filtered thought chain examples; c i is the ith thought chain example before filtering; Sim(a i , t i ) is the similarity between a i and t i ; theta is the similarity threshold; C is the set of thought chain examples before filtering; a i is the generated answer of q i based on c i ; t i is the true answer of q i ; q i is the corresponding power customer service question sample of c i ; Embedding(*) represents the embedding vector.

[0029] Optionally, the constructing the thought chain graph of the target topic type according to the plurality of thought chain examples comprises: constructing the thought chain graph of the target topic type according to the plurality of thought chain examples, taking the reasoning steps in the thought chain examples as nodes, and taking the connection relationship between the reasoning steps as edges; wherein the continuous reasoning steps in the same thought chain example in the thought chain graph are connected, and for the reasoning steps in different thought chain examples: when the similarity between the reasoning steps is not less than a preset semantic similarity threshold, the reasoning steps are connected; otherwise, the reasoning steps are not connected.

[0030] Optionally, before the constructing the thought chain graph of the target topic type according to the plurality of thought chain examples, the method further comprises: adopting a maximum marginal correlation method to perform a cycle filtering of the plurality of thought chain examples of the target topic type by the following formula until the filtered thought chain examples reach a specified number or reach a maximum similarity limit, and taking the filtered thought chain examples as the thought chain examples for constructing the thought chain graph of the target topic type:

[0031]

[0032] wherein d i is the embedding vector of the ith thought chain example of the target topic type; T j is the target topic type; S is the set of filtered thought chain examples; Sim(q, d i ) is the similarity between d i and q; Sim(d i , d k ) is the similarity between d i and dk similarity; λ is a balance parameter; q is an embedding vector of the power customer service problem; d k is the kth thought chain example screened out.

[0033] In a third aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for constructing a large model prompt thought chain for power customer service when executing the computer program.

[0034] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, wherein the computer program implements the steps of the method for constructing a large model prompt thought chain for power customer service when executed by a processor.

[0035] Compared with the prior art, the present application has the following beneficial effects:

[0036] The method for constructing a large model prompt thought chain for power customer service first determines the target topic type according to the power customer service problem, then obtains the comprehensive representation of each fusion thought chain of the target topic type, and then selects the fusion thought chain corresponding to the comprehensive representation with the highest similarity based on the similarity, as the large model prompt thought chain for the power customer service problem. This method adopts a selection strategy based on topic types, effectively reduces the complexity of the selection strategy, and improves the selection efficiency and the quality of the prompt words. At the same time, the comprehensive representation of each fusion thought chain of the target topic type adopts a multi-thought chain example fusion analysis strategy based on a graph attention network, integrates the reasoning process information of multiple thought chain examples, improves the reasoning stability and accuracy of the selected fusion thought chain, and effectively solves the instability problem caused by reasoning based on a single thought chain example. BRIEF DESCRIPTION OF DRAWINGS

[0037] Figure 1 The flow chart of the method for constructing a large model prompt thought chain for power customer service according to the embodiment of the present application.

[0038] Figure 2 The structure block diagram of the system for constructing a large model prompt thought chain for power customer service according to the embodiment of the present application. DETAILED DESCRIPTION

[0039] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work should fall within the protection scope of the present application.

[0040] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product, or device.

[0041] The present application will be described in further detail below with reference to the drawings:

[0042] Referring to Figure 1 In an embodiment of the present application, a large model prompt thinking chain construction method for power customer service is provided, which can realize high-quality and high-efficiency screening of thinking examples and improve the reasoning effect of the large model of power customer service.

[0043] Specifically, the large model prompt thinking chain construction method for power customer service includes the following steps:

[0044] S1: Obtain a power customer service question, and determine a target topic type according to the power customer service question.

[0045] S2: Obtain a comprehensive representation of each fusion thinking chain of the target topic type.

[0046] S3: Obtain a fusion thinking chain corresponding to the comprehensive representation with the highest similarity to the power customer service question in the comprehensive representation of each fusion thinking chain, as a large model prompt thinking chain for the power customer service question.

[0047] The comprehensive representation of each fusion thinking chain of the target topic type is constructed by the following method: obtaining a plurality of thinking examples of the target topic type, constructing a thinking chain graph of the target topic type according to the plurality of thinking examples, and obtaining each fusion thinking chain of the target topic type and a comprehensive representation of each fusion thinking chain through a pre-trained graph attention network according to the thinking chain graph of the target topic type.

[0048] The application is a large model prompt thinking chain construction method for power customer service. First, the target topic type is determined according to the power customer service problem, then the comprehensive representation of each fusion thinking chain of the target topic type is obtained, and then the fusion thinking chain corresponding to the highest similarity comprehensive representation is selected based on similarity as the large model prompt thinking chain for power customer service of the power customer service problem. This method uses a selection strategy based on topic type, effectively reduces the complexity of the selection strategy, and improves the selection efficiency and prompt word quality. At the same time, the comprehensive representation of each fusion thinking chain of the target topic type uses a multi-thinking example fusion analysis strategy based on graph attention network to integrate the reasoning process information of multiple thinking example, which improves the reasoning stability and accuracy of the finally selected fusion thinking chain, effectively solving the instability problem caused by reasoning based on a single thinking example.

[0049] In a possible implementation, the target topic type is determined according to the power customer service problem, which includes: obtaining the representation vector of the power customer service problem; obtaining the representation vector of the topic type in each preset topic type, and the topic type with the highest similarity to the power customer service problem as the target topic type determined by the power customer service problem.

[0050] For example, when calculating the similarity of the representation vector of the topic type and the power customer service problem, a semantic similarity method can be used. Specifically, the embedding vector of the representation vector of the topic type and the embedding vector of the power customer service problem are obtained, and then the semantic similarity between the representation vector of the topic type and the power customer service problem is determined by the vector inner product based on the embedding vector of the representation vector of the topic type and the embedding vector of the power customer service problem. The embedding vector can be generated using a pre-trained Sentence-BERT model. The Sentence-BERT model is a variant based on the BERT (Bidirectional Encoder Representations from Transformers or Bidirectional Encoder Representations) architecture, designed specifically for generating fixed-length sentence embeddings, and optimized for semantic embeddings to improve computational efficiency, suitable for tasks such as semantic similarity calculation, text clustering, and information retrieval.

[0051] In a possible implementation, the representation vector of the topic type is obtained by: counting the word frequency of each feature word of each thinking example of the topic type; calculating the c-TF-IDF weight of each feature word using the category-based word frequency-inverse document frequency c-TF-IDF algorithm according to the word frequency of each feature word; and selecting the top pre-set number of feature words in the descending order of c-TF-IDF weight as the representation vector of the topic type.

[0052] Exemplarily, when counting the word frequencies of the feature words of each thinking chain example of each topic type, CountVectorizer can be used to count the word frequencies of the feature words of each thinking chain example of each topic type. CountVectorizer is a tool for text feature extraction in the scikit-learn library, which can convert text into a word frequency matrix and then count the number of times each feature word appears in a document.

[0053] Explanatorily, the c-TF-IDF (class-based term frequency-inverse document frequency) algorithm is an improved text feature extraction algorithm designed for clustering or classification tasks to highlight keywords that are distinctive in each class. When calculating the c-TF-IDF weight of each feature word by the c-TF-IDF algorithm, for the feature w in the topic type T j , the c-TF-IDF weight W w,j of w is calculated as follows:

[0054]

[0055] where f w,j is the word frequency of the feature word w in the topic type T j ; N is the total number of topic types; T k is the feature word set in the topic type T j .

[0056] In one possible implementation, the obtaining of the thinking chain examples of the target topic type includes: obtaining a plurality of power customer service problem samples; generating a thinking chain generation prompt template based on the plurality of power customer service problem samples according to a preset thinking chain generation prompt template, generating a plurality of thinking chain examples of each power customer service problem sample by a large model; classifying all thinking chain examples based on topic types to obtain thinking chain examples of each topic type, and obtaining the thinking chain examples of the target topic type according to the thinking chain examples of each topic type.

[0057] Explanatorily, the large model in the above steps can use the Guangming Power large model or other large models.

[0058] Explanatorily, a specific thinking chain generation prompt template is designed to stimulate the large model to automatically generate a plurality of thinking chain examples (thinking chain reasoning steps) of each power customer service problem sample through explicit instructions.

[0059] For example, the thought chain generation prompt template can be designed as: "Please explain your reasoning process and show the reason for each step." For a specific power customer service problem sample: "User: The power at home suddenly stopped, and after checking the electric meter, it was found that the electric meter screen had no display. What could be the reason?", under the instruction of the above thought chain generation prompt template, a thought chain example generated by the large model is: "First step: the electric meter screen may be damaged or caused by power failure; second step: check if the neighbor's power is off, if the neighbor's power is not off, the problem may be in the user's line or electric meter; third step: check if the electric meter switch (air switch) is tripped, if the air switch is tripped, the line may be short-circuited or overloaded; fourth step: if the air switch is not tripped and the electric meter still has no display, it may be caused by the electric meter being damaged or the line being disconnected."

[0060] Through the above method, the large model can automatically generate a large number of thought chain examples for different power customer service problems, thereby forming a rich thought chain example pool. Specifically, the thought chain generation method can be understood as a semi-automatic thought chain construction framework, which can effectively improve the construction efficiency of thought chain examples, and reduce the overall quality of the thought chain example pool while reducing labor costs.

[0061] In a possible implementation, the classifying all thought chain examples based on topic types comprises: adopting a topic modeling method based on bidirectional encoder representation to classify all thought chain examples based on topic types.

[0062] Explanatorily, the topic modeling method based on bidirectional encoder representation (BERTopic method) is adopted to model the topics of all thought chain examples. The BERTopic method is based on the Transformer embedding model and the density clustering algorithm, which can not only efficiently process long text, but also better preserve the semantic information of the text.

[0063] For example, the steps of modeling the topics of all thought chain examples using the BERTopic method are as follows:

[0064] Step 1: semantic embedding (Embedding). The text information of each thought chain example is converted into a semantic vector, i.e., an embedding vector, e i = Embedding(c i ), c i ∈ C; where e i is the embedding vector of the i-th thought chain example c i , and C is the set of thought chain examples.

[0065] Step 2: Dimensionality reduction (UMAP). The high-dimensional embedding vectors are reduced in dimension by the uniform manifold approximation and projection algorithm (UMAP) to improve the clustering effect: u i = UMAP(e i ), e i ∈ E; where u i is the reduced dimension vector of the i-th thought example c i 's embedding vector.

[0066] Step 3: Density clustering (HDBSCAN). The reduced dimension embedding vectors are subjected to density clustering to automatically determine the optimal number of clusters and achieve efficient partitioning of examples: {T1, T2,.., T k} = HDBSCAN({u1, u2,..., u n}); where T k is the k-th cluster after density clustering.

[0067] In one possible implementation, before classifying all thought examples based on topic type, it further includes: filtering thought examples by the following formula:

[0068] S pool = {c i | Sim(a i , t i ) ≥ θ, c i ∈ C}

[0069]

[0070] where S pool is the filtered thought example set; c i is the i-th thought example before filtering; Sim(a i , t i ) is the similarity between a i and t i ; θ is the similarity threshold; C is the thought example set before filtering; a i is the generated answer q i based on c i ; t i is the true answer of q i ; q i is the corresponding power customer service question sample of c i ; Embedding(*) represents the embedding vector.

[0071] Explanatorily, based on the thought examples generated by the large model, a pruning mechanism is introduced to remove thought examples with low quality. Define the automatically generated thought example set as C = {c1, c2,..., cn}, wherein each c i comprises one q i , one a i , and one t i .

[0072] If the generated answer matches the true answer, the thinking example is retained, otherwise the thinking example is discarded. The determination of matching uses a semantic similarity measure, that is, when the semantic similarity is not less than a preset similarity threshold, the thinking example is retained, otherwise the thinking example is discarded. Illustratively, the preset similarity threshold can be determined by pre-experiment, and in the present embodiment, it is set to 0.75 to ensure a reasonable balance between quality and quantity.

[0073] Illustratively, for the power customer service question sample: "What is the problem if the meter screen does not display?", one of the generated answers is: "It may be caused by power grid maintenance blackout, it is suggested to try to restore power supply later." The semantic similarity between the generated answer and the true answer "The meter screen does not display generally due to meter itself failure or line failure, and should contact the power company for maintenance." is less than the threshold 0.75, so the corresponding thinking example is pruned and deleted.

[0074] In one possible implementation, the thinking example pool can be dynamically updated. Specifically, as the power customer service question samples continue to accumulate, the thinking example pool can be updated regularly. The specific update strategy is as follows: 1. New power customer service question samples are regularly imported into the large model to generate thinking examples; 2. The newly generated thinking examples are subjected to the above pruning strategy; and 3. The qualified thinking examples are added to the current thinking example pool.

[0075] In one possible implementation, constructing the thinking chain graph of the target topic type according to the plurality of thinking examples includes: constructing the thinking chain graph of the target topic type according to the plurality of thinking examples, taking the reasoning steps in the thinking examples as nodes, and taking the connection relationship between the reasoning steps as edges; wherein, in the thinking chain graph, the consecutive reasoning steps in the same thinking example are connected, and for the reasoning steps in different thinking examples: when the similarity between the reasoning steps is not less than a preset semantic similarity threshold, the reasoning steps are connected; otherwise, the reasoning steps are not connected.

[0076] Illustratively, in the processing of complex reasoning tasks in the power customer service field, a single thinking chain is difficult to effectively cover diversified reasoning paths, and a multi-thinking chain fusion strategy based on a graph attention network (GAT) is adopted to integrate the information of multiple thinking examples through the construction of an implicit graph structure and the adaptive attention mechanism.

[0077] For the input power customer service question q, a plurality of high-quality thinking examples are obtained through the above steps, which are defined as a set: C q={c (1) ,c (2) ,...,c (N)}. Where each c (i) This represents a complete reasoning chain corresponding to the i-th thought chain example. The reasoning chain consists of several reasoning steps:

[0078] To capture the relationships between multiple thought chain examples, these multiple reasoning chain examples are constructed as an implicit graph structure G = (V, E), where nodes v ∈ V represent the reasoning steps of each thought chain. Right now: Edge e∈E represents the association between different nodes. Its initial connection strategy is: 1. Full connection between consecutive reasoning steps within the same thought chain example; 2. Connection between similar reasoning steps of different thought chain examples (the similar reasoning steps are determined based on the semantic similarity between the reasoning steps).

[0079] For example, the initial feature representation of each node Using Sentence-BERT embedding vector e v :

[0080]

[0081] When acquiring the integrated thought chains and comprehensive representations of each thought chain for a target topic type through a pre-trained graph attention network, GAT updates the node representation by learning the attention weights between nodes to aggregate information from neighboring nodes. The attention coefficient between node v and its neighbor node u∈N(v) is defined as:

[0082]

[0083] in, It is the characteristic transformation matrix; It is the attention parameter vector; || represents feature concatenation.

[0084] Update the representation of node v based on the attention coefficient:

[0085]

[0086] Where σ(*) is the activation function, usually the ReLU activation function.

[0087] After the L-layer GAT update, the node representation contains rich contextual information. Each thought chain example is transformed into a fused thought chain, and then the final semantic representation of each node is obtained through a linear layer.

[0088]

[0089] wherein W and b are the parameter matrix and bias term of the linear layer respectively.

[0090] The final node representation of each fusion thought chain is aggregated to obtain the comprehensive representation of each fusion thought chain:

[0091]

[0092] Then, based on the embedding vector q of the power customer service question, the similarity scores of the power customer service question and the comprehensive representations of the fusion thought chains are calculated in combination with the comprehensive representations of the fusion thought chains:

[0093]

[0094] wherein score i is the similarity score of the power customer service question and the comprehensive representation of the i-th fusion thought chain.

[0095] Finally, the fusion reasoning chain with the highest similarity score is selected as the large model prompt thought chain output of the power customer service question facing the power customer service:

[0096]

[0097] wherein c * is the fusion reasoning chain with the highest similarity score.

[0098] In one possible implementation, before constructing the thought chain graph of the target topic type according to the thought chain examples, the method further includes adopting a maximum marginal correlation method to perform cyclic screening of the thought chain examples of the target topic type by the following formula, until the screened thought chain examples reach a specified number or reach a maximum similarity limit, and the screened thought chain examples are used as the thought chain examples for constructing the thought chain graph of the target topic type:

[0099]

[0100] wherein d i is the embedding vector of the i-th thought chain example of the target topic type; T j is the target topic type; S is the set of screened thought chain examples; Sim(q, d i ) is the similarity of d i and q; Sim(d i , d k ) is the similarity of d i and d k ; λ is a balance parameter; q is the embedding vector of the power customer service question; d k is the k-th screened thought chain example.

[0101] Explanatorily, in order to further improve the diversity and representativeness of the enhanced thinking example selection, a method based on maximum marginal relevance (MMR) is designed for the selection of thinking examples. The specific process is as follows:

[0102] The embedding vector of the power customer service question is defined as q, and the target topic type T j The embedding vector of each thinking example is d i The selection formula of the MMR method is as follows:

[0103]

[0104] Wherein, λ is used to balance the relevance to the question and the diversity between examples, and is usually set to 0.7.

[0105] The MMR method first matches the power customer service question to the corresponding target topic type, and then in the target topic type, the thinking examples are selected in a loop using the above formula until the specified number of selected examples is reached or the maximum similarity limit (i.e. the similarity between the embedding vector of the currently selected thinking example and the embedding vector of the power customer service question is less than the preset limit) is reached.

[0106] The following is an embodiment of the device of the present application, which can be used to execute the method embodiment of the present application. For details not disclosed in the device embodiment, please refer to the method embodiment of the present application.

[0107] Referring to Figure 2 In another embodiment of the present application, a large model prompt thinking chain construction system for power customer service is provided, which can be used to implement the large model prompt thinking chain construction method for power customer service described above. Specifically, the large model prompt thinking chain construction system for power customer service includes a type determination module, a comprehensive representation module and a selection module.

[0108] The type determination module is used to obtain the power customer service question and determine the target topic type according to the power customer service question; the comprehensive representation module is used to obtain the comprehensive representation of each fusion thinking chain of the target topic type; the selection module is used to obtain the fusion thinking chain corresponding to the comprehensive representation with the highest similarity to the power customer service question in the comprehensive representation of each fusion thinking chain, as the large model prompt thinking chain for power customer service of the power customer service question; wherein, the comprehensive representation of each fusion thinking chain of the target topic type is constructed by the following way: obtaining a plurality of thinking examples of the target topic type and constructing a thinking chain graph of the target topic type according to the plurality of thinking examples, and obtaining each fusion thinking chain and the comprehensive representation of each fusion thinking chain of the target topic type through the pre-trained graph attention network according to the thinking chain graph of the target topic type.

[0109] In a possible implementation, the determining the target topic type according to the power customer service problem comprises: obtaining a preset topic type whose representation vector is most similar to the power customer service problem as the target topic type determined by the power customer service problem.

[0110] In a possible implementation, the representation vector of the topic type is obtained by: counting the word frequency of each feature word of each thinking chain example of the topic type; calculating the c-TF-IDF weight of each feature word according to the word frequency of each feature word using a category-based term frequency-inverse document frequency c-TF-IDF algorithm; and selecting the first preset number of feature words in descending order of the c-TF-IDF weight as the representation vector of the topic type.

[0111] In a possible implementation, the obtaining of the thinking chain examples of the target topic type comprises: obtaining a plurality of power customer service problem samples; generating a plurality of thinking chain examples of each power customer service problem sample by a large model based on a preset thinking chain generation prompt template according to the plurality of power customer service problem samples; classifying all the thinking chain examples based on the topic type to obtain the thinking chain examples of each topic type, and obtaining the thinking chain examples of the target topic type according to the thinking chain examples of each topic type.

[0112] In a possible implementation, the classifying all the thinking chain examples based on the topic type comprises: classifying all the thinking chain examples based on the topic type by using a topic modeling method based on bidirectional encoder representation.

[0113] In a possible implementation, before the classifying all the thinking chain examples based on the topic type, the method further comprises: screening the thinking chain examples by:

[0114] S pool ={c i |Sim(a i ,t i )≥θ,c i ∈C}

[0115]

[0116] wherein, S pool is the screened thinking chain example set; c i is the i th thinking chain example before screening; Sim(a i ,t i ) is the similarity between a i and t i ; θ is the similarity threshold; C is the thinking chain example set before screening; a i is the representation vector of the topic type based on c iq generated from the large-scale power customer service model i The generated answer; t i For q i The real answer; q i For c i The corresponding power customer service question sample; Embedding(*) represents the embedding vector.

[0117] In one possible implementation, constructing a mind chain graph for the target topic type based on several mind chain examples includes: constructing a mind chain graph for the target topic type based on several mind chain examples, with reasoning steps within the mind chain examples as nodes and connections between reasoning steps as edges; wherein, consecutive reasoning steps within the same mind chain example are connected in the mind chain graph, and for reasoning steps within different mind chain examples: when the similarity between reasoning steps is not less than a preset semantic similarity threshold, the reasoning steps are connected; otherwise, the reasoning steps are not connected.

[0118] In one possible implementation, before constructing the mind chain diagram of the target topic type based on several mind chain examples, the method further includes using a maximum marginal relevance approach to iteratively filter several mind chain examples of the target topic type using the following formula, until the number of filtered mind chain examples reaches a specified number or the maximum similarity limit is reached, and the filtered mind chain examples are used as the mind chain examples for constructing the mind chain diagram of the target topic type:

[0119]

[0120] Where, d i T is the embedding vector of the i-th thought chain example of the target topic type; j S represents the target topic type; S represents the set of selected thought chain examples; Sim(q,d) i ) is d i Similarity to q; Sim(d) i ,d k ) is d i With d k The similarity; λ is the balance parameter; q is the embedding vector of the electricity customer service question; d k This is the kth example of the thought chain selected.

[0121] All relevant content of each step involved in the aforementioned embodiment of the large model prompting mind chain construction method for power customer service can be referenced to the functional description of the corresponding functional module of the large model prompting mind chain construction system for power customer service in the embodiment of the present invention, and will not be repeated here.

[0122] The division of the modules in the embodiments of the present application is illustrative, and is merely logical function division. In actual implementation, another division manner can be used. In addition, each function module in each embodiment of the present application can be integrated in one processor, or can be physically separated, or two or more modules can be integrated in one module. The integrated module can be realized in the form of hardware or in the form of a software function module.

[0123] In still another embodiment of the present application, a computer device is provided, which includes a processor and a memory. The memory is configured to store a computer program, and the computer program includes program instructions. The processor is configured to execute the program instructions stored in the computer storage medium. The processor can be a central processing unit (CPU), and can also be another general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or another programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and the like. The processor is a computing core and a control core of the terminal, and is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions in the computer storage medium to implement a corresponding method flow or a corresponding function. The processor in the embodiments of the present application can be used for the operation of the large model prompt thinking chain construction method for power customer service.

[0124] In still another embodiment of the present application, the present application further provides a storage medium, specifically a computer readable storage medium (Memory), which is a memory device in a computer device, used for storing programs and data. It can be understood that the computer readable storage medium herein can include an internal storage medium in the computer device, and of course can also include an extended storage medium supported by the computer device. The computer readable storage medium provides a storage space, which stores an operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and the instructions can be one or more computer programs (including program codes). It should be noted that the computer readable storage medium herein can be a high-speed RAM memory, or a non-volatile memory such as at least one disk memory. The one or more instructions stored in the computer readable storage medium can be loaded and executed by the processor to implement the corresponding steps of the power customer service-oriented large model prompt thinking chain construction method in the above embodiment.

[0125] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.

[0126] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device that implements the flowcharts and / or block diagrams. Figure 1 The function specified in one or more flows and / or blocks Figure 1 The means for performing the function specified in one or more flows and / or blocks.

[0127] These computer program instructions can also be stored in a computer readable storage medium capable of directing the computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable storage medium produce a product including instruction means, which implements the flowcharts and / or block diagrams. Figure 1 The function specified in one or more flows and / or blocksFigure 1 the function specified in the one or more blocks.

[0128] These computer program instructions can also be loaded into computer or other programmable data processing devices, so that a series of operation steps are performed on the computer or other programmable data processing devices to generate computer-implemented processing, so that the instructions executed on the computer or other programmable data processing devices provide a process for implementing the flow Figure 1 the flow or flows and / or blocks Figure 1 the steps of the function specified in the one or more blocks.

[0129] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, but not to limit it, although the above embodiments of the present application have been described in detail, those skilled in the art should understand: the specific embodiments of the present application can be modified or replaced by the same, without departing from the spirit and scope of the present application, any modification or equivalent replacement, which should be covered within the scope of protection of the claims of the present application.

Claims

1. A large model prompt thinking chain construction method for power customer service, characterized in that, The method comprises the following steps: acquiring a power customer service question and determining a target topic type according to the power customer service question; acquiring comprehensive representations of each fusion thinking chain of the target topic type; acquiring a fusion thinking chain corresponding to the comprehensive representation with the highest similarity to the power customer service question in the comprehensive representations of each fusion thinking chain as a large model prompt thinking chain of the power customer service question facing the power customer service; wherein the comprehensive representations of each fusion thinking chain of the target topic type are constructed in the following manner: acquiring a plurality of thinking example of the target topic type and constructing a thinking chain graph of the target topic type according to the plurality of thinking example, and acquiring each fusion thinking chain of the target topic type and the comprehensive representation of each fusion thinking chain through a pre-trained graph attention network according to the thinking chain graph of the target topic type.

2. The power customer service oriented large model prompt thinking chain construction method according to claim 1, characterized in that, The determination of the target topic type according to the power customer service question comprises: acquiring a topic type with the highest similarity to the representation vector of the topic type in the preset each topic type as the target topic type determined according to the power customer service question.

3. The power customer service oriented large model prompt thinking chain construction method according to claim 2, characterized in that, The representation vector of the topic type is obtained in the following manner: statistically acquiring the word frequency of each feature word of each thinking example of the topic type; calculating the c-TF-IDF weight of each feature word using the category-based term frequency-inverse document frequency c-TF-IDF algorithm according to the word frequency of each feature word; and selecting the top preset number of feature words in the descending order of the c-TF-IDF weight as the representation vector of the topic type.

4. The power customer service oriented large model prompt thinking chain construction method according to claim 1, characterized in that, The acquisition of the plurality of thinking example of the target topic type comprises: acquiring a plurality of power customer service question samples; generating a plurality of thinking example of each power customer service question sample through a large model based on a preset thinking chain generation prompt template according to the plurality of power customer service question samples; classifying all thinking examples based on topic types to obtain thinking examples of each topic type, and obtaining a plurality of thinking example of the target topic type according to the thinking examples of each topic type.

5. The power customer service oriented large model prompt thinking chain construction method according to claim 4, characterized in that, The classification of all thinking examples based on topic types comprises: classifying all thinking examples based on topic types using a topic modeling method based on bidirectional encoder representation.

6. The power customer service oriented large model prompt thinking chain construction method according to claim 4, characterized in that, Before classifying all thinking examples based on topic types, the method further comprises: screening the thinking example in the following manner: S pool = {c i | Sim(a i , t i ) ≥ θ,c i ∈ C} wherein S pool is the set of screened thought examples; c i is the ith thought example before screening; Sim(a i , t i ) is the similarity between a i and t i ; θ is the similarity threshold; C is the set of thought examples before screening; a i is the generated answer of q i based on c i ; t i is the true answer of q i ; q i is the corresponding power customer service question sample of c i ; Embedding(*) represents an embedding vector.

7. The power customer service oriented large model prompt thinking chain construction method according to claim 1, characterized in that, The construction of the thinking chain graph of the target topic type according to the plurality of thinking example comprises: constructing a thinking chain graph of the target topic type according to the plurality of thinking example, taking the reasoning steps in the thinking example as nodes and the connection relationship between the reasoning steps as edges; wherein the continuous reasoning steps in the same thinking example in the thinking chain graph are connected, and for the reasoning steps in different thinking examples: when the similarity between the reasoning steps is not less than a preset semantic similarity threshold, the reasoning steps are connected; otherwise, the reasoning steps are not connected.

8. The power customer service oriented large model prompt thinking chain construction method according to claim 1, characterized in that, Before constructing the thinking chain graph of the target topic type according to the plurality of thinking example, the method further comprises: The maximum marginal correlation method is adopted, and the target topic type is screened through the following formula: wherein d i is an embedding vector of the i-th thinking model example of the target topic type; T j is the target topic type; S is the set of filtered thinking model examples; Sim(q, d i ) is the similarity of d i and q; Sim(d i , d k ) is the similarity of d i and d k ; λ is a balance parameter; q is an embedding vector of the power customer service question; d k is the k-th filtered thinking model example.

9. A large model prompt thinking chain construction system for power customer service, characterized by, Comprises: The type determination module is used for obtaining the power customer service problem, and determining the target topic type according to the power customer service problem; The comprehensive representation module is used for obtaining the comprehensive representation of each fusion thinking chain of the target topic type; The selection module is used for obtaining the fusion thinking chain corresponding to the comprehensive representation with the highest similarity to the power customer service problem in the comprehensive representation of each fusion thinking chain, as the power customer service-oriented large model prompt thinking chain of the power customer service problem; Wherein, the comprehensive representation of each fusion thinking chain of the target topic type is constructed by the following way: Obtain several thinking examples of the target topic type and construct a thinking chain graph of the target topic type according to the several thinking examples, and obtain each fusion thinking chain and the comprehensive representation of each fusion thinking chain of the target topic type through the pre-trained graph attention network according to the thinking chain graph of the target topic type.

10. The power customer service oriented large model prompt thinking chain construction system according to claim 9, wherein, The target topic type is determined according to the power customer service problem, which comprises: Obtain the representation vector of the topic type in the preset each topic type with the highest similarity to the power customer service problem, as the target topic type determined by the power customer service problem.

11. The power customer service oriented large model prompt thinking chain construction system according to claim 10, wherein, The representation vector of the topic type is obtained by the following way: Statistical feature words of each thinking example of the topic type; According to the word frequency of each feature word, the c-TF-IDF weight of each feature word is calculated by using the c-TF-IDF algorithm based on the category, and the first preset number of feature words in the descending order of c-TF-IDF weight are selected as the representation vector of the topic type.

12. The power customer service oriented large model prompt thinking chain construction system according to claim 9, wherein, The several thinking examples of the target topic type are obtained, which comprises: Obtain several power customer service problem samples; According to the several power customer service problem samples, a thinking chain generation prompt template is generated based on the preset, and several thinking examples of each power customer service problem sample are generated by a large model; All thinking examples are classified based on topic type to obtain thinking examples of each topic type, and several thinking examples of the target topic type are obtained according to the thinking examples of each topic type.

13. The power customer service oriented large model prompt thinking chain construction system according to claim 12, characterized in that, The all thinking examples are classified based on topic type, which comprises: All thinking examples are classified based on topic type by using the topic modeling method based on bidirectional encoder representation.

14. The power customer service oriented large model prompt thinking chain construction system according to claim 12, wherein, Before the all thinking examples are classified based on topic type, it further comprises: The thinking examples are screened by the following formula: S pool = {c i | Sim(a i , t i ) ≥ θ,c i ∈ C} Among them, S pool This is a collection of filtered examples of thought chains; c i This is the i-th thought chain example before filtering; Sim(a i ,t i ) is a i and t i The similarity is θ; the similarity threshold is θ; C is the set of thought chain examples before filtering; a i For C-based i q generated from the large-scale power customer service model i The generated answer; t i For q i The real answer; q i For c i The corresponding power customer service question sample; Embedding(*) represents the embedding vector.

15. The power customer service oriented large model prompt thinking chain construction system according to claim 9, characterized in that, The thinking chain graph of the target topic type is constructed according to the several thinking examples, which comprises: According to the several thinking examples, the reasoning steps in the thinking examples are taken as nodes, and the connection relationship between the reasoning steps is taken as edges, to construct the thinking chain graph of the target topic type; The continuous reasoning steps in the same thought chain diagram example are connected, and for the reasoning steps in different thought chain diagram examples: when the similarity between the reasoning steps is not less than a preset semantic similarity threshold, the reasoning steps are connected; otherwise, the reasoning steps are not connected.

16. The power customer service oriented large model prompt thinking chain construction system of claim 9, wherein, Before constructing the thought chain diagram of the target topic type according to the thought chain diagram examples, the method further includes: The maximum marginal correlation method is adopted to perform the cycle screening of the thought chain diagram examples of the target topic type through the following formula until the screened thought chain diagram examples reach a specified number or a maximum similarity limit, and the screened thought chain diagram examples are used as the thought chain diagram examples for constructing the thought chain diagram of the target topic type: wherein d i is an embedding vector of the i-th thinking model example of the target topic type; T j is the target topic type; S is the set of filtered thinking model examples; Sim(q,d i ) is the similarity of d i and q; Sim(d i ,d k ) is the similarity of d i and d k ; λ is a balance parameter; q is an embedding vector of the power customer service question; d k is the k-th filtered thinking model example.

17. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the large model prompt thought chain construction method for power customer service according to any one of claims 1 to 8.

18. A computer-readable storage medium, the computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the large model prompt thought chain construction method for power customer service according to any one of claims 1 to 8.

Citation Information

Cited By

  • Method for managing a knowledge base, method and device for model reasoning based on a knowledge base

    CN122470642A