Method and device for content verification, equipment and storage medium
By adjusting the decoding strategy of the machine learning model, the candidate text units in the output text sequence are verified in real time, which solves the inference delay problem caused by traditional content inspection methods, and realizes safe and compliant streaming content generation, improving user experience.
Patent Information
- Application Number
- CN202311331017.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-13
- Publication Date
- 2025-04-15
AI Technical Summary
In the scenario where machine learning models generate content, traditional content inspection methods need to wait for the complete model to be output before verification, resulting in a decrease in inference delay and user experience, and the existing technology has failed to effectively solve the problems of content security and compliance inspection.
By obtaining the prediction results of the machine learning model for the output text sequence, determining whether the candidate text unit meets the content verification conditions, and adjusting the parameters in the decoding strategy, reducing the probability that the candidate text unit that does not meet the conditions is selected, so that content verification is performed in real time in streaming content generation.
It realizes the characteristics of maintaining streaming generation on the basis of ensuring the security and compliance of model output content, reducing model inference delay and improving user experience. As a lightweight content verification method, this solution can be applied to various models without retraining the model.
Smart Images

Figure CN119830254A_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computer technology, and more particularly, to methods, devices, apparatuses, and computer-readable storage media for content verification. Background Art
[0002] As machine learning and deep learning technologies have been widely used in many fields, computer systems can use machine learning models (such as generative models) to generate various types of content, including text content. For content generated by models, content checks need to be performed in many application scenarios to avoid inappropriate content provision. Summary of the invention
[0003] In the first aspect of the present disclosure, a method for content verification is provided. The method includes: obtaining a prediction result of a machine learning model for an output text sequence, the prediction result indicating multiple candidate text units to be included at a position of the output text sequence; determining whether each of the multiple candidate text units meets the content verification condition; if it is determined that at least one of the multiple candidate text units does not meet the content verification condition, adjusting the parameters for at least one candidate text unit used in the decoding strategy part of the machine learning model to reduce the probability that at least one candidate text unit is selected to be included at the position of the output text sequence; and using the decoding strategy part of the machine learning model, based at least on the adjusted parameters for at least one candidate text unit and the parameters of the remaining candidate text units in the multiple candidate text units, determining the target text unit to be included at the position of the output text sequence.
[0004] In the second aspect of the present disclosure, a device for content verification is provided. The device includes: an acquisition module configured to acquire a prediction result of a machine learning model for an output text sequence, the prediction result indicating multiple candidate text units to be included at a position of the output text sequence; a verification module configured to determine whether each of the multiple candidate text units meets the content verification condition; an adjustment module configured to adjust the parameters for at least one candidate text unit used in the decoding strategy part of the machine learning model to reduce the probability that at least one candidate text unit is selected to be included at the position of the output text sequence if it is determined that at least one candidate text unit among the multiple candidate text units does not meet the content verification condition; and a target determination module configured to determine the target text unit to be included at the position of the output text sequence using the decoding strategy part of the machine learning model, based at least on the adjusted parameters for at least one candidate text unit and the parameters of the remaining candidate text units among the multiple candidate text units.
[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes the method of the first aspect.
[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the medium, and when the computer program is executed by a processor, the method of the first aspect is implemented.
[0007] It should be understood that the content described in this section is not intended to limit the key features or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0009] Figure 1 A schematic diagram showing an example environment in which embodiments of the present disclosure can be implemented;
[0010] Figure 2 A block diagram of a content checking system for a model according to some embodiments of the present disclosure is shown;
[0011] Figure 3 A flowchart showing a process for content verification according to some embodiments of the present disclosure is shown;
[0012] Figure 4 A block diagram showing an apparatus for content verification according to some embodiments of the present disclosure; and
[0013] Figure 5 An electronic device is shown in which one or more embodiments of the present disclosure may be implemented. DETAILED DESCRIPTION
[0014] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0015] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0016] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0017] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0018] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information, so that the user can independently choose whether to provide personal information to software or hardware such as electronic devices, applications, servers or storage media that execute operations of the technical solution of the present disclosure based on the prompt message.
[0019] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information is sent to the user in a manner such as a pop-up window, in which the prompt information can be presented in text form. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0020] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0021] As used herein, the term "model" can learn the association between the corresponding input and output from the training data, so that after the training is completed, the corresponding output can be generated for a given input. The generation of the model can be based on machine learning technology. Deep learning is a machine learning algorithm that processes inputs and provides corresponding outputs by using multi-layer processing units. A neural network model is an example of a model based on deep learning. In this article, "model" may also be referred to as "machine learning model", "learning model", "machine learning network" or "learning network", and these terms are used interchangeably in this article.
[0022] Generally, machine learning can be roughly divided into three stages, namely the training stage, the testing stage, and the application stage (also called the inference stage). In the training stage, a given model can be trained using a large amount of training data, and the parameter values are continuously updated iteratively until the model can obtain consistent inferences that meet the expected goals from the training data. Through training, the model can be considered to be able to learn the association between input and output (also called input-to-output mapping) from the training data. The parameter values of the trained model are determined. In the testing stage, the test input is applied to the trained model to test whether the model can provide the correct output, thereby determining the performance of the model. The testing stage can sometimes be integrated into the training stage. In the application stage, the trained model can be used to process the actual model input based on the parameter values obtained through training to determine the corresponding model output.
[0023] Figure 1 A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. In environment 100, electronic device 110 receives model input 122 and processes model input 122 using machine learning model 120 to provide model output 124. Model input 122 may be provided by user 105. Model output 124 may be provided or presented to user 105 via an appropriate output device.
[0024] Although shown as being deployed at the electronic device 110 , in other embodiments, the machine learning model 120 may also be remotely deployed and / or distributed and accessible by the electronic device 110 .
[0025] In some embodiments, the model input 122 may be in text form, user instructions, or other forms; the model output 124 may be a text sequence. Of course, depending on the specific model configuration, the model input 122 and the model output 124 may also be content in other modalities.
[0026] In some embodiments, a question-answering system may be constructed based on the machine learning model 120 , where the model input 122 from the user 105 may be considered as a user question, and the model output 124 may be an answer to the user question.
[0027] In environment 100, electronic device 110 can be any type of terminal device or server device. Examples of terminal devices include mobile terminals, fixed terminals or portable terminals, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, personal communication systems (PCS) devices, personal navigation devices, personal digital assistants (PDAs), audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio broadcast receivers, e-book devices, gaming devices, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. In some embodiments, electronic device 110 can also support any type of interface for users (such as "wearable" circuits, etc.). Examples of server devices include, but are not limited to, mainframes, edge computing nodes, computing devices in cloud environments, and the like.
[0028] It should be understood that the structure and function of the various elements in the environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure.
[0029] In some embodiments, the machine learning model 120 may be a generative model. A generative model refers to a content generation technology implemented by a machine learning model. A generative model can automatically generate meaningful and coherent content based on input content, including natural language text or images, audio, video, etc. A language model refers to a model trained on the basis of a large-scale corpus and having a certain understanding and generation capability for a language. For text content generation, it mainly relies on a language model to execute. Driven by large-scale pre-trained models, the generation quality and speed of generative models have become increasingly satisfactory.
[0030] Since model processing takes a certain amount of time, in some embodiments, the entire model output can be provided to the user after the model output is fully determined. In some embodiments, the machine learning model can support streaming content generation. The so-called "streaming content generation" means that the machine learning model can gradually output part of the text sequence, and predict the subsequent text content to be output based on the previously output part, until the final text sequence is output. The text part output by the model in real time can be provided to the user instantly. In this way, the user can avoid long waiting times and obtain a better user experience.
[0031] In the field of content provision, content inspection tasks are usually required to check the security of the content (for example, whether it contains sensitive information). The traditional solution is to input all content into the content review system for inspection. However, when faced with content inspection tasks for model-generated content, if the traditional solution is directly introduced into model reasoning, it will cause serious reasoning delays, because it is necessary to wait for the complete model output before content inspection can be performed. This will destroy the streaming content output characteristics of the model, which is unacceptable in terms of time and seriously reduces the user experience.
[0032] Traditionally, there are some model-based controllable text solutions, but these solutions are all aimed at solving the problems of uncontrollable and unpredictable effects of natural language generation (NLG) in the traditional sense, and have not focused on issues such as content security checks.
[0033] According to an example embodiment of the present disclosure, an improved content verification scheme is provided. In this scheme, for multiple candidate text units at a certain position in an output text sequence, content verification is applied to the multiple candidate text units before the decoding strategy of the machine learning model is applied. If one or some candidate text units do not meet the content verification conditions, the parameters used in the decoding strategy part of the machine learning model for the non-compliant candidate text units are adjusted to reduce the probability that the candidate text unit or units are selected to be included at the position of the output text sequence. Then, the decoding strategy part of the machine learning model is used to select the target text unit to be included at the position of the output text sequence based on the candidate text units with the adjusted parameters.
[0034] According to this solution, the security and compliance of the model output content are enhanced. Moreover, on the basis of ensuring the security of the model output content, its streaming characteristics can be maintained to utilize the speed of streaming output, and there is no need to perform verification after all outputs are completed. This can achieve low-latency model reasoning. In addition, as a lightweight content verification solution, this solution can be applied to various models to introduce a content review mechanism in the reasoning process of these models, without the need to retrain the model, with high compatibility and low application cost.
[0035] Some example embodiments of the present disclosure will be described below with reference to the accompanying drawings.
[0036] Figure 2 FIG. 2 is a block diagram of a content inspection system 200 for a model according to some embodiments of the present disclosure. Figure 1 The content inspection system 200 is described in the context of FIG. 1 , for example, the content inspection system 200 may be implemented at the electronic device 110 or otherwise accessible by the electronic device 110 .
[0037] like Figure 2As shown, the content inspection system 200 includes a machine learning model 120 and a content inspection part 230. The machine learning model 120 may have the characteristics of streaming content generation, providing a model output 124 in a streaming manner. In the scenario of text generation, the model output 124 includes an output text sequence.
[0038] In general, the machine learning model 120 may include an encoding part and a decoding part. The encoding part includes an encoder 202, which processes a model input 122. The model input 122 may be an input text sequence, an instruction, or a content input of other modalities provided by the user 105. Based on the processing of the encoder 202, the decoding part continues to determine the model output. The decoding part may include a prediction part 210 and a decoding strategy part 220. In an embodiment of the present disclosure, the content inspection strategy is mainly applied to the decoding side of the machine learning model 120, so there is no restriction on the encoding processing of the machine learning model 120.
[0039] When the model is decoded, the text units at various positions in the output text sequence can be determined one by one according to the granularity of the text unit. The determination of the next text unit depends on the previous text unit. Here, the text unit refers to the unit granularity of the machine learning model 120 processing text, sometimes also referred to as a "token". Each text unit can be, for example, a single word, multiple words, punctuation marks or other symbols.
[0040] The prediction part 210 in the decoding part is configured to determine a prediction result for each position in the output text sequence, and the prediction result indicates a plurality of candidate text units to be included at a position of the output text sequence. In some embodiments, the prediction part 210 can be configured to perform sampling according to probability to estimate the next text unit when one or more text units are known. In this way, the prediction result indicates the probability distribution of a plurality of candidate text units to be included at a position of the output text sequence. The probability of each candidate text unit in the probability distribution indicates the degree to which the candidate text unit is suitable for being included in the corresponding position of the output text sequence. This prediction process can be expressed as follows:
[0041] p(wk|w1,…wk-1)=p(wk|wk-n,…,wk-1), n <k (1)
[0042] According to the above formula (1), when the text units w1, ... wk-1 at the 1st to k-1th positions in the output text sequence are known (i.e., have been decoded by the machine learning model 120), the predicted probability of the text unit wk at the kth position is based on the text units w1, ... wk-1 at the 1st to k-1th positions. This probability is also equal to the text units at the wk-nth to wk-1th positions. That is, when determining the text unit at the kth position, kn text units can be considered forward. Generally, when determining the text unit at the kth position, the prediction part 210 can determine the probability that each candidate text unit is suitable to be connected to the kn text units based on the decoded kn text units considered forward for multiple candidate text units in the vocabulary, thereby obtaining the probability distribution of multiple candidate text units. In some embodiments, the prediction part 210 can be based on a transformer structure or any other appropriate model structure.
[0043] like Figure 2 As shown, assuming that the text unit at the third position in the output text sequence is to be decoded, and assuming that three text units are to be considered ahead when decoding, the prediction part 210 determines the probability distribution 212 of multiple candidate text units W31, W32, W33, W34, etc. that may be included at the third position based on the decoded part 205 in the output text sequence, i.e., the text units W0, W1, and W2. Note that although four candidate text units are shown, there may actually be more candidate text units.
[0044] Since the prediction part 210 determines the prediction result for the output text sequence, that is, multiple candidate text units to be included at a position of the output text sequence, the multiple candidate text units can be provided to the content checking part 230 to determine whether each of the multiple candidate text units meets the content verification condition.
[0045] Depending on the specific scenario and specific application, the content verification condition may include verification constraints, verification rules, etc. that need to be applied to the content. In some embodiments, the content verification condition may include a content security condition to check whether the generated content contains information that does not meet security requirements, sensitive information, etc. In some embodiments, the content verification condition may include a condition for checking non-false information to perform factual verification on the generated content to determine whether the generated content contains false fabricated information. In some embodiments, the content verification condition may include any appropriate predetermined text filtering condition. The text filtering condition may be a configurable hard filtering condition to prevent some inappropriate content from being presented to the user.
[0046] The content inspection part 230 can utilize various content audits, inspection strategies and technologies to realize the judgment of content verification conditions. In some embodiments, the content inspection part 230 can filter out candidate text units that do not meet the conditions by configuring some rules. In some embodiments, the content inspection part 230 can utilize a content inspection model to realize the inspection of content verification conditions. When inspecting non-false information, the content inspection part 230 can also determine whether it contains false fabricated information based on the knowledge base. Alternatively or additionally, the content inspection part 230 can also include a content filtering list to filter out candidate text units that do not meet the preset text filtering conditions.
[0047] In some embodiments, if a portion of the output text sequence (e.g., portion 205) has been decoded by the machine learning model 120, for each candidate text unit in a plurality of candidate text units, the content inspection portion 230 may also combine the candidate text sequence with a portion of the output text sequence that has been decoded or one or more text units in the portion to form a text sequence and determine whether the text sequence meets the content verification conditions. That is, similar to model decoding, when checking the content, one or more text units are also considered forward for the text unit at the current position. This can prevent the text unit selected at the current position from forming non-compliant content together with its adjacent text units.
[0048] In some embodiments, if the content checking part 230 determines that multiple candidate text units all meet the content verification condition, the content checking part 230 will not perform further processing, but continue to input the prediction result 212 to the decoding strategy part 220. The decoding strategy part 220 determines the target text unit at the current position according to the normal decoding operation.
[0049] If the content inspection part 230 determines that at least one of the multiple candidate text units does not meet the content verification condition, the content inspection part 230 can adjust or trigger the adjustment of the parameters used in the decoding strategy part 220 of the machine learning model for at least one candidate text unit to reduce the probability that at least one candidate text unit is selected to be included at the position of the output text sequence. That is, in the content generation process, while maintaining streaming generation, the decoding strategy for the text unit at each position in the output text sequence is disturbed to promote the generation of verified, secure and compliant content.
[0050] Further, the decoding strategy part 230 of the machine learning model is used to determine the target text unit, such as W32, at the position to be included in the output text sequence based on at least the adjusted parameters for at least one candidate text unit and the parameters of the remaining candidate text units in the plurality of candidate text units. The target text unit determined at this position will continue to be used as the basis for determining the text unit at the next position and is provided to the prediction part 210.
[0051] In some embodiments, the disturbance of the model decoding by the content inspection part 230 may include disturbing the probability of at least one candidate text unit that does not meet the content verification condition. That is, for the probability distribution of multiple candidate text units indicated by the prediction result 212, the probability distribution of multiple candidate text units is adjusted by reducing the probability of at least one candidate text unit to obtain the adjusted prediction result 232. The adjusted prediction result 232 indicates the adjusted probability distribution and can be input to the decoding strategy part 220. The decoding strategy part 220 can determine the target text unit to be included at the position of the output text sequence based on the adjusted probability distribution. For example, the decoding strategy part 220 can select the candidate text unit with the highest probability as the target text unit according to the specific decoding strategy. Of course, depending on the decoding strategy adopted by the machine learning model 120, the target text unit can also be selected according to other principles based on the probability distribution.
[0052] When adjusting the probability, if at least one candidate text unit is determined to not meet the content verification condition, the probability of at least one candidate text unit that does not meet the content verification condition can be reduced to such an extent that the decoding strategy portion cannot select at least one candidate text unit. For example, the probability of at least one candidate text unit that does not meet the content verification condition can be reduced to 0 or close to 0. For example, in Figure 2 In the example shown, assuming that the candidate text unit W31 is determined to be not in compliance with the content verification condition, the probability of the candidate text unit W31 is reduced from the original highest probability of 66.4% to 0.01%. Based on such a low probability, the decoding strategy conventionally applied by the decoding strategy part 220 usually does not select the corresponding candidate text unit as the outputtable target text unit.
[0053] When the probability is disturbed, the probability of the candidate text units that meet the content verification condition can remain unchanged, or can be dynamically changed to maintain the sum of the probabilities of all candidate text units to be 1.
[0054] In some embodiments, in addition to directly adjusting the probability of candidate texts that do not meet the content verification conditions, the weighting parameters applied to each candidate text unit (or the probability of each candidate text unit) in the decoding strategy part 220 can also be disturbed. Such weighting parameters can be parameters configured by the decoding strategy part 220 to select the target text unit. The content inspection part 230 can instruct the decoding strategy part 220 to reduce (or otherwise change) the weighting parameters applied to one or more candidate text units that do not meet the content verification conditions, thereby reducing the probability of these candidate text units being selected as target text units.
[0055] Of course, in other embodiments, the decoding of the machine learning model 120 can be disturbed in other ways so that the candidate text units determined to not meet the content verification conditions cannot be selected or have only a low probability of being selected as the target text units at the corresponding positions of the output text sequence.
[0056] Due to the introduction of a streaming-like content inspection mechanism, content verification is supported for the output content of each position of the output text sequence, which can ensure content security. In some embodiments, the target text unit that has been content-checked can be provided to the user in a streaming manner. If the previous part of the output text sequence has been decoded by the machine learning model and provided to the user, the target text unit determined by the current position of the output text sequence can be connected to the provided sequence part and provided to the user. From the user's perspective, the text output of each text unit can be seen.
[0057] In some embodiments, if one or more text units are considered ahead when checking the content, and if the text sequence formed by the one or more text units considered ahead and the target text unit to be output at that position does not meet the content verification condition, the one or more text units previously provided can be modified so that the entire text sequence can meet the content verification condition. In this way, from the user's perspective, one or more text units that have been output previously will be rewritten as new text units. However, in general, a text sequence that does not meet the content verification condition will not be provided to the user.
[0058] According to the embodiments of the present disclosure, content review is introduced at the bottom layer of the streaming generated model to achieve streaming generation of safe and compliant content, thereby improving the speed of model reasoning and user experience.
[0059] Figure 3 FIG. 3 is a flowchart of a process 300 for content verification according to some embodiments of the present disclosure. The process 300 may be implemented in Figure 2 The content inspection system 200 is provided.
[0060] In block 310 , the content inspection system 200 obtains a prediction result of the machine learning model for the output text sequence, the prediction result indicating a plurality of candidate text units to be included at a position of the output text sequence.
[0061] At block 320 , content inspection system 200 determines whether each of the plurality of candidate text units meets the content verification condition.
[0062] In box 330, if the content inspection system 200 determines that at least one candidate text unit among the multiple candidate text units does not meet the content verification conditions, the parameters for the at least one candidate text unit used in the decoding strategy portion of the machine learning model are adjusted to reduce the probability of the at least one candidate text unit being selected to be included at a position in the output text sequence.
[0063] In box 340, the content inspection system 200 utilizes the decoding strategy portion of the machine learning model to determine a target text unit to be included at a position in the output text sequence based at least on the adjusted parameters for at least one candidate text unit and the parameters of the remaining candidate text units in the plurality of candidate text units.
[0064] In some embodiments, the prediction result indicates a probability distribution of multiple candidate text units to be included at a position in the output text sequence, the probability distribution indicating the degree to which the multiple candidate text units are each suitable for being included at the position in the output text sequence. In some embodiments, adjusting a parameter for at least one candidate text unit used in a decoding strategy portion of the machine learning model includes adjusting the probability distribution of the multiple candidate text units by reducing the probability of at least one candidate text unit.
[0065] In some embodiments, determining a target text unit to be included at a position of the output text sequence includes: utilizing a decoding strategy portion of a machine learning model to determine a target text unit to be included at a position of the output text sequence based on an adjusted probability distribution.
[0066] In some embodiments, adjusting the probability distribution of the plurality of candidate text units includes reducing the probability of at least one candidate text unit that does not meet the content verification condition to such an extent that the decoding strategy component cannot select the at least one candidate text unit.
[0067] In some embodiments, the content verification condition includes at least one of the following: a content security condition, a non-false information condition, and a predetermined text filtering condition.
[0068] In some embodiments, a portion of the output text sequence has been decoded by a machine learning model, and determining whether each of a plurality of candidate text units satisfies a content verification condition includes: for each of the plurality of candidate text units, determining whether a text sequence consisting of the candidate text unit and at least one text unit in a portion of the output text sequence satisfies the content verification condition.
[0069] In some embodiments, a portion of the output text sequence has been decoded by the machine learning model and provided to the user, and process 300 further includes: connecting the target text unit to the portion and providing it to the user.
[0070] In some embodiments, a portion of the output text sequence has been decoded by a machine learning model and provided to a user, and process 400 also includes: if at least one text unit in the portion of the output text sequence and a text sequence formed by a target text unit do not meet content verification conditions, modifying at least one text unit provided to the user.
[0071] Figure 4 A block diagram of an apparatus 400 for content verification according to some embodiments of the present disclosure is shown. The apparatus 400 may be implemented as or included in the content inspection system 200 or the electronic device 110. Each module / component in the apparatus 400 may be implemented by hardware, software, firmware, or any combination thereof.
[0072] As shown, the device 400 includes an acquisition module 410, which is configured to acquire the prediction result of the machine learning model for the output text sequence, and the prediction result indicates multiple candidate text units to be included at a position of the output text sequence. The device 400 also includes a verification module 420, which is configured to determine whether each of the multiple candidate text units meets the content verification condition; and an adjustment module 430, which is configured to adjust the parameters for at least one candidate text unit used in the decoding strategy part of the machine learning model if it is determined that at least one candidate text unit among the multiple candidate text units does not meet the content verification condition, so as to reduce the probability that at least one candidate text unit is selected to be included at the position of the output text sequence. The device 400 also includes a target determination module 440, which is configured to use the decoding strategy part of the machine learning model to determine the target text unit to be included at the position of the output text sequence based on at least the adjusted parameters for at least one candidate text unit and the parameters of the remaining candidate text units among the multiple candidate text units.
[0073] In some embodiments, the prediction result indicates a probability distribution of multiple candidate text units to be included at a position in the output text sequence, the probability distribution indicating the degree to which the multiple candidate text units are each suitable for being included at the position in the output text sequence. In some embodiments, the adjustment module 430 is configured to adjust the probability distribution of the multiple candidate text units by reducing the probability of at least one candidate text unit.
[0074] In some embodiments, the target determination module 440 is configured to: utilize the decoding strategy portion of the machine learning model to determine the target text unit to be included at the position of the output text sequence based on the adjusted probability distribution.
[0075] In some embodiments, the adjustment module 430 is configured to reduce the probability of at least one candidate text unit not meeting the content verification condition to such an extent that the decoding strategy component cannot select the at least one candidate text unit.
[0076] In some embodiments, the content verification condition includes at least one of the following: a content security condition, a non-false information condition, and a predetermined text filtering condition.
[0077] In some embodiments, a portion of the output text sequence has been decoded by a machine learning model, and the verification module 420 is configured to: for each candidate text unit among a plurality of candidate text units, determine whether a text sequence consisting of the candidate text unit and at least one text unit in a portion of the output text sequence meets a content verification condition.
[0078] In some embodiments, a portion of the output text sequence has been decoded by the machine learning model and provided to the user, and the device 400 also includes: a first providing module configured to connect the target text unit to the portion and provide it to the user.
[0079] In some embodiments, a portion of the output text sequence has been decoded by a machine learning model and provided to a user, and the device 400 also includes: a second providing module, configured to modify at least one text unit provided to the user if a text sequence consisting of at least one text unit in the portion of the output text sequence and a target text unit does not meet content verification conditions.
[0080] Figure 5 1 shows a block diagram of an electronic device 500 in which one or more embodiments of the present disclosure may be implemented. It should be understood that Figure 5 The electronic device 500 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Figure 5 The electronic device 500 shown can be used to implement Figure 1 The electronic device 110, Figure 2Content inspection system 200. Figure 5 The electronic device 500 shown can be used to implement Figure 4 Device 400.
[0081] like Figure 5 As shown, the electronic device 500 is in the form of a general-purpose computing device. The components of the electronic device 500 may include, but are not limited to, one or more processors or processing units 510, a memory 520, a storage device 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. The processing unit 510 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 520. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 500.
[0082] The electronic device 500 typically includes a plurality of computer storage media. Such media may be any available media accessible to the electronic device 500, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 520 may be a volatile memory (e.g., registers, caches, random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 530 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data and may be accessed within the electronic device 500.
[0083] The electronic device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 5 As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 520 may include a computer program product 525 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.
[0084] The communication unit 540 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 500 can be implemented in a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 500 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0085] The input device 550 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 560 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 500 may also communicate with one or more external devices (not shown) through the communication unit 540 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 500, or communicate with any device that allows the electronic device 500 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0086] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0087] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0088] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0089] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0090] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0091] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.
Claims
1. A method for content verification, comprising: Obtaining a prediction result of a machine learning model for an output text sequence, the prediction result indicating a plurality of candidate text units to be included at a position of the output text sequence; Determining whether each of the plurality of candidate text units meets a content verification condition; If it is determined that at least one of the plurality of candidate text units does not meet the content verification condition, adjusting a parameter for the at least one candidate text unit used in a decoding strategy portion of the machine learning model to reduce a probability that the at least one candidate text unit is selected to be included at the position of the output text sequence; as well as Utilizing the decoding strategy portion of the machine learning model, a target text unit to be included at the position in the output text sequence is determined based at least on the adjusted parameters for the at least one candidate text unit and the parameters of the remaining candidate text units in the multiple candidate text units.
2. The method of claim 1, wherein the prediction result indicates a probability distribution of a plurality of candidate text units to be included at a position of the output text sequence, the probability distribution indicating the degree to which the plurality of candidate text units are each suitable for being included at the position of the output text sequence, and wherein adjusting a parameter for the at least one candidate text unit used in a decoding strategy portion of the machine learning model comprises: The probability distribution of the plurality of candidate text units is adjusted by reducing the probability of the at least one candidate text unit.
3. The method of claim 2, wherein determining the target text unit to be included at the position of the output text sequence comprises: Utilizing the decoding strategy portion of the machine learning model, a target text unit to be included at the position of the output text sequence is determined based on the adjusted probability distribution.
4. The method according to claim 2, wherein adjusting the probability distribution of the plurality of candidate text units comprises: The probability of the at least one candidate text unit not meeting the content verification condition is reduced to such an extent that the decoding strategy portion cannot select the at least one candidate text unit.
5. The method according to claim 1, wherein the content verification condition comprises at least one of the following: Content security conditions, The condition of non-false information, Predetermined text filter conditions.
6. The method of claim 1, wherein a portion of the output text sequence has been decoded by the machine learning model, and wherein determining whether each of the plurality of candidate text units satisfies a content verification condition comprises: For each candidate text unit among the plurality of candidate text units, it is determined whether a text sequence formed by the candidate text unit and at least one text unit in the portion of the output text sequence meets the content verification condition.
7. The method of claim 1, wherein a portion of the output text sequence has been decoded by the machine learning model and provided to a user, and the method further comprises: The target text unit is connected to the portion and provided to the user.
8. The method of claim 1, wherein a portion of the output text sequence has been decoded by the machine learning model and provided to a user, and the method further comprises: If a text sequence formed by at least one text unit in the portion of the output text sequence and the target text unit does not meet the content verification condition, the at least one text unit provided to the user is modified.
9. A device for content verification, comprising: an acquisition module configured to acquire a prediction result of a machine learning model for an output text sequence, wherein the prediction result indicates a plurality of candidate text units to be included at a position of the output text sequence; A verification module, configured to determine whether each of the plurality of candidate text units meets a content verification condition; an adjustment module configured to adjust a parameter for the at least one candidate text unit used in a decoding strategy portion of the machine learning model to reduce a probability that the at least one candidate text unit is selected to be included at the position of the output text sequence if it is determined that the at least one candidate text unit among the plurality of candidate text units does not meet the content verification condition; as well as A target determination module is configured to utilize the decoding strategy part of the machine learning model to determine the target text unit to be included at the position of the output text sequence based at least on the adjusted parameters for the at least one candidate text unit and the parameters of the remaining candidate text units in the multiple candidate text units.
10. The apparatus according to claim 9, wherein the prediction result indicates a probability distribution of a plurality of candidate text units to be included at a position of the output text sequence, the probability distribution indicating the degree to which the plurality of candidate text units are each suitable for being included at the position of the output text sequence, and wherein the adjustment module is configured to: The probability distribution of the plurality of candidate text units is adjusted by reducing the probability of the at least one candidate text unit.
11. The apparatus according to claim 10, wherein the target determination module is configured to: Utilizing the decoding strategy portion of the machine learning model, a target text unit to be included at the position of the output text sequence is determined based on the adjusted probability distribution.
12. The apparatus according to claim 10, wherein the adjustment module is configured to: The probability of the at least one candidate text unit not meeting the content verification condition is reduced to such an extent that the decoding strategy portion cannot select the at least one candidate text unit.
13. The apparatus according to claim 9, wherein the content verification condition comprises at least one of the following: Content security conditions, The condition of non-false information, Predetermined text filter conditions.
14. The apparatus of claim 9, wherein a portion of the output text sequence has been decoded by the machine learning model, and wherein the verification module is configured to: For each candidate text unit among the plurality of candidate text units, it is determined whether a text sequence formed by the candidate text unit and at least one text unit in the portion of the output text sequence meets the content verification condition.
15. The apparatus of claim 9, wherein a portion of the output text sequence has been decoded by the machine learning model and provided to a user, and the apparatus further comprises: The first providing module is configured to provide the target text unit to the user after being connected to the part.
16. The apparatus of claim 9, wherein a portion of the output text sequence has been decoded by the machine learning model and provided to a user, and the apparatus further comprises: The second providing module is configured to modify the at least one text unit provided to the user if a text sequence formed by at least one text unit in the part of the output text sequence and the target text unit does not meet the content verification condition.
17. An electronic device comprising: at least one processing unit; as well as At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the device to perform the method according to any one of claims 1 to 8 when executed by the at least one processing unit.
18. A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 8 when executed by a processor.