Legal case question reply method and device and electronic equipment

By using a pre-trained legal case response model, leveraging a large language model and P-tuning v2 fine-tuning technology, we solved the problem of inefficiency in the enterprise case system and achieved accurate responses to legal case questions.

CN120804236APending Publication Date: 2025-10-17PETROCHINA CO LTD

Patent Information

Application Number
CN202410423573.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-09
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

The enterprise case system was inefficient in reading legal case documents and unable to accurately answer relevant questions.

Method used

A pre-trained legal case response model is adopted, a large language model is used as the initial training model, and the parameters are fine-tuned through the P-tuning v2 method to generate legal case response information.

Benefits of technology

Improves the accuracy of answers to legal case questions and the efficiency of obtaining results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804236A_ABST
    Figure CN120804236A_ABST
Patent Text Reader

Abstract

The invention discloses a legal case question reply method and device and electronic equipment. The method comprises the following steps: acquiring legal case questioning information of a user; inputting the legal case question information into a pre-trained legal case reply model to obtain legal case reply information corresponding to the legal case question information; wherein the legal case reply model takes a large language model as an initial training model, and parameters of the initial training model are finely adjusted to obtain the legal case reply model. According to the technical scheme, the legal case question information of the user is obtained and input into the pre-trained legal case reply model to obtain the legal case reply information corresponding to the legal case question information, so that the legal case reply information corresponding to the legal case question information is obtained when the legal case question information is input. Accurate legal case answer information can be obtained, and the efficiency of obtaining the result is high.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to a legal case question reply method and device and electronic equipment. BACKGROUND

[0002] In the development and use process of the enterprise case system, the system needs to be able to read case documents and automatically identify document content, and then accurately reply to employee questions.

[0003] The current ChatGPT has shown strong language reply capability, and through knowledge training on the open source pre-training large model, similar ChatGpt similar effects can be achieved in some vertical fields, so it is possible to achieve accurate reply to legal case questions by deploying fewer models. SUMMARY

[0004] The present application provides a legal case question reply method, device and electronic equipment to solve the problem of low efficiency of reading legal cases by enterprises and the inability to directly obtain relevant answers to legal case questions.

[0005] According to an aspect of the present application, a legal case question reply method is provided, which comprises:

[0006] Obtaining legal case question information of a user;

[0007] Inputting the legal case question information into a pre-trained legal case reply model to obtain legal case answer information corresponding to the legal case question information;

[0008] The legal case reply model uses a large language model as an initial training model, and is obtained by fine-tuning the parameters of the initial training model.

[0009] According to another aspect of the present application, a legal case question reply device is provided, which comprises:

[0010] A question information acquisition module for acquiring legal case question information of a user;

[0011] An answer information generation module for inputting the legal case question information into a pre-trained legal case reply model to obtain legal case answer information corresponding to the legal case question information;

[0012] The legal case reply model uses a large language model as an initial training model, and is obtained by fine-tuning the parameters of the initial training model.

[0013] According to another aspect of the present application, an electronic device is provided, which comprises:

[0014] at least one processor; and

[0015] a memory in communication with the at least one processor; wherein

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the method for replying to a legal case question according to any one of the embodiments of the present application.

[0017] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to perform the method for replying to a legal case question according to any one of the embodiments of the present application when the processor executes the computer instructions.

[0018] The technical solution of the embodiments of the present application obtains the legal case question information of a user, inputs the legal case question information into a pre-trained legal case reply model, and obtains the legal case answer information corresponding to the legal case question information, so that the legal case answer information can be obtained accurately and efficiently when the legal case question information is input.

[0019] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0021] Figure 1 is a flow chart of a method for replying to a legal case question according to an embodiment of the present application;

[0022] Figure 2 is a structural schematic diagram of a legal case question reply device according to an embodiment of the present application;

[0023] Figure 3 is a structural schematic diagram of an electronic device implementing the method for replying to a legal case question according to an embodiment of the present application. DETAILED DESCRIPTION

[0024] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative effort should fall into the protection scope of the present application.

[0025] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device including a series of steps or units does not necessarily have to include only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product, or device.

[0026] Embodiment one

[0027] Figure 1 A flowchart of a legal case question reply method is provided for the first embodiment of the present application. The present embodiment can be applicable to a case where a system is required to be able to automatically read documents of legal cases related to law and automatically identify the content of the documents, thereby realizing an intelligent question and answer function. The method can be executed by a legal case question reply device, which can be realized in the form of hardware and / or software, and can be configured in an electronic device with data processing capability. As shown in Figure 1 The method comprises:

[0028] S110, obtaining legal case question information of a user.

[0029] The legal case question information can be question information related to a legal case raised by a user.

[0030] When a user has a legal case question demand, corresponding legal case question information can be generated according to the legal case question demand of the user. The legal case question demand can be the demand of a user for a question related to a legal case.

[0031] S120, inputting the legal case question information into a pre-trained legal case reply model to obtain legal case answer information corresponding to the legal case question information.

[0032] The legal case reply model takes a large language model as an initial training model, and fine-tunes parameters of the initial training model.

[0033] The legal case reply model can be a model trained by taking a large language model as an initial training model, and used to generate legal case answer information. The legal case answer information can be information corresponding to the answer to the legal case question information.

[0034] After obtaining the legal case question information, the legal case question information can be input into the pre-trained legal case reply model, and the legal case reply model is calculated to generate the legal case answer information corresponding to the legal case question information.

[0035] Optionally, the large language model is a ChatGLM-6B model.

[0036] When selecting a large language model, the ChatGLM-6B model can be selected. The reason is that ChatGLM-6B is an open source and supports Chinese-English bilingual dialogue language model, General Language Model (GLM) architecture, with 6.2 billion parameters. Combined with model quantization technology, users can deploy it locally on consumer-grade graphics cards (INT4 quantization level requires only 6GB of video memory). ChatGLM-6B uses similar technology to ChatGPT and is optimized for Chinese question answering and dialogue. After about 1T identifier Chinese-English bilingual training, supplemented by supervised knowledge training, feedback self-help, human feedback reinforcement learning and other technologies, the 6.2 billion parameter ChatGLM-6B can generate answers that are quite in line with human preferences.

[0037] In an optional solution, the training process of the legal case reply model can include steps A1-A2:

[0038] Step A1, obtaining historical legal cases, and generating historical training corpus in question and answer format according to the historical legal cases.

[0039] Step A2, inputting the historical training corpus into the initial training model for training, and adjusting the parameters of the initial training model through P-tuning v2 during the training process to obtain the legal case reply model.

[0040] The historical legal cases can be existing legal documents obtained by big data and other methods.

[0041] P-tuning v2 can be an existing method for adjusting the parameters of a large language model.

[0042] In training the legal case reply model, historical legal cases need to be obtained, and historical training corpus in question and answer format is generated according to the format that can be correctly recognized by the large language model.

[0043] The historical training corpus is input into the initial training model, the initial training model is trained, and the parameters in the initial training model are adjusted by using the P-tuning v2 method during the training process, so as to obtain the legal case reply model.

[0044] Optionally, after obtaining the historical legal cases and generating the historical training corpus in question and answer format according to the historical legal cases, the method further comprises:

[0045] According to the historical legal cases, historical test corpus in question and answer format is generated.

[0046] After generating the historical training corpus and training the initial training model according to the historical training corpus, historical test corpus is also needed to be generated for testing the accuracy of the calculation results of the legal case reply model, so historical test corpus in question and answer format is generated according to the historical legal cases.

[0047] For generating the historical test corpus and the historical training corpus, after obtaining the historical legal cases, the historical legal cases can be divided according to a certain proportion for generation.

[0048] In an optional solution, after obtaining the legal case reply model, the method further comprises steps B1-B2:

[0049] Step B1, test the legal case reply model according to the historical test corpus to obtain the model result accuracy.

[0050] Step B2, if the model result accuracy is less than the preset threshold, re-generate the historical training corpus, and train the legal case reply model according to the re-generated historical training corpus until the model result accuracy is greater than the preset threshold.

[0051] After generating the historical test corpus, the historical test corpus is input into the trained legal case reply model to determine the accuracy of the calculation results of the legal case reply model, so as to obtain the model result accuracy.

[0052] When the model result accuracy is less than the preset threshold, it indicates that the accuracy of the calculation results of the legal case reply model is low, and it is difficult to provide legal case answer information corresponding to the legal case question information. At this time, the historical legal cases are re-obtained, the historical training corpus is re-generated, and the legal case reply model is re-trained according to the re-generated historical training corpus until the model result accuracy is greater than or equal to the preset threshold.

[0053] Optionally, after obtaining the historical legal cases, the method further comprises:

[0054] data cleaning and normalization processing are performed on the historical legal cases to obtain cleaned historical legal cases.

[0055] After obtaining the historical legal cases, there is often some data missing and obvious abnormalities in the historical legal cases. To this end, the historical legal cases need to be cleaned, the missing data and obviously abnormal data in the historical legal cases are cleaned, and normalization processing is performed to obtain cleaned historical legal cases that can be correctly processed by the legal case reply model.

[0056] Optionally, the historical training corpus in question and answer format is generated according to the historical legal cases, comprising:

[0057] The historical training corpus in question and answer format is generated according to the cleaned historical legal cases.

[0058] Among them, the fine-tuning method of P-tuning v2 is explained.

[0059] Fine-tuning of large language models requires a lot of resources and time, and there is an urgent need for more efficient fine-tuning methods. To understand the P-tuning v2 fine-tuning method, first need to understand the prefix-tuning fine-tuning method and P-tuning v1 fine-tuning method.

[0060] The prefix-tuning fine-tuning method adds a prefix, i.e. a continuous specific task vector, to the model, and only optimizes this small segment of parameters during fine-tuning. For conditional generation tasks, the input is a text x and the output is a sequence y.

[0061] z = [x; y] is the concatenation of x and y, Xidx and Yidx represent the indices of the sequence, hi represents the activation value at each time i, hi = [hi(1);...; hi(n)] represents the concatenation of all layer output vectors at the current time, hi(j) is the output of the jth layer Transformer at time i, so the autoregressive language model calculates the output hi at each time:

[0062] $hi = LM phi (zi, h<i)$

[0063] The last layer of hi is used to calculate the distribution of the next word:

[0064] $p phi (zi+1 | h≤i) = softmax(W phi hi(n))$

[0065] where φ is the parameter of the language model. After adding prefix in front of the autoregressive language model, z = [PREFIX; x; y] or z = [PREFIX; x; PREFIX; y], Pidx represents the index of prefix, and |Pidx| represents the length of prefix. Prefix-tuning stores the prefix parameters by initializing a trainable matrix Pθ (dimension ∣Pidx×dim(hi)∣):

[0066] $hi={Pθ[i,:],ifi∈Pid x LMφ(zi,h<i),otherwise$

[0067] The training object is the same as Fine-tuning, but the parameter φ of the language model is fixed, and only the prefix parameter θ is a trainable parameter. Therefore, hi is a function of the trainable Pθ.

[0068] The P-tuning v1 fine-tuning method is to add Prompt to the fine-tuning process, and only the parameters of the Prompt part are trained, while the parameters of the language model are fixed.

[0069] P-tuning v1 designs an automatic method to generate continuous prompts to improve the fine-tuning effect of the model. The template of P-tuning v1 can be represented by the following formula:

[0070] ${h0,...,hi,e(x),hi+1,...,hm,e(y)}$

[0071] Where h represents the continuous prompt representation of P-tuning v1, e represents a pre-trained language model, x represents the original input of the data, and y represents the label of the data. When facing downstream task fine-tuning, the model is fine-tuned by optimizing the parameters of h:

[0072] $h^0:m={arghminL(M(x,y))$

[0073] The P-tuning v1 fine-tuning method lacks universality. Experiments show that when the model size exceeds 100 billion parameters, the P-tuning v1 can be comparable to the full parameter fine-tuning method, but for those smaller models, the P-tuning v1 method and the full parameter fine-tuning method have a big difference in performance, and the effect is very poor. At the same time, P-tuning v1 lacks cross-task universality, and its effectiveness in the sequence labeling task has not been verified. Sequence labeling requires predicting a series of labels, most of which are meaningless labels, which is a great challenge to the P-tuning v1 fine-tuning method. In addition, when the model layer is very deep, the stability of the model during fine-tuning is difficult to guarantee. The deeper the model layer, the more difficult it is to predict the impact of the prompt input in the first layer on the following.

[0074] The P-tuning v2 fine-tuning method is an improved version of the P-tuning v1 fine-tuning method, and also draws on the prefix-tuning fine-tuning method.

[0075] Compared with the P-tuning v1 fine-tuning method, the P-tuning v2 fine-tuning method adopts the prefix-tuning method, and adds a fine-tunable parameter in front of each input layer. In the prefix part, the embedding input of each layer of the transformer needs to be fine-tuned, while the P-tuning v1 only fine-tunes the first layer. At the same time, for the prefix part, the input of each layer of the transformer is not the output of the previous layer, but a randomly initialized embedding as input.

[0076] According to the technical scheme of the embodiment of the application, by obtaining the legal case question information of the user, the legal case question information is input into the pre-trained legal case reply model to obtain the legal case answer information corresponding to the legal case question information, so that the legal case answer information can be obtained more accurately when the legal case question information is input, and the efficiency of obtaining the result is higher.

[0077] Embodiment two

[0078] Figure 2 A structural block diagram of a legal case question reply device is provided for the embodiment of the application. The embodiment can be applied to a situation where the system can automatically read the documents of the legal related cases and automatically identify the document content, thereby realizing the intelligent question and answer function. The legal case question reply device can be realized in the form of hardware and / or software, and the legal case question reply device can be configured in an electronic device with data processing capability. For example Figure 2As shown, the legal case question reply device of the embodiment can include a question information acquisition module 210 and an answer information generation module 220. Among them:

[0079] The question information acquisition module 210 is configured to acquire legal case question information of a user.

[0080] The answer information generation module 220 is configured to input the legal case question information into a pre-trained legal case reply model to obtain legal case answer information corresponding to the legal case question information.

[0081] The legal case reply model uses a large language model as an initial training model, and fine-tunes parameters of the initial training model.

[0082] On the basis of the above embodiment, optionally, the large language model is a ChatGLM-6B model.

[0083] On the basis of the above embodiment, optionally, the device further includes a model training module.

[0084] On the basis of the above embodiment, optionally, the model training module includes:

[0085] The training corpus generation unit is configured to acquire historical legal cases and generate historical training corpora in a question and answer format according to the historical legal cases.

[0086] The model generation unit is configured to input the historical training corpora into the initial training model for training, and adjust parameters in the initial training model through P-tuning v2 during the training process to obtain the legal case reply model.

[0087] On the basis of the above embodiment, optionally, the device further includes:

[0088] The test corpus generation unit is configured to generate historical test corpora in a question and answer format according to the historical legal cases.

[0089] On the basis of the above embodiment, optionally, the device further includes:

[0090] The accuracy rate acquisition unit is configured to test the legal case reply model according to the historical test corpora to obtain a model result accuracy rate.

[0091] The accuracy rate judgment unit is configured to, if the model result accuracy rate is less than a preset threshold, regenerate the historical training corpora, and train the legal case reply model according to the regenerated historical training corpora until the model result accuracy rate is greater than the preset threshold.

[0092] On the basis of the above-mentioned embodiments, optionally, after the training corpus generation unit, the device further comprises:

[0093] The data cleaning unit is configured to clean and normalize the historical legal cases to obtain cleaned historical legal cases.

[0094] On the basis of the above-mentioned embodiments, optionally, the training corpus acquisition unit is specifically configured to:

[0095] The cleaned historical legal cases are used to generate historical training corpora in a question and answer format.

[0096] The legal case question reply device provided in the embodiments of the present application can execute the legal case question reply method provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.

[0097] Embodiment three

[0098] Figure 3 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.

[0099] As shown in Figure 3 The electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which are communicatively connected to the at least one processor 11, wherein the memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0100] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0101] The processor 11 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the legal case question answering method.

[0102] In some embodiments, the legal case question answering method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the legal case question answering method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the legal case question answering method by any other appropriate means, such as by means of firmware.

[0103] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0104] Computer programs for implementing the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions defined in the flow charts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package and partially on a remote machine or entirely on a remote machine or server.

[0105] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0106] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0107] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0108] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0109] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in series, or executed in different orders, as long as the desired results of the technical solutions of the present disclosure can be achieved, and the present disclosure is not limited herein.

[0110] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for answering legal case questions, characterized in that: include: Obtain information about users' legal case questions; Inputting the legal case question information into a pre-trained legal case response model to obtain legal case response information corresponding to the legal case question information; The legal case response model uses a large language model as an initial training model and fine-tunes the parameters of the initial training model.

2. The method according to claim 1, characterized in that The large language model is the ChatGLM-6B model.

3. The method according to claim 1, characterized in that The training process of the legal case response model includes: Obtaining historical legal cases and generating historical training corpus in a question-and-answer format based on the historical legal cases; The historical training corpus is input into the initial training model for training, and during the training process, the parameters in the initial training model are adjusted through P-tuning v2 to obtain the legal case response model.

4. The method according to claim 3, characterized in that After obtaining historical legal cases and generating historical training corpus in a question-and-answer format based on the historical legal cases, the method further includes: Based on the historical legal cases, historical test corpus in question-and-answer format is generated.

5. The method according to claim 4, characterized in that After obtaining the legal case response model, the method further includes: Testing the legal case response model based on the historical test corpus to obtain the accuracy of the model result; If the accuracy of the model result is less than a preset threshold, the historical training corpus is regenerated, and the legal case response model is trained based on the regenerated historical training corpus until the accuracy of the model result is greater than the preset threshold.

6. The method according to claim 3, characterized in that After obtaining historical legal cases, the method further includes: The historical legal cases are cleaned and normalized to obtain cleaned historical legal cases.

7. The method according to claim 6, characterized in that Generate historical training corpus in question-answer format based on the historical legal cases, including: The historical training corpus in question-answer format is generated based on the cleaned historical legal cases.

8. A device for answering questions in legal cases, characterized in that: include: Question information acquisition module, used to obtain legal case question information from users; an answer information generation module, configured to input the legal case question information into a pre-trained legal case response model to obtain legal case answer information corresponding to the legal case question information; The legal case response model uses a large language model as an initial training model and fine-tunes the parameters of the initial training model.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the method for answering legal case questions according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for answering legal case questions according to any one of claims 1 to 7 when executed.

Citation Information

Patent Citations

  • Automatic answering method and device for legal consultation, storage medium and electronic equipment

    CN116795962A

  • Large language model training method and device, equipment and medium

    CN116821684A

  • Legal assistance method and system based on large language model

    CN117743590A

Cited By

  • Information reasoning method and device, electronic equipment and storage medium

    CN121562827A