Risk detection method, device, equipment and storage medium for answering data

Through the joint risk estimation method based on preset thinking chains, the answer data generated by the language model is detected risk, which solves the problem of relying on artificial annotation data in the existing technology, and realizes efficient and reliable risk detection of the language model in complex scenarios.

CN119311844BActive Publication Date: 2025-04-11SHENZHEN DIBO ENTERPRISE RISK MANAGEMENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411835242.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-11
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

The prior art relies on large-scale artificial annotation alignment data in the risk detection of the content generated by language model, which leads to complex acquisition process and difficulty in ensuring quality consistency, resulting in low reliability of language models in complex and changing generation task scenarios.

Method used

The response data generated by the language model is combined with a preset thinking chain. By constructing a sequence of questions pointing to compliance, privacy and content vulnerability risks, risk assessment results are generated and the target confidence probability is calculated. Finally, the language model generates new answer data based on the risk joint estimate probability until the risk detection meets the preset threshold.

Benefits of technology

Without relying on large-scale artificial annotation data, the language model can iterate and improve the answer data by itself, improving the usability and reliability of deep learning methods in the direction of data risk detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311844B_ABST
    Figure CN119311844B_ABST
Patent Text Reader

Abstract

The present application relates to the field of natural language processing technology, and discloses a risk detection method, device, equipment and storage medium for answer data. The method includes: obtaining answer data generated by a language model; based on a preset chain of thought, performing joint risk estimation on the answer data to obtain a joint risk estimation probability; judging whether the joint risk estimation probability exceeds a preset probability threshold; if exceeded, enabling the language model to generate new answer data according to the joint risk estimation probability; returning to the step of obtaining the answer data generated by the language model; if not exceeded, outputting the answer data. The embodiments of the present application can improve the usability of data risk detection in deep learning methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a risk detection method, device, equipment and storage medium for answer data. Background Art

[0002] With the continuous development of natural language technology, especially the development of pre-trained language models, the application of natural language processing technology has been developed in many fields, for example, in writing and intelligent assistants. However, the content generated by language models may have risks such as content security, privacy leakage and misinformation.

[0003] In related technologies, risk detection of content generated by language models relies on large-scale manually annotated and aligned data, and fine-tuning technology is used to guide the language model to generate content that meets compliance and security standards. The process of obtaining annotated data is complicated and it is difficult to ensure quality consistency. The reliability is not high in practical applications, which makes it difficult for language models to cope with complex and changeable generation task scenarios. Summary of the invention

[0004] The purpose of this application is to provide a risk detection method, device, equipment and storage medium for answering data, which can improve the usability of data risk detection in the direction of deep learning methods.

[0005] The present application embodiment provides a risk detection method for answer data, including:

[0006] Get the answer data generated by the language model;

[0007] Based on a preset thinking chain, the answer data is subjected to joint risk estimation to obtain a joint risk estimation probability; the thinking chain includes a plurality of question data pointing to corresponding risks, and the joint risk estimation probability represents the confidence that the answer data has the risk pointed to by the thinking chain;

[0008] Determining whether the risk joint estimated probability exceeds a preset probability threshold;

[0009] If it exceeds, the language model is made to generate new answer data according to the risk joint estimated probability; and the step of obtaining the answer data generated by the language model is returned;

[0010] If not exceeded, the answer data is output.

[0011] In some embodiments, before performing risk joint estimation on the answer data based on a preset thought chain to obtain the risk joint estimation probability, the method further includes:

[0012] Constructing a first question sequence, a second question sequence, and a third question sequence; the first question sequence includes question data pointing to compliance risks, the second question sequence includes question data pointing to privacy risks, and the third question sequence includes question data pointing to content vulnerability risks;

[0013] The thinking chain is constructed according to the first question sequence, the second question sequence and the third question sequence.

[0014] In some embodiments, the risk joint estimation of the answer data based on a preset thought chain to obtain the risk joint estimation probability includes:

[0015] splicing the answer data and the question data to obtain multiple sets of first spliced ​​data;

[0016] Performing risk assessment on the first spliced ​​data to obtain a risk assessment result;

[0017] Calculating a target confidence probability; the target confidence probability is a confidence probability that the risk assessment result indicates that the first spliced ​​data has a corresponding risk;

[0018] The target confidence probabilities are jointly estimated to obtain the risk joint estimated probability.

[0019] In some embodiments, performing risk assessment on the first spliced ​​data to obtain a risk assessment result includes:

[0020] The first spliced ​​data is input into the language model to perform context semantic extraction on the first spliced ​​data based on a self-attention mechanism and perform logical reasoning according to the context semantic extraction result, and generate the risk assessment result according to the logical reasoning.

[0021] In some embodiments, the target confidence probability is calculated as follows:

[0022] ,

[0023] in, is the target confidence probability, softmax() is the normalization operation, c is the answer data, q is the question data, Transformer(input) is the risk detection result, input is the first concatenated data, and [yes] is the index symbol of the risk detection result indicating that the answer data has the corresponding risk;

[0024] The calculation formula of the risk joint estimation probability is:

[0025] ,

[0026] Where P is the joint estimated probability of risk, is the target confidence probability pointing to compliance risk, is the target confidence probability pointing to the privacy risk, is the target confidence probability pointing to the content vulnerability risk, is the i-th problem data pointing to compliance risk, is the jth problem data pointing to privacy risk, is the kth problem data pointing to content vulnerability risk, i∈[1,n], j∈[1,m], k∈[1,l], n is the number of problem data pointing to compliance risk, m is the number of problem data pointing to privacy risk, and l is the number of problem data pointing to content vulnerability risk.

[0027] In some embodiments, the step of generating new answer data by the language model based on the risk joint estimation probability includes:

[0028] Generate risk warning data based on the joint estimated probability of the risks;

[0029] splicing the risk warning data and the answer data to obtain second spliced ​​data;

[0030] The second concatenated data is input into the language model to generate the new answer data.

[0031] In some embodiments, before obtaining the answer data generated by the language model, the method further includes:

[0032] Training the model to be trained based on preset training sample data to obtain a trained model;

[0033] The weight parameters of the trained model are adjusted based on the labeled data for the training sample data to obtain the language model.

[0034] The present application also provides a risk detection device for answering data, including:

[0035] The first module is used to obtain answer data generated by the language model;

[0036] The second module is used to perform risk joint estimation on the answer data based on a preset thinking chain to obtain a risk joint estimation probability; the thinking chain includes a plurality of question data pointing to corresponding risks, and the risk joint estimation probability represents the confidence that the answer data has the risk pointed to by the thinking chain;

[0037] The third module is used to determine whether the risk joint estimated probability exceeds a preset probability threshold;

[0038] The fourth module is used to enable the language model to generate new answer data or output the answer data based on the risk joint estimation probability.

[0039] An embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned risk detection method for answer data when executing the computer program.

[0040] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the risk detection method for answer data described above is implemented.

[0041] The beneficial effects of the present application are as follows: based on a preset chain of thought, risk joint estimation is performed on the answer data to obtain a risk joint estimation probability, the risk joint estimation probability is compared with a preset probability threshold, and when the risk joint estimation probability exceeds the probability threshold, the language model is enabled to generate new answer data according to the risk joint estimation probability, and new answer data is generated iteratively in this way until the risk joint estimation probability does not exceed the probability threshold, and the answer data is output. Due to the use of a risk detection method that performs risk joint estimation on the answer data based on a preset chain of thought and enables the language model to generate new answer data according to the risk joint estimation probability, the language model can iteratively improve the answer data by itself, without the need to use large-scale manually annotated alignment data, which can improve the availability of data risk detection in the deep learning method. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 It is a flow chart of the risk detection method of answer data provided in an embodiment of the present application.

[0043] Figure 2 It is a flowchart of the specific method of step S102 provided in an embodiment of the present application.

[0044] Figure 3 It is a flowchart of the specific method of step S104 provided in an embodiment of the present application.

[0045] Figure 4 It is a structural diagram of a risk detection device for answer data provided in an embodiment of the present application.

[0046] Figure 5 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0048] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown can be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second" and the like in the specification, claims and drawings are used to distinguish similar objects, and are not used to describe a specific order or sequence.

[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0050] Figure 1 is a flow chart of the risk detection method for answer data provided by the embodiment of the present application. Figure 1 In some embodiments, the method may include but is not limited to steps S101 to S105.

[0051] It should be noted that the execution subject of the risk detection method for answer data provided in the embodiment of this specification can be applied to terminal-side devices or cloud-side devices, and this embodiment does not limit this.

[0052] Step S101, obtaining answer data generated by the language model.

[0053] The execution subject can obtain the answer data generated by the language model, and the answer data is the data generated by the language model by performing question and answer prediction based on the query data input by the user.

[0054] Preferably, the language model is a deep neural network model based on the Transformer architecture. The language model captures the contextual semantic features of the query data based on the self-attention mechanism, generates a word at each time step according to the contextual semantic features of the query data, and uses the previously generated word as context to generate the next word, and gradually generates text content until the required text length is reached or an end symbol is generated to obtain the answer data.

[0055] Step S102, based on the preset thought chain, perform risk joint estimation on the answer data to obtain the risk joint estimation probability.

[0056] The chain of thought includes multiple question data pointing to corresponding risks. Chain of Thought refers to breaking down logically complex problems, forming a complete thinking process through a series of logically related thoughts, and showing a small number of examples (i.e., multiple question data pointing to corresponding risks) to the large language model and explaining the reasoning process of these examples. The chain of thought aims to let the large language model learn to show the reasoning process when generating answers, so as to guide it to obtain more accurate answers.

[0057] The probability of joint risk estimation represents the confidence that the risk pointed to by the thought chain of the answer data exists. Specifically, it represents the confidence that the result of the thought chain reasoning of the answer data is the existence of risk, that is, the credibility of the various risks pointed to by the thought chain of the answer data. Among them, ‌Joint estimation‌ refers to the method of estimating multiple related parameters or variables at the same time. This method is usually used to process complex data structures in which there are interdependencies among the parameters. The goal of joint estimation is to find a set of parameter values ​​that make these values ​​as close to the actual data as possible while satisfying all relevant conditions. ‌‌

[0058] In the specific implementation, firstly, based on the preset thinking chain, thinking chain reasoning is performed on the answer data to verify whether the answer data has the risks pointed to by multiple question data in the thinking chain, and a thinking chain reasoning result containing multiple question reasoning results is obtained. Then, a joint risk estimation is performed on the multiple question reasoning results in the thinking chain reasoning result to verify the confidence level of the risk in the thinking chain reasoning result, that is, the credibility level of the various risks pointed to by the thinking chain in the answer data, and obtain the joint risk estimation probability.

[0059] In a specific embodiment, before step S102, the method further includes:

[0060] Constructing a first question sequence, a second question sequence, and a third question sequence; the first question sequence includes question data pointing to compliance risks, the second question sequence includes question data pointing to privacy risks, and the third question sequence includes question data pointing to content vulnerability risks;

[0061] Construct a thinking chain based on the first sequence of questions, the second sequence of questions and the third sequence of questions.

[0062] In an embodiment of the present application, the thinking chain contains question data pointing to three categories of risks, and the risks pointed to by the question data are compliance risk, privacy risk and content vulnerability risk, respectively. Among them, the question data pointing to compliance risk constructs a first question sequence, the question data pointing to privacy risk constructs a second question sequence, and the question data pointing to content vulnerability risk constructs a third question sequence.

[0063] It can be understood that the question data pointing to compliance risks are questions about whether the answer data has compliance risks, for example, the question data pointing to compliance risks may be "Does the answer data violate content security specifications?" The question data pointing to privacy risks are questions about whether the answer data has privacy risks, for example, the question data pointing to privacy risks may be "Does the answer data likely expose sensitive information of individuals or organizations?" The question data pointing to content vulnerability risks are questions about whether the answer data has content vulnerability risks, for example, the question data pointing to content vulnerability risks may be "Does the answer data have logical errors or factual inaccuracies?".

[0064] Figure 2 is a flowchart of a specific method of step S102 provided in an embodiment of the present application. Figure 2 In some embodiments, the method includes but is not limited to steps S201 to S204.

[0065] Step S201, concatenating answer data and question data to obtain multiple sets of first concatenated data.

[0066] In a specific implementation, the answer data and each question data in the thinking chain are spliced ​​according to a preset format, so that the question data carries specific answer data, and multiple groups of first spliced ​​data are obtained.

[0067] Step S202: performing risk assessment on the first spliced ​​data to obtain a risk assessment result.

[0068] In a specific implementation, the first spliced ​​data is input into a pre-trained model, and a risk assessment is performed on the first spliced ​​data using the pre-trained model to determine whether the answer data in the first spliced ​​data contains the risk indicated by the question data, and to obtain a risk assessment result where the risk indicated by the question data exists or a risk assessment result where the risk indicated by the question data does not exist.

[0069] Preferably, a language model is used to perform risk assessment on the first spliced ​​data.

[0070] In a specific embodiment, step S202 specifically includes: inputting the first spliced ​​data into a language model to perform context semantic extraction on the first spliced ​​data based on a self-attention mechanism and performing logical reasoning based on the context semantic extraction result, and generating a risk assessment result based on the logical reasoning.

[0071] Step S203, calculating the target confidence probability.

[0072] In a specific embodiment, the calculation formula of the target confidence probability is:

[0073] ,

[0074] in, is the target confidence probability, softmax() is the normalization operation, c is the answer data, q is the question data, Transformer(input) is the risk detection result, input is the first concatenated data, and [yes] is the index symbol of the risk detection result indicating that the answer data has the corresponding risk;

[0075] The target confidence probability is the confidence probability that the risk assessment result indicates that the first spliced ​​data has a corresponding risk.

[0076] Step S204, jointly estimate the target confidence probability to obtain a risk joint estimation probability.

[0077] In a specific embodiment, the calculation formula of the risk joint estimation probability is:

[0078] ,

[0079] Where P is the joint estimated probability of risk, is the target confidence probability pointing to compliance risk, is the target confidence probability pointing to the privacy risk, is the target confidence probability pointing to the content vulnerability risk, is the i-th problem data pointing to compliance risk, is the jth problem data pointing to privacy risk, is the kth problem data pointing to content vulnerability risk, i∈[1,n], j∈[1,m], k∈[1,l], n is the number of problem data pointing to compliance risk, m is the number of problem data pointing to privacy risk, and l is the number of problem data pointing to content vulnerability risk.

[0080] Step S103, determining whether the risk joint estimated probability exceeds a preset probability threshold.

[0081] If it exceeds, execute step S104 and return to step S101; if it does not exceed, execute step S105.

[0082] After obtaining the joint estimated probability of risk, the risk level of the answer data is evaluated according to the joint estimated probability of risk. In the specific implementation, a probability threshold for distinguishing the risk level of the answer data is preset, and the joint estimated probability of risk is compared with the probability threshold. If the joint estimated probability of risk exceeds the probability threshold, it is judged that the risk level of the answer data is high, and there are risks such as violation of regulations, privacy disclosure or content errors. If the joint estimated probability of risk does not exceed the probability threshold, it is necessary to generate new answer data, then the risk level of the answer data is judged to be low, and the current answer data can be output.

[0083] Step S104, based on the joint estimated probability of risk, the language model generates new answer data.

[0084] In a specific implementation, corresponding risk warning data is generated according to the joint estimated probability of risk, and the risk warning data and the current answer data are input into the language model so that the language model generates new answer data according to the risk warning data and the current answer data.

[0085] Figure 3 is a flowchart of a specific method of step S104 provided in an embodiment of the present application. Figure 3 In some embodiments, the method includes but is not limited to steps S301 to S303.

[0086] Step S301, generating risk warning data according to the risk joint estimation probability.

[0087] In the specific implementation, the risk warning data is generated according to the preset format. For example, the risk warning data may be "the answer data has the risk of violation, privacy leakage or content error, please regenerate".

[0088] In some embodiments, the risk warning data may be generated based on the joint estimated probability of risk, and when the joint estimated probability of risk exceeds a preset probability threshold, the corresponding risk warning data may be generated based on the specific value of the target confidence probability of the joint estimated probability of risk. For example, if the reason that the joint estimated probability of risk exceeds the preset probability threshold is that the target confidence probability pointing to the privacy risk exceeds the preset confidence probability threshold, the generated risk warning data may be "There is a risk of violation of the answer data, please regenerate".

[0089] Step S302, concatenating the risk warning data and the answer data to obtain second concatenated data.

[0090] In a specific implementation, the risk warning data and the current answer data are spliced ​​according to a preset format, so that the current answer data carries the specific risk warning data, and the second spliced ​​data is obtained.

[0091] Step S303: input the second concatenated data into a language model to generate new answer data.

[0092] In the specific implementation, the language model captures the contextual semantic features of the second concatenated data based on the self-attention mechanism, generates a word at each time step according to the contextual semantic features of the second concatenated data, and uses the previously generated word as the context to generate the next word, gradually generating text content until the required text length is reached or an end symbol is generated to obtain new answer data.

[0093] Step S105: output answer data.

[0094] In some embodiments, before step S101, the method further includes:

[0095] Training the model to be trained based on preset training sample data to obtain a trained model;

[0096] The weight parameters of the trained model are adjusted based on the labeled data of the training sample data to obtain a language model.

[0097] The goal of training the model to be trained based on the preset training sample data is to improve the language understanding and generation capabilities of the model to be trained through large-scale language data. For the loss function, the cross entropy loss based on maximum likelihood estimation is suitable for the generative model, which is specifically used to predict the next word. This loss function is used to optimize each step of the prediction of the model to be trained during training to ensure the coherence and accuracy of the generated text. The specific loss function form is:

[0098] ,

[0099] Among them, L(θ) is the model loss information of the model to be trained, θ is the weight parameter of the model to be trained, is the target word at time step t, is the word sequence before time step t, t∈[1,T], and T is the number of problem data pointing to compliance risks.

[0100] In the stage of adjusting the weight parameters of the trained model based on the labeled data of the training sample data, the trained model will be fine-tuned on a small number of specific manually labeled aligned datasets containing security, compliance and privacy protection related texts. The cross entropy loss is also used in the fine-tuning, but the focus is on adjusting the weight parameters of the trained model to meet the requirements of trusted generation. The manually labeled dataset is represented as follows:

[0101] ,..., ,

[0102] Among them, x s is the sth input text, y s is the label corresponding to the s-th input text, which is used to guide the trained model to output data that meets the trustworthy standards, s∈[1,S], where S is the number of input texts.

[0103] See also Figure 4 The embodiment of the present application further provides a risk detection device for answer data, which can implement the risk detection method for answer data, and the device includes:

[0104] The first module 401 is used to obtain answer data generated by the language model;

[0105] The second module 402 is used to perform risk joint estimation on the answer data based on a preset thinking chain to obtain a risk joint estimation probability; the thinking chain includes multiple question data pointing to corresponding risks, and the risk joint estimation probability represents the confidence that the answer data has the risk pointed to by the thinking chain;

[0106] The third module 403 is used to determine whether the risk joint estimated probability exceeds a preset probability threshold;

[0107] The fourth module 404 is used to make the language model generate new answer data or output answer data according to the risk joint estimated probability.

[0108] The specific implementation of the risk detection device for answer data is substantially the same as the specific implementation of the risk detection method for answer data described above, and will not be described in detail herein.

[0109] Figure 5 It is a block diagram of an electronic device according to an exemplary embodiment.

[0110] Refer to the following Figure 5 The electronic device 500 according to this embodiment of the present disclosure is described. Figure 5 The electronic device 500 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0111] like Figure 5 As shown, the electronic device 500 is in the form of a general computing device. The components of the electronic device 500 may include, but are not limited to: at least one processing unit 510, at least one storage unit 520, a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510), a display unit 540, etc.

[0112] The storage unit stores program codes, which can be executed by the processing unit 510, so that the processing unit 510 executes the steps according to various exemplary embodiments of the present disclosure described in the risk detection method of answering data in the above-mentioned part of this specification.

[0113] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 5201 and / or a cache storage unit 5202 , and may further include a read-only storage unit (ROM) 5203 .

[0114] The storage unit 520 may also include a program / utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0115] Bus 530 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0116] The electronic device 500 may also communicate with one or more external devices 500' (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 500, and / or communicate with any device that enables the electronic device 500 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 550. Furthermore, the electronic device 500 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 560. The network adapter 560 may communicate with other modules of the electronic device 500 via a bus 530. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0117] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the risk detection method for answer data is implemented.

[0118] The risk detection method, device, equipment and storage medium for answer data provided in the embodiments of the present application jointly estimate the risk of answer data based on a preset chain of thought to obtain a joint risk estimation probability, compare the joint risk estimation probability with a preset probability threshold, and when the joint risk estimation probability exceeds the probability threshold, the language model is enabled to generate new answer data according to the joint risk estimation probability, and new answer data is generated iteratively in this way until the joint risk estimation probability does not exceed the probability threshold, and the answer data is output. Since the risk detection method of jointly estimating the risk of answer data based on a preset chain of thought and enabling the language model to generate new answer data according to the joint risk estimation probability is adopted, the language model can iteratively improve the answer data by itself, without the need to use large-scale manually annotated alignment data, and the availability of the data risk detection direction of the deep learning method can be improved.

[0119] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation of the present disclosure.

[0120] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0121] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0122] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.

[0123] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.

Claims

1. A risk detection method for answer data, characterized in that: include: Get the answer data generated by the language model; Based on a preset thinking chain, the answer data is subjected to joint risk estimation to obtain a joint risk estimation probability; the thinking chain includes a plurality of question data pointing to corresponding risks, and the joint risk estimation probability represents the confidence that the answer data has the risk pointed to by the thinking chain; Determining whether the risk joint estimated probability exceeds a preset probability threshold; If it exceeds, the language model is made to generate new answer data according to the risk joint estimated probability; Return to the step of obtaining the answer data generated by the language model; If not exceeded, output the answer data; Before performing risk joint estimation on the answer data based on the preset thinking chain to obtain the risk joint estimation probability, the method further includes: Constructing a first question sequence, a second question sequence, and a third question sequence; the first question sequence includes question data pointing to compliance risks, the second question sequence includes question data pointing to privacy risks, and the third question sequence includes question data pointing to content vulnerability risks; constructing the thinking chain according to the first question sequence, the second question sequence and the third question sequence; The method of performing joint risk estimation on the answer data based on the preset thinking chain to obtain the joint risk estimation probability includes: splicing the answer data and the question data to obtain multiple sets of first spliced ​​data; Performing risk assessment on the first spliced ​​data to obtain a risk assessment result; Calculating a target confidence probability; the target confidence probability is a confidence probability that the risk assessment result indicates that the first spliced ​​data has a corresponding risk; Performing joint estimation on the target confidence probability to obtain the risk joint estimation probability; The calculation formula of the target confidence probability is: , in, is the target confidence probability, softmax() is the normalization operation, c is the answer data, q is the question data, Transformer(input) is the risk detection result, input is the first concatenated data, and [yes] is the index symbol of the risk detection result indicating that the answer data has the corresponding risk; The calculation formula of the risk joint estimation probability is: , Where P is the joint estimated probability of risk, is the target confidence probability pointing to compliance risk, is the target confidence probability pointing to the privacy risk, is the target confidence probability pointing to the content vulnerability risk, is the i-th problem data pointing to compliance risk, is the jth problem data pointing to privacy risk, is the kth problem data pointing to content vulnerability risk, i∈[1,n], j∈[1,m], k∈[1,l], n is the number of problem data pointing to compliance risk, m is the number of problem data pointing to privacy risk, and l is the number of problem data pointing to content vulnerability risk.

2. The risk detection method for answer data according to claim 1, characterized in that: Performing a risk assessment on the first spliced ​​data to obtain a risk assessment result, including: The first spliced ​​data is input into the language model to perform context semantic extraction on the first spliced ​​data based on a self-attention mechanism and perform logical reasoning according to the context semantic extraction result, and generate the risk assessment result according to the logical reasoning.

3. The risk detection method for answer data according to claim 1, characterized in that: The step of jointly estimating the probability according to the risk so that the language model generates new answer data includes: Generate risk warning data based on the joint estimated probability of the risks; splicing the risk warning data and the answer data to obtain second spliced ​​data; The second concatenated data is input into the language model to generate the new answer data.

4. The risk detection method for answer data according to any one of claims 1 to 3, characterized in that: Before obtaining the answer data generated by the language model, the method further includes: Training the model to be trained based on preset training sample data to obtain a trained model; The weight parameters of the trained model are adjusted based on the labeled data for the training sample data to obtain the language model.

5. A risk detection device for answer data, characterized in that: include: The first module is used to obtain answer data generated by the language model; The second module is used to perform risk joint estimation on the answer data based on a preset thinking chain to obtain a risk joint estimation probability; the thinking chain includes a plurality of question data pointing to corresponding risks, and the risk joint estimation probability represents the confidence that the answer data has the risk pointed to by the thinking chain; The third module is used to determine whether the risk joint estimated probability exceeds a preset probability threshold; A fourth module is used to enable the language model to generate new answer data or output the answer data according to the risk joint estimation probability; Before performing risk joint estimation on the answer data based on the preset thinking chain to obtain the risk joint estimation probability, the method further includes: Constructing a first question sequence, a second question sequence, and a third question sequence; the first question sequence includes question data pointing to compliance risks, the second question sequence includes question data pointing to privacy risks, and the third question sequence includes question data pointing to content vulnerability risks; constructing the thinking chain according to the first question sequence, the second question sequence and the third question sequence; The method of performing joint risk estimation on the answer data based on the preset thinking chain to obtain the joint risk estimation probability includes: splicing the answer data and the question data to obtain multiple sets of first spliced ​​data; Performing risk assessment on the first spliced ​​data to obtain a risk assessment result; Calculating a target confidence probability; the target confidence probability is a confidence probability that the risk assessment result indicates that the first spliced ​​data has a corresponding risk; Performing joint estimation on the target confidence probability to obtain the risk joint estimation probability; The calculation formula of the target confidence probability is: , in, is the target confidence probability, softmax() is the normalization operation, c is the answer data, q is the question data, Transformer(input) is the risk detection result, input is the first concatenated data, and [yes] is the index symbol of the risk detection result indicating that the answer data has the corresponding risk; The calculation formula of the risk joint estimation probability is: , Where P is the joint estimated probability of risk, is the target confidence probability pointing to compliance risk, is the target confidence probability pointing to the privacy risk, is the target confidence probability pointing to the content vulnerability risk, is the i-th problem data pointing to compliance risk, is the jth problem data pointing to privacy risk, is the kth problem data pointing to content vulnerability risk, i∈[1,n], j∈[1,m], k∈[1,l], n is the number of problem data pointing to compliance risk, m is the number of problem data pointing to privacy risk, and l is the number of problem data pointing to content vulnerability risk.

6. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the risk detection method for answer data according to any one of claims 1 to 4 when executing the computer program.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the risk detection method for answer data according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Data compliance self-inspection method and device

    CN114416958A

  • Content compliance judgment method based on thinking chain reasoning implicit generation

    CN116955539A