Method and device for determining sample feature quantiles based on access mode protection
Through the technology of merging and filling pseudo-items in a trusted execution environment, the quantiles of sample features are determined, and the security and performance problems are solved when determining sample feature quantiles, and effective protection of sample feature privacy data is achieved.
Patent Information
- Application Number
- CN202011232020.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-06
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2040-11-06
AI Technical Summary
In a trusted execution environment, it is difficult to find a balance between security and performance when determining the quantiles of sample characteristics, especially when processing important privacy data, and prior art is difficult to effectively protect data privacy.
By reading the sample feature array in the TEE environment sequentially, combining the weight values of the same feature values, filling in pseudo terms to form a new array, and reading the real terms by inadvertent access, thereby determining the feature quantiles and ensuring the access mode No privacy data is disclosed.
In the TEE environment, it is more secure to determine the quantile points of sample features, prevent side channel attacks, protect the private data of sample features, and ensure that read and write operations do not leak sensitive information.
Smart Images

Figure CN112182632B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of data security technology, and in particular, to a method and device for determining sample feature quantiles based on access mode protection. Background Art
[0002] In various application fields that require data processing, data security issues have attracted much attention. Trusted Execution Environment (TEE) can provide an execution environment independent of the operating system, and provide security protection by isolating highly security-sensitive applications from the general software environment. For example, the trusted enclave based on Software Guard Extensions (SGX) technology. Trusted Execution Environment technology usually uses a hardware isolation mechanism to isolate a secure area containing the CPU and memory in the computing platform, and the encrypted data in the memory is only visible inside the CPU. This trusted execution environment technology can provide relatively secure data computing services.
[0003] When performing training or other application processing for a network model in TEE, the CPU can pre-process the sample data. For example, the sample features can be binned, that is, the feature values of multiple sample features can be grouped according to the quantiles, and each group can be regarded as a category value. In an example, for an age set consisting of 1 to 50, the age set can be divided into 4 bins through the quantiles 15, 25, and 35. The sample features after binning can bring a lot of performance improvements to model training. When determining the quantile of an attribute item in the sample feature, the CPU needs to frequently read the sample data from the memory. When the sample data is very important privacy data, the security requirements for processing the sample data using a trusted execution environment will be higher.
[0004] Therefore, it is hoped that there will be an improved solution that can more safely determine the quantiles of sample characteristics in the TEE environment. Summary of the invention
[0005] One or more embodiments of this specification describe a method and device for determining sample feature quantiles based on access mode protection, which can more securely determine the quantiles of sample features in a TEE environment. The specific technical solution is as follows.
[0006] In a first aspect, an embodiment provides a method for determining a sample feature quantile based on access mode protection, which is executed by a CPU in a TEE, wherein the TEE also includes a memory, wherein sample features of N1 samples are stored in the memory, and the sample features include a feature value and a corresponding weight value of any first attribute item in a plurality of attribute items; the method includes:
[0007] Sequentially read a first array containing N1 items from the memory, wherein any item contains a feature value and a corresponding weight value of a first attribute item of any sample among the N1 samples;
[0008] For the N1 eigenvalues in the first array, the weight values corresponding to the eigenvalues with the same value are merged to obtain a first sequence, in which each item includes an eigenvalue and a corresponding merged weight value;
[0009] Filling a number of pseudo items in the first sequence to obtain a second sequence, so that the number of items in the second sequence reaches N1 items; any pseudo item includes a preset feature value and a corresponding preset weight value;
[0010] forming a second array including N1 items based on the second sequence, and writing the second array into the memory;
[0011] Using an oblivious access method, reading items other than a plurality of pseudo items in the second array from the memory;
[0012] The characteristic quantile of the first attribute item is determined based on the read items.
[0013] In one implementation, the step of merging weight values corresponding to eigenvalues with the same value for the N1 eigenvalues in the first array includes:
[0014] Read N1 items from the first array respectively, decrypt each item, and obtain the characteristic value and weight value contained in each item respectively;
[0015] For the N1 eigenvalues obtained by decryption, the weight values corresponding to the eigenvalues with the same value are merged.
[0016] In one implementation, the step of merging weight values corresponding to eigenvalues of the same value includes:
[0017] Sort the N1 eigenvalues in the first array according to their values to obtain an initial sequence consisting of N1 items after reordering;
[0018] For the initial sequence, weight values corresponding to eigenvalues with the same value in the sequence are merged to obtain a first sequence.
[0019] In one implementation, the step of sorting the N1 eigenvalues in the first array according to value size includes:
[0020] The oblivious sort primitive is used to sort the N1 eigenvalues in the first array according to their value sizes.
[0021] In one implementation, the step of merging weight values corresponding to eigenvalues with the same value in the sequence includes:
[0022] For the initial sequence, based on the inadvertent comparison primitive, adjacent eigenvalues in the sequence are compared to see if they are the same, and weight values corresponding to eigenvalues with the same value are merged.
[0023] In one embodiment, the step of reading items other than a plurality of pseudo items in the second array from the memory in an oblivious access manner comprises:
[0024] The oblivious read primitive is used to read N1 items in the second array from the memory, and items other than the plurality of pseudo items are determined from the N1 items.
[0025] In one implementation, the N1 samples are one of a plurality of batch samples in a sample set; and the step of determining the characteristic quantile of the first attribute item based on the read items includes:
[0026] Using an oblivious access method, real items in a plurality of third arrays having a set number of items are read from the memory respectively, the plurality of third arrays also including a plurality of pseudo items, the second array and the plurality of third arrays being obtained based on sample features of different batches of samples in the sample set respectively;
[0027] According to a predetermined method, the second array and the plurality of third arrays are merged in a step-by-step manner until the last array is merged; wherein the merging of any one-level arrays comprises: for a set of eigenvalues containing real items in two arrays, merging the weight values corresponding to the eigenvalues with the same value to obtain a merged sequence; filling a number of pseudo-items in the merged sequence to obtain a filled sequence, so that the number of items in the filled sequence is the sum of the number of items in the two arrays; forming a merged array based on the filled sequence, and writing the merged array into the memory;
[0028] In an oblivious access manner, items other than several pseudo items in a merged array obtained by merging the last level of arrays are read from the memory, and the characteristic quantile of the first attribute item is determined based on the items read from the merged array.
[0029] In one embodiment, the step of forming a merged array based on the filling sequence includes:
[0030] The filling sequence forms an array to be pruned, wherein the number of items in the array to be pruned is the same as the number of items in the filling sequence;
[0031] Based on the comparison between the number of items in the array to be pruned and a preset maximum number of items, a pruning operation is performed on the array to be pruned to obtain a merged array.
[0032] In one implementation, the preset characteristic value is a value greater than the characteristic value of the first attribute item of the N1 samples, and the preset weight value is set to 0.
[0033] In one embodiment, the step of filling a plurality of dummy items in the first sequence to obtain the second sequence includes:
[0034] For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence to obtain a second sequence.
[0035] In one embodiment, the step of filling a plurality of dummy items in the first sequence to obtain the second sequence includes:
[0036] For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence;
[0037] Based on the weight value of each real item except a plurality of pseudo items in the first sequence, determining the maximum quantile and the minimum quantile of the eigenvalue in the real item;
[0038] For each pseudo item in the first sequence, using a preset value as the maximum quantile and the minimum quantile of the characteristic value in the pseudo item;
[0039] Based on the characteristic values, weight values, and corresponding maximum quantiles and minimum quantiles included in each real item and each pseudo item, a second sequence is formed;
[0040] The step of determining the characteristic quantile of the first attribute item based on the read items includes:
[0041] The characteristic quantile of the first attribute item is determined based on the characteristic values, weight values, and corresponding maximum quantile and minimum quantile contained in the read items.
[0042] In a second aspect, an embodiment provides a sample feature quantile determination device based on access mode protection, which is deployed in a CPU in a TEE, wherein the TEE also includes a memory, wherein sample features of N1 samples are stored in the memory, wherein the sample features include a feature value and a corresponding weight value of any first attribute item in a plurality of attribute items; the device includes:
[0043] A sequential reading module is configured to sequentially read a first array containing N1 items from the memory, wherein any item contains a feature value and a corresponding weight value of a first attribute item of any sample in the N1 samples;
[0044] A weight merging module is configured to merge the weight values corresponding to the eigenvalues with the same value in the first array to obtain a first sequence, in which each item includes the eigenvalue and the corresponding merged weight value;
[0045] A pseudo-item filling module is configured to fill a plurality of pseudo-items in the first sequence to obtain a second sequence, so that the number of items in the second sequence reaches N1 items; any pseudo-item includes a preset feature value and a corresponding preset weight value;
[0046] an array writing module, configured to form a second array including N1 items based on the second sequence, and write the second array into the memory;
[0047] an oblivious reading module configured to read items other than a plurality of pseudo items in the second array from the memory in an oblivious access manner;
[0048] The quantile determination module is configured to determine the characteristic quantile of the first attribute item based on the read items.
[0049] In one implementation, the weight merging module is specifically configured as follows:
[0050] Read N1 items from the first array respectively, decrypt each item, and obtain the characteristic value and weight value contained in each item respectively;
[0051] For the N1 eigenvalues obtained by decryption, the weight values corresponding to the eigenvalues with the same value are merged.
[0052] In one implementation, the weight merging module, when merging weight values corresponding to feature values of the same value, includes:
[0053] Sort the N1 eigenvalues in the first array according to their values to obtain an initial sequence consisting of N1 items after reordering;
[0054] For the initial sequence, weight values corresponding to eigenvalues with the same value in the sequence are merged to obtain a first sequence.
[0055] In one implementation, the weight merging module, when sorting the N1 eigenvalues in the first array according to the value size, includes:
[0056] The oblivious sort primitive is used to sort the N1 eigenvalues in the first array according to their value sizes.
[0057] In one implementation, the weight merging module, when merging weight values corresponding to feature values with the same value in the sequence, includes:
[0058] For the initial sequence, based on the inadvertent comparison primitive, adjacent eigenvalues in the sequence are compared to see if they are the same, and weight values corresponding to eigenvalues with the same value are merged.
[0059] In one implementation, the inadvertent reading module is specifically configured as follows:
[0060] The oblivious read primitive is used to read N1 items in the second array from the memory, and items other than the plurality of pseudo items are determined from the N1 items.
[0061] In one implementation, the N1 samples are one of a plurality of batch samples in a sample set; the quantile determination module is specifically configured as follows:
[0062] Using an oblivious access method, real items in a plurality of third arrays having a set number of items are read from the memory respectively, the plurality of third arrays also including a plurality of pseudo items, the second array and the plurality of third arrays being obtained based on sample features of different batches of samples in the sample set respectively;
[0063] According to a predetermined method, the second array and the plurality of third arrays are merged in a step-by-step manner until the last array is merged; wherein the merging of any one-level arrays comprises: for a set of eigenvalues containing real items in two arrays, merging the weight values corresponding to the eigenvalues with the same value to obtain a merged sequence; filling a number of pseudo-items in the merged sequence to obtain a filled sequence, so that the number of items in the filled sequence is the sum of the number of items in the two arrays; forming a merged array based on the filled sequence, and writing the merged array into the memory;
[0064] In an oblivious access manner, items other than several pseudo items in a merged array obtained by merging the last level of arrays are read from the memory, and the characteristic quantile of the first attribute item is determined based on the items read from the merged array.
[0065] In one implementation, the quantile determination module, when forming a merged array based on the padding sequence, includes:
[0066] The filling sequence forms an array to be pruned, wherein the number of items in the array to be pruned is the same as the number of items in the filling sequence;
[0067] Based on the comparison between the number of items in the array to be pruned and a preset maximum number of items, a pruning operation is performed on the array to be pruned to obtain a merged array.
[0068] In one implementation, the preset characteristic value is a value greater than the characteristic value of the first attribute item of the N1 samples, and the preset weight value is set to 0.
[0069] In one implementation, the pseudo-item filling module is specifically configured as follows:
[0070] For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence to obtain a second sequence.
[0071] In one implementation, the pseudo-item filling module is specifically configured as follows:
[0072] For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence;
[0073] Based on the weight value of each real item except a plurality of pseudo items in the first sequence, determining the maximum quantile and the minimum quantile of the eigenvalue in the real item;
[0074] For each pseudo item in the first sequence, using a preset value as the maximum quantile and the minimum quantile of the characteristic value in the pseudo item;
[0075] Based on the characteristic values, weight values, and corresponding maximum quantiles and minimum quantiles included in each real item and each pseudo item, a second sequence is formed;
[0076] The quantile determination module is specifically configured as follows:
[0077] The characteristic quantile of the first attribute item is determined based on the characteristic values, weight values, and corresponding maximum quantile and minimum quantile contained in the read items.
[0078] In a third aspect, an embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute any one of the methods described in the first aspect.
[0079] In a fourth aspect, an embodiment provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any one of the first aspects is implemented.
[0080] The method and device provided in the embodiments of this specification, after merging the weight values of the eigenvalues in the first array, the number of items of the eigenvalues will be reduced, and a number of pseudo-items are filled in the first sequence, so that the number of items in the second sequence can be equal to the number of eigenvalues in the first array, so that the number of array items written to the memory is the same as the number of array items initially read from the memory, and the privacy data of the sample features will not be leaked in the comparison of the access modes of reading and writing. In addition, when the array filled with pseudo-items is read from the memory again, an inadvertent access method can be used to obtain the real items in the array, and the feature quantile can be determined based on the real items. The inadvertent access method can protect the number of real items in the array as much as possible. Therefore, the embodiments of this specification can determine the quantile of sample features more securely in a TEE environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0082] Figure 1 A schematic diagram of an implementation scenario of an embodiment disclosed in this specification;
[0083] Figure 2 A flow chart of a method for determining sample feature quantiles based on access mode protection provided in an embodiment;
[0084] Figure 3 A schematic diagram for comparing the first array, the first sequence and the second sequence;
[0085] Figure 4 is another schematic diagram of the second sequence;
[0086] Figure 5 A schematic diagram of merging array A and array B to obtain array 1;
[0087] Figure 6 A schematic block diagram of a device for determining sample feature quantiles based on access mode protection provided in an embodiment. DETAILED DESCRIPTION
[0088] The solution provided in this specification is described below in conjunction with the accompanying drawings.
[0089] Figure 1Schematic diagram of an implementation scenario of an embodiment disclosed in this specification. The node in the trusted execution environment (TEE) includes a CPU and a memory. The memory is used to store data, the CPU is used to process data, and the CPU can access the data in the memory. Specifically, the CPU can read data from the memory, and use the application running in the CPU to process the data, and write data to the memory. The trusted execution environment isolates the CPU and the memory to form a trusted environment isolated from the outside world. The data stored in the memory is encrypted data. After the CPU reads the encrypted data from the memory, it is decrypted inside the CPU and the data is processed. The data stored by the CPU in the memory is also encrypted data. In this way, the CPU and the memory form a trusted security area through a physical isolation mechanism. Other applications, including operating system OS, BIOS system, virtual machine system, etc., cannot access the data in the security area, and cannot spy on or tamper with the status and data of the application therein.
[0090] The nodes in the trusted execution environment can be understood as nodes or units that apply TEE technology, also known as trusted computing nodes or trusted computing units. TEE nodes can be implemented in physical computers, and their isolation capabilities can prevent other applications from snooping and tampering with the applications and data of trusted computing nodes, ensuring the security of computing. For example, a TEE node can be a trusted computing enclave, and can be implemented using technologies such as SGX or Trust Zone. For example, according to SGX technology, a computing enclave is formed by providing a series of CPU instruction codes to allow user code to create a private memory area with high access rights. Other applications, including various operating systems, cannot access the data in the enclave, and cannot snoop or tamper with the status and data of the applications therein. TEE nodes can be used to perform certain computing tasks.
[0091] When training a neural network model, in order to improve model performance, improve model stability, and reduce model overfitting, sample features can be processed in advance. Binning is a method of processing features in machine learning modeling. Binning, also known as bucketing, K bucketing is to divide feature values into K groups or bins. When binning sample features, it is necessary to determine the quantile. For example, a set of feature values corresponding to an attribute item is [1,1,1,1,2,2,2,2,3,4,5,6,7,8,9,10]. When the quantiles are determined to be 2 and 6, the set of feature values can be divided into three groups: [1,1,1,1,2,2,2,2,], [3,4,5,6], and [7,8,9,10], and each group corresponds to a bin.
[0092] The following describes how to determine the quantile of a certain attribute item. In an application scenario, the sample features of multiple samples are stored in the memory of the TEE node, and the CPU of the TEE node can determine the quantile of the sample features of these samples by accessing the memory. The sample features may include the feature values and corresponding weight values of multiple attribute items. That is, each feature value may have a corresponding weight value, which is used to identify the importance of the feature value.
[0093] The sample features of a sample may include feature values of multiple attribute items, and for each attribute item, the quantile of the attribute item may be determined respectively. For example, the sample may be one of the following objects: goods, users, events, etc. When the sample is a product, the sample features may include attribute items such as price and sales volume; when the sample is a user, the sample features may include attribute items such as user age, income, and consumption amount; when the sample is an event, the sample features may include attribute items such as event text features and event category. The above sample data is usually private data that needs to be kept confidential.
[0094] Sample features are stored in the TEE memory in an encrypted manner. The CPU reads sample data from the memory, decrypts it, and uses it to determine the quantiles. The newly generated data is encrypted and written to the memory. Data such as sample features in the memory are important private data. This encryption working mode of TEE ensures that these private data are only visible inside the CPU, which protects the samples.
[0095] In order to further improve the security of private data in TEE, prevent it from being snooped, and prevent side channel attacks, when determining the sample feature quantile, the embodiment of this specification provides a sample feature quantile determination method based on access mode protection. In this method, it is known that the sample features of N1 samples are stored in the memory, and the sample features include the feature value and corresponding weight value of any first attribute item in multiple attribute items. The CPU sequentially reads the first array containing N1 items from the memory, and for the N1 feature values in the first array, the weight values corresponding to the feature values with the same value size are merged to obtain the first sequence, fill several pseudo items in the first sequence to obtain the second sequence, so that the number of items in the second sequence reaches N1 items, and form a second array containing N1 items based on the second sequence, and write the second array into the memory. When it is necessary to obtain data, an inadvertent access method is used to read the items in the second array except for several pseudo items from the memory, and the feature quantile of the first attribute item is determined based on the read items. Since after the weight values are merged, the number of array items written to the memory is the same as the number of array items initially read from the memory, the privacy of the sample cannot be pried into by comparing the changes in the number of items read from the array and written to the array. This access mode to the memory will not leak the privacy data of the sample features. Moreover, when it is necessary to read the real items of the array filled with pseudo-items from the memory, an inadvertent access method can be used to obtain them, and the feature quantile can be determined based on the real items. The inadvertent access method can protect the real item information in the array from being leaked as much as possible. Therefore, the embodiments of this specification can more securely determine the quantile of sample features in a TEE environment. The above method is described below in conjunction with specific embodiments.
[0096] Figure 2 A flow chart of a method for determining sample feature quantiles based on access mode protection provided in an embodiment. The method is executed by a CPU in a TEE, and the TEE also includes a memory, in which sample features of N1 samples are stored, and the sample features include a feature value and a corresponding weight value of any first attribute item in a plurality of attribute items. The TEE can be implemented in any device, equipment, platform, device cluster, etc. with computing and processing capabilities. The method includes the following steps S210 to S260.
[0097] Step S210, sequentially read a first array containing N1 items from the memory. Any item in the first array contains the feature value and the corresponding weight value of the first attribute item of any sample in the N1 samples, that is, the N1 items in the first array correspond to the feature values and the corresponding weight values of the first attribute items of the N1 samples. N is a positive integer, and N1 can be a pre-set integer. The N1 samples can be part of the samples or all of the samples in the sample set.
[0098] For example, the eigenvalues and weight values of 16 samples on a certain attribute item are [6-1, 5-1, 4-2, 3-2, 1-1, 1-1, 1-2, 1-3, 2-1, 2-2, 2-4, 2-1, 7-1, 8-2, 9-1, 10-2]. The left side of the symbol "-" is the eigenvalue, and the right side is the weight value. The first array can be an array consisting of the encrypted data of the above 16 items.
[0099] Step S220: for the N1 eigenvalues in the first array, the weight values corresponding to the eigenvalues with the same value are merged to obtain a first sequence. Each item in the first sequence includes an eigenvalue and a corresponding merged weight value.
[0100] In a specific implementation, this step can read N1 items from the first array, decrypt each item, and obtain the eigenvalues and weight values contained in each item; for the N1 eigenvalues obtained by decryption, the weight values corresponding to the eigenvalues with the same value are merged. When decrypting each item, it can be performed according to the preset secret key and decryption algorithm.
[0101] In this step, when merging the weight values corresponding to the eigenvalues with the same value, specifically, the N1 eigenvalues in the first array can be sorted according to the value size to obtain an initial sequence consisting of N1 items after reordering; then, for the initial sequence, the weight values corresponding to the eigenvalues with the same value size in the sequence are merged to obtain the first sequence.
[0102] For example, for the eigenvalues and weight values of the following 16 samples on a certain attribute item [6-1, 5-1, 4-2, 3-2, 1-1, 1-1, 1-2, 1-3, 2-1, 2-2, 2-4, 2-1, 7-1, 8-2, 9-1, 10-2], sort their eigenvalues to get the initial sequence [1-1, 1-1, 1-2, 1-3, 2-1, 2-2, 2-4, 2-1, 3-2, 4-2, 5-1, 6-1, 7-1, 8-2, 9-1, 10-2], merge the weight values corresponding to the same eigenvalues in the initial sequence to get the first sequence [1-7, 2-8, 3-2, 4-2, 5-1, 6-1, 7-1, 8-2, 9-1, 10-2]. When merging the weight values of eigenvalues, first sorting the eigenvalues by size can more efficiently achieve the merging of the weight values.
[0103] In the above implementation, when the N1 eigenvalues in the first array are sorted according to the value size, an oblivious sort primitive can be used to implement it. For example, an oblivious sort primitive ObliviousSort or other primitives with the same function are used. In the data processing performed by the internal cache inside the CPU, the oblivious sort primitive is used to prevent the compiler from optimizing specific instructions, thereby preventing possible access mode information leakage, so that the privacy protection when sorting the eigenvalues is more stringent.
[0104] When merging the weight values corresponding to the eigenvalues with the same value in the initial sequence, the adjacent eigenvalues in the sequence can be compared based on the oblivious comparison primitive to see if they are the same, and the weight values corresponding to the eigenvalues with the same value can be merged. For example, the oblivious comparison primitives such as ObliviousEqual, ObliviousGreater, ObliviousGreaterOrEqual, ObliviousLess or ObliviousLessOrEqual are used. Inside the CPU, the use of the above-mentioned oblivious comparison primitives to implement the comparison of eigenvalues can prevent the compiler from optimizing jump instructions, thereby preventing possible access mode information leakage, making the comparison process of eigenvalues safer.
[0105] Step S230, fill a number of pseudo items in the first sequence to obtain a second sequence, so that the number of items in the second sequence reaches N1 items. Any pseudo item contains a preset feature value and a corresponding preset weight value. Pseudo items can be understood as non-real data items and do not participate in the binning calculation in subsequent processing. The second sequence contains items in the first sequence, which are real items, and real items can be understood as real data items.
[0106] When the first array contains eigenvalues of the same value, after the weight values are merged, the number of items in the first sequence will be less than the first array, that is, less than N1 items. In order to protect the access mode, this embodiment fills a number of dummy items in the first sequence to ensure that the number of items in the second sequence reaches N1 items.
[0107] When a number of dummy items are filled in the first sequence, the difference X between the number of items in the first sequence and N1 can be determined, and X dummy items of the difference are filled in the first sequence, so that the number of items in the second sequence can reach N1 items. Among them, N1 = the number of items in the first sequence + X. The number of dummy items varies with different arrays.
[0108] In a specific case, when the number of items in the first sequence is equal to the number of items in the first array, there is no need to fill the first sequence with dummy items, that is, 0 dummy items may be filled in the first sequence.
[0109] The pseudo items filled in the first sequence may be completely identical or different. That is, the preset feature value and the preset weight value may have a set of values or may include multiple sets of values. For example, assuming that three pseudo items need to be filled in the first sequence, the three pseudo items may be completely identical or different.
[0110] There are multiple implementations for setting the preset feature value and the preset weight value, based on the principle of not affecting the data processing result of the real item. For example, the preset weight value can be set to 0. By setting the preset feature value and the preset weight value specifically, it is possible to easily distinguish which items are pseudo items and which items are real items in the subsequent processing process.
[0111] For example, the preset eigenvalue may be a value greater than the eigenvalue of the first attribute item of the above N1 samples, and the preset weight value is set to 0. A value greater than the eigenvalue of the first attribute item of the above N1 samples may be understood as a value greater than the maximum value of multiple eigenvalues of the first attribute item of the above N1 samples. In this embodiment, when filling a plurality of pseudo-items in the first sequence, if the eigenvalues in the first sequence have been sorted from small to large in value, a plurality of pseudo-items may be directly filled at the end of the first sequence to obtain a second sequence. In this way, in the second sequence, each eigenvalue, including real items and pseudo-items, is arranged in order from small to large in value.
[0112] Figure 3 A comparison diagram of the first array, the first sequence and the second sequence. The first row of the array or sequence represents the eigenvalue, and the second row represents the weight value. The first array contains 16 items, and the first sequence contains 10 items, which is 6 items less than the first array. By filling 6 pseudo items at the end of the first sequence, the second sequence can be obtained, and the number of items in the second sequence is the same as the number of items in the first array. The preset eigenvalue in each pseudo item is represented by S, and the preset weight value is 0.
[0113] Step S240, a second array including N1 items is formed based on the second sequence, and the second array is written into the memory. When forming the second array, each item in the second sequence may be encrypted using a preset secret key and encryption algorithm, and each encrypted item is formed into the second array in a predetermined order. When writing the second array into the memory, each item in the second array may be written into the memory sequentially.
[0114] Step S250, using an oblivious access method, read the items in the second array except for a number of dummy items from the memory. This step can be performed when the data in the second array needs to be used.
[0115] Specifically, when implementing this step, an oblivious read primitive may be used to read N1 items in the second array from the memory, and determine items other than a number of pseudo items, i.e., real items, from the N1 items. For example, the oblivious read primitive may include ObliviousAssign or ObliviousChoose, which have similar effects but different parameter positions.
[0116] The oblivious access method can ensure that the reading process of the second array does not leak any private data, and the outside world cannot observe the actual number of items in the second array. The outside world refers to various other applications or machine environments outside the TEE.
[0117] Step S260, determining the characteristic quantile of the first attribute item based on the read items. In this embodiment, the read items can be understood as the read real items. When determining the characteristic quantile of the first attribute item based on the real items, it can be determined according to a conventional algorithm. For example, a chi-square binning algorithm or a Best-KS (Kolmogorov-Smirnov) binning algorithm can be used to determine the characteristic quantile of the first attribute item based on the characteristic values and weight values in each real item.
[0118] The above embodiment can be applied in scenarios with multiple sample features. In another scenario, the number of samples is very large, for example, the number is in the tens of millions or hundreds of millions. When determining the quantile based on a large number of sample features, it is impossible to process the characteristic values of the first attribute items of all samples at one time. At this time, a batch processing method can be adopted, that is, the sample set can be divided into multiple batches, the above N1 sample sets can be understood as one of the batches, and each batch is processed using the process of step S210 to step S240. The process of step S210 to step S240 can also be named Obliviousmake summary algorithm. Then, an oblivious access method is adopted to read the real items in the array of each batch from the memory respectively, and the real items of each batch are merged by weight values, and the characteristic quantile of the first attribute item is determined based on the real items in the merged array.
[0119] In this embodiment, when each batch is processed through the process of step S210 to step S240, the maximum quantile and the minimum quantile may also be determined for each real item, so as to more accurately and quickly determine the characteristic quantile of the first attribute item.
[0120] In this embodiment, the step of filling a plurality of dummy items in the first sequence to obtain the second sequence in step S230 may specifically include the following steps 1a to 4a.
[0121] Step 1a: for the first sequence after sorting the eigenvalues from small to large, fill a number of pseudo items at the end of the first sequence.
[0122] Step 2a, based on the weight value of each real item except for a number of pseudo items in the first sequence, determine the maximum quantile and the minimum quantile of the eigenvalue in the real item. The maximum quantile and the minimum quantile both refer to the maximum quantile order and the minimum quantile order that the eigenvalue may take in the sequence.
[0123] Step 3a: for each pseudo item in the first sequence, the preset value is used as the maximum quantile and the minimum quantile of the characteristic value in the pseudo item.
[0124] Step 4a, forming a second sequence based on the eigenvalues, weight values, and corresponding maximum quantiles and minimum quantiles contained in each real item and each pseudo item.
[0125] In this embodiment, when determining the second sequence, each item adds a maximum quantile (rmax) and a minimum quantile (rmin), the maximum quantile and the minimum quantile of the real item can be determined according to the order of the feature values and the weight value, and the maximum quantile and the minimum quantile of the pseudo item can be preset values. Keeping the structure of the pseudo item and the real item the same can better protect privacy data from the perspective of access mode.
[0126] Figure 4 Another schematic diagram of the second sequence, in which the maximum quantile and the minimum quantile are added. For example, for eigenvalue 1, its weight value is 4, and the maximum quantile that this eigenvalue 1 may take in the sequence is 4, and the minimum quantile is 0. For the pseudo term S, its maximum quantile and minimum quantile are both set to the preset value -1.
[0127] In this embodiment, when determining the characteristic quantile of the first attribute item based on the read items in step S260, the characteristic quantile of the first attribute item can be determined based on the characteristic values, weight values, and corresponding maximum quantile and minimum quantile contained in the read items. This is more applicable in multi-batch and large number sample scenarios.
[0128] In a scenario with a large number of samples, each batch can be processed using the process of step S210 to step S250, and the real items of each batch are merged by weight value, and the characteristic quantile of the first attribute item is determined based on the real items in the merged array. The following embodiment focuses on the problem of array merging of different batches of data.
[0129] In this embodiment, the above N1 samples are a batch sample among multiple batch samples in the sample set. For example, the sample set contains 1,000 samples, and these 1,000 samples are divided into 50 batches, and each 20 samples constitute a batch sample. TEE can read sample features into the memory in batches, and the feature value of the first attribute item of each batch sample corresponds to an array in the memory. The CPU can process the array corresponding to each batch sample according to the process of steps S210 to S240, and write the array filled with pseudo items into the memory.
[0130] In this embodiment, the step of determining the characteristic quantile of the first attribute item based on the read items in step S260 may include the following steps 1b to 3b.
[0131] Step 1b, adopting an oblivious access method, respectively reads real items in multiple third arrays with a set number of items from the memory. Among them, the multiple third arrays also include a number of pseudo items, and the second array and the multiple third arrays are respectively obtained based on the sample characteristics of different batches of samples in the sample set. In this step, the multiple third arrays are arrays obtained after processing in steps S210 to S240. The number of items in the second array and the multiple third arrays can be different, and the multiple third arrays can also be different, that is, they can have different set numbers of items. For more description of the oblivious access method in this step, please refer to the description in step S250.
[0132] Step 2b, in accordance with a predetermined method, the second array and the plurality of third arrays are merged in a step-by-step manner until the last level of array merging. Any level of array merging includes: for a set of eigenvalues containing real items in the two arrays, merging the weight values corresponding to the eigenvalues with the same value to obtain a merged sequence; filling a number of pseudo-items in the merged sequence to obtain a filled sequence, so that the number of items in the filled sequence is the sum of the number of items in the two arrays; forming a merged array based on the filled sequence, and writing the merged array into a memory.
[0133] In this step, the second array and the plurality of third arrays are merged in a predetermined manner, which may include at least the following two methods. One method is to use the second array and the plurality of third arrays as the first-level nodes of an inverted tree, and merge the second array and the plurality of third arrays in a step-by-step manner in the form of an inverted tree. The array merging method of the inverted tree may adopt a treereduce algorithm.
[0134] For example, for the following four arrays A, B, C, and D, take them as the first-level nodes, and merge arrays in the form of an inverted tree, you can first merge array A and array B to get array 1, merge array C and array D to get array 2, and then merge array 1 and array 2 to get array 3. Array 3 is the merged array obtained by merging the last-level arrays.
[0135] Another method is to sort the second array and the plurality of third arrays in order, and merge the arrays one by one from the beginning to the end according to the order. This implementation method can be applied in stream processing. The arrays can be sorted according to the order in which they are processed.
[0136] For example, for the following four arrays A, B, C, and D arranged in sequence, you can merge array A and array B to get array 1, merge array 1 with array C to get array 2, and merge array 2 with array D to get array 3.
[0137] The two arrays in any one-level array merging may include the second array and arrays in multiple third arrays, or may include the merged array obtained in the merging process. Each time an array is merged, the merged array obtained can be written into the memory, and the real items in the array can be read from the memory by using the oblivious access method when needed.
[0138] When the arrays are merged to the last level, it can be understood that after multiple array merging, the data of all samples in the sample set are included in the merged array obtained at the last level.
[0139] The specific implementation of step 2b can be found in Figure 2 The description of steps S220 to S240 in the above description will not be repeated here.
[0140] Step 3b, using the oblivious access method, read the items in the merged array obtained by merging the last level of arrays from the memory except for several pseudo items, and determine the characteristic quantile of the first attribute item based on the items read from the merged array. The items in the array except for several pseudo items are real items. Since each item has been encrypted, it is impossible to distinguish between real items and pseudo items from the outside.
[0141] Figure 5 A schematic diagram of merging array A and array B to obtain array 1. The first to fourth rows of each array represent the eigenvalue, weight value, minimum quantile, and maximum quantile, respectively. The pseudo items in array A and array 1 are selected by boxing, and the pseudo item in array B is 0. Array A and array B both have 15 items. After merging them and filling in pseudo items, array 1 is obtained, which has 30 items. The unselected part on the left side of array 1 is the real item, which is obtained by merging the real items in array A and array B by weight value. The specific array merging process includes obtaining the real items of array A and array B, sorting the real items, merging the weight values, filling in pseudo items, and recalculating the minimum quantile rmin and the maximum quantile rmax.
[0142] The above steps 1b to 3b include the process of merging two batches of arrays and filling them with pseudo items. This process can also be named the ObliviousSetCombin algorithm. When merging arrays, in order to prevent the outside world from performing side channel attacks through access patterns, the number of items in the merged array is usually the sum of the number of items in the two arrays, but as the array merge proceeds, the number of items in the merged array will increase. Therefore, in order to reduce the number of items and avoid side channel attacks, a pruning process can also be added to each array merge. Please refer to the following content for details.
[0143] The step of forming a merged array based on the filling sequence in step 2b may include the following steps 1c and 2c.
[0144] Step 1c, the padding sequence is formed into an array to be pruned, and the number of items in the array to be pruned is the same as the number of items in the padding sequence. The padding sequence is formed into the array to be pruned, and each item in the padding sequence is encrypted to form the array to be pruned. The array to be pruned can also be written into a memory, and then read from the memory when needed.
[0145] Step 2c: based on the comparison between the number of items in the array to be pruned and the preset maximum number of items maxsize, a pruning operation is performed on the array to be pruned to obtain a merged array.
[0146] Specifically, when the number of items srcsize of the array to be pruned is not greater than the preset maximum number of items maxsize, the array to be pruned can be directly used as the merged array. When the number of items srcsize of the array to be pruned is greater than the maximum number of items maxsize, and the number of items maxIndex of the real items contained in the array to be pruned is not greater than the maximum number of items maxsize, the number of pseudo items contained in the array to be pruned is reduced so that the number of items in the merged array is equal to the maximum number of items.
[0147] When the number of items srcsize in the array to be pruned is greater than the maximum number of items maxsize, and the number of items maxIndex of the real items contained in the array to be pruned is greater than the maximum number of items maxsize, delete the pseudo items in the array to be pruned, and prune the real items in the array to be pruned to the maximum number of items maxsize, to obtain a merged array.
[0148] The above pruning operations in different situations can make the dimension of the output array min(maxsize, srcsize). Since the two items in the brackets are fixed values, they will not leak any information about the data distribution, that is, the sample privacy data will not be leaked, and the number of items can be reduced at the same time.
[0149] The foregoing describes certain embodiments of the present specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in an order different from that in the embodiments, and the desired results may still be achieved. In addition, the processes depicted in the accompanying drawings do not necessarily have to be performed in the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0150] Figure 6 A schematic block diagram of a sample feature quantile determination device based on access mode protection provided in an embodiment. The device 600 is deployed in a CPU in a trusted execution environment TEE, and the TEE also includes a memory, in which sample features of N1 samples are stored, and the sample features include a feature value and a corresponding weight value of any first attribute item in multiple attribute items. Figure 2 The device 600 includes:
[0151] A sequential reading module 610 is configured to sequentially read a first array containing N1 items from the memory, wherein any item contains a feature value and a corresponding weight value of a first attribute item of any sample in the N1 samples;
[0152] The weight merging module 620 is configured to merge the weight values corresponding to the eigenvalues with the same value in the first array to obtain a first sequence, in which each item includes the eigenvalue and the corresponding merged weight value;
[0153] The pseudo-item filling module 630 is configured to fill a plurality of pseudo-items in the first sequence to obtain a second sequence, so that the number of items in the second sequence reaches N1 items; any pseudo-item includes a preset feature value and a corresponding preset weight value;
[0154] An array writing module 640 is configured to form a second array including N1 items based on the second sequence, and write the second array into the memory;
[0155] An oblivious reading module 650 is configured to read the items other than the plurality of pseudo items in the second array from the memory in an oblivious access manner;
[0156] The quantile determination module 660 is configured to determine the characteristic quantile of the first attribute item based on the read items.
[0157] In one implementation, the weight merging module 620 is specifically configured as follows:
[0158] Read N1 items from the first array respectively, decrypt each item, and obtain the characteristic value and weight value contained in each item respectively;
[0159] For the N1 eigenvalues obtained by decryption, the weight values corresponding to the eigenvalues with the same value are merged.
[0160] In one implementation, the weight merging module 620, when merging weight values corresponding to feature values of the same value, includes:
[0161] Sort the N1 eigenvalues in the first array according to their values to obtain an initial sequence consisting of N1 items after reordering;
[0162] For the initial sequence, weight values corresponding to eigenvalues with the same value in the sequence are merged to obtain a first sequence.
[0163] In one implementation, when the weight merging module 620 sorts the N1 eigenvalues in the first array according to the value size, it includes using an inadvertent sorting primitive to sort the N1 eigenvalues in the first array according to the value size.
[0164] In one embodiment, when the weight merging module 620 merges the weight values corresponding to the eigenvalues with the same value in the sequence, it includes, for the initial sequence, comparing whether adjacent eigenvalues in the sequence are the same based on the inadvertent comparison primitive, and merging the weight values corresponding to the eigenvalues with the same value.
[0165] In one embodiment, the oblivious read module 650 is specifically configured to use an oblivious read primitive to read N1 items in the second array from the memory, and determine items other than the plurality of pseudo items from the N1 items.
[0166] In one implementation, the N1 samples are one of a plurality of batch samples in the sample set; the quantile determination module 660 is specifically configured as follows:
[0167] Using an oblivious access method, real items in a plurality of third arrays having a set number of items are read from the memory respectively, the plurality of third arrays also including a plurality of pseudo items, the second array and the plurality of third arrays being obtained based on sample features of different batches of samples in the sample set respectively;
[0168] According to a predetermined method, the second array and the plurality of third arrays are merged in a step-by-step manner until the last array is merged; wherein the merging of any one-level arrays comprises: for a set of eigenvalues containing real items in two arrays, merging the weight values corresponding to the eigenvalues with the same value to obtain a merged sequence; filling a number of pseudo-items in the merged sequence to obtain a filled sequence, so that the number of items in the filled sequence is the sum of the number of items in the two arrays; forming a merged array based on the filled sequence, and writing the merged array into the memory;
[0169] In an oblivious access manner, items other than several pseudo items in a merged array obtained by merging the last level of arrays are read from the memory, and the characteristic quantile of the first attribute item is determined based on the items read from the merged array.
[0170] In one implementation, the quantile determination module 660, when forming a merged array based on the filling sequence, includes:
[0171] The filling sequence forms an array to be pruned, wherein the number of items in the array to be pruned is the same as the number of items in the filling sequence;
[0172] Based on the comparison between the number of items in the array to be pruned and a preset maximum number of items, a pruning operation is performed on the array to be pruned to obtain a merged array.
[0173] In one implementation, the preset characteristic value is a value greater than the characteristic value of the first attribute item of the N1 samples, and the preset weight value is set to 0.
[0174] In one implementation, the pseudo-item filling module 630 is specifically configured as follows:
[0175] For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence to obtain a second sequence.
[0176] In one implementation, the pseudo-item filling module 630 is specifically configured as follows:
[0177] For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence;
[0178] Based on the weight value of each real item except a plurality of pseudo items in the first sequence, determining the maximum quantile and the minimum quantile of the eigenvalue in the real item;
[0179] For each pseudo item in the first sequence, using a preset value as the maximum quantile and the minimum quantile of the characteristic value in the pseudo item;
[0180] Based on the characteristic values, weight values, and corresponding maximum quantiles and minimum quantiles included in each real item and each pseudo item, a second sequence is formed;
[0181] The quantile determination module 660 is specifically configured as follows:
[0182] The characteristic quantile of the first attribute item is determined based on the characteristic values, weight values, and corresponding maximum quantile and minimum quantile contained in the read items.
[0183] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0184] The present specification also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute Figures 1 to 5 Any of the methods described above.
[0185] The embodiment of the present specification also provides a computing device, including a memory and a processor, wherein the memory stores an executable code, and when the processor executes the executable code, Figures 1 to 5 Any of the methods described above.
[0186] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the storage medium and computing device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0187] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present invention may be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0188] The specific implementation methods described above further describe the purpose, technical solutions and beneficial effects of the embodiments of the present invention in detail. It should be understood that the above description is only a specific implementation method of the embodiments of the present invention and is not intended to limit the scope of protection of the present invention. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solution of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A method for determining a sample feature quantile based on access mode protection, which is executed by a CPU in a trusted execution environment TEE, wherein the TEE further includes a memory, wherein the memory stores sample features of N1 samples, wherein the sample features include a feature value and a corresponding weight value of any first attribute item among a plurality of attribute items; the method includes: Sequentially read a first array containing N1 items from the memory, wherein any item contains a feature value and a corresponding weight value of a first attribute item of any sample among the N1 samples; For the N1 eigenvalues in the first array, the weight values corresponding to the eigenvalues with the same value are merged to obtain a first sequence, in which each item includes an eigenvalue and a corresponding merged weight value; Filling a number of pseudo items in the first sequence to obtain a second sequence, so that the number of items in the second sequence reaches N1 items; the second sequence includes items in the first sequence, any pseudo item includes a preset feature value and a corresponding preset weight value, and the pseudo item is a non-real data item and does not participate in the binning calculation; forming a second array including N1 items based on the second sequence, and writing the second array into the memory; Using an oblivious access method, reading items other than a plurality of pseudo items in the second array from the memory; The characteristic quantile of the first attribute item is determined based on the read items.
2. According to the method of claim 1, the step of merging the weight values corresponding to the eigenvalues with the same value in the first array comprises: Read N1 items from the first array respectively, decrypt each item, and obtain the characteristic value and weight value contained in each item respectively; For the N1 eigenvalues obtained by decryption, the weight values corresponding to the eigenvalues with the same value are merged.
3. According to the method of claim 1 or 2, the step of merging weight values corresponding to feature values of the same value comprises: Sort the N1 eigenvalues in the first array according to their values to obtain an initial sequence consisting of N1 items after reordering; For the initial sequence, weight values corresponding to eigenvalues with the same value in the sequence are merged to obtain a first sequence.
4. According to the method of claim 3, the step of sorting the N1 eigenvalues in the first array according to the magnitude of the eigenvalues comprises: The oblivious sort primitive is used to sort the N1 eigenvalues in the first array according to their value sizes.
5. According to the method of claim 3, the step of merging weight values corresponding to eigenvalues with the same value in the sequence comprises: For the initial sequence, based on the inadvertent comparison primitive, adjacent eigenvalues in the sequence are compared to see if they are the same, and weight values corresponding to eigenvalues with the same value are merged.
6. The method according to claim 1, wherein the step of reading the items other than the plurality of pseudo items in the second array from the memory in an oblivious access manner comprises: The oblivious read primitive is used to read N1 items in the second array from the memory, and items other than the plurality of pseudo items are determined from the N1 items.
7. According to the method of claim 1, the N1 samples are one of a plurality of batch samples in a sample set; the step of determining the characteristic quantile of the first attribute item based on the read items comprises: Using an oblivious access method, real items in a plurality of third arrays having a set number of items are read from the memory respectively, the plurality of third arrays also including a plurality of pseudo items, the second array and the plurality of third arrays being obtained based on sample features of different batches of samples in the sample set respectively; According to a predetermined method, the second array and the plurality of third arrays are merged in a step-by-step manner until the last array is merged; wherein the merging of any one-level arrays comprises: for a set of eigenvalues containing real items in two arrays, merging the weight values corresponding to the eigenvalues with the same value to obtain a merged sequence; filling a number of pseudo-items in the merged sequence to obtain a filled sequence, so that the number of items in the filled sequence is the sum of the number of items in the two arrays; forming a merged array based on the filled sequence, and writing the merged array into the memory; In an oblivious access manner, items other than several pseudo items in a merged array obtained by merging the last level of arrays are read from the memory, and the characteristic quantile of the first attribute item is determined based on the items read from the merged array.
8. The method according to claim 7, wherein the step of forming a merge array based on the filling sequence comprises: The filling sequence forms an array to be pruned, wherein the number of items in the array to be pruned is the same as the number of items in the filling sequence; Based on the comparison between the number of items in the array to be pruned and a preset maximum number of items, a pruning operation is performed on the array to be pruned to obtain a merged array. 9 . The method according to claim 1 , wherein the preset characteristic value is a value greater than the characteristic value of the first attribute item of the N1 samples, and the preset weight value is set to 0.
10. The method according to claim 9, wherein the step of filling a plurality of dummy items in the first sequence to obtain the second sequence comprises: For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence to obtain a second sequence.
11. The method according to claim 9, wherein the step of filling a plurality of dummy items in the first sequence to obtain the second sequence comprises: For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence; Based on the weight value of each real item except a plurality of pseudo items in the first sequence, determining the maximum quantile and the minimum quantile of the eigenvalue in the real item; For each pseudo item in the first sequence, using a preset value as the maximum quantile and the minimum quantile of the characteristic value in the pseudo item; Based on the characteristic values, weight values, and corresponding maximum quantiles and minimum quantiles included in each real item and each pseudo item, a second sequence is formed; The step of determining the characteristic quantile of the first attribute item based on the read items includes: The characteristic quantile of the first attribute item is determined based on the characteristic values, weight values, and corresponding maximum quantile and minimum quantile contained in the read items.
12. A sample feature quantile determination device based on access mode protection, deployed in a CPU in a trusted execution environment TEE, wherein the TEE further comprises a memory, wherein the sample features of N1 samples are stored in the memory, wherein the sample features comprise a feature value and a corresponding weight value of any first attribute item among a plurality of attribute items; the device comprises: A sequential reading module is configured to sequentially read a first array containing N1 items from the memory, wherein any item contains a feature value and a corresponding weight value of a first attribute item of any sample in the N1 samples; A weight merging module is configured to merge the weight values corresponding to the eigenvalues with the same value in the first array to obtain a first sequence, in which each item includes the eigenvalue and the corresponding merged weight value; A pseudo-item filling module is configured to fill a number of pseudo-items in the first sequence to obtain a second sequence, so that the number of items in the second sequence reaches N1 items; the second sequence includes items in the first sequence, any pseudo-item includes a preset feature value and a corresponding preset weight value, and the pseudo-item is a non-real data item and does not participate in the binning calculation; an array writing module, configured to form a second array including N1 items based on the second sequence, and write the second array into the memory; an oblivious reading module configured to read items other than a plurality of pseudo items in the second array from the memory in an oblivious access manner; The quantile determination module is configured to determine the characteristic quantile of the first attribute item based on the read items.
13. The device according to claim 12, wherein the weight merging module is specifically configured as follows: Read N1 items from the first array respectively, decrypt each item, and obtain the characteristic value and weight value contained in each item respectively; For the N1 eigenvalues obtained by decryption, the weight values corresponding to the eigenvalues with the same value are merged.
14. The device according to claim 12 or 13, wherein the weight merging module, when merging weight values corresponding to feature values of the same value, comprises: Sort the N1 eigenvalues in the first array according to their values to obtain an initial sequence consisting of N1 items after reordering; For the initial sequence, weight values corresponding to eigenvalues with the same value in the sequence are merged to obtain a first sequence.
15. The device according to claim 14, wherein the weight merging module, when sorting the N1 eigenvalues in the first array according to the magnitude of the values, comprises: The oblivious sort primitive is used to sort the N1 eigenvalues in the first array according to their value sizes.
16. The device according to claim 14, wherein the weight merging module, when merging weight values corresponding to feature values with the same value in the sequence, comprises: For the initial sequence, based on the inadvertent comparison primitive, adjacent eigenvalues in the sequence are compared to see if they are the same, and weight values corresponding to eigenvalues with the same value are merged.
17. The device according to claim 12, wherein the inadvertent reading module is specifically configured as follows: The oblivious read primitive is used to read N1 items in the second array from the memory, and items other than the plurality of pseudo items are determined from the N1 items.
18. The device according to claim 12, wherein the N1 samples are one of a plurality of batch samples in a sample set; and the quantile determination module is specifically configured as follows: Using an oblivious access method, real items in a plurality of third arrays having a set number of items are read from the memory respectively, the plurality of third arrays also including a plurality of pseudo items, the second array and the plurality of third arrays being obtained based on sample features of different batches of samples in the sample set respectively; According to a predetermined manner, the second array and the plurality of third arrays are merged level by level until the last level of array merging is performed; wherein any level of array merging includes: For the eigenvalue sets containing the real items in the two arrays, the weight values corresponding to the eigenvalues with the same value are merged to obtain a merged sequence; Filling a number of dummy items in the merged sequence to obtain a filled sequence, so that the number of items in the filled sequence is the sum of the number of items in the two arrays; forming a merged array based on the filled sequence, and writing the merged array into the memory; In an oblivious access manner, items other than several pseudo items in a merged array obtained by merging the last level of arrays are read from the memory, and the characteristic quantile of the first attribute item is determined based on the items read from the merged array.
19. The apparatus according to claim 18, wherein the quantile determination module, when forming a merged array based on the padding sequence, comprises: The filling sequence forms an array to be pruned, wherein the number of items in the array to be pruned is the same as the number of items in the filling sequence; Based on the comparison between the number of items in the array to be pruned and a preset maximum number of items, a pruning operation is performed on the array to be pruned to obtain a merged array. 20 . The device according to claim 12 , wherein the preset characteristic value is a value greater than the characteristic value of the first attribute item of the N1 samples, and the preset weight value is set to 0.
21. The device according to claim 20, wherein the pseudo-item filling module is specifically configured as follows: For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence to obtain a second sequence.
22. The device according to claim 20, wherein the pseudo-item filling module is specifically configured as follows: For a first sequence in which each eigenvalue is sorted from small to large, a plurality of pseudo items are filled at the end of the first sequence; Based on the weight value of each real item except a plurality of pseudo items in the first sequence, determining the maximum quantile and the minimum quantile of the eigenvalue in the real item; For each pseudo item in the first sequence, using a preset value as the maximum quantile and the minimum quantile of the characteristic value in the pseudo item; Based on the characteristic values, weight values, and corresponding maximum quantiles and minimum quantiles included in each real item and each pseudo item, a second sequence is formed; The quantile determination module is specifically configured as follows: The characteristic quantile of the first attribute item is determined based on the characteristic values, weight values, and corresponding maximum quantile and minimum quantile contained in the read items.
23. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 11.
24. A computing device comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 11 is implemented.
