Sentence quality inspection method, device, equipment and storage medium based on federated learning
Through the federated learning method, multi-party network model gradients are aggregated to generate a federated quality inspection model, which solves the problem of long preparation time and inaccuracy in the early stage of statement quality inspection, achieves faster and more accurate quality inspection, and protects the security of data of all parties. sex.
Patent Information
- Application Number
- CN202010206524.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-20
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-03-20
AI Technical Summary
In the existing technology, the preliminary preparation time for sentence quality inspection is long, and the quality inspection is inaccurate. This is mainly because the quality inspection standard data of different business parties cannot be shared, resulting in a long preparation time for labeling sample data and incomplete annotation.
Using a method based on federated learning, a federated quality inspection model is generated through the gradient aggregation of network models at the first terminal and the second terminal, which is used to conduct quality inspection of the sentences to be inspected, avoiding the time of labeling a large number of samples in the early stage by all parties, and through joint Multi-party data training improves quality inspection accuracy.
It shortens the preliminary preparation time for quality inspection, improves the accuracy of quality inspection, and ensures the security and privacy protection of data of all parties.
Smart Images

Figure CN111428265B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular to a sentence quality inspection method, device, equipment and storage medium based on federated learning. Background Art
[0002] With the continuous development of financial technology (Fintech), especially Internet technology finance, more and more technologies (such as artificial intelligence, big data, cloud storage, etc.) are being applied in the financial field, but the financial field also puts forward higher requirements for various technologies, such as requiring more comprehensive and accurate sentence quality inspection.
[0003] Currently, the services provided by human agents are spread across all aspects of life. The service statements of human agents can be used to reflect the operational risks of the service platform from the side. The more standardized the service statements of human agents are, the lower the operational risks of the service platform are. However, the less standardized the service statements of human agents are, and the more statements involving terrorism and violence are used, the higher the operational risks of the service platform are. Therefore, accurate quality inspection of service statements of human agents is conducive to analyzing the risks of platform operations.
[0004] With the development of artificial intelligence technology, sentence quality inspection has also changed from traditional manual sampling inspection to intelligent model quality inspection. However, the quality inspection effect of the intelligent model depends largely on the number and quality of the examples annotated for quality inspection. Due to the need for data security and privacy protection, the quality inspection standard data of different business parties cannot be shared. As a result, different business parties need to spend a lot of time to annotate a large amount of sample data for training models, and the preparation time for quality inspection is long. Moreover, even if all business parties perform annotation, the sentences in life vary greatly and are difficult to be fully annotated, which makes the intelligent model inaccurate due to incomplete annotation during the quality inspection process.
[0005] Therefore, how to shorten the preparation time before quality inspection and improve the accuracy of quality inspection are technical problems that need to be solved urgently. Summary of the invention
[0006] The main purpose of the present invention is to provide a sentence quality inspection method, device, equipment and storage medium based on federated learning, aiming to solve the technical problems of long preparation time and inaccurate quality inspection in the prior art.
[0007] To achieve the above object, the present invention provides a sentence quality inspection method based on federated learning, and the sentence quality inspection method based on federated learning comprises the following steps:
[0008] The first terminal trains a first network model corresponding to the first terminal according to the acquired quality inspection example sentence;
[0009] Transmitting a first model gradient obtained by training the first network model to a federal server, wherein the federal server receives the first model gradient and a second model gradient sent by at least one second terminal, and the federal server aggregates the first model gradient and the second model gradient to generate a backhaul gradient;
[0010] The first terminal receives the feedback gradient sent by the federation server, trains the first network model based on the feedback gradient, generates a federation quality inspection model, and calls the federation quality inspection model to perform quality inspection on the received sentence to be quality inspected.
[0011] Optionally, before the step of training, by the first terminal, a first network model corresponding to the first terminal according to the acquired quality inspection example sentence, the method further includes:
[0012] Acquire a second quality inspection item of the second terminal, and perform an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item;
[0013] Obtain a quality inspection example sentence corresponding to the target quality inspection item.
[0014] Optionally, the step of obtaining the second quality inspection item of the second terminal and performing an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item includes:
[0015] receiving a second quality inspection mark corresponding to the second quality inspection item and transmitted by the second terminal, wherein the second quality inspection mark is processed by function transformation and encryption at the second terminal;
[0016] Decrypting the second quality inspection mark to obtain a second decrypted quality inspection mark;
[0017] Searching the first terminal for a first quality inspection item corresponding to the unqualified statement, and reading a first quality inspection identifier corresponding to the first quality inspection item;
[0018] Function transformation processing is performed on the first quality inspection identifier, and an intersection operation is performed between the second decrypted quality inspection identifier and the first quality inspection identifier processed by the function transformation to generate a target quality inspection item.
[0019] Optionally, the step of calling the federated quality inspection model to perform quality inspection on the received statement to be quality inspected includes:
[0020] When a sentence to be checked is received, the federated quality check model is called to perform quality check on the sentence to be checked, and whether there is an unqualified sentence in the sentence to be checked is identified.
[0021] Optionally, after the step of identifying whether there are unqualified statements in the statements to be quality checked, the method further includes:
[0022] If there are unqualified sentences in the sentences to be checked, a voice platform corresponding to the sentences to be checked is searched, and warning information is generated based on the sentences to be checked and the voice platform.
[0023] Optionally, the step of training the first network model based on the backhaul gradient to generate a federated quality inspection model includes:
[0024] Decrypting the returned gradient, and updating the parameters of the first network model according to the decrypted returned gradient to generate parameters of the model to be trained;
[0025] Based on the parameters of the model to be trained, training the first network model;
[0026] Determine whether the trained first network model converges, and if so, generate a federated quality inspection model.
[0027] Optionally, the step of transmitting the first model gradient obtained by training the first network model to the federal server includes:
[0028] The first model gradient is encrypted according to the encryption rule in the first terminal, and the encrypted first model gradient is transmitted to the federal server.
[0029] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a sentence quality inspection device based on federated learning, and the sentence quality inspection device based on federated learning comprises:
[0030] A training module, used for the first terminal to train a first network model corresponding to the first terminal according to the acquired quality inspection example sentence;
[0031] A transmission module, configured to transmit a first model gradient obtained by training the first network model to a federal server, wherein the federal server receives the first model gradient and a second model gradient sent by at least one second terminal, and the federal server aggregates the first model gradient and the second model gradient to generate a return gradient;
[0032] A generation module is used for the first terminal to receive the feedback gradient sent by the federal server, and to train the first network model based on the feedback gradient to generate a federal quality inspection model, and to call the federal quality inspection model to perform quality inspection on the received sentence to be quality inspected.
[0033] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a sentence quality inspection device based on federated learning, wherein the sentence quality inspection device based on federated learning comprises a memory, a processor, and a sentence quality inspection program based on federated learning stored in the memory and executable on the processor, wherein the sentence quality inspection program based on federated learning implements the steps of the sentence quality inspection method based on federated learning as described above when executed by the processor.
[0034] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a storage medium, on which a sentence quality inspection program based on federated learning is stored, and when the sentence quality inspection program based on federated learning is executed by a processor, the steps of the sentence quality inspection method based on federated learning as described above are implemented.
[0035] The sentence quality inspection method based on federated learning of the present invention is provided with a mechanism for quality inspection of sentences based on federated learning combined with multi-party data. First, the first terminal trains the first network model corresponding to the first terminal according to the quality inspection example sentence obtained for training, and transmits the first model gradient obtained by training the first network model to the federated server; the federated server receives the first model gradient and the second model gradient sent by at least one second terminal, and aggregates the first model gradient and the second model gradient to obtain the return gradient and send it to the first terminal; the first terminal continues to train the first network model based on the return gradient until the first network model shows convergence characteristics and stops training, and generates a federated quality inspection model; thereafter, when receiving the sentence to be inspected that needs to be inspected, the trained federated quality inspection model is called to inspect the sentence to be inspected. In this way, it is determined whether the sentence is standardized. Because the federated quality inspection model used for quality inspection is trained by combining the quality inspection examples of multiple terminals, it avoids the parties corresponding to different terminals from spending more time on a large number of sample annotations in the early stage, while shortening the preparation time for quality inspection, enriching the sample quantity and sample type of training, so that the quality inspection of the federated quality inspection model is more accurate. At the same time, the quality inspection examples of each party only exist within the system of each party, which is conducive to ensuring the security of the quality inspection examples of each party. Therefore, the quality inspection of the sentence through the federated quality inspection model is a quality inspection conducted by combining the data of multiple parties under the premise that the privacy of the data of each party is strictly protected, which ensures the accuracy of the quality inspection while protecting the security of the data of each party. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a structural schematic diagram of the device hardware operating environment involved in the embodiment of the sentence quality inspection device based on federated learning of the present invention;
[0037] Figure 2 This is a flow chart of a first embodiment of a sentence quality inspection method based on federated learning according to the present invention;
[0038] Figure 3It is a schematic diagram of the functional modules of a preferred embodiment of the sentence quality inspection device based on federated learning of the present invention.
[0039] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0040] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0041] The present invention provides a sentence quality inspection device based on federated learning, referring to Figure 1 , Figure 1 It is a structural schematic diagram of the device hardware operating environment involved in the embodiment scheme of the sentence quality inspection device based on federated learning of the present invention.
[0042] like Figure 1 As shown, the sentence quality inspection device based on federated learning may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0043] Those skilled in the art will understand that Figure 1 The hardware structure of the sentence quality inspection device based on federated learning shown in the figure does not constitute a limitation of the sentence quality inspection device based on federated learning, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0044] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a statement quality inspection program based on federated learning. The operating system is a program for managing and controlling the statement quality inspection device and software resources based on federated learning, and supports the operation of the network communication module, the user interface module, the statement quality inspection program based on federated learning, and other programs or software; the network communication module is used to manage and control the network interface 1004; the user interface module is used to manage and control the user interface 1003.
[0045] exist Figure 1 In the hardware structure of the sentence quality inspection device based on federated learning shown in the figure, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; the processor 1001 can call the sentence quality inspection program based on federated learning stored in the memory 1005, and perform the following operations:
[0046] The first terminal trains a first network model corresponding to the first terminal according to the acquired quality inspection example sentence;
[0047] Transmitting a first model gradient obtained by training the first network model to a federal server, wherein the federal server receives the first model gradient and a second model gradient sent by at least one second terminal, and the federal server aggregates the first model gradient and the second model gradient to generate a backhaul gradient;
[0048] The first terminal receives the feedback gradient sent by the federation server, trains the first network model based on the feedback gradient, generates a federation quality inspection model, and calls the federation quality inspection model to perform quality inspection on the received sentence to be quality inspected.
[0049] Optionally, before the step of training the first network model corresponding to the first terminal according to the acquired quality inspection example sentence, the processor 1001 may call a sentence quality inspection program based on federated learning stored in the memory 1005, and perform the following operations:
[0050] Acquire a second quality inspection item of the second terminal, and perform an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item;
[0051] Obtain a quality inspection example sentence corresponding to the target quality inspection item.
[0052] Optionally, the step of obtaining the second quality inspection item of the second terminal and performing an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item includes:
[0053] receiving a second quality inspection mark corresponding to the second quality inspection item and transmitted by the second terminal, wherein the second quality inspection mark is processed by function transformation and encryption at the second terminal;
[0054] Decrypting the second quality inspection mark to obtain a second decrypted quality inspection mark;
[0055] Searching the first terminal for a first quality inspection item corresponding to the unqualified statement, and reading a first quality inspection identifier corresponding to the first quality inspection item;
[0056] Function transformation processing is performed on the first quality inspection identifier, and an intersection operation is performed between the second decrypted quality inspection identifier and the first quality inspection identifier processed by the function transformation to generate a target quality inspection item.
[0057] Optionally, the step of calling the federated quality inspection model to perform quality inspection on the received statement to be quality inspected includes:
[0058] When a sentence to be checked is received, the federated quality check model is called to perform quality check on the sentence to be checked, and whether there is an unqualified sentence in the sentence to be checked is identified.
[0059] Optionally, after the step of identifying whether there are unqualified statements in the statements to be quality checked, the method further includes:
[0060] If there are unqualified sentences in the sentences to be checked, a voice platform corresponding to the sentences to be checked is searched, and warning information is generated based on the sentences to be checked and the voice platform.
[0061] Optionally, the step of training the first network model based on the backhaul gradient to generate a federated quality inspection model includes:
[0062] Decrypting the returned gradient, and updating the parameters of the first network model according to the decrypted returned gradient to generate parameters of the model to be trained;
[0063] Based on the parameters of the model to be trained, training the first network model;
[0064] Determine whether the trained first network model converges, and if so, generate a federated quality inspection model.
[0065] Optionally, the step of transmitting the first model gradient obtained by training the first network model to the federal server includes:
[0066] The first model gradient is encrypted according to the encryption rule in the first terminal, and the encrypted first model gradient is transmitted to the federal server.
[0067] The specific implementation of the sentence quality inspection device based on federated learning of the present invention is basically the same as the various embodiments of the sentence quality inspection method based on federated learning described below, and will not be repeated here.
[0068] The present invention also provides a sentence quality inspection method based on federated learning.
[0069] Reference Figure 2 , Figure 2 The figure is a flow chart of the first embodiment of the sentence quality inspection method based on federated learning of the present invention.
[0070] The embodiment of the present invention provides an embodiment of a sentence quality inspection method based on federated learning. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that here. Specifically, the sentence quality inspection method based on federated learning in this embodiment includes:
[0071] Step S10, the first terminal trains a first network model corresponding to the first terminal according to the acquired quality inspection example sentence;
[0072] The sentence quality inspection method based on federated learning in this embodiment is applied to a first system using federated learning, the first system including a first terminal and a first network model connected to the first terminal; and is suitable for quality inspection of sentences using a federated quality inspection model obtained through federated training of the first network model. Among them, the sentences come from the customer service system of each external service platform. When the human agents in the customer service system provide product consultation, question answering and other services to customers via voice connection, they will record the voice and save it in the customer service system. The sentence quality inspection based on federated learning is to detect whether the saved sentences contain intimidation, violence and other non-compliant language.
[0073] Furthermore, before the sentence is quality-checked by the federated quality-check model based on federated learning, the federated quality-check model is first federated trained. Specifically, the first terminal obtains the labeled quality-check example sentence by receiving or reading from the storage unit of the first system, and the quality-check example sentence is the non-standard information used for training. The obtained quality-check example sentence is transmitted to the first network model corresponding to the first terminal, and the first network model is trained to generate the model gradient of the first network model.
[0074] Step S20, transmitting a first model gradient obtained by training the first network model to a federal server, wherein the federal server receives the first model gradient and a second model gradient sent by at least one second terminal, and the federal server aggregates the first model gradient and the second model gradient to generate a return gradient;
[0075] Furthermore, the present embodiment is provided with a federal server connected to the first system. In addition to the first system, the federal server is also connected to at least one second system. The second system includes a second terminal and a second network model corresponding to each other, as well as quality inspection examples for each training. The quality inspection examples of each party's system are only in their respective local systems and will not be transmitted to other systems, thereby ensuring the security of the data of each party's system. As the coordinator of the parties' systems, the federal server coordinates the parties' systems to execute the federated learning algorithm on their respective quality inspection examples, and trains to generate a federal quality inspection model. After the first system trains the first network model to obtain the first model gradient, the first model gradient is transmitted to the federal server. The server aggregates the first model gradient from the first terminal and the second model gradient from at least one second terminal, and generates a return gradient to return to the parties' systems. The aggregation method can be to perform summing processing, average value data, weighted processing, etc. on the first model gradient and at least one second model gradient.
[0076] Furthermore, although the transmitted first model gradient and the second model gradient are not the specific training data and model parameters of the systems of the parties, an encrypted transmission mechanism is still set to ensure the security of the transmission of the first model gradient and the second model gradient, thereby ensuring the security of the data of the systems of the parties from multiple aspects. Specifically, the step of transmitting the first model gradient obtained by training the first network model to the federated server includes:
[0077] Step a: encrypt the first model gradient according to the encryption rule in the first terminal, and transmit the encrypted first model gradient to the federal server.
[0078] Furthermore, each party system may set up its own independent encryption transmission mechanism, that is, each system party encrypts and transmits the model gradient with different encryption rules; or the same encryption transmission mechanism may be set up, that is, each party system party encrypts and transmits their own model gradient with the same encryption rule. Specifically, before transmitting the model gradient to the federal server, the first system first reads the encryption rule in the first terminal, and encrypts the first model gradient according to the encryption rule, and then transmits the encrypted first model gradient to the federal server to aggregate with the second model gradient of the second system. The encryption rule can be symmetric encryption or asymmetric encryption. Considering the encryption effect, the encryption rule of asymmetric encryption is preferably used.
[0079] Step S30: The first terminal receives the feedback gradient sent by the federation server, trains the first network model based on the feedback gradient, generates a federation quality inspection model, and calls the federation quality inspection model to perform quality inspection on the received sentence to be inspected.
[0080] Furthermore, the first system receives the feedback gradient returned by the federal server, and updates the model parameters of the first network model based on the received feedback gradient. The first network model continues to be trained with the updated model parameters, and determines whether the first network model exhibits convergence characteristics. If convergence characteristics are exhibited, the training of the first network model is stopped to obtain a federated quality inspection model based on federated learning. If convergence characteristics are not exhibited, the first model gradient continues to be transmitted to the federal server for aggregation, and the feedback gradient returned by the federal server is received to continue training until the first network model exhibits convergence characteristics, and a federal quality inspection model is generated.
[0081] It should be noted that the coordinator of this embodiment can also be any one of the systems of the parties, that is, no server is set up to connect with the systems of the parties, but any one of the systems of the parties is selected as the coordinator, and the other systems are all connected to the system as the coordinator. In the case of any one system as the coordinator, the systems of the parties transmit their respective model gradients to the coordinator, and the coordinator aggregates and generates the return gradients and sends them to the other systems of the parties; accordingly, the systems of the parties receive the return gradients sent by the system as the coordinator to continue training.
[0082] Furthermore, after the first system has trained a federated quality inspection model based on federated learning, it can use the federated quality inspection model to perform quality inspection on the statements. When the customer service system that is in communication with the first system has a need to perform quality inspection on the statements, the statements are transmitted to the first system. The first system receives the statements that need to be quality inspected as statements to be quality inspected, and calls the federated quality inspection model to perform quality inspection on them. Among them, quality inspection is the process of determining whether there are unqualified statements in the statements to be quality inspected. Unqualified statements represent language that does not conform to the specifications. By identifying whether there are unqualified statements in the statements to be quality inspected, it is determined whether the statements to be quality inspected conform to the specifications. Specifically, the steps of calling the federated quality inspection model to perform quality inspection on the received statements to be quality inspected include:
[0083] Step b: when receiving the sentence to be checked, calling the federated quality inspection model to perform quality inspection on the sentence to be checked, and identifying whether there is an unqualified sentence in the sentence to be checked.
[0084] Understandably, the quality inspection example sentences used for training can exist in the form of text or voice. Considering that the sentences to be inspected generated by recording are unclear due to the influence of the call signal or call environment at the time, if the quality inspection example sentences are set as voice, the quality inspection of the sentences to be inspected by the quality inspection example sentences in voice form will lead to inaccurate quality inspection due to the unclear sentences to be inspected. Therefore, in this embodiment, the quality inspection example sentences are preferably in the form of text, and the quality inspection is achieved by converting the sentences to be inspected into text.
[0085] Further, after receiving the sentence to be quality-checked with quality-check requirements, segment and identify the sentence to be quality-checked, detect the literal meaning represented by each segment of speech, and convert each segment of speech into text information. After all segments of speech divided from the speech to be quality-checked are converted into text information, splice the converted text information in the order of the divided segments of speech to generate a text file, thus realizing the conversion of the sentence to be quality-checked into a text file. Considering that the converted text file contains invalid words irrelevant to the context, such as "de", "di", "a", "ya", etc. To improve the quality-check efficiency, multiple invalid words are preset in advance, and it is identified whether any of the multiple invalid words is included in the text file. If included, it is removed from the text file.
[0086] Furthermore, the quality-check example sentences are non-standard information for training the federated quality-check model. The federated quality-check model for sentence quality-check based on federated learning is to detect whether there is non-standard language in the sentence, and the non-standard language is embodied in the form of a preset language formula. Specifically, call the federated quality-check model to process the text file after removing invalid words, analyze whether there are keywords corresponding to unqualified sentences. If there are corresponding keywords, count the number of keywords. At the same time, count the total number of sentence keywords contained in the text file, and calculate the ratio of the number of keywords corresponding to unqualified sentences to the total number to generate the proportion of keywords. A preset threshold representing the proportion size of keywords is preset in advance. Compare the determined proportion of keywords with the preset threshold to judge whether the proportion of keywords is greater than the preset threshold. If it is greater than the preset threshold, it indicates that the number of non-standard languages contained in the sentence to be quality-checked is large, and it is determined that there are unqualified sentences in the sentence to be quality-checked. If the determined proportion of keywords is less than or equal to the preset threshold, it indicates that the number of non-standard languages contained in the sentence to be quality-checked is small, and it is determined that there are no unqualified sentences in the sentence to be quality-checked.
[0087] It should be noted that this embodiment can also directly identify whether there are unqualified sentences in the sentence to be detected through the number of keywords. A preset threshold representing the number of keywords is preset in advance. After determining that there are keywords in the text file, count the number of keywords and compare the statistical value with the preset threshold to judge whether the statistical value is greater than the preset threshold. If it is greater than the preset threshold, it indicates that the number of non-standard languages contained in the speech of the sentence to be quality-checked is large, and it is determined that there are违规话术 in the speech of the sentence to be quality-checked. If the number of counted keywords is less than or equal to the preset threshold, it indicates that the number of non-standard languages contained in the speech of the sentence to be quality-checked is small, and it is determined that there are no违规话术 in the speech of the sentence to be quality-checked.
[0088] Further, after the step of identifying whether there are unqualified sentences in the sentence to be quality-checked, it further includes:
[0089] Step c: if there are unqualified sentences in the sentences to be checked, searching for a voice platform corresponding to the sentences to be checked, and generating warning information based on the sentences to be checked and the voice platform.
[0090] After determining that there are unqualified sentences in the sentences to be checked, find the voice platform corresponding to the sentences to be checked, that is, the platform corresponding to the customer service system from which the sentences to be checked come. Generate warning information for the sentences to be checked and the voice platform to indicate that the service of the voice platform is poor and there may be operational risks. In addition, prompt information can be generated separately for the sentences to be checked to inform the voice platform that the customer service personnel from which the sentences to be checked come have service problems, or as confrontation information between customers and customer service.
[0091] It should be noted that the present embodiment may also be provided with a mechanism for generating different warning messages according to the number of unqualified sentences contained in the sentence to be inspected. At this time, as long as the keywords corresponding to the unqualified sentences in the text file are identified, it is determined that there are unqualified sentences in the sentence to be inspected. Then, the proportion or number of keywords is determined, and different warning messages are generated according to different proportions or numbers. Among them, the higher the proportion or number, the more serious the warning message representing the violation; conversely, the less serious the warning message representing the violation is, so as to perform different operations according to different warning messages.
[0092] The sentence quality inspection method based on federated learning of the present invention is provided with a mechanism for quality inspection of sentences based on federated learning combined with multi-party data. First, the first terminal trains the first network model corresponding to the first terminal according to the quality inspection example sentence obtained for training, and transmits the first model gradient obtained by training the first network model to the federated server; the federated server receives the first model gradient and the second model gradient sent by at least one second terminal, and aggregates the first model gradient and the second model gradient to obtain the return gradient and send it to the first terminal; the first terminal continues to train the first network model based on the return gradient until the first network model shows convergence characteristics and stops training, and generates a federated quality inspection model; thereafter, when receiving the sentence to be inspected that needs to be inspected, the trained federated quality inspection model is called to inspect the sentence to be inspected. In this way, it is determined whether the sentence is standardized. Because the federated quality inspection model used for quality inspection is trained by combining the quality inspection examples of multiple terminals, it avoids the parties corresponding to different terminals from spending more time on a large number of sample annotations in the early stage, while shortening the preparation time for quality inspection, enriching the sample quantity and sample type of training, so that the quality inspection of the federated quality inspection model is more accurate. At the same time, the quality inspection examples of each party only exist within the system of each party, which is conducive to ensuring the security of the quality inspection examples of each party. Therefore, the quality inspection of the sentence through the federated quality inspection model is a quality inspection conducted by combining the data of multiple parties under the premise that the privacy of the data of each party is strictly protected, which ensures the accuracy of the quality inspection while protecting the security of the data of each party.
[0093] Furthermore, based on the first embodiment of the sentence quality checking method based on federated learning of the present invention, a second embodiment of the sentence quality checking method based on federated learning of the present invention is proposed.
[0094] The difference between the second embodiment of the sentence quality inspection method based on federated learning and the first embodiment of the sentence quality inspection method based on federated learning is that, before the step of training the first network model corresponding to the first terminal according to the acquired quality inspection example sentence, the step further includes:
[0095] Step S50, obtaining a second quality inspection item of the second terminal, and performing an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item;
[0096] Step S60, obtaining a quality inspection example sentence corresponding to the target quality inspection item.
[0097] Before training the first network model, this embodiment needs to unify the quality inspection items with the second system. The quality inspection items represent the language categories for quality inspection of sentences, such as intimidation categories, violence categories, etc., so as to mark quality inspection examples according to the categories for training. Specifically, the second quality inspection item is obtained from the second terminal, and the first quality inspection item is read from the first terminal, and then the intersection operation is performed on the first quality inspection item and the second quality inspection item to obtain the common quality inspection item between the two as the target quality inspection item corresponding to the unqualified sentence. Thereafter, the first system obtains the quality inspection example sentence corresponding to the target quality inspection item from the various types of marked quality inspection example sentences, that is, the quality inspection example sentence of the language category represented by the target quality inspection item, for training the first network model.
[0098] It should be noted that the generation of target quality inspection items can also be performed on the federated server. The first terminal transmits the first quality inspection item to the federated server, and the second terminal transmits the second quality inspection item to the federated server. The federated server performs an intersection operation on the first quality inspection item and the second quality inspection item to generate the target quality inspection item and send it to each party's system. In particular, whether the target quality inspection item is generated in the first system or in the federated server, the first quality inspection item and the second quality inspection item are both represented by their respective quality inspection identifiers, and the transmission of their respective quality inspection identifiers needs to be processed by function conversion and encryption.
[0099] Specifically, the step of obtaining the second quality inspection item of the second terminal and performing an intersection operation on the first quality inspection item and the second quality inspection item in the first terminal to generate the target quality inspection item includes:
[0100] Step S51, receiving a second quality inspection mark corresponding to the second quality inspection item transmitted by the second terminal, wherein the second quality inspection mark is processed by function transformation and encryption at the second terminal;
[0101] Step S52, decrypting the second quality inspection mark to obtain a second decrypted quality inspection mark;
[0102] Step S53, searching the first terminal for a first quality inspection item corresponding to the unqualified statement, and reading a first quality inspection identifier corresponding to the first quality inspection item;
[0103] Step S54, performing function transformation processing on the first quality inspection mark, and performing an intersection operation between the second decrypted quality inspection mark and the first quality inspection mark processed by the function transformation, to generate a target quality inspection item.
[0104] Further, the target quality inspection item generated in the first system is used as an example for explanation. Each second quality inspection item contained in the second terminal carries a second quality inspection mark representing their uniqueness, and each first quality inspection item contained in the first terminal carries a first quality inspection mark representing their uniqueness. Each second quality inspection mark is sent to the first system after function transformation processing and encryption processing at the second terminal, wherein the function is preferably a hash function and the encryption is asymmetric encryption. For example, the second quality inspection marks of the second quality inspection item are u1, u2, u3, and u4, respectively. Hash transformation is performed on u1, u2, u3, and u4 by hash function H to obtain H(u1), H(u2), H(u3), and H(u4). At the same time, the first system provides the public key in the asymmetric encryption to the second system, and the second system encrypts H(u1), H(u2), H(u3), and H(u4) by the public key and sends them to the first system.
[0105] Furthermore, after receiving the second quality inspection mark corresponding to the second quality inspection item transmitted by the second terminal, the first system decrypts each second quality inspection mark through the asymmetric encryption private key to obtain a second decrypted quality inspection label. The first quality inspection item corresponding to the unqualified statement in the first terminal is searched, and the first quality inspection mark corresponding to the first quality inspection item is read, and the transformed first quality inspection mark is obtained by the same function transformation method as the second quality inspection item. If the first quality inspection marks corresponding to the first quality inspection item are u1, u2, u3, and u5 respectively, u1, u2, u3, and u5 are also hashed through the hash function H to obtain H(u1), H(u2), H(u3), and H(u5).
[0106] Furthermore, an intersection operation is performed between the second decrypted quality inspection mark and the transformed first quality inspection mark to obtain the same quality inspection mark between the two, and then the quality inspection item corresponding to the same quality inspection mark between the two is used as the target quality inspection item. For example, if an intersection operation is performed on the above-mentioned decrypted H(u1), H(u2), H(u3), H(u4), and the transformed H(u1), H(u2), H(u3), H(u5), H(u1), H(u2), H(u3) are obtained, which are the same quality inspection marks between the two, and the quality inspection item represented by the same quality inspection mark is the target quality inspection item corresponding to the unqualified statement.
[0107] Before training the first network model through the quality inspection example sentences, this embodiment screens the quality inspection example sentences through the same quality inspection items between the parties, so that the quality inspection example sentences used for training belong to the same type, which is conducive to the accuracy of model training. At the same time, the same quality inspection items are determined by the intersection operation of the first quality inspection identifier and the second quality inspection identifier that respectively represent the quality inspection items between the parties, avoiding the direct transmission of the quality inspection items and ensuring the leakage of the quality inspection items. In addition, the first quality inspection identifier and the second quality inspection identifier are subjected to function transformation and encryption processing, further ensuring the security of the quality inspection items.
[0108] Furthermore, based on the first or second embodiment of the sentence quality checking method based on federated learning of the present invention, a third embodiment of the sentence quality checking method based on federated learning of the present invention is proposed.
[0109] The difference between the third embodiment of the sentence quality inspection method based on federated learning and the first or second embodiment of the sentence quality inspection method based on federated learning is that the step of training the first network model based on the backpropagation gradient to generate a federated quality inspection model includes:
[0110] Step S31, decrypting the returned gradient, and updating the parameters of the first network model according to the decrypted returned gradient to generate parameters of the model to be trained;
[0111] Step S32, training the first network model based on the parameters of the model to be trained;
[0112] Step S33, determining whether the trained first network model has converged, and if so, generating a federated quality inspection model.
[0113] Furthermore, the feedback gradient returned by the federal server is transmitted in the form of encrypted ciphertext, and can be symmetric encryption or asymmetric encryption. After receiving the returned feedback gradient, the first system decrypts the feedback gradient according to the encryption method agreed with the federal server to obtain the decrypted feedback gradient. Then, the parameters of the first network model are updated with the decrypted feedback gradient to obtain the parameters of the model to be trained, and the first network model is continued to be trained with the parameters of the model to be trained. After the training is completed, the trained first network model is tested with the quality inspection example sentence used for testing to determine whether the result obtained by the first network model processing the quality inspection example sentence is within the expected result range. If the results obtained within the consecutive number of times are within the expected result range, it is determined that the trained first network model converges, the training is terminated, and the first network model is determined as the federal quality inspection model. Otherwise, the training continues until the first network model converges and a federal quality inspection model is generated.
[0114] This embodiment trains the first network model based on federated learning, does not transmit the first data, protects privacy, and enriches the number of training samples, optimizes the quality inspection effect of the trained federated quality inspection model, and makes the sentence quality inspection based on the federated quality inspection model more accurate.
[0115] The present invention also provides a sentence quality inspection device based on federated learning.
[0116] Reference Figure 3 , Figure 3This is a functional module diagram of the first embodiment of the sentence quality inspection device based on federated learning of the present invention. The sentence quality inspection device based on federated learning includes:
[0117] A training module 10 is used for the first terminal to train a first network model corresponding to the first terminal according to the acquired quality inspection example sentence;
[0118] A transmission module 20, configured to transmit a first model gradient obtained by training the first network model to a federal server, wherein the federal server receives the first model gradient and a second model gradient sent by at least one second terminal, and the federal server aggregates the first model gradient and the second model gradient to generate a return gradient;
[0119] The generating module 30 is used for the first terminal to receive the feedback gradient sent by the federation server, train the first network model based on the feedback gradient, generate a federation quality inspection model, and call the federation quality inspection model to perform quality inspection on the received sentence to be quality inspected.
[0120] Furthermore, the sentence quality inspection device based on federated learning also includes:
[0121] A calculation module, used for obtaining a second quality inspection item of the second terminal, and performing an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item;
[0122] The acquisition module is used to acquire the quality inspection example sentences corresponding to the target quality inspection item.
[0123] Furthermore, the operation module includes:
[0124] A receiving unit, configured to receive a second quality inspection mark corresponding to the second quality inspection item and transmitted by the second terminal, wherein the second quality inspection mark is processed by function transformation and encryption at the second terminal;
[0125] A decryption unit, used to decrypt the second quality inspection mark to obtain a second decrypted quality inspection mark;
[0126] a reading unit, configured to search the first terminal for a first quality inspection item corresponding to the unqualified statement, and read a first quality inspection identifier corresponding to the first quality inspection item;
[0127] The operation unit is used to perform function transformation processing on the first quality inspection mark, and perform intersection operation between the second decrypted quality inspection mark and the first quality inspection mark processed by function transformation to generate a target quality inspection item.
[0128] Furthermore, the generating module 30 further includes:
[0129] The quality inspection unit is used to call the federated quality inspection model to perform quality inspection on the sentences to be inspected when receiving the sentences to be inspected, and identify whether there are unqualified sentences in the sentences to be inspected.
[0130] Furthermore, the generating module 30 further includes:
[0131] The searching unit is used for searching for a voice platform corresponding to the sentence to be checked if there is an unqualified sentence in the sentence to be checked, and generating warning information based on the sentence to be checked and the voice platform.
[0132] Furthermore, the generating module 30 includes:
[0133] An updating unit, configured to decrypt the returned gradient, and update the parameters of the first network model according to the decrypted returned gradient to generate parameters of the model to be trained;
[0134] A training unit, configured to train the first network model based on the parameters of the model to be trained;
[0135] The judging unit is used to judge whether the trained first network model has converged, and if so, to generate a federated quality inspection model.
[0136] Furthermore, the transmission module is also used for:
[0137] The first model gradient is encrypted according to the encryption rule in the first terminal, and the encrypted first model gradient is transmitted to the federal server.
[0138] The specific implementation of the sentence quality inspection device based on federated learning of the present invention is basically the same as the embodiments of the sentence quality inspection method based on federated learning mentioned above, and will not be repeated here.
[0139] In addition, an embodiment of the present invention further provides a storage medium.
[0140] A sentence quality inspection program based on federated learning is stored on the storage medium. When the sentence quality inspection program based on federated learning is executed by the processor, the steps of the sentence quality inspection method based on federated learning as described above are implemented.
[0141] The storage medium of the present invention may be a computer-readable storage medium, and its specific implementation is basically the same as the above-mentioned embodiments of the sentence quality inspection method based on federated learning, and will not be repeated here.
[0142] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are protected by the present invention.
Claims
1. A sentence quality inspection method based on federated learning, characterized in that: The sentence quality inspection method based on federated learning includes the following steps: Acquire a second quality inspection item of the second terminal, and perform an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item, where the quality inspection item is used to represent a language category for quality inspection of the sentence; Acquire quality inspection example sentences corresponding to the target quality inspection item, so as to perform model training based on the quality inspection example sentences with category annotations; The first terminal trains a first network model corresponding to the first terminal according to the acquired quality inspection example sentence; Transmitting a first model gradient obtained by training the first network model to a federal server, wherein the federal server receives the first model gradient and a second model gradient sent by at least one second terminal, and the federal server aggregates the first model gradient and the second model gradient to generate a backhaul gradient; The first terminal receives the feedback gradient sent by the federation server, trains the first network model based on the feedback gradient, generates a federation quality inspection model, and calls the federation quality inspection model to perform quality inspection on the received sentence to be quality inspected.
2. The sentence quality inspection method based on federated learning according to claim 1, characterized in that: The step of obtaining the second quality inspection item of the second terminal and performing an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item includes: receiving a second quality inspection mark corresponding to the second quality inspection item and transmitted by the second terminal, wherein the second quality inspection mark is processed by function transformation and encryption at the second terminal; Decrypting the second quality inspection mark to obtain a second decrypted quality inspection mark; Searching for a first quality inspection item corresponding to the unqualified statement in the first terminal, and reading a first quality inspection identifier corresponding to the first quality inspection item; Function transformation processing is performed on the first quality inspection identifier, and an intersection operation is performed between the second decrypted quality inspection identifier and the first quality inspection identifier processed by the function transformation to generate a target quality inspection item.
3. The sentence quality inspection method based on federated learning according to claim 1, characterized in that: The step of calling the federated quality inspection model to perform quality inspection on the received sentence to be inspected includes: When a sentence to be checked is received, the federated quality check model is called to perform quality check on the sentence to be checked, and whether there is an unqualified sentence in the sentence to be checked is identified.
4. The sentence quality inspection method based on federated learning according to claim 3 is characterized in that: After the step of identifying whether there are unqualified statements in the sentences to be inspected, the method further includes: If there are unqualified sentences in the sentences to be checked, a voice platform corresponding to the sentences to be checked is searched, and warning information is generated based on the sentences to be checked and the voice platform.
5. The sentence quality inspection method based on federated learning according to any one of claims 1 to 4, characterized in that: The step of training the first network model based on the backtransmitted gradient to generate a federated quality inspection model comprises: Decrypting the returned gradient, and updating the parameters of the first network model according to the decrypted returned gradient to generate parameters of the model to be trained; Based on the parameters of the model to be trained, training the first network model; Determine whether the trained first network model converges, and if so, generate a federated quality inspection model.
6. The sentence quality inspection method based on federated learning according to any one of claims 1 to 4, characterized in that: The step of transmitting the first model gradient obtained by training the first network model to the federal server comprises: The first model gradient is encrypted according to the encryption rule in the first terminal, and the encrypted first model gradient is transmitted to the federal server.
7. A sentence quality inspection device based on federated learning, characterized in that: The sentence quality inspection device based on federated learning includes: A calculation module, used for obtaining a second quality inspection item of the second terminal, and performing an intersection operation on the first quality inspection item in the first terminal and the second quality inspection item to generate a target quality inspection item, where the quality inspection item is used to represent a language category for quality inspection of a sentence; An acquisition module, used to acquire quality inspection example sentences corresponding to the target quality inspection item, so as to perform model training based on the quality inspection example sentences with category annotations; A training module, used for the first terminal to train a first network model corresponding to the first terminal according to the acquired quality inspection example sentence; A transmission module, configured to transmit a first model gradient obtained by training the first network model to a federal server, wherein the federal server receives the first model gradient and a second model gradient sent by at least one second terminal, and the federal server aggregates the first model gradient and the second model gradient to generate a return gradient; A generation module is used for the first terminal to receive the feedback gradient sent by the federal server, and to train the first network model based on the feedback gradient to generate a federal quality inspection model, and to call the federal quality inspection model to perform quality inspection on the received sentence to be quality inspected.
8. A sentence quality inspection device based on federated learning, characterized in that: The federated learning-based sentence quality inspection device includes a memory, a processor, and a federated learning-based sentence quality inspection program stored in the memory and executable on the processor. When the federated learning-based sentence quality inspection program is executed by the processor, the steps of the federated learning-based sentence quality inspection method described in any one of claims 1 to 6 are implemented.
9. A storage medium, characterized in that: The storage medium stores a sentence quality checking program based on federated learning, and when the sentence quality checking program based on federated learning is executed by the processor, the steps of the sentence quality checking method based on federated learning as described in any one of claims 1 to 6 are implemented.
