Method for determining answer corresponding to question of bank customer and related device
By fine-tuning the DPR model and relational graph convolutional network to enhance the contextual understanding of bank customer questions, and combining it with a hybrid multi-decoder to generate answers, the problem of insufficient answer accuracy in intelligent customer service systems is solved, and more accurate and diverse responses are achieved.
Patent Information
- Application Number
- CN202510892348.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-09-26
AI Technical Summary
Existing bank intelligent customer service systems suffer from insufficient answer accuracy in complex business consultations involving multiple rounds of interactions, especially mechanical responses caused by incoherent understanding of the context.
A fine-tuned DPR model is used in combination with an encoder to generate the initial answer vector. The feature vectors of keywords and related keywords are extracted through a relational graph convolutional network. The knowledge graph is used to enhance the context embedding. The final answer is generated in combination with a hybrid multi-decoder, taking into account the distribution and diversity of emotions.
It improves the accuracy and flexibility of answers to bank customers' questions, provides responses with a wider range of background information and emotional color, and improves the service quality of the intelligent customer service system.
Smart Images

Figure CN120705272A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of bank customer service, and in particular to a method for determining answers to bank customers' questions and related devices. Background Art
[0002] With the rapid development of my country's financial sector, banking business models have also undergone profound changes, with increasingly diversified service content and forms. Against this backdrop, to meet this growing and diverse customer service demand, and particularly with the breakthroughs and widespread application of natural language processing technology, major banks have been integrating intelligent customer service systems into their online service platforms. These systems automatically determine the appropriate answers to bank customers' questions, aiming to improve service efficiency and coverage.
[0003] At present, most of them use template-based or retrieval-generated answer methods to determine the corresponding answers to bank customers' questions and provide them with banking business consultation solutions.
[0004] However, using fixed phrases to respond to bank users, and in complex business consultation sessions involving multiple rounds of interaction, can easily lead to incoherent understanding of the context and mechanical responses to questions, resulting in inaccurate answers to certain bank customers' questions. Summary of the Invention
[0005] In view of the above problems, this application provides a method and related device for determining the corresponding answers to bank customers' questions, in order to improve the accuracy of the answers to bank customers' questions. The specific solution is as follows:
[0006] A first aspect of the present application provides a method for determining an answer to a question of a bank customer, comprising:
[0007] Obtaining a question text input by a bank customer and a question context corresponding to the question text;
[0008] Input the question text into a pre-trained fine-tuned DPR model to obtain an initial answer text for the question text, and use an encoder to encode the initial answer text for the question text to generate an initial answer vector for the question text;
[0009] Adding a tag to the question context, and generating an initial embedding vector of the marked question context based on the marked question context;
[0010] Extracting keywords from the marked question context, and retrieving target-related keywords that have a positive relationship with the keywords from a pre-built concept dictionary;
[0011] Obtaining initial feature vectors of the keyword and the target-associated keyword, as well as the relationship between the keyword and the target-associated keyword, and performing a convolution operation on the initial feature vectors of the keyword and the target-associated keyword using a relational graph convolutional network based on the relationship between the keyword and the target-associated keyword to obtain a target feature vector;
[0012] Determining a target embedding vector for the labeled question context based on the target feature vector and the initial embedding vector for the labeled question context;
[0013] Based on the initial answer vector of the question text and the target embedding vector of the labeled question context, learning a target answer vector for the question text from the sentiment distribution;
[0014] Training data is obtained using the target answer vector of the question text and the final answer to the question text, and a pre-constructed hybrid multi-decoder is trained using the training data to obtain a trained hybrid multi-decoder, wherein the input of the pre-constructed hybrid multi-decoding system is the target answer vector of the question text, and the output of the pre-constructed hybrid multi-decoding system is the final answer to the question text.
[0015] In one possible implementation, the training process of fine-tuning the DPR model includes:
[0016] Obtaining a plurality of training samples with annotated information, wherein the annotated information includes an initial answer text to a historical question text, and each of the training samples includes the historical question text;
[0017] The initial DPR model is trained based on the multiple training samples to obtain the fine-tuning DPR model, the input of the fine-tuning DPR model is the question text, and the output of the fine-tuning DPR model is the initial answer text of the question text.
[0018] In a possible implementation, generating an initial embedding vector of the marked question context based on the marked question context includes:
[0019] Use AILab_Embedding to map the labeled question context to obtain the word embedding vector, position embedding vector, and dialogue state embedding vector of the labeled question context;
[0020] Calculating a high-dimensional embedding vector of the marked question context based on the word embedding vector, the position embedding vector, and the dialogue state embedding vector of the marked question context;
[0021] A Transformer Encoder is used to encode the high-dimensional embedding vector of the labeled question context to generate an initial embedding vector of the labeled question context.
[0022] In a possible implementation, the process of constructing the concept dictionary includes:
[0023] For each concept word in the preset corpus, retrieve related concept words that have a positive relationship with the concept word from the ConceptNet knowledge base;
[0024] Performing embedding representations on the concept words and the associated concept words respectively to obtain the embedding representations of the concept words and the embedding representations of the associated concept words;
[0025] Retrieving the three-dimensional vector representation corresponding to the concept word and the three-dimensional vector representation corresponding to the associated concept word from the NRC_VAD sentiment dictionary;
[0026] Based on the embedding representation of the concept words, the embedding representation of the associated concept words, the three-dimensional vector representation corresponding to the concept words, and the three-dimensional vector representation corresponding to the associated concept words, the cosine similarity, sentiment distance, and sentiment intensity score between the concept words and the associated concept words are calculated;
[0027] The concept dictionary is constructed based on the cosine similarity, the sentiment distance, and the sentiment intensity score between the concept word and the associated concept word.
[0028] In a possible implementation, retrieving target-related keywords that have a positive relationship with the keywords from a pre-built concept dictionary includes:
[0029] Retrieving related keywords that have a positive relationship with the keyword from a pre-built concept dictionary;
[0030] For each of the associated keywords, obtaining a sentiment intensity score between the keyword and the associated keyword, and determining whether the sentiment intensity score between the keyword and the associated keyword is not less than a preset threshold;
[0031] If the sentiment intensity score between the keyword and the associated keyword is not less than the preset threshold, the associated keyword is determined as the target associated keyword.
[0032] In a possible implementation, the method of performing a convolution operation on the initial feature vectors of the keyword and the target-related keyword using a relational graph convolutional network based on the relationship between the keyword and the target-related keyword to obtain a target feature vector includes:
[0033] Determining the keyword and the target-related keyword as knowledge graph nodes, and determining the relationship between the keyword and the target-related keyword as a knowledge graph edge;
[0034] For each of the knowledge graph nodes, using the knowledge graph edge corresponding to the knowledge graph node, perform a first-stage convolution operation on the initial feature vector of the knowledge graph node to obtain a local feature vector of the knowledge graph node;
[0035] Using the neighboring knowledge graph nodes corresponding to the knowledge graph node, a second-stage convolution operation is performed on the local feature vector of the knowledge graph node to obtain a node feature vector of the knowledge graph node;
[0036] The target feature vector is calculated based on the local feature vector of each knowledge graph node and the node feature vector of each knowledge graph node.
[0037] In one possible implementation, determining a target embedding vector of the marked question context based on the target feature vector and the initial embedding vector of the marked question context includes:
[0038] Based on the target feature vector, calculating the initial feature vector of each knowledge graph edge;
[0039] Calculating the total number of knowledge graph relationships based on the initial feature vector of each knowledge graph edge and the initial embedding vector of the labeled question context;
[0040] A target embedding vector of the labeled question context is calculated based on the total number of knowledge graph relations and the initial embedding vector of the labeled question context.
[0041] In one possible implementation, learning a target answer vector for the question text from a sentiment distribution based on the initial answer vector for the question text and the target embedding vector for the labeled question context includes:
[0042] Encoding the initial answer vector of the question text and the target embedding vector of the marked question context respectively to obtain a candidate answer vector of the question text;
[0043] Based on the candidate answer vectors of the question text, obtaining the sentiment answer vector of the question text using sentiment distribution;
[0044] Based on the sentiment answer vector of the question text, a target answer vector of the question text is obtained by learning from the sentiment distribution.
[0045] A second aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0046] The memory is used to store computer programs;
[0047] The processor is used to execute the computer program so that the electronic device can implement the method for determining the corresponding answer to the bank customer's question in the above-mentioned first aspect or any implementation method of the first aspect.
[0048] A third aspect of the present application provides a computer storage medium carrying one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can determine the corresponding answers to questions of bank customers according to the first aspect or any implementation of the first aspect.
[0049] Based on the above technical solution, this application provides a method and related apparatus for determining the corresponding answer to a bank customer's question. The method comprises: first, obtaining a question text entered by the bank customer and the corresponding question context, thereby facilitating understanding of the question text's context. An initial answer text is then obtained by fine-tuning a Descriptive Processing (DPR) model, which is then encoded using an encoder to generate an initial answer vector, enabling a deeper understanding of the question text at a semantic level. The question context is then labeled and an initial embedding vector is generated. Keywords and their target-related keywords are extracted, and a target feature vector is obtained using a relational graph convolutional network. Finally, a target embedding vector is determined. This leverages structured knowledge within the knowledge graph, providing broader context and deeper knowledge support for the answer. A target answer vector for the question text is then learned from a sentiment distribution based on the target feature vector, the labeled initial embedding vector of the question context, and the initial answer vector of the question text, facilitating the generation of emotionally charged answers. Finally, a hybrid multi-decoder system is trained using the target answer vector and training data to generate the final answer to the question text. By learning different decoding strategies, the flexibility and diversity of responses are enhanced, improving the accuracy of the answers determined for the bank customer's questions. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
[0051] Figure 1 A flowchart of a method for determining answers to bank customer questions provided in an embodiment of the present application;
[0052] Figure 2A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The following describes the embodiments of the present application in conjunction with the accompanying drawings. The terms used in the implementation methods of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application.
[0054] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0055] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0056] In order to improve the accuracy of the answers to bank customers' questions, the present application provides a method for determining the answers to bank customers' questions. The method for determining the answers to bank customers' questions provided by the present application is further described in detail below in combination with the accompanying drawings and specific implementation methods.
[0057] Please see the attached Figure 1 , Figure 1 This is a flow chart of a method for determining the corresponding answer to a bank customer's question provided in an embodiment of the present application. The method may include the following steps:
[0058] Step S101: Obtain the question text input by the bank customer and the question context corresponding to the question text.
[0059] It's important to note that question text is the natural language text entered by bank customers through interactive channels, used to express specific questions or requests, such as "When is my credit card payment due?" and "Can I use the mobile banking transfer function?" Question context is additional information surrounding the question text, supplementing the question context, customer identity, or past interactions to help more accurately understand the question. For example, previous conversations between the customer and the bank can be included.
[0060] In this application, customers can input question text through the bank's online customer service system, mobile banking APP, official website and other channels. In addition to text input, customers can also ask questions through voice. When customers ask questions through telephone customer service or voice assistants, the microphone can be used to collect the customer's voice signal, and the collected voice signal is processed by noise reduction, dereverberation, etc. to improve the voice quality. Key features are extracted from the processed voice signal. These features are the input of the speech recognition model. The extracted features are input into the pre-trained speech recognition model (such as a model based on a deep neural network DNN or Transformer), and the model outputs the corresponding text content. Regardless of the channel through which the customer inputs the question (text or voice), it will eventually be converted into a unified text form to obtain the question text entered by the bank customer. , and the question context corresponding to the question text , the question context corresponding to the question text shared by It consists of rounds of dialogue.
[0061] Step S102: Input the question text into the pre-trained fine-tuned DPR model to obtain the initial answer text of the question text, and use the encoder to encode the initial answer text of the question text to generate the initial answer vector of the question text.
[0062] It's important to note that the DPR (Dense Passage Retrieval) model is a deep learning model used for information retrieval. It can quickly and accurately find relevant answers to questions from large amounts of text. In this step, a fine-tuned DPR model is used to better adapt it to the characteristics of bank customers' questions, thereby more accurately generating initial answer text.
[0063] The training process of the fine-tuning DPR model may include obtaining multiple training samples with labeled information, wherein the labeled information includes an initial answer text to a historical question text, and each training sample includes the historical question text. The initial DPR model is trained based on the multiple training samples to obtain a fine-tuning DPR model, wherein the input of the fine-tuning DPR model is the question text, and the output of the fine-tuning DPR model is the initial answer text to the question text.
[0064] Specifically, the multiple training samples with labeled information come from two sources: one is the university's open-source ESConv dataset, which contains more than 1,000 rounds of dialogue and is annotated with information such as the speaker's emotion category and intensity. This dataset is used to train empathy-related objectives; the second is the Chinese Financial Question and Answer Dataset, which consists of more than 10,000 financial question-answer pairs, covering relevant knowledge in multiple fields such as banking, securities, and insurance; the third part comes from internal customer conversation data of banks. This dataset collects frequently asked questions and provides corresponding standard answers to construct an intelligent customer service question-and-answer dataset on banking expertise. The latter two datasets are mainly used to train objectives related to retrieval tasks.
[0065] The encoder can be constructed using two independent bert_base_chinese pre-trained models. Fine-tuning samples are constructed using the CCKS2020 financial question-answering data. Each fine-tuning training sample consists of an input text, a gold answer, and a randomly selected negative sample. Following the principle of contrastive learning, the model is trained by optimizing the following loss function: maximizing the similarity between the input and the gold answer, while minimizing the similarity between the input and the negative sample:
[0066]
[0067] in, represents the question text, represents the golden answer to the question text, represents the negative sample answer of the question text, Represents the dot product similarity between the two.
[0068] For the question text entered by the bank customer, the fine-tuned DPR model is used to retrieve the question with the highest correlation with the input text in the bank professional knowledge question-answering dataset, and the answer corresponding to the question is used as the candidate answer. , then respond to the candidate answer Encoding, the encoder uses a standard Transformer Encoder to obtain the final representation of the example retrieval link, that is, the initial answer text of the question text .
[0069] Step S103: Add a tag to the question context, and generate an initial embedding vector of the marked question context based on the marked question context.
[0070] In this application, AILab_Embedding can be used to map the labeled question context to obtain the word embedding vector, position embedding vector, and dialogue state embedding vector of the labeled question context. Based on the word embedding vector, position embedding vector, and dialogue state embedding vector of the labeled question context, a high-dimensional embedding vector of the labeled question context is calculated. The high-dimensional embedding vector of the labeled question context is encoded using the Transformer Encoder encoder to generate the initial embedding vector of the labeled question context.
[0071] Specifically, the problem context shared by Round of dialogue, the Round dialogue expansion and adding special markers , and then the labeled question context is expressed as: .in is the question context No. Round of dialogue With the help of the open source AILab_Embedding Chinese vector table, Each token in the word is mapped to a high-dimensional numerical representation. The encoding methods include word embedding, position embedding, and dialogue state embedding. Word embedding uses a high-dimensional numerical vector to distinguish the semantic information of different words; position embedding is used to identify the position of words in the sentence; and dialogue state embedding is used to identify the order in which the dialogue clauses occur. The three are added together to obtain the labeled question context. High-dimensional embedding representation of :
[0072]
[0073] in, word embedding vectors representing the context of the question after tokenization, The position embedding vector representing the context of the question after labeling, The dialogue state embedding vector representing the labeled question context, , Context for the question after tagging The total number of words in Context for the question after tagging The word embedding dimension in .
[0074] The question context after the mark High-dimensional embedding representation of Send it to the Transformer encoder to get the initial embedding vector of the labeled question context .
[0075] Step S104: extracting keywords from the marked question context, and retrieving target-related keywords that have a positive relationship with the keywords from a pre-built concept dictionary.
[0076] Since the amount of information contained in the question text and question context is limited, directly generating the corresponding answer based solely on the question text and question context may not accurately understand the intent of the question text entered by the bank customer. Therefore, a concept dictionary can be introduced to better understand the semantic information of the question text entered by the bank customer.
[0077] The process of constructing a concept dictionary may include: for each concept word in the preset corpus, retrieving related concept words that have a positive relationship with the concept word from the ConceptNet knowledge base. Embedding the concept words and the related concept words respectively to obtain the embedding representation of the concept words and the embedding representation of the related concept words. Retrieving the three-dimensional vector representation corresponding to the concept words and the three-dimensional vector representation corresponding to the related concept words from the NRC_VAD sentiment dictionary. Based on the embedding representation of the concept words, the embedding representation of the related concept words, the three-dimensional vector representation corresponding to the concept words and the three-dimensional vector representation corresponding to the related concept words, the cosine similarity, sentiment distance and sentiment intensity score between the concept words and the related concept words are calculated. Based on the cosine similarity, sentiment distance and sentiment intensity score between the concept words and the related concept words, a concept dictionary is constructed.
[0078] Specifically, we first introduce the ConceptNet knowledge base and the NRC_VAD sentiment dictionary. For each word that appears in the preset corpus, we search all the concepts that have a positive relationship with it in the ConceptNet knowledge base. Each pair of concepts is represented by a tuple. To express it. Represents each concept word in the vocabulary built based on the corpus, Represents Related concept words with positive relationships, Represents the relationship between a concept word and its associated concept words. The relationship in ConceptNet includes two types: positive relationship and negative relationship. Positive relationship indicates a positive association between two words, while negative relationship mostly indicates an antonym relationship between two words, such as Antonym. Such relationships need to be removed from the semantic network, and only positive relationships are retained. and related concept words Perform high-dimensional embedding representation of Glove respectively, and look up the corresponding three-dimensional vector representation in the NRC_VAD sentiment dictionary:
[0079]
[0080]
[0081] Then we can calculate the concept words Glove high-dimensional embedding representation and related concept words The cosine similarity between the Glove high-dimensional embedding representations , emotional distance and emotional intensity scores :
[0082]
[0083]
[0084]
[0085] in, The Valence representation of word x is: represents the Arousal representation of the word x. Both are specific values, for example, =0.93, =0.442
[0086] Then the concept words , related concept words , cosine similarity , emotional distance , and the sentiment intensity score Stored together in the concept dictionary ConceptDict, each item in the dictionary is represented as a set: .in, Expressive words and related concepts The correspondence between them. Where k=1,2,3...sum(concept) represents the sum of words The number of related external concepts. Indicates each and every word Related external concepts, their subscripts and of One-to-one correspondence. And the same k=1,2,3...sum(concept), represents the number of associated external concepts. Sum(concept) represents the sum of words The number of related external concepts.
[0087] In this application, related keywords that have a positive relationship with the keyword can be retrieved from a pre-built concept dictionary. For each related keyword, the sentiment intensity score between the keyword and the related keyword can be obtained, and a determination can be made as to whether the sentiment intensity score between the keyword and the related keyword is not less than a preset threshold. If the sentiment intensity score between the keyword and the related keyword is not less than the preset threshold, the related keyword can be determined as a target related keyword.
[0088] Since keywords are not only the cornerstone of discourse but also the carrier of discourse meaning, they are often regarded as the core part of a sentence. The TextRank algorithm can be used to extract the conversation history. The key words in the set For each keyword , retrieve all related concepts in the concept dictionary ConceptDict, and then specify a preset threshold , only keep The concept of , together constitutes a node set .in Represents external concepts that are retrieved and retained based on keywords.
[0089] Step S105: Obtain the initial feature vectors of the keywords and target-related keywords, as well as the relationship between the keywords and the target-related keywords, and based on the relationship between the keywords and the target-related keywords, use the relational graph convolutional network to perform a convolution operation on the initial feature vectors of the keywords and the target-related keywords to obtain the target feature vector.
[0090] It should be noted that the knowledge graph node consists of a node set The knowledge graph edge is a set of relationships between knowledge graph nodes. The construction rules of the knowledge graph edge include: there is one edge relationship between any two keywords; there is another edge relationship between a keyword and the target-related keyword.
[0091] In the present application, keywords and target-related keywords can be determined as knowledge graph nodes, and the relationship between keywords and target-related keywords can be determined as knowledge graph edges. For each knowledge graph node, the knowledge graph edge corresponding to the knowledge graph node can be used to perform a first-stage convolution operation on the initial feature vector of the knowledge graph node to obtain a local feature vector of the knowledge graph node. The neighboring knowledge graph nodes corresponding to the knowledge graph node can be used to perform a second-stage convolution operation on the local feature vector of the knowledge graph node to obtain a node feature vector of the knowledge graph node. The target feature vector can be calculated based on the local feature vectors of each knowledge graph node and the node feature vector of each knowledge graph node.
[0092] Specifically, in order to realize the modeling of knowledge graph, the relational graph convolutional neural network RGCN is introduced. First, the knowledge graph is defined Knowledge Graph The node collection in One-to-one correspondence set Elements in . Knowledge Graph The edge set in , 0 represents the edge between keywords, and 1 represents the edge between a keyword and a target-related keyword. The relational graph convolutional neural network RGCN can obtain the updated node features, i.e., the target feature vector, through a two-stage convolution operation.
[0093] Among them, the first stage convolution aims to aggregate according to the different relationships connected to a node, thereby updating the local information of the node:
[0094]
[0095] in, Representation node In the graph convolutional network The vectorized representation of the layer, the initial value of the 0th layer is the node The word embedding Glove is represented. Indicates that it has a relationship with node i All neighbor nodes of The vectorized representation of the layer, the initial value of the 0th layer is the node The word embedding Glove representation. After multiple iterative calculations, the node In the graph convolutional network The final vectorized representation of the layer , Representation node In the graph convolutional network Vectorized representation of the layer, Indicates that in the relationship Next node The neighbor set of For the relationship The corresponding normalization coefficient is used to assign different weight coefficients to different relationships. is the weight matrix, It is a regularization term used to solve the problem of a surge in parameters when there are too many types of relationships.
[0096] The second stage of convolution aims to rely on nodes All neighbor nodes update their own information:
[0097]
[0098] According to the node In the graph convolutional network Vectorized representation of layers , multiplied by a coefficient matrix . Then for the node All neighbors of , also multiplied by a coefficient matrix . Then through the nonlinear activation function . Get the calculation result of the second part of the convolution .
[0099] The node features obtained after two convolution operations can be and Splicing is performed to obtain the final node feature representation, that is, the target feature vector .
[0100] Step S106: Determine a target embedding vector for the labeled question context based on the target feature vector and the initial embedding vector for the labeled question context.
[0101] In this application, an initial feature vector for each knowledge graph edge can be calculated based on the target feature vector. The total number of knowledge graph relationships can be calculated based on the initial feature vector for each knowledge graph edge and the initial embedding vector of the labeled question context. The target embedding vector for the labeled question context can be calculated based on the total number of knowledge graph relationships and the initial embedding vector of the labeled question context.
[0102] Specifically, in order to obtain the knowledge graph A more comprehensive representation requires not only modeling nodes but also modeling the relationships between nodes. Relational networks are introduced to achieve the transformation from nodes to relationships. All the relations contained in are disassembled to obtain a series of triples .in , There are two nodes with edge relationships and The vectorized representation of To represent the relationship between the two, the average pooling of the node vectors connected at both ends is used as the relationship The initialization representation is:
[0103]
[0104] The initial representation of all relations can be Send it to the GRU of the inner relationship network for encoding:
[0105]
[0106] The outer function of the relation network executes an attention mechanism based on the conversation context. Some important relation paths can be given higher weights through attention weighting:
[0107]
[0108]
[0109] Perform weighted summation on each relationship path to obtain the final representation of nodes and relationships in the fusion knowledge graph, where is the total number of relations in the knowledge graph:
[0110]
[0111] Comprehensive representation of integrated knowledge graph and the original conversation context representation , we get the knowledge-enhanced context representation, that is, the target embedding vector of the labeled question context:
[0112]
[0113] Step S107: Based on the initial answer vector of the question text and the target embedding vector of the marked question context, the target answer vector of the question text is learned from the sentiment distribution.
[0114] In this application, the initial answer vector of the question text and the target embedding vector of the labeled question context can be encoded separately to obtain a candidate answer vector for the question text. Based on the candidate answer vectors of the question text, the sentiment answer vector of the question text can be obtained by using the sentiment distribution. Based on the sentiment answer vector of the question text, the target answer vector of the question text can be obtained by learning from the sentiment distribution.
[0115] Specifically, knowledge-enhanced contextual representations can be combined and example representation , and get the final output of the encoding part:
[0116]
[0117] It is a fully connected layer of size h. Based on this, we learn the sentiment distribution , to identify the emotional signals expressed by users. And learn the emotional embedding representation from the emotional distribution: the emotional answer vector of the question text and the target answer vector of the question text :
[0118]
[0119]
[0120] Step S108: Use the target answer vector of the question text and the final answer of the question text to obtain training data, use the training data to train a pre-constructed hybrid multi-decoder to obtain a trained hybrid multi-decoder, the input of the pre-constructed hybrid multi-decoding system is the target answer vector of the question text, and the output of the pre-constructed hybrid multi-decoding system is the final answer to the question text.
[0121] Based on in-depth research on human empathy, empathy is more than a simple emotional resonance; it can be manifested through three specific mechanisms: emotional response, interpretation, and exploration. These three mechanisms play their respective roles in different contexts, collectively constituting the diverse nature of empathy. Using a standard single Transformer decoder to learn these three representations can lead to two potential drawbacks in the generated responses: first, the model's interpretability may be reduced; second, the model may favor the generation of general responses in order to balance the competing forces between the three mechanisms.
[0122] Specifically, the module consists of three components: (1) a base decoder that learns universal expressions; (2) three independent decoders that learn how to appropriately express the three empathy mechanisms; and (3) a meta-decoder that combines the outputs of all decoders. All decoders are based on the original Transformer decoder. Different mechanisms are used to generate empathic responses for different input dialogue contexts. Therefore, the three decoders in the decoding process must dynamically learn the weights of the three expression mechanisms in response to the specific input received. Different decoders are assigned different weight scores based on the encoding results of the original dialogue text. :
[0123]
[0124] All three decoders are designed based on the standard Transformer decoding end. After the calculation of self-attention, feedforward propagation, and cross attention, the decoded output is obtained. :
[0125]
[0126] in, Express Perform a linear calculation, Represents the previous t-1 time steps, and the decoder part generates the word embedding representation E by decoding.
[0127] Similarly, the output of the basic decoder :
[0128]
[0129] Combines the outputs of three independent decoders and the basic decoder :
[0130]
[0131] Finally, the combined result is fed into the meta-decoder to obtain the final predicted response, which is the final answer to the question text. :
[0132]
[0133] Furthermore, a multi-task joint training approach can be used to fine-tune the model. The loss function consists of three parts: sentiment prediction loss, target response generation loss, and diversity loss.
[0134] Among them, the sentiment prediction loss uses cross entropy loss as the training loss for sentiment classification. represents the sentiment distribution predicted by the model, Indicates the true emotional label contained in the speech:
[0135]
[0136] The loss when generating the target response uses the negative log-likelihood loss to predict the target response. represents the generated words, represents the output of the encoder part, Indicates the word currently to be predicted:
[0137]
[0138] Diversity loss is used to enhance the vocabulary richness of generated responses and penalize some frequently occurring meaningless responses, thereby enhancing the richness of generated text. First, calculate the frequency of each word in the corpus:
[0139] Then define the weight coefficient based on word frequency , , the final diversity loss objective function is The final training goal is .in, 、 、 is a hyperparameter used to balance the speed at which the three types of losses decrease.
[0140] in, represents the size of the vocabulary built from the corpus, Represents each word in the corpus The frequency of occurrence. Based on this, each word is calculated Frequency of occurrence , for each word frequency , multiplied by a coefficient And add one, which makes the final weight coefficient is between (0, 1), The introduction of makes the words with high frequency get smaller coefficients. Indicates the candidate words found in the vocabulary during the current decoding process, is an indicator function if and only if in the current decoding process = It is 1 when , and 0 at other times.
[0141] In summary, this application provides a method for determining the corresponding answer to a bank customer's question. The method comprises: first, obtaining the question text entered by the bank customer and the corresponding question context, which facilitates understanding the context of the question text. Then, an initial answer text for the question text is obtained by fine-tuning the DPR model. This is then encoded using an encoder to generate an initial answer vector, enabling a deeper understanding of the question text at a semantic level. The question context is then labeled and an initial embedding vector is generated. Keywords and their target-related keywords are extracted, and a target feature vector is obtained using a relational graph convolutional network. Finally, a target embedding vector is determined. This leverages structured knowledge within the knowledge graph, providing broader context and deeper knowledge support for the answer. Then, a target answer vector for the question text is learned from a sentiment distribution based on the target feature vector, the labeled initial embedding vector of the question context, and the initial answer vector of the question text, facilitating the generation of emotionally charged answers. Finally, a hybrid multi-decoder system is trained using the target answer vector and training data to generate the final answer to the question text. By learning different decoding strategies, the flexibility and diversity of responses are enhanced, improving the accuracy of the answers determined for the bank customer's questions.
[0142] An electronic device is also provided in an embodiment of the present application. Figure 2 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic device in the embodiments of the present application may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 2 The electronic device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.
[0143] like Figure 2As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 201, which can perform various appropriate actions and processes based on programs stored in a read-only memory (ROM) 202 or programs loaded from a storage device 208 into a random access memory (RAM) 203. When the electronic device is powered on, the RAM 203 also stores various programs and data required for the operation of the electronic device. The processing device 201, ROM 202, and RAM 203 are interconnected via a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0144] Typically, the following devices may be connected to the I / O interface 205: an input device 206 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 207 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 208 including, for example, a memory card, a hard disk, etc.; and a communication device 209. The communication device 209 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Figure 2 The electronic device is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0145] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements a method for determining the corresponding answer to any question of a bank customer provided in the embodiment of the present application.
[0146] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement a method for determining the corresponding answer to any bank customer's question provided in an embodiment of the present application.
[0147] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0148] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0149] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0150] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
Claims
1. A method for determining the corresponding answer to a question of a bank customer, characterized in that: include: Obtaining a question text input by a bank customer and a question context corresponding to the question text; Input the question text into a pre-trained fine-tuned DPR model to obtain an initial answer text for the question text, and use an encoder to encode the initial answer text for the question text to generate an initial answer vector for the question text; Adding a tag to the question context, and generating an initial embedding vector of the marked question context based on the marked question context; Extracting keywords from the marked question context, and retrieving target-related keywords that have a positive relationship with the keywords from a pre-built concept dictionary; Obtaining initial feature vectors of the keyword and the target-associated keyword, as well as the relationship between the keyword and the target-associated keyword, and performing a convolution operation on the initial feature vectors of the keyword and the target-associated keyword using a relational graph convolutional network based on the relationship between the keyword and the target-associated keyword to obtain a target feature vector; Determining a target embedding vector for the labeled question context based on the target feature vector and the initial embedding vector for the labeled question context; Based on the initial answer vector of the question text and the target embedding vector of the labeled question context, learning a target answer vector for the question text from the sentiment distribution; Training data is obtained using the target answer vector of the question text and the final answer to the question text, and a pre-constructed hybrid multi-decoder is trained using the training data to obtain a trained hybrid multi-decoder, wherein the input of the pre-constructed hybrid multi-decoding system is the target answer vector of the question text, and the output of the pre-constructed hybrid multi-decoding system is the final answer to the question text.
2. The method for determining the corresponding answers to bank customers' questions according to claim 1, characterized in that: The training process of the fine-tuning DPR model includes: Obtaining a plurality of training samples with annotated information, wherein the annotated information includes an initial answer text to a historical question text, and each of the training samples includes the historical question text; The initial DPR model is trained based on the multiple training samples to obtain the fine-tuning DPR model, the input of the fine-tuning DPR model is the question text, and the output of the fine-tuning DPR model is the initial answer text of the question text.
3. The method for determining the corresponding answers to bank customers' questions according to claim 1, characterized in that: The step of generating an initial embedding vector of the marked question context based on the marked question context includes: Use AILab_Embedding to map the labeled question context to obtain the word embedding vector, position embedding vector, and dialogue state embedding vector of the labeled question context; Calculating a high-dimensional embedding vector of the marked question context based on the word embedding vector, the position embedding vector, and the dialogue state embedding vector of the marked question context; A Transformer Encoder is used to encode the high-dimensional embedding vector of the labeled question context to generate an initial embedding vector of the labeled question context.
4. The method for determining the corresponding answers to bank customers' questions according to claim 1, characterized in that: The process of constructing the concept dictionary includes: For each concept word in the preset corpus, retrieve related concept words that have a positive relationship with the concept word from the ConceptNet knowledge base; Performing embedding representations on the concept words and the associated concept words respectively to obtain the embedding representations of the concept words and the embedding representations of the associated concept words; Retrieving the three-dimensional vector representation corresponding to the concept word and the three-dimensional vector representation corresponding to the associated concept word from the NRC_VAD sentiment dictionary; Based on the embedding representation of the concept words, the embedding representation of the associated concept words, the three-dimensional vector representation corresponding to the concept words, and the three-dimensional vector representation corresponding to the associated concept words, the cosine similarity, sentiment distance, and sentiment intensity score between the concept words and the associated concept words are calculated; The concept dictionary is constructed based on the cosine similarity, the sentiment distance, and the sentiment intensity score between the concept word and the associated concept word.
5. The method for determining the corresponding answers to bank customers' questions according to claim 1, characterized in that: The step of retrieving target-related keywords that have a positive relationship with the keywords from a pre-built concept dictionary includes: Retrieving related keywords that have a positive relationship with the keyword from a pre-built concept dictionary; For each of the associated keywords, obtaining a sentiment intensity score between the keyword and the associated keyword, and determining whether the sentiment intensity score between the keyword and the associated keyword is not less than a preset threshold; If the sentiment intensity score between the keyword and the associated keyword is not less than the preset threshold, the associated keyword is determined as the target associated keyword.
6. The method for determining the corresponding answers to bank customers' questions according to claim 1, characterized in that: The method of performing a convolution operation on the initial feature vectors of the keyword and the target-related keyword using a relational graph convolutional network based on the relationship between the keyword and the target-related keyword to obtain a target feature vector includes: Determining the keyword and the target-related keyword as knowledge graph nodes, and determining the relationship between the keyword and the target-related keyword as a knowledge graph edge; For each of the knowledge graph nodes, using the knowledge graph edge corresponding to the knowledge graph node, perform a first-stage convolution operation on the initial feature vector of the knowledge graph node to obtain a local feature vector of the knowledge graph node; Using the neighboring knowledge graph nodes corresponding to the knowledge graph node, a second-stage convolution operation is performed on the local feature vector of the knowledge graph node to obtain a node feature vector of the knowledge graph node; The target feature vector is calculated based on the local feature vector of each knowledge graph node and the node feature vector of each knowledge graph node.
7. The method for determining the corresponding answers to bank customers' questions according to claim 6, characterized in that: The determining, based on the target feature vector and the initial embedding vector of the labeled question context, a target embedding vector of the labeled question context comprises: Based on the target feature vector, calculating the initial feature vector of each knowledge graph edge; Calculating the total number of knowledge graph relationships based on the initial feature vector of each knowledge graph edge and the initial embedding vector of the labeled question context; A target embedding vector of the labeled question context is calculated based on the total number of knowledge graph relations and the initial embedding vector of the labeled question context.
8. The method for determining the corresponding answers to bank customers' questions according to claim 1, characterized in that: The step of learning a target answer vector for the question text from a sentiment distribution based on the initial answer vector for the question text and the target embedding vector for the labeled question context includes: Encoding the initial answer vector of the question text and the target embedding vector of the marked question context respectively to obtain a candidate answer vector of the question text; Based on the candidate answer vectors of the question text, obtaining the sentiment answer vector of the question text using sentiment distribution; Based on the sentiment answer vector of the question text, a target answer vector of the question text is obtained by learning from the sentiment distribution.
9. An electronic device, characterized in that: comprising at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program so that the electronic device can implement the method for determining the corresponding answer to a question of a bank customer as described in any one of claims 1 to 8.
10. A computer storage medium, characterized in that The storage medium carries one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the method for determining the corresponding answers to questions of bank customers as described in any one of claims 1 to 8.