Method, device, storage medium and electronic device for requesting a large model based on cut-points
By embedding pointcuts in large model requests to intercept and detect sensitive information, the problems of low user awareness and weakened functionality in existing technologies are solved, achieving efficient and secure protection of sensitive information.
Patent Information
- Application Number
- CN202411263906.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-09-10
AI Technical Summary
Existing technologies, when preventing leak-proof attacks, rely on users' low awareness and directly disable the function of loading third-party website resources for large models, which weakens the model's functionality and makes it difficult to effectively protect against the leakage of sensitive information.
By embedding pointcuts in large model requests, sensitive information can be intercepted and detected, and preset response operations can be executed to prevent the leakage of sensitive information without affecting the model's functionality.
It achieves efficient prevention of information leakage attacks without modifying the large model service infrastructure, improving both security and convenience.
Smart Images

Figure CN118784376B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to computer technology, and in particular to a method, device, storage medium and electronic device for requesting a large model based on a cut-point. Background Art
[0002] A prompt leakage attack is an attempt to manipulate the model output to leak part or all of the original prompt. In large language models, prompt leakage usually involves adding malicious instructions to user input to steal the model's original prompt, which can lead to the exposure of sensitive information and potential abuse of prompts by unauthorized individuals. Prompt leakage attacks can lead to the leakage of private information in user prompts, such as some private information in user conversation records (such as email addresses, credit card information, etc.). The leakage of these user prompts may be used by attackers for malicious purposes. A common way to steal user sensitive information is that the attacker creates a malicious website. When a normal user visits the website and copies text from the website, the website's malicious js (JavaScript, a literal scripting language) embeds malicious prompts in the text content of the user's clipboard. When the normal user visits the large model service and pastes text into the dialog box of the large model service, the large model service executes the malicious prompt in the pasted text to access the third-party website resources controlled by the attacker, and carries sensitive information such as user conversation records in the request parameters. The attacker can restore the stolen sensitive information from the access log of the third-party website, which has a serious risk of privacy leakage.
[0003] In the case of prompt leakage attacks, the common defense solution in the prior art is to use a large model service or browser security plug-in to detect sensitive information in the chat content and remind users not to enter sensitive information in the chat. This method relies on the user's self-consciousness and the actual effect is not good; or directly disable the function of the large model to load third-party website resources. Although this can completely solve the corresponding security risks, it greatly weakens the function of the large model and is unlikely to be implemented. Summary of the invention
[0004] The purpose of the embodiments of this specification is to provide a method, device, storage medium and electronic device for requesting a large model based on a cut point.
[0005] The embodiment of this specification provides a method for requesting a large model based on a cut-point. By embedding a cut-point in a target function associated with a question request initiated by a user to a target large model in a target, a cut-point is enabled to intercept a target request related to the target large model, detect whether the target request contains target content related to sensitive information, and execute a preset response operation when an attack behavior is found. If no attack is found, the target function continues to execute the behavior after the cut-point, thereby not relying on the user to view the alarm and respond in time, having higher security, and not requiring modification of the infrastructure of the large model service, having better convenience, not requiring disabling the function of the large model to load third-party website resources, and having feasibility. The method includes:
[0006] In response to a question request initiated by a user to a target large model in a target application, based on a cut point embedded in a target function associated with the question request, a target request related to the target large model is intercepted, and whether the target request contains target content related to sensitive information is detected;
[0007] If the target request includes the target content, a preset response operation is performed for the target request; otherwise, the target function continues to be executed based on the target request.
[0008] Further, the target request is the question request, and the response to the question request initiated by the user to the target large model in the target application, based on the cut point embedded in the target function associated with the question request, intercepting the target request related to the target large model, and detecting whether the target request contains target content related to sensitive information, includes:
[0009] In response to a question request initiated by a user to a target large model in a target application, based on a cut point embedded in a target function in the target application for submitting a question request to the large model, the question request is intercepted to detect whether the question request contains instruction information for sending sensitive information to a third party.
[0010] Further, the target request is a network request initiated by the target large model in the process of executing the question request for requesting to obtain the required third-party resources, and the response to the question request initiated by the user to the target large model in the target application, based on the cut point embedded in the target function associated with the question request, intercepting the target request related to the target large model, and detecting whether the target request contains target content related to sensitive information, includes:
[0011] In response to a question request initiated by a user to a target large model in a target application, based on a cutoff point embedded in a target function for initiating a network request to a third party in a backend service corresponding to the target large model, the network request is intercepted to detect whether the network request contains sensitive information.
[0012] Further, the detecting whether the target request contains target content related to sensitive information includes:
[0013] The target request is input into a trained small model, and it is determined whether the target request contains target content related to sensitive information based on the sensitive prediction information output by the small model.
[0014] Further, the detecting whether the target request contains target content related to sensitive information includes:
[0015] By performing regular expression matching on the target request, it is determined whether the target request contains target content related to sensitive information according to the matching result.
[0016] Furthermore, the preset response operation includes at least one of the following:
[0017] blocking the target request;
[0018] issuing a warning for said target request;
[0019] The target request is written to a log.
[0020] Further, the preset response operation includes issuing a warning for the target request and / or writing the target request into a log;
[0021] Wherein, the method further comprises:
[0022] The target function is caused to continue to be executed based on the target request.
[0023] Further, the preset response operation includes blocking the target request;
[0024] Wherein, the method further comprises:
[0025] The target function is terminated and continued to execute.
[0026] Further, performing a preset response operation on the target request includes:
[0027] Based on a preset response rule, a preset response operation is performed on the target request.
[0028] The embodiment of this specification also provides a device for requesting a large model based on a cut point, including:
[0029] An interception module, for responding to a question request initiated by a user to a target large model in a target application, intercepting a target request related to the target large model based on a cut point embedded in a target function associated with the question request, and detecting whether the target request contains target content related to sensitive information;
[0030] The response module is used to execute a preset response operation for the target request if the target request contains the target content, and otherwise, to enable the target function to continue to be executed based on the target request.
[0031] The embodiments of the present specification also provide a computer program product, wherein the computer program product stores at least one instruction, and the at least one instruction is suitable for being loaded by a processor and executing the above method steps.
[0032] The embodiments of the present specification also provide a storage medium, wherein the storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the steps of the above method.
[0033] An embodiment of the present specification also provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the above method.
[0034] In the embodiments of the present specification, by embedding a cut point in the target function associated with the question request initiated by the user to the target big model in the target, the aspect program can intercept the target request related to the target big model, detect whether the target request contains target content related to sensitive information, and execute the preset response operation when an attack behavior is found. If no attack is found, the target function continues to execute the behavior after the cut point, thereby not relying on the user to check the alarm and respond in time, having higher security, and not requiring modification of the infrastructure of the big model service, having better convenience, and not requiring disabling the function of the big model to load third-party website resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A flowchart of a method for requesting a large model based on a cut-point provided in an embodiment of this specification;
[0036] Figure 2 A flowchart of a method for requesting a large model based on a cut-point is provided as an example in an embodiment of this specification;
[0037] Figure 3 A flowchart of a method for requesting a large model based on a cut-point is provided as an example in an embodiment of this specification;
[0038] Figure 4A schematic diagram of a structure of a device for requesting a large model based on a cut point provided in an embodiment of this specification;
[0039] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0041] See also Figure 1 , is a flow chart of a method for requesting a large model based on a cut-point provided in an embodiment of this specification. In an embodiment of this specification, the method for requesting a large model based on a cut-point is applied to a device for requesting a large model (hereinafter referred to as a "large model requesting device") or an electronic device equipped with a large model requesting device. Figure 1 The process shown is described in detail, and the method for requesting a large model based on a cut point may specifically include the following steps:
[0042] S102, in response to a question request initiated by a user to a target large model in a target application, based on a cut point embedded in a target function associated with the question request, intercept a target request related to the target large model, and detect whether the target request contains target content related to sensitive information.
[0043] In some embodiments, the target application includes but is not limited to an application (App, Application, an application is defined as a software package that can run independently), a mini-program (a mini-program cannot run independently and needs to run in a host program), a browser (a software application for accessing the Internet that allows users to obtain and display information on a web page by entering a URL (web page address) or clicking a link), etc. It should be noted that the above-mentioned applications are only examples and not limitations. Those skilled in the art should understand that any type of application can be included in the protection scope of this specification, and this specification does not limit this.
[0044] In some embodiments, large models (also known as large language models, Large Language Model, LLM for short) are deep learning models trained on massive text data, which can generate natural language text or understand the meaning of language text. Such models can perform a variety of natural language processing tasks, including but not limited to text classification, question answering, and conversation. As the model size grows, LLM is able to generate more accurate and coherent outputs while processing more complex and longer input sequences. In addition, larger models can cover a wider range of knowledge and language contexts, thereby providing more comprehensive and targeted answers and solutions.
[0045] In some embodiments, in response to a trigger operation (e.g., a click operation) performed by a user in a target application, the target application generates a corresponding question request and sends the question request to the target large model. In some embodiments, the question request includes a prompt, that is, the request content of the question request is a prompt, and the prompt refers to input information or instructions provided to a computer program or model. In the large language model, the prompt is a question or statement provided by the user to the large model, which is used to guide the large model to generate relevant replies or responses. After receiving a prompt, the large model will generate subsequent content or answers that are most relevant to the prompt based on its internally trained knowledge and algorithms. In some embodiments, the prompt is usually composed of user input content and instructions, and the user input includes but is not limited to the content entered by the user in the target application, the content selected by the user in the target application, etc. The instruction is determined according to the trigger operation performed by the user, for example, according to the button clicked by the user, the instruction associated with the button is determined, for example, the prompt is "Please translate the following content into English 'I am the monitor'", where the user input is "I am the monitor" and the instruction is "Please translate the following content into English". It should be noted that the above prompt words are only examples and not limitations. Those skilled in the art should understand that prompt words of any content can be included in the protection scope of this specification, and this specification does not limit this. In some embodiments, the question request also includes but is not limited to user identification information (used to identify the questioner), identification information of the target application (used to identify the application that initiates the question), and identification information of the target large model (used to identify which large model to initiate the question request, and to identify which large model's backend service sends the question request). In some embodiments, the target application is pre-set to be able to initiate a question request only to one large model, namely the target large model, or the target application is pre-set to be able to initiate a question request to multiple large models. At this time, the user needs to select the target large model from the multiple large models, or the target application matches the multiple large models according to the question request to obtain a target large model that matches the question request, or the target large model is determined based on the model identification information input by the user (for example, the access address of the large model backend service).
[0046] In some embodiments, aspect is a security system concept, the core concept of which is to decouple security management from business logic by embedding security control points (cut points) in each layer of business logic. This aspect is independent of the main business logic and does not affect the realization of the main functions. Therefore, additional security checks and protection mechanisms can be added without changing the original business logic, thereby improving the overall security of the software system. The aspect system embeds security aspects between atomic functions and business logic layers through AOP (aspect-oriented programming), so that the behavior of functions in runtime applications can be monitored and controlled, providing risk discovery and governance capabilities for privacy protection services.
[0047] In some embodiments, the method for requesting a big model based on a cut-off point (i.e., a cut-off program) in the embodiments of this specification can be run in a target application. In this case, the target request related to the target big model is the question request, and the target function associated with the question request is a function in the target application for submitting (sending) the question request to the big model. By embedding the cut-off point corresponding to the cut-off program in the target function, the cut-off program can intercept the question request before the target application sends the question request to the target big model, and detect whether the question request contains instructions for sending sensitive information to a third party (a third party other than the target application and the target big model, such as a third-party website), that is, the target content at this time is instructions for sending sensitive information to a third party.
[0048] In some embodiments, the method for requesting a large model based on a cut-off point (i.e., a cut-off program) in the embodiments of this specification can also be run in the backend service of the target large model. After the target application sends the question request to the target large model, the target large model will process the question request after receiving the question request. During the processing, if the target large model determines that the question request needs to access third-party resources, the large model backend service will generate a corresponding network request for requesting to obtain the third-party resources required by the question request, and send the network request to the third party. At this time, the target request related to the target large model is the network request, and the target function associated with the question request is the target function for initiating a network request to a third party in the backend service corresponding to the target large model. By embedding the cut-off point corresponding to the cut-off program in the target function, the cut-off program can intercept the network request before the large model backend service sends the network request to the third party, and detect whether the network request contains sensitive information (e.g., user chat records), that is, the target content at this time is sensitive information. In some embodiments, the network request includes but is not limited to resource identification information (used to identify the resource object requested to be obtained), third-party identification information (used to identify which third party to initiate the network request to), identification information of the target large model, etc. In some embodiments, the resource identification information and the third-party identification information are determined by the target big model based on the question request during the process of processing the question request. For example, the target big model first determines the resource identification information of the third-party resource required for the question request, and then determines the identification information of the resource acquisition source (i.e., the third party) of the third-party resource. Alternatively, the target big model first determines the identification information of the resource acquisition source (i.e., the third party) corresponding to the question request, and then determines the resource identification information of the third-party resource required for the question request.
[0049] S104: If the target request includes the target content, perform a preset response operation for the target request; otherwise, continue to execute the target function based on the target request.
[0050] In some embodiments, if the aspect program determines that the target request contains the target content (i.e., the target request is found to have an attack behavior), a preset response operation will be performed for the target request, and the preset response operation includes but is not limited to blocking the target request, warning the target request, writing the target request to a log, etc. Here, the preset response operation corresponding to any operation type can be included in the protection scope of this specification, and this specification does not limit this. In some embodiments, if the aspect program determines that the target request does not contain the target content (i.e., no attack behavior is found in the target request), the aspect program will continue to execute the behavior after the cut point, so that the target function continues to execute based on the target request, that is, if the method of the request big model based on the cut point in the embodiment of this specification (i.e., the aspect program) runs in the target application, then by making the target function continue to execute based on the question request, the target application sends the question request to the backend service of the target big model, and if the method of the request big model based on the cut point in the embodiment of this specification (i.e., the aspect program) runs in the backend service of the target big model, then by making the target function continue to execute based on the network request, the big model backend service sends the network request to a third party.
[0051] In the embodiments of the present specification, by embedding a cut point in the target function associated with the question request initiated by the user to the target big model in the target, the aspect program can intercept the target request related to the target big model, detect whether the target request contains target content related to sensitive information, and execute the preset response operation when an attack behavior is found. If no attack is found, the target function continues to execute the behavior after the cut point, thereby not relying on the user to check the alarm and respond in time, having higher security, and not requiring modification of the infrastructure of the big model service, having better convenience, not requiring disabling the function of the big model to load third-party website resources, and having feasibility.
[0052] In some embodiments, the target request is the question request, and the response to the question request initiated by the user to the target big model in the target application, based on the pointcut embedded in the target function associated with the question request, intercepts the target request related to the target big model, and detects whether the target request contains target content related to sensitive information, including: responding to the question request initiated by the user to the target big model in the target application, based on the pointcut embedded in the target function in the target application used to submit the question request to the big model, intercepts the question request, and detects whether the question request contains instruction information for sending sensitive information to a third party. In some embodiments, the method for requesting a big model based on the pointcut (i.e., the aspect program) in the embodiments of this specification runs in the target application. At this time, the target request related to the target big model is the question request, and the target function associated with the question request is the function in the target application used to submit (send) the question request to the big model, and the target content is an instruction for sending sensitive information to a third party. In some embodiments, by embedding the tangent point corresponding to the aspect program in the target function, the aspect program can intercept the question request before the target application sends the question request to the target large model, and detect whether the question request contains instructions for sending sensitive information to a third party (a third party other than the target application and the target large model, such as a third-party website), where sensitive information includes but is not limited to chat records, ID numbers, account passwords, identity information, and other information that is sensitive to the user. It should be noted that sensitive information of any type and content can be included in the protection scope of this specification, and this specification does not limit this.
[0053] In some embodiments, the target request is a network request initiated by the target large model in the process of executing the question request to request the acquisition of the required third-party resources, and the response to the question request initiated by the user to the target large model in the target application, based on the pointcut embedded in the target function associated with the question request, intercepting the target request related to the target large model, and detecting whether the target request contains target content related to sensitive information, includes: responding to the question request initiated by the user to the target large model in the target application, based on the pointcut embedded in the target function for initiating a network request to a third party in the backend service corresponding to the target large model, intercepting the network request, and detecting whether the network request contains sensitive information. In some embodiments, the method of requesting a large model based on the pointcut (i.e., the aspect program) in the embodiments of this specification runs in the backend service of the target large model. At this time, the target request related to the target large model is the network request, and the target function associated with the question request is the target function for initiating a network request to a third party in the backend service corresponding to the target large model, and the target content is sensitive information. In some embodiments, after the target application sends the question request to the target big model, the target big model will process the question request after receiving the question request. During the processing, if the target big model determines that the question request needs to access third-party resources, the big model back-end service will generate a corresponding network request for requesting to obtain the third-party resources required for the question request, and send the network request to the third party. By embedding the corresponding point of intersection of the aspect program in the target function, the aspect program can intercept the network request before the big model back-end service sends the network request to the third party, and detect whether the network request contains sensitive information (for example, chat records). This example embodiment does not specifically limit the specific form of sensitive information.
[0054] In some embodiments, the detecting whether the target request contains target content related to sensitive information includes: inputting the target request into a trained small model, and determining whether the target request contains target content related to sensitive information based on the sensitive prediction information output by the small model. In some embodiments, a small model refers to a neural network model with a smaller parameter scale, usually with the number of parameters ranging from 1.5B to 7B. Compared with a large model, a small model has a much smaller parameter scale. A small model usually refers to a smaller-scale machine learning or deep learning model with a smaller number of parameters, lower computational complexity, and shorter training time. In some embodiments, the input of the small model is the request content (i.e., the prompt word), and the output of the small model is sensitive prediction information. The sensitive prediction information is used to predict whether the request content contains target content related to sensitive information, and the target content includes sensitive information or instructions for sending sensitive information to a third party. In some embodiments, it is necessary to train the small model according to the training samples and their corresponding label information (the label information is used to indicate whether the corresponding training samples contain content related to sensitive information) to obtain a trained small model. Here, it should be noted that this example embodiment does not specifically limit the training method of the small model. Those skilled in the art should understand that any training method can be included in the protection scope of this specification, and this specification does not limit this. In some embodiments, by inputting the request content (i.e., the prompt word) of the target request into the trained small model, the sensitive prediction information output by the small model can be obtained, and then based on the sensitive prediction information, it can be determined whether the target request contains target content related to sensitive information, that is, it can be determined whether the network request contains sensitive information, or it can be determined whether the question request contains instruction information for sending sensitive information to a third party.
[0055] In some embodiments, the detecting whether the target request contains target content related to sensitive information includes: performing regular matching on the target request, and determining whether the target request contains target content related to sensitive information according to the matching result. In some embodiments, regular matching is performed on the request content of the target request through one or more preset regular expressions to obtain a corresponding matching result. According to the matching result, it can be determined whether the target request contains target content related to sensitive information. If the matching result indicates that the request content of the target request matches at least one of the one or more preset regular expressions, it can be determined that the target request contains target content related to sensitive information, that is, it can be determined that the network request contains sensitive information, or it can be determined that the question request contains instruction information for sending sensitive information to a third party. If the matching result indicates that the request content of the target request does not match any of the one or more preset regular expressions, it can be determined that the target request does not contain target content related to sensitive information, that is, it can be determined that the network request does not contain sensitive information, or it can be determined that the question request does not contain instruction information for sending sensitive information to a third party.
[0056] In some embodiments, the preset response operation includes at least one of the following: blocking the target request; issuing a warning for the target request; writing the target request to a log. In some embodiments, the preset response operation may include blocking the target request, for example, blocking the question request initiated by the target application to the target large model, so that the question request will not be sent to the backend service of the target large model, and for another example, blocking the network request initiated by the large model backend service to a third party for requesting to obtain the third-party resources required by the large model to process the question request, so that the network request will not be sent to the third party. In some embodiments, the preset response operation may also include issuing a warning for the target request, for example, the method for requesting a large model based on a cut point (i.e., a cut program) in the embodiment of this specification runs in the target application, at this time, the warning information corresponding to the question request can be presented to the user in the target application, and for another example, the method for requesting a large model based on a cut point (i.e., a cut program) in the embodiment of this specification runs in the backend service of the target large model, then the backend service of the target large model will return the warning information corresponding to the network request to the target application, and present the warning information corresponding to the network request to the user in the target application. In some embodiments, the preset response operation may also include writing the target request into a log. For example, the method for requesting a large model based on a cut-off point (i.e., a cut-off program) in the embodiment of this specification is run in a target application. At this time, the relevant parameters of the question request (including but not limited to the request content, request time, identification information of the user who initiates the question request, identification information of the request target, i.e., the target large model, etc.) may be written into the log of the target application. For another example, the method for requesting a large model based on a cut-off point (i.e., a cut-off program) in the embodiment of this specification is run in the back-end service of the target large model. At this time, the relevant parameters of the network request (including but not limited to the request content, request time, identification information of the request target, i.e., a third party, the request content of the question request corresponding to the network request, the request time, identification information of the user who initiates the question request, identification information of the target large model, etc.) may be written into the log of the target large model. Alternatively, the large model back-end service may return the relevant parameters of the network request to the target application, and the target application may write the relevant parameters of the network request into the log of the target application.
[0057] In some embodiments, the preset response operation includes issuing a warning for the target request and / or writing the target request to a log; wherein the method further includes: causing the target function to continue to execute based on the target request. In some embodiments, if the preset response operation includes at least one of issuing a warning for the target request and writing the target request to a log, the target function will also continue to execute based on the target request, that is, the aspect program will continue to execute the behavior after the cut point. If the method of the request big model based on the cut point (i.e., the aspect program) in the embodiment of this specification runs in the target application, the target function will continue to execute based on the question request, so that the target application sends the question request to the backend service of the target big model. If the method of the request big model based on the cut point (i.e., the aspect program) in the embodiment of this specification runs in the backend service of the target big model, the target function will continue to execute based on the network request, so that the big model backend service sends the network request to a third party.
[0058] In some embodiments, the preset response operation includes blocking the target request; wherein, the method further includes: causing the target function to terminate execution. In some embodiments, if the response operation includes blocking the target request, the target function will also be terminated, that is, the aspect program will not continue to execute the behavior after the cut point. If the method of requesting a large model based on the cut point (i.e., the aspect program) in the embodiment of this specification runs in the target application, the target application will not send the question request to the backend service of the target large model by terminating execution. If the method of requesting a large model based on the cut point (i.e., the aspect program) in the embodiment of this specification runs in the backend service of the target large model, the target function will be terminated, so that the large model backend service will not send the network request to a third party.
[0059] In some embodiments, the performing of a preset response operation on the target request includes: performing a preset response operation on the target request based on a preset response rule. In some embodiments, the aspect program determines a preset response operation suitable for the target request from a plurality of preset response operations based on a preset response rule, and performs the preset response operation on the target request. For example, based on a preset response rule, according to at least one of the information such as the request content (i.e., prompt word) of the question request, the request time, the relevant user information of the user initiating the question request, and the relevant description information of the request object of the question request, i.e., the target large model, etc., the preset response operation matching the question request under the response rule is determined from a plurality of preset response operations, and the preset response operation is performed on the question request. For another example, based on a preset response rule, according to at least one of the information such as the relevant description information of the request object of the network request, i.e., the third party, the relevant description information of the request resource, the request time, and the relevant user information of the initiator of the question request corresponding to the network request, the preset response operation matching the network request under the response rule is determined from a plurality of preset response operations, and the preset response operation is performed on the network request.
[0060] Figure 2 A flowchart of a method for requesting a large model based on a cut-off point is provided as an example in an embodiment of this specification.
[0061] like Figure 2 As shown, the user initiates a question request to the big model in the target application. By embedding a pointcut in the function in the target application that is used to submit (send) the question request to the big model, the aspect program corresponding to the pointcut running in the target application intercepts the question request and detects whether the question request contains instructions for sending sensitive information to a third-party website. If it does, that is, when it is found that the question request contains an attack behavior, the question request is responded to as necessary according to the pre-set rules. If it does not, that is, when no attack behavior is found in the question request, the aspect program continues to execute the behavior after the pointcut and returns the original response content of the big model to the user.
[0062] Figure 3 A flowchart of a method for requesting a large model based on a cut-off point is provided as an example in an embodiment of this specification.
[0063] like Figure 3As shown, the large model executes the user's request, determines that the request needs to access third-party resources, initiates a network request to the third party for obtaining the third-party resources, and embeds a cut point in the target function for initiating a network request to the third party in the back-end service of the large model. The aspect program corresponding to the cut point running in the back-end service of the large model intercepts the network request and detects whether the http request parameters of the network request contain sensitive information. If it contains sensitive information, that is, when it is found that the question request contains an attack behavior, the question request is responded to as necessary according to the preset rules. If it does not contain sensitive information, that is, when it is found that the question request contains no attack behavior, the aspect program continues to execute the behavior after the cut point, that is, sending the network request to the third party.
[0064] Figure 4 A schematic diagram of a structure of a device for requesting a large model based on a cut point provided in an embodiment of this specification, the device for requesting a large model (hereinafter referred to as "large model request device 1") can be implemented as all or part of an electronic device through software, hardware or a combination of both. According to some embodiments, the large model request device 1 includes an interception module 11 and a response module 12.
[0065] The interception module 11 is used to respond to a question request initiated by a user to a target large model in a target application, intercept a target request related to the target large model based on a cut point embedded in a target function associated with the question request, and detect whether the target request contains target content related to sensitive information.
[0066] The response module 12 is configured to execute a preset response operation for the target request if the target request contains the target content, and otherwise, to enable the target function to continue to be executed based on the target request.
[0067] In some embodiments, the target request is the question request, and the response to the question request initiated by the user to the target macro model in the target application, based on the cut point embedded in the target function associated with the question request, intercepting the target request related to the target macro model, and detecting whether the target request contains target content related to sensitive information, includes:
[0068] In response to a question request initiated by a user to a target large model in a target application, based on a cut point embedded in a target function in the target application for submitting a question request to the large model, the question request is intercepted to detect whether the question request contains instruction information for sending sensitive information to a third party.
[0069] In some embodiments, the target request is a network request initiated by the target large model in the process of executing the question request for requesting to obtain the required third-party resources, and the response to the question request initiated by the user to the target large model in the target application, based on the cut point embedded in the target function associated with the question request, intercepting the target request related to the target large model, and detecting whether the target request contains target content related to sensitive information, includes:
[0070] In response to a question request initiated by a user to a target large model in a target application, based on a cutoff point embedded in a target function for initiating a network request to a third party in a backend service corresponding to the target large model, the network request is intercepted to detect whether the network request contains sensitive information.
[0071] In some embodiments, detecting whether the target request contains target content related to sensitive information includes:
[0072] The target request is input into a trained small model, and it is determined whether the target request contains target content related to sensitive information based on the sensitive prediction information output by the small model.
[0073] In some embodiments, detecting whether the target request contains target content related to sensitive information includes:
[0074] By performing regular expression matching on the target request, it is determined whether the target request contains target content related to sensitive information according to the matching result.
[0075] In some embodiments, the preset response operation includes at least one of the following:
[0076] blocking the target request;
[0077] issuing a warning for said target request;
[0078] The target request is written to a log.
[0079] In some embodiments, the preset response operation includes issuing a warning for the target request and / or writing the target request into a log;
[0080] The large model requesting device 1 is also used for:
[0081] The target function is caused to continue to be executed based on the target request.
[0082] In some embodiments, the preset response operation includes blocking the target request;
[0083] The large model requesting device 1 is also used for:
[0084] The target function is terminated and continued to execute.
[0085] In some embodiments, performing a preset response operation on the target request includes:
[0086] Based on a preset response rule, a preset response operation is performed on the target request.
[0087] 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.
[0088] The embodiment of the present specification also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded by a processor to execute the method of the embodiment of the present specification.
[0089] The embodiments of the present specification also provide a computer program product, which stores at least one instruction, and the at least one instruction is loaded by the processor to execute the method of the embodiments of the present specification.
[0090] The embodiments of this specification also provide Figure 5 The structural diagram of the electronic device shown in FIG. Figure 5 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-mentioned voice activity detection method.
[0091] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0092] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0093] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0094] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0095] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0096] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0097] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0098] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0099] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0100] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0101] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0102] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0103] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0104] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0105] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0106] 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 system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0107] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. A method for requesting a large model based on a cut point, comprising: In response to a question request initiated by a user to a target large model in a target application, based on a cut point embedded in a target function associated with the question request, a target request related to the target large model is intercepted, and whether the target request contains target content related to sensitive information is detected; If the target request contains the target content, perform a preset response operation for the target request; otherwise, enable the target function to continue to be executed based on the target request; The target request is a network request initiated by the target large model in the process of executing the question request for requesting to obtain the required third-party resources. The response to the question request initiated by the user to the target large model in the target application is based on the cut point embedded in the target function associated with the question request, intercepting the target request related to the target large model, and detecting whether the target request contains target content related to sensitive information, including: In response to a question request initiated by a user to a target large model in a target application, based on a tangent point embedded in a target function for initiating a network request to a third party in a backend service corresponding to the target large model, the network request is intercepted to detect whether the network request contains sensitive information; wherein, after receiving the question request, if the target large model determines during processing that the question request needs to access third-party resources, a corresponding network request for requesting to obtain the third-party resources required for the question request is generated, and the network request is sent to the third party.
2. The method according to claim 1, wherein the target request is the question request, and the step of responding to the question request initiated by the user to the target large model in the target application, intercepting the target request related to the target large model based on the cut point embedded in the target function associated with the question request, and detecting whether the target request contains target content related to sensitive information comprises: In response to a question request initiated by a user to a target large model in a target application, based on a cut point embedded in a target function in the target application for submitting a question request to the large model, the question request is intercepted to detect whether the question request contains instruction information for sending sensitive information to a third party.
3. According to the method of claim 1, the detecting whether the target request contains target content related to sensitive information comprises: The target request is input into a trained small model, and it is determined whether the target request contains target content related to sensitive information based on the sensitive prediction information output by the small model.
4. According to the method of claim 1, the detecting whether the target request contains target content related to sensitive information comprises: By performing regular expression matching on the target request, it is determined whether the target request contains target content related to sensitive information according to the matching result.
5. The method according to claim 1, wherein the preset response operation comprises at least one of the following: blocking the target request; issuing a warning for said target request; The target request is written to a log.
6. The method according to claim 5, wherein the preset response operation comprises issuing a warning for the target request and / or writing the target request into a log; in, The method further comprises: The target function is caused to continue to be executed based on the target request.
7. The method according to claim 5, wherein the preset response operation comprises blocking the target request; in, The method further comprises: The target function is terminated and continued to execute.
8. According to the method according to any one of claims 1 to 7, the step of performing a preset response operation on the target request comprises: Based on a preset response rule, a preset response operation is performed on the target request.
9. A device for requesting a large model based on a cut point, comprising: An interception module, for responding to a question request initiated by a user to a target large model in a target application, intercepting a target request related to the target large model based on a cut point embedded in a target function associated with the question request, and detecting whether the target request contains target content related to sensitive information; A response module, configured to, if the target request contains the target content, perform a preset response operation on the target request, otherwise, enable the target function to continue to be executed based on the target request; The target request is a network request initiated by the target large model in the process of executing the question request for requesting to obtain the required third-party resources. The response to the question request initiated by the user to the target large model in the target application is based on the cut point embedded in the target function associated with the question request, intercepting the target request related to the target large model, and detecting whether the target request contains target content related to sensitive information, including: In response to a question request initiated by a user to a target large model in a target application, based on a tangent point embedded in a target function for initiating a network request to a third party in a backend service corresponding to the target large model, the network request is intercepted to detect whether the network request contains sensitive information; wherein, after receiving the question request, if the target large model determines during processing that the question request needs to access third-party resources, a corresponding network request for requesting to obtain the third-party resources required for the question request is generated, and the network request is sent to the third party.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
11. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method as claimed in any one of claims 1 to 8.
12. A computer program product having at least one instruction stored thereon, characterized in that: When the at least one instruction is executed by the processor, the steps of the method described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Data processing method and device, storage medium and electronic equipment
CN115357940A
Private data protection method and device for large language model, medium and equipment
CN118410522A