A training method and system for artificial intelligence model

By conducting context scale and sentence cluster analysis on the communication sample data of the communication process, and correcting the attention weight, the problem of insufficient versatility of the SA-LSTM model in short text processing is solved, and the accuracy of the recognition results and the training process are improved. reliability.

CN118503717BActive Publication Date: 2024-10-15SHANGHAI XUANWU INFORMATION TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410980141.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-10-15
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

The existing SA-LSTM model lacks versatility when processing short texts, resulting in large deviations in recognition results for special sentences and low reliability of the text recognition model training process.

Method used

By obtaining the communication sample data of the communication process, it is divided into a training sample set and a priori sample set, clustered according to the context scale and sentence clustering clusters, the attention weight is corrected, and each communication is classified based on the context scale and sentence readability. The statements are corrected for attention and model training is performed.

Benefits of technology

It improves the model's recognition accuracy for special sentences and the reliability of the training process, and enhances its ability to process short texts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503717B_ABST
    Figure CN118503717B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of model training technology based on text processing, and in particular to a training method and system for an artificial intelligence model. The method obtains context scales based on the differences in sentence composition between communication objects and the differences in speech association in time sequence in each communication sample data in a priori sample set, and clusters to obtain sample clusters; clusters to obtain sentence clusters based on the approximate situation of structural composition analysis between communication sentences in the priori sample set, and determines the sentence readability through the distribution of each sentence cluster in the sample cluster; obtains the context scale of communication sample data in the training sample set, and obtains the corrected attention weights in combination with the sentence readability obtained by matching each communication sentence to perform communication sentence training to obtain an artificial intelligence model. The present invention combines the context and sentence analysis of the priori sample set in communication, corrects the degree of attention of each communication sentence during the training process, makes the training process more reliable, and obtains a better model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of model training based on text processing, and in particular to a training method and system for an artificial intelligence model. Background Art

[0002] In the intelligent recognition task of text information, sentences in text data often have both short-term and long-term relationships, that is, they have multi-level structures and meanings, and it is necessary to read the real semantic information in the context. Self-attention long short-term memory network (SA-LSTM) is a deep learning model that combines the self-attention mechanism (SA) and the long short-term memory network (LSTM). When processing sequence data, it can simultaneously utilize the long-term dependency capture ability of LSTM and the dynamic weight allocation characteristics of self-attention, thereby improving the recognition performance of the model.

[0003] The SA-LSTM model still has the problem of insufficient versatility in actual language text recognition applications. For example, in short call texts, the text cannot provide complete contextual information due to conversation habits. Some communication sentences are concise and require more complex prior information to infer the meaning of the sentences. The self-attention mechanism does not have a built-in inductive bias to force the model to learn specific structures or patterns. When the traditional SA-LSTM model recognizes relatively concise special sentences, it will ignore their true meaning relationship and may over-expand or extract them into other meanings. The model's recognition results for special sentences are highly biased, and the reliability of the text recognition model training process is low. Summary of the invention

[0004] In order to solve the technical problems in the prior art that the recognition results of the model for special sentences have large deviations and the model training process of text recognition has low reliability, the purpose of the present invention is to provide a training method and system for an artificial intelligence model, and the technical solutions adopted are as follows:

[0005] The present invention provides a method for training an artificial intelligence model, the method comprising:

[0006] Acquire communication sample data of a number of communication processes, each communication sample data includes a communication sentence spoken by two communication objects each time during a communication process; divide all communication sample data into a training sample set and a priori sample set;

[0007] In each communication sample data in the prior sample set, the context scale of each communication sample data is obtained according to the composition differences between the communication sentences of the two communication objects in all corresponding speeches, and the differences between the degrees of correlation between speeches in time sequence; the communication sample data in the prior sample set are clustered based on the context scale to obtain sample clusters;

[0008] In the prior sample set, based on the sentence length and word composition approximation between each two communication sentences, the communication sentences in the prior sample set are clustered to obtain sentence clusters; according to the distribution of the communication sentences in each sentence cluster among all sample clusters, the sentence readability of each sentence cluster is obtained;

[0009] In the training sample set, the context scale of each communication sample data is obtained; the sentence readability of each communication sentence is determined according to the matching of each communication sentence with the sentence clustering cluster in the prior sample set; the modified attention weight of each communication sentence in the training sample set is obtained by combining the sentence readability of each communication sentence with the context scale of the communication sample data;

[0010] The model is trained on the training sample set according to the modified attention weight to obtain the artificial intelligence model.

[0011] Furthermore, the method for obtaining the context scale includes:

[0012] For any communication sample data in the prior sample set, the autonomy of each communication object in each speech is obtained by comparing the word composition of each speech of each communication object in the communication sample data with the previous and next speeches in time sequence; the initiative of each communication object in speaking is obtained by combining the autonomy of all speeches of each communication object;

[0013] According to the approximate situation of the speaking initiative of two communication objects in the communication sample data, the active replacement degree of the communication sample data is obtained;

[0014] According to the difference in word distribution of two communication objects in all speeches in the communication sample data, obtaining the communication variation degree of the communication sample data;

[0015] The context scale of the communication sample data is obtained by combining the active substitution degree and communication change degree of the communication sample data; both the active substitution degree and the communication change degree are positively correlated with the context scale.

[0016] Furthermore, the step of obtaining the autonomy of each communication object in each speech by associating each speech of each communication object in the communication sample data with the previous and next speeches in time sequence in terms of word composition includes:

[0017] For any speech of each communication object, the previous speech of the speech in the time sequence is regarded as the preceding speech of the speech, and the next speech of the speech in the time sequence is regarded as the succeeding speech of the speech; if the succeeding speech of the speech does not exist, the autonomy of the speech is the preset autonomy;

[0018] Obtaining a text vector of a speech; taking the similarity between the text vector of the speech and the previous speech as the previous association of the speech; taking the similarity between the text vector of the speech and the subsequent speech as the subsequent association of the speech;

[0019] When there is a previous statement and the previous correlation is not zero, the ratio of the subsequent correlation of the statement to the previous correlation is normalized to obtain the previous and next correlation of the statement; otherwise, the subsequent correlation of the statement is normalized to obtain the previous and next correlation of the statement;

[0020] The total number of all words in the subsequent speech is taken as the number of words in the subsequent speech; the total number of words in the subsequent speech that are interjections is counted as the number of exclamations in the subsequent speech; the ratio of the number of exclamations in the subsequent speech to the number of words is taken as the subsequent exclamation relevance of the speech;

[0021] The autonomy of the speech is obtained by combining the contextual relevance and subsequent interjection relevance of the speech; both contextual relevance and subsequent interjection relevance are positively correlated with autonomy.

[0022] Furthermore, the method for obtaining the communication change degree includes:

[0023] Among all the speeches of each communication object in the communication sample data, words that are nouns, pronouns, and adjectives are grouped into a set as the speech word set of each communication object;

[0024] The Jaccard similarity between the speech word sets of two communication objects in the communication sample data is calculated and negative correlation mapping is performed to obtain the communication change degree of the communication sample data.

[0025] Furthermore, the method for obtaining the sentence clustering clusters includes:

[0026] For any two different communication sentences, the structural similarity of the two communication sentences is obtained according to the similarity of the word parts of speech in the two communication sentences;

[0027] The character length in each communication sentence is used as the sentence length of each communication sentence; the difference between the sentence lengths of the two communication sentences is negatively correlated and normalized to obtain the length similarity of the two communication sentences;

[0028] The structural similarity and length similarity of the two communication sentences are combined to obtain similarity indexes of the two communication sentences; the similarity indexes of every two communication sentences are used as a metric to cluster all communication sentences to obtain sentence clusters.

[0029] Furthermore, the method for obtaining the structural similarity includes:

[0030] The number of types of parts of speech in which words appear in each communication sentence is taken as the structural type of each communication sentence;

[0031] The largest structural type in the two communication sentences is taken as the maximum number of types of the two communication sentences; the number of types of parts of speech that appear in both words in the two communication sentences is taken as the number of the same types of the two communication sentences;

[0032] The ratio of the number of the same categories of the two communication sentences to the maximum number of categories is used as the structural similarity of the two communication sentences.

[0033] Furthermore, obtaining the sentence readability of each sentence cluster according to the distribution of the communication sentences in each sentence cluster in all sample clusters includes:

[0034] For any sentence cluster, obtain the distribution probability of the communication sentences in the sentence cluster in each sample cluster;

[0035] The information entropy of the distribution probability of the communication sentences in the sentence cluster in each sample cluster is normalized and used as the sentence readability of the sentence cluster.

[0036] Furthermore, determining the readability of each communication statement according to the matching of each communication statement with the statement clustering cluster in the prior sample set includes:

[0037] Obtain the central communication sentence of each sentence cluster in the prior sample set;

[0038] For any communication sentence in the training sample set, obtain the similarity index between the communication sentence and each central communication sentence; take the sentence cluster corresponding to the largest similarity index as the matching cluster of the communication sentence;

[0039] The sentence readability of the matching cluster is taken as the sentence readability of the communication sentence.

[0040] Furthermore, the method for obtaining the modified attention weight includes:

[0041] The product of the sentence readability of each communication sentence in the training sample set and the sentence scale of the communication sample data where the communication sentence is located is used as the modified attention weight of each communication sentence in the training sample set.

[0042] The present invention also provides a training system for an artificial intelligence model, the system comprising:

[0043] The sample data acquisition module is used to acquire communication sample data of a number of communication processes, each communication sample data includes the communication sentences of each speech of two communication objects in a communication process; all communication sample data are divided into a training sample set and a priori sample set;

[0044] The prior sample context analysis module is used to obtain the context scale of each communication sample data in the prior sample set according to the composition differences between the communication sentences of the two communication objects in all corresponding speeches and the differences between the degrees of correlation between the speeches in time sequence; cluster the communication sample data in the prior sample set based on the context scale to obtain sample clusters;

[0045] The prior sample sentence analysis module is used to cluster the communication sentences in the prior sample set based on the sentence length and word composition approximation between each two communication sentences to obtain sentence clusters; and obtain the sentence readability of each sentence cluster according to the distribution of the communication sentences in each sentence cluster among all sample clusters;

[0046] The training sample supervision module is used to obtain the context scale of each communication sample data in the training sample set; determine the sentence readability of each communication sentence according to the matching of each communication sentence with the sentence clustering cluster in the prior sample set; and obtain the modified attention weight of each communication sentence in the training sample set by combining the sentence readability of each communication sentence with the context scale of the communication sample data;

[0047] The training module is used to perform model training on the training sample set according to the modified attention weight to obtain an artificial intelligence model.

[0048] The present invention has the following beneficial effects:

[0049] The present invention adds a priori sample set to analyze the situation that the weight of the sentence needs to be corrected in the training process of the communication sample data. First, according to the differences in the sentence composition between the communication objects and the differences in the speech association in the time sequence in the communication sample data in the prior sample set, the context scale is obtained, thereby reflecting the simplicity of the language habits of this communication process. For the communication sample data that needs to expand the analysis information, the greater the attention, the clustering is further performed according to the context scale, and the clustering division of the communication sample data is performed. Further, the structural composition analysis approximation between the communication sentences in the prior sample set is performed, and the sentence clustering clusters are obtained by clustering. Each sentence clustering cluster reflects the communication sentences with the same sentence structure. Through the distribution of each sentence clustering cluster in the sample clustering cluster, the context scale of the sentences with the same structure can be judged to determine the readability of the sentence and reflect the special degree of the sentence structure. After completing the analysis of the priori sample set, when each communication sentence is identified and analyzed in the training sample set, the sentence readability is obtained by obtaining the context scale and matching it with the sentence clustering cluster. The attention degree of each communication sentence during training is corrected in combination with the context scale and sentence readability to obtain a better intelligent model. The present invention uses a priori sample sets to perform a combined analysis of context and sentences in communication, and corrects the attention level of each communication sentence in the training process, making the training process more reliable and the obtained model better. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 A flow chart of a training method for an artificial intelligence model provided by one embodiment of the present invention;

[0052] Figure 2 A percentage diagram of an intelligent customer service satisfaction survey result provided by an embodiment of the present invention;

[0053] Figure 3 A schematic diagram of a model training process provided by an embodiment of the present invention;

[0054] Figure 4 A flow chart of a method for obtaining a context scale provided by an embodiment of the present invention;

[0055] Figure 5 A flow chart of a method for obtaining sentence clusters provided by an embodiment of the present invention;

[0056] Figure 6A structural diagram of a training system for an artificial intelligence model provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the training method and system of an artificial intelligence model proposed by the present invention, its specific implementation method, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0058] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0059] The following is a detailed description of a training method and system for an artificial intelligence model provided by the present invention in conjunction with the accompanying drawings.

[0060] See also Figure 1 , which shows a flow chart of a training method for an artificial intelligence model provided by an embodiment of the present invention, the method comprising the following steps:

[0061] S1: Obtain communication sample data of several communication processes, each communication sample data contains the communication sentences of two communication objects each time in a communication process; all communication sample data are divided into a training sample set and a priori sample set.

[0062] The user experience of intelligent customer service is generally poor. Please refer to Figure 2 , which shows a percentage diagram of the results of an intelligent customer service satisfaction survey provided by an embodiment of the present invention. Intelligent customer service still cannot replace manual customer service. In order to improve the efficiency of handling user issues, artificial intelligence models are used to identify customer needs and emotions, so as to enhance the user experience of intelligent customer service through automatic inscription-assisted answers and improve customer satisfaction.

[0063] Due to factors such as personal character, communication habits, cultural background, emotional state, communication purpose and environment, people have different language habits when communicating. Some sentences are more complete and specific, while others are brief and conservative. Due to different language habits, people cannot communicate in a standardized language logic. For intelligent customer service, it is a necessary responsibility to communicate with users of various language habits. Therefore, when performing artificial intelligence recognition and analysis on call texts, it is necessary to consider the sentence structure of the sentence.

[0064] During the training process, some shorter special structure sentences will have a greater impact on the training of the model. For example, "It's all right", "You can see", "Not bad" or "No need", etc., short sentence structures will appear habitually during the call, but it can be seen that such sentences have almost no clear referents, and are very incomplete sentence structures. They may not have a short-term relationship with the previous sentence, and may also refer to something in an earlier conversation. It is necessary to make an inferential judgment based on all communication records. For example, "It's all right" can be expanded to mean "I think the solution you just mentioned is all right" or "I don't care about the solution you just mentioned, anything is fine."

[0065] In an embodiment of the present invention, in order to better train the artificial intelligence model, the call recording records of the telephone customer service during 50,000 communications are collected, and the recording time of a single communication process is required to be greater than 30 seconds. The call recording is converted into text through an automatic speech recognition system and the data is cleaned and denoised to obtain the communication text of each communication process as the communication sample data for training. The specific sample data acquisition process can be adjusted by the implementer according to the specific implementation scenario, and no restrictions are made here. It should be noted that data cleaning and denoising are technical means well known to those skilled in the art and will not be elaborated here.

[0066] For each communication sample data, the communication objects are customer service and users, and in a single communication process, each communication object will speak multiple times, and each speech contains multiple sentences. The communication sample data are divided into a training sample set and a priori sample set. In the embodiment of the present invention, the training sample set and the priori sample set are divided in a ratio of 3 to 2. Before training, a supervision module is generated through the priori sample set to correct the attention of special sentences that are easily ignored and learned incorrectly during model training, so as to avoid the uncertainty problems caused by direct training. Please refer to Figure 3 , which shows a schematic diagram of a model training process provided by an embodiment of the present invention. When the communication sentences in the training sample set are input into the self-attention mechanism, namely SA, a default attention weight will be generated, and the attention weight will be corrected by the supervision module, and then input into the long short-term memory network, namely LSTM, and a training cycle will be completed after the training output.

[0067] In some possible implementations of the present invention, when analyzing the sentences between communication sentences, the composition structure of the words in the sentences will be analyzed. Therefore, natural language processing technology, that is, NLP, can be used to divide each communication sentence and mark the part of speech, which includes: nouns, verbs, adjectives, adverbs, pronouns, prepositions, conjunctions, articles, interjections, numerals and quantifiers. It should be noted that the division of words in specific sentences and the part of speech marking are technical means well known to those skilled in the art, and will not be elaborated here.

[0068] S2: In each communication sample data in the prior sample set, the context scale of each communication sample data is obtained according to the composition differences between the communication sentences of the two communication objects in all corresponding speeches, and the differences between the degrees of correlation between the speeches in time sequence; the communication sample data in the prior sample set are clustered based on the context scale to obtain sample clusters.

[0069] In the interactive process, since communication is mutual, there must be an active and passive relationship in communication. Compared with passive speech, active speech usually has more complete sentences, and the possibility of its speech being required for expanded analysis is smaller. Therefore, a preliminary analysis can be conducted based on the connection between the two communication objects and the changes in sentence structure during each speech.

[0070] Preferably, in a possible implementation of the embodiment of the present invention, the method for obtaining the context scale is as follows: Figure 4 , which shows a flow chart of a method for obtaining a context scale provided by an embodiment of the present invention, the method comprising the following steps:

[0071] S201: For any communication sample data in the prior sample set, the autonomy of each communication object in each speech is obtained by combining the relationship between each speech of each communication object and the previous and next speeches in time sequence in terms of word composition; the speech initiative of each communication object is obtained by combining the autonomy of all speeches of each communication object.

[0072] For a single speech, when the communication object's speech has a higher correlation with the subsequent text and a lower correlation with the previous text, it means that this speech is more likely to be a highly proactive speech with relatively rich content. At the same time, when there are more interjections in the subsequent speech of this speech, such as "um", "ah", "oh" or "ma", it also reflects that the topic raised by the speech has caused a discussion of opinions or emotional expression, and the proactive tendency of this speech is also higher. Therefore, through the correlation between the previous and next texts of the speech, the autonomy of each speech is preliminarily analyzed.

[0073] Preferably, in some possible implementation methods of the embodiments of the present invention, the method for acquiring the autonomy of speech includes:

[0074] First, for any speech of each communication object, the previous speech of the speech in the time sequence is regarded as the preceding speech of the speech, and the next speech of the speech in the time sequence is regarded as the subsequent speech of the speech, and the context of the speech is marked. If the subsequent speech of the speech does not exist, it means that this speech is the last closing statement in the communication process, and no further judgment of autonomy is required. Then the autonomy of the speech is the preset autonomy. In the embodiment of the present invention, the preset autonomy is set to 0, and the specific value can be adjusted by the implementer.

[0075] Furthermore, the text vector of the speech is obtained, and the similarity between the text vector of the speech and the previous speech is used as the previous association of the speech, and the similarity between the text vector of the speech and the subsequent speech is used as the subsequent association of the speech. The higher the similarity, the stronger the association of the text content. In the embodiment of the present invention, the acquisition of text vectors and the calculation of similarity between vectors are technical means well known to those skilled in the art, such as using Word2Vec to acquire text vectors and using cosine similarity to perform similarity analysis between vectors, which will not be described in detail here.

[0076] Furthermore, when there is a previous speech and the previous correlation is not zero, it means that the speech is affected by the previous speech. The ratio of the subsequent correlation of the speech to the previous correlation is normalized to obtain the before-after correlation of the speech. When the subsequent correlation is stronger and the previous correlation is weaker, the before-after correlation is higher, indicating that the active speaking tendency of the speech in the before-after correlation is higher. Otherwise, it means that the speech is not affected by the previous speech. The subsequent correlation of the speech is normalized to obtain the before-after correlation of the speech. The higher the correlation with the subsequent speech, the higher the active expression tendency of the speech.

[0077] Furthermore, the total number of all words in the subsequent speech is taken as the number of words in the subsequent speech, the total number of words in the subsequent speech that are interjections is counted as the number of exclamations in the subsequent speech, and the ratio of the number of exclamations to the number of words in the subsequent speech is taken as the subsequent exclamation relevance of the speech. The more interjections there are in the subsequent speech, the higher the active tendency of this speech in emotional expression.

[0078] Finally, the autonomy of the speech is obtained by combining the contextual correlation and the subsequent interjection correlation of the speech, reflecting the degree of active expression tendency of the speech. In the embodiment of the present invention, the product of the contextual correlation and the subsequent interjection correlation can be used as autonomy, reflecting that the contextual correlation and the subsequent interjection correlation are both positively correlated with autonomy. In other embodiments of the present invention, other basic mathematical operations can also be used to reflect that the contextual correlation and the subsequent interjection correlation are both positively correlated with autonomy, such as addition, etc., which are not limited here.

[0079] In a specific implementation of the embodiment of the present invention, the expression of autonomy is:

[0080] ; In the formula, Expressed as The autonomy of the speech, Expressed as The number of words in each utterance, Expressed as The number of exclamations per speech, Expressed as The subsequent association of the speech, Expressed as The preceding relationship of the speech, It is represented as a normalization processing function. It should be noted that normalization is a technical means well known to those skilled in the art. The normalization function can be linear normalization or standard normalization, etc. The specific normalization method is not limited here. Expressed as The relevance of the speech, Expressed as The subsequent order of the speech exclaims the relevance.

[0081] At this point, the analysis of the autonomy of each speech is completed, and further combined with the autonomy of all speeches of the communication object, it reflects the initiative of the communication object in this communication process.

[0082] Preferably, in the embodiment of the present invention, the average value of the autonomy of all speeches of each communication object is used as the speech initiative of each communication object to reflect the communication initiative tendency of the communication object, and is combined in the form of a mean value.

[0083] In other embodiments of the present invention, the accumulated value of the autonomy of all speeches of each communication object may be used as the speech initiative of each communication object and combined in the form of a sum value, which will not be elaborated here.

[0084] S202: Obtaining the initiative replacement degree of the communication sample data according to the approximate situation of the speaking initiative of the two communication objects in the communication sample data.

[0085] The similarity of speech initiative is used to judge the frequent changes in communication direction during the communication dialogue. If the speech initiative is more similar, it means that the degree of subject replacement of the communication topic is higher. The communication subject in customer service telephone communication is usually one-way, so it is very likely that unrecognized incomplete sentences are hidden, which makes the context judgment more related.

[0086] In an embodiment of the present invention, the difference in speech initiative of two communication objects in the communication sample data is negatively correlated and normalized to obtain the active replacement degree of the communication sample data. The smaller the difference in speech initiative, the higher the similarity and the higher the degree of replacement.

[0087] S203: Obtain the communication variation degree of the communication sample data according to the distribution difference of words in all speeches of the two communication objects in the communication sample data.

[0088] The differences in the distribution structure of words between speeches by the communication objects reflect the degree of change in the content of the communication text. The closer the distribution of words is, the less change there is in the communication topic, the more consistent the context is, and the less likely it is that there are sentences that are difficult to analyze. Therefore, words with referential properties such as nouns, adjectives, and pronouns in the speech are used as words for distribution structure analysis. The more similar the distribution of these words is, the more consistent the communication topic is, and the less change there is. Conversely, the greater the distribution difference is, the more communication topics there are, the higher the degree of change is, and there may be misunderstandings.

[0089] Preferably, in some possible implementations of the embodiments of the present invention, the method for acquiring the communication change degree includes:

[0090] First, among all the speeches of each communication object in the communication sample data, the words that are nouns, pronouns and adjectives are grouped into a set as the speech word set of each communication object. The words that are nouns, pronouns and adjectives have a high degree of representing the attribute characteristics in the text and are more meaningful for analyzing the context.

[0091] The Jaccard similarity between the speech word sets of the two communication objects in the communication sample data is further calculated and negatively mapped to obtain the communication change degree of the communication sample data. The Jaccard similarity is an indicator to measure the similarity of two sets. It mainly focuses on the proportion of the same elements in the two sets. The larger the Jaccard similarity, the more significant the similarity in the speech word sets, reflecting the low change, so the communication change degree is smaller. It should be noted that the Jaccard similarity is a well-known technical means well known to those skilled in the art, and will not be elaborated here.

[0092] S204: Combining the active substitution degree and the communication change degree of the communication sample data, obtaining the context scale of the communication sample data; both the active substitution degree and the communication change degree are positively correlated with the context scale.

[0093] Combined with the active substitution degree and communication change degree between the communication objects in the communication sample data, it comprehensively reflects the changes in the communication process. The higher the degree of change, the more obvious the situation of sentence brevity and incompleteness between sentences, the higher the complexity of the contextual relationship, and the larger the context scale, the higher the degree of subsequent attention required.

[0094] In an embodiment of the present invention, the product of the active substitution degree and the communication change degree of the communication sample data is used as the context scale of the communication sample data, reflecting that both the active substitution degree and the communication change degree are positively correlated with the context scale. In a specific implementation method of the embodiment of the present invention, the expression of the context scale is:

[0095] ; In the formula, Expressed as The context scale of the communication sample data, Expressed as One communication object in the communication sample data The initiative to speak, Expressed as Another communication object in the communication sample data The initiative to speak, Expressed as One communication object in the communication sample data A collection of speeches, Expressed as Another communication object in the communication sample data A collection of speeches, Represented as a communication object Communicate with The Jaccard similarity between the speech word sets, is expressed as a natural constant, It is represented as a preset adjustment coefficient, which is set to 0.001 in the embodiment of the present invention, and its purpose is to prevent the denominator from being zero, making the formula meaningless.

[0096] in, Expressed as The active replacement degree of the communication sample data is negatively correlated and normalized by an exponential function with a natural constant as the base. Expressed as The communication change degree of the communication sample data is negatively correlated in the form of inverse correlation. The greater the active substitution degree, the greater the communication change degree, which means that the active change degree of the speaker in the communication process is higher, the topic changes more frequently, the context relationship is more complex, and the degree of recognition error may be higher, so the context scale is higher.

[0097] At this point, the analysis of the context scale in the communication sample data is completed. Based on the context scale, the communication sample data is first clustered and divided, and the overall context structure in the communication process is classified to obtain sample clusters. In an embodiment of the present invention, the context scale can be used as a metric for clustering, and the communication sample data is clustered by the k-means clustering algorithm to obtain sample clusters with similar context scales. The clustering method is a technical means well known to those skilled in the art, and is not limited or elaborated here.

[0098] S3: In the prior sample set, based on the sentence length and word composition similarity between each two communication sentences, the communication sentences in the prior sample set are clustered to obtain sentence clusters; according to the distribution of the communication sentences in each sentence cluster in all sample clusters, the sentence readability of each sentence cluster is obtained.

[0099] When training on specific communication sentences, it is necessary to analyze the sentence situation more specifically. In some communication sentences, when the sentences are closer to the common conversation habits in daily conversations, even if the context is more complex, there is no need to pay too much attention to the interpretation. Therefore, the communication sentences are further analyzed and all communication sentences are clustered and divided according to the sentence structure.

[0100] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the sentence clusters can be found in Figure 5 , which shows a flow chart of a method for obtaining sentence clusters provided by an embodiment of the present invention, the method comprising the following steps:

[0101] S301: For any two different communication sentences, the structural similarity of the two communication sentences is obtained according to the similarity of the parts of speech of the words in the two communication sentences.

[0102] For two communication sentences, the closer the parts of speech of the constituent words are, the more similar the expression habits of the sentences are. For example, "I need manual customer service" has three parts of speech, "I" is a pronoun, "need" is a verb, "manual" and "customer service" are both nouns, and "good" has one part of speech, which is an adjective. Therefore, the similarity of the constituent structures is first reflected by the parts of speech.

[0103] Preferably, in an embodiment of the present invention, the number of types of parts of speech in which words appear in each communication sentence is taken as the structural type of each communication sentence, the largest structural type in the two communication sentences is taken as the maximum number of types of the two communication sentences, and the largest number of types in the two sentences is taken as the basis for comparison. The number of types of parts of speech in which words appear in both communication sentences is taken as the number of the same types in the two communication sentences, reflecting the common distribution of parts of speech in the sentences. For example, if nouns and verbs exist in both communication sentences, the number of the same types is 2.

[0104] The ratio of the number of the same types of the two communication sentences to the maximum number of types is further used as the structural similarity of the two communication sentences. The proportion of the number of the same types in the sentence with the most parts of speech reflects the similarity of the two communication sentences in terms of part of speech distribution.

[0105] S302: taking the character length in each communication sentence as the sentence length of each communication sentence; performing negative correlation mapping and normalization processing on the difference in sentence lengths of the two communication sentences to obtain the length similarity of the two communication sentences.

[0106] The similarity is further analyzed based on the length of the two communication sentences. The closer the lengths of the two communication sentences are, the closer the two communication sentences may be in expression habits. Therefore, in the embodiment of the present invention, the absolute values ​​of the difference in the sentence lengths of the two communication sentences are negatively correlated and normalized to obtain the length similarity, which reflects the similarity of the two communication sentences in character length.

[0107] S303: combining the structural similarity and length similarity of the two communication sentences to obtain similarity indexes of the two communication sentences; using the similarity indexes of every two communication sentences as a metric, clustering all communication sentences to obtain sentence clusters.

[0108] Finally, the structural similarity and length similarity of the two communication sentences are combined to reflect the similarity of the two communication sentences in terms of language expression habits. In the embodiment of the present invention, the product of the structural similarity and the length similarity is used as the similarity index of the two communication sentences. In other embodiments of the present invention, the sum of the structural similarity and the length similarity can also be used as the similarity index of the two communication sentences to comprehensively reflect the similarity, which will not be elaborated here.

[0109] In a specific method of an embodiment of the present invention, the expression of the similarity index is:

[0110] ; In the formula, Expressed as The communication sentence and Similarity index of communication sentences, Expressed as The length of each communication sentence, Expressed as The length of each communication sentence, Expressed as The communication sentence and The number of the same types of communication sentences, Expressed as The communication sentence and The maximum number of communication sentences. and Different. Among them, Expressed as The communication sentence and The length similarity of the communication sentences, Expressed as The communication sentence and The greater the length similarity and structural similarity, the more significant the similarity between the two communication sentences, and the greater the similarity index.

[0111] The similarity index can be used to characterize the degree of closeness between communication sentences, and clustering can be performed based on the similarity index. Therefore, in an embodiment of the present invention, the similarity index between communication sentences is used as a metric, and all communication sentences are clustered using the k-means clustering algorithm to obtain sentence clustering clusters. The implementer of the clustering algorithm can select one according to the specific implementation scenario, and no limitation or elaboration is made here.

[0112] At this point, the analysis of the expression habits represented by the communication sentences is completed, and the clustering of the communication sentences is obtained.

[0113] When the communication sentences in the sentence clustering cluster are distributed more concentratedly in the sample clustering cluster, it means that the expression habit of this sentence is a common habit in a certain context, and the situation that the sentence needs to be interpreted and paid attention to is low. On the contrary, when the communication sentences in the sentence clustering cluster are distributed more dispersedly in the sample clustering cluster, it means that the expression habit of this sentence is not very common, and it may have multiple characteristic information in different scenarios and needs to be paid attention to and further analyzed. Therefore, based on this distribution, the sentence clustering cluster is obtained to characterize the sentence readability of the communication sentence.

[0114] Preferably, in some possible implementation methods of the embodiments of the present invention, for any sentence clustering cluster, the distribution probability of the communication sentences in the sentence clustering cluster in each sample clustering cluster is obtained, that is, the proportion of the communication sentences in the sentence clustering cluster in each sample clustering cluster. The information entropy of the distribution probability of the communication sentences in the sentence clustering cluster in each sample clustering cluster is normalized as the sentence readability of the sentence clustering cluster. The uniformity of the distribution is reflected by the information entropy. When the information entropy is higher, it means that the distribution is more uniform and the dispersion of the sentences is significant. Therefore, the sentence readability is higher, reflecting the high degree of need for further reading.

[0115] In other embodiments of the present invention, the interquartile range may also be used to reflect the distribution uniformity of the distribution probability, which will not be elaborated here.

[0116] At this point, the degree of analysis of the sentence clusters that need further reading is completed, reflecting the degree to which the sentence expression habits can be analyzed.

[0117] S4: In the training sample set, obtain the context scale of each communication sample data; determine the sentence readability of each communication sentence according to the matching situation between each communication sentence and the sentence clustering cluster in the prior sample set; combine the sentence readability of each communication sentence and the context scale of the communication sample data to obtain the modified attention weight of each communication sentence in the training sample set.

[0118] Based on the analysis results of the prior sample set, the correction degree is obtained by matching each communication sentence in each communication sample data in the training sample set in the analysis results, and the weights of the samples participating in the training are adjusted to a certain extent. In the embodiment of the present invention, the context scale of the communication sample data in the training sample set is first obtained based on the method for obtaining the context scale of each communication sample data in the prior sample. The specific method is described in detail in step S2 and will not be repeated here.

[0119] For each communication sentence, the sentence readability is obtained by matching it with the clusters in the prior sample set. Preferably, in some possible implementation methods of the embodiments of the present invention, first, the central communication sentence of each sentence cluster in the prior sample set is obtained, and the central communication sentence can characterize the overall characteristics of the sentence cluster. In the embodiments of the present invention, for any sentence cluster in the prior sample set, the similarity index between each communication sentence in the sentence cluster and each other communication sentence is calculated and the average is obtained to obtain the characterization degree of each communication sentence, and the communication sentence with the largest characterization degree is used as the central communication cluster of the sentence cluster.

[0120] Furthermore, for any communication sentence in the training sample set, obtain the similarity index between the communication sentence and the central communication sentence of each sentence clustering cluster, and reflect the degree of matching through the similarity index. The calculation process of the similarity index is described in detail in the above step S3, which will not be repeated here. The sentence clustering cluster corresponding to the largest similarity index is used as the matching clustering cluster of the communication sentence. The largest similarity index reflects the best match. The sentence readability of the matching clustering cluster is used as the sentence readability of the communication sentence, reflecting the degree to which the communication sentence in the training sample set needs to be expanded and read. It should be noted that if there are multiple best matches, any sentence clustering cluster is selected as the matching clustering cluster. In other embodiments of the present invention, all the best matching sentence clustering clusters are also used as matching clustering clusters, and the average of the sentence readability of all matching clustering clusters is used as the sentence readability of the communication sentence.

[0121] After obtaining the sentence scale and sentence readability of each communication sentence in the training sample set, the two aspects are comprehensively reflected to reflect the degree to which the communication sentence needs further attention. In an embodiment of the present invention, the product of the sentence readability of each communication sentence in the training sample set and the sentence scale of the communication sample data where the communication sentence is located is used as the modified attention weight of each communication sentence in the training sample set.

[0122] At this point, each communication sentence in the training sample set is analyzed and matched with the prior sample set to obtain the modified attention weight of each communication sentence, so as to facilitate the subsequent regulation of the training process.

[0123] S5: Perform model training on the training sample set according to the modified attention weight to obtain an artificial intelligence model.

[0124] Before training the training sample set, the attention weights are analyzed through the self-attention mechanism. The specific process is as follows: (1) Each communication sample data in the training sample set is a sequence, and each communication sentence in the sequence is converted into an embedding vector. For each communication sentence in the sequence, the self-attention mechanism in the model calculates three vectors: query (Q), key (K), and value (V). These vectors are obtained by multiplying the input vector with three different weight matrices, which are randomly initialized, for example, using the random initialization function provided by deep learning frameworks such as PyTorch or TensorFlow. (2) For each communication sentence in the sequence, the model calculates the similarity between its query vector and the key vectors of all other sentences. For example, this can be achieved through dot product or additive attention. (3) The similarity calculation result will be scaled, for example, by dividing by the square root of the key vector dimension and then normalizing it through the softmax function to ensure that the sum of the attention weights of all communication sentences in the same communication sample data is 1. (4) The value vector is weighted summed using the normalized attention weights to obtain the output vector of each communication sentence. This output vector reflects the degree of "attention" of other communication statements in the sequence to this communication statement, which is the default attention weight of this communication statement.

[0125] The adjusted attention weight is obtained by multiplying the modified attention weight of each communication sentence by the attention weight, and then the adjusted attention weight of each communication sentence in the communication sample data is summed and normalized to obtain the final attention weight of each communication sentence. The artificial intelligence model is obtained by subsequent training based on the final attention weight. The subsequent training process is a well-known technical means familiar to technicians in this field and will not be elaborated here. By adjusting the distribution of attention weights, the learning effect of the model on spoken text is improved, and the versatility of the model is improved.

[0126] In summary, the present invention adds a priori sample set to analyze the situation that the weight of the sentence needs to be corrected in the training process of the communication sample data. First, according to the differences in the sentence composition between the communication objects and the differences in the speech association in the time sequence in the communication sample data in the prior sample set, the context scale is obtained, thereby reflecting the simplicity of the language habits of this communication process. For the communication sample data that needs to expand the analysis information, the greater the attention, further clustering is performed according to the context scale, and clustering and division of the communication sample data. Further, the structural composition analysis approximation between the communication sentences in the prior sample set is performed, and the sentence clustering clusters are obtained by clustering. Each sentence clustering cluster reflects the communication sentences with the same sentence structure. Through the distribution of each sentence clustering cluster in the sample clustering cluster, the context scale of the sentences with the same structure can be judged to determine the readability of the sentence and reflect the special degree of the sentence structure. After completing the analysis of the prior sample set, when each communication sentence is identified and analyzed in the training sample set, the sentence readability is obtained by obtaining the context scale and matching it with the sentence clustering cluster. The degree of attention of each communication sentence during training is corrected in combination with the context scale and sentence readability to obtain a better intelligent model. The present invention uses a priori sample sets to perform a combined analysis of context and sentences in communication, and corrects the attention level of each communication sentence in the training process, making the training process more reliable and the obtained model better.

[0127] The present invention also provides a training system for an artificial intelligence model. Figure 6 , which shows a structural diagram of an artificial intelligence model training system provided by an embodiment of the present invention, the system 600 includes: a sample data acquisition module 601, a priori sample context analysis module 602, a priori sample sentence analysis module 603, a training sample supervision module 604 and a training module 605.

[0128] The sample data acquisition module 601 is used to acquire communication sample data of a plurality of communication processes, each communication sample data includes a communication sentence of each speech of two communication objects in a communication process; all communication sample data are divided into a training sample set and a priori sample set;

[0129] The prior sample context analysis module 602 is used to obtain the context scale of each communication sample data in the prior sample set according to the composition differences between the communication sentences of the two communication objects in all corresponding speeches and the differences between the degrees of correlation between the speeches in time sequence; cluster the communication sample data in the prior sample set based on the context scale to obtain sample clusters;

[0130] The prior sample sentence analysis module 603 is used to cluster the communication sentences in the prior sample set based on the sentence length and word composition approximation between each two communication sentences to obtain sentence clusters; and obtain the sentence readability of each sentence cluster according to the distribution of the communication sentences in each sentence cluster among all sample clusters;

[0131] The training sample supervision module 604 is used to obtain the context scale of each communication sample data in the training sample set; determine the sentence readability of each communication sentence according to the matching of each communication sentence with the sentence clustering cluster in the prior sample set; and obtain the modified attention weight of each communication sentence in the training sample set by combining the sentence readability of each communication sentence and the context scale of the communication sample data;

[0132] The training module 605 is used to perform model training on the training sample set according to the modified attention weight to obtain an artificial intelligence model.

[0133] It should be noted that the system provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. Since the specific implementation process of the training system of an artificial intelligence model in this embodiment is the same as the specific implementation process of the training method of an artificial intelligence model in the above embodiment, it will not be described in detail here.

[0134] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0135] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

Claims

1. A training method for an artificial intelligence model, characterized in that: The method comprises: Acquire communication sample data of a number of communication processes, each communication sample data includes a communication sentence spoken by two communication objects each time during a communication process; divide all communication sample data into a training sample set and a priori sample set; In each communication sample data in the prior sample set, the context scale of each communication sample data is obtained according to the composition differences between the communication sentences of the two communication objects in all corresponding speeches, and the differences between the degrees of correlation between speeches in time sequence; the communication sample data in the prior sample set are clustered based on the context scale to obtain sample clusters; In the prior sample set, based on the sentence length and word composition approximation between each two communication sentences, the communication sentences in the prior sample set are clustered to obtain sentence clusters; according to the distribution of the communication sentences in each sentence cluster among all sample clusters, the sentence readability of each sentence cluster is obtained; In the training sample set, the context scale of each communication sample data is obtained; the sentence readability of each communication sentence is determined according to the matching of each communication sentence with the sentence clustering cluster in the prior sample set; the modified attention weight of each communication sentence in the training sample set is obtained by combining the sentence readability of each communication sentence with the context scale of the communication sample data; The model is trained on the training sample set according to the modified attention weight to obtain the artificial intelligence model.

2. The training method of an artificial intelligence model according to claim 1, characterized in that: The method for obtaining the context scale includes: For any communication sample data in the prior sample set, the autonomy of each communication object in each speech is obtained by comparing the word composition of each speech of each communication object in the communication sample data with the previous and next speeches in time sequence; the initiative of each communication object in speaking is obtained by combining the autonomy of all speeches of each communication object; According to the approximate situation of the speaking initiative of two communication objects in the communication sample data, the active replacement degree of the communication sample data is obtained; According to the difference in word distribution of two communication objects in all speeches in the communication sample data, obtaining the communication variation degree of the communication sample data; The context scale of the communication sample data is obtained by combining the active substitution degree and communication change degree of the communication sample data; both the active substitution degree and the communication change degree are positively correlated with the context scale.

3. The training method of an artificial intelligence model according to claim 2, characterized in that: The step of obtaining the autonomy of each communication object in each speech by correlating each speech of each communication object in the communication sample data with the previous and next speeches in time sequence in terms of word composition includes: For any speech of each communication object, the previous speech of the speech in the time sequence is regarded as the preceding speech of the speech, and the next speech of the speech in the time sequence is regarded as the succeeding speech of the speech; if the succeeding speech of the speech does not exist, the autonomy of the speech is the preset autonomy; Obtaining a text vector of a speech; taking the similarity between the text vector of the speech and the previous speech as the previous association of the speech; taking the similarity between the text vector of the speech and the subsequent speech as the subsequent association of the speech; When there is a previous statement and the previous correlation is not zero, the ratio of the subsequent correlation of the statement to the previous correlation is normalized to obtain the previous and next correlation of the statement; otherwise, the subsequent correlation of the statement is normalized to obtain the previous and next correlation of the statement; The total number of all words in the subsequent speech is taken as the number of words in the subsequent speech; the total number of words in the subsequent speech that are interjections is counted as the number of exclamations in the subsequent speech; the ratio of the number of exclamations in the subsequent speech to the number of words is taken as the subsequent exclamation relevance of the speech; The autonomy of the speech is obtained by combining the contextual relevance and subsequent interjection relevance of the speech; both contextual relevance and subsequent interjection relevance are positively correlated with autonomy.

4. The training method of an artificial intelligence model according to claim 2, characterized in that: The method for obtaining the communication change degree includes: Among all the speeches of each communication object in the communication sample data, words that are nouns, pronouns, and adjectives are grouped into a set as the speech word set of each communication object; The Jaccard similarity between the speech word sets of two communication objects in the communication sample data is calculated and negative correlation mapping is performed to obtain the communication change degree of the communication sample data.

5. The training method of an artificial intelligence model according to claim 1, characterized in that: The method for obtaining the sentence clustering clusters includes: For any two different communication sentences, the structural similarity of the two communication sentences is obtained according to the similarity of the word parts of speech in the two communication sentences; The character length in each communication sentence is used as the sentence length of each communication sentence; the difference between the sentence lengths of the two communication sentences is negatively correlated and normalized to obtain the length similarity of the two communication sentences; The structural similarity and length similarity of the two communication sentences are combined to obtain similarity indexes of the two communication sentences; the similarity indexes of every two communication sentences are used as a metric to cluster all communication sentences to obtain sentence clusters.

6. The training method of an artificial intelligence model according to claim 5, characterized in that: The method for obtaining the structural similarity includes: The number of types of parts of speech in which words appear in each communication sentence is taken as the structural type of each communication sentence; The largest structural type in the two communication sentences is taken as the maximum number of types of the two communication sentences; the number of types of parts of speech that appear in both words in the two communication sentences is taken as the number of the same types of the two communication sentences; The ratio of the number of the same categories of the two communication sentences to the maximum number of categories is used as the structural similarity of the two communication sentences.

7. The training method of an artificial intelligence model according to claim 1, characterized in that: The obtaining of the sentence readability of each sentence cluster according to the distribution of the communication sentences in each sentence cluster in all sample clusters includes: For any sentence cluster, obtain the distribution probability of the communication sentences in the sentence cluster in each sample cluster; The information entropy of the distribution probability of the communication sentences in the sentence cluster in each sample cluster is normalized and used as the sentence readability of the sentence cluster.

8. The method for training an artificial intelligence model according to claim 5, characterized in that: The determining of the readability of each communication statement according to the matching of each communication statement with the statement clustering cluster in the prior sample set includes: Obtain the central communication sentence of each sentence cluster in the prior sample set; For any communication sentence in the training sample set, obtain the similarity index between the communication sentence and each central communication sentence; take the sentence cluster corresponding to the largest similarity index as the matching cluster of the communication sentence; The sentence readability of the matching cluster is taken as the sentence readability of the communication sentence.

9. The training method of an artificial intelligence model according to claim 1, characterized in that: The method for obtaining the modified attention weight includes: The product of the sentence readability of each communication sentence in the training sample set and the context scale of the communication sample data in which the communication sentence is located is used as the modified attention weight of each communication sentence in the training sample set.

10. A training system for an artificial intelligence model, characterized in that: The system comprises: The sample data acquisition module is used to acquire communication sample data of a number of communication processes, each communication sample data includes the communication sentences of each speech of two communication objects in a communication process; all communication sample data are divided into a training sample set and a priori sample set; The prior sample context analysis module is used to obtain the context scale of each communication sample data in the prior sample set according to the composition differences between the communication sentences of the two communication objects in all corresponding speeches and the differences between the degrees of correlation between the speeches in time sequence; cluster the communication sample data in the prior sample set based on the context scale to obtain sample clusters; The prior sample sentence analysis module is used to cluster the communication sentences in the prior sample set based on the sentence length and word composition approximation between each two communication sentences to obtain sentence clusters; and obtain the sentence readability of each sentence cluster according to the distribution of the communication sentences in each sentence cluster among all sample clusters; The training sample supervision module is used to obtain the context scale of each communication sample data in the training sample set; determine the sentence readability of each communication sentence according to the matching of each communication sentence with the sentence clustering cluster in the prior sample set; and obtain the modified attention weight of each communication sentence in the training sample set by combining the sentence readability of each communication sentence with the context scale of the communication sample data; The training module is used to perform model training on the training sample set according to the modified attention weight to obtain an artificial intelligence model.

Citation Information

Patent Citations

  • Data enhancement method and device, electronic equipment and storage medium

    CN114595327A

  • Word replacement method and device, equipment and medium

    CN116151230A

  • Apparatus for Evaluating and Improving Response, Method and Computer Readable Recording Medium Thereof

    US20230229864A1

  • Data enhancement method and apparatus, electronic device, and storage medium

    WO2023159758A1