Training method, recognition method and system of legal intention recognition model

By constructing a tree structure to represent legal service categories and training large language models, the problem of poor legal intention recognition in the existing technology is solved, and higher recognition accuracy and efficiency are achieved.

CN119558427APending Publication Date: 2025-03-04ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411612902.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The prior art is susceptible to human subjective factors, knowledge lag and large amount of knowledge when identifying legal intentions, resulting in poor identification results.

Method used

By constructing a tree structure with hierarchical graphical structure, characterizing legal service categories, and training large language models based on tree structure and legal query samples, a model with legal intention recognition ability is obtained.

Benefits of technology

It improves the accuracy and efficiency of identifying legal intentions, reduces the influence of human factors, and enhances the model's ability to understand complex legal issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119558427A_ABST
    Figure CN119558427A_ABST
Patent Text Reader

Abstract

The invention provides a training method, a recognition method and a system for a legal intention recognition model, and the training method comprises the steps: obtaining a legal query sample, building a training data set of a large language model according to the legal query sample and a preset tree structure, according to the training data set, the legal intention recognition ability of the large language model is trained, a legal intention recognition model is obtained, and the legal intention recognition ability refers to the ability of classifying the legal query samples based on a tree structure to obtain corresponding legal service categories. According to the method, the accuracy and reliability of the legal intention recognition capability of the big language model can be improved, so that the legal intention recognition model can accurately and effectively determine the legal consultation intention of the user, and the legal consultation experience of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of artificial intelligence technology, and in particular to a training method, an identification method and a system for a legal intent identification model. Background Art

[0002] With the rapid development and diversification of society, people's legal awareness is increasing, and the demand for legal services is also increasing. In the face of more and more legal consultation issues, it is particularly important to accurately understand and answer people's legal intentions. Legal intentions refer to the specific issues that users are concerned about or the specific matters that need to be resolved when seeking legal help, such as contract disputes, marriage and family affairs, intellectual property protection, etc.

[0003] In the related art, the legal intent corresponding to the legal consultation can be determined manually.

[0004] However, considering the vastness and timeliness of legal knowledge, the above manual method is easily affected by human subjective factors, knowledge lag, knowledge volume, etc., which may lead to poor results in the recognition of legal intent.

[0005] It is worth noting that the contents of the above-mentioned related technologies are merely information known to the inventor personally, which does not mean that the above-mentioned information has entered the public domain before the filing date of this specification, nor does it mean that it can become the prior art of this specification. Summary of the invention

[0006] This specification provides a training method, an identification method and a system for a legal intent identification model to avoid at least one of the above-mentioned technical problems.

[0007] In a first aspect, this specification provides a method for training a legal intent recognition model, comprising:

[0008] Get a sample legal search;

[0009] Constructing a training data set of a large language model according to the legal query samples and a preset tree structure, wherein the tree structure is a hierarchical graphical structure representing legal service categories; and

[0010] The legal intent recognition capability of the large language model is trained according to the training data set to obtain a legal intent recognition model, wherein the legal intent recognition capability refers to the ability to classify the legal query samples based on the tree structure to obtain corresponding legal service categories.

[0011] Second, this specification provides a method for identifying legal intent, including:

[0012] Obtain targeted legal research; and

[0013] The target legal query is predicted based on a pre-trained legal intent recognition model to obtain a target intent path corresponding to the target legal query, wherein the legal intent recognition model is trained based on the training method described in any one of claims 1 to 6, and the target intent path uses a preset format example to represent the legal service category corresponding to the target legal query.

[0014] In a third aspect, this specification provides a training system for a legal intent recognition model, including:

[0015] at least one storage medium storing at least one instruction set for training a legal intent recognition model;

[0016] At least one processor is communicatively connected to the at least one storage medium, wherein when the at least one processor is running, the at least one instruction set is read, and the training method as described in the first aspect is executed according to the instructions of the at least one instruction set.

[0017] Fourthly, this specification provides a legal intent identification system, including:

[0018] at least one storage medium storing at least one set of instructions for identifying legal intent;

[0019] At least one processor is communicatively connected to the at least one storage medium, wherein the at least one processor reads the at least one instruction set when running, and executes the identification method as described in the second aspect according to the instructions of the at least one instruction set.

[0020] In a fifth aspect, the present specification provides a computer-readable non-temporary storage medium, wherein the computer-readable non-temporary storage medium stores at least one instruction set, and the at least one instruction set is executed by at least one processor to implement the method described in the first aspect or the second aspect.

[0021] It can be seen from the above technical solutions that the training method, identification method and system of the legal intent identification model provided in this specification. In the training method, a tree structure of a hierarchical graphical structure is constructed to characterize the legal service category based on the tree structure, and the legal intent identification ability of the large prediction model is trained based on the tree structure and legal query samples, so that the large language model learns to classify the legal query samples based on the tree structure and obtain the corresponding legal service category, thereby obtaining a legal intent identification model with legal identification ability.

[0022] The training method, identification method and other functions of the legal intent recognition model provided in this specification will be partially listed in the following description. The creative aspects of the training method, identification method and system of the legal intent recognition model provided in this specification can be fully explained by practicing or using the methods, devices and combinations described in the following detailed examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0024] Figure 1 A schematic diagram of an application scenario of a training method for a legal intent recognition model provided in an embodiment of this specification;

[0025] Figure 2 A schematic diagram of the structure of a training system for a legal intent recognition model provided in an embodiment of this specification;

[0026] Figure 3 A flowchart of a method for training a legal intent recognition model provided in an embodiment of this specification;

[0027] Figure 4 A schematic diagram of the correspondence between legal queries and legal intent provided for the embodiments of this specification;

[0028] Figure 5 A schematic diagram of a tree structure provided in an embodiment of this specification;

[0029] Figure 6 A schematic diagram of a training data set provided in an embodiment of this specification;

[0030] Figure 7 A flowchart of a method for identifying legal intent provided in an embodiment of this specification;

[0031] Figure 8 A schematic diagram of the principles of the method for identifying legal intent provided in the embodiments of this specification. DETAILED DESCRIPTION

[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Instead, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the appended claims.

[0033] It should be understood that the terms "including" and "having" and any variations thereof in the embodiments of this specification are intended to cover but not exclude inclusion. For example, a product or device comprising a series of components is not necessarily limited to those components explicitly listed, but may include other components not explicitly listed or inherent to these products or devices.

[0034] In the embodiments of this specification, the term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0035] The term "plurality" in the embodiments of the present specification refers to two or more than two, and other quantifiers are similar thereto.

[0036] The terms "first", "second", "third", etc. in this specification are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise indicated. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, for example, they can be implemented in an order other than those given in the diagrams or descriptions of the embodiments of this specification.

[0037] The term "unit / module" as used in this specification refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic or combination of hardware and / or software code that is capable of performing the functions associated with that element.

[0038] To facilitate readers' understanding of this specification, the application scenarios of this specification are now introduced.

[0039] The technical solution provided in this specification is applicable to scenarios where it is necessary to determine the user's legal intent. For example, the technical solution provided in this specification can be applied to the scenario of online legal consulting services. As another example, the technical solution provided in this specification can be applied to the scenario of intelligent customer service system. As another example, the technical solution provided in this specification can be applied to the scenario of legal knowledge base search. As another example, the technical solution provided in this specification can be applied to the scenario of automatic generation of legal documents. Among them, legal intent can be understood as the specific needs, goals or expectations expressed by individuals or organizations when it comes to legal affairs. In the context of legal consultation and legal services, legal intent can be specifically understood as the specific issues that users are concerned about when seeking legal help or the category of legal services required (or called legal service type).

[0040] Take the above scenario of online legal consulting service as an example:

[0041] Hutong can submit legal inquiries (i.e. questions raised by users, also known as user input) through the online platform, such as contract disputes, marriage and family affairs, etc. The system analyzes the content of the received legal inquiries to determine the user's specific legal intent.

[0042] For example, the legal query submitted by the user is "I have been employed for one month, and the company has signed a labor contract but has not given it to me. What should I do?" The system analyzes the content of the legal query to determine that the user's specific legal intent is: the legal query is a question of "legal consultation / labor dispute". In some embodiments, the system can also query relevant laws and regulations based on the specific legal intent, and obtain and output legal advice corresponding to the legal query.

[0043] Take the above legal knowledge base search scenario as an example:

[0044] Users can search for specific legal issues on the legal knowledge base website. In response, the system analyzes the received legal issues to optimize the relevance and accuracy of the search results.

[0045] For example, the keyword entered by the user on the legal knowledge base website is "house rental contract termination". The system analyzes the keyword to determine the user's specific legal intent: the keyword is a question of "legal consultation / contract termination". In some embodiments, the system can also query relevant laws and regulations based on the specific legal intent, and obtain and display legal clauses and cases related to "contract termination".

[0046] Take the above scenario of automatic generation of legal documents as an example:

[0047] Lawyers or other legal workers use automated tools to generate legal documents, such as complaints, contracts, etc. The system can assist in generating documents.

[0048] For example, the user describes the type of document to be generated as "needing a divorce agreement". The system analyzes the description to determine the user's specific legal intent: the description is a question of "legal consultation / marriage and family affairs". In some embodiments, the system can pre-build a legal document template to call the legal document template corresponding to the specific legal intent query, and generate a divorce agreement corresponding to the user's description based on the called legal document template.

[0049] In practical applications, the following two methods can be used to identify legal intent.

[0050] Method 1 is to manually identify the legal intent. For example, in combination with the above-mentioned scenario of online legal consulting services, the recognition system can output the legal queries it obtains. Correspondingly, the staff can analyze the legal queries based on their legal knowledge and obtain the corresponding legal intent.

[0051] However, this method is easily affected by human subjective factors and the amount of personal legal knowledge, and has the problem of low recognition accuracy and efficiency.

[0052] Method 2 is to identify legal intent based on keyword matching. For example, in combination with the above-mentioned online legal consulting service scenario, after the recognition system obtains the legal query, it can obtain the keywords in the legal query and determine the corresponding legal intent based on the keyword matching method of the legal and regulatory database.

[0053] However, the legal system contains a huge and complex legal database. Different regions and even different legal fields have their own specific legal provisions and regulations. When faced with such a huge legal database, keyword matching alone cannot accurately find the corresponding laws and regulations. That is, this method has the disadvantages of low accuracy and efficiency.

[0054] It is worth noting that the contents of the above-mentioned related technologies are merely information known to the inventor personally, which does not mean that the above-mentioned information has entered the public domain before the filing date of this specification, nor does it mean that it can become the prior art of this specification.

[0055] In some embodiments, in order to avoid the technical problems existing in the above two methods, the legal intent can be identified based on a network model.

[0056] For example, in combination with the above-mentioned scenario of online legal consulting services: the training system can obtain legal query samples to train the basic network model according to the legal query samples to obtain a legal intent recognition model. Accordingly, when the recognition system receives a target legal query, it determines the legal intent corresponding to the target legal query based on the legal intent recognition model.

[0057] In some embodiments, the basic network model may be a traditional classification model, that is, a classification model in related technologies. For example, the training system may train the classification model based on legal query samples to obtain a legal intent recognition model that distinguishes the legal service classifications corresponding to different legal queries.

[0058] However, traditional classification models generally have small parameters and insufficient generalization capabilities. When faced with complex legal issues, they lack the ability to understand and have a small context window, which results in low intent recognition accuracy of classification models.

[0059] In other embodiments, the basic network model may be a large language model (LLM). For example, the training system may train the large prediction model based on legal query samples to obtain a legal intent recognition model that distinguishes the legal service categories corresponding to different legal queries.

[0060] Although large language models have powerful language understanding and generation capabilities, they still have some limitations. For example, they may produce answers that are inconsistent with the facts (hallucinations), answer based on outdated information (outdated knowledge), and give unsafe advice in certain specific situations (security issues). In the field of legal consulting, these issues are particularly sensitive because incorrect legal advice can have serious consequences. The model needs to understand and follow effective laws and regulations, and provide advice within the scope of the regulations.

[0061] Therefore, in order to avoid at least one of the above problems, this specification proposes a technical concept that is the result of creative labor: in the training stage: the training system constructs a tree structure of a hierarchical graphical structure to characterize the legal service category based on the tree structure; based on the tree structure and legal query samples, the legal intent recognition capability of the large prediction model is trained so that the large language model learns to classify the legal query samples based on the tree structure and obtain the corresponding legal service category, thereby obtaining a legal intent recognition model with legal recognition capability. Correspondingly, in the application stage: the recognition system predicts the obtained target legal query based on the legal intent recognition model to obtain the legal service category corresponding to the target legal query. In some embodiments, the recognition system can further determine the query result corresponding to the target legal query based on the recognized legal service category.

[0062] Based on the above analysis, it can be seen that the tree structure provides a hierarchical structure for representing different legal intents, such as different legal service categories. Through the hierarchical structure of the tree structure, complex legal queries can be systematically classified, so that the model can learn the relationship and characteristics between different legal service categories, thereby improving the accuracy of legal query classification. Accordingly, the large language model is trained using the constructed training data set to enable it to have the ability to recognize legal intent. During the training process, the large language model will learn how to classify the input legal queries through the hierarchical structure of the tree structure to obtain the corresponding legal service categories. After the training is completed, the legal intent recognition model can automatically identify the legal queries entered by the user and accurately classify them into the corresponding legal service categories, thereby providing users with targeted legal services or suggestions.

[0063] Figure 1 FIG. 1 is a schematic diagram of an application scenario of a training method for a legal intent recognition model according to an embodiment of the present specification (hereinafter referred to as a training method). The training method of the present specification can be applied to: Figure 1 The application scenario 100 shown. Figure 1 As shown, the application scenario 100 may include a target user 101 , a client 102 , a server 103 , and a network 104 .

[0064] The target user 101 may be a user that triggers the training of the legal intent recognition model. For example, the target user 101 may perform a target operation on the client 102 to trigger the training of the legal intent recognition model.

[0065] The client 102 may be an electronic device that provides interactive functions to the target user 101. For example, the client 102 may provide an interactive interface to the target user 101, and the target user 101 may perform interactive operations in the interactive page. In some embodiments, the client 102 executes the training method described in this specification in response to detecting an operation of training the legal intent recognition model triggered by the target user 101. At this time, the client 102 may store data or instructions for executing the training method described in this specification, and may execute or be used to execute the data or instructions. In some embodiments, the client 102 may include a hardware device with data information processing functions and the necessary programs required to drive the hardware device to work, so as to execute the training method described in this specification.

[0066] In some embodiments, the client 102 may include a mobile device, a tablet computer, a laptop computer, a built-in device of a motor vehicle, or the like, or any combination thereof. In some embodiments, the mobile device may include a smart home device, a smart mobile device, a virtual reality device, an augmented reality device, or the like, or any combination thereof. In some embodiments, the smart home device may include a smart TV, a desktop computer, or the like, or any combination thereof. In some embodiments, the smart mobile device may include a smart phone, a personal digital assistant, a gaming device, a navigation device, or the like, or any combination thereof. In some embodiments, the built-in device in a motor vehicle may include an onboard computer, an onboard TV, or the like.

[0067] In some embodiments, the client 102 may be installed with one or more applications (Application, APP). APP can provide the target user 101 with the ability and interface to interact with the outside world through the network 104. APP includes but is not limited to: web browser APP programs, search APP programs, chat APP programs, shopping APP programs, video APP programs, financial management APP programs, instant messaging tools, email clients, social platform software, etc.

[0068] like Figure 1 As shown, the client 102 can be connected to the server 103 for communication. The server 103 can be connected to one client 102 for communication, or can be connected to multiple clients 102 for communication. In some embodiments, the client 102 can interact with the server 103 through the network 104 to receive or send messages, etc. For example, the client 102 can interact with the server 103 through the network 104 to send a target logistics order to the server 103.

[0069] The server 103 may be a server that provides various services. For example, the server 103 may be a cloud server or a local server. The server 103 may be connected to a client 102 for communication and receive data sent by the client 102, or may be connected to multiple clients 102 for communication and receive data sent by each client 102.

[0070] In some embodiments, the training method described in this specification can be executed on the server 103. In this case, the server 103 can store data or instructions for executing the training method described in this specification, and can execute or be used to execute the data or instructions. The server 103 can include a hardware device with data information processing functions and the necessary programs required to drive the hardware device to work.

[0071] The network 104 is a medium for providing a communication connection between the client 102 and the server 103. The network 104 can facilitate the exchange of information or data. Figure 1 As shown, the client 102 and the server 103 can be connected to the network 104 respectively, and transmit information or data to each other through the network 104.

[0072] In some embodiments, the network 104 may be any type of wired or wireless network, or a combination thereof. For example, the network 104 may include a cable network, a wired network, a fiber optic network, a telecommunications network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a public switched telephone network (PSTN), a Bluetooth network TM, a short-range wireless network (ZigBee TM), a near field communication (NFC) network, or a similar network.

[0073] In some embodiments, the network 104 may include one or more network access points. For example, the network 104 may include a wired or wireless network access point, such as a base station or an Internet exchange point, through which one or more components of the client 102 and the server 103 can connect to the network 104 to exchange data or information.

[0074] It is worth mentioning that Figure 1 The number of clients 102, servers 103, and networks 104 in the embodiment is only illustrative. According to the implementation requirements, there may be any number of clients 102, servers 103, and networks 104. The training method provided in this specification may be executed entirely on the client 102, entirely on the server 103, or partially on the client 102 and partially on the server 103.

[0075] That is to say, Figure 1 and for Figure 1 The above description is only used to illustrate the application scenarios to which the training method of this specification may be applicable, and should not be understood as a limitation on the application scenarios.

[0076] Regarding the application scenarios of the legal intent recognition method (hereinafter referred to as the recognition method) provided in this embodiment, please refer to the above description of the training method, which will not be repeated here.

[0077] Figure 2The hardware structure diagram of a training system 200 provided according to an embodiment of the present specification is shown. The training system 200 can execute the training method described in the present specification. The training method is introduced in other parts of the present specification. When the training method is executed on the client 102, the training system 200 can be the client 102. When the training method is executed on the server 103, the training system 200 can be the server 103. When the training method is partially executed on the client 102 and partially executed on the server 103, the training system 200 can be a system including the client 102 and the server 103.

[0078] like Figure 2 As shown, the training system 200 may include at least one storage medium 203 and at least one processor 202. In some embodiments, the training system 200 may also include a communication port 204 and an internal communication bus 201. The training system 200 may also include an I / O component 205.

[0079] The internal communication bus 201 can connect different system components. For example, the internal communication bus 201 can connect the storage medium 203, the processor 202, the communication port 204 and the I / O component 205.

[0080] I / O component 205 supports input / output between query system 200 and other components.

[0081] The communication port 204 is used for data communication between the query system 200 and the outside world. For example, the communication port 204 can be used for data communication between the query system 200 and the network 104. The communication port 204 can be a wired communication port or a wireless communication port.

[0082] The storage medium 203 may include a data storage device. The data storage device may be a non-temporary storage medium or a temporary storage medium. For example, the data storage device may include one or more of a disk 2031, a read-only storage medium (ROM) 2032, or a random access storage medium (RAM) 2033. The storage medium 203 also includes at least one instruction set stored in the data storage device. The instruction set includes a computer program code, and the computer program code may include a program, a routine, an object, a component, a data structure, a process, a module, etc. for executing the training method provided in this specification.

[0083] At least one processor 202 may be communicatively connected to at least one storage medium 203. At least one processor 202 is used to execute the above-mentioned at least one instruction set. When the training system 200 is running, at least one processor 202 reads the at least one instruction set and executes the training method provided in this specification according to the instructions of the at least one instruction set. The processor 202 may execute all the steps included in the training method. The processor 202 may be in the form of one or more processors. In some embodiments, the processor 202 may include one or more hardware processors, such as a microcontroller, a microprocessor, a reduced instruction set computer (RISC), an application-specific integrated circuit (ASIC), an application-specific instruction set processor (ASIP), a central processing unit (CPU), a graphics processing unit (GPU), a physical processing unit (PPU), a microcontroller unit, a digital signal processor (DSP), a field programmable gate array (FPGA), an advanced RISC machine (ARM), a programmable logic device (PLD), any circuit or processor capable of performing one or more functions, etc., or any combination thereof.

[0084] For illustration purposes only, only one processor 202 is shown in the training system 200 in the accompanying drawings. However, it should be noted that the training system 200 in this specification may also include multiple processors, and therefore, the operations and / or method steps disclosed in this specification may be performed by one processor or by multiple processors in combination. For example, if the processor 202 of the training system 200 is described in this specification as performing step A and step B, it should be understood that step A and step B may also be performed jointly or separately by two different processors 202 (e.g., the first processor performs step A, the second processor performs step B, or the first and second processors perform steps A and B together).

[0085] Similarly, regarding the structure of the generation system of this embodiment, reference may be made to the description of the training system 200 in the above example, which will not be repeated here.

[0086] See also Figure 3 , Figure 3 This is a flow chart of the training method provided in the embodiment of this specification. Figure 3 As shown, the method includes the following S301 to S303:

[0087] S301: Obtain legal inquiry sample.

[0088] The legal query samples are legal queries in the training phase. They correspond to the target legal queries in the training phase in the following text. In other words, the “samples” and “targets” are used to distinguish legal queries at different stages, and cannot be understood as limitations on legal queries. Similar expressions will not be repeated in the following text.

[0089] Exemplarily, the training system may collect a large amount of sample data of legal queries (ie, legal query samples), which are used for subsequent training of the legal intent recognition model.

[0090] This embodiment does not limit the method of obtaining legal query samples, that is, this embodiment does not limit the method of collecting sample data for the training system. For example, the training system can obtain a large amount of legal query texts through various channels (such as historical consultation records, public databases, consultations submitted by users, etc.) to be used as legal query samples.

[0091] In some embodiments, after obtaining the legal query text, the training system may perform data cleaning on the legal query text to remove irrelevant information, noise, formatting errors, etc., so as to ensure the data quality of the legal query sample.

[0092] Relatively speaking, the training system uses a variety of legal query samples to cover different categories of legal issues, which can ensure the comprehensiveness and representativeness of the training. In addition, the cleaned data is cleaner, reducing the impact of noise on training and improving the accuracy and reliability of training.

[0093] In some embodiments, the legal query sample includes a sample context and a sample user input, wherein the sample context includes a sample user historical session, and the sample user input includes a sample user's current legal query.

[0094] For example, the process of legal consultation may be a process in which a user continuously raises legal questions. For example, after raising the first legal question and receiving feedback, the user may further ask questions based on the feedback received.

[0095] Therefore, in this embodiment, the legal query sample includes two aspects: historical legal queries (ie, historical conversations of sample users) and currently input legal queries (ie, current legal queries of sample users).

[0096] In this embodiment, the legal query sample includes not only the currently input legal query, but also the corresponding context. Therefore, the training data set subsequently constructed based on the legal query sample can represent both the currently input legal query and the corresponding context. Therefore, when the training system subsequently trains the large language model based on the training data set, it can learn to determine the legal intent from the overall legal query, so as to improve the overall recognition effect and reliability of the trained legal intent recognition model.

[0097] S302: Constructing a training data set for a large language model based on the legal query samples and a preset tree structure, wherein the tree structure is a hierarchical graphic structure representing the legal service categories.

[0098] Exemplarily, the tree structure is a hierarchical graphical structure used to represent different legal service categories, so as to represent different levels of legal intent through different legal service categories. For example, legal intent can be understood as the user's legal goal, which is a structured analysis of user input (i.e., legal query). Legal intent can be divided into different levels according to fields and legal facts.

[0099] in, Figure 4 The correspondence between legal inquiry and legal intent can be characterized.

[0100] like Figure 4 As shown in the figure, if the legal query is "Help me search for patents", the legal intent is "internal affairs", and specifically "patent services" under "internal affairs". If the legal query is "consulting on five social insurances and one housing fund", the legal intent is "five social insurances and one housing fund". If the legal query is "transfer of housing provident fund", the legal intent is "housing provident fund".

[0101] in, Figure 5 It is a schematic diagram of the tree structure. Figure 5 As shown in , the tree structure includes a root node, a parent node, and a child node. The parent node and the child node are relative concepts. Figure 5 The "patent" in is both a child node of "company internal affairs" and a parent node of "query". Figure 5 It can be seen that the tree structure starts from the root node and gradually refines into specific legal issue categories (i.e. legal service categories).

[0102] Accordingly, combined Figure 5 It can be seen that "Legal Inquiry" can be the first-level legal intent; "Legal Inquiry-Labor Dispute, Legal Inquiry-Marriage and Family Affairs" can be the second-level legal intent; "Legal Inquiry-Labor Dispute-Five Insurances and One Fund" can be the third-level legal intent.

[0103] In some embodiments, the training system may obtain prompt information, wherein the prompt information includes a format example for responding to a legal query sample based on a tree structure.

[0104] Accordingly, the above S302 may include: constructing a sample query statement including prompt information, a legal query sample, and a tree structure, and constructing a training data set including the sample query statement and the classification truth value of the sample query statement. The classification truth value is the legal service category corresponding to the legal query sample represented by the format example.

[0105] Exemplarily, the prompt information can be understood as a format example (also called a format template) for guiding the large language model to generate a response, and is defined based on a tree structure. In other words, the format example can be used to guide the large language model on how to respond to the legal query sample according to the classification structure of the tree structure.

[0106] For example, based on Figure 5 In the tree structure shown, format examples may include: Response Format Example 1: Legal Consultation / Marriage and Family Affairs; Response Format Example 2: Internal Company Affairs / Patents / Inquiries; Response Format Example 3: Self-Identity Awareness.

[0107] Accordingly, on the one hand, the training system can construct a legal query statement including a format example; on the other hand, the training system can determine the actual legal service category (ie, classification truth value) corresponding to the sample query statement represented by the format example.

[0108] For example, Figure 6 As shown, the training data set includes: sample query statements (such as Figure 6 The “Q” shown in the figure) and the classification truth (such as Figure 6 "A" shown).

[0109] In this embodiment, the prompt information can provide a clear format example so that the large language model can understand how to generate a response that meets the requirements. In addition, by constructing a structured training data set including sample query statements and classification truth values, it can facilitate the understanding and learning of the large language model, thereby improving training efficiency and accuracy. Moreover, by clarifying the classification truth value through the tree structure, the large language model can learn the correct classification logic during the training process.

[0110] S303: The legal intent recognition capability of the large language model is trained according to the training data set to obtain a legal intent recognition model. The legal intent recognition capability refers to the ability to classify legal query samples based on a tree structure to obtain corresponding legal service categories.

[0111] Exemplarily, the training system uses the structured training data set obtained in S302 to train the large language model to optimize the parameters of the large language model so that it can correctly classify the input legal query according to the tree structure and obtain the corresponding legal service category.

[0112] For example, in combination with the above example, a legal query sample is "I have been employed for a month, and the company has signed a labor contract but has not given it to me. What should I do?". Legal intent recognition capability can be understood as training the system to learn based on Figure 5 The tree structure shown classifies the legal query sample and obtains the capability of the legal service category "legal consultation / labor dispute".

[0113] Combined with the above analysis of S301 and S303, it can be seen that in this embodiment, by combining the tree structure to construct a structured training data set, the large language model can learn the hierarchical relationship and category characteristics between different legal queries. In other words, training the large language model based on the constructed training data set can make the trained legal intent recognition model have a stronger legal intent recognition ability. Furthermore, in the application stage, the recognition system can accurately and reliably determine the correct classification of the input legal query based on the legal intent recognition model. Thereby, the accuracy and reliability of legal consultation and the user's legal consultation experience can be improved.

[0114] In some embodiments, the above S303 may include the following steps 1 to 3:

[0115] Step 1: For any sample query in the training data set, the sample prediction intent path of any sample query is obtained based on the large language model prediction. The sample prediction intent path is a legal service category represented by a format example and corresponding to any sample query.

[0116] Exemplarily, in combination with the above analysis, the training data set includes sample query statements, and this embodiment does not limit the number of sample query statements.

[0117] Accordingly, for each sample query statement in the training data set, the training system can predict the query result of the sample query statement based on the large language model to obtain the corresponding legal service category, and the legal service category is represented based on the format example.

[0118] Exemplarily, for the sample query statement Q1, the training system can obtain the prediction result (ie, the predicted intention path) AY1 of the sample query statement Q1 through step 1.

[0119] Step 2: Construct a loss function based on the sample prediction intent path and the classification truth value corresponding to any sample query statement. The target loss value in the loss function is determined based on the sample prediction intent path, and at least some of the prediction intent paths have different loss values.

[0120] It is understandable that the loss function includes a target loss value. In some embodiments, the loss values ​​of different sample data in the same training are the same. For example, the training system minimizes the prediction results and true labels of different sample data with the same loss value. In this embodiment, the training system minimizes the prediction results and true labels of different sample data with different loss values.

[0121] Exemplarily, combined with the above analysis, it can be seen that the training data set also includes classification truth values. Assume that the classification truth value of the sample query statement Q1 is AT1. Then in this step 2, the training system can construct a loss function between the predicted intention path AY1 and the classification truth value AT1. The loss function is used to characterize the difference between the predicted intention path AY1 and the classification truth value AT1.

[0122] Assuming that the loss value between the predicted intention path AY1 and the classification truth value AT1 is Loss1, the loss value Loss1 is determined by the training system based on the predicted intention path AY1. In other words, different predicted intention paths may have different loss values.

[0123] For example, when the predicted intention path service category is "legal consultation / labor dispute", the loss value Loss1 = α; when the predicted intention path is "self-identity cognition", the loss value Loss1 = β; α≠β.

[0124] Step 3: Determine the legal intent recognition model based on the loss function.

[0125] Exemplarily, the training system trains a legal intent recognition model capable of recognizing legal intent by minimizing a target loss value of a loss function.

[0126] Combined with the above analysis of steps 1 to 3, it can be seen that in this embodiment, different prediction results correspond to different loss values, so that the large language model can distinguish the prediction errors of different legal service categories, so as to make adjustments more accurately, thereby improving the accuracy and reliability of the legal intent recognition model. In addition, the differentiation and flexibility of training can also be improved.

[0127] In some embodiments, the training system can tokenize the tree structure to obtain a token sequence of the legal service category in the tree structure. Accordingly, the above step 2 can include: obtaining a target token sequence of the sample prediction intent path, matching the target token sequence with the token sequence of the legal service category in the tree structure to obtain a target loss value, and constructing a loss function that characterizes the difference between the sample prediction intent path and the classification truth value corresponding to any sample query statement based on the target loss value.

[0128] For example, the training system is Figure 5 The tree structure shown in the figure is tokenized to obtain token sequences such as "legal consultation / marriage and family affairs", "internal affairs / patents", etc., which are not listed here one by one.

[0129] After obtaining the prediction results, the training system can tokenize the prediction results to obtain a token sequence corresponding to the prediction results (i.e., a target token sequence). The training system matches the target token sequence with each token sequence corresponding to the tree structure to obtain a target loss value.

[0130] Accordingly, the training system can construct a loss function based on the target loss value to characterize the difference between the predicted result and the true label through the loss function. This enables the large language model to accurately classify legal queries and obtain the legal intent recognition capability of the corresponding legal service category. In addition, by combining the tokenization method to construct the loss function, the calculation can be simplified, thereby achieving the technical effect of saving resources and improving training efficiency.

[0131] In some embodiments, the above-mentioned matching of the target token sequence with the token sequence of the legal service category in the tree structure to obtain the target loss value may include the following sub-steps 1 and 2:

[0132] Sub-step 1: Calculate the similarity between the target token sequence and the token sequence of the legal service category in the tree structure to obtain the legal service category token sequence with the highest similarity to the target token sequence.

[0133] Exemplarily, in combination with the above analysis, the tree structure corresponds to multiple token sequences. The training system can calculate the similarities between the multiple token sequences and the target token sequence respectively. After calculating each similarity, the training system can compare each similarity to determine the maximum similarity from each similarity, thereby obtaining the legal service category token sequence with the highest similarity.

[0134] Sub-step 2: Determine the target loss value based on the legal service category token sequence with the highest similarity.

[0135] In some embodiments, sub-step 2 may include: obtaining a target consultation frequency of the legal service category with the highest similarity in an actual consultation scenario, and determining a target loss value according to the target consultation frequency, wherein the loss value is inversely proportional to the consultation frequency.

[0136] Exemplarily, the training system can obtain, through similarity calculation, a token sequence (hereinafter referred to as the first token sequence) that matches (eg, is highly similar to) the target token sequence among the token sequences corresponding to the tree structure.

[0137] In combination with the above example, if the consultation frequency of the legal service category corresponding to the first token sequence is higher, the target loss value can be determined as a smaller loss value; conversely, if the consultation frequency of the legal service category corresponding to the first token sequence is lower, the target loss value can be determined as a larger loss value.

[0138] That is, the loss value of the predicted intention path is determined based on the consultation frequency of its corresponding legal service category in the actual legal consultation scenario.

[0139] Combined with the above analysis, the loss values ​​of different prediction results may be different, and the loss values ​​are determined based on the legal service category specifically represented by the prediction results. In this embodiment, the training system can determine the corresponding loss value based on the consultation frequency of the prediction results in the actual scenario. For example, the prediction results with a relatively higher consultation frequency have a relatively larger corresponding loss value; conversely, the prediction results with a relatively lower consultation frequency have a relatively smaller corresponding loss value.

[0140] For example, take the prediction result in the above example - the sample prediction service category is "legal consultation / labor dispute" as an example: in the actual legal consultation scenario, there are relatively more legal queries corresponding to "legal consultation / labor dispute", that is, the consultation frequency is relatively high, then the loss value α is a relatively small value.

[0141] For example, taking the prediction result in the above example - the sample prediction service category is "self-identity awareness" as an example: in the actual legal consultation scenario, the legal queries corresponding to "self-identity awareness" are relatively few, that is, the consultation frequency is relatively low, then the loss value β is a relatively large value.

[0142] In this embodiment, the loss value is determined by combining the consultation frequency, and the higher the consultation frequency, the smaller the loss value, and the lower the consultation frequency, the larger the loss value. This can make the legal intent recognition model more capable of classifying frequently consulted legal issues, thereby improving the user's consultation experience. It can also reduce the training resources for the classification ability of legal issues with low consultation frequency, thereby accelerating the training convergence efficiency.

[0143] The above examples mainly introduce the technical solutions of the training phase. Combined with the above analysis, it can be seen that after the training phase, a legal intent recognition model with the ability to recognize legal intent can be obtained. The legal intent recognition model can accurately and reliably determine the legal service category corresponding to the legal query. To facilitate the reader's understanding, the technical solution for the application of the legal intent recognition model is now explained.

[0144] See also Figure 7 , Figure 7 The following is a flow chart of the identification method provided in this disclosure. Figure 7 As shown, the identification method includes the following S701 and S702:

[0145] S701: Obtain target legal query.

[0146] It is understandable that in order to avoid cumbersome description, technical features in the application stage that are the same or similar to those in the above-mentioned training stage will not be repeated in the application stage.

[0147] For example, regarding the understanding of the target legal query and the method of obtaining the target legal query, please refer to the description of the legal query sample in the above example, which will not be repeated here.

[0148] S702: Predict the target legal query based on the pre-trained legal intent recognition model to obtain a target intent path corresponding to the target legal query. The legal intent recognition model is trained based on the training method described in any of the above embodiments; the target intent path uses a preset format example to represent the legal service category corresponding to the target legal query.

[0149] Exemplarily, when receiving the target legal query, the recognition system may input the target legal query into the legal intent recognition model. The legal intent recognition model identifies the target legal query based on its legal intent recognition capability to obtain a target intent path corresponding to the target legal query.

[0150] Combined with the analysis of the above training stage, it can be seen that the legal intent recognition model has a strong ability to recognize legal intent. Therefore, the target legal query is recognized based on the legal intent recognition model to classify the target legal query, which can achieve the accuracy and reliability of recognition.

[0151] In some embodiments, S702 may include the following steps 1 to 3:

[0152] Step 1: Obtain the pre-built tree structure and target context of the target legal query.

[0153] Similarly, for the understanding of the tree structure and target context, please refer to the above description of the tree structure and sample context in the training phase, which will not be repeated here.

[0154] Step 2: Construct a target query statement including a tree structure, a target context, and a target legal query.

[0155] Similarly, regarding the implementation principle of step 2, please refer to the implementation principle of constructing the sample query statement in the above example, which will not be repeated here.

[0156] For example, Figure 8As shown, when the training system receives the target legal query input by the user, it can call the intent recognition service. For example, the training system can obtain the target context, and assemble the target context and the target legal query by reading the tree structure to obtain the target query statement.

[0157] Step 3: Input the target query statement into the legal intent recognition model and output the target intent path.

[0158] Correspondingly, the recognition system can input the target query statement into the legal intent recognition model so that the legal intent recognition model can recognize the target query statement based on its legal intent recognition capability and obtain the target intent path.

[0159] Combining the above examples with Figure 8 ,The input of the legal intent recognition model is the target query sentence, and the output is the target intent path.

[0160] In some embodiments, the identification method of this embodiment is applied to an application program. The identification method may also include: converting the target intent path into a target identifier code recognizable by the application program, and acquiring and outputting a query result corresponding to the target legal query according to the target identifier.

[0161] For example, in the case of application-based legal intent recognition, after obtaining the user's target intent path, in order to further respond to the user's target legal query, the recognition system can convert the target intent path into a target identifier that the application can recognize. Accordingly, the application can quickly and reliably determine the query result corresponding to the target legal query based on the target identifier.

[0162] For example, the target legal query is "My parents are divorced, do I still need to support them?" First, the recognition system can determine that the target intent path corresponding to the target legal query is "legal consultation / marriage and family affairs" based on the legal intent recognition model. Then, the recognition system can convert "legal consultation / marriage and family affairs" into a target identifier that can be recognized by the application. Accordingly, the application can search from the legal database based on the target identifier that it can recognize to obtain the corresponding query result "need to support".

[0163] That is to say, in this embodiment, the recognition system can identify the intent of the user's question through the legal intent recognition model and then locate the legal field category to which the question belongs. After determining the legal field category, the recognition system can perform a refined search on the retrieved laws and regulations to enhance the quality of answers to legal questions. For example, the recognition system can perform a refined search based on Retrieval-Augmented Generation (RAG). Among them, RAG is a natural language processing technology that combines information retrieval (Retrieval) and text generation (Generation). It is mainly used to solve some natural language understanding and generation tasks that require external knowledge or specific information, such as question answering or text summarization.

[0164] For example, combining the above example and Figure 8 ,After obtaining the target intention path, the recognition system can call the retrieval enhancement service. ,Correspondingly, the recognition system determines and outputs the ,query results corresponding to the target legal query based on the retrieval enhancement ,service.

[0165] In some embodiments, the above-mentioned conversion of the target intent path into a target identifier recognizable by the application may include: converting the target intent path into the target identifier based on a preset first mapping relationship, wherein the first mapping relationship is used to characterize the correspondence between the intent path and the identifier.

[0166] Furthermore, the above-mentioned using the application to obtain and output the query result corresponding to the target legal query according to the target identifier may include: determining the target legal and regulatory base corresponding to the target identifier based on the second mapping relationship, and obtaining and outputting the query result from the target legal and regulatory base. The second mapping relationship is used to characterize the correspondence between the identifier and the legal and regulatory base.

[0167] For example, in the first mapping relationship, the identifier of the intent path "legal consultation / marriage and family affairs" is 1, the identifier of the intent path "legal consultation / labor disputes" is 2, and so on, which are not listed one by one here.

[0168] In combination with the above example, when the target intent path is "legal consultation / marriage and family affairs", the recognition system converts the target intent path "legal consultation / marriage and family affairs" into identifier 1.

[0169] Correspondingly, different laws and regulations correspond to different legal and regulatory libraries. For example, marriage and family affairs correspond to the marriage and family legal and regulatory library; labor disputes correspond to the labor legal and regulatory library. In the second mapping relationship, identifier 1 has a corresponding relationship with the marriage and family legal and regulatory library; identifier 2 has a corresponding relationship with the labor legal and regulatory library.

[0170] In combination with the above example, when the positive target identifier is identifier 1, the application searches from the marriage and family laws and regulations database to obtain and output the query result of "need for support".

[0171] It is worth noting that the above examples are only used to illustrate the possible implementation methods of the training method and recognition method of this specification, and cannot be understood as limiting the implementation methods of the training method and recognition method of this specification. For example, based on the above technical concept, some of the above technical features can be combined to obtain a new embodiment; new technical features can be added on the basis of the above examples to obtain a new embodiment; some technical features can be reduced on the basis of the above examples to obtain a new embodiment; some technical features in the above examples can be replaced with other technical features; some technical features and the order of the above examples can be adjusted to obtain a new embodiment, etc., which will not be listed here one by one.

[0172] Based on the above technical concept, this specification also provides a computer-readable non-temporary storage medium, which stores at least one instruction set. When the at least one instruction set is executed by a processor, the steps of the training method and recognition method described in this specification are implemented.

[0173] In some possible implementations, various aspects of this specification may also be implemented in the form of a program product, which includes a program code. When the program product is run on the training system 200, the program code is used to enable the training system 200 to perform the steps of the training method described in this specification. The program product for implementing the above method may include a portable compact disk read-only memory (CD-ROM) including the program code, and may be run on the training system 200. However, the program product of this specification is not limited to this. In this specification, a readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system or used in combination with it. The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media include: an electrical connection with one or more conductors, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. The computer-readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above. Program code for performing the operations of the present specification may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the training system 200, partially on the training system 200, as a stand-alone software package, partially on the training system 200 and partially on a remote training system, or entirely on the remote training system 200.

[0174] It should be noted that the collection, storage, use, processing, transmission, provision and disclosure of relevant user information (such as legal inquiries, etc.) involved in the technical solution of this specification are in compliance with the relevant laws and regulations and do not violate public order and good morals.

[0175] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require a specific order or a continuous order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0176] In summary, after reading this detailed disclosure, those skilled in the art will appreciate that the foregoing detailed disclosure may be presented only by way of example and may not be limiting. Although not explicitly stated herein, those skilled in the art will appreciate that this specification requires various reasonable changes, improvements and modifications to the embodiments. These changes, improvements and modifications are intended to be proposed by this specification and are within the spirit and scope of the exemplary embodiments of this specification.

[0177] In addition, certain terms in this specification have been used to describe embodiments of this specification. For example, "one embodiment", "an embodiment" and / or "some embodiments" mean that a particular feature, structure or characteristic described in conjunction with the embodiment may be included in at least one embodiment of this specification. Therefore, it can be emphasized and should be understood that two or more references to "an embodiment" or "one embodiment" or "an alternative embodiment" in various parts of this specification do not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics may be appropriately combined in one or more embodiments of this specification.

[0178] It should be understood that in the foregoing description of the embodiments of this specification, in order to help understand a feature and for the purpose of simplifying this specification, this specification combines various features in a single embodiment, figure or its description. However, this does not mean that the combination of these features is necessary. When reading this specification, it is entirely possible for a person skilled in the art to mark out some of the devices as separate embodiments. In other words, the embodiments in this specification can also be understood as the integration of multiple secondary embodiments. And the content of each secondary embodiment is also valid when it is less than all the features of a single aforementioned disclosed embodiment.

[0179] Each patent, patent application, publication of patent applications, and other materials, such as articles, books, specifications, publications, documents, articles, etc., cited herein, except to the extent that it is inconsistent or conflicting with this document or that has a limiting effect on the broadest scope of the claims, may be incorporated herein by reference and used for all purposes now or hereafter associated with this document. In addition, in the event of any inconsistency or conflict between the description, definition, and / or use of a term in any material and the description, definition, and / or use of a term in this document, the term in this document shall prevail.

[0180] Finally, it should be understood that the embodiments of the application disclosed herein are explanations of the principles of the embodiments of this specification. Other modified embodiments are also within the scope of this specification. Therefore, the embodiments disclosed in this specification are only used as examples and not as limitations. Those skilled in the art can adopt alternative configurations according to the embodiments in this specification to implement the applications in this specification. Therefore, the embodiments of this specification are not limited to the embodiments accurately described in the application.

Claims

1. A method for training a legal intent recognition model, comprising: Get a sample legal search; Constructing a training data set of a large language model according to the legal query samples and a preset tree structure, wherein the tree structure is a hierarchical graphical structure representing legal service categories; and The legal intent recognition capability of the large language model is trained according to the training data set to obtain a legal intent recognition model, wherein the legal intent recognition capability refers to the ability to classify the legal query samples based on the tree structure to obtain corresponding legal service categories.

2. The method according to claim 1, wherein: The method further comprises: Obtaining prompt information, the prompt information including a format example for responding to the legal query sample based on the tree structure; And, the training data set for constructing a large language model based on the legal query samples and the preset tree structure includes: constructing a sample query statement including the prompt information, the legal query samples, and the tree structure, and constructing the training data set including the sample query statement and the classification true value of the sample query statement, wherein the classification true value is the legal service category corresponding to the legal query sample represented by the format example.

3. The method according to claim 2, wherein: The step of training the legal intent recognition capability of the large language model according to the training data set to obtain a legal intent recognition model includes: For any sample query statement in the training data set, a sample prediction intent path of the any sample query statement is obtained based on the large language model prediction, wherein the sample prediction intent path is a legal service category corresponding to the any sample query statement expressed in the format example; Constructing a loss function according to the sample prediction intent path and the classification truth value corresponding to any sample query statement, wherein a target loss value in the loss function is determined based on the sample prediction intent path, and at least some of the prediction intent paths have different loss values; and The legal intent recognition model is determined based on the loss function.

4. The method according to claim 3, wherein: The method further comprises: Tokenizing the tree structure to obtain a token sequence of the legal service category in the tree structure; And, constructing a loss function according to the sample prediction intention path and the classification truth value corresponding to the arbitrary sample query statement, including: obtaining the target token sequence of the prediction intention path, matching the target token sequence with the token sequence of the legal service category in the tree structure to obtain the target loss value, and constructing the loss function that characterizes the difference between the prediction intention path and the classification truth value corresponding to the arbitrary sample query statement according to the target loss value.

5. The method according to claim 4, wherein: Matching the target token sequence with the token sequence of the legal service category in the tree structure to obtain the target loss value includes: Calculating the similarity between the target token sequence and the token sequence of the legal service category in the tree structure to obtain the legal service category token sequence with the highest similarity to the target token sequence; and The target loss value is determined based on the legal service category token sequence with the highest similarity.

6. The method according to claim 5, wherein: The determining the target loss value according to the legal service category token sequence with the highest similarity includes: Obtaining the target consultation frequency of the legal service category with the highest similarity in the actual consultation scenario; and The target loss value is determined according to the target consultation frequency, wherein the loss value is inversely proportional to the consultation frequency.

7. The method according to claim 1, wherein: The legal query sample includes a sample context and a sample user input; The sample context includes a sample user's historical conversation, and the sample user input includes a sample user's current legal query.

8. A method for identifying legal intent, comprising: Obtain targeted legal inquiries; as well as The target legal query is predicted based on a pre-trained legal intent recognition model to obtain a target intent path corresponding to the target legal query, wherein the legal intent recognition model is trained based on the training method described in any one of claims 1 to 7, and the target intent path uses a preset format example to represent the legal service category corresponding to the target legal query.

9. The method according to claim 8, wherein: The method of predicting the target legal query based on the pre-trained legal intent recognition model to obtain a target intent path corresponding to the target legal query includes: Obtaining a pre-built tree structure and a target context of the target legal query; Constructing a target query statement including the tree structure, the target context, and the target legal query; and The target query statement is input into the legal intent recognition model, and the target intent path is output.

10. The method according to claim 9, wherein: The method further comprises: Converting the target intent path into a target identifier recognizable by the application; and The application is used to obtain and output a query result corresponding to the target legal query according to the target identifier.

11. The method according to claim 10, wherein: The converting the target intent path into a target identifier recognizable by the application comprises: converting the target intent path into the target identifier based on a preset first mapping relationship, wherein the first mapping relationship is used to characterize the correspondence between the intent path and the identifier; And, using the application to obtain and output the query result corresponding to the target legal query according to the target identifier, including: determining the target legal and regulatory library corresponding to the target identifier based on a second mapping relationship, and obtaining and outputting the query result from the target legal and regulatory library; wherein the second mapping relationship is used to characterize the correspondence between the identifier and the legal and regulatory library.

12. A training system for a legal intent recognition model, comprising: at least one storage medium storing at least one instruction set for training a legal intent recognition model; At least one processor is communicatively connected to the at least one storage medium, wherein when the at least one processor is running, the at least one instruction set is read, and the training method as described in any one of claims 1 to 7 is executed according to the instructions of the at least one instruction set.

13. A system for identifying legal intent, comprising: at least one storage medium storing at least one set of instructions for identifying legal intent; At least one processor is communicatively connected to the at least one storage medium, wherein the at least one processor reads the at least one instruction set when it is running, and executes the identification method as described in any one of claims 8 to 11 according to the instructions of the at least one instruction set.