Model data contamination detection methods, devices, computer equipment and storage media
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]有鉴于此,本申请提出了一种模型数据污染检测方法、装置、计算机设备及存储介质,以解决相关技术中存在的针对强化学习阶段的模型数据污染检测问题
[0037] An embodiment of the fourth aspect of this application provides a computer-readable storage medium storing computer instructions for causing a computer to perform the model data contamination detection method described in the first aspect above.
Smart Images

Figure CN121562582B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence (AI) technology, specifically to a method, apparatus, computer equipment, and storage medium for detecting model data contamination. Background Technology
[0002] The reliability of evaluation results for Large Language Models (LLMs) is easily affected by data contamination; therefore, a data contamination detection mechanism is needed. Data contamination refers to the situation where, during the training process of an LLM, the training samples contain data that the model has "seen" or "optimized" beforehand. This causes the LLM to directly "memorize answers" without performing reasoning based on language understanding, resulting in inflated evaluation results. Data contamination detection involves identifying whether a particular sample has been "seen" or "specifically optimized" by the model during the training phase.
[0003] Currently, data contamination detection is performed in the pre-training and supervised fine-tuning stages by evaluating the likelihood signals generated by the samples under the model (e.g., perplexity with low anomaly), but there is no data contamination detection for the reinforcement learning stage. Summary of the Invention
[0004] In view of this, this application proposes a model data contamination detection method, apparatus, computer equipment, and storage medium to solve the problem of model data contamination detection in the reinforcement learning stage in related technologies.
[0005] A first aspect of this application provides a method for detecting model data contamination, the method comprising:
[0006] The question-answering model to be detected is invoked to process the question information to obtain at least two answer information; each answer information includes multiple word units; the at least two answer information are obtained based on different prompt information.
[0007] For any word element contained in any answer information, the uncertainty of the question-answering model in generating the word element is calculated to obtain multiple uncertainties corresponding to any answer information; the uncertainty is used to reflect the degree of change in the reasoning path of the question-answering model;
[0008] If the similarity of multiple uncertainties of the at least two answer information satisfies a preset similarity condition, it is determined that the question-answering model is contaminated by data.
[0009] This application embodiment calculates the uncertainty of the question-answering model when generating each word, and judges whether the question-answering model is contaminated by data based on the similarity of multiple uncertainties of at least two answer information. It can accurately detect whether the model after reinforcement learning is contaminated by data, thereby helping to improve the question-answering performance of the model.
[0010] In this embodiment of the application, calculating the uncertainty of the question-answering model when generating the lexical units includes:
[0011] Calculate the probability distribution of the question-answering model when generating the word; the probability distribution includes the probability of the question-answering model selecting each candidate word in the vocabulary when generating the word;
[0012] The uncertainty of the question-answering model in generating the lexical units is calculated based on the probability distribution.
[0013] In this embodiment, the following algorithm is used to calculate the uncertainty of the question-answering model when generating the lexical units based on the probability distribution:
[0014]
[0015] in, v Represents any candidate word in the vocabulary. V This represents all candidate lexical units in the vocabulary. This indicates that the question-answering model generates lexical units. The probability distribution of selection for each candidate word in the vocabulary. This indicates that the question-answering model generates the lexical units. Uncertainty at that time.
[0016] In this embodiment of the application, calculating the uncertainty of the question-answering model in generating the lexical units based on the probability distribution includes:
[0017] Multiple target words are selected based on the selection probability of each candidate word; the multiple target words are a preset number of candidate words with selection probabilities from high to low;
[0018] The uncertainty of the question-answering model in generating the terminology is calculated based on the selection probability of the multiple target terms.
[0019] In this embodiment of the application, the at least two answer information includes first answer information and second answer information; the question-answering model to be detected is invoked to process the question information to obtain at least two answer information, including:
[0020] Initial prompts are generated based on the question information and the chat template.
[0021] The initial prompt information is input into the question-answering model to obtain the first answer information;
[0022] The question information, the first answer information, and the reasoning path transformation indication information are fused to obtain self-criticism prompt information;
[0023] The self-criticism prompt is input into the question-and-answer model to obtain the second answer.
[0024] In this embodiment of the application, the method further includes:
[0025] Calculate the similarity parameters between the multiple first uncertainties corresponding to the first answer information and the multiple second uncertainties corresponding to the second answer information;
[0026] If the similarity parameter is greater than a preset similarity threshold, then the similarity of multiple uncertainties of the at least two answer information satisfies the preset similarity condition.
[0027] If the similarity parameter is less than or equal to the preset similarity threshold, then it is determined that the similarity of multiple uncertainties of the at least two answer information does not meet the preset similarity condition.
[0028] In this embodiment of the application, the similarity parameter is a cosine similarity value, and the preset similarity threshold is determined in the following way:
[0029] During the training phase of the question-answering model, two training result information is generated for each training information in the uncontaminated training information set. The two training result information for each training information is obtained by processing different prompt information.
[0030] For any two answer pieces of training information, calculate the cosine similarity between the two answer pieces to obtain the cosine similarity distribution of the multiple question-and-answer processes;
[0031] The cosine similarity distribution (1- The quantile is determined as the preset similarity threshold, wherein, For significance level, 0 < <0.1.
[0032] A second aspect of this application provides a model data contamination detection device, the device comprising:
[0033] The answer information output module is used to call the question-answering model to be tested to process the question information and obtain at least two answer information; each answer information includes multiple word units; the at least two answer information are obtained based on different prompt information.
[0034] The uncertainty calculation module is used to calculate the uncertainty of the question-answering model when generating any word contained in any answer information, and to obtain multiple uncertainties corresponding to any answer information; the uncertainty is used to reflect the degree of change of the reasoning path of the question-answering model;
[0035] The data contamination determination module is used to determine that the question-answering model is contaminated by the training data if the similarity of multiple uncertainties of the at least two answer information satisfies a preset similarity condition.
[0036] An embodiment of the third aspect of this application provides a computer device including a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the model data contamination detection method described in the first aspect above.
[0037] An embodiment of the fourth aspect of this application provides a computer-readable storage medium storing computer instructions for causing a computer to perform the model data contamination detection method described in the first aspect above.
[0038] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0039] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0040] Figure 1 A schematic flowchart of a model data contamination detection method provided in an embodiment of this application is shown;
[0041] Figure 2 A schematic flowchart of another model data contamination detection method provided in an embodiment of this application is shown;
[0042] Figure 3 This illustration shows a schematic diagram of the structure of a model data contamination detection device according to an embodiment of this application;
[0043] Figure 4 This illustration shows a schematic diagram of the structure of a computer device according to an embodiment of this application;
[0044] Figure 5A schematic diagram of a storage medium provided in one embodiment of this application is shown. Detailed Implementation
[0045] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.
[0046] It should be noted that, unless otherwise stated, the technical or scientific terms used in this application shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains.
[0047] The technical scenarios involved in the embodiments of this application are described below.
[0048] The reliability of evaluations for Large Language Models (LLMs) is severely threatened by data contamination. This occurs when benchmark samples are unexpectedly included in the training data, potentially invalidating the model's reported performance. To address this, existing techniques have focused almost exclusively on the pre-training and Supervised Fine-Tuning (SFT) phases. However, these efforts leave a significant gap: the increasingly important post-training phase of Reinforcement Learning (RL). This application argues that this is a critical oversight, as powerful techniques such as Verifiable Reward Reinforcement Learning (RLVR) are now essential for enhancing the inference capabilities of LLMs. This makes the RL phase a major potential source of contamination, yet it has been largely overlooked. The challenge of detecting contamination in the Reinforcement Learning (RL) phase stems from a fundamental shift in training objectives that renders existing methods ineffective. Both pre-training and Supervised Fine-Tuning (SFT) are likelihood-based paradigms; they train the model to maximize the probability of observed data. This process naturally generates strong likelihood-based signals, such as unusually low perplexity, which most current detectors rely on to identify contamination. In contrast, reinforcement learning, especially reward-based reinforcement learning (RLVR), follows the principle of reward maximization. Instead of being trained to mimic the real distribution, the policy seeks successful inference paths through sparse reward signals. This approach typically has stronger generalization capabilities than supervised fine-tuning, but by deviating from likelihood-based objectives, it also eliminates the signals relied upon by traditional detectors. Therefore, contamination detection in the RL stage becomes challenging.
[0049] Given the ineffectiveness of likelihood-based signals, this application's exploration of novel detection methods first focuses on identifying inherent signals in the reward-driven training process. Recent research on reinforcement learning training dynamics points to a promising candidate signal: policy collapse. Specifically, reinforcement learning reduces the search space to improve pass@1 accuracy, but often at the cost of reduced pass@k performance, and produces unique entropy patterns, such as high-entropy concentrations on certain labels. These findings suggest that entropy can serve as a powerful indicator of this collapse and its associated path dependencies. However, preliminary research in this application found that directly using entropy as a contamination signal is unreliable. This is because policy collapse is a general behavior in reinforcement learning and can occur even on clean samples not seen during training. Both contaminated and clean samples can exhibit sparse label-level entropy. This indicates that simple passive checking is insufficient. Therefore, this application implements an active detection mechanism to reveal potential differences. The findings show that contaminated samples are difficult to deviate from (self-criticism) when asked to generate an alternative inference path after being given an initial response, resulting in highly similar entropy curves. In contrast, the model exhibits greater flexibility on clean samples, producing more pronounced entropy patterns.
[0050] Based on these observations, this application implements an entropy-based detection method called "self-criticism," which employs a self-criticism detection strategy. The core idea is to have the model generate two distinct responses to the same question; if these two responses exhibit high similarity in the entropy space, they are marked as contaminated. However, rigorously evaluating this method is challenging because existing benchmarks cannot purely isolate and simulate contamination during the reinforcement learning phase. To overcome this obstacle, embodiments of this application also develop a new benchmark specifically built for this purpose: RL-MIA (Reinforcement Learning Membership Inference Attack). The effectiveness of the self-criticism method is demonstrated by applying RL-MIA to challenging mathematical and logical datasets.
[0051] According to an embodiment of this application, a method for detecting model data contamination is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0052] This embodiment provides a method for detecting model data contamination. Figure 1 This is a flowchart of a model data contamination detection method according to an embodiment of this application, such as... Figure 1 As shown, the process includes the following steps:
[0053] Step S101: Call the question-answering model to be tested to process the question information and obtain at least two answer information.
[0054] Specifically, each answer information includes multiple word elements (each word element can be understood as a token); the at least two answer information are obtained based on different prompt information. For example, the first answer information can be generated by the question-answering model based on the question information and the first inference path, and the second answer information can be generated by the question-answering model based on the first answer information and the second inference path, where the first inference path is different from the second inference path.
[0055] In some specific embodiments, the question-answering model to be detected may refer to the question-answering model after reinforcement learning.
[0056] In some specific embodiments, such as Figure 2 As shown, step S101 above includes steps S1011-S1014:
[0057] Step S1011: Generate initial prompt information based on the problem information and the chat template.
[0058] Specifically, the chat template is used to process the question information into a form that the question-and-answer model can accept and process, namely the processing prompt information mentioned above.
[0059] Step S1012: Input the initial prompt information into the question-and-answer model to obtain the first answer information.
[0060] Specifically, for example, as shown in the following formula:
[0061]
[0062] in, Indicates problem information. Indicates the information about the problem. q The initial prompt message embedded in the chat template. M This represents a question-and-answer model. This represents the initial response of the question-answering model, i.e., the first answer information.
[0063] Step S1013: The question information, the first answer information, and the reasoning path transformation indication information are fused to obtain self-criticism prompt information.
[0064] Specifically, for example, as shown in the following formula:
[0065]
[0066] in, This indicates fusion processing. This indicates a shift in reasoning path, used to control the question-answering model to output answer information via an alternative reasoning path. This represents the second response (i.e., the second answer information) in the question-and-answer model, which is a self-criticism prompt.
[0067] Step S1014: Input the self-criticism prompt information into the question-and-answer model to obtain the second answer information.
[0068] Specifically, after receiving the self-criticism prompt, the method further includes: embedding the self-criticism prompt into the chat template to obtain a second prompt, and inputting the second prompt into the question-answering model so that the question-answering model outputs a second answer based on the second prompt, as shown in the following formula:
[0069]
[0070] in, This indicates the second answer information.
[0071] Step S102: For any word element contained in any answer information, calculate the uncertainty of the question-answering model when generating the word element, and obtain multiple uncertainties corresponding to any answer information.
[0072] Specifically, the uncertainty reflects the degree of variation in the reasoning path of the question-answering model. This uncertainty helps the question-answering model determine whether it used two different reasoning paths when answering the same question twice, and further helps determine whether data contamination exists in the question-answering model.
[0073] In some specific embodiments, step S102 above includes steps S1021-S1022:
[0074] Step S1021: Calculate the probability distribution of the question-answering model when generating the word units.
[0075] Specifically, the probability distribution includes the probability of the question-answering model selecting each candidate word in the vocabulary when generating the word. In other words, when the question-answering model generates a word, it outputs a probability distribution based on the current context (including question information) and its own parameters. This distribution covers all words in the vocabulary. Each word has a corresponding probability value, indicating how likely the question-answering model considers it the next word.
[0076] Step S1022: Calculate the uncertainty of the question-answering model when generating the word units based on the probability distribution.
[0077] Specifically, uncertainty can be understood as entropy. The generation of lexical units by the question-answering model can be calculated using the following formula. Uncertainty at time:
[0078]
[0079] in, v Represents any candidate word in the vocabulary. V This represents all candidate lexical units in the vocabulary. This indicates that the question-answering model generates lexical units. The probability distribution of selection for each candidate word in the vocabulary. This indicates that the question-answering model generates the lexical units. Uncertainty at that time.
[0080] In some specific embodiments, step S1022 above includes steps a1-a2:
[0081] Step a1: Select multiple target words based on the selection probability of each candidate word.
[0082] Specifically, the multiple target word elements are a preset number of candidate word elements with selection probabilities ranging from high to low. The preset number can be set according to actual circumstances, for example, the first N.
[0083] Step a2: Calculate the uncertainty of the question-answering model when generating the target words based on the selection probability of the multiple target words.
[0084] Step S103: If the similarity of multiple uncertainties of the at least two answer information satisfies a preset similarity condition, it is determined that the question-answering model is contaminated by data.
[0085] Specifically, similarity includes, but is not limited to, cosine similarity.
[0086] In some specific embodiments, the method further includes steps b1-b3:
[0087] Step b1: Calculate the similarity parameters between the multiple first uncertainties corresponding to the first answer information and the multiple second uncertainties corresponding to the second answer information.
[0088] Specifically, length-aware (penalized) cosine similarity can be used to calculate similarity parameters, as shown below:
[0089]
[0090] in, This is used to indicate aligning the lengths of multiple first uncertainties and multiple second uncertainties, that is, padding the shorter one with zeros to make their lengths equal. This represents the cosine similarity. This represents the similarity parameter; a higher parameter indicates a greater likelihood that the question-answering model is contaminated with data.
[0091] Step b2: If the similarity parameter is greater than the preset similarity threshold, then determine that the similarity of the multiple uncertainties of the at least two answer information satisfies the preset similarity condition.
[0092] Specifically, the preset similarity threshold can be set according to the actual situation, and no specific limitation is made here.
[0093] Step b3: If the similarity parameter is less than or equal to the preset similarity threshold, then it is determined that the similarity of the multiple uncertainties of the at least two answer information does not meet the preset similarity condition.
[0094] In this embodiment of the application, the first answer information generated by the question-answering model includes multiple word elements, each word element corresponding to an uncertainty, and the uncertainties of multiple word elements constitute a first uncertainty sequence, namely:
[0095]
[0096] Similarly, the second answer information generated by the question-answering model includes multiple word units, each corresponding to an uncertainty. The uncertainties of multiple word units constitute a second uncertainty sequence, that is:
[0097]
[0098] After obtaining the first uncertainty sequence and the second uncertainty sequence, the similarity between the two sequences is calculated. If the similarity is higher than the preset similarity threshold, it indicates that the question-answering model still uses the original reasoning path when instructed to change the reasoning path. This indicates that the model has a memory phenomenon, that is, the question-answering model is contaminated by data.
[0099] In some specific embodiments, the aforementioned preset similarity threshold is determined in the following manner:
[0100] Step c1: During the training phase of the question-answering model, two training result information is generated for each training information in the uncontaminated training information set. The two training result information for each training information is obtained by processing different prompt information.
[0101] Specifically, the process of generating the two training result information can refer to step S101 above, except that this step is for training information in an uncontaminated training information set.
[0102] Step c2: For any two answer pieces of training information, calculate the cosine similarity between the two answer pieces to obtain the cosine similarity distribution of the multiple question-and-answer process.
[0103] Specifically, the specific implementation method for calculating the cosine similarity between two answer information can be referred to step b1 above, and will not be repeated here.
[0104] Step c3, the cosine similarity distribution (1- The quantile is determined as the preset similarity threshold.
[0105] Specifically, For significance level, 0 < <0.1.
[0106] Corresponding to the above implementation of the model data contamination detection method, this application also provides a model data contamination detection device for executing the model data contamination detection method described in the above embodiments. Figure 3 As shown, the model data contamination detection device includes:
[0107] The answer information output module is used to call the question-answering model to be tested to process the question information and obtain at least two answer information; each answer information includes multiple word units; the at least two answer information are obtained based on different prompt information.
[0108] The uncertainty calculation module is used to calculate the uncertainty of the question-answering model when generating any word contained in any answer information, and to obtain multiple uncertainties corresponding to any answer information; the uncertainty is used to reflect the degree of change of the reasoning path of the question-answering model;
[0109] The data contamination determination module is used to determine that the question-answering model is contaminated by the training data if the similarity of multiple uncertainties of the at least two answer information satisfies a preset similarity condition.
[0110] Optionally, the uncertainty calculation module is further configured to calculate the probability distribution of the question-answering model when generating the word; the probability distribution includes the selection probability of each candidate word in the vocabulary when the question-answering model generates the word; and calculate the uncertainty of the question-answering model when generating the word based on the probability distribution.
[0111] Optionally, the uncertainty calculation module is further configured to filter out multiple target words based on the selection probability of each candidate word; the multiple target words are a preset number of candidate words with selection probabilities ranging from high to low; and to calculate the uncertainty of the question-answering model when generating the word based on the selection probabilities of the multiple target words.
[0112] Optionally, the answer information output module is further configured to generate initial prompt information based on the question information and the chat template; input the initial prompt information into the question-and-answer model to obtain the first answer information; fuse the question information, the first answer information, and the reasoning path transformation indication information to obtain self-criticism prompt information; and input the self-criticism prompt information into the question-and-answer model to obtain the second answer information.
[0113] Optionally, the device further includes: a module for determining whether a preset similarity condition is met, configured to calculate a similarity parameter between a plurality of first uncertainties corresponding to the first answer information and a plurality of second uncertainties corresponding to the second answer information; if the similarity parameter is greater than a preset similarity threshold, then it is determined that the similarity of the plurality of uncertainties of the at least two answer information satisfies the preset similarity condition; if the similarity parameter is less than or equal to the preset similarity threshold, then it is determined that the similarity of the plurality of uncertainties of the at least two answer information does not satisfy the preset similarity condition.
[0114] Optionally, the device further includes: a preset similarity threshold determination module, used to generate two training result information for each training information in the uncontaminated training information set during the training phase of the question-answering model, wherein the two training result information for each training information are processed based on different prompt information; for any two answer information of a training information, calculate the cosine similarity of the two answer information to obtain the cosine similarity distribution of the multiple question-answering processes; and divide the (1-) of the cosine similarity distribution into the (1-) The quantile is determined as the preset similarity threshold, wherein, For significance level, 0 < <0.1.
[0115] The model data contamination detection device provided in the above embodiments of this application and the model data contamination detection method provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the applications stored therein.
[0116] This application also provides a computer device for performing the above-described model data contamination detection method. Please refer to... Figure 4 This illustrates a schematic diagram of a computer device provided by some embodiments of this application. For example... Figure 4 As shown, the computer device 4 includes: a processor 400, a memory 401, a bus 402, and a communication interface 403. The processor 400, the communication interface 403, and the memory 401 are connected via the bus 402. The memory 401 stores a computer program that can run on the processor 400. When the processor 400 runs the computer program, it executes the model data contamination detection method provided in any of the foregoing embodiments of this application.
[0117] The memory 401 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 403 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network.
[0118] Bus 402 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. Memory 401 is used to store programs. After receiving an execution instruction, processor 400 executes the program. The model data contamination detection method disclosed in any of the foregoing embodiments can be applied to processor 400, or implemented by processor 400.
[0119] The processor 400 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 400 or by instructions in software form. The processor 400 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 401. The processor 400 reads the information in memory 401 and, in conjunction with its hardware, completes the steps of the above method.
[0120] The computer equipment provided in this application embodiment and the model data contamination detection method provided in this application embodiment are based on the same inventive concept and have the same beneficial effects as the methods they adopt, operate or implement.
[0121] This application also provides a computer-readable storage medium corresponding to the model data contamination detection method provided in the foregoing embodiments. Please refer to... Figure 5 The computer-readable storage medium shown is an optical disc 30, on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it executes the model data contamination detection method provided in any of the foregoing embodiments.
[0122] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.
[0123] The computer-readable storage medium provided in the above embodiments of this application and the model data contamination detection method provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the applications stored therein.
[0124] It should be noted that:
[0125] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known structures and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0126] Similarly, it should be understood that, for the sake of brevity and to aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of this application, various features of this application are sometimes grouped together in a single embodiment, figure, or description thereof. However, this disclosure should not be construed as reflecting a schematic diagram in which the claimed application requires more features than expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this application.
[0127] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of this application and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
[0128] The above description is merely a preferred embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for detecting model data contamination, characterized in that, The method includes: The question-answering model to be detected is invoked to process the question information to obtain at least two answer information; each answer information includes multiple word units; the at least two answer information are obtained based on different prompt information. For any word element contained in any answer information, the uncertainty of the question-answering model in generating the word element is calculated to obtain multiple uncertainties corresponding to any answer information; the uncertainty is used to reflect the degree of change in the reasoning path of the question-answering model; If the similarity of multiple uncertainties of the at least two answer information satisfies a preset similarity condition, it is determined that the question-answering model is contaminated by data. Calculating the uncertainty of the question-answering model in generating the lexical units includes: Calculate the probability distribution of the question-answering model when generating the word; the probability distribution includes the probability of the question-answering model selecting each candidate word in the vocabulary when generating the word; Calculate the uncertainty of the question-answering model when generating the word units based on the probability distribution; The following algorithm is used to calculate the uncertainty of the question-answering model in generating the lexical units based on the probability distribution: in, v Represents any candidate word in the vocabulary. V This represents all candidate lexical units in the vocabulary. This indicates that the question-answering model generates lexical units. The probability distribution of selection for each candidate word in the vocabulary. This indicates that the question-answering model generates the lexical units. Uncertainty at that time.
2. The method according to claim 1, characterized in that, The uncertainty of the question-answering model in generating the lexical units is calculated based on the probability distribution, including: Multiple target words are selected based on the selection probability of each candidate word; the multiple target words are a preset number of candidate words with selection probabilities from high to low; The uncertainty of the question-answering model in generating the terminology is calculated based on the selection probability of the multiple target terms.
3. The method according to claim 1, characterized in that, The at least two answer information includes first answer information and second answer information; the question information is processed by calling the question-answering model to be detected to obtain at least two answer information, including: Initial prompts are generated based on the question information and the chat template. The initial prompt information is input into the question-and-answer model to obtain the first answer information; The question information, the first answer information, and the reasoning path transformation indication information are fused to obtain self-criticism prompt information; The self-criticism prompt is input into the question-and-answer model to obtain the second answer.
4. The method according to claim 3, characterized in that, The method also includes: Calculate the similarity parameters between the multiple first uncertainties corresponding to the first answer information and the multiple second uncertainties corresponding to the second answer information; If the similarity parameter is greater than a preset similarity threshold, then the similarity of multiple uncertainties of the at least two answer information satisfies the preset similarity condition. If the similarity parameter is less than or equal to the preset similarity threshold, then it is determined that the similarity of multiple uncertainties of the at least two answer information does not meet the preset similarity condition.
5. The method according to claim 4, characterized in that, The similarity parameter is a cosine similarity value, and the preset similarity threshold is determined in the following way: During the training phase of the question-answering model, two training result information is generated for each training information in the uncontaminated training information set. The two training result information for each training information is obtained by processing different prompt information. For any two answer pieces of training information, calculate the cosine similarity between the two answer pieces to obtain the cosine similarity distribution of multiple question-and-answer processes; The cosine similarity distribution (1- The quantile is determined as the preset similarity threshold, wherein, For significance level, 0 < <0.
1.
6. A model data contamination detection device, characterized in that, The device includes: The answer information output module is used to call the question-answering model to be tested to process the question information and obtain at least two answer information; each answer information includes multiple word units; the at least two answer information are obtained based on different prompt information. The uncertainty calculation module is used to calculate the uncertainty of the question-answering model when generating any word contained in any answer information, and to obtain multiple uncertainties corresponding to any answer information; the uncertainty is used to reflect the degree of change of the reasoning path of the question-answering model; The data contamination determination module is used to determine that the question-answering model is contaminated by the training data if the similarity of multiple uncertainties of the at least two answer information satisfies a preset similarity condition. Calculating the uncertainty of the question-answering model in generating the lexical units includes: Calculate the probability distribution of the question-answering model when generating the word; the probability distribution includes the probability of the question-answering model selecting each candidate word in the vocabulary when generating the word; Calculate the uncertainty of the question-answering model when generating the word units based on the probability distribution; The following algorithm is used to calculate the uncertainty of the question-answering model in generating the lexical units based on the probability distribution: in, v Represents any candidate word in the vocabulary. V This represents all candidate lexical units in the vocabulary. This indicates that the question-answering model generates lexical units. The probability distribution of selection for each candidate word in the vocabulary. This indicates that the question-answering model generates the lexical units. Uncertainty at that time.
7. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the model data contamination detection method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the model data contamination detection method according to any one of claims 1 to 5.