A subject recognition model training method, a conversation subject recognition method and device

By combining current and historical conversation data through multi-task training and optimizing the model using cross-entropy and binary cross-entropy loss functions, the problems of topic recognition accuracy and switching judgment in intelligent question-answering robots are solved, thereby improving the accuracy of the model and the user experience.

CN115357713BActive Publication Date: 2026-01-27CHENGDU MEIERBEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210942412.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-08
Publication Date
2026-01-27
Estimated Expiration
2042-08-08

AI Technical Summary

Technical Problem

Existing technologies in intelligent question-answering robots suffer from poor accuracy in topic recognition, weak generalization ability, difficulty in effectively utilizing historical conversation information, and inability to accurately determine whether the conversation topic has changed.

Method used

A multi-task training method is adopted, combining current conversation and historical conversation data. Through semantic representation model and classifier, the model is optimized using cross-entropy and binary cross-entropy loss functions to train topic recognition and topic switching judgment models.

Benefits of technology

It improves the accuracy of topic recognition models and the accuracy of topic switching judgments, enhances the communication efficiency between intelligent question answering robots and users, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115357713B_ABST
    Figure CN115357713B_ABST
Patent Text Reader

Abstract

The application discloses a subject recognition model training method, a conversation subject recognition method and device. The training method comprises the following steps: obtaining current conversation corpus and historical conversation corpus and inputting the current conversation corpus and the historical conversation corpus into a semantic representation model respectively to obtain current semantic representation vectors and historical semantic representation vectors output by the semantic representation model; splicing the current semantic representation vectors and the historical semantic representation vectors to obtain a spliced vector; inputting the spliced vector into a first classifier to obtain output subject recognition prediction probability; inputting the spliced vector into a second classifier to obtain output subject switching judgment prediction probability; constructing a first loss function of the subject recognition prediction probability; constructing a second loss function of the subject switching judgment prediction probability; and optimizing the first loss function and the second loss function until the model training is successful. The application adopts a multi-task training mode to perform model training, thereby effectively improving the accuracy of the subject recognition model and the subject judgment model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of semantic recognition technology, and in particular to a topic recognition model training method, a conversation topic recognition method and apparatus. Background Technology

[0002] In the field of intelligent question answering, the accuracy of topic recognition is crucial. In the actual operation of a question-answering robot, accurately combining topic information can significantly improve the semantic understanding capability of the intelligent question-answering system, enabling it to provide more precise answers. This effectively enhances the communication efficiency between the intelligent question-answering robot and customers, and improves the user experience.

[0003] The relevant topic recognition technologies can be summarized into the following two methods: 1. Topic judgment based on proper nouns, keywords, and entity names; 2. Preprocessing the short text input by customers in intelligent customer service conversations, extracting the corresponding text features, and inputting them into a trained text classifier to obtain the corresponding topic recognition results.

[0004] With the rapid development of artificial intelligence technology, deep learning, transfer learning, and other technologies have been widely applied in industry, and semantic recognition technology is constantly being innovated, achieving increasingly significant results in practical applications. However, the aforementioned technologies exhibit the following shortcomings: 1. Topic recognition methods based on keyword and feature extraction have poor accuracy, poor generalization ability, and high maintenance difficulty; 2. When performing topic recognition, only the current sentence information sent by the customer is used, without effectively utilizing the preceding context; 3. The accuracy rate of topic recognition is low; 4. During the conversation between the intelligent question-answering robot and the customer, the topic of the content expressed by the customer may change. Accurately determining whether the conversation topic needs to be switched is also a key factor affecting the accuracy of topic recognition. The aforementioned technologies have not considered this issue. Summary of the Invention

[0005] This application provides a method for training a topic recognition model, including:

[0006] Obtain current and historical conversation data;

[0007] The current conversation corpus and the historical conversation corpus are respectively input into the semantic representation model to obtain the current semantic representation vector corresponding to the current conversation corpus and the historical semantic representation vector corresponding to the historical conversation corpus output by the semantic representation model.

[0008] The current semantic representation vector and the historical semantic representation vector are concatenated to obtain a concatenated vector;

[0009] The concatenated vector is input into the first classifier to obtain the topic recognition prediction probability output by the first classifier;

[0010] The concatenated vector is input into the second classifier to obtain the topic switching prediction probability output by the second classifier;

[0011] A first loss function for predicting the topic recognition probability is constructed based on the cross-entropy loss function;

[0012] A second loss function for predicting the probability of topic switching is constructed based on a binary cross function;

[0013] The first loss function and the second loss function are optimized until the semantic representation model, the first classifier, and the second classifier are successfully trained.

[0014] In some embodiments, optimizing the first loss function and the second loss function includes:

[0015] Calculate the first loss value of the first loss function, and calculate the second loss value of the second loss function;

[0016] The parameters of the semantic representation model are adjusted based on the first loss value and the second loss value until the semantic representation model, the first classifier, and the second classifier converge.

[0017] In some embodiments, the method further includes:

[0018] When the number of historical statements in the historical conversation corpus is zero, the historical semantic representation vector is set to zero;

[0019] When the number of historical statements in the historical conversation corpus is not zero, the historical statements are concatenated in sequence.

[0020] In some embodiments, the topic recognition prediction probability is obtained through the softmax function in the first classifier, and the formula for the softmax function is as follows:

[0021] y1' = softmax(w1 v);

[0022] Where y1' represents the topic recognition prediction probability, w1 represents the learnable parameters in the first classifier, and V represents the concatenated vector.

[0023] In some embodiments, the predicted probability of topic switching is obtained by using the sigmoid function in the second classifier. The formula for the sigmoid function is as follows:

[0024] y2' = sigmoid(w2 v);

[0025] Where y2' represents the prediction probability of topic switching judgment, w2 represents the learnable parameters in the second classifier, and V represents the concatenation vector.

[0026] In some embodiments, the formula for the first loss function of the topic identification prediction probability is as follows:

[0027] L1=-∑[y1log(y1')+(1-y1)log(1-y1')];

[0028] Where L1 represents the first loss function, y1' represents the topic recognition prediction probability, and y1 represents the true label of the labeled topic classification.

[0029] In some embodiments, the formula for the second loss function used to determine the prediction probability of topic switching is as follows:

[0030] L2 = -∑y2log(y2');

[0031] Where L2 represents the second loss function, y2' represents the prediction probability of topic switching judgment, and y2 represents the true label of whether the labeled topic has switched.

[0032] This application also provides a method for identifying conversation topics, including:

[0033] Obtain conversation information entered by the user during the conversation;

[0034] The conversation information is input into the trained topic recognition model to obtain topic recognition results, wherein the topic recognition model is trained based on the topic recognition model training method described above.

[0035] This application embodiment also provides a topic recognition model training device, including:

[0036] The acquisition unit is configured to acquire the current and historical speech data.

[0037] The first input unit is configured to input the current conversation data and the historical conversation data into the semantic representation model respectively, and obtain the current semantic representation vector corresponding to the current conversation data and the historical semantic representation vector corresponding to the historical conversation data output by the semantic representation model.

[0038] The vector concatenation unit is configured to concatenate the current semantic representation vector and the historical semantic representation vector to obtain a concatenated vector;

[0039] The second input unit is configured to input the concatenated vector into the first classifier to obtain the topic recognition prediction probability output by the first classifier;

[0040] The third input unit is configured to input the concatenated vector into the second classifier to obtain the topic switching judgment prediction probability output by the second classifier;

[0041] The first loss function construction unit is configured to construct a first loss function based on the cross-entropy loss function to predict the topic recognition probability.

[0042] The second loss function construction unit is configured to construct a second loss function based on the binary cross function to predict the topic switching probability.

[0043] The optimization unit is configured to optimize the first loss function and the second loss function until the semantic representation model, the first classifier, and the second classifier are successfully trained.

[0044] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.

[0045] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor executes the computer program to implement the method described above.

[0046] The embodiments of this application adopt the following technical solutions:

[0047] Obtain the current conversation corpus and historical conversation corpus; input the current conversation corpus and the historical conversation corpus into the semantic representation model respectively to obtain the current semantic representation vector corresponding to the current conversation corpus and the historical semantic representation vector corresponding to the historical conversation corpus output by the semantic representation model; concatenate the current semantic representation vector and the historical semantic representation vector to obtain the concatenated vector; input the concatenated vector into the first classifier to obtain the topic recognition prediction probability output by the first classifier; input the concatenated vector into the second classifier to obtain the topic switching judgment prediction probability output by the second classifier; construct a first loss function for the topic recognition prediction probability based on the cross-entropy loss function; construct a second loss function for the topic switching judgment prediction probability based on the binary cross function; optimize the first loss function and the second loss function until the semantic representation model, the first classifier, and the second classifier are successfully trained. Input the user's conversation information during the conversation into the trained topic recognition model to obtain the topic recognition result.

[0048] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects:

[0049] In the training process of the topic recognition model, more historical sentence information is effectively utilized. On the basis of the topic recognition task, a topic switching judgment task is added for joint training. The label information between the two tasks will influence and promote each other. By adopting this multi-task training method, the accuracy of the topic recognition model and the topic judgment model can be effectively improved. Attached Figure Description

[0050] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0051] Figure 1 A flowchart of a topic recognition model training method is provided in this application embodiment;

[0052] Figure 2 A flowchart of a conversation topic identification method is provided in this application embodiment;

[0053] Figure 3 This application provides a schematic diagram of the structure of a topic recognition model training device.

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

[0055] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0056] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0057] Example 1

[0058] like Figure 1 As shown in the embodiment of this application, a method for training a topic recognition model is provided, including:

[0059] S101. Obtain the current conversation data and historical conversation data.

[0060] Optionally, the application scenario of this application embodiment can be in the field of intelligent question answering, such as the medical aesthetics field, and the conversation topics can include words such as hair transplant, double eyelid surgery, rhinoplasty, orthodontics, and breast augmentation. This application embodiment does not limit this.

[0061] S102. Input the current conversation data and the historical conversation data into the semantic representation model respectively to obtain the current semantic representation vector corresponding to the current conversation data and the historical semantic representation vector corresponding to the historical conversation data output by the semantic representation model.

[0062] Optionally, the semantic representation model can be a semantic representation model based on BERT embedding.

[0063] The word sequence of the current statement in the current corpus is represented as: w c =(w c1 ,...,w ci ,...,w cn The word sequence of historical statements in historical discourse corpora is represented as: w h =(w h1 ,...,w hj ,...,w hm ), where w ci w represents the i-th word in the current sentence. hj This represents the j-th word in the concatenated historical statement, where n and m represent the number of words in the current statement and the concatenated historical statement, respectively.

[0064] The two word sequences are then input into the BERT-based semantic representation model to obtain the current semantic representation vector v. c =BERT(w hj ), i∈[1,n], and historical semantic representation vector v h =BERT(w hj ), j∈[1,m].

[0065] S103. The current semantic representation vector and the historical semantic representation vector are concatenated to obtain a concatenated vector.

[0066] S104. Input the concatenated vector into the first classifier to obtain the topic recognition prediction probability output by the first classifier.

[0067] S105. Input the concatenated vector into the second classifier to obtain the topic switching prediction probability output by the second classifier.

[0068] Based on the effective use of more historical sentence information, this application embodiment adds a topic switching judgment task for joint training of the topic recognition task. The label information between the two tasks will influence and promote each other. By adopting this multi-task training method to train the topic recognition model, the accuracy of the topic recognition model and the topic judgment model can be effectively improved.

[0069] If the topic switching judgment indicates that the current statement has switched topics relative to historical statements, then the topic recognition model should focus more on the current statement. Otherwise, it should pay more attention to historical statements, especially when the information in the current statement is unclear. Information from historical statements can help determine the topic expressed by the current statement. On the other hand, in multi-task learning, if a topic switch occurs, providing the target topic (the true label of the topic recognition) simultaneously helps the topic switching model learn deeper internal judgment logic.

[0070] S106. Construct the first loss function for the predicted probability of topic recognition based on the cross-entropy loss function.

[0071] S107. Construct a second loss function for predicting the topic switching probability based on a binary cross function.

[0072] S108. Optimize the first loss function and the second loss function until the semantic representation model, the first classifier, and the second classifier are successfully trained.

[0073] In some embodiments, optimizing the first loss function and the second loss function includes:

[0074] Calculate the first loss value of the first loss function, and calculate the second loss value of the second loss function;

[0075] The parameters of the semantic representation model are adjusted based on the first loss value and the second loss value until the semantic representation model, the first classifier, and the second classifier converge.

[0076] In some embodiments, the topic recognition model training method further includes:

[0077] When the number of historical statements in the historical conversation corpus is zero, the historical semantic representation vector is set to zero;

[0078] When the number of historical statements in the historical conversation corpus is not zero, the historical statements are concatenated in sequence.

[0079] In some embodiments, the topic recognition prediction probability is obtained through the softmax function in the first classifier, and the formula for the softmax function is as follows:

[0080] y1' = softmax(w1 v);

[0081] Where y1' represents the topic recognition prediction probability, w1 represents the learnable parameters in the first classifier, and V represents the concatenated vector.

[0082] In some embodiments, the predicted probability of topic switching is obtained by using the sigmoid function in the second classifier. The formula for the sigmoid function is as follows:

[0083] y2' = sigmoid(w2 v);

[0084] Where y2' represents the prediction probability of topic switching judgment, w2 represents the learnable parameters in the second classifier, and V represents the concatenation vector.

[0085] In some embodiments, the formula for the first loss function of the topic identification prediction probability is as follows:

[0086] L1=-∑[y1log(y1')+(1-y1)log(1-y1')];

[0087] Where L1 represents the first loss function, y1' represents the topic recognition prediction probability, and y1 represents the true label of the labeled topic classification.

[0088] In some embodiments, the formula for the second loss function used to determine the prediction probability of topic switching is as follows:

[0089] L2 = -∑y2log(y2');

[0090] Where L2 represents the second loss function, y2' represents the prediction probability of topic switching judgment, and y2 represents the true label of whether the labeled topic has switched.

[0091] In this embodiment, more historical sentence information is effectively utilized during the training of the topic recognition model. A topic judgment task is added to the topic recognition task for joint training. The label information between the two tasks will influence and promote each other. By adopting this multi-task training method for model training, the accuracy of the topic recognition model and the topic judgment model can be effectively improved.

[0092] Example 2

[0093] like Figure 2 As shown in the embodiments of this application, a method for identifying conversation topics is also provided, including:

[0094] S201. Obtain the session information entered by the user during the session;

[0095] S202. Input the conversation information into the trained topic recognition model to obtain the topic recognition result, wherein the topic recognition model is trained based on the topic recognition model training method described above.

[0096] This application's embodiments perform information retrieval based on the contextual understanding of the conversation, thereby effectively utilizing the preceding information and achieving intelligent search. It effectively utilizes more historical information and employs multi-task training, with topic recognition and topic switching judgment tasks influencing each other, ensuring that both tasks contribute to more accurate model training. The topic switching judgment task proposed in this application's embodiments, when applied to the field of intelligent question answering, allows the intelligent question answering robot to react promptly and accurately when the conversation topic changes, answering user questions, improving topic recognition accuracy, and thus enhancing the user experience.

[0097] Example 3

[0098] like Figure 3 As shown in the illustration, this application also provides a topic recognition model training device, comprising:

[0099] Acquisition unit 31 is configured to acquire the current speech data and the historical speech data;

[0100] The first input unit 32 is configured to input the current conversation data and the historical conversation data into the semantic representation model respectively, and obtain the current semantic representation vector corresponding to the current conversation data and the historical semantic representation vector corresponding to the historical conversation data output by the semantic representation model.

[0101] The vector concatenation unit 33 is configured to concatenate the current semantic representation vector and the historical semantic representation vector to obtain a concatenated vector;

[0102] The second input unit 34 is configured to input the concatenated vector into the first classifier to obtain the topic recognition prediction probability output by the first classifier.

[0103] The third input unit 35 is configured to input the concatenated vector into the second classifier to obtain the topic switching judgment prediction probability output by the second classifier;

[0104] The first loss function construction unit 36 ​​is configured to construct a first loss function based on the cross-entropy loss function to predict the topic recognition probability.

[0105] The second loss function construction unit 37 is configured to construct a second loss function based on the binary cross function to predict the topic switching judgment probability.

[0106] The optimization unit 38 is configured to optimize the first loss function and the second loss function until the semantic representation model, the first classifier and the second classifier are successfully trained.

[0107] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0108] Therefore, this application also proposes a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the methods described in any embodiment of this application.

[0109] Furthermore, this application also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in any embodiment of this application.

[0110] Example 4

[0111] This application provides an electronic device. Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment Six of this application. Figure 4 As shown, this embodiment provides an electronic device 400, which includes: one or more processors 420; and a storage device 410 for storing one or more programs. When the one or more programs are run by the one or more processors 420, the one or more processors 420 implement the topic recognition model training method provided in this application embodiment. The method includes:

[0112] Obtain current and historical conversation data;

[0113] The current conversation corpus and the historical conversation corpus are respectively input into the semantic representation model to obtain the current semantic representation vector corresponding to the current conversation corpus and the historical semantic representation vector corresponding to the historical conversation corpus output by the semantic representation model.

[0114] The current semantic representation vector and the historical semantic representation vector are concatenated to obtain a concatenated vector;

[0115] The concatenated vector is input into the first classifier to obtain the topic recognition prediction probability output by the first classifier;

[0116] The concatenated vector is input into the second classifier to obtain the topic switching prediction probability output by the second classifier;

[0117] A first loss function for predicting the topic recognition probability is constructed based on the cross-entropy loss function;

[0118] A second loss function for predicting the probability of topic switching is constructed based on a binary cross function;

[0119] The first loss function and the second loss function are optimized until the semantic representation model, the first classifier, and the second classifier are successfully trained.

[0120] Figure 4 The electronic device 400 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0121] like Figure 4 As shown, the electronic device 400 includes a processor 420, a storage device 410, an input device 430, and an output device 440; the number of processors 420 in the electronic device can be one or more. Figure 4 Taking a processor 420 as an example; the processor 420, storage device 410, input device 430, and output device 440 in the electronic device can be connected via a bus or other means. Figure 4 For example, China and Israel are connected via bus 450.

[0122] Storage device 410, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and module units, such as the program instructions corresponding to the cloud bottom height determination method in the embodiments of this application.

[0123] Storage device 410 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, storage device 410 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory, or other non-volatile solid-state storage device. In some instances, storage device 410 may further include memory remotely located relative to processor 420, which can be connected via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0124] Input device 430 can be used to receive input digital, character, or voice information, and to generate key signal inputs related to user settings and function control of the electronic device. Output device 440 may include electronic devices such as a display screen and a speaker.

[0125] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0126] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0127] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0128] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0129] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0130] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, 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 technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0131] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0132] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for training a topic recognition model, characterized in that, include: Obtain current and historical conversation data; The current conversation corpus and the historical conversation corpus are respectively input into the semantic representation model to obtain the current semantic representation vector corresponding to the current conversation corpus and the historical semantic representation vector corresponding to the historical conversation corpus output by the semantic representation model. The current semantic representation vector and the historical semantic representation vector are concatenated to obtain a concatenated vector; The concatenated vector is input into the first classifier to obtain the topic recognition prediction probability output by the first classifier; The concatenated vector is input into the second classifier to obtain the topic switching prediction probability output by the second classifier; A first loss function for predicting the topic recognition probability is constructed based on the cross-entropy loss function; A second loss function for predicting the probability of topic switching is constructed based on a binary cross function; The first loss function and the second loss function are optimized until the semantic representation model, the first classifier, and the second classifier are successfully trained.

2. The topic recognition model training method according to claim 1, characterized in that, Optimization of the first and second loss functions includes: Calculate the first loss value of the first loss function, and calculate the second loss value of the second loss function; The parameters of the semantic representation model are adjusted based on the first loss value and the second loss value until the semantic representation model, the first classifier, and the second classifier converge.

3. The topic recognition model training method according to claim 1, characterized in that, The method further includes: When the number of historical statements in the historical conversation corpus is zero, the historical semantic representation vector is set to zero; When the number of historical statements in the historical conversation corpus is not zero, the historical statements are concatenated in sequence.

4. The topic recognition model training method according to claim 1, characterized in that, The topic recognition prediction probability is obtained by using the softmax function in the first classifier, and the formula for the softmax function is as follows: y1' = softmax(w1v); Where y1' represents the topic recognition prediction probability, w1 represents the learnable parameters in the first classifier, and V represents the concatenated vector.

5. The topic recognition model training method according to claim 1, characterized in that, The prediction probability of topic switching is obtained by using the sigmoid function in the second classifier. The formula for the sigmoid function is as follows: y2' = sigmoid(w2v); Where y2' represents the prediction probability of topic switching judgment, w2 represents the learnable parameters in the second classifier, and V represents the concatenation vector.

6. The topic recognition model training method according to claim 1, characterized in that, The formula for the first loss function of the topic recognition prediction probability is as follows: L1=-∑[y1log(y1')+(1-y1)log(1-y1')]; Where L1 represents the first loss function, y1' represents the topic recognition prediction probability, and y1 represents the true label of the labeled topic classification.

7. The topic recognition model training method according to claim 1, characterized in that, The formula for the second loss function used to determine the prediction probability of topic switching is as follows: L2 = -∑y2log(y2'); Where L2 represents the second loss function, y2' represents the prediction probability of topic switching judgment, and y2 represents the true label of whether the labeled topic has switched.

8. A method for identifying conversation topics, characterized in that, include: Obtain conversation information entered by the user during the conversation; The session information is input into the trained topic recognition model to obtain topic recognition results, wherein the topic recognition model is trained based on the topic recognition model training method according to any one of claims 1 to 7.

9. A topic recognition model training device, characterized in that, include: The acquisition unit is configured to acquire the current and historical speech data. The first input unit is configured to input the current conversation data and the historical conversation data into the semantic representation model respectively, and obtain the current semantic representation vector corresponding to the current conversation data and the historical semantic representation vector corresponding to the historical conversation data output by the semantic representation model. The vector concatenation unit is configured to concatenate the current semantic representation vector and the historical semantic representation vector to obtain a concatenated vector; The second input unit is configured to input the concatenated vector into the first classifier to obtain the topic recognition prediction probability output by the first classifier; The third input unit is configured to input the concatenated vector into the second classifier to obtain the topic switching judgment prediction probability output by the second classifier; The first loss function construction unit is configured to construct a first loss function based on the cross-entropy loss function to predict the topic recognition probability. The second loss function construction unit is configured to construct a second loss function based on the binary cross function to predict the topic switching judgment probability. The optimization unit is configured to optimize the first loss function and the second loss function until the semantic representation model, the first classifier, and the second classifier are successfully trained.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 7, or claim 8.

11. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7, or claim 8.

Citation Information

Patent Citations

  • News recommendation method and topic characterization method based on RNN and attention mechanism

    CN109492157A

  • Text recognition model training method, text recognition method and related device

    CN114626551A