Safety chat robot interaction method, device and equipment and storage medium

Through the interaction method of security chatbots, the security language model trained by LoRA technology is used to deal with security problems, solving the problem of programmers being inefficient in answering security questions, and achieving fast and accurate answers.

CN119226449APending Publication Date: 2024-12-31BEIJING QIHOOD TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310787975.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

When programmers deal with security issues, it is difficult for existing technology to find solutions quickly and accurately, resulting in a lot of time and effort to manually search and screen.

Method used

The security chatbot interaction method is adopted, and the user's dialogue events are obtained, and the security language model is inputted into the preset security language model. The training module is injected into the initial large language model and trained, and a dialogue reply is generated and displayed to the user.

Benefits of technology

It achieves rapid and accurate answers to security questions, avoids wasting time and energy in manual search and screening, and improves work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226449A_ABST
    Figure CN119226449A_ABST
Patent Text Reader

Abstract

The invention relates to the field of man-machine interaction, and discloses a safety chat robot interaction method, device and equipment and a storage medium, and the method comprises the steps: obtaining a dialogue event which is triggered by a user based on a preset interaction interface and contains a safety problem; inputting the dialogue event into a preset security language model to obtain a model output result; and generating a dialogue reply according to the model output result, and displaying the dialogue reply through a preset interaction interface. Compared with the prior art in which the solution of the security question is found in a manual query mode, the conversation event containing the security question is processed through the preset security language model, and the conversation reply is generated based on the preset security language model to obtain the solution of the security question; therefore, the technical defect that in the prior art, a large amount of time and energy need to be consumed for manual searching and manual screening is overcome, and then a user can rapidly obtain an accurate solution to the safety question in a man-machine interaction mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of human-computer interaction technology, and in particular to a security chat robot interaction method, device, equipment and storage medium. Background Art

[0002] With the rapid development of information technology, people may encounter various security issues in the process of code development. Since these security issues involve a wide range of sub-fields and types, even experienced programmers cannot ensure that they can answer these security issues quickly and accurately.

[0003] In response to the above technical problems, programmers in the industry usually obtain corresponding answers by querying and searching in source databases or common search engines. However, the answers obtained by this method are varied, and it often takes a lot of time and energy to manually screen to find the right answer, which is inefficient. Therefore, the industry is in urgent need of a method that can quickly and accurately obtain the corresponding answers to security issues.

[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of the present invention is to provide a security chat robot interaction method, device, equipment and storage medium, aiming to solve the technical problem of how to quickly and accurately obtain answers to security questions.

[0006] To achieve the above object, the present invention provides a security chat robot interaction method, the method comprising the following steps:

[0007] Acquire a dialogue event triggered by a user based on a preset interactive interface, wherein the dialogue event includes a security question;

[0008] Input the conversation event into a preset security language model to obtain a model output result, wherein the preset security language model is a model obtained by injecting a trainable module into an initial large language model through LoRA technology and training the initial large language model injected with the trainable module, and the trainable module is used to adjust the corresponding full rank matrix in the initial large language model;

[0009] Generate a dialogue response based on the model output result, and display the dialogue response through the preset interactive interface.

[0010] Optionally, before the step of obtaining a dialog event triggered by a user based on a preset interactive interface, the step further includes:

[0011] Collecting original security data, wherein the original security data includes one or more of vulnerability identification, vulnerability version, vulnerability description, and vulnerability source;

[0012] Performing data preprocessing on the original security data to obtain training data;

[0013] The initial large language model is trained based on the training data and LoRA technology to obtain a preset security language model.

[0014] Optionally, the step of training the initial large language model based on the training data and the LoRA technology to obtain a preset security language model includes:

[0015] Injecting a trainable module into an initial large language model through the LoRA technology to obtain an initial large language model injected with the trainable module;

[0016] The initial large language model injected with the trainable module is trained using the training data to obtain a preset security language model.

[0017] Optionally, the step of training the initial large language model injected with the trainable module by using the training data to obtain a preset security language model includes:

[0018] Freezing the pre-trained model weights in the initial large language model injected with the trainable module, wherein the pre-trained model weights are weights corresponding to the full-rank matrix in the initial large language model;

[0019] Fine-tuning unfrozen model parameters in the initial large language model to obtain a fine-tuned large language model;

[0020] The fine-tuned large language model is trained using the training data to obtain a preset security language model.

[0021] Optionally, the step of fine-tuning unfrozen model parameters in the initial large language model to obtain a fine-tuned large language model includes:

[0022] Decomposing unfrozen model parameters in the initial large language model by the trainable module to obtain a low-rank matrix, wherein the unfrozen model parameters are a full-rank matrix corresponding to the attention layer;

[0023] The low-rank matrix is ​​weighted to obtain a fine-tuned large language model.

[0024] Optionally, the step of performing data preprocessing on the original security data to obtain training data includes:

[0025] Determining whether the original security data contains a preset source identifier, where the preset source identifier is used to indicate the validity of the original security data;

[0026] If the original security data contains a preset source identifier, the original security data is determined as training data.

[0027] Optionally, the step of generating a dialogue response according to the model output result and displaying the dialogue response through the preset interactive interface includes:

[0028] Generate a current dialogue response according to the output result of the model, and obtain the number of completed dialogue rounds with the user;

[0029] If the number of dialogue rounds is less than a preset number of rounds, displaying the dialogue reply to the user through the preset interactive interface;

[0030] If the number of conversation rounds is greater than or equal to the preset number of rounds, the interaction record with the earliest time and date in the preset interaction interface is deleted according to the conversation time and date, and the current conversation reply is displayed to the user through the preset interaction interface.

[0031] In addition, to achieve the above-mentioned purpose, the present invention also proposes a safety chat robot interaction device, the safety chat robot interaction device comprising:

[0032] An event acquisition module is used to acquire a dialogue event triggered by a user based on a preset interactive interface, wherein the dialogue event includes security issues;

[0033] A model input module, used to input the dialogue event into a preset security language model to obtain a model output result, wherein the preset security language model is a model obtained by injecting a trainable module into an initial large language model through LoRA technology and training the initial large language model injected with the trainable module, and the trainable module is used to adjust the corresponding full rank matrix in the initial large language model;

[0034] The model output module is used to generate a dialogue response according to the model output result and display the dialogue response through the preset interactive interface.

[0035] In addition, to achieve the above-mentioned purpose, the present invention also proposes a security chat robot interaction device, which includes: a memory, a processor, and a security chat robot interaction program stored in the memory and executable on the processor, and the security chat robot interaction program is configured to implement the steps of the security chat robot interaction method described above.

[0036] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a security chat robot interaction program is stored. When the security chat robot interaction program is executed by a processor, the steps of the security chat robot interaction method described above are implemented.

[0037] The present invention obtains a dialogue event triggered by a user based on a preset interactive interface, wherein the dialogue event includes security issues; inputs the dialogue event into a preset security language model to obtain a model output result, wherein the preset security language model is a model obtained by injecting a trainable module into an initial large language model through LoRA technology, and training the initial large language model injected with the trainable module, wherein the trainable module is used to adjust the corresponding full-rank matrix in the initial large language model; generates a dialogue response according to the model output result, and displays the dialogue response through a preset interactive interface. Compared with the prior art that finds answers to security issues through manual search and manual screening, the above method of the present invention processes dialogue events containing security issues through a preset security language model, and obtains answers to security issues based on dialogue responses generated based on the model output result of the preset security language model, thereby avoiding the technical defects of the prior art that require a lot of time and effort for manual search and manual screening, thereby enabling users to quickly obtain accurate answers to security issues through human-computer interaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of the structure of a secure chat robot interaction device in a hardware operating environment involved in an embodiment of the present invention;

[0039] Figure 2 This is a flow chart of the first embodiment of the security chat robot interaction method of the present invention;

[0040] Figure 3 A schematic diagram of the flow of interaction between a robot and a user in the security chat robot interaction method of the present invention;

[0041] Figure 4 This is a flow chart of the second embodiment of the security chat robot interaction method of the present invention;

[0042] Figure 5 A schematic diagram of constructing a preset safety language model for the safety chat robot interaction method of the present invention;

[0043] Figure 6 A schematic diagram of the flow chart of the third embodiment of the security chat robot interaction method of the present invention;

[0044] Figure 7 This is a structural block diagram of the first embodiment of the security chat robot interaction device of the present invention.

[0045] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0046] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0047] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a secure chat robot interaction device in the hardware operating environment involved in an embodiment of the present invention.

[0048] like Figure 1 As shown, the security chat robot interaction device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0049] Those skilled in the art will understand that Figure 1 The structure shown in does not constitute a limitation on the security chat robot interaction device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0050] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a security chat robot interaction program.

[0051] exist Figure 1In the security chat robot interaction device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the security chat robot interaction device of the present invention can be set in the security chat robot interaction device, and the security chat robot interaction device calls the security chat robot interaction program stored in the memory 1005 through the processor 1001, and executes the security chat robot interaction method provided by the embodiment of the present invention.

[0052] The embodiment of the present invention provides a security chat robot interaction method, referring to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the security chat robot interaction method of the present invention.

[0053] In this embodiment, the security chat robot interaction method includes the following steps:

[0054] Step S10: Acquire a dialogue event triggered by a user based on a preset interactive interface, wherein the dialogue event includes security issues.

[0055] It should be noted that the execution subject of the method of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a mobile phone, a tablet computer, a personal computer, etc., or other electronic devices that can achieve the same or similar functions, and this embodiment does not limit this. Here, a security chat robot (hereinafter referred to as the robot) will be taken as an example to illustrate various embodiments of the security chat robot interaction method of the present invention.

[0056] It is understandable that the above-mentioned preset interactive interface is an interface for users to interact with the robot. In this interface, users can enter security questions they want to ask and send them to the robot, thereby triggering a dialogue event.

[0057] It should be understood that since this embodiment interacts with the user based on security questions raised by the user, it can identify dialogue events containing security questions, such as: what is a security vulnerability, how to fix a security vulnerability, etc. As for dialogue events that do not contain security questions, that is, when the user enters non-security questions in the preset interactive interface (such as what materials the atmosphere is composed of, what is the display principle of the LCD screen, etc.), the robot can forward these non-security questions to the search engine for search, and feedback the search results to the user.

[0058] In a specific implementation, the above-mentioned dialogue event can be obtained from a server, and the data transmission interface of the above-mentioned server is respectively connected with the data transmission interface of the robot and the preset interaction interface.

[0059] Step S20: Input the conversation event into a preset security language model to obtain a model output result. The preset security language model is a model obtained by injecting a trainable module into an initial large language model through LoRA technology, and training the initial large language model injected with the trainable module. The trainable module is used to adjust the corresponding full rank matrix in the initial large language model.

[0060] It should be noted that the above-mentioned LoRA (Low-Rank Adaptation) technology is an adaptive strategy technology that does not introduce additional reasoning delays and significantly reduces the number of trainable parameters for downstream tasks while maintaining model quality.

[0061] It should be understood that the above-mentioned initial large language model refers to a deep learning model that can be trained using a large amount of text data, which can generate natural language text or understand the meaning of language text, such as chatGPT, GLM-130, etc., and this embodiment is not limited to this.

[0062] It is understandable that the above-mentioned trainable module can be a module including several network layers, and the above-mentioned full-rank matrix is ​​a matrix with equal values ​​of rank and order.

[0063] Step S30: Generate a dialogue response according to the model output result, and display the dialogue response through the preset interactive interface.

[0064] refer to Figure 3 , Figure 3 FIG. 1 is a flow chart of the interaction between the robot and the user in the security chat robot interaction method of the present invention. Figure 3 As shown, the robot can be deployed based on a preset security language model. After receiving a dialogue event triggered by a user, the robot generates a dialogue response based on the model output result output by the preset security language model and then displays it to the user. Figure 3 The preset security language model can be obtained by inputting the original security data after data preprocessing into the initial large language model, and then training and fine-tuning it in combination with LoRA technology.

[0065] Furthermore, in this embodiment, in order to accurately obtain the preset safety language model, thereby improving the accuracy of the interactive dialogue between the user and the robot based on the preset safety language model, before step S10, the following may also be included:

[0066] Step S1: Collect original security data, where the original security data includes one or more of vulnerability identification, vulnerability version, vulnerability description, and vulnerability source.

[0067] In a specific implementation, the collection method of the above-mentioned original security data may include a model-based collection method and a manual collection method. Specifically, the above-mentioned model-based collection method may include: inputting a preset question and answer template into the initial large language model, so that the initial large language model performs security-related simulated questions and answers based on the preset question and answer template; generating the original security data according to the results of the security-related simulated questions and answers. The above-mentioned manual-based collection method may include: collecting open source security data through an Internet search engine, and using the open source security data as the original security data. Exemplarily, the above-mentioned Internet search engine may be a retrieval technology that uses a specific strategy to retrieve specified information from the Internet and feed it back to the user based on user needs and certain algorithms. The above-mentioned open source security data may refer to security information data that can be freely obtained and used.

[0068] Furthermore, the above-mentioned preset question and answer template may be a module that includes a number of question boxes and answer boxes, and these question boxes and answer boxes are arranged in a staggered manner. The above-mentioned security-related simulated question and answer based on the preset question and answer template can be achieved by repeatedly asking questions to the initial large language model in advance and recording the answers of the initial large language model. For example, the entire process in a certain security-related simulated question and answer is: start asking questions, enter question 1 "What is A", and get answer 1 "A is a structure composed of B and C"; enter question 2 "What field is A applied to", and get answer 2 "A is applied to field D"; enter question 3 "What are the advantages and disadvantages of A", and get answer 3 "The advantage of A is E, and the disadvantage is F", and end the question. Then at this time, if you ask the above-mentioned initial large language model again "What is A", you will get all the contents of the above-mentioned B, C, D, E, and F, so that the answer to the question will be generated more comprehensively and quickly.

[0069] Step S2: preprocess the original security data to obtain training data.

[0070] It should be noted that the above training data is the data in the above original security data that can be used to train the initial large language model.

[0071] In a specific implementation, data preprocessing can be achieved by determining whether the above-mentioned original security data contains a preset source identifier, wherein the preset source identifier is used to characterize the validity of the original security data. The specific steps may be: determining whether the original security data contains a preset source identifier; if the original security data contains a preset source identifier, the original security data is determined as training data. The above-mentioned preset source identifier can be generally understood as an officially recognized gold standard or an officially recognized mark, which can be a string of encrypted codes or a string of random strings, which is not limited in this embodiment.

[0072] Furthermore, in order to prevent the occurrence of contradictory descriptions of the same vulnerability in the interaction between the robot and the user, the above step S2 may also include:

[0073] Detect whether there is a first category of original security data and a second category of original security data for the same vulnerability in the original security data; if so, determine training data from the original security data based on vulnerability information of the same vulnerability in the first category of original security data and the second category of original security data.

[0074] The definition of the same vulnerability can be determined by the similarity between the vulnerabilities. For example, if there are two different data of the same vulnerability in the original security data, and the similarity between them is greater than a preset threshold, then the two data can be considered to be the first type of original security data and the second type of original security data for the same vulnerability.

[0075] Specifically, the above-mentioned step of determining training data from the original security data based on the vulnerability information of the same vulnerability in the first category of original security data and the second category of original security data, if it exists, may include: if it exists, judging whether the first category of original security data and the second category of original security data contain a preset source identifier based on the vulnerability information of the same vulnerability in the first category of original security data and the second category of original security data, wherein the preset source identifier is used to characterize the validity of the original security data; if the first category of original security data contains the preset source identifier and the second category of original security data does not contain the preset source identifier, then determining the first category of original security data as training data, and determining the second category of original security data as supplementary data for the training data; if the second category of original security data contains the preset source identifier and the first category of original security data does not contain the preset source identifier, then determining the second category of original security data as training data, and determining the first category of original security data as supplementary data for the training data.

[0076] Furthermore, in order to provide a more comprehensive response to security questions raised by users, if neither the first category of original security data nor the second category of original security data contains the preset source identifier, the collection methods corresponding to the first category of original security data and the second category of original security data are determined based on the vulnerability information of the same vulnerability in the first category of original security data and the second category of original security data; and training data is determined from the original security data based on the collection methods corresponding to the first category of original security data and the second category of original security data.

[0077] In a specific implementation, three situations can be divided to determine the training data from the original security data based on the collection methods corresponding to the first category of original security data and the second category of original security data. For example: 1. If the collection method of the first category of original security data is the model-based collection method, and the collection method of the second category of original security data is the manual-based collection method, then the first category of original security data is determined as training data, and the second category of original security data is determined as supplementary data; 2. If the collection method of the first category of original security data is the manual-based collection method, and the collection method of the second category of original security data is the model-based collection method, then the second category of original security data is determined as training data, and the first category of original security data is determined as supplementary data. 3. If the collection methods of the first category of original security data and the second category of original security data are both the model-based collection method, then both the first category of original security data and the second category of original security data are determined as training data.

[0078] Step S3: Train the initial large language model based on the training data and LoRA technology to obtain a preset security language model.

[0079] This embodiment collects original security data, which includes one or more of vulnerability identification, vulnerability version, vulnerability description, and vulnerability source; performs data preprocessing on the original security data to obtain training data; trains the initial large language model based on the training data and LoRA technology to obtain a preset security language model, which is a model obtained by injecting a trainable module into the initial large language model through the LoRA technology and training the initial large language model injected with the trainable module, and the trainable module is used to adjust the corresponding full-rank matrix in the initial large language model; obtains a dialogue event triggered by a user based on a preset interactive interface, wherein the dialogue event includes a security issue; inputs the dialogue event into the preset security language model to obtain a model output result; generates a dialogue reply according to the model output result, and displays the dialogue reply through the preset interactive interface. Compared with the prior art that generates answers to security questions with the help of a traditional large language model, the above method of this embodiment trains the initial large language model based on training data and LoRA technology to obtain a preset security language model, and inputs the dialogue event triggered by the user into the preset security language model to generate a dialogue response containing answers to security questions, thereby avoiding the technical defects of the prior art that requires a lot of time and effort for manual search and manual screening, and enables users to quickly obtain accurate answers to security questions through human-computer interaction.

[0080] refer to Figure 4 , Figure 4 This is a flow chart of the second embodiment of the security chat robot interaction method of the present invention.

[0081] Based on the above first embodiment, in this embodiment, step S3 may include:

[0082] Step S31: injecting a trainable module into the initial large language model through the LoRA technology to obtain the initial large language model injected with the trainable module.

[0083] It should be understood that the above-mentioned trainable module may be a module including several newly added network layers.

[0084] Step S32: The initial large language model injected with the trainable module is trained using the training data to obtain a preset security language model.

[0085] In a specific implementation, since the initial large language model is a pre-trained model, it is in a convergent state as a whole, that is, the initial large language model contains many dense layers for matrix multiplication, and these dense layers are usually full rank. In this embodiment, some full rank matrices in the initial large language model can be adjusted by injecting a trainable module into the initial large language model, thereby fine-tuning the initial large language model to obtain the above-mentioned preset security language model.

[0086] Furthermore, in this embodiment, in order to avoid the reduction of efficiency caused by adjusting all parameters in the initial large language model, the step S32 may include:

[0087] Step S321: Freeze the pre-trained model weights in the initial large language model injected with the trainable module, wherein the pre-trained model weights are weights corresponding to the full-rank matrix in the initial large language model.

[0088] It should be understood that the freezing of the pre-trained model weights in the initial large language model injected with the trainable module means that the values ​​of these model weights are fixed and not updated.

[0089] Step S322: fine-tune the unfrozen model parameters in the initial large language model to obtain a fine-tuned large language model.

[0090] It should be noted that the above-mentioned unfrozen model parameters are model parameters that can be updated.

[0091] In a specific implementation, the unfrozen model parameters in the above-mentioned initial large language model can be fine-tuned through the LoRA technology to obtain a fine-tuned large language model.

[0092] Step S323: training the fine-tuned large language model using the training data to obtain a preset security language model.

[0093] In a specific implementation, the training data can be input into the fine-tuned large language model for training to obtain the fine-tuned model weights; and a preset security language model is obtained based on the pre-trained model weights and the fine-tuned model weights.

[0094] refer to Figure 5 , Figure 5 The schematic diagram of constructing a preset safety language model for the safety chat robot interaction method of the present invention is shown in FIG. Figure 5 As shown in the figure, by freezing some parameters in the initial large language model and fine-tuning the full-rank matrix in the initial large language model based on the LoRA technology, a fine-tuned large language model is obtained. Finally, the training data is input into the fine-tuned large language model, and the preset security language model is constructed and saved in combination with the loss function obtained during the training process.

[0095] Specifically, in this embodiment, in order to further reduce the number of parameters involved in the model training process, thereby shortening the generation cycle of the model output results, and further improving the interaction efficiency between the robot and the user, the step S322 may include:

[0096] Step S3221: Decomposing the unfrozen model parameters in the initial large language model through the trainable module to obtain a low-rank matrix, where the unfrozen model parameters are the full-rank matrix corresponding to the attention layer.

[0097] It should be noted that the above-mentioned low-rank matrix refers to a matrix whose rank is small relative to the number of rows or columns.

[0098] In a specific implementation, the unfrozen model parameters in the initial large language model can be decomposed to obtain a low-rank matrix, thereby reducing the number of parameters involved in the model training process. Furthermore, the low-rank matrix can be obtained by decomposing the full-rank matrix corresponding to the attention layer in the initial large language model.

[0099] Step S3222: performing weight adjustment on the low-rank matrix to obtain a fine-tuned large language model.

[0100] In a specific implementation, the weight coefficients of the above low-rank matrix may be modified to implement weight adjustment.

[0101] In this embodiment, a trainable module is injected into the initial large language model through the LoRA technology to obtain an initial large language model injected with the trainable module; the pre-trained model weights in the initial large language model injected with the trainable module are frozen, and the pre-trained model weights are the weights corresponding to the full-rank matrix in the initial large language model; the unfrozen model parameters in the initial large language model are decomposed through the trainable module to obtain a low-rank matrix, and the unfrozen model parameters are the full-rank matrix corresponding to the attention layer; the low-rank matrix is ​​weight-adjusted to obtain a fine-tuned large language model; the fine-tuned large language model is trained through the training data to obtain a preset security language model. Compared with the prior art that directly inputs the training data into the traditional large language model for training, the above method of this embodiment decomposes the full-rank matrix corresponding to the attention layer in the initial large language model to obtain a low-rank matrix, and inputs the training data into the fine-tuned large language model obtained by weight adjustment based on the above low-rank matrix, thereby avoiding the need for the prior art to adjust multiple parameters in the traditional large language model, thereby improving the training efficiency of the preset security language model in this embodiment.

[0102] refer to Figure 6 , Figure 6 This is a flow chart of the third embodiment of the security chat robot interaction method of the present invention.

[0103] Based on the above embodiments, in this embodiment, in order to screen the original security data and thus improve the accuracy of the interaction content between the robot and the user, the step S2 may include:

[0104] Step S21: determining whether the original security data contains a preset source identifier, wherein the preset source identifier is used to characterize the validity of the original security data.

[0105] In a specific implementation, it is possible to determine whether the original security data contains a preset source identifier by querying the source code corresponding to the original security data.

[0106] Step S22: If the original security data contains a preset source identifier, the original security data is determined as training data.

[0107] It should be understood that if a certain original security data contains a preset source identifier, it means that the original security data is officially certified data, and therefore it can be used as training data.

[0108] Step S23: If the original security data does not contain a preset source identifier, the original security data is cleaned to obtain training data.

[0109] It is understandable that if a certain original security data does not contain a preset source identifier, it means that the original security data is not officially certified data, which means that the data is not necessarily valid or credible, so it is necessary to clean the data to obtain training data.

[0110] In a specific implementation, the original security data may be cleaned by establishing preset rules, for example, deleting the original security data containing preset keywords, etc. This embodiment does not limit the specific regulations of the preset rules.

[0111] Based on the above embodiments, in this embodiment, in order to ensure the immediacy of the interactive dialogue between the robot and the user, thereby improving the user's interactive experience, the step S30 may include:

[0112] Step S301: Generate a current dialogue response according to the model output result, and obtain the number of completed dialogue rounds with the user.

[0113] It should be noted that the above number of dialogue rounds refers to the number of rounds of complete interactive dialogue between the user and the robot. Specifically, a complete interactive dialogue can be that after the user asks a security question Q1, the robot displays the corresponding response A1 to the security question to the user through a preset interactive interface. The dialogue consisting of Q1 and A1 is considered a complete interactive dialogue.

[0114] It should be understood that if there are too many completed conversation rounds between the robot and the user, the user will not be able to quickly browse the current conversation replies, and it will also cause data congestion, thereby reducing the user's interactive experience.

[0115] Step S302: If the number of conversation rounds is less than a preset number of rounds, the conversation replies are displayed to the user through the preset interaction interface.

[0116] It should be understood that if the above-mentioned number of conversation rounds is less than the preset number of rounds, it means that even if new conversation replies are added to the preset interaction interface at this time, it will not have a negative impact on the user experience. Therefore, the above-mentioned conversation replies can be displayed to the user through the above-mentioned preset interaction interface.

[0117] Step S303: If the number of conversation rounds is greater than or equal to the preset number of rounds, the interaction record with the earliest time and date in the preset interaction interface is deleted according to the conversation time and date, and the current conversation reply is displayed to the user through the preset interaction interface.

[0118] It should be understood that if the number of conversation rounds is greater than or equal to the preset number of rounds, it means that if a new conversation reply is added to the preset interaction interface at this time, the user will not be able to quickly browse the current conversation reply, and it will also cause data congestion and reduce the user's interactive experience. Therefore, the conversation replies currently in the preset interaction interface can be sorted in descending or ascending order of the conversation time and date, and the interaction record with the earliest time and date in the preset interaction interface can be deleted, and then the current conversation reply can be displayed to the user through the preset interaction interface.

[0119] This embodiment determines whether the original security data contains a preset source identifier, which is used to characterize the validity of the original security data; if the original security data contains the preset source identifier, the original security data is determined as training data; if the original security data does not contain the preset source identifier, the original security data is cleaned based on the preset rules to obtain training data; the current dialogue response is generated according to the model output result, and the number of completed dialogue rounds with the user is obtained; if the number of dialogue rounds is less than the preset number of rounds, the dialogue response is displayed to the user through the preset interaction interface; if the number of dialogue rounds is greater than or equal to the preset number of rounds, the earliest interaction record in the preset interaction interface is deleted according to the dialogue time and date, and the current dialogue response is displayed to the user through the preset interaction interface. Compared with the existing security question answering method, the above method of this embodiment improves the accuracy of the interaction content between the robot and the user by preprocessing the original security data; at the same time, by deleting the earliest interaction record in the preset interaction interface, the immediacy of the interactive dialogue between the robot and the user is guaranteed, thereby improving the user's interactive experience.

[0120] In addition, an embodiment of the present invention further proposes a storage medium, on which a security chat robot interaction program is stored. When the security chat robot interaction program is executed by a processor, the steps of the security chat robot interaction method described above are implemented.

[0121] Reference Figure 7 , Figure 7 This is a structural block diagram of the first embodiment of the security chat robot interaction device of the present invention.

[0122] like Figure 7 As shown, the security chat robot interaction device proposed in the embodiment of the present invention includes:

[0123] An event acquisition module 701 is used to acquire a dialog event triggered by a user based on a preset interactive interface, wherein the dialog event includes a security issue;

[0124] A model input module 702 is used to input the conversation event into a preset security language model to obtain a model output result. The preset security language model is a model obtained by injecting a trainable module into an initial large language model through LoRA technology and training the initial large language model injected with the trainable module. The trainable module is used to adjust the corresponding full rank matrix in the initial large language model.

[0125] The model output module 703 is used to generate a dialogue response according to the model output result, and display the dialogue response through the preset interactive interface.

[0126] This embodiment obtains a dialogue event triggered by a user based on a preset interactive interface, wherein the dialogue event includes security issues; inputs the dialogue event into a preset security language model to obtain a model output result, wherein the preset security language model is a model obtained by injecting a trainable module into an initial large language model through LoRA technology, and training the initial large language model injected with the trainable module, wherein the trainable module is used to adjust the corresponding full-rank matrix in the initial large language model; generates a dialogue response according to the model output result, and displays the dialogue response through a preset interactive interface. Compared with the prior art that finds answers to security issues through manual search and manual screening, the above method of this embodiment processes dialogue events containing security issues through a preset security language model, and obtains answers to security issues based on dialogue responses generated based on the model output results of the preset security language model, thereby avoiding the technical defects of the prior art that require a lot of time and effort for manual search and manual screening, thereby enabling users to quickly obtain accurate answers to security issues through human-computer interaction.

[0127] Based on the first embodiment of the security chat robot interaction device of the present invention, a second embodiment of the security chat robot interaction device of the present invention is proposed.

[0128] In this embodiment, the model input module 702 is also used to collect original security data, and the original security data includes one or more of vulnerability identification, vulnerability version, vulnerability description, and vulnerability source; perform data preprocessing on the original security data to obtain training data; and train the initial large language model based on the training data and LoRA technology to obtain a preset security language model.

[0129] Furthermore, the model input module 702 is also used to inject a trainable module into the initial large language model through the LoRA technology to obtain an initial large language model injected with the trainable module; and train the initial large language model injected with the trainable module through the training data to obtain a preset security language model.

[0130] Furthermore, the model input module 702 is also used to freeze the pre-trained model weights in the initial large language model injected with the trainable module, wherein the pre-trained model weights are the weights corresponding to the full-rank matrix in the initial large language model; fine-tune the unfrozen model parameters in the initial large language model to obtain a fine-tuned large language model; and train the fine-tuned large language model using the training data to obtain a preset security language model.

[0131] Furthermore, the model input module 702 is also used to decompose the unfrozen model parameters in the initial large language model through the trainable module to obtain a low-rank matrix, and the unfrozen model parameters are the full-rank matrix corresponding to the attention layer; and adjust the weights of the low-rank matrix to obtain a fine-tuned large language model.

[0132] Furthermore, the model input module 702 is also used to determine whether the original security data contains a preset source identifier, and the preset source identifier is used to characterize the validity of the original security data; if the original security data contains the preset source identifier, the original security data is determined as training data; if the original security data does not contain the preset source identifier, the original security data is cleaned to obtain training data.

[0133] Furthermore, the model output module 703 is also used to generate a current dialogue response based on the model output result, and obtain the number of completed dialogue rounds with the user; if the number of dialogue rounds is less than the preset number of rounds, the dialogue response is displayed to the user through the preset interaction interface; if the number of dialogue rounds is greater than or equal to the preset number of rounds, the interaction record with the earliest time and date in the preset interaction interface is deleted according to the dialogue time and date, and the current dialogue response is displayed to the user through the preset interaction interface.

[0134] Other embodiments or specific implementations of the security chat robot interaction device of the present invention can refer to the above-mentioned method embodiments and will not be repeated here.

[0135] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0136] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0137] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0138] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A security chat robot interaction method, characterized in that: The security chat robot interaction method comprises the following steps: Acquire a dialogue event triggered by a user based on a preset interactive interface, wherein the dialogue event includes a security question; Input the conversation event into a preset security language model to obtain a model output result, wherein the preset security language model is a model obtained by injecting a trainable module into an initial large language model through LoRA technology and training the initial large language model injected with the trainable module, and the trainable module is used to adjust the corresponding full rank matrix in the initial large language model; Generate a dialogue response based on the model output result, and display the dialogue response through the preset interactive interface.

2. The security chat robot interaction method according to claim 1, characterized in that: Before the step of obtaining a dialog event triggered by a user based on a preset interactive interface, the method further includes: Collecting original security data, wherein the original security data includes one or more of vulnerability identification, vulnerability version, vulnerability description, and vulnerability source; Performing data preprocessing on the original security data to obtain training data; The initial large language model is trained based on the training data and LoRA technology to obtain a preset security language model.

3. The security chat robot interaction method according to claim 2, characterized in that: The step of training the initial large language model based on the training data and the LoRA technology to obtain a preset security language model includes: Injecting a trainable module into an initial large language model through the LoRA technology to obtain an initial large language model injected with the trainable module; The initial large language model injected with the trainable module is trained using the training data to obtain a preset security language model.

4. The security chat robot interaction method according to claim 3, characterized in that: The step of training the initial large language model injected with the trainable module through the training data to obtain a preset security language model includes: Freezing the pre-trained model weights in the initial large language model injected with the trainable module, wherein the pre-trained model weights are weights corresponding to the full-rank matrix in the initial large language model; Fine-tuning unfrozen model parameters in the initial large language model to obtain a fine-tuned large language model; The fine-tuned large language model is trained using the training data to obtain a preset security language model.

5. The security chat robot interaction method according to claim 4, characterized in that: The step of fine-tuning the unfrozen model parameters in the initial large language model to obtain a fine-tuned large language model includes: Decomposing unfrozen model parameters in the initial large language model by the trainable module to obtain a low-rank matrix, wherein the unfrozen model parameters are a full-rank matrix corresponding to the attention layer; The low-rank matrix is ​​weighted to obtain a fine-tuned large language model.

6. The security chat robot interaction method according to claim 2, characterized in that: The step of preprocessing the original security data to obtain training data includes: Determining whether the original security data contains a preset source identifier, where the preset source identifier is used to indicate the validity of the original security data; If the original security data contains a preset source identifier, the original security data is determined as training data.

7. The security chat robot interaction method according to any one of claims 1 to 6, characterized in that: The step of generating a dialogue response according to the model output result and displaying the dialogue response through the preset interactive interface includes: Generate a current dialogue response according to the output result of the model, and obtain the number of completed dialogue rounds with the user; If the number of dialogue rounds is less than a preset number of rounds, displaying the dialogue reply to the user through the preset interactive interface; If the number of conversation rounds is greater than or equal to the preset number of rounds, the interaction record with the earliest time and date in the preset interaction interface is deleted according to the conversation time and date, and the current conversation reply is displayed to the user through the preset interaction interface.

8. A security chat robot interaction device, characterized in that: The safety chat robot interaction device comprises: An event acquisition module is used to acquire a dialogue event triggered by a user based on a preset interactive interface, wherein the dialogue event includes security issues; A model input module, used to input the dialogue event into a preset security language model to obtain a model output result, wherein the preset security language model is a model obtained by injecting a trainable module into an initial large language model through LoRA technology and training the initial large language model injected with the trainable module, and the trainable module is used to adjust the corresponding full rank matrix in the initial large language model; The model output module is used to generate a dialogue response according to the model output result and display the dialogue response through the preset interactive interface.

9. A security chat robot interactive device, characterized in that: The security chat robot interaction device includes: a memory, a processor, and a security chat robot interaction program stored in the memory and executable on the processor. When the security chat robot interaction program is executed by the processor, the security chat robot interaction method according to any one of claims 1 to 7 is implemented.

10. A storage medium, characterized in that: The storage medium stores a security chat robot interaction program, and when the security chat robot interaction program is executed by the processor, the security chat robot interaction method according to any one of claims 1 to 7 is implemented.