Data processing method, data processing device and computer readable storage medium
By setting a security level for key-value cache blocks and performing encryption and noise reduction, the problem of insufficient security of key-value cache data is solved, achieving efficient security protection and privacy assurance.
Patent Information
- Application Number
- CN202611381705.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-07
- Publication Date
- 2026-11-27
AI Technical Summary
Existing key-value caching technologies lack security and privacy protection for data, resulting in insufficient security.
By setting different security levels for key-value cache blocks and performing encryption or noise injection based on the security level, including selective encryption and noise injection, combined with a lightweight encryption layer, a differential privacy perturbation layer, and a security control layer, fine-grained data isolation and privacy protection can be achieved.
It improves the security and privacy protection of key-value cached data, preventing unauthorized access and theft, while maintaining inference efficiency and throughput.
Smart Images

Figure CN123180352A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a data processing method, a data processing apparatus, a computer-readable storage medium, and a computer program product. Background Technology
[0002] With the rapid development of large language model technology, intelligent reasoning services have become widely adopted and applied. Large model reasoning processes generally rely on key-value caching mechanisms to accelerate computation. Therefore, the storage method and scheduling strategy of the key-value cache directly determine the operational stability, data transmission efficiency, and response speed of large model context reasoning, playing a crucial supporting role in the efficient and stable operation of large model reasoning services. Summary of the Invention
[0003] The inventors discovered that current key-value caching technologies primarily focus on performance and efficiency, lacking security and privacy protection for key-value cached data, resulting in insufficient security for key-value cached data.
[0004] One of the technical problems this disclosure aims to solve is: how to improve the security of key-value cached data.
[0005] According to one aspect of this disclosure, a data processing method is provided, comprising: receiving a user's request; obtaining a lexical corresponding to the request; generating a plurality of key-value cache blocks based on the lexical, wherein each key-value cache block includes a key-value vector corresponding to at least one lexical; determining a security level for each key-value cache block based on the semantic sensitivity and attention score corresponding to each lexical; and processing each key-value cache block according to the security level, wherein the processing includes at least one of encryption and noise injection.
[0006] In some embodiments, processing each key-value cache block according to the security level includes: determining whether to encrypt the key-value cache block according to the security level; if encrypted, determining the encryption strength according to the security level, wherein the encryption strength is positively correlated with the security level; and encrypting the key-value cache block according to the encryption strength.
[0007] In some embodiments, encrypting the key-value cache block according to the encryption strength includes: determining a key and an encryption algorithm according to the encryption strength, wherein the key is a session key of the session to which the request belongs or a derived key of the session key; and encrypting the key-value cache block using the key and the encryption algorithm.
[0008] In some embodiments, processing each key-value cache block according to the security level includes: for each key-value cache block, determining the semantic sensitivity corresponding to each lexical; injecting noise into the key-value vector corresponding to the sensitive lexical, wherein the sensitive lexical is a lexical whose corresponding semantic sensitivity exceeds a threshold, and the intensity of the noise is determined according to the security level of the key-value cache block to which the sensitive lexical belongs.
[0009] In some embodiments, the intensity of the noise is determined based on the security level of the key-value cache block to which the sensitive word belongs and the attention score corresponding to the sensitive word. The intensity of the noise is negatively correlated with the attention score and positively correlated with the security level.
[0010] In some embodiments, the data processing method further includes: constructing a block table, the block table being used to store indexes of the plurality of key-value cache blocks, encryption tags and key identifiers of encrypted key-value cache blocks, the indexes being used to locate the plurality of key-value cache blocks, and the encrypted key-value cache blocks being encrypted key-value cache blocks among the plurality of key-value cache blocks.
[0011] In some embodiments, the data processing method further includes: decrypting the encrypted key-value cache blocks in the plurality of key-value cache blocks in a secure environment.
[0012] In some embodiments, the request includes multiple requests, and the data processing method further includes at least one of the following: when the multiple requests belong to multiple tenants, grouping requests from the same tenant into the same batch for processing; when the multiple requests belong to the same tenant, grouping requests from the same session into the same batch for processing.
[0013] In some embodiments, the data processing method further includes at least one of the following: when the security level of the first key-value cache block is higher than that of the second key-value cache block and the capacity of the first storage space is insufficient, migrating the second key-value cache block from the first storage space to the second storage space, wherein the first key-value cache block is a key-value cache block to be stored in the first storage space, the second key-value cache block is the key-value cache block with the lowest security level in the first storage space, and the security of the first storage space is higher than that of the second storage space; when prefetching key-value cache blocks in the second storage space, migrating the key-value cache blocks to be prefetched from the second storage space to the first storage space in descending order of security level.
[0014] According to another aspect of this disclosure, a data processing apparatus is provided, comprising: a receiving module configured to receive a user's request; an acquiring module configured to acquire a lexical corresponding to the request; a generating module configured to generate a plurality of key-value cache blocks based on the lexical, wherein each key-value cache block includes a key-value vector corresponding to at least one lexical; a determining module configured to determine a security level for each key-value cache block based on the semantic sensitivity and attention score corresponding to each lexical; and a processing module configured to process each key-value cache block according to the security level, wherein the processing includes at least one of encryption and noise injection.
[0015] According to another aspect of this disclosure, a data processing apparatus is provided, comprising: at least one memory; and at least one processor coupled to said at least one memory, said at least one processor being configured to execute the data processing method described in any of the foregoing embodiments based on instructions stored in said at least one memory.
[0016] According to another aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, the instructions of which, when executed by a processor, implement the data processing method described in any of the foregoing embodiments.
[0017] According to other aspects of this disclosure, a computer program product is provided that, when run on a computer, causes the computer to perform the data processing method as described in any embodiment.
[0018] The embodiments disclosed herein have the following advantages or beneficial effects: by setting different security levels for key-value cache blocks and encrypting or injecting noise according to the security level, more accurate and efficient security processing can be achieved, thereby improving the security of key-value cache data.
[0019] Other features and advantages of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic flowchart illustrating a data processing method according to some embodiments of the present disclosure; Figure 2AThis is an architectural diagram illustrating a data processing system according to some embodiments of the present disclosure; Figure 2B This is a flowchart illustrating the workflow of a data processing system according to some embodiments of the present disclosure; Figure 3 This is a block diagram illustrating a data processing apparatus according to some embodiments of the present disclosure; Figure 4 This is a block diagram illustrating a data processing apparatus according to other embodiments of the present disclosure; Figure 5 This is a block diagram illustrating a computer system for implementing some embodiments of the present disclosure. Detailed Implementation
[0022] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0023] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of this disclosure.
[0024] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.
[0025] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0026] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.
[0027] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0028] First, combined Figure 1 The data processing methods described in this disclosure are explained.
[0029] Figure 1 This is a schematic flowchart illustrating a data processing method according to some embodiments of the present disclosure.
[0030] like Figure 1 As shown, the data processing method includes: step S1, receiving a user's request; step S2, obtaining the lexical units corresponding to the request; step S3, generating multiple key-value cache blocks based on the lexical units, wherein each key-value cache block includes a key-value vector corresponding to at least one lexical unit; step S4, determining a security level for each key-value cache block based on the semantic sensitivity and attention score corresponding to each lexical unit; step S5, processing each key-value cache block according to the security level, wherein the processing includes at least one of encryption and noise injection.
[0031] In step S1, the user can make a request to the system through the interactive interface.
[0032] In step S2, after receiving the user's request, the system can generate corresponding tokens based on the request. For example, it can perform text preprocessing and token segmentation on the complete request text. The preprocessing may include character cleaning, filtering of redundant whitespace characters, and adaptation of special symbols. The tokenizer can split the continuous text string into multiple discrete tokens based on the model's preset vocabulary, forming a token sequence.
[0033] In step S3, the word sequence parsed from the user request is sequentially input into the encoder or self-attention layer of the large model. For each word, a corresponding key vector and value vector are generated. The key vectors and value vectors generated for the same word are bound together to obtain the key-value data corresponding to that word. Then, according to a preset cache block partitioning rule, the key-value data corresponding to at least one word can be encapsulated into a key-value cache block, thereby generating multiple key-value cache blocks.
[0034] In step S4, the security level of the key-value cache block can be determined based on the semantic sensitivity and attention score of the corresponding word. When determining semantic sensitivity, for example, semantic features can be extracted from the text corresponding to the word. Then, based on the extracted semantic features, it can be determined whether the text contains private information or sensitive content, and the semantic sensitivity score corresponding to the word can be output. This score is used as the semantic sensitivity of the word. Alternatively, higher semantic sensitivity scores can be assigned to more sensitive parts such as the earlier layers of representation, value vectors, and recent words. When determining the attention score, for example, the word sequence can be input into the attention layer of the large model. After linear projection, query vectors, key vectors, and value vectors are generated. Based on the query vector and key vector, the original attention weight matrix is obtained through dot product. After scaling and normalization, the attention weights between each word are obtained. Finally, from the attention weight matrix, the attention weights related to the current word are aggregated, for example, the maximum value, average value, or sum of the weights in that row is taken. The aggregated value is used as the attention score corresponding to that word.
[0035] After obtaining the semantic sensitivity and attention scores of each word in the key-value cache block, the security level of the key-value cache block can be determined comprehensively. For example, the maximum value of the semantic sensitivity score of each word in the cache block and the average value of the attention score of each word are obtained, and a weighted calculation is performed to obtain the comprehensive score of the cache block. The higher the comprehensive score, the higher the security level.
[0036] In addition to semantic sensitivity and attention score, when determining the security level, the overall security policy of the tenant, manual marking by the user, etc. can also be considered to comprehensively determine the final security level.
[0037] In step S5, after obtaining the security level of each cache block, a differentiated protection strategy can be set according to the security level, such as setting different encryption strengths or allocating different privacy budgets, so as to achieve different levels of security processing for each cache block.
[0038] By considering the dynamic characteristics of key-value cache data, such as changes in attention scores and semantic sensitivity during its lifecycle, when calculating security levels, fine-grained data isolation and privacy protection can be achieved in multi-user environments, improving the security of key-value cache data while maintaining inference efficiency.
[0039] The process of determining the security level of each key-value cache block has been described above. The following section will detail the specific security handling methods for each key-value cache block.
[0040] In some embodiments, the key-value cache block can be encrypted according to a security level. For example, based on the security level, it is determined whether to encrypt the key-value cache block; if encryption is required, the encryption strength is determined based on the security level, wherein the encryption strength is positively correlated with the security level; and the key-value cache block is encrypted according to the encryption strength.
[0041] For example, key-value cache blocks with lower security levels are not encrypted. Key-value cache blocks with higher security levels are encrypted, and the higher the security level, the stronger the encryption.
[0042] In some embodiments, after determining the encryption strength, a key and an encryption algorithm can be determined based on the encryption strength, and the key-value cache block can be encrypted using the key and the encryption algorithm, wherein the key is the session key of the session to which the request belongs or a derived key of the session key.
[0043] Based on the same session root key, multiple derived keys of different lengths are generated using a key derivation function. Different encryption strengths can correspond to different lengths of derived keys and different encryption algorithms. Encryption algorithms include, for example, the Advanced Encryption Standard-Counter (AES-CTR) algorithm and the ChaCha20 stream cipher algorithm. For instance, low encryption strength uses a 128-bit derived key and is encrypted using the AES-128 algorithm, while high encryption strength uses a 256-bit derived key and is encrypted using the AES-256 algorithm.
[0044] Furthermore, encryption strength can be adjusted through integrity verification strategies. For example, for key-value cache blocks with higher security levels, a high-security hash algorithm can be used to generate and verify integrity tags on top of encryption to enhance privacy protection.
[0045] By selectively encrypting different key-value cache blocks and setting different encryption strengths, key-value cache data of different users can be effectively isolated and protected to prevent unauthorized access or theft, while minimizing the impact on inference efficiency and throughput. This reduces performance overhead and improves the security of key-value cache data.
[0046] In some embodiments, in addition to encryption, noise injection can be performed on the key-value cache blocks according to the security level. For example, for each key-value cache block, the semantic sensitivity corresponding to each term is determined; noise is injected into the key-value vector corresponding to the sensitive term, wherein the sensitive term is the term whose corresponding semantic sensitivity exceeds a threshold, and the intensity of the noise is determined according to the security level of the key-value cache block to which the sensitive term belongs.
[0047] For example, different security levels can correspond to different privacy budgets. The noise intensity can be determined based on the privacy budget; the lower the privacy budget, the higher the injected noise intensity. After determining the noise intensity, irreversible differential noise can be injected into the more sensitive parts of the key-value cache block, such as the value vector. The noise distribution can be, for example, Gaussian noise, Laplace noise, etc.
[0048] In some embodiments, the intensity of the noise is determined based on the security level of the key-value cache block to which the sensitive word belongs and the attention score corresponding to the sensitive word. The intensity of the noise is negatively correlated with the attention score and positively correlated with the security level.
[0049] When injecting noise into sensitive terms in a key-value cache block, the noise intensity depends not only on the security level of the cache block but also on the attention score of each term. For example, a baseline noise intensity can be determined based on the security level of the cache block. Then, for different sensitive terms within that cache block, the baseline noise intensity can be scaled according to their attention scores to determine the final noise intensity. Noise can be injected into different terms based on a utility-aware differential privacy budget allocation principle. For terms with high attention scores, less noise can be injected to avoid affecting model inference and protect model performance. For terms with low attention scores that do not carry important information, more noise can be injected to provide stronger privacy protection.
[0050] By injecting noise into the more sensitive parts of the key-value cache block and dynamically adjusting the noise intensity according to the security level and attention score, more precise security protection is provided. Even if an attacker obtains the perturbed key-value cache data, they cannot reliably infer the original input information, thus providing quantifiable privacy guarantees.
[0051] In some embodiments, the data processing method further includes: constructing a block table, the block table being used to store indexes of the plurality of key-value cache blocks, encryption tags and key identifiers of encrypted key-value cache blocks, the indexes being used to locate the plurality of key-value cache blocks, and the encrypted key-value cache blocks being encrypted key-value cache blocks among the plurality of key-value cache blocks.
[0052] For example, memory tagging can be performed and combined with the paging attention mechanism of the high-efficiency Virtual Large Language Model (vLLM) inference engine. Each key-value cache block is labeled with an "encryption" tag and a corresponding key ID in the block table. Data in high-security blocks is encrypted in real time using the key management service. The processed data is marked as plaintext cache block or encrypted cache block and is ready to be stored in secure storage.
[0053] By storing key-value cache blocks in a block table and binding them with encryption tags and keys, secure scheduling is not limited by physical storage location. Furthermore, when the cache is moved into or out of the secure environment, it can quickly identify whether decryption is required, thus improving execution efficiency.
[0054] The encrypted and perturbed data is securely stored in High Bandwidth Memory (GPUHBM), Dynamic Random Access Memory (CPU DRAM), and Solid State Drive (SSD). During retrieval, the encrypted key-value cache blocks within these multiple key-value cache blocks can be decrypted in a secure environment.
[0055] For example, the large language model computation unit issues a read request, the access control module verifies permissions, and then the block to be decrypted is decrypted in a Trusted Execution Environment (TEE) or a preset security module before being sent to the computation unit. Since only a small amount of noise is injected into the key words during noise injection, the quality of the model's inference on the noisy cache is minimally degraded, and no denoising is required. The decrypted perturbation data can be directly used for computation.
[0056] By decrypting encrypted key-value cache blocks in a secure environment, privacy data leakage is prevented, further ensuring the security of cached data.
[0057] When the request includes multiple requests, when batching the requests, not only prefix sharing can be considered, but security context can also be used as a scheduling basis. For example, if the multiple requests belong to multiple tenants, requests from the same tenant will be processed in the same batch; if the multiple requests belong to the same tenant, requests from the same session will be processed in the same batch.
[0058] During batching, multiple requests from the same tenant or within the same session are prioritized for batching, thus maintaining the same key and policy throughout the computation process without the need for switching. If different tenants must be mixed, the scheduler will intelligently sort the computation order, processing decryption or computation operations that require the same key together whenever possible.
[0059] By using security context as the basis for scheduling and prioritizing requests with the same context, the overhead of key switching and policy reset can be reduced, thus minimizing performance loss.
[0060] To prevent high-security data from remaining in insecure environments for extended periods, cache prefetching and swapping can be scheduled according to security levels. For example, if the security level of the first key-value cache block is higher than that of the second key-value cache block and the capacity of the first storage space is insufficient, the second key-value cache block can be migrated from the first storage space to the second storage space. Here, the first key-value cache block is the one to be stored in the first storage space, and the second key-value cache block is the one with the lowest security level in the first storage space, meaning the first storage space has higher security than the second storage space. When prefetching key-value cache blocks in the second storage space, the blocks to be prefetched are migrated from the second storage space to the first storage space in descending order of security level.
[0061] The first storage space is, for example, the GPU HBM, and the second storage space is, for example, the CPU DRAM or SSD. For instance, if a cache block to be stored has a high security level, but the current GPU HBM capacity is insufficient, the cache block with the lowest security level in the GPU HBM can be swapped out to the CPU DRAM or SSD first, while the cache blocks with higher security levels reside in the GPU HBM, and can be swapped out in encrypted form if necessary. When subsequent inference processes will use cache blocks in the CPU DRAM or SSD, these cache blocks can be prefetched into the GPU HBM in descending order of security level.
[0062] By scheduling data flow according to security level during cache prefetching and swapping, high-security data can be prevented from remaining in insecure environments for extended periods, thereby further improving cache data security.
[0063] The data processing method of this disclosure has been introduced above. This data processing method can be used to implement the data processing system of this disclosure. The following section will combine... Figure 2A The data processing system disclosed herein will be described in detail.
[0064] Figure 2A This is an architectural diagram illustrating a data processing system according to some embodiments of the present disclosure.
[0065] like Figure 2A As shown, the data processing system mainly includes a security control layer, a monitoring and analysis layer, a differential privacy perturbation layer, and a lightweight encryption layer.
[0066] The security control layer includes a security policy manager, a security-aware scheduler, and access control and audit logs. During batching and prefetching caching by the security-aware scheduler, security overhead is minimized through security-aware scheduling and prefetching mechanisms, maintaining high system throughput. When batching requests, not only prefix sharing is considered, but also security contexts such as key IDs and privacy budgets are used as scheduling criteria, prioritizing requests with the same context to reduce key switching and policy reset overhead. During key-value cache prefetching or evicting, data flow is scheduled according to security levels to prevent sensitive data from remaining in insecure environments.
[0067] The monitoring and analysis layer comprises three main parts: key-value cache analysis, dynamic security grading, and policy binding. The context-aware dynamic security grading mechanism includes dynamic security level labeling and policy binding. During dynamic security level labeling, each key-value cache block is assigned a dynamic security level label based on semantic sensitivity, attention score, and user-manual marking. During policy binding, different security levels are bound to differentiated protection policies, such as encryption strength and privacy budget.
[0068] The differential privacy perturbation layer primarily consists of attention-aware noise injection. Before the key-value cache is written to memory, precisely calibrated noise is injected into the sensitive information that needs to be cached. The distribution and intensity of the noise can be dynamically adjusted based on a preset privacy budget and the attention score of the term. Less noise is injected into terms with high attention scores to protect model performance, while more noise is injected into terms with low attention scores to provide stronger privacy protection. Even if an attacker obtains the perturbed key-value cache data, they cannot reliably infer the original input information, providing quantifiable privacy guarantees.
[0069] The lightweight encryption layer comprises three parts: memory tagging, selective encryption, and user-level key management. When the key-value cache is stored in memory, lightweight encryption methods enforce isolation of key-value cache data across different users. During user-level key management, a unique symmetric key is assigned to each user session or tenant. In selective encryption, more sensitive portions of the key-value cache are encrypted in real time. The encryption algorithm employs a computationally efficient lightweight symmetric encryption algorithm designed to be compatible with GPU parallel computing. During memory tagging, combined with paging attention, each key-value cache block is tagged with an "encryption" label and a corresponding key ID in the block table. This label is only decrypted by the trusted execution environment or security module and loaded into Static Random Access Memory (GPU SRAM) for computation when needed.
[0070] The data processing system of this disclosure can improve the security of key-value cached data.
[0071] The overall architecture and functions of the data processing system have been introduced above. The following section will combine... Figure 2B Introduce the system's workflow. Figure 2B This is a flowchart illustrating the workflow of a data processing system according to some embodiments of the present disclosure.
[0072] like Figure 2B As shown, the workflow of a data processing system mainly includes four stages: initialization, request processing, cache storage and retrieval, and resource release.
[0073] The initialization phase mainly includes configuring GPU, CPU, and SSD cache space, as well as starting background services such as monitoring, selection, and management. The system starts the security module, loads the key service and policy manager, and generates session keys and initial privacy budgets for new user sessions.
[0074] During the request processing phase, user requests enter the scheduler, which allocates a security context. When the large language model generates key-value caches, the monitoring and analysis layer analyzes the attention score of each lexical unit in real time and reports metadata to the security policy manager. The security policy manager dynamically assigns security levels and protection policies, giving each key-value cache block a dynamic security level label. Different security levels are bound to different combinations of protection policies. Then, the monitoring and analysis layer distributes the data to the differential privacy perturbation layer according to the policy. The differential privacy perturbation layer perturbs the data, injecting attention-aware differential noise into sensitive content. Finally, a lightweight encryption layer performs memory tagging processing, combining it with a pagination attention mechanism to mark the security status of each cache block in the block table. Data in high-security-level blocks is encrypted in real time using keys from the key management service. The processed data is marked as either plaintext or encrypted cache blocks, ready for secure storage.
[0075] During the cache storage and retrieval phases, the security-aware scheduler optimizes request batching based on the security context, reducing key switching overhead. Encrypted and perturbed data is securely stored in GPU HBM, CPU DRAM, and SSD. During retrieval, the large language model computation unit issues a read request, and the access control module verifies permissions. Blocks requiring decryption are decrypted in the TEE or security module and then sent to the computation unit. The large language model then uses the processed cached data for the next round of generation computation.
[0076] During the resource release phase, the key is destroyed upon the end of the session, and the relevant cache area is securely erased.
[0077] The following section describes the overall workflow of the system using a specific cloud service multi-tenant AI platform scenario.
[0078] For example, a cloud provider offering large language model inference services runs three tenants' AI applications simultaneously on a single server using virtualization technology. Tenant A's application is a code generation assistant, handling enterprise users' private code repositories. Tenant B's application is a medical consultation robot, providing hospitals with initial patient consultations. Tenant C's application is a marketing copy generator, creating advertising copy for users.
[0079] The system must ensure that the key-value cache data of the three tenants are completely isolated in the shared GPU memory, CPU memory and storage, so that even if the application of one tenant is attacked, it cannot steal the sensitive data of other tenants.
[0080] When the system starts, the security policy manager preloads different security policy templates for each tenant.
[0081] When tenant A initiates a session, the key management service generates a session key K_A1 derived from tenant A's master key. Simultaneously, the security policy manager marks the session as a "code" context and initializes a privacy budget. Similarly, tenant B's user session receives a session key K_B1 derived from tenant B's master key and is marked as a "medical" context, employing a stricter privacy budget. Tenant C's user session receives a session key K_C1 derived from tenant C's master key and is marked as a "general" context.
[0082] During the request processing phase, upon receiving a user request from tenant A stating "Please optimize the following function:...", the monitoring and analysis layer detects the code snippet and, based on tenant A's policy, marks the key-value cache block containing the function logic as having a high security level. The secure runtime engine uses K_A1 to perform selective encryption on this part of the cache and injects a small amount of noise into common symbols in the code.
[0083] Upon receiving a user request from tenant B, "My father has a history of diabetes, and his blood pressure has recently risen to 160 / 100. What should we be aware of?", the module detects medical information such as "diabetes" and "blood pressure 160 / 100" and, based on tenant B's strict policy, marks it as the highest security level. The engine uses K_B1 to enforce encryption on all this information and injects high-intensity differential privacy noise into the value vector of the entire sentence to prevent privacy inference to the greatest extent possible.
[0084] When the analysis module receives a user request from tenant C to "write a lively social media caption for a new coconut-scented shampoo," it determines that the information is non-sensitive and marks it as low-security. The engine does not perform encryption; it only injects standard-strength noise into the value vector to balance performance and privacy.
[0085] Upon receiving these three concurrent requests, the security-aware scheduler identifies that they belong to three different security contexts. To reduce performance overhead, the scheduler prioritizes grouping multiple requests within the same tenant, such as grouping two user requests from tenant A together. This ensures that the same key and policy are maintained throughout the computation process, eliminating the need for switching. If different tenants must be mixed, the scheduler intelligently reorders the computation, processing decryption / computation operations requiring the same key as much as possible.
[0086] Suppose an attacker exploits a vulnerability in tenant C to attempt to scan GPU memory. The attacker can only access tenant A's encrypted cache, tenant B's encrypted cache, and tenant C's noisy plaintext cache. Lacking the encryption key, the attacker cannot decrypt the cached data, and due to the noise superimposed on the sensitive data, even if the attacker obtained the key, they would be unable to recover the original content.
[0087] When the large language model needs to read tenant A's encrypted cache block for the next round of code generation, the access control module verifies the request's origin. Only a legitimate session from tenant A can trigger the decryption process using K_A1. Requests from tenant B or C fail verification and therefore can never access tenant A's plaintext data.
[0088] When a user session ends, the corresponding session key is immediately destroyed. When a tenant's contract with the cloud service expires, the cloud administrator only needs to revoke the tenant's master key in the key management service. This operation permanently invalidates all historical key-value cache data generated by the tenant that may still remain on the storage device, making it impossible to decrypt.
[0089] The following is for reference. Figure 3 and Figure 4 This invention describes a data processing apparatus according to embodiments of the present disclosure, used to perform any of the embodiments of the data processing methods described above. Figure 3 This is a block diagram illustrating a data processing apparatus according to some embodiments of the present disclosure.
[0090] like Figure 3 As shown, the data processing device 3 includes: a receiving module 31 configured to receive a user's request; an acquisition module 32 configured to acquire the lexical corresponding to the request; a generation module 33 configured to generate multiple key-value cache blocks based on the lexical, wherein each key-value cache block includes a key-value vector corresponding to at least one lexical; a determination module 34 configured to determine a security level for each key-value cache block based on the semantic sensitivity and attention score corresponding to each lexical; and a processing module 35 configured to process each key-value cache block according to the security level, wherein the processing includes at least one of encryption and noise injection.
[0091] The receiving module 31 of the data processing device 3 can, for example, be used to perform... Figure 1 Step S1. The acquisition module 32 of the data processing device 3 can, for example, be used to perform... Figure 1 Step S2. The generation module 33 of the data processing device 3 can, for example, be used to perform... Figure 1 Step S3. The determination module 34 of the data processing device 3 can, for example, be used to perform... Figure 1 Step S4. The processing module 35 of the data processing device 3 can, for example, be used to perform... Figure 1 Step S5.
[0092] It should be understood that the data processing apparatus 3 may also include other modules for performing other steps in the data processing method of the embodiments of this disclosure.
[0093] The data processing apparatus of this disclosure can improve the security of key-value cached data.
[0094] Figure 4 A schematic diagram of the structure of a data processing apparatus according to other embodiments of the present disclosure is shown. For example... Figure 4 As shown, the data processing apparatus 4 of this embodiment includes: at least one memory 41; and at least one processor 42 coupled to the at least one memory 41, the at least one processor 42 being configured to execute the data processing method described in any of the foregoing embodiments based on instructions stored in the at least one memory 41.
[0095] The memory 41 may include, for example, system memory, fixed non-volatile storage media, etc. The system memory stores, for example, the operating system, application programs, boot loader, and other programs.
[0096] The data processing apparatus of this disclosure can improve the security of key-value cached data.
[0097] Figure 5 This is a block diagram illustrating a computer system for implementing some embodiments of the present disclosure. Figure 5 As shown, the computer system 5 includes a memory 51 and a processor 52, and may also include an input / output interface 53, a network interface 54, a storage interface 55, etc. These interfaces 53, 54, and 55, as well as the memory 51 and processor 52, can be connected, for example, via a bus 56. The input / output interface 53 provides a connection interface for input / output devices such as a monitor, mouse, keyboard, and touchscreen. The network interface 54 provides a connection interface for various networked devices. The storage interface 55 provides a connection interface for external storage devices such as SD cards and USB flash drives.
[0098] Embodiments of this disclosure also provide a computer-readable storage medium having a computer program stored thereon, the instructions of which, when executed by a processor, implement the data processing method described in any of the foregoing embodiments.
[0099] According to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product that, when run on a computer, causes the computer to implement the data processing method described in any of the foregoing embodiments. The computer program product includes computer instructions carried on a computer-readable medium, the computer instructions containing program code for performing the methods shown in the flowcharts.
[0100] The data processing method of this disclosure can improve the security of key-value cache data.
[0101] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0102] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0103] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0104] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0105] The above description is only a preferred embodiment of this disclosure and is not intended to limit this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the protection scope of this disclosure.
Claims
1. A data processing method, comprising: Receive user requests; Obtain the lexical units corresponding to the request; Based on the lexical, multiple key-value cache blocks are generated, wherein each key-value cache block includes a key-value vector corresponding to at least one lexical; For each key-value cache block, the security level is determined based on the semantic sensitivity and attention score corresponding to each term. Each key-value cache block is processed according to the security level, wherein the processing includes at least one of encryption and noise injection.
2. The data processing method according to claim 1, wherein, Processing each key-value cache block according to the security level includes: Based on the security level, determine whether to encrypt the key-value cache block; In the case of encryption, the encryption strength is determined according to the security level, wherein the encryption strength is positively correlated with the security level; The key-value cache block is encrypted according to the encryption strength.
3. The data processing method according to claim 2, wherein, Encrypting the key-value cache block according to the encryption strength includes: Based on the encryption strength, a key and an encryption algorithm are determined, wherein the key is the session key of the session to which the request belongs or a derived key of the session key; The key-value cache block is encrypted using the key and the encryption algorithm.
4. The data processing method according to claim 1, wherein, Processing each key-value cache block according to the security level includes: For each key-value cache block, determine the semantic sensitivity corresponding to each lexical unit; Noise is injected into the key-value vector corresponding to a sensitive word, wherein the sensitive word is a word whose semantic sensitivity exceeds a threshold, and the intensity of the noise is determined according to the security level of the key-value cache block to which the sensitive word belongs.
5. The data processing method according to claim 4, wherein, The intensity of the noise is determined based on the security level of the key-value cache block to which the sensitive word belongs and the attention score corresponding to the sensitive word. The intensity of the noise is negatively correlated with the attention score and positively correlated with the security level.
6. The data processing method according to claim 1 further includes: A block table is constructed to store the index of the plurality of key-value cache blocks, the encryption tag and key identifier of the encrypted key-value cache blocks, the index is used to locate the plurality of key-value cache blocks, and the encrypted key-value cache block is the encrypted key-value cache block among the plurality of key-value cache blocks.
7. The data processing method according to claim 1 further includes: In a secure environment, the encrypted key-value cache blocks among the multiple key-value cache blocks are decrypted.
8. The data processing method according to claim 1, wherein, The request includes multiple requests, and the data processing method further includes at least one of the following: In the case where multiple requests belong to multiple tenants, requests from the same tenant will be grouped into the same batch for processing. If multiple requests belong to the same tenant, requests for the same session will be grouped into the same batch for processing.
9. The data processing method according to claim 1, further comprising at least one of the following: If the security level of the first key-value cache block is higher than that of the second key-value cache block and the capacity of the first storage space is insufficient, the second key-value cache block will be migrated from the first storage space to the second storage space. The first key-value cache block is the key-value cache block to be stored in the first storage space, and the second key-value cache block is the key-value cache block with the lowest security level in the first storage space. The security of the first storage space is higher than that of the second storage space. When prefetching key-value cache blocks in the second storage space, the key-value cache blocks to be prefetched are migrated from the second storage space to the first storage space in descending order of security level.
10. A data processing apparatus, comprising: The receiving module is configured to receive user requests; The acquisition module is configured to acquire the tokens corresponding to the request; The generation module is configured to generate multiple key-value cache blocks based on the lexical units, wherein each key-value cache block includes a key-value vector corresponding to at least one lexical unit. The determination module is configured to determine the security level for each key-value cache block based on the semantic sensitivity and attention score corresponding to each lexical unit; The processing module is configured to process each key-value cache block according to the security level, wherein the processing includes at least one of encryption and noise injection.
11. A data processing apparatus, comprising: At least one memory; as well as At least one processor coupled to the at least one memory, the at least one processor being configured to perform the data processing method as described in any one of claims 1 to 9 based on instructions stored in the at least one memory.
12. A computer-readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the data processing method as described in any one of claims 1 to 9.
13. A computer program product, when run on a computer, causes the computer to implement the data processing method as described in any one of claims 1 to 9.
