Customer service work order classification method and device, computer program product and electronic equipment
By training the target model and combining the pre-trained language model and attention mechanism, the problem of inaccurate classification of customer service work orders is solved, the classification accuracy and work efficiency are improved, and the rapid classification needs of massive service types are adapted.
Patent Information
- Application Number
- CN202411146416.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-11-22
AI Technical Summary
In the prior art, the classification of customer service work orders is inaccurate, resulting in high personnel costs and long processing time. Text classification models such as TextCNN and TextRNN are inefficient in long-term dependence on text modeling and sample imbalance, making it difficult to effectively solve the problem of customer service work orders. Issue of inaccurate type of service.
By obtaining the conversation text between the user and the customer service, using multiple training samples to train the target model, generate prompt words and input the pre-trained language model, combining the attention sharing encoding layer within the segment, the attention feature association layer between segments, and text category mapping hierarchy, calculate the probability of each service type and filter out the target service type to improve classification accuracy.
It improves the accuracy of the classification results of customer service work orders, reduces manual classification errors, improves work efficiency, reduces personnel costs, and adapts to the fast and efficient classification of massive service-type nodes.
Smart Images

Figure CN119003777A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and more specifically, to a method, device, computer program product, and electronic device for classifying customer service work orders. Background Art
[0002] Customer complaint analysis is one of the effective means of reducing customer complaint rates. Customer service personnel divide the content of each conversation into corresponding service type nodes according to product, problem, and reason. This allows them to quickly locate user problems and optimize potential unreasonable processes and business rules. However, customer complaint analysis requires experienced customer service staff to classify and judge customer service tickets, which is costly and takes additional time to process.
[0003] Text classification models in related technologies, such as TextCNN (Text Convolutional Neural Network) and TextRNN (Text Recurrent Neural Network), are simple and fast. However, TextCNN cannot model long-term text dependencies, and TextRNN's serial computation is inefficient and prone to catastrophic forgetting. Furthermore, text classification tasks are susceptible to the number of categories and samples. A larger number of categories increases the difficulty of classification, and an imbalanced number of samples can easily lead to significant discrepancies in recognition performance across different categories.
[0004] Currently, no effective solution has been proposed to the problem of inaccurate classification of service types for customer service tickets in related technologies. Summary of the Invention
[0005] The main purpose of this application is to provide a customer service work order classification method, device, computer program product and electronic device to solve the problem of inaccurate service type classification of customer service work orders in related technologies.
[0006] To achieve the above objectives, according to one aspect of the present application, a method for classifying customer service tickets is provided. The method comprises: obtaining a conversation text between a user and a customer service representative, inputting the conversation text into a target model, and obtaining N candidate service types, where N is a positive integer and the target model is trained using multiple sets of training samples, each set of training samples including historical conversation text and the service type of the historical conversation text; randomly selecting a service type other than the N candidate service types from multiple preset service types to obtain an example service type; generating a prompt word based on the training sample of the example service type, where the training sample is a sample used to train the target model, and the prompt word is used to indicate the text output requirements of a pre-trained language model; and inputting the conversation text, the N candidate service types, and the prompt word into the pre-trained language model to obtain a target service type.
[0007] Optionally, the target model is obtained by: obtaining historical conversation texts between multiple users and customer service, and determining the service type of each historical conversation text to obtain a sample data set, wherein the sample data set contains multiple sample data, and each sample data includes a historical conversation text and the service type of the historical conversation text; classifying the sample data set according to different service types to obtain a data set for each service type; filtering out training samples of the service type from the data set of each service type according to a preset data screening strategy to obtain multiple groups of training samples; and performing multiple iterative training on the preset neural network model based on the multiple groups of training samples to obtain the target model.
[0008] Optionally, training samples of the service type are filtered out from the data set of each service type according to a preset data screening strategy to obtain multiple groups of training samples, including: for each data set of the service type, determining multiple statements of each sample data in the target data set; determining the frequency of occurrence of each statement in the sample data, and determining statements with an occurrence frequency greater than or equal to an occurrence frequency threshold as statements to be processed; calculating the similarity between each statement to be processed and the service type, and when the similarity is less than the similarity threshold, removing the statement to be processed from the sample data to obtain an updated target data set; determining the number of sample data in the updated data set of each service type to obtain the number of samples of the data set of each service type; down-sampling the data set whose sample number is greater than or equal to the sample number threshold, and up-sampling the data set whose sample number is less than the sample number threshold to obtain multiple groups of training samples.
[0009] Optionally, the preset neural network model is iteratively trained multiple times based on multiple groups of training samples to obtain a target model, including: determining a target loss function of the preset neural network model, inputting multiple groups of training samples into the preset neural network model, and obtaining the probability that the historical conversation text in each group of training samples belongs to each service type; inputting the probability that the historical conversation text belongs to each service type into the target loss function to obtain a loss value; iteratively updating the model parameters of the preset neural network model multiple times to obtain a preset neural network model for each iteration; calculating the loss value of the preset neural network model for each iteration based on multiple groups of training samples to obtain a group of loss values, and determining the preset neural network model corresponding to the minimum loss value in the group of loss values as the target model.
[0010] Optionally, the probability that the historical conversation text belongs to each service type is input into the target loss function to obtain the loss value, including: for each service type, determining the target probability that the historical conversation text belongs to the target service type, and determining the sample weight of the target service type, wherein the sample weight is determined based on the number of samples in the data set of the target service type; calculating the cross entropy of the target probability to obtain the target cross entropy; determining a preset constant, calculating the difference between the preset value and the target probability, and calculating the product of the preset constant difference, the sample weight and the target cross entropy to obtain the sub-loss value of the target service type of the historical conversation text; and accumulating the sub-loss values of all service types of all historical conversation texts in all training samples to obtain the loss value.
[0011] Optionally, the preset neural network model includes: an intra-segment attention shared encoding layer, an inter-segment attention feature association layer and a text category mapping layer. The intra-segment attention shared encoding layer is used to divide the historical conversation text into multiple paragraphs and extract text features within each paragraph. The inter-segment attention feature association layer is used to extract correlation features between multiple paragraphs. The text category mapping layer is used to output the probability that the text features and correlation feature maps belong to each service type.
[0012] Optionally, the method also includes: determining a plurality of candidate service type output quantities and obtaining a plurality of groups of test samples, wherein each group of test samples includes historical conversation text and the service type of the historical conversation text; for each candidate service type output quantity, determining N as the candidate service type output quantity, testing the target model based on the plurality of groups of test samples, and obtaining the classification accuracy of the plurality of groups of test samples of the target model; determining the classification accuracy of each candidate service type output quantity, obtaining a group of classification accuracy rates, determining the candidate service type output quantity corresponding to the maximum accuracy rate in the group of classification accuracy rates as the target output quantity, and setting N as the target output quantity.
[0013] To achieve the above-mentioned objectives, according to another aspect of the present application, a customer service ticket classification device is provided. The device comprises: an acquisition unit, configured to acquire a conversation text between a user and a customer service representative, input the conversation text into a target model, and obtain N candidate service types, where N is a positive integer, and the target model is trained using multiple sets of training samples, each set of training samples including historical conversation text and the service type of the historical conversation text; a selection unit, configured to randomly select a service type other than the N candidate service types from multiple preset service types to obtain an example service type; a generation unit, configured to generate a prompt word based on the training sample of the example service type, where the training sample is a sample used to train the target model, and the prompt word is used to indicate the text output requirements of a pre-trained language model; and an input unit, configured to input the conversation text, the N candidate service types, and the prompt word into the pre-trained language model to obtain a target service type.
[0014] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the customer service work order classification method described in each embodiment of the present application.
[0015] This application employs the following steps: obtaining the conversation text between a user and customer service representative, inputting the conversation text into a target model, and obtaining N candidate service types, where N is a positive integer. The target model is trained using multiple training samples, each of which includes historical conversation text and the service types in the historical conversation text; randomly selecting a service type other than the N candidate service types from multiple preset service types to obtain an example service type; generating a prompt word based on the training sample of the example service type, where the training sample is a sample used to train the target model, and the prompt word is used to indicate the text output requirements of the pre-trained language model; and inputting the conversation text, N candidate service types, and prompt word into the pre-trained language model to obtain the target service type. This solves the problem of inaccurate service type classification of customer service tickets in the related art. A target model is trained using machine learning methods to automatically output candidate service types based on the conversation text. An example service type is selected from the preset service types. The candidate service type and the example service type output by the target model are input into the pre-trained language model, and the pre-trained language model outputs the target service type, thereby improving the accuracy of customer service ticket classification results. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:
[0017] Figure 1 This is a flowchart of a customer service work order classification method provided in accordance with an embodiment of the present application;
[0018] Figure 2 This is a schematic diagram of the classification process of customer service work orders provided according to an embodiment of the present application;
[0019] Figure 3 is a schematic diagram of a preset neural network model provided according to an embodiment of the present application;
[0020] Figure 4 This is a flowchart of an optional customer service work order classification method provided in accordance with an embodiment of the present application;
[0021] Figure 5 2 is a schematic diagram of a customer service work order classification device provided according to an embodiment of the present application;
[0022] Figure 6 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0024] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0025] It should be noted that 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 data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0027] It should be noted that the information collected is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0028] For ease of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0029] TextCNN (Text Convolutional Neural Network): a neural network with a convolutional structure.
[0030] TextRNN (Text Recurrent Neural Network): A neural network that models sequential information.
[0031] LSTM (Long Short-Term Memory): A variant of recurrent neural networks.
[0032] BERT (Bidirectional Encoder Representation from Transformers): A pre-trained language model based on the Transformer architecture.
[0033] The present invention will be described below in conjunction with preferred implementation steps. Figure 1 This is a flow chart of a customer service ticket classification method provided in accordance with an embodiment of the present application. Figure 1 As shown, the method includes the following steps:
[0034] Step S101: obtain the conversation text between the user and the customer service, input the conversation text into the target model, and obtain N candidate service types, where N is a positive integer. The target model is trained by multiple groups of training samples, and each group of training samples includes historical conversation text and the service type of the historical conversation text.
[0035] Specifically, the text of conversations between users and customer service representatives can be text of a company's customer service representative handling various customer complaints. The target model can be a neural network model trained using machine learning methods using a large number of labeled training samples. After the conversation text to be classified is input into the trained target model, the target model calculates the probability of the conversation text belonging to each service type and, based on the probability statistics, automatically outputs the top N candidate service types, ranked from highest to lowest probability.
[0036] Before training the target model, a classification dataset must be constructed based on historical conversations between users and customer service representatives. For example, before constructing the classification dataset, hundreds of thousands of conversations between customer service representatives and users were collected. The input conversation texts were then concatenated and annotated, with the output labels consisting of manually labeled service type nodes. The text length, number of service type nodes, and number of samples within each node were then analyzed. The text in the classification dataset was preprocessed using a collaborative data augmentation strategy. First, all speech and online samples were segmented according to punctuation, and the frequency of each sentence was counted. High-frequency sentences with no value were then marked, and each sample was filtered. Furthermore, datasets for service types with many samples were downsampled, while datasets for service types with few samples were upsampled, thereby narrowing the gap in sample numbers between different categories. The pre-set neural network model was trained using the collected training samples for each service type to obtain the target model.
[0037] Step S102: randomly selecting a service type other than N candidate service types from a plurality of preset service types to obtain an example service type.
[0038] Specifically, the preset service types can be various service types that have been classified in advance based on historical customer complaints handled by the enterprise. The candidate service types output by the target model belong to multiple candidate service types. In order to filter out the target service type to which the conversation text ultimately belongs from N candidate service types, this embodiment uses a large model to filter out the target service type from N candidate service types. In order to assist the large model to better understand the classification and screening tasks, it is necessary to select a reference example service type. In order to avoid the example service type being affected by the same candidate service type, a service type other than the N candidate service types is selected as the example service type.
[0039] Step S103 : generating prompt words based on training samples of the example service type, wherein the training samples are samples for training the target model, and the prompt words are used to prompt the text output requirements of the pre-trained language model.
[0040] Specifically, this embodiment uses dynamic prompts to assist the large model in classifying the conversation text. Prompts are used to guide the large model in generating classification results based on the intent or requirements of this embodiment, helping the large model to more accurately produce expected classification results. Prompts are extracted from training samples of the example service type to guide the large model in outputting classification results.
[0041] For example, a prompt about classification is constructed in the open source big model. The prompt specifically includes roles and capabilities, task background, and detailed requirements. The roles and capabilities are the roles that the big model needs to play and the tasks it is good at, namely, customer service data experts and text classification tasks. The task background explains the specific tasks to be done, namely, based on the content of the conversation between the user and customer service and the top N candidate service types, the conversation text is divided into a node of a service type among the candidate service types. The detailed requirements limit the output results and style of the big model. For example, it can output not only the classification results, but also the classification basis extracted from the text.
[0042] To help large models better understand and reason about classification tasks, dynamic prompts can be constructed by introducing different few-shots (a machine learning method that uses a small amount of labeled data to train a model) as reference examples. Since the selection must be made from the top N candidate service types, samples from at least N+1 categories are compiled as reference examples. Each time a candidate service type is excluded from these categories, a random reference example is added to the prompt, thereby constructing a dynamically changing prompt and preventing the impact of candidate service types contained in the reference examples on the large model. Compared to the constructed text classification network, the large model does not require input text segmentation and can process very long texts at once. In addition, through prompt input and reasoning, there is no need to consider sample imbalance issues and it can effectively understand the differentiated content between similar categories.
[0043] After determining N candidate service types, the large model based on Dynamic Prompt performs further reasoning and judgment, which can effectively improve the accuracy of multi-classification when the number of categories is large. The large Chinese model based on Dynamic Prompt assists the classification network in node judgment, integrating the N candidate service types identified by the target model into the dynamic prompt for in-depth understanding and reasoning, further distinguishing the differentiated content between similar categories, and assisting in improving recognition results. The large Chinese model based on Dynamic Prompt further infers the results screened by the target model, without considering text length and sample distribution. It can effectively improve the accuracy of multi-classification when the number of categories is large.
[0044] Step S104: input the conversation text, N candidate service types and prompt words into a pre-trained language model to obtain a target service type.
[0045] Specifically, the pre-trained language model can be a large model. By inputting the conversation text, N candidate service types and prompt words into the large model, the large model outputs the final classification result target service type of the conversation text.
[0046] For example, Figure 2 This is a schematic diagram of the classification process of the customer service work order provided in the embodiment of the present application, such as Figure 2 As shown, the conversation text between the user and the agent (i.e., customer service) is obtained. The conversation text can be obtained by transcribed by ASR (Automatic Speech Recognition) through a voice call between the user and the agent, or obtained from an online chat between the user and the agent. The conversation text is input into the classification network (i.e., the target model). The shared BERT+BiLSTM (Bidirectional Long Short-Term Memory Network)+Attention (multi-level attention mechanism) in the classification network processes the conversation text and outputs nodes with the top N candidate service types with classification probabilities. The conversation text, N candidate service types, and dynamic prompts are then input into the large model (i.e., the pre-trained language model). The large model outputs the final classification result, i.e., the target service type, and feeds the target service type back to the agent.
[0047] The customer service ticket classification method provided in an embodiment of the present application obtains the conversation text between a user and a customer service representative, inputs the conversation text into a target model, and obtains N candidate service types, where N is a positive integer. The target model is trained using multiple sets of training samples, each set of training samples including historical conversation text and the service types of the historical conversation text. A service type other than the N candidate service types is randomly selected from multiple preset service types to obtain an example service type. A prompt word is generated based on the training sample of the example service type, where the training sample is a sample used to train the target model, and the prompt word is used to indicate the text output requirements of a pre-trained language model. The conversation text, the N candidate service types, and the prompt word are input into the pre-trained language model to obtain the target service type. This method solves the problem of inaccurate service type classification of customer service tickets in related technologies. A target model is trained using a machine learning method to automatically output candidate service types based on the conversation text. An example service type is selected from the preset service types. The candidate service type and the example service type output by the target model are input into the pre-trained language model, and the pre-trained language model outputs the target service type, thereby improving the accuracy of customer service ticket classification results.
[0048] In order to determine the target service type to which the conversation text belongs, a target model is trained to output the classification result of the conversation text. Optionally, in the classification method of the customer service ticket provided in the embodiment of the present application, the target model is obtained in the following manner: historical conversation texts between multiple users and customer service are obtained, and the service type of each historical conversation text is determined to obtain a sample data set, wherein the sample data set contains multiple sample data, and each sample data includes a historical conversation text and the service type of the historical conversation text; the sample data set is classified according to different service types to obtain a data set for each service type; training samples of the service type are filtered out from the data set of each service type according to a preset data screening strategy to obtain multiple groups of training samples; and the preset neural network model is iteratively trained multiple times based on the multiple groups of training samples to obtain a target model.
[0049] Specifically, a large amount of historical conversation texts between users and customer service are first collected, and each historical conversation text is manually labeled with the service type to which it belongs. Then, all historical conversation texts are classified according to the labeled service type to obtain a data set for each service type. In order to improve the classification effect of the target model, the data set of each service type is processed according to the preset data screening strategy, and multiple groups of training samples are screened out from the data set of each service type, so as to train the preset neural network model based on the multiple groups of training samples. The preset neural network model can be a text classification network model constructed based on a multi-level attention encoding model. After multiple iterative training, the target model is obtained.
[0050] This embodiment of the application introduces a target model into the work order system and utilizes a text classification network to automatically determine the service type node to which each conversation text belongs. This effectively prevents inexperienced customer service from misclassifying a text, while freeing up experienced customer service resources and improving work efficiency. The service type to which a conversation text belongs can be quickly, efficiently, and accurately determined within a vast number of service type nodes, eliminating the need for manual, complex categorization and improving system order settlement efficiency.
[0051] In order to avoid the impact of non-standard text of training samples on the training process of the target model, the collected text data set is screened according to a preset data screening strategy. Optionally, in the classification method of customer service work orders provided in an embodiment of the present application, training samples of the service type are screened from the data set of each service type according to the preset data screening strategy to obtain multiple groups of training samples, including: for each service type data set, determining multiple sentences of each sample data in the target data set; determining the frequency of occurrence of each sentence in the sample data, and determining sentences with an occurrence frequency greater than or equal to an occurrence frequency threshold as sentences to be processed; calculating the similarity between each sentence to be processed and the service type, and when the similarity is less than the similarity threshold, removing the sentence to be processed from the sample data to obtain an updated target data set; determining the number of sample data in the updated data set of each service type to obtain the number of samples in the data set of each service type; down-sampling the data set with a sample number greater than or equal to the sample number threshold, and up-sampling the data set with a sample number less than the sample number threshold to obtain multiple groups of training samples.
[0052] Specifically, before constructing the dataset for each service type, we collected hundreds of thousands of historical conversations between customer service representatives and users. This data comes from voice calls and online chats. The former is pre-recognized using ASR. The input text consists of the conversations between customer service representatives and users, and is annotated. For example, each sample is formatted as "[Customer Service] Content 1 [User] Content 2 ... [Customer Service] Content n." The output labels are manually annotated service type nodes. 75% of the voice call input samples are between 1,000 and 3,000 characters long, and 75% of the online chat samples are between 200 and 2,000 characters long. The output labels contain 635 service types, with a maximum of 20,000 samples per service type and a minimum of only ten.
[0053] Because the text input in the sample data is too long and contains a lot of redundant information, it will have a significant impact on the training process of the target model. Therefore, the redundant information needs to be filtered according to the preset data filtering strategy. First, all voice and online sample data are segmented according to punctuation marks to obtain multiple sentences for each sample data. The frequency of occurrence of each sentence is counted, and then the high-frequency sentences with no value (i.e., pending sentences) are marked. The pending sentences in each sample data are then filtered. The eliminated pending sentences include some common greetings and closing remarks on the customer service side, as well as some non-business-related replies during the conversation. By calculating the similarity between each pending sentence and the service type, the pending sentences with a similarity below the similarity threshold are eliminated.
[0054] In addition, to address the problem of uneven sample sizes for various service types, down-sample the data sets of service types whose sample sizes are greater than or equal to the sample size threshold, extract sample data in different text length ranges from the corresponding data sets according to a preset ratio as training samples, and up-sample the data sets of service types whose sample sizes are less than the sample size threshold. For example, text enhancement tools are used to increase the sample size by back-translating random sentences in each sample data of the data set, replacing homophones, randomly adding and deleting characters, and replacing adjacent word positions, thereby shortening the gap in sample sizes between data sets of different service types.
[0055] The embodiment of the present application eliminates redundant information in the training samples and balances the number of samples in the data sets of different service types, thereby avoiding the impact of differences in the training samples on the training target model.
[0056] After the training samples are processed, a target model is trained through iterative training. Optionally, in the customer service ticket classification method provided in the embodiment of the present application, the preset neural network model is iteratively trained multiple times based on multiple groups of training samples to obtain the target model, including: determining the target loss function of the preset neural network model, inputting multiple groups of training samples into the preset neural network model, and obtaining the probability that the historical conversation text in each group of training samples belongs to each service type; inputting the probability that the historical conversation text belongs to each service type into the target loss function to obtain the loss value; iteratively updating the model parameters of the preset neural network model multiple times to obtain the preset neural network model for each iteration; calculating the loss value of the preset neural network model for each iteration based on multiple groups of training samples to obtain a group of loss values, and determining the preset neural network model corresponding to the minimum loss value in the group of loss values as the target model.
[0057] Specifically, the preset neural network model can be a text classification network built based on a multi-level attention encoding model. The text classification network can include an intra-segment attention sharing encoding layer, an inter-segment attention feature association layer, and a text category mapping layer. The calculation formula for the probability that the historical conversation text belongs to each service type is as follows:
[0058] P(y i |x i )=Softmax[F(I(E(x i )))];
[0059] Among them, x iFor the i-th input conversation text, E, I, and F represent the intra-segment attention shared encoding layer, the inter-segment attention feature association layer, and the text category mapping layer, respectively. The Softmax function (an activation function that converts a vector into a probability distribution) is then used to output the probability distribution of each service type for the historical conversation text. Through multi-level interactive learning of the input text through the intra-segment attention of the encoding layer and the inter-segment attention of the association layer, the service type node to which the conversation text belongs can be more accurately determined.
[0060] Although upsampling and downsampling were performed on training samples for different service types during data preprocessing, sample imbalance still exists, making it difficult to identify categories with fewer samples. Therefore, a fused cross-entropy loss function, also known as the target loss function, is constructed based on the initial category distribution of samples for each service type and the probability output during training. This target loss function is used to select the target model from the preset neural network models trained over multiple iterations. For example, the loss value of the preset neural network model for each iteration is calculated based on the target loss function, and the preset neural network model with the minimum loss value is used as the target model.
[0061] The embodiment of the present application trains a preset neural network model through multiple iterations to screen out the target model corresponding to the minimum loss value calculated based on the target loss function, so that the difference between the prediction result of the target model and the true label is minimized, thereby improving the performance of the model.
[0062] Optionally, in the customer service ticket classification method provided in the embodiment of the present application, the probability that the historical conversation text belongs to each service type is input into the target loss function to obtain the loss value, including: for each service type, determining the target probability that the historical conversation text belongs to the target service type, and determining the sample weight of the target service type, wherein the sample weight is determined based on the number of samples in the data set of the target service type; calculating the cross entropy of the target probability to obtain the target cross entropy; determining a preset constant, calculating the difference between the preset value and the target probability, and calculating the product of the preset constant difference, the sample weight and the target cross entropy to obtain the sub-loss value of the target service type of the historical conversation text; accumulating the sub-loss values of all service types of all historical conversation texts in all training samples to obtain the loss value.
[0063] Specifically, the formula of the objective loss function is as follows:
[0064]
[0065] Among them, y i logP(y i |x i ) represents the traditional cross entropy function, α i (1-P(y i |xi )) β Is the constructed fusion coefficient, which specifically includes two parts, α i represents the sample weight, which is determined according to the initial distribution of the service types to which the samples belong and remains unchanged during the training process. All 635 service types are divided into three levels according to the number of samples: less than 100, 100-1000, and more than 1000. Each level is assigned a different fixed coefficient. For example, the sample weights of the three levels of service types are set to 0.5, 0.3, and 0.2 respectively. The service type with fewer samples should be given more attention, so the weight is set to be smaller; (1-P(y i |x i )) β β represents the correction coefficient, determined by the Softmax layer output probability. It continuously corrects the loss value during training, reducing the contribution of easy samples to the loss function and increasing the contribution of difficult samples. β is a preset constant. By constructing a fused target loss function using a fixed coefficient and a correction coefficient, we can address both the imbalance in sample size and training difficulty across different service types.
[0066] Optionally, in the customer service ticket classification method provided in the embodiment of the present application, the preset neural network model includes: an intra-segment attention shared encoding layer, an inter-segment attention feature association layer and a text category mapping layer. The intra-segment attention shared encoding layer is used to divide the historical conversation text into multiple paragraphs and extract text features within each paragraph. The inter-segment attention feature association layer is used to extract correlation features between multiple paragraphs. The text category mapping layer is used to output the probability that the text features and correlation feature maps belong to each service type.
[0067] Specifically, the preset neural network model consists of three parts: the intra-segment attention shared encoding layer, the inter-segment attention feature association layer, and the text category mapping layer. Figure 3 Schematic diagram of a preset neural network model provided according to an embodiment of the present application. Figure 3As shown in the figure, the intra-segment attention encoding layer consists of a parameter-sharing BERT model, which is used to independently encode each segmented text paragraph. The internal multi-head attention mechanism can learn the contextual information within the paragraph, and then use the vector of the last hidden layer at the CLS (position in the neural network) position as the final feature vector to generate a high-quality text embedding representation. The feature vectors of each paragraph are then vertically spliced in sequence; the inter-segment attention feature association layer consists of a bidirectional LSTM model with attention, which is used to process the interdependence between multiple paragraphs. Attention is assigned to paragraphs containing important information with higher attention weights, further mining the feature information of the complete input text; the text category mapping layer consists of a fully connected network, which maps the feature vector to a specified dimension, thereby identifying the service type to which the conversation text belongs.
[0068] In the embodiment of the present application, different segments of the dialogue text are successively passed through the intra-segment attention sharing encoding layer and the inter-segment attention feature association layer, so as to adapt to texts of different lengths. At the same time, a target loss function is designed, and the initial category distribution of each training sample and the probability output during the training process are respectively used as the weights of the target loss function to avoid the impact of sample imbalance on classification. A BERT+BiLSTM+Attention multi-level attention classification network (that is, a preset neural network model) is constructed. The parameter-shared BERT model extracts features from the segmented paragraphs, and the bidirectional LSTM with attention associates and interacts the features between paragraphs, thereby adapting to both speech and online text lengths. Based on the preset neural network model, information is extracted from the paragraphs of the input text, and then the information between paragraphs is interactively associated and identified, which effectively solves the problem of limited text length and can adapt to both speech and online recognition scenarios.
[0069] The number of candidate service types output by the target model can be determined based on the classification accuracy of the target model. Optionally, in the customer service ticket classification method provided in the embodiment of the present application, the method also includes: determining the number of multiple candidate service type outputs, and obtaining multiple groups of test samples, wherein each group of test samples includes historical conversation text and the service type of the historical conversation text; for each candidate service type output number, determining N as the candidate service type output number, testing the target model based on multiple groups of test samples, and obtaining the classification accuracy of the multiple groups of test samples of the target model; determining the classification accuracy of each candidate service type output number, obtaining a group of classification accuracy rates, determining the candidate service type output number corresponding to the maximum accuracy rate in a group of classification accuracy rates as the target output number, and setting N as the target output number.
[0070] Specifically, before the large model further understands and infers the output candidate service types, it first tests the classification accuracy of the target model under different numbers of candidate service type outputs. For example, the classification accuracy of the top 1, top 3, top 5, and top 10 target models is calculated respectively. Based on the test results, the number of candidate service type outputs with the maximum accuracy is selected as the target output number of the target model, that is, N.
[0071] The embodiment of the present application ensures the accuracy of the classification results of the target model by selecting the number of candidate service types output with the highest classification accuracy.
[0072] According to another embodiment of the present application, an optional customer service ticket classification method is also provided. Figure 4 This is a flow chart of an optional customer service work order classification method provided in accordance with an embodiment of the present application. Figure 4 As shown, the method includes:
[0073] Step S401: construct a classification dataset based on customer service dialogue data.
[0074] Specifically, before constructing the classification set, hundreds of thousands of conversation texts between agents and users were collected simultaneously. The input text was the concatenation and labeling of the conversation content between the agents and users, and the output label was the manually labeled service type node. Then, the text length, number of nodes, and number of samples under each node were analyzed.
[0075] Step S402: pre-process the input text based on the collaborative data enhancement strategy.
[0076] Specifically, all speech and online samples are first segmented by punctuation, and the frequency of each sentence is counted. High-frequency sentences with no value are then marked, and each sample is filtered. Furthermore, categories with many samples are downsampled, while categories with few samples are upsampled, thereby narrowing the gap in sample numbers between categories.
[0077] Step S403: construct a text classification network based on a multi-level attention encoding model.
[0078] Specifically, to extract features from the input text, a pre-trained BERT model is used as the encoder. The input content is segmented into fixed lengths, while retaining some overlap between the text segments before and after the segmentation. The overlap length needs to be sufficient to preserve the complete conversation content of the agent or user. The text classification network consists of three parts: the intra-segment attention shared encoding layer, the inter-segment attention feature association layer, and the text category mapping layer. The intra-segment attention encoding layer consists of a parameter-sharing BERT model; the inter-segment attention feature association layer consists of a bidirectional LSTM model with attention; and the text category mapping layer consists of a fully connected network. The final input and output can be expressed as:
[0079] P(y i |x i )=Softmax[F(I(E(x i )))];
[0080] Among them, xi is the i-th input text, E, I and F represent the encoding layer, association layer and mapping layer respectively, and then the probability distribution of each category is output through the Softmax function to determine the service type node to which the conversation belongs.
[0081] Step S404: construct a fusion loss function based on the initial state and training state of the sample.
[0082] Specifically, a fused cross entropy loss function is constructed based on the initial category distribution of each sample and the probability output during training, which is expressed as follows:
[0083]
[0084] Among them, y i logP(y i |x i ) represents the traditional cross entropy function, α i (1-P(y i |x i )) β is the constructed fusion coefficient, α i represents a fixed coefficient, which is determined by the initial distribution of the sample category; (1-P(y i |x i )) β Represents the correction coefficient, which is determined by the output probability of the Softmax layer, and β is a constant.
[0085] Step S405: Perform auxiliary category judgment based on the large model of the dynamic prompt.
[0086] Specifically, before the large model further understands and infers the top N categories output, it first tests the accuracy of the top 1, top 3, top 5, and top 10 categories output by the text classification network. Based on the test results, the top N categories with the highest probability output by the network are selected as candidates for the large model. The currently available Chinese open source large model is used as a candidate, and then a classification prompt is constructed, which specifically includes the role and capabilities, task background, and detailed requirements. Ultimately, it outputs not only the classification results but also the classification basis extracted from the text. Different few-shot examples are introduced as reference examples to construct a dynamic prompt. Samples from multiple categories are compiled as reference examples. Each time the top N classification candidates are excluded from these categories, a reference example is randomly selected and added to the prompt, thus constructing a dynamically changing prompt. Ultimately, the optimal large model is selected based on the accuracy of auxiliary recognition.
[0087] The embodiment of the present application adopts an optional customer service ticket classification method. In the first stage, different segments of the call text are first passed through the intra-segment attention sharing encoding layer and the inter-segment attention feature association layer to adapt to texts of different lengths. At the same time, a new loss function is designed, and the initial category distribution of each sample and the probability output during the training process are used as weights of the loss function to avoid the impact of sample imbalance on classification. In the second stage, based on the results screened out in the first stage, further reasoning and judgment are made based on the large model of dynamic prompts. When the number of categories is large, the accuracy of multi-classification can be effectively improved. This embodiment can quickly, efficiently and accurately determine the service type to which the call belongs in a large number of classification nodes, thereby replacing the complex manual classification operations and improving the efficiency of the system settlement.
[0088] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0089] The embodiment of the present application also provides a customer service work order classification device. It should be noted that the customer service work order classification device of the embodiment of the present application can be used to execute the customer service work order classification method provided in the embodiment of the present application. The following introduces the customer service work order classification device provided in the embodiment of the present application.
[0090] Figure 5 Schematic diagram of a classification device for customer service work orders according to an embodiment of the present application. Figure 5 As shown, the device includes:
[0091] An acquisition unit 501 is configured to acquire the conversation text between the user and the customer service representative, input the conversation text into a target model, and obtain N candidate service types, where N is a positive integer. The target model is trained using multiple sets of training samples, each set of training samples including historical conversation text and the service type of the historical conversation text.
[0092] A selection unit 502 is configured to randomly select a service type other than N candidate service types from a plurality of preset service types to obtain an example service type;
[0093] A generating unit 503 is configured to generate prompt words based on training samples of the example service type, wherein the training samples are samples for training the target model, and the prompt words are used to prompt the text output requirements of the pre-trained language model;
[0094] The input unit 504 is used to input the conversation text, N candidate service types and prompt words into the pre-trained language model to obtain the target service type.
[0095] The customer service ticket classification device provided in the embodiment of the present application obtains the conversation text between the user and the customer service through the acquisition unit 501, inputs the conversation text into the target model, and obtains N candidate service types, where N is a positive integer, and the target model is trained by multiple sets of training samples, each set of training samples includes historical conversation texts and service types of the historical conversation texts; the selection unit 502 randomly selects a service type other than the N candidate service types from multiple preset service types to obtain an example service type; the generation unit 503 generates a prompt word based on the training sample of the example service type, where the training sample is a sample for training the target model. The prompt word is used to prompt the text output requirement of the pre-trained language model; the input unit 504 inputs the conversation text, N candidate service types and the prompt word into the pre-trained language model to obtain the target service type, which solves the problem of inaccurate service types classified by customer service work orders in related technologies. A target model that automatically outputs candidate service types based on the conversation text is trained through a machine learning method, and an example service type is selected from the preset service types. The candidate service type and the example service type output by the target model are input into the pre-trained language model, and the pre-trained language model outputs the target service type, thereby achieving the effect of improving the accuracy of the classification results of customer service work orders.
[0096] Optionally, in the customer service ticket classification device provided in the embodiment of the present application, the device also includes: a first determination unit, used to obtain historical conversation texts between multiple users and customer service, and determine the service type of each historical conversation text to obtain a sample data set, wherein the sample data set contains multiple sample data, and each sample data includes a historical conversation text and the service type of the historical conversation text; a classification unit, used to classify the sample data set according to different service types to obtain a data set for each service type; a screening unit, used to screen out training samples of the service type from the data set of each service type according to a preset data screening strategy to obtain multiple groups of training samples; a training unit, used to perform multiple iterative training on the preset neural network model based on the multiple groups of training samples to obtain a target model.
[0097] Optionally, in the classification device for customer service work orders provided in an embodiment of the present application, the screening unit includes: a first determination module, used to determine, for each service type data set, multiple statements for each sample data in the target data set; a second determination module, used to determine the frequency of occurrence of each statement in the sample data, and determine statements with an occurrence frequency greater than or equal to an occurrence frequency threshold as statements to be processed; a first calculation module, used to calculate the similarity between each statement to be processed and the service type, and when the similarity is less than the similarity threshold, remove the statement to be processed from the sample data to obtain an updated target data set; a third determination module, used to determine the number of sample data in the updated data set of each service type, and obtain the number of samples in the data set of each service type; a sampling module, used to downsample the data set whose sample number is greater than or equal to the sample number threshold, and upsample the data set whose sample number is less than the sample number threshold, to obtain multiple groups of training samples.
[0098] Optionally, in the customer service work order classification device provided in the embodiment of the present application, the training unit includes: a fourth determination module, used to determine the target loss function of the preset neural network model, input multiple groups of training samples into the preset neural network model, and obtain the probability that the historical conversation text in each group of training samples belongs to each service type; an input module, used to input the probability that the historical conversation text belongs to each service type into the target loss function to obtain a loss value; an update module, used to iteratively update the model parameters of the preset neural network model for multiple times to obtain the preset neural network model for each iteration; a second calculation module, used to calculate the loss value of the preset neural network model for each iteration based on multiple groups of training samples to obtain a group of loss values, and determine the preset neural network model corresponding to the minimum loss value in the group of loss values as the target model.
[0099] Optionally, in the customer service work order classification device provided in the embodiment of the present application, the input module includes: a first determination submodule, used to determine, for each service type, the target probability that the historical conversation text belongs to the target service type, and determine the sample weight of the target service type, wherein the sample weight is determined based on the number of samples in the data set of the target service type; a calculation submodule, used to calculate the cross entropy of the target probability to obtain the target cross entropy; a second determination submodule, used to determine a preset constant, calculate the difference between the preset value and the target probability, and calculate the product of the preset constant difference, the sample weight and the target cross entropy to obtain the sub-loss value of the target service type of the historical conversation text; an accumulation module, used to accumulate the sub-loss values of all service types of all historical conversation texts in all training samples to obtain a loss value.
[0100] Optionally, in the customer service ticket classification device provided in an embodiment of the present application, the preset neural network model includes: an intra-segment attention shared encoding layer, an inter-segment attention feature association layer, and a text category mapping layer. The intra-segment attention shared encoding layer is used to divide the historical conversation text into multiple paragraphs and extract text features within each paragraph. The inter-segment attention feature association layer is used to extract correlation features between multiple paragraphs. The text category mapping layer is used to output the probability that the text features and correlation feature maps belong to each service type.
[0101] Optionally, in the customer service work order classification device provided in the embodiment of the present application, the device also includes: a second determination unit, used to determine the number of multiple candidate service type outputs and obtain multiple groups of test samples, wherein each group of test samples includes historical conversation text and the service type of the historical conversation text; a third determination unit, used to determine N as the number of candidate service type outputs for each candidate service type output number, test the target model based on multiple groups of test samples, and obtain the classification accuracy of the multiple groups of test samples of the target model; a fourth determination unit, used to determine the classification accuracy of each candidate service type output number, obtain a group of classification accuracy rates, determine the number of candidate service type outputs corresponding to the maximum accuracy rate in a group of classification accuracy rates as the target output number, and set N to the target output number.
[0102] The classification device for customer service work orders includes a processor and a memory. The above-mentioned acquisition unit 501, selection unit 502, generation unit 503 and input unit 504 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
[0103] The processor contains a kernel, which retrieves the corresponding program unit from memory. You can configure one or more kernels, and adjust kernel parameters to improve the accuracy of customer service ticket classification results.
[0104] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0105] An embodiment of the present invention provides a computer-readable storage medium having a program stored thereon, which implements a method for classifying customer service work orders when executed by a processor.
[0106] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes a method for classifying customer service work orders when the program is running.
[0107] Figure 6 Schematic diagram of an electronic device according to an embodiment of the present application. Figure 6 As shown, electronic device 601 includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are performed: obtaining a conversation text between a user and a customer service representative, inputting the conversation text into a target model, and obtaining N candidate service types, where N is a positive integer. The target model is trained using multiple sets of training samples, each set of training samples including historical conversation text and the service types of the historical conversation text; randomly selecting a service type other than the N candidate service types from multiple preset service types to obtain an example service type; generating a prompt word based on the training sample of the example service type, where the training sample is a sample used to train the target model, and the prompt word is used to indicate the text output requirements of the pre-trained language model; and inputting the conversation text, the N candidate service types, and the prompt word into the pre-trained language model to obtain the target service type. The device herein may be a server, a PC, a PAD, a mobile phone, or the like.
[0108] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: obtaining a conversation text between a user and a customer service representative, inputting the conversation text into a target model, and obtaining N candidate service types, wherein N is a positive integer, and the target model is trained by multiple groups of training samples, each group of training samples including historical conversation texts and the service types of the historical conversation texts; randomly selecting a service type other than the N candidate service types from multiple preset service types to obtain an example service type; generating a prompt word based on the training sample of the example service type, wherein the training sample is a sample for training the target model, and the prompt word is used to prompt the text output requirements of the pre-trained language model; inputting the conversation text, N candidate service types, and the prompt word into the pre-trained language model to obtain the target service type.
[0109] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0110] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, 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 generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0111] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0113] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0114] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0115] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0116] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0117] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0118] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A method for classifying customer service work orders, characterized in that: include: Obtain the conversation text between the user and the customer service, input the conversation text into the target model, and obtain N candidate service types, where N is a positive integer, and the target model is trained by multiple groups of training samples, each group of training samples includes historical conversation texts and service types of the historical conversation texts; Randomly select a service type other than the N candidate service types from a plurality of preset service types to obtain an example service type; Generate prompt words based on the training samples of the example service type, wherein the training samples are samples for training the target model, and the prompt words are used to prompt the text output requirements of the pre-trained language model; The conversation text, the N candidate service types and the prompt word are input into a pre-trained language model to obtain a target service type.
2. The method according to claim 1, characterized in that: The target model is obtained by: Acquire historical conversation texts between multiple users and customer service, and determine the service type of each historical conversation text to obtain a sample data set, wherein the sample data set includes multiple sample data, each sample data includes a historical conversation text and the service type of the historical conversation text; Classifying the sample data set according to different service types to obtain a data set for each service type; Filtering training samples of the service type from the data set of each service type according to a preset data screening strategy to obtain multiple groups of training samples; The preset neural network model is iteratively trained multiple times based on the multiple groups of training samples to obtain the target model.
3. The method according to claim 2, characterized in that According to the preset data screening strategy, the training samples of the service type are screened out from the data set of each service type, and the obtained multiple groups of training samples include: For each service type of data set, multiple statements for each sample data in the target data set are determined; Determine the occurrence frequency of each statement in the sample data, and determine statements with an occurrence frequency greater than or equal to an occurrence frequency threshold as statements to be processed; Calculate the similarity between each statement to be processed and the service type, and when the similarity is less than a similarity threshold, remove the statement to be processed from the sample data to obtain an updated target data set; Determine the number of sample data in the updated data set of each service type, and obtain the number of samples in the data set of each service type; Down-sampling is performed on a data set whose sample number is greater than or equal to a sample number threshold, and up-sampling is performed on a data set whose sample number is less than the sample number threshold, to obtain the multiple groups of training samples.
4. The method according to claim 2, characterized in that: The preset neural network model is trained multiple times iteratively based on the multiple groups of training samples to obtain the target model, including: Determine the target loss function of the preset neural network model, input the multiple groups of training samples into the preset neural network model, and obtain the probability that the historical conversation text in each group of training samples belongs to each service type; Inputting the probability that the historical conversation text belongs to each service type into the target loss function to obtain a loss value; Iteratively updating the model parameters of the preset neural network model multiple times to obtain a preset neural network model for each iteration; Based on the multiple groups of training samples, the loss value of the preset neural network model in each iteration is calculated to obtain a group of loss values, and the preset neural network model corresponding to the minimum loss value in the group of loss values is determined as the target model.
5. The method according to claim 4, characterized in that The probability that the historical conversation text belongs to each service type is input into the target loss function, and the loss value obtained includes: For each service type, determining a target probability that the historical conversation text belongs to a target service type, and determining a sample weight of the target service type, wherein the sample weight is determined based on the number of samples in a data set of the target service type; Calculating the cross entropy of the target probability to obtain a target cross entropy; Determine a preset constant, calculate the difference between the preset value and the target probability, and calculate the product of the preset constant difference, the sample weight and the target cross entropy to obtain a sub-loss value of the target service type of the historical conversation text; The loss value is obtained by summing up the sub-loss values of all service types of all historical conversation texts in all training samples.
6. The method according to claim 2, characterized in that The preset neural network model includes: an intra-segment attention shared encoding layer, an inter-segment attention feature association layer and a text category mapping layer. The intra-segment attention shared encoding layer is used to divide the historical conversation text into multiple paragraphs and extract text features in each paragraph. The inter-segment attention feature association layer is used to extract correlation features between the multiple paragraphs. The text category mapping layer is used to output the probability that the text features and the correlation feature mapping belong to each service type.
7. The method according to claim 1, characterized in that The method further comprises: Determine the number of outputs of multiple candidate service types, and obtain multiple groups of test samples, wherein each group of test samples includes a historical conversation text and a service type of the historical conversation text; For each candidate service type output quantity, determine N as the candidate service type output quantity, test the target model based on the multiple groups of test samples, and obtain the classification accuracy of the multiple groups of test samples of the target model; Determine the classification accuracy of each candidate service type output quantity to obtain a set of classification accuracy rates, determine the candidate service type output quantity corresponding to the maximum accuracy rate in the set of classification accuracy rates as the target output quantity, and set N to the target output quantity.
8. A classification device for customer service work orders, characterized in that: include: An acquisition unit is used to acquire the conversation text between the user and the customer service, input the conversation text into the target model, and obtain N candidate service types, wherein N is a positive integer, and the target model is trained by multiple groups of training samples, each group of training samples includes historical conversation text and the service type of the historical conversation text; A selection unit, configured to randomly select a service type other than the N candidate service types from a plurality of preset service types to obtain an example service type; A generating unit, configured to generate prompt words based on a training sample of the example service type, wherein the training sample is a sample for training the target model, and the prompt words are used to prompt a text output requirement of a pre-trained language model; The input unit is used to input the dialogue text, the N candidate service types and the prompt word into a pre-trained language model to obtain a target service type.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for classifying customer service work orders described in any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the customer service work order classification method described in any one of claims 1 to 7.
Citation Information
Cited By
Training sample data generation method and device, readable storage medium and program product
CN120277419A
Intention recognition model training method, intention recognition method, and related device
CN122692187A
