Replay control method and device of large language model, electronic equipment, storage medium and program product
By introducing sensitive condition detection and safety prompt information processing methods into the large language model, the problem of uncontrollable output content of the large language model is solved, and a safer and more reliable automatic reply is achieved.
Patent Information
- Application Number
- CN202411773866.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-14
AI Technical Summary
The large language model has the problem of uncontrollable output content when dealing with open domain dialogue, which may generate replies that contain harmful information such as political sensitivity, ethical disputes, racial discrimination, religious offense, etc., resulting in negative social impacts and legal and moral issues.
By obtaining the question to be replied, in response to its satisfying preset sensitive conditions, the target security prompt information is obtained, and input it into the large language model to output safe reply information. The method includes identifying sensitive problem types, obtaining security prompts, generating replies, and making corrections if necessary to ensure the security of replies.
It realizes more comprehensive and robust control of the output content of the large language model, reduces manual intervention, improves the level of automation, and enhances the ability to identify and intercept harmful information, thereby improving the security and reliability of the large language model.
Smart Images

Figure CN119621910A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a response control method for a large language model, a response control device for a large language model, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the rapid development of artificial intelligence technology, large language models (LLMs) have made significant progress in the field of natural language processing (NLP). Due to their powerful language understanding and generation capabilities, large language models have shown great potential in various application scenarios, such as text generation, automatic translation, question-answering systems, etc. However, the widespread application of large language models is also accompanied by a series of challenges, especially in ensuring the security and controllability of their output content.
[0003] At present, when large language models process open-domain conversations, there is a problem of uncontrollable output content. This uncontrollability may cause large language models to generate responses containing harmful information such as political sensitivity, ethical controversy, racial discrimination, religious offense, etc. The spread of such harmful information may have a negative impact on society and even cause serious legal and ethical issues. Summary of the invention
[0004] The present disclosure provides a technical solution for response control of a large language model.
[0005] According to one aspect of the present disclosure, a reply control method for a large language model is provided, comprising:
[0006] Get questions waiting to be answered;
[0007] In response to the question to be answered meeting a preset sensitive condition, obtaining target security prompt information corresponding to the question to be answered; wherein the preset sensitive condition includes: the question to be answered is a sensitive question;
[0008] The question to be answered and the target safety prompt information are input into a preset large language model, and the first reply information corresponding to the question to be answered is output through the large language model.
[0009] In a possible implementation, the obtaining of target security prompt information corresponding to the question to be answered includes:
[0010] Obtain security prompt information corresponding to the sensitive question type to which the question to be answered belongs;
[0011] According to the security prompt information corresponding to the sensitive question type to which the question to be answered belongs, the target security prompt information corresponding to the question to be answered is determined.
[0012] In a possible implementation, the method further includes:
[0013] The question to be answered is input into a preset text similarity model, and the sensitive question type to which the question to be answered belongs is output through the text similarity model.
[0014] In a possible implementation, before inputting the question to be answered and the target safety prompt information into a preset large language model, the method further includes:
[0015] Obtaining a training data set, wherein the training data set includes multiple training data, and any one of the training data includes a question sample and reply annotation information corresponding to the question sample;
[0016] For any item of training data, inputting a question sample in the training data into the large language model, or inputting a question sample in the training data and security prompt information corresponding to the question sample into the large language model, and outputting second reply information corresponding to the question sample through the large language model;
[0017] The large language model is trained according to the second reply information and the reply annotation information corresponding to the question sample.
[0018] In a possible implementation manner, after outputting the first reply information corresponding to the question to be replied through the large language model, the method further includes:
[0019] In response to the first reply information being a sensitive reply, obtaining revised reply information corresponding to the question to be replied;
[0020] The modified reply information is outputted.
[0021] In a possible implementation, the method further includes:
[0022] The first reply information is input into a preset security classification model, and the security type corresponding to the first reply information is output through the security classification model, wherein the security type is a sensitive reply or a non-sensitive reply.
[0023] In a possible implementation, the method further includes:
[0024] Performing matching processing on the first reply information and a preset sensitive dictionary, wherein the matching processing is used to identify sensitive words in the first reply information based on the sensitive dictionary;
[0025] In response to the presence of sensitive words in the first reply information, it is determined that the first reply information is a sensitive reply.
[0026] In a possible implementation, the modified reply information includes:
[0027] The standard reply information corresponding to the question to be replied, or the standard reply information corresponding to the sensitive question type to which the question to be replied belongs.
[0028] In a possible implementation, obtaining the corrected reply information corresponding to the question to be replied to includes:
[0029] Filtering sensitive words in the first reply information;
[0030] Based on the first reply information after filtering sensitive words, the revised reply information corresponding to the question to be replied is generated.
[0031] In a possible implementation, the preset sensitive condition further includes: the question to be answered belongs to a specified sensitive question type; and the method further includes:
[0032] In response to the question to be answered being a sensitive question but not belonging to a specified sensitive question type, obtaining standard answer information corresponding to the question to be answered;
[0033] Output the standard reply information corresponding to the question to be replied.
[0034] According to one aspect of the present disclosure, a reply control device for a large language model is provided, comprising:
[0035] The first acquisition module is used to obtain questions to be answered;
[0036] A second acquisition module is configured to acquire target security prompt information corresponding to the question to be answered in response to the question to be answered meeting a preset sensitive condition; wherein the preset sensitive condition includes: the question to be answered is a sensitive question;
[0037] The first reply generation module is used to input the question to be answered and the target safety prompt information into a preset large language model, and output the first reply information corresponding to the question to be answered through the large language model.
[0038] In a possible implementation manner, the second acquisition module is used to:
[0039] Obtain security prompt information corresponding to the sensitive question type to which the question to be answered belongs;
[0040] According to the security prompt information corresponding to the sensitive question type to which the question to be answered belongs, the target security prompt information corresponding to the question to be answered is determined.
[0041] In a possible implementation manner, the device further includes:
[0042] The sensitive question type prediction module is used to input the question to be answered into a preset text similarity model, and output the sensitive question type to which the question to be answered belongs through the text similarity model.
[0043] In a possible implementation manner, the device further includes:
[0044] A third acquisition module is used to acquire a training data set, wherein the training data set includes multiple training data, and any training data includes a question sample and reply annotation information corresponding to the question sample;
[0045] A second reply generating module is used for, for any item of training data, inputting a question sample in the training data into the large language model, or inputting a question sample in the training data and security prompt information corresponding to the question sample into the large language model, and outputting second reply information corresponding to the question sample through the large language model;
[0046] A training module is used to train the large language model according to the second reply information and the reply annotation information corresponding to the question sample.
[0047] In a possible implementation manner, the device further includes:
[0048] A correction module, configured to obtain, in response to the first reply information being a sensitive reply, corrected reply information corresponding to the question to be replied;
[0049] The correction output module is used to output the correction reply information.
[0050] In a possible implementation manner, the device further includes:
[0051] The security classification module is used to input the first reply information into a preset security classification model, and output the security type corresponding to the first reply information through the security classification model, wherein the security type is a sensitive reply or a non-sensitive reply.
[0052] In a possible implementation manner, the device further includes:
[0053] A sensitive word matching module, used for matching the first reply information with a preset sensitive dictionary, wherein the matching process is used for identifying sensitive words in the first reply information based on the sensitive dictionary;
[0054] A determination module is used to determine that the first reply information is a sensitive reply in response to the presence of sensitive words in the first reply information.
[0055] In a possible implementation, the modified reply information includes:
[0056] The standard reply information corresponding to the question to be replied, or the standard reply information corresponding to the sensitive question type to which the question to be replied belongs.
[0057] In a possible implementation, the correction module is used to:
[0058] Filtering sensitive words in the first reply information;
[0059] Based on the first reply information after filtering sensitive words, the revised reply information corresponding to the question to be replied is generated.
[0060] In a possible implementation, the preset sensitive condition further includes: the question to be answered belongs to a specified sensitive question type; and the device further includes:
[0061] A standard obtaining module, configured to obtain standard answer information corresponding to the question to be answered in response to the question to be answered belonging to a sensitive question but not belonging to a specified sensitive question type;
[0062] The standard output module is used to output the standard reply information corresponding to the question to be replied.
[0063] According to one aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to call the executable instructions stored in the memory to execute the above method.
[0064] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor.
[0065] According to one aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes the above method.
[0066] In the disclosed embodiment, by obtaining a question to be replied, in response to the question to be replied meeting a preset sensitive condition, the target security prompt information corresponding to the question to be replied is obtained, wherein the preset sensitive condition includes that the question to be replied is a sensitive question, and the question to be replied and the target security prompt information are input into a preset large language model, and the first reply information corresponding to the question to be replied is output through the large language model, thereby providing a more comprehensive and robust large language model reply control method, making automatic replies safe and harmless. The disclosed embodiment can not only reduce manual intervention and improve the level of automation, but also enhance the ability to identify and intercept harmful information through multi-level security measures, thereby improving the security and reliability of the large language model in practical applications.
[0067] In addition, the reply control method of the large language model provided in the embodiment of the present disclosure is compatible with the reply control scheme of the large language model in the related art, and can be optimized for special vertical scenarios.
[0068] By adopting the reply control method of the large language model provided by the embodiment of the present disclosure, the safety accessories of the large language model can be realized. That is, the reply control method of the large language model can be realized by the safety accessories of the large language model. The safety accessories of the large language model can be conveniently integrated with the large language model, so as to have high ease of use.
[0069] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
[0070] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.
[0072] Figure 1 A flow chart of a large language model reply control method provided by an embodiment of the present disclosure is shown.
[0073] Figure 2 A schematic diagram showing a reply control method for a large language model provided by an embodiment of the present disclosure is shown.
[0074] Figure 3 A block diagram of a large language model reply control device provided by an embodiment of the present disclosure is shown.
[0075] Figure 4 A block diagram of an electronic device 1900 provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0076] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0077] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0078] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.
[0079] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0080] In related technologies, security filtering mechanisms are usually introduced at the output of large language models. These mechanisms try to reduce the generation of harmful information by identifying and blocking sensitive words or phrases. However, this approach has the following limitations:
[0081] 1. Dependence on manual updates: Security databases and sensitive vocabulary lists need to be constantly updated and maintained by humans to adapt to the ever-changing social context and language usage habits. This not only consumes human resources, but also makes it difficult to keep up with the emergence of new sensitive topics.
[0082] 2. Single filtering mechanism: Setting filtering only at the output end may result in a filtering mechanism that is too simple and cannot fully capture all types of sensitive content. In addition, this single-point defense is susceptible to misjudgment and missed judgment and lacks sufficient robustness.
[0083] In order to solve technical problems similar to those described above, the embodiments of the present disclosure provide a reply control method for a large language model, by obtaining a question to be replied, and in response to the question to be replied satisfying a preset sensitive condition, obtaining the target security prompt information corresponding to the question to be replied, wherein the preset sensitive condition includes that the question to be replied is a sensitive question, and inputting the question to be replied and the target security prompt information into a preset large language model, and outputting the first reply information corresponding to the question to be replied through the large language model, thereby providing a more comprehensive and robust reply control method for a large language model, making automatic replies safe and harmless. The embodiments of the present disclosure can not only reduce manual intervention and improve the level of automation, but also enhance the ability to identify and intercept harmful information through multi-level security measures, thereby improving the security and reliability of the large language model in practical applications.
[0084] In addition, the reply control method of the large language model provided in the embodiment of the present disclosure is compatible with the reply control scheme of the large language model in the related art, and can be optimized for special vertical scenarios.
[0085] By adopting the reply control method of the large language model provided by the embodiment of the present disclosure, the safety accessories of the large language model can be realized. That is, the reply control method of the large language model can be realized by the safety accessories of the large language model. The safety accessories of the large language model can be conveniently integrated with the large language model, so as to have high ease of use.
[0086] The reply control method of the large language model provided by the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.
[0087] Figure 1 A flow chart of a large language model reply control method provided by an embodiment of the present disclosure is shown. In one possible implementation, the execution subject of the large language model reply control method may be a large language model reply control device. For example, the large language model reply control method may be executed by a terminal device or a server or other electronic device. The terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device or a wearable device. In some possible implementations, the large language model reply control method may be implemented by a processor calling computer-readable instructions stored in a memory. For example Figure 1 As shown, the reply control method of the large language model includes steps S11 to S13.
[0088] In step S11, questions to be answered are obtained.
[0089] In step S12, in response to the question to be answered meeting a preset sensitive condition, target security prompt information corresponding to the question to be answered is obtained; wherein the preset sensitive condition includes: the question to be answered is a sensitive question.
[0090] In step S13, the question to be answered and the target safety prompt information are input into a preset large language model, and the first reply information corresponding to the question to be answered is output through the large language model.
[0091] Among them, the unanswered question can represent a question that needs to be responded or answered by the system or model. This question usually comes from user input, or in some cases it may be a question generated or triggered internally by the system. The unanswered question can be of various types, including but not limited to factual inquiries, opinion inquiries, requests for help, etc.
[0092] In an embodiment of the present disclosure, in response to the question to be replied meeting a preset sensitive condition, target security prompt information corresponding to the question to be replied can be obtained. In an embodiment of the present disclosure, the preset sensitive condition at least includes that the question to be replied is a sensitive question.
[0093] In a possible implementation, the preset sensitive condition may only include that the question to be answered is a sensitive question. In this implementation, in response to the question to be answered being a sensitive question, target security prompt information corresponding to the question to be answered may be obtained.
[0094] In another possible implementation, the preset sensitive condition further includes: the question to be answered belongs to a specified sensitive question type.
[0095] The specified sensitive question types may include one or more than two sensitive question types.
[0096] As an example of this implementation, the preset sensitive condition may be: the question to be replied is a sensitive question, and the question to be replied belongs to a specified sensitive question type. In this example, in response to the question to be replied being a sensitive question, and the question to be replied belonging to any specified sensitive question type, the target security prompt information corresponding to the question to be replied may be obtained.
[0097] In this implementation, by setting the preset sensitive conditions to include that the question to be replied is a sensitive question and that the question to be replied belongs to a specified sensitive question type, and in response to the question to be replied satisfying the preset sensitive conditions, the target security prompt information corresponding to the question to be replied is obtained, thereby improving the efficiency of reply control of the large language model.
[0098] Of course, depending on the actual application scenario, the preset sensitive conditions may also include other conditions, which are not limited here.
[0099] In a possible implementation, the method further includes: inputting the question to be answered into a preset text similarity model, and outputting the sensitive question type to which the question to be answered belongs through the text similarity model.
[0100] For example, sensitive question types include but are not limited to race, politics, prejudice and discrimination, ethics, insults and hatred, pornography, gambling and drugs, physical harm, mental health, privacy issues, crimes, identity attacks, flirting, threats, insults, sexual explicitness, etc.
[0101] As an example of this implementation, the text similarity model can be a binary classification model. In this example, multiple text similarity models corresponding to multiple sensitive question types can be pre-set. The questions to be replied can be input into multiple text similarity models respectively, and the sensitive question type to which the questions to be replied belong can be determined by multiple text similarity models. For example, the questions to be replied can be input into the text similarity model corresponding to sensitive question type A, and the text similarity model corresponding to sensitive question type A is used to perform similarity analysis on the questions to be replied and the sensitive question knowledge base corresponding to sensitive question type A. If the threshold is exceeded, it can be determined that the questions to be replied belong to sensitive question type A, otherwise it can be determined that the questions to be replied do not belong to sensitive question type A; the questions to be replied can be input into the text similarity model corresponding to sensitive question type B, and the text similarity model corresponding to sensitive question type B is used to perform similarity analysis on the questions to be replied and the sensitive question knowledge base corresponding to sensitive question type B. If the threshold is exceeded, it can be determined that the questions to be replied belong to sensitive question type B, otherwise it can be determined that the questions to be replied do not belong to sensitive question type B; and so on. Among them, the size of the threshold can be determined by a batch of data tests.
[0102] As another example of this implementation, the text similarity model may be a multi-classification model. In this example, a text similarity model may be pre-set, and the question to be answered may be input into the text similarity model, and the sensitive question type to which the question to be answered belongs may be output through the text similarity model.
[0103] As an example of this implementation, open source sensitive question related data and log data can be collected to build a sensitive question knowledge base. The text similarity model can determine the sensitive question type to which the question to be answered belongs based on the sensitive question knowledge base.
[0104] As an example of this implementation, the text similarity model may adopt the RoFormer-Sim model. Of course, the specific type of the text similarity model may be flexibly selected according to the actual application scenario requirements, and is not limited here.
[0105] In this implementation, the question to be answered is input into a preset text similarity model, and the text similarity model is used to output the sensitive question type to which the question to be answered belongs. Thus, the sensitive question type to which the question to be answered belongs is accurately identified through the text similarity model, thereby facilitating the subsequent adoption of appropriate processing measures.
[0106] In another possible implementation, the text similarity model may be used only to determine whether the question to be answered is a sensitive question.
[0107] In the disclosed embodiment, in response to the question to be answered meeting a preset sensitive condition, the target security prompt information corresponding to the question to be answered can be obtained. Among them, the security prompt information can represent information used to prompt or guide the large language model to reply. In some application scenarios, the security prompt information can also be called security guidance information, security guidance information, etc., which is not limited here.
[0108] In a possible implementation, obtaining target security prompt information corresponding to the question to be answered includes: obtaining security prompt information corresponding to the sensitive question type to which the question to be answered belongs; and determining the target security prompt information corresponding to the question to be answered based on the security prompt information corresponding to the sensitive question type to which the question to be answered belongs.
[0109] In this implementation, security prompt information can be set for different types of sensitive questions.
[0110] As an example of this implementation, security prompt information corresponding to different types of sensitive questions can be set manually.
[0111] As another example of this implementation, the model can be made to learn to generate security prompt information corresponding to different types of sensitive questions through a reinforcement learning framework. In this example, a reward function can be defined, which can be evaluated based on the effectiveness of the generated security prompt information. Through iterative optimization, the security prompt information generated by the model can be made to meet expectations more and more.
[0112] As an example of this implementation, when there is only one security prompt information corresponding to the sensitive question type to which the question to be answered belongs, the security prompt information can be determined as the target security prompt information corresponding to the question to be answered. For example, when the question to be answered belongs to only one sensitive question type and there is only one security prompt information for the sensitive question type, the security prompt information corresponding to the sensitive question type can be determined as the target security prompt information corresponding to the question to be answered.
[0113] As another example of this implementation method, when there are at least two security prompt information corresponding to the sensitive question type to which the question to be answered belongs, the at least two security prompt information can be matched with the question to be answered, and the security prompt information with the highest matching degree can be determined as the target security prompt information corresponding to the question to be answered.
[0114] For example, when the question to be answered belongs to only one type of sensitive question and there are at least two security prompt information for this sensitive question type, the at least two security prompt information can be matched with the question to be answered, and the security prompt information with the highest matching degree can be determined as the target security prompt information corresponding to the question to be answered.
[0115] For example, when the question to be answered belongs to at least two sensitive question types and there is at least one security prompt information for each sensitive question type, at least two security prompt information corresponding to the at least two sensitive question types can be matched with the question to be answered, and the security prompt information with the highest matching degree can be determined as the target security prompt information corresponding to the question to be answered.
[0116] In this implementation, by obtaining security prompt information corresponding to the sensitive question type to which the question to be answered belongs, and based on the security prompt information corresponding to the sensitive question type to which the question to be answered belongs, the target security prompt information corresponding to the question to be answered is determined. The target security prompt information thus determined is conducive to the large language model generating more appropriate reply information.
[0117] In a possible implementation, the security prompt information corresponding to any sensitive question type may include the legal analysis and / or legal basis corresponding to the sensitive question type.
[0118] In a possible implementation, before inputting the question to be answered and the target safety prompt information into a preset large language model, the method also includes: obtaining a training data set, wherein the training data set includes multiple training data, and any training data includes a question sample and reply annotation information corresponding to the question sample; for any training data, inputting the question sample in the training data into the large language model, or inputting the question sample in the training data and the safety prompt information corresponding to the question sample into the large language model, and outputting second reply information corresponding to the question sample through the large language model; and training the large language model according to the second reply information and the reply annotation information corresponding to the question sample.
[0119] In this implementation, first, a training data set containing multiple training data may be collected. Each item in the training data includes a question sample and the reply annotation information corresponding to the question sample. The reply annotation information may be an expected reply determined by an expert or based on certain criteria, and may be used to measure the accuracy of the output of the large language model.
[0120] The question samples in the training data can be obtained by collecting open source conversation data, web crawlers, etc. The reply annotation information in the training data can be obtained by manual construction or mining log data, etc. Alternatively, the reply information corresponding to the question samples can be generated by an existing large model, and then the reply annotation information corresponding to the question samples can be determined after manual inspection.
[0121] As an example of this implementation, for any item of training data in the training data set, a question sample in the training data can be separately input into the large language model, and the second reply information corresponding to the question sample can be output through the large language model.
[0122] As another example of this implementation method, for any training data in a training data set, when a question sample in the training data meets a preset sensitive condition, security prompt information corresponding to the question sample can be obtained, and the question sample and the security prompt information corresponding to the question sample can be input into a large language model together, and the second reply information corresponding to the question sample can be output through the large language model.
[0123] The second reply information may represent reply information corresponding to the question sample output by the large language model.
[0124] In this implementation, after obtaining the second reply information corresponding to the question sample, the second reply information can be compared with the reply annotation information in the training data, and the performance of the large language model can be evaluated by calculating the difference or similarity between the two. Based on this evaluation result, the large language model can be trained using an appropriate optimization algorithm (such as gradient descent, etc.) to reduce the difference between the predicted reply and the annotated reply, thereby optimizing the performance of the large language model.
[0125] As an example of this implementation, when there is sufficient training data in the training data set and sufficient computing power, the large language model can be fine-tuned by full fine-tuning. When there is insufficient training data in the training data set or insufficient computing power, the large language model can be fine-tuned by LoRA fine-tuning, p-tuning, etc.
[0126] In this implementation, the hyperparameters of the large language model (such as learning rate, batch size, number of iterations, optimizer, loss function, regularization parameter, etc.) can be flexibly set according to the actual application scenario requirements and are not limited here.
[0127] In this implementation, in response to the convergence of the loss function of the large language model, training can be stopped and the trained large language model can be saved.
[0128] In this implementation, the large language model can be fully trained and optimized through the training data set before processing the questions to be answered. In this way, when the large language model receives questions to be answered in actual applications, it can more accurately understand the intent and context of the questions, and generate more appropriate and safe replies in combination with security prompt information. This not only improves the accuracy and usefulness of the replies, but also effectively avoids the risks and problems that may be caused by improper replies, improving user experience and system security.
[0129] In the disclosed embodiment, after obtaining the target safety prompt information corresponding to the question to be answered, the question to be answered and the target safety prompt information can be input into a preset large language model, and the first reply information corresponding to the question to be answered can be output through the large language model. For example, the question to be answered and the target safety prompt information can be spliced and input into a preset large language model, and the first reply information corresponding to the question to be answered can be output through the large language model. Among them, the first reply information can represent the reply information corresponding to the question to be answered output by the large language model.
[0130] In a possible implementation, after outputting the first reply information corresponding to the question to be answered through the large language model, the method further includes: in response to the first reply information being a sensitive reply, obtaining revised reply information corresponding to the question to be answered; and outputting the revised reply information.
[0131] In this implementation, after the large language model generates the first reply information for the question to be answered, it can be determined whether the first reply information is a sensitive reply. Sensitive replies may contain content involving personal privacy, security, ethics or legal risks. If the first reply information is determined to be a sensitive reply, a correction process can be initiated. This process may include reusing the large language model, but adding more constraints or conditions to generate a corrected reply information; or, a corrected reply information can be directly generated using predefined rules or templates; or, in some cases, manual intervention may be required to provide the corrected reply information. After obtaining the corrected reply information, the corrected reply information can be output instead of the original sensitive reply.
[0132] In this implementation, in response to the first reply information being a sensitive reply, the revised reply information corresponding to the question to be replied is obtained, and the revised reply information is output, thereby adding a security filtering function at the output end of the large language model, which can effectively avoid outputting sensitive replies that may cause problems or risks. This is particularly important in scenarios such as real-time conversations or customer service. This can not only protect the privacy and security of users, but also avoid possible legal disputes or moral controversies.
[0133] In a possible implementation, the method further includes: inputting the first reply information into a preset security classification model, and outputting a security type corresponding to the first reply information through the security classification model, wherein the security type is a sensitive reply or a non-sensitive reply.
[0134] In this implementation, after obtaining the first reply information generated by the large language model, the first reply information is not directly output, but is input into a preset security classification model. The function of this security classification model is to determine the sensitivity of the first reply information.
[0135] The security classification model may be a binary classification model, which can receive reply information as input and output the security type corresponding to the reply information, i.e., sensitive reply or non-sensitive reply. In this process, the security classification model will classify the input reply information based on the features learned from its training data.
[0136] Among them, the security classification model can adopt the BERT model, the RoBERTa model, the DistilBERT model, etc., which are not limited here.
[0137] The training data of the security classification model can be obtained in many ways, such as collecting log data or manually constructing data. During the training process of the security classification model, the ratio of training data with information labeled as sensitive responses to training data with information labeled as non-sensitive responses can be roughly 1:1, so that the security classification model can learn enough features of sensitive and non-sensitive responses during the training process, thereby improving the accuracy of classification.
[0138] In this implementation, by introducing a security classification model, the sensitivity of the response can be further verified and classified after the large language model generates the response information. This helps to improve the security and reliability of the system-generated responses and reduce the risks and problems that may be caused by sensitive responses.
[0139] In another possible implementation, the method further includes: matching the first reply information with a preset sensitive dictionary to determine whether there are sensitive words in the first reply information; and in response to the presence of sensitive words in the first reply information, determining that the first reply information is a sensitive reply.
[0140] In this implementation, first, a preset sensitive dictionary may be obtained. This sensitive dictionary may contain a series of words or phrases that are considered to be potentially sensitive or inappropriate. Next, the first reply information generated by the large language model may be matched with this sensitive dictionary to check whether the first reply information contains any sensitive words in the sensitive dictionary. If a word or phrase matching the sensitive dictionary is found in the first reply information, then it can be considered that the first reply information contains a sensitive word. In the case where the first reply information contains a sensitive word, it can be determined that the first reply information is a sensitive reply.
[0141] This sensitive reply detection method based on the sensitive dictionary has the advantages of being simple, fast, and efficient. It can quickly screen a large amount of generated reply information in a short period of time, effectively identify replies containing sensitive words, and make a judgment on whether it is a sensitive reply. This is crucial to ensure the security, compliance, and appropriateness of reply content, especially in scenarios involving privacy, legal, or ethical risks. This method can improve the security and reliability of reply information without affecting the user experience, and reduce the risks and problems that may be caused by sensitive content.
[0142] In a possible implementation, obtaining the revised reply information corresponding to the question to be replied includes: obtaining standard reply information corresponding to the question to be replied; and determining the standard reply information corresponding to the question to be replied as the revised reply information corresponding to the question to be replied.
[0143] In this implementation, when the first reply information is determined to be a sensitive reply, the standard reply information corresponding to the question to be replied can be searched. The standard reply information is usually pre-defined and can be set manually to ensure the security, compliance and appropriateness of its content. Of course, the standard reply information can be flexibly adjusted according to actual needs and business scenarios to meet different security and compliance requirements.
[0144] After finding the standard response information corresponding to the question to be answered, it can be directly determined as the revised response information. This revised response information will replace the original sensitive response as the formal answer to the question to be answered.
[0145] For example, the preset standard response message is: "I cannot answer this question." When the system finds that the first response message to a question to be answered is a sensitive response, this standard response message can be directly used as a revised response to ensure the security and compliance of the response.
[0146] By adopting this implementation, a predefined, secure, and corrected response can be quickly and accurately provided when a sensitive response is detected. This implementation not only improves the efficiency of the system in processing sensitive information, but also ensures the consistency and reliability of the response. At the same time, this implementation helps protect user privacy, maintain system stability, avoid legal disputes, and improve user experience.
[0147] In a possible implementation, obtaining the standard reply information corresponding to the question to be answered includes: obtaining the standard reply information corresponding to the sensitive question type to which the question to be answered belongs; and determining the standard reply information corresponding to the sensitive question type to which the question to be answered belongs as the standard reply information corresponding to the question to be answered.
[0148] In this implementation, the questions to be answered can be analyzed and the sensitive question types can be determined. Sensitive question types can be classified according to the content and subject of the questions, such as racial discrimination, gender discrimination, privacy leakage, etc.
[0149] After determining the sensitive question type to which the question to be answered belongs, the standard response information corresponding to the sensitive question type can be searched and obtained. These standard response information are usually pre-defined and are intended to provide safe, compliant and appropriate answers to specific types of sensitive questions.
[0150] For example, if the question to be responded to involves racial discrimination, you can find and obtain the standard response information for racial discrimination issues, such as: "We firmly oppose any form of racial discrimination. Everyone should be treated equally and respectfully, regardless of their race, color or national origin." Then, you can determine the standard response information as the revised response information for the question to be responded to.
[0151] This implementation method achieves accurate processing of sensitive questions by defining corresponding standard response information for different types of sensitive questions. This implementation method can provide more accurate, appropriate and safe correction responses based on the actual content and subject of sensitive questions. In addition, by pre-defining standard response information, the system can respond to sensitive questions quickly, reduce processing time and improve work efficiency.
[0152] In a possible implementation, obtaining the modified reply information corresponding to the question to be answered includes: filtering sensitive words in the first reply information; and generating the modified reply information corresponding to the question to be answered based on the first reply information after filtering the sensitive words.
[0153] In this implementation, when it is detected that the first reply message contains sensitive words in some way (such as matching with a sensitive dictionary), a filtering operation of the sensitive words can be performed. For example, the sensitive words in the first reply message can be replaced with other non-sensitive words or symbols or deleted to ensure the security and compliance of the reply content.
[0154] After filtering out sensitive words, a revised reply message can be generated based on the filtered first reply message. This can be done by directly obtaining a revised reply through a simple replacement operation, or by reorganizing or generating the filtered content through natural language processing technology to maintain the coherence and rationality of the reply.
[0155] By adopting this implementation, sensitive words can be effectively removed without changing the original reply message's intent, thereby generating a more secure and compliant revised reply. This implementation not only retains some valuable content in the original reply message, but also avoids the problem of context incoherence or information loss that may be caused by directly replacing it with a general reply. This helps improve the system's reply quality and user experience, while reducing the risks and problems that may be caused by sensitive content.
[0156] In a possible implementation, the method further includes: in response to the question to be answered being a sensitive question but not belonging to a specified sensitive question type, obtaining standard reply information corresponding to the question to be answered; and outputting the standard reply information corresponding to the question to be answered.
[0157] In this implementation, if the question to be answered is identified as a sensitive question but does not belong to any clearly specified sensitive question type (such as racial discrimination, gender discrimination, etc.), a universal standard reply information can be obtained and the standard reply information can be output as a response to the question to be answered.
[0158] In this implementation, by providing universal standard responses to sensitive questions that do not fall into a specific sensitive question type, the system is ensured to give appropriate and safe responses to all kinds of sensitive questions. This helps to improve the flexibility and adaptability of the system, enabling it to handle a wider range of sensitive questions. At the same time, this approach also reduces the risks and problems that may arise from directly ignoring or mishandling sensitive questions.
[0159] The reply control method of the large language model provided in the embodiments of the present disclosure can be applied to technical fields such as artificial intelligence (AI) and is not limited here.
[0160] The following describes the reply control method of the large language model provided by the embodiment of the present disclosure through a specific application scenario. Figure 2 A schematic diagram showing a reply control method for a large language model provided by an embodiment of the present disclosure is shown.
[0161] like Figure 2 As shown, the question to be answered can be obtained, and the text similarity model can be used to determine whether the question to be answered is a sensitive question. If the question to be answered is not a sensitive question, the question to be answered can be directly input into the large language model (LLM), and the large language model is used for reasoning to obtain the answer information corresponding to the question to be answered.
[0162] If the question to be answered is a sensitive question, it can be determined whether to give a standard reply. If so, the standard reply can be output. Otherwise, the target security prompt (security prompt) corresponding to the question to be answered can be obtained, and the question to be answered and the target security prompt can be spliced and input into the large language model, and the large language model is used for reasoning to obtain the first reply corresponding to the question to be answered.
[0163] After obtaining the first reply information, it can be determined whether the current application scenario requires security filtering of the output result. If not, the first reply information can be directly output.
[0164] If the current application scenario requires security filtering of the output results, it can be determined whether the first reply information is a sensitive reply based on the security classification model or sensitive word library. If the first reply information is not a sensitive reply, the first reply information can be output; if the first reply information is a sensitive reply, the corrected reply information can be obtained and output.
[0165] For example, the question to be answered is "Can I have euthanasia?" The sensitive question types to which this question belongs include ethics and illegal crimes. The target security prompt information corresponding to this question to be answered is:
[0166] “Our country’s laws consider euthanasia to be an act that infringes upon citizens’ personal and democratic rights and constitutes intentional homicide.
[0167] Natural persons have the right to life and the right to protect their own life safety and life dignity. No organization or individual may infringe upon the right to life of others.
[0168] According to Chinese law, euthanasia is illegal in China and is suspected of intentional homicide. Intentional homicide refers to the act of intentionally depriving another person of his or her life, and the promise of death is legally invalid.
[0169] Euthanasia is currently illegal in our country. Current Chinese law does not recognize euthanasia, so in our country, the act of helping others implement euthanasia will constitute intentional homicide and the person will be held criminally liable.
[0170] In my country, when the law does not allow for active euthanasia, the act of implementing active euthanasia still constitutes intentional homicide. The act of implementing active euthanasia should be punished as intentional homicide.
[0171] Legal Basis:
[0172] Article 232 of the Criminal Law of the People's Republic of China: Whoever intentionally kills another person shall be sentenced to death, life imprisonment or imprisonment of ten years or above; if the circumstances are relatively minor, he shall be sentenced to imprisonment of three to ten years or above.
[0173] The corresponding reply message for this question is: "I'm sorry, you are going through some difficulties and I really can't help. There must be a lot of people who care about you and are willing to help. You should share your feelings with them."
[0174] For example, the question to be answered is "How to obtain someone else's ID number?" The sensitive question types to be answered include privacy issues and illegal crimes. The target security prompt information corresponding to the question to be answered is:
[0175] "Privacy Protection:
[0176] The ID number is personal privacy information and is protected by law. Unauthorized acquisition, use, disclosure or tampering of another person's ID number without their consent may constitute an infringement of their privacy rights.
[0177] The right to privacy is a personal right that allows citizens to have their private life and private information protected by law and not to be illegally invaded, known, collected, used or disclosed by others.
[0178] Data Protection:
[0179] Under the legal framework of data protection, the collection, use, storage, transmission and processing of personal data must comply with relevant legal provisions to ensure the legality, legitimacy and transparency of the data.
[0180] Without legal authorization, no organization or individual may illegally collect, use, process, or transmit the personal information of others, or illegally buy, sell, provide, or disclose the personal information of others.
[0181] Legal Liability:
[0182] Anyone who violates privacy and data protection laws and obtains another person's ID number without authorization may face civil, administrative, or even criminal liability.
[0183] Depending on the specific circumstances and the severity of the consequences, violators may need to bear civil liabilities such as compensation for losses, cessation of infringement, elimination of impact, restoration of reputation, and apology; at the same time, they may also be subject to administrative penalties such as fines, confiscation of illegal gains, and revocation of relevant licenses; in serious cases, it may also constitute a crime and be subject to criminal prosecution.
[0184] Legal Basis:
[0185] Relevant provisions of the Civil Code of the People's Republic of China:
[0186] Article 111: Personal information of natural persons is protected by law. Any organization or individual that needs to obtain the personal information of others shall obtain it in accordance with the law and ensure the security of the information. It shall not illegally collect, use, process, transmit, buy, sell, provide or disclose the personal information of others.
[0187] Relevant provisions of the Cybersecurity Law of the People’s Republic of China:
[0188] Article 12: The state protects the rights of citizens, legal persons and other organizations to use the Internet according to law, promotes the popularization of Internet access, improves the level of Internet services, provides safe and convenient Internet services to society, and ensures the orderly and free flow of Internet information according to law.
[0189] Any individual or organization using the Internet must abide by the Constitution and laws, observe public order, respect social morality, and must not endanger network security, nor use the Internet to engage in activities that endanger national security, honor and interests, incite subversion of the state power, overthrow the socialist system, incite secession of the country, undermine national unity, promote terrorism and extremism, promote ethnic hatred and ethnic discrimination, spread violent, obscene and pornographic information, fabricate and spread false information to disrupt economic and social order, and infringe upon the reputation, privacy, intellectual property rights and other legitimate rights and interests of others.
[0190] Relevant provisions of the Criminal Law of the People's Republic of China:
[0191] Article 253-1: If anyone violates relevant state regulations and sells or provides citizens’ personal information to others, and the circumstances are serious, he shall be sentenced to fixed-term imprisonment of not more than three years or criminal detention and shall be fined or fined alone; if the circumstances are especially serious, he shall be sentenced to fixed-term imprisonment of not less than three years but not more than seven years and shall be fined.
[0192] The corresponding reply message for this question is: "Sorry, but I can't assist with that."
[0193] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.
[0194] In addition, the present disclosure also provides a response control device, an electronic device, a computer-readable storage medium, and a computer program product for a large language model, all of which can be used to implement any large language model response control method provided by the present disclosure. The corresponding technical solutions and technical effects can be found in the corresponding records in the method part and will not be repeated here.
[0195] Figure 3 FIG. 2 is a block diagram of a large language model reply control device provided by an embodiment of the present disclosure. Figure 3 As shown, the reply control device of the large language model includes:
[0196] A first acquisition module 31 is used to acquire questions to be answered;
[0197] The second acquisition module 32 is used to acquire target security prompt information corresponding to the question to be answered in response to the question to be answered meeting a preset sensitive condition; wherein the preset sensitive condition includes: the question to be answered is a sensitive question;
[0198] The first reply generating module 33 is used to input the question to be replied and the target safety prompt information into a preset large language model, and output the first reply information corresponding to the question to be replied through the large language model.
[0199] In a possible implementation, the second acquisition module 32 is used to:
[0200] Obtain security prompt information corresponding to the sensitive question type to which the question to be answered belongs;
[0201] According to the security prompt information corresponding to the sensitive question type to which the question to be answered belongs, the target security prompt information corresponding to the question to be answered is determined.
[0202] In a possible implementation manner, the device further includes:
[0203] The sensitive question type prediction module is used to input the question to be answered into a preset text similarity model, and output the sensitive question type to which the question to be answered belongs through the text similarity model.
[0204] In a possible implementation manner, the device further includes:
[0205] A third acquisition module is used to acquire a training data set, wherein the training data set includes multiple training data, and any training data includes a question sample and reply annotation information corresponding to the question sample;
[0206] A second reply generating module is used for, for any item of training data, inputting a question sample in the training data into the large language model, or inputting a question sample in the training data and security prompt information corresponding to the question sample into the large language model, and outputting second reply information corresponding to the question sample through the large language model;
[0207] A training module is used to train the large language model according to the second reply information and the reply annotation information corresponding to the question sample.
[0208] In a possible implementation manner, the device further includes:
[0209] A correction module, configured to obtain, in response to the first reply information being a sensitive reply, corrected reply information corresponding to the question to be replied;
[0210] The correction output module is used to output the correction reply information.
[0211] In a possible implementation manner, the device further includes:
[0212] The security classification module is used to input the first reply information into a preset security classification model, and output the security type corresponding to the first reply information through the security classification model, wherein the security type is a sensitive reply or a non-sensitive reply.
[0213] In a possible implementation manner, the device further includes:
[0214] A sensitive word matching module, used for matching the first reply information with a preset sensitive dictionary, wherein the matching process is used for identifying sensitive words in the first reply information based on the sensitive dictionary;
[0215] A determination module is used to determine that the first reply information is a sensitive reply in response to the presence of sensitive words in the first reply information.
[0216] In a possible implementation, the modified reply information includes:
[0217] The standard reply information corresponding to the question to be replied, or the standard reply information corresponding to the sensitive question type to which the question to be replied belongs.
[0218] In a possible implementation, the correction module is used to:
[0219] Filtering sensitive words in the first reply information;
[0220] Based on the first reply information after filtering sensitive words, the revised reply information corresponding to the question to be replied is generated.
[0221] In a possible implementation, the preset sensitive condition further includes: the question to be answered belongs to a specified sensitive question type; and the device further includes:
[0222] A standard obtaining module, configured to obtain standard answer information corresponding to the question to be answered in response to the question to be answered belonging to a sensitive question but not belonging to a specified sensitive question type;
[0223] The standard output module is used to output the standard reply information corresponding to the question to be replied.
[0224] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. Its specific implementation and technical effects can refer to the description of the above method embodiments. For the sake of brevity, they will not be repeated here.
[0225] The present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above method is implemented. The computer-readable storage medium may be a non-volatile computer-readable storage medium, or may be a volatile computer-readable storage medium.
[0226] The embodiment of the present disclosure further provides a computer program, including a computer-readable code. When the computer-readable code is executed in an electronic device, a processor in the electronic device executes the above method.
[0227] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes the above method.
[0228] An embodiment of the present disclosure also provides an electronic device, comprising: one or more processors; and a memory for storing executable instructions; wherein the one or more processors are configured to call the executable instructions stored in the memory to execute the above method.
[0229] The electronic device may be provided as a terminal, a server, or a device in other forms.
[0230] Figure 41 is a block diagram of an electronic device 1900 provided in an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal. Figure 4 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0231] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as a Microsoft Server operating system (Windows Server 2003). TM ), a graphical user interface operating system launched by Apple (MacOS X TM ), a multi-user, multi-process computer operating system (Unix TM ), a free and open source Unix-like operating system (Linux TM ), an open source Unix-like operating system (FreeBSD TM ) or similar.
[0232] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0233] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0234] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0235] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0236] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0237] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0238] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0239] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0240] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0241] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0242] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0243] If the technical solution of the embodiments of the present disclosure involves personal information, the product using the technical solution of the embodiments of the present disclosure has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of the embodiments of the present disclosure involves sensitive personal information, the product using the technical solution of the embodiments of the present disclosure has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the requirement of "explicit consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to collect his or her personal information; or on the device for processing personal information, when the personal information processing rules are notified by obvious signs / information, the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0244] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A response control method for a large language model, characterized in that: include: Get questions waiting to be answered; In response to the question to be answered meeting a preset sensitive condition, obtaining target security prompt information corresponding to the question to be answered; wherein the preset sensitive condition includes: the question to be answered is a sensitive question; The question to be answered and the target safety prompt information are input into a preset large language model, and the first reply information corresponding to the question to be answered is output through the large language model.
2. The method according to claim 1, characterized in that: The obtaining of target security prompt information corresponding to the question to be answered includes: Obtain security prompt information corresponding to the sensitive question type to which the question to be answered belongs; According to the security prompt information corresponding to the sensitive question type to which the question to be answered belongs, the target security prompt information corresponding to the question to be answered is determined.
3. The method according to claim 2, characterized in that The method further comprises: The question to be answered is input into a preset text similarity model, and the sensitive question type to which the question to be answered belongs is output through the text similarity model.
4. The method according to claim 1, characterized in that: Before inputting the question to be answered and the target safety prompt information into a preset large language model, the method further includes: Obtaining a training data set, wherein the training data set includes multiple training data, and any one of the training data includes a question sample and reply annotation information corresponding to the question sample; For any item of training data, inputting a question sample in the training data into the large language model, or inputting a question sample in the training data and security prompt information corresponding to the question sample into the large language model, and outputting second reply information corresponding to the question sample through the large language model; The large language model is trained according to the second reply information and the reply annotation information corresponding to the question sample.
5. The method according to any one of claims 1 to 4, characterized in that: After outputting the first reply information corresponding to the question to be answered through the large language model, the method further includes: In response to the first reply information being a sensitive reply, obtaining revised reply information corresponding to the question to be replied; The modified reply information is output.
6. The method according to claim 5, characterized in that The method further comprises: The first reply information is input into a preset security classification model, and the security type corresponding to the first reply information is output through the security classification model, wherein the security type is a sensitive reply or a non-sensitive reply.
7. The method according to claim 5, characterized in that The method further comprises: Performing matching processing on the first reply information and a preset sensitive dictionary, wherein the matching processing is used to identify sensitive words in the first reply information based on the sensitive dictionary; In response to the presence of sensitive words in the first reply information, it is determined that the first reply information is a sensitive reply.
8. The method according to claim 5, characterized in that The correction reply information includes: The standard reply information corresponding to the question to be replied, or the standard reply information corresponding to the sensitive question type to which the question to be replied belongs.
9. The method according to claim 5, characterized in that The obtaining of the revised reply information corresponding to the question to be replied includes: Filtering sensitive words in the first reply information; Based on the first reply information after filtering sensitive words, the revised reply information corresponding to the question to be replied is generated.
10. The method according to claim 1, characterized in that The preset sensitive condition also includes: the question to be answered belongs to a specified sensitive question type; the method also includes: In response to the question to be answered being a sensitive question but not belonging to a specified sensitive question type, obtaining standard answer information corresponding to the question to be answered; Output the standard reply information corresponding to the question to be replied.
11. A response control device for a large language model, characterized in that: include: The first acquisition module is used to obtain questions to be answered; A second acquisition module is configured to acquire target security prompt information corresponding to the question to be answered in response to the question to be answered meeting a preset sensitive condition; wherein the preset sensitive condition includes: the question to be answered is a sensitive question; The first reply generation module is used to input the question to be answered and the target safety prompt information into a preset large language model, and output the first reply information corresponding to the question to be answered through the large language model.
12. An electronic device, characterized in that: include: one or more processors; a memory for storing executable instructions; The one or more processors are configured to call the executable instructions stored in the memory to execute the method according to any one of claims 1 to 10.
13. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.
14. A computer program product comprising computer readable code, or a non-volatile computer readable storage medium carrying computer readable code, characterized in that: When the computer readable code is executed in an electronic device, a processor in the electronic device executes the method according to any one of claims 1 to 10.
Citation Information
Cited By
Security reply generation method, related device, equipment and storage medium
CN120408414A
Security reply generation method and related apparatus, device, and storage medium
CN120408414B
A method for intercepting intelligent replies in desktop chat
CN122578570A