Legitimacy dialogue answer generation method and device, electronic equipment and storage medium
By conducting supervised fine-tuning training on large language models, using training data sets of illegal problems and dialogue answers, the dialogue model's identification and suggestions problems when facing complex illegal problems are solved, and effective identification of illegal problems and legal advice provision is achieved. , improves legal security.
Patent Information
- Application Number
- CN202411386336.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-09-30
AI Technical Summary
When facing complex and concealed illegal problems, existing dialogue models are difficult to effectively identify illegal intentions and cannot provide effective warnings or legal suggestions, which increases legal security risks.
By obtaining the training data set, including illegal questions and corresponding dialogue answers, supervised fine-tuning training of large language models based on these data, generate dialogue answers that can identify illegal questions and provide warnings and legal suggestions.
It has achieved effective identification of illegal issues in complex illegal scenarios, and provided users with clear warnings and legal suggestions, improving legal security and legal alignment.
Smart Images

Figure CN119397348A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of large language models, and in particular to a method, device, electronic device and storage medium for generating legitimate dialogue answers. Background Art
[0002] With the rapid development of generative artificial intelligence, dialogue models based on natural language processing have been widely used in various fields.
[0003] However, when faced with complex and hidden illegal issues, dialogue models often fail to effectively identify illegal intentions, and are unable to effectively warn users or provide legal assistance, increasing potential legal security risks.
[0004] Therefore, finding a method for generating legal dialogue answers that can effectively identify illegal issues and provide effective warnings and legal suggestions for illegal issues has become an urgent problem to be solved. Summary of the invention
[0005] The present invention provides a method, device, electronic device and storage medium for generating legal dialogue answers, which realize dialogue answers that can effectively identify illegal issues and provide effective warnings and legal suggestions for illegal issues.
[0006] The present invention provides a method for generating legal dialogue answers, the method comprising: obtaining a question to be answered; inputting the question to be answered into a pre-trained large language model, and obtaining a dialogue answer corresponding to the question to be answered output by the large language model, wherein, in the case that the question to be answered is an illegal question, the dialogue answer includes a recognition result that the question to be answered is an illegal question, and includes a warning and legal suggestions corresponding to the question to be answered.
[0007] According to a method for generating legality dialogue answers provided by the present invention, the large language model is obtained through supervised fine-tuning training in the following manner: obtaining a training data set, wherein the training data set includes multiple groups of training data, the training data is composed of illegal question training data and dialogue answer training data corresponding to the illegal question training data, the illegal question training data and the dialogue answer training data are extracted from legal precedents; training the large language model based on the training data set to obtain a trained large language model.
[0008] According to a method for generating legality dialogue answers provided by the present invention, the training data is obtained in the following manner: obtaining legal precedents, and profiling the illegal subject in the legal precedent based on the legal precedent to obtain a portrait of the illegal subject; based on the portrait of the illegal subject, constructing an illegal dialogue scenario corresponding to the portrait of the illegal subject, and an illegal intention corresponding to the portrait of the illegal subject; constructing illegal problem training data based on the portrait of the illegal subject, the illegal dialogue scenario and the illegal intention; calling the legal judgment of the legal precedent to generate dialogue answer training data corresponding to the illegal problem training data; obtaining the training data based on the illegal problem training data and the dialogue answer training data corresponding to the illegal problem training data.
[0009] According to a method for generating a legality dialogue answer provided by the present invention, before constructing, based on the portrait of the illegal subject, an illegal dialogue scenario corresponding to the portrait of the illegal subject, and an illegal intention corresponding to the portrait of the illegal subject, the method also includes: based on the legal precedent, restoring the illegal event process at different illegal stages; based on the portrait of the illegal subject, constructing an illegal dialogue scenario corresponding to the portrait of the illegal subject, and an illegal intention corresponding to the portrait of the illegal subject, specifically includes: based on the illegal event process and the portrait of the illegal subject, constructing an illegal dialogue scenario corresponding to the portrait of the illegal subject, and an illegal intention corresponding to the portrait of the illegal subject.
[0010] According to a method for generating a legality dialogue answer provided by the present invention, based on the illegal event process and the illegal subject portrait, an illegal dialogue scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait are constructed, which specifically includes: calling a pre-constructed first large language model; inputting the illegal event process and the illegal subject portrait as first text prompt information into the first large language model, and obtaining the illegal dialogue scenario corresponding to the illegal subject portrait and the illegal intention corresponding to the illegal subject portrait output by the first large language model.
[0011] According to a method for generating answers to legality dialogues provided by the present invention, the illegal question training data is constructed based on the illegal subject portrait, the illegal dialogue occurrence scenario and the illegal intention, specifically comprising: calling a pre-constructed second largest language model; inputting the illegal subject portrait, the illegal dialogue occurrence scenario and the illegal intention as second text prompt information into the second largest language model, and obtaining the illegal question training data output by the second largest language model, wherein the illegal question training data comprises explicit illegal question training data and implicit illegal question training data, the explicit illegal question training data comprises illegal keywords; and the implicit illegal question training data does not include illegal keywords.
[0012] The present invention also provides a device for generating legal dialogue answers, the device comprising: an acquisition module for acquiring questions to be answered; a generation module for inputting the questions to be answered into a pre-trained large language model, and obtaining dialogue answers corresponding to the questions to be answered output by the large language model, wherein, in the case that the questions to be answered are illegal questions, the dialogue answers include identification that the questions to be answered are illegal questions, and include warnings and legal suggestions corresponding to the questions to be answered.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating a legitimacy dialogue answer as described in any one of the above is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for generating a legality dialogue answer.
[0015] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned methods for generating legality dialogue answers.
[0016] The method, device, electronic device and storage medium for generating legal dialogue answers provided by the present invention obtain questions to be answered; input the questions to be answered into a pre-trained large language model, and obtain dialogue answers corresponding to the questions to be answered output by the large language model, wherein, in the case where the questions to be answered are illegal questions, the dialogue answers include the recognition result that the questions to be answered are illegal questions, and include warnings and legal suggestions corresponding to the questions to be answered. A dialogue answer that can effectively identify illegal questions and provide effective warnings and legal suggestions for illegal questions is achieved, thereby achieving good legal security and legal alignment. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a flowchart of the method for generating a legality dialogue answer provided by the present invention.
[0019] Figure 2 It is a schematic diagram of the process of constructing training data provided by the present invention.
[0020] Figure 3 The present invention provides a flowchart of constructing an illegal conversation scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait based on the illegal subject portrait.
[0021] Figure 4 The present invention provides a flowchart of constructing an illegal conversation scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait based on the illegal event process and the illegal subject portrait.
[0022] Figure 5 It is a flowchart provided by the present invention for constructing illegal problem training data based on the illegal subject portrait, the illegal dialogue scenario and the illegal intention.
[0023] Figure 6 It is a structural schematic diagram of the legality dialogue answer generation device provided by the present invention.
[0024] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] The method for generating legality dialogue answers provided by the present invention can identify and reject illegal requests in complex illegal scenarios, provide detailed legal explanations and suggestions, and thus achieve legal security and legal alignment.
[0027] Figure 1 It is a flowchart of the method for generating a legality dialogue answer provided by the present invention.
[0028] The following will be combined Figure 1 The process of the method for generating a legal dialogue answer provided by the present invention is described.
[0029] In an exemplary embodiment of the present invention, Figure 1 It can be seen that the method for generating a legality dialogue answer may include step 110 and step 120, and each step will be introduced below.
[0030] In step 110, questions to be answered are obtained.
[0031] In step 120, the question to be answered is input into a pre-trained large language model to obtain a dialogue answer corresponding to the question to be answered output by the large language model, wherein, in the case that the question to be answered is an illegal question, the dialogue answer includes a recognition result that the question to be answered is an illegal question, as well as a warning and legal suggestion corresponding to the question to be answered.
[0032] In one embodiment, the question to be answered may be a question that needs to be identified as to whether it complies with legal rules, wherein the question to be answered may be a legal question or an illegal question. When the question to be answered is a legal question, based on the dialogue answer corresponding to the question to be answered output by the large language model, it can be identified that the question to be answered is a question in a legal scenario; when the question to be answered is an illegal question, based on the dialogue answer corresponding to the question to be answered output by the large language model, it can be identified that the question to be answered is a question in an illegal scenario.
[0033] In another embodiment, the question to be answered can be input into a pre-trained large language model, so that the dialogue answer corresponding to the question to be answered can be obtained from the large language model. In order to achieve the technical effect of identifying and rejecting illegal requests in complex illegal scenarios and providing detailed legal explanations and suggestions, where the question to be answered is an illegal question, the dialogue answer includes the recognition result that the question to be answered is an illegal question, as well as a warning and legal suggestions corresponding to the question to be answered. In other words, when the question to be answered is an illegal question, the illegal request can be identified and rejected, the user can be clearly warned of the potential risks of illegal behavior, and detailed legal explanations and suggestions can be provided.
[0034] The method for generating legal dialogue answers provided by the present invention obtains a question to be answered; inputs the question to be answered into a pre-trained large language model, and obtains a dialogue answer corresponding to the question to be answered output by the large language model, wherein, in the case where the question to be answered is an illegal question, the dialogue answer includes the recognition result that the question to be answered is an illegal question, and includes warnings and legal suggestions corresponding to the question to be answered. A dialogue answer that can effectively identify illegal issues and provide effective warnings and legal suggestions for illegal issues is achieved, thereby achieving good legal security and legal alignment.
[0035] In another exemplary embodiment of the present invention, the large language model can be obtained by supervised fine-tuning training in the following manner: Obtaining a training data set, wherein the training data set includes multiple sets of training data, the training data consisting of illegal question training data and dialogue answer training data corresponding to the illegal question training data, the illegal question training data and the dialogue answer training data are extracted from legal precedents; The large language model is trained based on the training data set to obtain a trained large language model.
[0036] In one embodiment, in order to ensure that the trained large language model has the ability to identify and reject illegal requests in complex illegal scenarios and provide detailed legal explanations and suggestions, a training data set may be obtained, and the large language model may be trained based on the training data set, so that a trained large language model may be obtained.
[0037] In another embodiment, the training data set may include multiple sets of training data. The training data is composed of illegal question training data and dialogue answer training data corresponding to the illegal question training data. It should be noted that the illegal question training data and the dialogue answer training data are extracted from legal precedents. Since the illegal question training data and the dialogue answer training data are extracted from legal precedents, it can be ensured that the constructed training data is referenceable and reasonable, thereby laying the foundation for the trained large language model to have the ability to effectively identify illegal issues and provide effective warnings and legal suggestions for illegal issues.
[0038] Figure 2 It is a schematic diagram of the process of constructing training data provided by the present invention.
[0039] In order to further introduce the method for generating legitimate dialogue answers provided by the present invention, Figure 2 Provide explanation.
[0040] In an exemplary embodiment of the present invention, Figure 2It can be seen that constructing training data may include steps 210 to 250, and each step will be introduced below.
[0041] In step 210, legal precedents are obtained, and based on the legal precedents, the illegal subject in the legal precedents is profiled to obtain a portrait of the illegal subject.
[0042] In one embodiment, the large language model GPT-4 can be used to construct a character profile from the illegal facts. That is, the illegal subject in the legal case can be profiled based on the legal case to obtain a portrait of the illegal subject. In the application process, the portrait of the illegal subject can be profiled according to the illegal facts, wherein the portrait of the illegal subject can include the background, growth experience, personality, language style, and motives of the illegal subject. The illegal facts mentioned above can be identified through legal cases.
[0043] In step 220, based on the illegal subject portrait, an illegal conversation scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait are constructed.
[0044] In another embodiment, based on the portrait of the illegal subject, the output of the large language model GPT-4 can be used to construct the illegal conversation scenario corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject.
[0045] In step 230, based on the illegal subject portrait, the illegal conversation scenario and the illegal intention, illegal problem training data is constructed.
[0046] In another embodiment, illegal problem training data can be constructed based on the illegal subject portrait, illegal dialogue scene and illegal intention. The illegal problem training data can be embodied in the form of synthesized specific dialogue content.
[0047] In step 240, the legal judgment of the legal case is called to generate dialogue answer training data corresponding to the illegal question training data.
[0048] In step 250, the training data is obtained based on the illegal question training data and the dialogue answer training data corresponding to the illegal question training data.
[0049] In another embodiment, the legal judgment of the legal case can also be called to generate the dialogue answer training data corresponding to the illegal question training data. Among them, the pre-trained model can also be used to extract keywords from the legal judgment of the legal case, so that the dialogue answer training data corresponding to the illegal question training data can be generated based on the keywords. Since the dialogue answer training data corresponding to the illegal question training data is extracted using the legal judgment of the legal case, it is possible to obtain safe and legally responsible dialogue answer training data. Among them, in terms of security, the answer needs to include clear rejection and warning. Rejection means that when the user makes an illegal request, the answer must directly refuse to provide help to prevent any possible illegal behavior. Warning means that when the user makes an illegal request, the answer should clearly point out the possible violation of the law and the punishment that should or will be received. This not only protects the safety of the user, but also prevents potential legal risks. The above can also reflect the aspect that the dialogue answer includes the identification result that the question to be answered is an illegal question. In terms of responsibility, the answer needs to include constructive suggestions. The suggestion should point to legal ways of help and provide legal actions that users can take. In addition to legal advice, answers should also include psychological counseling, help users identify their inner needs, and provide possible solutions. This sense of responsibility is not only reflected in compliance with the law, but also in comprehensive care for users, ensuring that they find appropriate solutions within the legal framework and receive psychological support. The above can also be reflected in the dialogue answer including legal advice corresponding to the question to be answered.
[0050] Through the above two considerations, when providing legal consultation and advice, Answer can not only protect the legal security of users, but also demonstrate a sense of responsibility to users and help them find reliable solutions to complex legal issues.
[0051] Figure 3 The present invention provides a flowchart of constructing an illegal conversation scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait based on the illegal subject portrait.
[0052] The following will be combined Figure 3 The process of constructing the illegal conversation scenario corresponding to the illegal subject portrait and the illegal intention corresponding to the illegal subject portrait based on the illegal subject portrait is explained.
[0053] In an exemplary embodiment of the present invention, Figure 3 It can be seen that based on the portrait of the illegal subject, constructing the illegal conversation scenario corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject can include steps 310 and 320, and each step will be introduced below.
[0054] In step 310, based on the legal precedents, the illegal event process at different illegal stages is restored.
[0055] In step 320, based on the illegal event process and the illegal subject portrait, the illegal conversation scenario corresponding to the illegal subject portrait and the illegal intention corresponding to the illegal subject portrait are constructed.
[0056] In one embodiment, a large language model (such as GPT-4) that performs well in text editing and rewriting tasks can be used to restate the illegal incident in three stages. GPT-4 is required to describe the three stages of the illegal incident, namely, "preparation", "implementation", and "completion", and GPT-4 needs to restore the scene of the illegal incident in popular language. That is, based on legal precedents, the process of the illegal incident at different stages of the illegal incident is restored, where different stages of the illegal incident may include the preparation stage, the implementation stage, and the completion stage.
[0057] Furthermore, at each stage, based on the GPT-4 model, according to the offender's personal profile (corresponding to the illegal subject portrait) and the illegal process (corresponding to the illegal event process), the scenario where the conversation may occur (corresponding to the illegal conversation scenario) and the illegal intention of the illegal subject's conversation (corresponding to the illegal intention) can be constructed. Based on this, illegal dialogue problems in complex illegal scenarios can be generated, laying the foundation for identifying and rejecting illegal requests, warning of potential risks of illegal behavior, and providing detailed legal explanations and suggestions.
[0058] Figure 4 The present invention provides a flowchart of constructing an illegal conversation scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait based on the illegal event process and the illegal subject portrait.
[0059] The following will be combined Figure 4 The following describes a process of constructing an illegal conversation scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait based on the illegal event process and the illegal subject portrait.
[0060] In an exemplary embodiment of the present invention, Figure 4 It can be seen that based on the illegal event process and the portrait of the illegal subject, the illegal conversation scenario corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject are constructed, which may include step 410 and step 420, and each step will be introduced below.
[0061] In step 410, a pre-built first language model is called.
[0062] In step 420, the illegal event process and the portrait of the illegal subject are input into the first language model as the first text prompt information, and the first language model outputs the illegal conversation scene corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject.
[0063] In one embodiment, the pre-built first language model, that is, the GPT-4 model, can also be called. Then, the illegal event process and the portrait of the illegal subject are input into the first language model as the first text prompt information, so that the illegal conversation scene corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject output by the first language model can be obtained. In the application process, at each stage, based on the GPT-4 model, according to the personal profile of the offender (corresponding to the portrait of the illegal subject) and the illegal process (corresponding to the illegal event process), the scene where the conversation may occur (corresponding to the illegal conversation scene) and the illegal intention of the illegal subject conversation (corresponding to the illegal intention) can be constructed. Based on this, the purpose of the illegal conversation can be inferred, which lays the foundation for identifying and rejecting illegal requests in complex illegal scenarios, and providing detailed legal interpretations and suggestions.
[0064] Figure 5 It is a flowchart provided by the present invention for constructing illegal problem training data based on the illegal subject portrait, the illegal dialogue scenario and the illegal intention.
[0065] The following will be combined Figure 5 The process of constructing illegal problem training data based on the illegal subject portrait, the illegal conversation scenario and the illegal intention is explained.
[0066] In an exemplary embodiment of the present invention, Figure 5 It can be seen that based on the portrait of the illegal subject, the scene where the illegal conversation occurs, and the illegal intention, constructing illegal problem training data can include steps 510 and 520, and each step will be introduced below.
[0067] In step 510, a pre-built second language model is called.
[0068] In step 520, the portrait of the illegal subject, the scene of the illegal conversation, and the illegal intention are input into the second largest language model as second text prompt information to obtain illegal problem training data output by the second largest language model, wherein the illegal problem training data includes explicit illegal problem training data and implicit illegal problem training data, the explicit illegal problem training data includes illegal keywords; the implicit illegal problem training data does not include illegal keywords.
[0069] In one embodiment, in the stage of synthesizing illegal questions, that is, in the process of obtaining illegal question training data, the GPT-4 model can be used to simulate the offender, and the specific dialogue content (corresponding to the illegal question training data) can be synthesized based on the character profile (corresponding to the portrait of the illegal subject), the illegal scene (corresponding to the scene where the illegal dialogue occurs) and the dialogue intention (corresponding to the illegal intention). Among them, explicit and implicit illegal question forms can be considered respectively. Among them, explicit illegal questions (corresponding to explicit illegal question training data) refer to questions with obvious illegal signals, such as illegal words or illegal behaviors; while implicit illegal questions (corresponding to implicit illegal question training data) do not rely on clear illegal keywords, and there is an intention to participate in or promote illegal actions in the questions.
[0070] Among them, in the implicit violation of the law, two forms of expression can be considered: at the language level, language skills use modifiers, such as hints, metaphors, obscurity, and roundabout methods; at the intention level, concealing intentions, such as avoiding or falsifying specific criminal acts and motives, and using legal appearances to cover up illegal intentions.
[0071] During the application process, a phase, scene, explicit and implicit form and its manifestation will be randomly selected in each illegal incident to synthesize specific dialogue questions.
[0072] In another embodiment, a pre-built second language model can also be called, and the portrait of the illegal subject, the illegal event process, the illegal conversation scene and the illegal intention can be input into the second language model as the second text prompt information, so as to obtain the illegal problem training data output by the second language model.
[0073] Through the aforementioned embodiments, the comprehensiveness of the constructed illegal issues (corresponding illegal issue training data) can be ensured; by simulating illegal behaviors and extracting complex and hidden illegal intentions from legal documents, various explicit and implicit illegal issues are covered, thereby improving the recognition ability of the large language model trained based on the training data set in complex illegal scenarios.
[0074] In addition, the generated dialogue answer training data corresponding to the illegal question training data can not only directly refuse illegal requests, but also explain the potential legal risks in detail, cite relevant laws and regulations, and provide legal advice and psychological counseling.
[0075] According to the foregoing description, the legitimacy dialogue answer generation method provided by the present invention significantly improves the security and legal alignment of the legitimacy dialogue answer generation method adopted by the present invention in illegal scenarios through comprehensive illegal question construction, information-rich security answer synthesis and model alignment training.
[0076] The following is a description of the legitimacy dialogue answer generation device provided by the present invention. The legitimacy dialogue answer generation device described below and the legitimacy dialogue answer generation method described above can be referenced to each other.
[0077] Figure 6 It is a structural schematic diagram of the legality dialogue answer generation device provided by the present invention.
[0078] The following will be combined Figure 6 The legitimacy dialogue answer generation device provided by the present invention is explained.
[0079] In an exemplary embodiment of the present invention, Figure 6 It can be seen that the legality dialogue answer generation device can include an acquisition module 610 and a generation module 620, and each module will be introduced below.
[0080] The acquisition module 610 may be configured to acquire questions to be answered; The generation module 620 can be configured to input the question to be answered into a pre-trained large language model, and obtain a dialogue answer corresponding to the question to be answered output by the large language model, wherein, in the case that the question to be answered is an illegal question, the dialogue answer includes a recognition result that the question to be answered is an illegal question, and includes warnings and legal suggestions corresponding to the question to be answered.
[0081] In an exemplary embodiment of the present invention, the generation module 620 may obtain the large language model through supervised fine-tuning training in the following manner: Obtaining a training data set, wherein the training data set includes multiple sets of training data, the training data consisting of illegal question training data and dialogue answer training data corresponding to the illegal question training data, the illegal question training data and the dialogue answer training data are extracted from legal precedents; The large language model is trained based on the training data set to obtain a trained large language model.
[0082] In an exemplary embodiment of the present invention, the generating module 620 may obtain the training data in the following manner: Obtaining legal precedents, and profiling the illegal subject in the legal precedents based on the legal precedents to obtain a portrait of the illegal subject; Based on the illegal subject portrait, construct an illegal conversation scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait; Based on the illegal subject portrait, the illegal conversation scene and the illegal intention, illegal problem training data is constructed; Invoking the legal judgment of the legal case to generate dialogue answer training data corresponding to the illegal question training data; The training data is obtained based on the illegal question training data and the dialogue answer training data corresponding to the illegal question training data.
[0083] In an exemplary embodiment of the present invention, the generation module 620 can construct the illegal conversation scene corresponding to the illegal subject portrait and the illegal intention corresponding to the illegal subject portrait based on the illegal subject portrait in the following manner: Based on the legal precedents, the illegal incident process at different stages of violation is restored; Based on the illegal event process and the portrait of the illegal subject, the illegal dialogue scenario corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject are constructed.
[0084] In an exemplary embodiment of the present invention, the generation module 620 can construct the illegal dialogue occurrence scene corresponding to the illegal subject portrait and the illegal intention corresponding to the illegal subject portrait based on the illegal event process and the illegal subject portrait in the following manner: Call the pre-built No.1 language model; The illegal event process and the portrait of the illegal subject are input into the first language model as the first text prompt information, and the illegal dialogue scene corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject are obtained as output by the first language model.
[0085] In an exemplary embodiment of the present invention, the generation module 620 can construct the illegal problem training data based on the illegal subject portrait, the illegal conversation scene and the illegal intention in the following manner: Call the pre-built second largest language model; The portrait of the illegal subject, the scene in which the illegal conversation occurs, and the illegal intention are input into the second largest language model as second text prompt information to obtain illegal problem training data output by the second largest language model, wherein the illegal problem training data includes explicit illegal problem training data and implicit illegal problem training data, the explicit illegal problem training data includes illegal keywords; the implicit illegal problem training data does not include illegal keywords.
[0086] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the method for generating a legal dialogue answer, which includes: obtaining a question to be answered; inputting the question to be answered into a pre-trained large language model, and obtaining a dialogue answer corresponding to the question to be answered output by the large language model, wherein, in the case where the question to be answered is an illegal question, the dialogue answer includes the recognition result that the question to be answered is an illegal question, and includes a warning and legal suggestion corresponding to the question to be answered.
[0087] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0088] On the other hand, the present invention also provides a computer program product, which includes a computer program, and the computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the method for generating a legal dialogue answer provided by the above-mentioned methods, and the method includes: obtaining a question to be answered; inputting the question to be answered into a pre-trained large language model, and obtaining a dialogue answer corresponding to the question to be answered output by the large language model, wherein, in the case that the question to be answered is an illegal question, the dialogue answer includes a recognition result that the question to be answered is an illegal question, and includes a warning and legal suggestion corresponding to the question to be answered.
[0089] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the method for generating a legal dialogue answer provided by the above-mentioned methods, the method comprising: obtaining a question to be answered; inputting the question to be answered into a pre-trained large language model, and obtaining a dialogue answer corresponding to the question to be answered output by the large language model, wherein, in the case that the question to be answered is an illegal question, the dialogue answer includes a recognition result that the question to be answered is an illegal question, and includes a warning and legal suggestion corresponding to the question to be answered.
[0090] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0091] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0092] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating a legitimate dialogue answer, characterized in that: The method comprises: Get questions to be answered; The question to be answered is input into a pre-trained large language model, and a dialogue answer corresponding to the question to be answered is obtained from the large language model output, wherein, in the case that the question to be answered is an illegal question, the dialogue answer includes a recognition result that the question to be answered is an illegal question, as well as a warning and legal suggestion corresponding to the question to be answered.
2. The method for generating a legitimate dialogue answer according to claim 1, characterized in that: The large language model is obtained by supervised fine-tuning training in the following manner: Obtaining a training data set, wherein the training data set includes multiple sets of training data, the training data consisting of illegal question training data and dialogue answer training data corresponding to the illegal question training data, the illegal question training data and the dialogue answer training data are extracted from legal precedents; The large language model is trained based on the training data set to obtain a trained large language model.
3. The method for generating a legitimate dialogue answer according to claim 2, characterized in that: The training data is obtained in the following manner: Obtaining legal precedents, and profiling the illegal subject in the legal precedents based on the legal precedents to obtain a portrait of the illegal subject; Based on the illegal subject portrait, construct an illegal conversation scenario corresponding to the illegal subject portrait and an illegal intention corresponding to the illegal subject portrait; Based on the illegal subject portrait, the illegal conversation scene and the illegal intention, illegal problem training data is constructed; Invoking the legal judgment of the legal case to generate dialogue answer training data corresponding to the illegal question training data; The training data is obtained based on the illegal question training data and the dialogue answer training data corresponding to the illegal question training data.
4. The method for generating a legitimate dialogue answer according to claim 3, characterized in that: Before constructing the illegal conversation occurrence scene corresponding to the illegal subject portrait and the illegal intention corresponding to the illegal subject portrait based on the illegal subject portrait, the method further includes: Based on the legal precedents, the illegal incident process at different stages of violation is restored; The illegal conversation scenario corresponding to the illegal subject portrait and the illegal intention corresponding to the illegal subject portrait are constructed based on the illegal subject portrait, and specifically include: Based on the illegal event process and the portrait of the illegal subject, the illegal dialogue scenario corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject are constructed.
5. The method for generating a legitimate dialogue answer according to claim 4, characterized in that: The illegal conversation scene corresponding to the illegal subject portrait and the illegal intention corresponding to the illegal subject portrait are constructed based on the illegal event process and the illegal subject portrait, and specifically include: Call the pre-built No.1 language model; The illegal event process and the portrait of the illegal subject are input into the first language model as the first text prompt information, and the illegal dialogue scene corresponding to the portrait of the illegal subject and the illegal intention corresponding to the portrait of the illegal subject are obtained as output by the first language model.
6. The method for generating a legitimate dialogue answer according to claim 3, characterized in that: The illegal problem training data is constructed based on the illegal subject portrait, the illegal conversation scene and the illegal intention, specifically including: Call the pre-built second largest language model; The portrait of the illegal subject, the scene in which the illegal conversation occurs, and the illegal intention are input into the second largest language model as second text prompt information to obtain illegal problem training data output by the second largest language model, wherein the illegal problem training data includes explicit illegal problem training data and implicit illegal problem training data, the explicit illegal problem training data includes illegal keywords; the implicit illegal problem training data does not include illegal keywords.
7. A device for generating a legitimate dialogue answer, characterized in that: The device comprises: An acquisition module is used to obtain questions to be answered; A generation module is used to input the question to be answered into a pre-trained large language model to obtain a dialogue answer corresponding to the question to be answered output by the large language model, wherein, in the case that the question to be answered is an illegal question, the dialogue answer includes a recognition result that the question to be answered is an illegal question, as well as a warning and legal suggestion corresponding to the question to be answered.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, it implements the method for generating a legality dialogue answer as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a legality dialogue answer as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for generating a legality dialogue answer as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Interpretable law automatic decision prediction method and device
CN111325387A
Staged training method for large legal dialogue model
CN117131173A
Method and system for solving illusion problem of large legal language model
CN117744802A
Customer profiling method based on customer response corpora, and device related thereto
WO2022126963A1