Question answering method for legal consultation, training method of central control model and electronic equipment

Through the central control model, multiple legal models are called for coordinated processing, which solves the problem that existing legal consulting systems are difficult to provide accurate responses when dealing with complex legal issues, and achieves more accurate and comprehensive general legal consulting services.

CN119849637AActive Publication Date: 2025-04-18NANJING SILICON INTELLIGENCE TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510007553.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-04-18
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

The existing legal consultation and question answering system is difficult to provide accurate and comprehensive general when dealing with complex legal issues, and the question information entered by users often lacks necessary information, resulting in inaccurate responses.

Method used

The central control model is used to process multiple preset legal models (such as legal event detection model, legal information extraction model, establishment condition determination model, etc.), and the appropriate target legal model is determined and the order of call is determined to generate more accurate legal consultation responses.

Benefits of technology

Through multi-model collaborative processing, legal events and entity relationships can be more accurately identified, more comprehensive and accurate legal advice can be provided, and inaccurate responses caused by insufficient user questions can be reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119849637A_ABST
    Figure CN119849637A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a question answering method for legal consultation, a training method for a central control model and electronic device.The question answering method for legal consultation comprises the steps that in response to first question information input by a user, a to-be-called target legal model is determined in multiple preset legal models based on the first question information, determining a calling sequence corresponding to the target legal model; calling the plurality of target legal models according to the calling sequence, and obtaining a processing result corresponding to each target legal model based on the first question information through each target legal model; and generating and outputting first reply information for the first question information based on the processing result corresponding to each target legal model. According to the method and the device, the proper legal model can be called for the legal consultation problem input by the user through the central control model to process the legal consultation problem, so that more accurate legal consultation suggestions are provided for the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a question-and-answer method for legal consultation, a training method for a central control model, and electronic equipment. Background Art

[0002] With the development of artificial intelligence (AI) technology, existing consulting question-answering systems usually use large language models (LLM) to achieve intelligent interaction with users. Large language models use natural language processing (NLP) technology to understand, interpret and generate text to perform tasks such as text analysis, sentiment analysis, language translation and speech recognition. Summary of the invention

[0003] The embodiment of the present application provides a question-and-answer method for legal consultation, a training method for a central control model, and an electronic device, which can process the legal consultation questions input by the user by calling an appropriate legal model through the central control model, so as to provide the user with more accurate legal consultation opinions. Specifically, the embodiment of the present application discloses the following technical solutions:

[0004] A first aspect of an embodiment of the present application provides a question-and-answer method for legal consultation, which is applied to a central control model. The method includes: in response to a first question information input by a user, determining a target legal model to be called from multiple preset legal models based on the first question information, and determining a calling order corresponding to the target legal models; calling the target legal models according to the calling order, and obtaining processing results corresponding to each target legal model based on the first question information through each target legal model; generating and outputting a first reply information to the first question information based on the processing results corresponding to each target legal model.

[0005] In some embodiments, the target legal model includes a legal event detection model and a legal information extraction model; the processing results corresponding to each of the target legal models are obtained based on the first question information through each of the target legal models, including: determining multiple entities in the first question information and the entity relationships between each of the multiple entities through the legal information extraction model; determining the question information features corresponding to the first question information and the initial features corresponding to each of the entities through the legal event detection model based on the first question information and the multiple entities; wherein the initial features corresponding to each of the entities represent the context information corresponding to each of the entities; determining the core information corresponding to the first question information through the legal event detection model based on the multiple entities, the entity relationships between the entities and the initial features corresponding to the entities; determining the target event information corresponding to the first question information through the legal event detection model based on the question information features and the core information corresponding to the first question information; wherein the processing results corresponding to each of the target legal models include the target event information determined by the legal event detection model.

[0006] In some embodiments, the core information corresponding to the first question information includes the core information corresponding to each of the entities in the first question information and the core relationships between the entities; the core information corresponding to the first question information is determined by the legal event detection model based on the multiple entities, the entity relationships between the entities and the initial features corresponding to the entities, including: determining a syntactic graph with each of the entities as nodes and the entity relationships between the entities as edges through the legal event detection model; updating the initial features corresponding to each of the entities based on the syntactic graph and the initial features corresponding to each of the entities through multiple neural network layers in the legal event detection model to obtain updated features of each of the nodes determined by each of the multiple neural network layers; determining the updated features of each of the nodes determined by the last neural network layer in the multiple neural network layers as the core information corresponding to each of the entities and the core relationships between the entities.

[0007] In some embodiments, the above-mentioned determining multiple entities in the above-mentioned first question information and the entity relationships between each of the above-mentioned entities through the above-mentioned legal information extraction model includes: obtaining historical event information through the above-mentioned legal information extraction model, and vectorizing the above-mentioned historical event information to obtain a supervision vector; extracting features of legal elements in the above-mentioned first question information through the above-mentioned legal information extraction model to obtain multiple element features corresponding to the above-mentioned first question information; determining content features corresponding to the above-mentioned first question information based on the above-mentioned multiple element features corresponding to the above-mentioned first question information and the above-mentioned supervision vector through the above-mentioned legal information extraction model, and determining the above-mentioned multiple entities according to the above-mentioned content features; extracting entity relationships from the above-mentioned content features through the above-mentioned legal information extraction model to obtain entity relationships between each of the above-mentioned entities; wherein, the processing results corresponding to each of the above-mentioned target legal models include the above-mentioned multiple entities determined by the above-mentioned legal information extraction model and the entity relationships between each of the above-mentioned entities.

[0008] In some embodiments, the above-mentioned content features corresponding to the above-mentioned first question information are determined by the above-mentioned legal information extraction model based on the above-mentioned multiple element features corresponding to the above-mentioned first question information and the above-mentioned supervision vector, including: concatenating or dot-multiplying the above-mentioned supervision vector and each of the above-mentioned element features through the above-mentioned legal information extraction model to obtain the above-mentioned multiple first element features; adjusting the weight of each of the above-mentioned first element features in the above-mentioned multiple first element features by using the attention mechanism through the above-mentioned legal information extraction model to obtain multiple second element features after weight adjustment; performing feature fusion processing on the above-mentioned multiple second element features through the above-mentioned legal information extraction model to obtain the above-mentioned content features.

[0009] In some embodiments, the above method also includes: determining the current event information based on the above entities and the entity relationships between the above entities through the above legal event detection model; when the above current event information is different from the above historical event information, vectorizing the above current event information through the above legal information extraction model to obtain the supervision vector corresponding to the above current event information; determining multiple entities in the above question information based on the supervision vector corresponding to the above current event information and the above multiple element features through the above legal information extraction model; determining the entity relationships between the above multiple entities corresponding to the above current event information based on the above multiple entities corresponding to the above current event information through the above legal information extraction model.

[0010] In some embodiments, the target legal model further includes a condition determination model; the target event information corresponding to the first question information is determined by the legal event detection model based on the question information characteristics and the core information corresponding to the first question information, including: determining the first event information corresponding to the first question information based on the question information characteristics and the core information corresponding to the first question information through the legal event detection model; determining event determination information based on the first event information through the condition determination model, and determining and outputting the second question information based on the event determination information and the first question information; obtaining the second reply information input by the user to the second question information through the legal event detection model, and determining the target question information based on the first question information and the second reply information; determining the target event information based on the target question information characteristics corresponding to the target question information and the core information corresponding to the target question information through the legal event detection model.

[0011] In some embodiments, the event determination information is determined based on the first event information through the establishment condition determination model, including: determining multiple preset texts associated with the first event information in a preset database based on the first event information through the establishment condition determination model; processing the first preset text through the establishment condition determination model to obtain multiple retrieval pairs corresponding to the first preset text; wherein the first preset text is any preset text among the multiple preset texts, and each of the multiple retrieval pairs includes a retrieval identifier and a retrieval content; clustering the multiple retrieval pairs corresponding to the first preset text through the establishment condition determination model to obtain multiple candidate seed retrieval pairs; determining a target seed retrieval pair that meets the preset conditions among the multiple candidate seed retrieval pairs through the establishment condition determination model, and determining the retrieval content of the target seed retrieval pair as the event determination information; wherein the processing results corresponding to each of the target legal models include the event determination information determined by the establishment condition determination model.

[0012] In some embodiments, the multiple search pairs corresponding to the above-mentioned first preset text are clustered by the above-mentioned establishment condition judgment model to obtain multiple candidate seed search pairs, including: in the current round of clustering process, the multiple first seed search pairs obtained in the previous round of clustering process and the multiple first search pairs that are not clustered are obtained by the above-mentioned establishment condition judgment model; wherein the above-mentioned multiple search pairs include the above-mentioned multiple first seed search pairs and the above-mentioned multiple first search pairs, and the sum of the number of the above-mentioned multiple first seed search pairs and the above-mentioned multiple first search pairs is equal to the preset number; the above-mentioned multiple first seed search pairs and the above-mentioned multiple first search pairs are clustered by the above-mentioned establishment condition judgment model to obtain multiple first search pairs corresponding to each of the above-mentioned legal categories in the multiple legal categories. two search pairs; determine the second seed search pairs corresponding to each of the above-mentioned legal categories among the above-mentioned multiple second search pairs corresponding to each of the above-mentioned legal categories through the above-mentioned establishment condition judgment model, and determine the multiple unclustered second search pairs among the above-mentioned multiple search pairs according to the above-mentioned preset number, the above-mentioned multiple first search pairs and the multiple second seed search pairs; cluster the multiple second seed search pairs and the multiple second search pairs in the next round of clustering process through the above-mentioned establishment condition judgment model until there are no unclustered search pairs in the above-mentioned multiple search pairs, and obtain the multiple candidate seed search pairs determined by the last round of clustering process; wherein each of the above-mentioned multiple candidate seed search pairs corresponds to a different legal category.

[0013] In some embodiments, the above-mentioned determination of the second seed search pair corresponding to each of the above-mentioned legal categories among the above-mentioned multiple second search pairs corresponding to each of the above-mentioned legal categories through the above-mentioned establishment condition determination model includes: determining the semantic vector corresponding to each of the above-mentioned second search pairs in each of the above-mentioned legal categories through the above-mentioned establishment condition determination model; determining the total distance between each first semantic vector and the second semantic vector in each of the above-mentioned legal categories according to the semantic vector corresponding to each of the above-mentioned second search pairs through the above-mentioned establishment condition determination model; wherein the above-mentioned first semantic vector is the semantic vector corresponding to any second search pair among the above-mentioned multiple second search pairs corresponding to each of the above-mentioned legal categories, and the above-mentioned second semantic vector is the semantic vector corresponding to the second search pair other than the second search pair corresponding to the above-mentioned first semantic vector; determining the target semantic vector with the shortest total distance to the above-mentioned second semantic vector among the multiple first semantic vectors through the above-mentioned establishment condition determination model, and determining the second search pair corresponding to the above-mentioned target semantic vector as the above-mentioned second seed search pair corresponding to each of the above-mentioned legal categories.

[0014] In some embodiments, the above-mentioned determination of the target seed retrieval pair that meets the preset conditions among the above-mentioned multiple candidate seed retrieval pairs through the above-mentioned establishment condition determination model includes: determining the target confidence score of each of the above-mentioned candidate seed retrieval pairs among the above-mentioned multiple candidate seed retrieval pairs through the above-mentioned establishment condition determination model; wherein the above-mentioned target confidence score is related to the correlation between each of the above-mentioned candidate seed retrieval pairs and the above-mentioned first event information, and the number of retrieval pairs in the legal category corresponding to each of the above-mentioned candidate seed retrieval pairs; and determining the candidate seed retrieval pairs among the above-mentioned multiple candidate seed retrieval pairs whose target confidence score is greater than or equal to the preset score as the above-mentioned target seed retrieval pair through the above-mentioned establishment condition determination model.

[0015] In some embodiments, the above-mentioned determination of the search content of the above-mentioned target seed search pair as the above-mentioned event determination information includes: if the ratio of the number of the above-mentioned target seed search pairs to the number of the above-mentioned multiple candidate seed search pairs is greater than or equal to a preset ratio, then the search content of the above-mentioned target seed search pair is determined as the above-mentioned event determination information; if the ratio of the number of the above-mentioned target seed search pairs to the number of the above-mentioned multiple candidate seed search pairs is less than the above-mentioned preset ratio, and the number of times the clustering is executed in a loop is less than or equal to the preset number of executions, then the above-mentioned multiple search pairs continue to be clustered until the ratio of the number of the above-mentioned target seed search pairs to the number of the above-mentioned multiple candidate seed search pairs is greater than or equal to the above-mentioned preset ratio. Set a ratio, or the number of times the above-mentioned loop executes clustering is greater than the above-mentioned preset number of executions; if the number of times the above-mentioned loop executes clustering is greater than the above-mentioned preset number of executions, then process the second preset text among the above-mentioned multiple preset texts to obtain multiple retrieval pairs corresponding to the above-mentioned second preset text; wherein the above-mentioned second preset text is any preset text among the above-mentioned multiple preset texts except the above-mentioned first preset text; cluster the multiple retrieval pairs corresponding to the above-mentioned second preset text to determine the target seed retrieval pair corresponding to the above-mentioned second preset text, and determine the retrieval content of the target seed retrieval pair corresponding to the above-mentioned second preset text as the event judgment information corresponding to the above-mentioned first question information.

[0016] In some embodiments, the target legal model includes a similar case retrieval model; the processing results corresponding to each target legal model obtained by each target legal model based on the first question information include: obtaining multiple preset texts through the similar case retrieval model, and determining the feature information corresponding to each of the multiple preset texts and the feature information corresponding to the first question information; wherein the feature information includes overall semantic features, core sentence features and label information; determining the similarity between the first question information and each of the preset texts through the similar case retrieval model based on the feature information corresponding to each of the preset texts and the feature information corresponding to the first question information; determining and outputting the target preset text from the multiple preset texts through the similar case retrieval model based on the similarity between the first question information and each of the preset texts; wherein the processing results corresponding to each target legal model include the target preset text determined by the similar case retrieval model.

[0017] In some embodiments, determining the feature information corresponding to each of the above-mentioned multiple preset texts includes: determining the overall semantic features and word semantic features corresponding to each of the above-mentioned preset texts through the above-mentioned similar case retrieval model; determining the core sentence meaning features corresponding to each of the above-mentioned preset texts based on the overall semantic features corresponding to each of the above-mentioned preset texts through the above-mentioned similar case retrieval model; determining the label information corresponding to each of the above-mentioned preset texts based on the word semantic features corresponding to each of the above-mentioned preset texts through the above-mentioned similar case retrieval model.

[0018] In some embodiments, the method further includes: identifying idiomatic sentences in each of the above-mentioned preset texts through the above-mentioned similar case retrieval model, and determining the processed preset text according to the idiomatic sentences in each of the above-mentioned preset texts; determining the similarity between the above-mentioned first question information and each of the above-mentioned preset texts based on the feature information corresponding to each of the above-mentioned preset texts and the feature information corresponding to the above-mentioned first question information through the above-mentioned similar case retrieval model, including: determining the similarity between the above-mentioned first question information and the above-mentioned processed preset text based on the overall semantic features, core sentence meaning features and label information corresponding to the above-mentioned processed preset text and the above-mentioned first question information through the above-mentioned similar case retrieval model.

[0019] In some embodiments, the target legal model further includes a legal event detection model and a legal information extraction model; the determination of the feature information corresponding to each of the multiple preset texts and the feature information corresponding to the first question information includes: determining the first event information corresponding to the first question information based on the question information feature corresponding to the first question information and the core information corresponding to the first question information through the legal event detection model; determining the event determination information based on the first event information through the establishment condition determination model, and determining and outputting the second question information based on the event determination information and the first question information; obtaining the second reply information input by the user to the second question information through the similar case retrieval model, and determining the target question information based on the first question information and the second reply information; determining the feature information corresponding to each of the preset texts and the feature information corresponding to the target question information through the similar case retrieval model.

[0020] A second aspect of an embodiment of the present application provides a training method for a central control model, which is applied to the central control model. The central control model includes a first language model and a reward model. The method includes: obtaining a scored first training sample and an unscored second training sample through any language model, and scoring the second training sample based on the first training sample to obtain a seed sample; training the reward model to be trained based on the seed sample to obtain a trained reward model; training the first language model to be trained based on the trained reward model and the third training sample to obtain a trained first language model; wherein the third training sample includes a third question sample, and the trained central control model includes the trained reward model and the trained first language model.

[0021] In some embodiments, the above-mentioned scoring of the second training sample based on the above-mentioned first training sample to obtain a seed sample includes: scoring the second model corresponding to the above-mentioned second training sample based on the above-mentioned first training sample, the first score corresponding to the above-mentioned first training sample and the above-mentioned second training sample through any of the above-mentioned language models to obtain the second score corresponding to the above-mentioned second model, and determining the above-mentioned seed sample according to the above-mentioned second training sample and the above-mentioned second score; wherein the above-mentioned first training sample includes a first question sample, the above-mentioned first model, a first processing result sample and the above-mentioned first score; the above-mentioned second training sample includes a second question sample, the above-mentioned second model and a second processing result sample; and the above-mentioned multiple preset legal models include the above-mentioned first model and the above-mentioned second model.

[0022] In some embodiments, the above-mentioned reward model to be trained includes multiple scoring models; the above-mentioned training of the reward model to be trained based on the above-mentioned seed samples to obtain the trained reward model includes: scoring the above-mentioned seed samples respectively through the above-mentioned multiple scoring models to obtain multiple scores corresponding to the above-mentioned seed samples; determining the target score corresponding to the above-mentioned seed sample based on the above-mentioned multiple scores corresponding to the above-mentioned seed sample through the above-mentioned reward model to be trained, and obtaining the above-mentioned trained reward model.

[0023] In some embodiments, the first language model to be trained is trained based on the trained reward model and the third training sample to obtain the trained first language model, including: determining the first target model to be called from the multiple preset legal models based on the third question sample through the first language model to be trained; obtaining the third processing result sample obtained after the third question sample is processed by the target model through the first language model to be trained; scoring the first target model based on the third training sample through the trained reward model to obtain a third score; wherein the third training sample also includes the first target model and the third processing result sample; optimizing the parameters of the first language model to be trained based on the third score to obtain the trained first language model.

[0024] In some embodiments, the central control model further includes a second language model; the above-mentioned parameters of the first language model to be trained are optimized based on the above-mentioned third score to obtain the above-mentioned trained first language model, including: obtaining the above-mentioned third question information sample through the above-mentioned second language model, and determining the second target model to be called in the above-mentioned multiple preset legal models based on the above-mentioned third question information sample; obtaining the fourth processing result sample obtained by the above-mentioned second target model based on the above-mentioned third question information sample; determining the divergence value based on the above-mentioned third processing result sample and the above-mentioned fourth processing result sample, and determining the loss function based on the above-mentioned third score and the above-mentioned divergence value; optimizing the parameters of the above-mentioned first language model to be trained based on the above-mentioned loss function, and obtaining the above-mentioned trained first language model.

[0025] A third aspect of the embodiment of the present application provides a question-and-answer device for legal consultation, which is configured in a central control model, and includes:

[0026] A first determination module is configured to respond to first question information input by a user, determine a target legal model to be called from a plurality of preset legal models based on the first question information, and determine a calling order corresponding to the target legal models;

[0027] A calling module is configured to call the target legal models according to the calling sequence, and obtain processing results corresponding to the target legal models based on the first question information through the target legal models;

[0028] The output module is configured to generate and output first reply information to the first question information based on the processing results corresponding to each of the target legal models.

[0029] A fourth aspect of the embodiments of the present application provides a training device for a central control model, which is configured in the central control model, wherein the central control model includes a first language model and a reward model, and the device includes:

[0030] A scoring module is configured to obtain a scored first training sample and an unscored second training sample through any language model, and score the second training sample based on the first training sample to obtain a seed sample;

[0031] A first training module is configured to train the reward model to be trained based on the seed sample to obtain a trained reward model;

[0032] The second training module is configured to train the first language model to be trained based on the trained reward model and the third training sample to obtain the trained first language model; wherein the third training sample includes the third question sample, and the trained central control model includes the trained reward model and the trained first language model.

[0033] The fifth aspect of an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory, the memory being configured to: store one or more programs; wherein, when the one or more programs are executed by one or more processors, the one or more processors implement the question-and-answer method for legal consultation described in the first aspect above, or implement the training method for the central control model described in the second aspect above.

[0034] The sixth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores computer program instructions. When the computer reads the instructions, it executes the question-and-answer method for legal consultation described in the first aspect, or implements the training method for the central control model described in the second aspect.

[0035] A seventh aspect of an embodiment of the present application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the question-and-answer method for legal consultation described in the first aspect, or implements the training method for the central control model described in the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0037] Figure 1 A flowchart of a question-and-answer method for legal consultation provided in some embodiments of the present application;

[0038] Figure 2 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0039] Figure 3 A schematic diagram of a legal information extraction model provided for some embodiments of the present application;

[0040] Figure 4 A schematic diagram of a legal event detection model provided for some embodiments of the present application;

[0041] Figure 5 A flowchart of another legal consultation question-and-answer method provided for some embodiments of the present application;

[0042] Figure 6 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0043] Figure 7 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0044] Figure 8 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0045] Fig. 9 A schematic diagram of a syntax diagram provided for some embodiments of the present application;

[0046] Fig.10 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0047] Fig.11 A scenario diagram of legal consultation provided for some embodiments of the present application;

[0048] Fig.12 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0049] Fig.13 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0050] Fig.14 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0051] Fig.15 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0052] Fig.16 A schematic diagram of a similar case retrieval model provided for some embodiments of the present application;

[0053] Fig.17 A flowchart of another question-and-answer method for legal consultation provided in some embodiments of the present application;

[0054] Fig.18 A scene graph for similar case retrieval provided in some embodiments of the present application;

[0055] Fig.19 A flowchart of a training method for a central control model provided in some embodiments of the present application;

[0056] Fig. 20 A schematic diagram of a training of a central control model provided in some embodiments of the present application;

[0057] Fig.21 A flowchart of another method for training a central control model provided in some embodiments of the present application;

[0058] Fig. 22 A flowchart of another method for training a central control model provided in some embodiments of the present application;

[0059] Fig.23 A schematic diagram of a question-and-answer device for legal consultation provided in some embodiments of the present application;

[0060] Fig.24 A schematic diagram of a training device for a central control model provided in some embodiments of the present application;

[0061] Fig.25 A schematic diagram of an electronic device according to some embodiments of the present application. DETAILED DESCRIPTION

[0062] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention and to make the above-mentioned purposes, features and advantages of the embodiments of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention are further described in detail below with reference to the accompanying drawings.

[0063] In the legal consultation scenario, when the user inputs a legal consultation question to the large language model to ask a question (i.e., inputs a Prompt), the large language model can output corresponding reply information based on the question information input by the user to provide legal consultation advice to the user. When the user can accurately describe the Prompt, the large language model can generate relatively accurate reply information. However, in actual situations, the Prompt described by the user is usually not accurate enough, and the user is usually unable to judge whether the reply information output by the large language model is accurate, and whether the Prompt needs to be updated so that the large language model can re-output the reply information. Moreover, the reply information generated by the current large language model is usually inconsistent with the actual situation.

[0064] For example, a user seeks legal advice from a large language model regarding a legal event in which an employee of a freight company privately drives a freight vehicle to handle personal matters on the way back from a transportation mission, and a car accident occurs on the way, causing property losses to the user. This legal event is actually related to occupational infringement (the unit should bear the tort liability in occupational infringement), so when the user enters the question information, he needs to describe the job relationship between the infringer (the freight company employee) and the freight company, so that the large language model can provide the user with legal advice related to occupational infringement based on this. If the question information entered by the user is "I was hit by someone, how should I ask for compensation", then since the question information does not describe information related to occupational infringement, the reply information generated by the large language model based on the question information may be unrelated to occupational infringement, that is, the legal advice provided by the large language model to the user deviates from the correct way to protect rights.

[0065] Moreover, since the large language model usually does not obtain all possible legal bases during the early training, especially some non-legal trial meeting minutes and guiding cases, the legal consulting advice generated by the large language model for some more complex legal consulting issues will have certain deviations.

[0066] Using the above example, for the legal event that "an employee of a freight company privately drove a freight vehicle to handle private matters on the way back from completing a transportation task, and a car accident occurred on the way, causing property losses to users", although the employee did not actually cause user losses in the process of performing work tasks, according to relevant legal provisions and precedents, since the employee's behavior had the appearance of performing work tasks, according to the appearanceism, it should be determined that the employee caused user losses in the process of performing work tasks, which falls within the scope of job-related torts, and the company should still bear the responsibility. It can be seen that the situation of this legal event is relatively complicated. Even if the lack of relevant necessary information in the question information entered by the user is not considered, the above-mentioned appearanceism provisions are not clearly recorded in the Civil Code and relevant judicial interpretations. If the large language model does not include relevant cases or minutes in the early training, the generated legal consulting advice will not cover the content related to appearanceism in job-related torts, that is, it can only generate relevant content based on the one-sided legal fact that the employee's non-job behavior tort is tortious, thereby generating legal consulting advice with the employee as the tortfeasor. Obviously, this legal consulting advice is inconsistent with actual judicial practice. In short, the existing large language models are still unable to provide users with more accurate legal advice in legal consulting scenarios.

[0067] Based on the above technical problems, the present application provides a question-and-answer method for legal consultation, a training method for a central control model and an electronic device, which can call a suitable legal model to process the question information input by the user, so as to provide the user with more accurate legal consultation opinions; and, in the case that the question information input by the user lacks necessary information, it can guide the user to provide more accurate question information by asking questions, thereby further providing the user with more accurate legal consultation opinions.

[0068] It should be noted that the training samples used in the training process of the neural network model involved in this application are all from authorized legal documents, judgments, case descriptions, etc., and the question-and-answer method of legal consultation and the conclusions obtained by the central control model provided in this application are only used to form consulting opinions for users' reference.

[0069] The following is a detailed explanation of the question-and-answer method for the legal consultation provided in this application.

[0070] Figure 1 A flowchart of a question-and-answer method for legal consultation provided in some embodiments of the present application, wherein: Figure 1 The question-answering method for legal consultation shown in Figure 1 can be applied to the central control model. Figure 1 As shown, the question-and-answer method for legal consultation may include steps 110 to 130.

[0071] Step 110 , in response to the first question information input by the user, determine the target legal model to be called from a plurality of preset legal models based on the first question information, and determine the calling order corresponding to the target legal model.

[0072] In some embodiments, the central control model may be a large language model LLM. In a legal consultation scenario, the central control model may receive question information input by a user (hereinafter referred to as first question information), and based on the first question information, call a suitable target legal model from a plurality of preset legal models, so that each target legal model obtains a corresponding processing result based on the first question information, and thus the central control model may provide legal consultation advice to the user based on the processing results obtained by each target legal model.

[0073] Exemplarily, the preset legal model may include a legal event detection model, a legal information extraction model, a condition determination model, a similar case retrieval model, etc. Among them, the legal event detection model is used to identify the legal event corresponding to the first question information; the legal information extraction model is used to extract the legal information (including entity information and entity relationships between entities) in the first question information, and the legal information determined by the legal information extraction model can be input into the legal event detection model, so that the legal event detection model can identify the legal event based on the legal information corresponding to the first question information; the condition determination model is used to determine the event determination information based on the legal event information corresponding to the first question information, so as to determine whether the legal event information obtained by the legal event detection model is accurate in combination with the event determination information and the first question information; the similar case retrieval model is used to retrieve similar legal cases and corresponding judgment results in existing legal cases according to the first question information, so as to generate legal consultation suggestions according to the retrieval results. The specific implementation of the above preset legal model is described in the subsequent embodiments.

[0074] In some examples, the central control model can call the legal event detection model to determine the legal event information involved in the first question information, and retrieve relevant legal cases and judgment results based on the legal event information. For example, if the first question information is "The contract signed between me and the other party is in a contract deadlock, can I request to terminate the contract?", it can be clearly stated that the legal event information corresponding to the first question information is "Contract termination under contract deadlock", so the central control model can call the legal event detection model to determine the legal event information corresponding to the first question information. In this case, the central control model can also call other legal models (such as legal article retrieval models, etc.) to retrieve relevant legal articles based on the legal event information to output to the user as legal advice.

[0075] In some examples, the central control model can also directly call the similar case retrieval model to retrieve legal cases similar to the first question information and the corresponding judgment results in the preset database to output to the user as legal consultation suggestions. In addition, the central control model can also call the legal event detection model and the similar case retrieval model at the same time.

[0076] In some examples, when the central control model calls the legal event detection model, it can also call the establishment condition determination model to determine the event determination information corresponding to the first question information, so as to verify the legal event detection results determined by the legal event detection model through the event determination information, thereby further ensuring the accuracy of the legal event detection results.

[0077] In the case where the first question information lacks necessary information, the central control model can generate an information slot (i.e., the second question information) based on the event determination information determined by the establishment condition determination model, and output it to the user in the form of a question, so that the user can supplement the first question information based on the second question information, thereby obtaining the complete first question information (i.e., the target question information). Then, the legal event detection model can perform legal event detection on the target question information and obtain the legal event detection result.

[0078] In some examples, when the central control model calls the legal event detection model, it can also call the legal information extraction model to extract the legal information (including entity information and entity relationships between entities) in the first question information, so that the legal event detection model can more accurately identify the legal event information based on the legal information corresponding to the first question information.

[0079] In some embodiments, when the central control model determines the target legal model to be called from the above-mentioned multiple preset legal models, it can determine the calling order of the target legal model. The number of target legal models can be one or more. When the number of target legal models is one, it is not necessary to determine the calling order; when the number of target legal models is multiple, the calling order of the target legal model can include parallel calling and / or sequential calling.

[0080] For example, if the target legal model to be called includes a legal event detection model, a legal information extraction model, a condition determination model and a similar case retrieval model, the calling order can be determined as follows: legal event detection model, legal information extraction model, condition determination model, legal event detection model; and the legal event detection model and the similar case retrieval model can be called in parallel.

[0081] Step 120 , calling the target legal models according to the calling sequence, and obtaining the processing results corresponding to the target legal models based on the first question information through the target legal models.

[0082] In some embodiments, after determining the target legal model to be called and the calling order corresponding to the target legal model, the central control model can perform corresponding processing based on the first question information through each target legal model, thereby obtaining the processing results corresponding to each target legal model. Among them, the processing results corresponding to each target legal model may include legal event information (i.e., target event information) determined by the legal event detection model, legal information (i.e., multiple entities and entity relationships between entities) determined by the legal information extraction model, event determination information determined by the establishment condition determination model, similar legal cases and judgment results (i.e., target preset text) determined by the similar case retrieval model, etc.

[0083] It can be understood that the processing performed by each target legal model based on the first question information can refer to the description in step 110 or subsequent embodiments, and will not be repeated here.

[0084] Step 130: Generate and output first reply information to the first question information based on the processing results corresponding to each target legal model.

[0085] In some embodiments, after each target legal model obtains a corresponding processing result, the central control model can integrate the relevant processing results to output final legal consulting advice to the user.

[0086] For example, the central control model can integrate the legal advice obtained based on the legal event detection model and the legal advice obtained based on the similar case retrieval model, so as to output the final legal advice to the user. For example, the final legal advice may include the definition of the legal event consulted by the user, the description of the responsibilities of both parties and the possible rights protection methods of the user, and the recommendation of the judgment of similar cases.

[0087] Through the above scheme, the central control model can call the appropriate target legal model for the legal consultation questions input by the user and determine the call order of the target legal model, so as to process the legal consultation questions through each target legal model in the call order, so as to provide users with more accurate legal consultation opinions. Through the coordinated use of the central control model and the legal model, the central control model only needs to perform the selection and call of the legal model and some underlying operations, and the legal model is responsible for the specific reasoning process, that is, the central control model focuses on short-term memory, and the legal model focuses on long-term memory. Through the combination of the two, the generated legal consultation suggestions can better meet the needs of users.

[0088] The following is an exemplary description of the implementation methods of each target legal model.

[0089] Figure 2A flowchart of another legal consultation question-and-answer method provided for some embodiments of the present application, such as Figure 2 As shown, the target legal model includes a legal event detection model and a legal information extraction model. In the above step 120, "obtaining processing results corresponding to each target legal model based on the first question information through each target legal model" may include steps 210 to 230.

[0090] Step 210: determine the entity relationships between the multiple entities in the first question information and the entities in the multiple entities through the legal information extraction model.

[0091] refer to Figure 3 A schematic diagram of a legal information extraction model is shown in FIG. Figure 3 As shown, the legal information extraction model 300 may include an entity extraction layer 30 and an entity relationship extraction layer 31. The entity extraction layer 30 includes a supervision model 310 and a content model 320; the entity relationship extraction layer 31 includes a graph neural network (GNN) model 330. The entity extraction layer 30 is used to determine the entity information in the first question information input by the user; the entity relationship extraction layer 31 is used to determine the entity relationship between entities based on the entity information in the first question information.

[0092] Exemplarily, the legal information extraction model 300 can extract features from the legal event detection results (i.e., historical legal events) obtained in the previous legal event detection process through the supervision model 310 in the entity extraction layer 30 to obtain a supervision vector, wherein the historical legal events can be determined by the legal event detection model 400; and extract legal elements from the first question information input by the user through the content model 320 in the entity extraction layer 30 to obtain multiple element features; then determine the content features based on the above multiple element features and the supervision vector through the content model 320, and determine the entity information in the first question information based on the content features. Then, the above content features are processed through the entity relationship extraction layer 31 in the legal information extraction model 300 to determine the entity relationship between each entity information.

[0093] For example, taking the first question information input by the user as "Zhang San borrowed 100,000 yuan from Li Si, and the two parties agreed to repay the loan one year later. One year later, Zhang San did not repay on time and ignored Li Si's reminders. Later, Li Si saw Zhang San walking on the road, so he hit Zhang San with a bicycle and caused minor injuries. Zhang San asked Li Si to pay for it, and Li Si left directly" as an example, after the first neural network model performs entity extraction on the first question information, the multiple entities obtained may include: Zhang San (character), Li Si (character), 100,000 yuan (loan amount), one year (loan time), bicycle (tool), minor injury (result); after the entity relationship extraction of the above multiple entities, the entity relationships between the entities obtained may include: Zhang San borrowed money from Li Si (loan relationship), Zhang San did not repay on time (breach of contract), Li Si urges for payment (collection behavior), Li Si hit Zhang San with a bicycle and left (personal infringement), Zhang San asked Li Si to pay for it (compensation request).

[0094] Furthermore, the entities and entity relationships corresponding to the question information obtained by the legal information extraction model 300 can be input into the legal event detection model 400, and the legal event detection model 400 can determine the legal event information corresponding to the first question information based on the above entity information and entity relationships.

[0095] Step 220 , determining the question information features corresponding to the first question information and the initial features corresponding to each entity based on the first question information and the multiple entities through the legal event detection model.

[0096] refer to Figure 4 A schematic diagram of a legal event detection model is shown in FIG. Figure 4 As shown, the legal event detection model 400 may include a first neural network model 410 , a second neural network model 420 , a third neural network model 430 , and a fourth neural network model 440 .

[0097] Exemplarily, the first neural network model 410 is a syntactic graph construction model. After the entities in the first question information and the entity relationships between the entities are obtained through the legal information extraction model 300, the corresponding syntactic graph can be constructed based on the above entities and the entity relationships between the entities through the first neural network model 410. The syntactic graph can represent all possible relationships between the entities (nodes).

[0098] Exemplarily, the second neural network model 420 may be a BERT model. The BERT model obtains multiple entities corresponding to the first question information and the first question information input by the user, and extracts context information corresponding to each entity in the first question information. The initial features corresponding to each entity determined by the BERT model usually cover a wider range, that is, they usually cover all possible contextual relationships related to each entity in the first question information. The BERT model can input the context information corresponding to each entity into the third neural network model 430 as the initial features corresponding to each entity. In addition, the BERT model can vectorize the first question information to obtain the question information features corresponding to the first question information.

[0099] Using the above example, the initial features corresponding to each entity in the first question information of the BERT model can be: Zhang San: [0.1, 0.2, 0.3, ...], Li Si: [0.2, 0.3, 0.4, ...], 100,000 RMB: [0.3, 0.4, 0.5, ...], one year: [0.4, 0.5, 0.6, ...], bicycle: [0.5, 0.6, 0.7, ...], minor injury: [0.8, 0.9, 0.7, ...]. It should be noted that the values ​​in the initial features corresponding to the above entities are only examples.

[0100] Step 230 , determining core information corresponding to the first question information through a legal event detection model based on multiple entities, entity relationships between entities, and initial features corresponding to each entity.

[0101] For example, Figure 4 As shown, since the initial features corresponding to each entity obtained by the BERT model usually cover a wider range, the initial features corresponding to each entity can be processed by the third neural network model 430 so that the initial features corresponding to each entity gradually converge to the core information corresponding to each entity and the core relationship between each entity.

[0102] The third neural network model 430 can be composed of a multi-layer graph convolutional network model (GCN). The third neural network model 430 obtains the syntactic graph determined by the syntactic graph construction model and the initial features corresponding to each entity determined by the BERT model, and updates the initial features corresponding to each entity layer by layer through each layer of GCN based on the syntactic graph and the initial features corresponding to each entity, using hierarchical propagation and aggregation of neighbor nodes; finally, the updated features corresponding to each entity obtained by the last layer of GCN are determined as the core information corresponding to the first question information, that is, the core information corresponding to each entity and the core relationship between each entity.

[0103] Step 240: Determine the target event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information through the legal event detection model.

[0104] For example, Figure 4 As shown, the fourth neural network model 440 can be a classification model, which can be implemented based on a fully connected layer, which is not limited in this embodiment. The core information corresponding to the first question information and the question information features corresponding to the first question information determined by the BERT model can be fused to obtain fused features; then the fused features are classified by the classification model, and the classification result obtained is the legal event information corresponding to the first question information (i.e., the target event information).

[0105] Through the above scheme, after calling the legal event detection model and the legal information extraction model, the central control model can extract the entities and entity relationships in the first question information input by the user through the legal information extraction model, and extract the contextual relationships corresponding to each entity in the first question information (that is, the initial features corresponding to each entity) through the BERT model in the legal event detection model, and update the initial features corresponding to each entity layer by layer through the multi-layer GCN model, so as to finally obtain the core information corresponding to each entity and the core relationship between each entity, and then accurately determine the legal event information corresponding to the first question information based on the core information corresponding to each entity and the core relationship between each entity through the classification model.

[0106] Figure 5 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Figure 5 As shown, the above step 210 may include steps 510 to 540.

[0107] Step 510, obtaining historical event information through the legal information extraction model, and vectorizing the historical event information to obtain a supervision vector.

[0108] In some embodiments, the legal information extraction model can obtain the question information input by the user and the historical event information corresponding to the question information determined by the legal event detection model. When the legal event detection model processes the question information for the first time, the historical event information can be the legal event detection result obtained by previously performing legal event detection on other question information.

[0109] In some embodiments, the supervision model in the legal information extraction model can vectorize the above historical event information to obtain a supervision vector, which is used to assist the content model to more accurately determine the entity information in the question information. The supervision model can be composed of a BERT model or a Transformer model.

[0110] Exemplarily, when the supervision model determines the supervision vector corresponding to the historical event information, it can determine the legal information type corresponding to the historical event information, and perform feature extraction (ie, vectorization processing) on ​​the legal information type to obtain the supervision vector.

[0111] In some examples, the question information input by the user is as follows: "A chemical plant was newly built upstream of my home this year. The output of my fish pond this year has dropped a lot compared to previous years. Some people in the village said that this is related to the illegal discharge of pollutants by the chemical plant, but we went to the factory to ask, and the person in charge insisted that they were discharging legally, and the change in fish pond output was caused by the climate. We don’t have evidence now, what should we do?" In the field of civil torts, the constituent elements of general tort incidents (i.e., legal information types) include tortious acts, damage facts, causal relationships, subjective faults, etc. When the legal event detection model determines that the historical event information corresponding to the above question information is "environmental pollution tort", the supervision model can determine that the legal information types corresponding to "environmental pollution tort" include tortious acts, damage facts, and causal relationships, and determine the supervision vectors corresponding to the above legal information types. In addition, since the burden of proof is reversed in causation in "environmental pollution infringement" incidents, when a user suffers losses due to environmental pollution and becomes the infringed party, there is no need to extract information related to the infringer's fault during the legal information extraction process, and the attention to causation should be low, or the causal relationship may not be paid attention to, that is, the supervision model can mark the causal relationship in the legal information type corresponding to the above historical event information as having low attention.

[0112] Step 520: extract features of the legal elements in the first question information through the legal information extraction model to obtain multiple element features corresponding to the first question information.

[0113] In some embodiments, the content model in the legal information extraction model can extract different types of legal elements in the question information to obtain multiple element features corresponding to the question information. That is, each element feature in the multiple element features corresponds to a different type. Among them, legal elements refer to common content existing in different legal fields. For example, multiple types of legal elements can include subject, object, behavior, object, subjective intention, etc.

[0114] In some embodiments, the content model may include multiple element extraction models. Each of the multiple element extraction models is used to extract different types of legal elements in the question information to obtain multiple different types of element features corresponding to the question information.

[0115] For example, in the process of classifying the legal elements in the question information, each element model can automatically complete the classification based on the training of a large amount of training data, so that each element model focuses on specific element features. On this basis, the identification of the element features that need to be identified can be set for each element model through manual annotation to enhance the classification effect of the model.

[0116] Continuing with the above example, after feature extraction of the question information input by the user in the content model, multiple different element features can be obtained, such as user-infringed party, chemical plant-infringer, environmental pollution infringement, chemical plant legality, climate-induced changes in production, etc. These element features cover all possible entities in the question information and the relationships between entities.

[0117] Step 530: Determine content features corresponding to the first question information through a legal information extraction model based on multiple element features and a supervision vector corresponding to the first question information, and determine multiple entities according to the content features.

[0118] In some embodiments, after obtaining the multiple element features and supervision vectors corresponding to the question information, the content model can further fuse the multiple element features and supervision vectors to obtain content features corresponding to the question information. The content features represent the multiple target entities corresponding to the question information.

[0119] Following the above example, after obtaining multiple element features and supervision vectors corresponding to the above question information, the content model can remotely supervise each element feature through the supervision vector, and assign weights corresponding to each element feature through the feature fusion layer in the content model, such as giving a larger weight to the element features related to the infringement and damage facts, and giving a smaller weight to the element features related to the causal relationship, and the remaining features can be ignored. Finally, the multiple element features after weight adjustment are fused to obtain the content features. The obtained content features focus on the two element features of the chemical plant's pollution discharge and the user's fish pond property loss, while the characterization of the element features of the causal relationship of climate causing product changes is relatively weak, indicating that there is no need to pay too much attention to the causal relationship in the subsequent reasoning process. In the above way, the content features output by the content model represent the key constituent elements in the environmental pollution infringement relationship between the user and the chemical plant, and exclude irrelevant entities and entity relationships such as the chemical plant's self-defense, so as to further improve the accuracy of subsequent legal event detection.

[0120] Step 540, extracting entity relationships from content features through the legal information extraction model to obtain entity relationships between entities.

[0121] In some embodiments, after determining multiple target entities corresponding to the question information through the supervision model and content model in the legal information extraction model, the graph neural network GNN in the legal information extraction model determines the entity relationship between the target entities based on the multiple target entities corresponding to the question information.

[0122] Exemplarily, the graph neural network GNN can construct a graph representation based on multiple target entities in the question information and the relationship between the target entities. Among them, each node in the graph representation is used to represent each target entity, and each edge in the graph representation is used to represent the relationship between the target entities. The graph neural network GNN can use the information transmission mechanism to update the characteristics of each node (entity) in the graph representation one by one, that is, based on the neighbor nodes corresponding to each node (that is, the nodes connected to it by edges) and the relationship between the neighbor nodes, the characteristics of each node are updated. After multiple information transmissions, the global characteristics of each node are finally obtained; the graph neural network GNN can predict the relationship between each target entity based on the global characteristics of each target entity to obtain the entity relationship between each target entity.

[0123] Through the above scheme, different types of legal element features in the question information can be extracted through the content model in the legal information extraction model, and multiple types of element features can be remotely supervised through the supervision model in the legal information extraction model to obtain content features. The content features can more accurately represent the entity information corresponding to the question information, thereby improving the accuracy of entity and entity relationship extraction in the legal consultation scenario. In addition, the GNN model in the legal information extraction model can realize the reasoning and extraction of complex entity relationships, improving the accuracy and effectiveness of legal information extraction.

[0124] Figure 6 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Figure 6 As shown, in the above step 530, "determining the content features corresponding to the first question information based on the multiple element features and the supervision vector corresponding to the first question information through the legal information extraction model" may include steps 610 to 630.

[0125] Step 610, concatenate or dot-multiply the supervision vector and each element feature through the legal information extraction model to obtain multiple first element features.

[0126] In some embodiments, after obtaining the above-mentioned supervision vector and multiple element features, the content model can concatenate or dot-multiply each element feature with the supervision vector to obtain multiple first element features, thereby realizing remote supervision of each element feature through the supervision vector. Among them, concatenating each element feature with the supervision vector can retain the original element feature on the basis of adding the supervision vector; dot-multiplying each element feature with the supervision vector can strengthen or weaken each element feature through the supervision vector, that is, increase or decrease the weight of each element feature.

[0127] For example, if the question information input by the user is "the discharge of pollutants from the upstream chemical plant has caused a sharp drop in the output of my fish pond, but the chemical plant claims that the discharge is legal", if the historical event information is "environmental pollution infringement", the supervision vector will vectorize the legal event type corresponding to "environmental pollution infringement" (including infringement behavior, damage facts and causal relationship), and the obtained supervision vector S = [s1, s2, ..., s n ]. If the element features obtained by each element extraction model after processing the question information are: Chemical Plant F1 = [f 11 ,f 12 ,…,f 1n ]、Fishpond F2=[f 21 ,f 22 ,…,f 2n ]、F3=[f 31 ,f 32 ,…,f 3n ], etc., then the above supervision vector S and each element feature F i After splicing, the first element features F can be obtained. i ′ =[F i ; S]; for the above supervision vector S and each element feature F i Performing dot multiplication, we can get the first element features F after dot multiplication. i ′ =[F i ·S].

[0128] Step 620, using the attention mechanism through the legal information extraction model to adjust the weight of each first factor feature in the multiple first factor features, to obtain multiple second factor features after the weight adjustment.

[0129] In some embodiments, the content model may further include a feature fusion layer. The feature fusion layer may use an attention mechanism to assign weights to each first element feature according to the importance of each first element feature, and obtain a plurality of second element features after weight adjustment.

[0130] Exemplarily, the feature fusion layer can use the attention mechanism to assign higher weights to the first-factor features with higher importance among the first-factor features (such as infringement and damage facts), and assign lower weights to the first-factor features with lower importance (such as causal relationships), thereby improving the accuracy of legal information extraction and further improving the accuracy of legal event detection.

[0131] Step 630, performing feature fusion processing on multiple second factor features through the legal information extraction model to obtain content features.

[0132] In some embodiments, after obtaining the above-mentioned multiple second factor features, the multiple second factor features are subjected to feature fusion processing through a feature fusion layer to obtain content features. The content features can characterize multiple target entities in the question information, such as "upstream chemical plant", "sharp drop in fish pond production", "pollution discharge", "legal discharge", etc.

[0133] Through the above scheme, after obtaining multiple element features corresponding to the question information through multiple element extraction models, the weight of each element feature can be further adjusted through the supervision vector and attention mechanism to strengthen or weaken the representation of each element feature, thereby improving the accuracy of legal information extraction.

[0134] Figure 7 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Figure 7 As shown, in the above step 530 , “determining multiple entities according to content characteristics” may include steps 710 to 740 .

[0135] Step 710 , perform sequence labeling on the content features to obtain multiple label sequences corresponding to the content features.

[0136] In some embodiments, based on the above-mentioned feature fusion layer, a conditional random field (CRF) layer can also be set in the content model. After obtaining the content features through the feature fusion layer, the content features can also be sequenced through the CRF layer to obtain multiple different sequence labeling results, that is, multiple different label sequences. Among them, each label sequence includes multiple label information.

[0137] For example, taking the content feature "the discharge of pollutants from the upstream chemical plant caused a sharp drop in the output of the fish pond, but the chemical plant claimed that the discharge was legal" as an example, if the preset label set includes B-subject (the entity of the category is marked as B), B-behavior, B-damage fact, I-behavior (internal supplementary information of the behavior) and O-non-entity, then the CRF layer performs sequence annotation on the above content features according to the above preset label set. The multiple label sequences obtained may include:

[0138] Y1 = {B-subject (upstream chemical plant), B-behavior (discharge of pollutants), O-non-entity (cause), B-damage fact (sharp drop in fish pond production), B-subject (upstream chemical plant), O-non-entity (claim), I-behavior (legal discharge)};

[0139] Y2 = {B-subject (upstream chemical plant), B-subject (discharge), B-behavior (cause), B-damage fact (sharp drop in fish pond output), B-subject (upstream chemical plant), B-subject (claim), I-behavior (legal discharge)};

[0140] Y3 = {B-behavior (upstream chemical plant), B-subject (pollution discharge), O-non-entity (cause), I-behavior (sharp drop in fish pond output), B-subject (upstream chemical plant), O-non-entity (claim), B-damage fact (legal discharge)}, etc.

[0141] Step 720: Determine the transition probability corresponding to each label sequence based on the multiple label information corresponding to each label sequence.

[0142] In some embodiments, after obtaining multiple label sequences, the CRF layer can determine the transition probability (or transition score) between multiple label information corresponding to each label sequence. Among them, the transition probability is used to characterize the dependency relationship between multiple label information corresponding to each label sequence. The transition probability reflects the semantic logical dependency between each label information in the sequence labeling task by quantifying this dependency. For example, if the transition probability corresponding to two label information is high, it means that the probability of the two label information appearing continuously is large, that is, it has a strong semantic association; if the transition probability corresponding to the two label information is low, it means that the continuity of the two label information is low, and usually does not have logical consistency.

[0143] For example, the transition probability between multiple label information can be determined based on the trained transition probability matrix, where the transition probability matrix is ​​used to represent the transition rules between the label information. The transition probability matrix A is a K×K matrix, where K is the number of preset label information in the preset label set; the element A[i,j] of the transition probability matrix represents the transition from label information y t-1 = i transfers to label information y t = j's transfer score. For example, if the label sequence is Y1 = {B-subject (upstream chemical plant), B-behavior (pollution discharge), B-damage fact (fish pond production sharply reduced), B-subject (upstream chemical plant), I-behavior (legal discharge)}, then A[B-subject, B-behavior] represents the probability of transfer from B-subject (upstream chemical plant) to B-behavior (pollution discharge).

[0144] For example, the transition probability matrix is:

[0145] For example, the label sequence Y1 = {B-subject (upstream chemical plant), B-behavior (discharge), O-non-entity (cause), B-damage fact (sharp drop in fish pond output), B-subject (upstream chemical plant), O-non-entity (claim), I-behavior (legal discharge)} corresponds to the transition probability: A[B-subject, B-behavior]+A[B-behavior, O-non-entity]+A[O-non-entity, B-damage fact]+A[B-damage fact, B-subject]+A[B-subject, O-non-entity]+A[O-non-entity, I-behavior]==0.8+0.1+0.2+0.0+0.1+0.0=1.2;

[0146] The corresponding transition probability of the label sequence Y2 = {B-subject (upstream chemical plant), B-subject (discharge), B-behavior (cause), B-damage fact (sharp drop in fish pond output), B-subject (upstream chemical plant), B-subject (claim), I-behavior (legal discharge)} is: A[B-subject, B-subject]+A[B-subject, B-behavior]+A[B-behavior, B-damage fact]+A[B-damage fact, B-subject]+[B-subject, B-subject]+A[B-subject, I-behavior]=0.0+0.8+0.0+0.0+0.0+0.0=0.8;

[0147] The transition probability corresponding to the label sequence Y3 = {B-behavior (upstream chemical plant), B-subject (pollution discharge), O-non-entity (cause), I-behavior (sharp drop in fish pond output), B-subject (upstream chemical plant), O-non-entity (claim), B-damage fact (legal discharge)} is: A[B-behavior, B-subject]+A[B-subject, O-non-entity]+A[O-non-entity, I-behavior]+A[I-behavior, B-subject]+A[B-subject, O-non-entity]+A[O-non-entity, B-damage fact]=0.5+0.1+0.0+0.0+0.1+0.2=0.9.

[0148] Step 730: Determine the conditional probability corresponding to each label sequence based on the transition probability corresponding to each label sequence.

[0149] In some embodiments, after determining the transition probability corresponding to each label sequence, the CRF layer can determine the conditional probability corresponding to each label sequence based on the transition probability corresponding to each label sequence. Exemplarily, the score function corresponding to each label sequence can be determined based on the transition probability corresponding to each label sequence; then the score function corresponding to each label sequence is log-likelihood estimated to determine the conditional probability corresponding to each label sequence. The score function is used to quantify the rationality of the label sequence relative to the input sequence (i.e., the content feature), that is, the degree of matching between the label sequence and the content feature.

[0150] In some examples, the conditional probability corresponding to each tag sequence can be determined according to formula (1):

[0151]

[0152] Among them, y t and t-1 is the tag information in the tag sequence, and X is the content feature. That is, the label sequence Y = {y1, y2, ..., y T} corresponding to the score function Score(X,Y). φ(y t ,y t-1 ,X) is the characteristic function, which can be determined based on the transition probability corresponding to the label sequence Y. Exponential function The log-likelihood used to calculate the score function uses an exponential function to ensure that all probability values ​​are non-negative, and the logarithmic property can be used to simplify the calculation of the CRF layer.

[0153] is the total score of all label sequences corresponding to the content features, It means that the total score is normalized to ensure the legitimacy of the conditional probability, that is, to ensure that the sum of the conditional probabilities of all label sequences is 1.

[0154] Step 740 , based on the conditional probabilities corresponding to the respective tag sequences, a target tag sequence is determined from the multiple tag sequences, and multiple target entities are determined according to the target tag sequence.

[0155] In some embodiments, after determining the conditional probabilities corresponding to each tag sequence, the CRF layer may use the Viterbi Algorithm to determine the target tag sequence with the largest conditional probability among multiple tag sequences. * In the process, the CRF layer calculates the label sequence with the highest conditional probability based on the transfer dependency (i.e., transfer probability) between each label information in the label sequence and the global information of the content features using an efficient dynamic programming method (such as the forward-backward algorithm). The target label sequence can represent multiple target entities corresponding to the question information.

[0156] Through the above process, for legal information extraction, the entities in the input consulting text often have complex contextual relationships and dependencies. Since the CRF layer can effectively utilize the dependencies between label information, it can greatly improve the accuracy and consistency of entity information extraction.

[0157] In some embodiments, the target legal model also includes a condition determination model, and the above method also includes: determining the current event information based on the entity and the entity relationship between each entity through the legal event detection model; when the current event information is different from the historical event information, the current event information is vectorized through the legal information extraction model to obtain the supervision vector corresponding to the current event information; determining multiple entities in the question information based on the supervision vector and multiple element features corresponding to the current event information through the legal information extraction model; determining the entity relationship between each entity in the multiple entities corresponding to the current event information based on the multiple entities corresponding to the current event information through the legal information extraction model.

[0158] Exemplarily, the above-mentioned entity information and entity relationships obtained by the legal information extraction model can be further input into the legal event detection model, and the legal event detection model determines the legal event information (i.e., current event information) corresponding to the first question information based on the entities and entity relationships corresponding to the first question information. In the case where the current event information is the same as the above-mentioned historical event information, the central control model can further search for legal cases or legal provisions based on the current event information to provide legal advice to users. In the case where the current event information is different from the above-mentioned historical event information, the information extraction model can extract legal information (including entities and entity relationships) from the first question information based on the current event information, so as to determine the legal event information again through the legal event detection model based on the entities and entity relationships obtained by this information extraction... and so on, until the current event information is the same as the historical event information.

[0159] Through the above scheme, the information extraction results obtained by the information extraction model can be fed back to the legal event detection model to re-determine the legal event information, so as to compare the legal event information determined in the previous legal event detection process with the legal event information determined in the current legal event detection process, thereby improving the accuracy of legal event detection.

[0160] Figure 8 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Figure 8 As shown, the above step 230 may include steps 810 to 830.

[0161] Step 810, determine a syntactic graph using the legal event detection model with each entity as a node and the entity relationships between entities as edges.

[0162] In some embodiments, after obtaining the above-mentioned multiple entities and entity relationships between the entities, a syntactic graph construction model in the legal event detection model can be used to construct a syntactic graph based on the multiple entities and entity relationships between the entities.

[0163] For example, when constructing a syntax graph, each entity is used as a node of the syntax graph, and the entity relationship between each entity is used as an edge between each node. Fig. 9 A schematic diagram of a syntax diagram is shown in Fig. 9 As shown, taking the first question information as "Zhang San and Li Si are neighbors. Zhang San borrowed RMB 100,000 from Li Si, and the two parties agreed to repay the loan in one year. One year later, Zhang San did not repay the loan on time and ignored Li Si's reminders. Later, Li Si saw Zhang San taking a walk on the road, so he hit Zhang San with a bicycle and caused minor injuries. Zhang San asked Li Si to pay for it, and Li Si left directly" as an example, the multiple nodes in the syntactic graph corresponding to the first question information are: Zhang San, Li Si, RMB 100,000, one year, bicycle, and minor injuries; the edges in the syntactic graph include: Zhang San---Neighbor---> Li Si, Zhang San---Loan---> RMB 100,000-Li Si, Zhang San---Breach of Contract---> One Year-Li Si, Li Si---Reminders---> Zhang San, Li Si-Bicycle---Hit Someone and Leave---> Minor Injury-Zhang San, Zhang San---Demand for Compensation---> Li Si.

[0164] Exemplarily, the syntactic graph can represent all the relationships between entities (nodes), and there may be some non-core relationships, such as "Zhang San and Li Si are neighbors", etc. Therefore, the entity relationships between the entities obtained can be subsequently processed by the third neural network model, so that the entity relationships between the entities gradually converge to the core relationships between the entities, so as to exclude the non-core relationships between the entities.

[0165] Step 820, based on the syntactic graph and the initial features corresponding to each entity, the initial features corresponding to each entity are updated through multiple neural network layers in the legal event detection model to obtain updated features of each node determined by each neural network layer in the multiple neural network layers.

[0166] In some embodiments, after obtaining the above-mentioned syntactic graph and the initial features corresponding to each entity determined by the BERT model, the initial features corresponding to each entity can be updated based on the syntactic graph and the initial features corresponding to each entity through a multi-layer graph convolutional network (GCN) in the legal event detection model.

[0167] Exemplarily, multi-layer GCN can update the features corresponding to each entity by hierarchical propagation and aggregation of neighbor node features. Taking the target node among multiple nodes as an example, the current features corresponding to the target node can be updated by the previous layer of GCN in the multi-layer GCN based on the current features corresponding to the target node and the current features corresponding to the neighbor nodes (i.e., adjacent nodes) of the target node, to obtain the updated features corresponding to the target node; and so on, until the updated features corresponding to the target node are obtained by the last layer of GCN in the multi-layer GCN. Among them, the current features corresponding to the target node in the first layer of GCN are the initial features corresponding to the target node.

[0168] In some embodiments, taking a target node among multiple nodes and the first two layers of GCN in a multi-layer GCN as an example, the first layer of GCN (i.e., the first neural network layer) first updates the initial features corresponding to the target node based on the initial features corresponding to the target node and the initial features corresponding to the adjacent nodes of the target node, and obtains the updated initial features corresponding to the target node (i.e., the first features).

[0169] Exemplarily, the first layer GCN can update the initial features corresponding to the target node based on the adjacency matrix corresponding to the syntactic graph, the self-loop matrix, the weight matrix corresponding to the first layer GCN, and the nonlinear activation function to obtain the first features corresponding to the target node.

[0170] In some examples, the method of updating the features of each node through the multi-layer GCN can refer to formula (2):

[0171]

[0172] Among them, H (l) The current features (H) corresponding to each node determined by the l-th layer GCN (0) That is, the initial feature corresponding to each node); H (l+1) is the updated feature corresponding to each node in the l+1th layer.

[0173] A is the N×N adjacency matrix corresponding to the syntax graph, which is used to represent the connection between each node and other nodes; if there is an edge between node i and node j, then A[i][j]=1; if there is no edge between node i and node j, then A[i][j]=0; I N is an N×N identity matrix, where N is the number of nodes; It means that each node in the syntactic graph is connected to itself, that is, the characteristics of the node itself are taken into account.

[0174] yes The degree matrix is ​​a diagonal matrix where each diagonal element It represents the degree of node i, that is, the number of edges connected to node i.

[0175] is the degree matrix The inverse square root of is used to normalize the adjacency matrix A to avoid the impact of large differences in node degrees on model training.

[0176] W (l) is the weight matrix corresponding to the l-th layer GCN, which is a trainable parameter matrix used to linearly transform node features.

[0177] σ is a nonlinear activation function, such as the Rectified Linear Unit (ReLU), which enables the third neural network model to capture complex patterns.

[0178] It means that the current feature H corresponding to the node determined by the l-th layer GCN is normalized by the adjacency matrix (l) To spread and aggregate; H (l) W (l) Indicates that the node features after propagation and aggregation are linearly transformed to obtain the node features after linear transformation; multiplying the updated node features by σ indicates that a nonlinear activation function is applied to the node features after linear transformation to increase the expression ability of the model, thereby obtaining the updated node features H (l+1) .

[0179] In some embodiments, after the first layer GCN obtains the first feature corresponding to the target node, the second layer GCN (i.e., the second neural network layer) updates the first feature corresponding to the target node based on the first feature corresponding to the target node and the first features corresponding to the adjacent nodes of the target node to obtain the updated first feature corresponding to the target node (i.e., the second feature).

[0180] Step 830, determining the updated features of each node determined by the last neural network layer in the multiple neural network layers as the core information corresponding to each entity and the core relationship between each entity.

[0181] In some embodiments, the updated features corresponding to each node obtained by the last layer GCN in the above-mentioned multi-layer GCN are the core information corresponding to each node and the core relationship between each entity, that is, the core information corresponding to each entity and the core relationship between each entity (that is, the core information corresponding to the first question information).

[0182] Through the above scheme, the multi-layer GCN structure can realize the layer-by-layer update of the relationship between entities represented by the syntactic graph and the entity context relationship represented by the initial features of the entity, and can exclude non-core entity information and non-core relationships between entities, thereby improving the convergence effect of entity core information and core relationships, and enabling better classification results to be obtained when subsequently classifying legal events based on entity information and entity relationships.

[0183] In some embodiments, the above step 240 may include: fusing the question information feature and the core information corresponding to the first question information to obtain a fused feature; and classifying the legal events corresponding to the fused feature through a legal information detection model to obtain target event information.

[0184] In some embodiments, after obtaining the core information corresponding to each entity and the core features between the entities (i.e., the core information corresponding to the first question information) through multi-layer GCN, the question information features corresponding to the first question information determined based on the BERT model and the core information corresponding to the first question information can be fused to obtain a fused feature representation. Exemplarily, the fusion of the question information features and the core information corresponding to the first question information can be achieved through concatenation, weighted summation, or attention mechanism. The specific fusion method is not limited in this embodiment.

[0185] In some embodiments, after determining the above fusion features, the legal events corresponding to the fusion features can be classified through the fourth neural network model to obtain one or more target event information. The fourth neural network model is a classification model, which can be implemented based on a fully connected (FC) layer, etc., which is not limited in this embodiment.

[0186] For example, for the first question information input by the user, "Zhang San and Li Si are neighbors. Zhang San borrowed 100,000 yuan from Li Si, and the two parties agreed to repay the loan in one year. One year later, Zhang San did not repay the loan on time and ignored Li Si's reminders. Later, Li Si saw Zhang San taking a walk on the road, so he hit Zhang San with a bicycle and injured him slightly. Zhang San asked Li Si to pay for it, and Li Si left directly", after being processed by the legal event detection model, it can be obtained that the target event information corresponding to the first question information is "not repaying debts" and "personal infringement".

[0187] Through the above scheme, the question information features corresponding to the first question information and the core information corresponding to the first question information are fused, so that the fourth neural network model can use the first question information as a reference in the process of classification prediction, thereby avoiding the problem of not being able to obtain accurate legal event detection results when the output of the multi-layer GCN deviates from the first question information.

[0188] Fig.10 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Fig.10 As shown, the above step 240 may include steps 1010 to 1040.

[0189] Step 1010: Determine first event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information through a legal event detection model.

[0190] In some embodiments, since the content of the first question information input by the user is usually colloquial, it may not be able to provide comprehensive information for legal event detection. In the case where the first question information currently input by the user lacks relevant necessary information, the event detection result obtained by the legal event detection model when performing legal event detection on the first question information is not accurate enough. Among them, necessary information refers to information used to accurately identify legal events. Therefore, in the case where the content of the first question information provided by the user lacks necessary information, the central control model can call the legal event establishment condition determination model (hereinafter referred to as the establishment condition determination model) and the legal event detection model in response to the first question information input by the user, so as to preliminarily determine the first event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information through the legal event detection model (at this time, it is still impossible to determine whether the first event information is consistent with the legal event actually consulted by the user); and determine the event determination information corresponding to the first event information through the establishment condition determination model, so as to determine the necessary information missing in the first question information through the event determination information.

[0191] It can be understood that the method of determining the first event information corresponding to the first question information can refer to the description of the above steps 210 to 240, which will not be repeated here.

[0192] refer to Fig.11 A legal consultation scenario diagram is shown in Figure 1. Fig.11As shown, taking the first question information 1101 input by the user in the user interface 10 of the central control model as "I and Party A have signed a three-year shop lease contract to lease the other party's shop, but since I can't make money now, can I request to terminate the lease contract in advance?" as an example, in the first question information 1101, since the reason for the operating loss is unclear, the basis for the party's request for contract termination may be a contract deadlock or a change of circumstances. Therefore, after the first event information corresponding to the first question information 1101 is determined by the legal event detection model (such as determining that the first event information is "contract termination under contract deadlock"), the event determination information corresponding to "contract termination under contract deadlock" can be determined through the establishment condition determination model, so as to determine the necessary information missing in the first question information through the event determination information.

[0193] Step 1020: determining event determination information based on the first event information by establishing a condition determination model, and determining and outputting second question information based on the event determination information and the first question information.

[0194] In some embodiments, then, the event judgment information can be determined based on the first event information through the establishment of a conditional judgment model, so that the central control model can generate corresponding second question information (or called information slot) based on the event judgment information and the first question information to ask questions to the user, so that the user can reply based on the second question information.

[0195] Using the above example, Fig.11 As shown, if the event judgment information corresponding to "contract termination under contract deadlock" determined by the establishment condition judgment model is: 1) Although the defaulting party breached the contract first, it was not a malicious breach; 2) If the defaulting party continues to perform the contract, it is unfair to the defaulting party; 3) The party that abides by the contract refuses to terminate the contract, which violates the principle of good faith; and according to the above first question information, it can be determined that the user is the defaulting party, but it is impossible to determine the reason for the user's business loss, so it is impossible to determine whether the user is a malicious breach of contract, and it is also impossible to determine whether continuing to perform the contract is unfair to the user. Therefore, the central control model can generate the corresponding second question information 1102 according to the above 1) and 2) event judgment information and output it to the user, such as the second question information 1102 can be "What is the reason for your business loss?", "Have you fully negotiated with the other party?", etc.

[0196] Step 1030: obtaining second reply information input by the user to the second question information through the legal event detection model, and determining the target question information based on the first question information and the second reply information.

[0197] In some embodiments, after the user inputs second reply information in response to the second question information output by the central control model, the legal event detection model can supplement and improve the first question information based on the second reply information to obtain the target question information.

[0198] Using the above example, Fig.11 As shown, if the second reply information 1103 input by the user to the above second question information 1102 is: "Because my capital chain is broken, I can't continue to operate. After negotiating with the other party, he insisted that I pay three years of rent", the legal event detection model can supplement the first question information 1101 based on the second reply information 1103 to obtain the target question information, such as "I signed a three-year shop lease contract with A to rent the other party's shop, but because my capital chain is broken, I can't continue to operate. After negotiating with the other party, he insisted that I pay three years of rent. Can I ask to terminate the lease contract in advance?". If the second reply information 1103 input by the user to the above second question information is: "Because the municipal construction caused the road in front of the shop to be blocked", the legal event detection model can supplement the first question information 1101 based on the second reply information 1103 to obtain the target question information, such as "I signed a three-year shop lease contract with A to rent the other party's shop, but because the municipal construction caused the road in front of the shop to be blocked, can I ask to terminate the lease contract in advance?".

[0199] Step 1040 , determining target event information based on the target question information features corresponding to the target question information and the core information corresponding to the target question information through the legal event detection model.

[0200] In some embodiments, after obtaining the above-mentioned target question information, the legal event detection model can further determine the target question information characteristics corresponding to the target question information and the core information corresponding to the target question information, thereby determining the second event information based on the target question information characteristics and the core information corresponding to the target question information.

[0201] Exemplarily, the second event information determined by the legal event detection model may be the same as the first event information, or may be different from the first event information. If the second event information is the same as the first event information, the second event information or the first event information may be determined as the target event information; if the second event information is different from the first event information, the newly detected second event information is determined as the target event information.

[0202] Continuing with the above example, when the target question information is "I signed a three-year shop lease contract with Party A to rent the other party's shop, but because my capital chain broke, I cannot continue to operate. After negotiating with the other party, he insisted that I pay three years of rent. Can I request to terminate the lease contract early?", the legal event detection model can determine that the second event information corresponding to the target question information is "Contract termination under contract deadlock". Therefore, the second event information is the same as the first event information, so it can be determined that the target event information is "Contract termination under contract deadlock".

[0203] When the target question information is "A and I signed a three-year shop lease contract to rent each other's shop, but because of municipal construction, the road in front of the shop is blocked. Can I request to terminate the lease contract early?", the legal event detection model can determine that the second event information corresponding to the target question information is "change of circumstances". Therefore, the second event information is different from the first event information, so the second event information can be determined as the target event information, that is, the target event information is "change of circumstances".

[0204] In some embodiments, after determining the final target event information, the central control model can call other legal tools to perform legal case retrieval or legal article retrieval based on the target event information to provide consulting opinions to users. Fig.11 As shown, if the target event information is determined to be "change of circumstances", the central control model can call other legal tools to retrieve and integrate legal cases or legal provisions related to contract termination under change of circumstances, obtain consulting opinions 1104 and output them to the user.

[0205] Through the above scheme, when necessary information is missing in the consultation information input by the user, the event judgment information can be determined by the legal event establishment condition judgment model, and an information slot can be generated based on the event judgment information; then, the user can be interacted with in the form of questions based on the information slot, so that the user can supplement and improve the consultation information to obtain the target question information, so that the legal event detection model can obtain more accurate legal event detection results based on the target question information.

[0206] Fig.12 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Fig.12 As shown, in the above step 1020 , “determining event determination information based on the first event information by establishing a condition determination model” may include steps 1210 to 1240 .

[0207] Step 1210: determine multiple preset texts associated with the first event information in a preset database based on the first event information by using a condition determination model.

[0208] In some embodiments, after the establishment condition determination model obtains the first event information output by the legal event detection model, it can retrieve the judgment document (i.e., preset text) related to the first event information in the preset data. For example, if the first question information input by the user is "I rented A's shop and signed a three-year lease contract, but now I am losing money due to an unexpected business, can I ask to terminate the lease contract early?", and after the legal event detection model processes the first question information, the first event information obtained is "Contract termination under contract deadlock", then the establishment condition determination model can retrieve the judgment document related to "Contract termination under contract deadlock" in the preset database.

[0209] Step 1220 , the first preset text is processed by the establishment condition determination model to obtain a plurality of search pairs corresponding to the first preset text.

[0210] In some embodiments, the condition determination model may then analyze any preset text (ie, the first preset text) among the plurality of preset texts through a large language model (LLM) to obtain a plurality of search pairs corresponding to the first preset text.

[0211] Each of the multiple search pairs includes a search identifier and a search content. The search identifier is used to represent a legal act or a legal event, such as "theft", "contract termination", "tort", etc. The search content is used to represent an entity associated with the legal act or legal event, such as "Zhang San", "5,000 yuan", "malicious breach of contract", etc. In the preset text, each legal act may correspond to one or more entities, and multiple different search pairs can be determined based on each legal act and each entity.

[0212] Step 1230 , clustering the multiple search pairs corresponding to the first preset text through the establishment condition determination model to obtain multiple candidate seed search pairs.

[0213] In some embodiments, after determining the multiple search pairs corresponding to the first preset text, the condition determination model can cluster the multiple search pairs through the large language model LLM to determine multiple candidate seed search pairs. Exemplarily, in order to avoid excessive burden on the model caused by clustering multiple search pairs at one time, multiple rounds of clustering can be used to cluster the multiple search pairs, and multiple rounds of clustering can also enable the next round of clustering process to learn the clustering results of the previous round, thereby improving the clustering effect.

[0214] Exemplarily, in each round of clustering, a preset number of search pairs (including seed search pairs obtained from the previous round of clustering and unclustered search pairs) can be selected and clustered to obtain multiple search pairs corresponding to each legal category in one or more legal categories, and then seed search pairs are determined from the multiple search pairs corresponding to each legal category. The seed search pairs are representative search pairs among the multiple search pairs corresponding to each legal category. After completing the clustering of all search pairs, the final multiple candidate seed search pairs can be obtained. Each candidate seed search pair corresponds to a legal category.

[0215] Among them, the legal category can be determined according to the legal field to which the legal case belongs or the specific type of the legal case, etc. For example, the legal category may include criminal law (such as intentional injury, theft), civil law (such as contract disputes, property inheritance), administrative law (such as administrative penalties), intellectual property law (such as patents, trademarks, copyrights), labor law (such as labor contracts, work-related injury compensation), etc.; or include contracts (such as lease contract disputes, sales contract disputes, service contract disputes), torts (such as personal injury compensation, traffic accident liability), labor disputes (such as labor contract termination, unpaid overtime wages), etc. It should be noted that the specific content of the above legal categories is only an example, and this is not limited in this embodiment.

[0216] Step 1240 , determining a target seed search pair that meets a preset condition from among multiple candidate seed search pairs by establishing a condition determination model, and determining the search content of the target seed search pair as event determination information.

[0217] In some embodiments, after determining the above-mentioned multiple candidate seed retrieval pairs, a target seed retrieval pair that meets the preset conditions can be determined from the above-mentioned multiple candidate seed retrieval pairs. Among them, the target seed retrieval pair can be a candidate retrieval pair with a high semantic association with the first event information, and the number of the target seed retrieval pairs can be one or more. Then, the event determination information corresponding to the first question information is determined based on the retrieval identifier and retrieval content of the above-mentioned target seed retrieval pair.

[0218] For example, if the first question information input by the user is "Can I terminate the shop lease contract?", the first event information obtained after legal event detection on the first question information is the termination of the contract under a contract deadlock, and the search identifier of the determined target seed search pair is "contract termination", and the search content is "it is obviously unfair for the defaulting party to continue to perform the contract", then the search content of the target seed search pair can be determined as the event judgment information corresponding to the first question information.

[0219] Through the above scheme, after the legal events involved in the consulting information input by the user are identified through the legal event detection model and the first event information is obtained, the corresponding event judgment information can be further determined based on the first event information, so that the accuracy of the above first event information can be determined based on the event judgment information and the consulting information.

[0220] Fig.13 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Fig.13 As shown, the above step 1230 may include steps 1310 to 1340.

[0221] Step 1310: In the current round of clustering, a plurality of first seed search pairs obtained in the previous round of clustering and a plurality of unclustered first search pairs are obtained by using the establishment condition determination model.

[0222] In some embodiments, during multiple rounds of clustering of multiple retrieval pairs corresponding to the first preset text, the current round of clustering process first obtains multiple seed retrieval pairs (i.e., first seed retrieval pairs) obtained by the previous round of clustering process and multiple retrieval pairs that have not been clustered (i.e., first retrieval pairs).

[0223] Exemplarily, take the case where the number of search pairs is 1000 and the preset number is 100. In the first round of clustering, 100 search pairs are selected from the 1000 search pairs for unsupervised clustering to obtain multiple search pairs corresponding to each of the multiple legal categories, and the first seed search pairs corresponding to each legal category are determined from the multiple search pairs corresponding to each legal category. If the number of first seed search pairs is 30, then in the second round of clustering, 70 unclustered first search pairs are selected from the remaining 900 search pairs (i.e., the sum of the number of first seed search pairs and first search pairs is equal to the preset number of 100), and the above 50 first seed search pairs and 70 first search pairs are clustered again.

[0224] Step 1320 , clustering the plurality of first seed search pairs and the plurality of first search pairs is performed through the establishment condition determination model to obtain a plurality of second search pairs corresponding to each of the plurality of legal categories.

[0225] In some embodiments, after the above-mentioned multiple first seed search pairs and multiple first search pairs are obtained through the previous round of clustering process, the multiple first seed search pairs and multiple first search pairs are subjected to unsupervised clustering through the current round of clustering process to obtain multiple second search pairs corresponding to each of the multiple legal categories. Using the above example, after clustering the above-mentioned 50 first seed search pairs and 70 first search pairs, multiple second search pairs corresponding to each legal category can be obtained, such as multiple second search pairs corresponding to 20 legal categories.

[0226] In some examples, an upper limit value for the number of legal categories obtained in each round of clustering process may be set, such as setting the number of legal categories obtained when clustering 100 search pairs in each round to be at most 60.

[0227] In some examples, different weights may be set for the search identifier and the search content during the clustering process. For example, the weight corresponding to the search identifier may be set to be smaller than the weight corresponding to the search content (e.g., the weight corresponding to the search identifier is set to 0.4, and the weight corresponding to the search content is set to 0.6), so that the basis for the establishment of the conditional determination model when clustering multiple search pairs will be more biased towards the search content of each search pair.

[0228] Step 1330, determine the second seed search pairs corresponding to each legal category among the multiple second search pairs corresponding to each legal category through the establishment condition judgment model, and determine multiple unclustered second search pairs among the multiple search pairs based on a preset number, multiple first search pairs and multiple second seed search pairs.

[0229] In some embodiments, after obtaining a plurality of second search pairs corresponding to each legal category through the clustering process of the current round, a representative second seed search pair is determined from the plurality of second search pairs corresponding to each legal category.

[0230] Exemplarily, the method for determining the second seed search pairs corresponding to each legal category can be based on the distance between each second search pair (such as Euclidean distance), or can be obtained by semantically summarizing multiple second search pairs corresponding to each legal category through a large language model, which is not limited in this embodiment.

[0231] In some embodiments, after the current round of clustering is completed, multiple unclustered second search pairs are obtained from the multiple search pairs according to a preset number, and the sum of the number of the multiple second search pairs and the number of the multiple second seed search pairs is equal to the preset number. Using the above example, if multiple second search pairs corresponding to 20 legal categories are obtained, the number of the multiple second seed search pairs determined is 20 (i.e., each legal category corresponds to a second seed search pair), and then 80 unclustered second search pairs are selected from the remaining 800 search pairs (i.e., the sum of the number of second seed search pairs and the number of second search pairs is equal to the preset number of 100), and the next round of clustering is performed on the above 20 second seed search pairs and 80 second search pairs.

[0232] Step 1340, clustering the multiple second seed retrieval pairs and the multiple second retrieval pairs in the next round of clustering process through the establishment condition judgment model until there are no unclustered retrieval pairs in the multiple retrieval pairs, and obtaining multiple candidate seed retrieval pairs determined by the last round of clustering process.

[0233] In some embodiments, the plurality of second seed search pairs and the plurality of second search pairs are clustered in the next round of clustering, and so on, until all the plurality of search pairs are clustered (i.e., there are no unclustered search pairs in the plurality of search pairs), and a plurality of candidate seed search pairs determined by the last round of clustering are obtained. Each of the plurality of candidate seed search pairs corresponds to a different legal category.

[0234] Through the above scheme, multiple search pairs corresponding to the first preset text can be clustered through multiple rounds of clustering, thereby improving the clustering effect, that is, obtaining more accurate classification results, and then determining more accurate event judgment information based on the seed search pairs.

[0235] In some embodiments, the above step 1330 of "determining the second seed search pair corresponding to each legal category among the multiple second search pairs corresponding to each legal category through the establishment condition determination model" may include: determining the semantic vector corresponding to each second search pair in each legal category through the establishment condition determination model; determining the total distance between each first semantic vector and the second semantic vector in each legal category based on the semantic vector corresponding to each second search pair through the establishment condition determination model; determining the target semantic vector with the shortest total distance to the second semantic vector among the multiple first semantic vectors through the establishment condition determination model, and determining the second search pair corresponding to the target semantic vector as the second seed search pair corresponding to each legal category.

[0236] In some embodiments, when determining the second seed search pairs corresponding to each legal category based on the distance (such as Euclidean distance) between each second search pair, the semantic vector corresponding to each second search pair in each legal category may be determined first. For example, the semantic vector corresponding to the search content of each second search pair may be determined.

[0237] For example, in the legal category of "contract termination", the search content of the second search pair and the semantic vectors corresponding to each search content are: S1 = "Although the defaulting party breached the contract first, it was not in bad faith", V1 = [0.8, 0.5]; S2 = "It is obviously unfair for the defaulting party to continue to perform the contract", V2 = [0.7, 0.6]; S3 = "The observant party refuses to terminate the contract, which violates the principle of good faith", V3 = [0.9, 0.4]. It should be noted that the specific values ​​of the semantic vectors corresponding to the above search contents are only examples.

[0238] In some embodiments, after determining the semantic vectors corresponding to each second search pair in each legal category, the distance (such as Euclidean distance) between the semantic vectors of each second search pair in each legal category and the semantic vectors of other second search pairs in the legal category is determined, that is, the distance between each first semantic vector and the second semantic vector in each legal category is determined, and the distance between each first semantic vector and the second semantic vector is added to obtain the total distance between each first semantic vector and the second semantic vector. The first semantic vector is a semantic vector corresponding to any second search pair among the multiple second search pairs corresponding to each legal category, and the second semantic vector is a semantic vector corresponding to a second search pair other than the second search pair corresponding to the first semantic vector.

[0239] Using the above example, in the second search pair S1, S2 and S3, the Euclidean distance between the semantic vector V1 of the second search pair S1 and the semantic vector V2 of S2 is The Euclidean distance between the semantic vector V1 of the second search pair S1 and the semantic vector V3 of S3 Then the total distance between the semantic vector V1 of the second search pair S1 and the semantic vectors of the second search pair S2 and S3 is

[0240] Similarly, the total distance between the semantic vector V2 of the second search pair S2 and the semantic vector V1 of the second search pair S1 and the semantic vector V3 of the second search pair S3 can be determined. And the total distance between the semantic vector V3 of the second search pair S3 and the semantic vector V1 of the second search pair S1 and the semantic vector V2 of the second search pair S2

[0241]

[0242] In some embodiments, after obtaining the total distances corresponding to the above-mentioned first semantic vectors, the first semantic vector with the shortest total distance can be determined as the target semantic vector, and the second search pair corresponding to the target semantic vector is the second seed search pair corresponding to the legal category to which it belongs.

[0243] Continuing with the above example, among the total distance D1 corresponding to the semantic vector V1 of the second search pair S1, the total distance D2 corresponding to the semantic vector V2 of the second search pair S2, and the total distance D3 corresponding to the semantic vector V3 of the second search pair S3, the total distance D1 has the smallest value. Therefore, the semantic vector V1 of the second search pair S1 can be determined as the target semantic vector, and the second search pair S1 is the second seed search pair in the legal category of "contract termination".

[0244] Through the above scheme, when determining the seed retrieval pair, by determining the sum of the distances between the semantic vectors of each retrieval pair in each legal category and the semantic vectors of all other retrieval pairs, and selecting the retrieval pair with the smallest sum of distances as the seed retrieval pair, the representativeness and centrality of the seed retrieval pair can be ensured, thereby ensuring the accuracy of the event judgment information determined based on the seed retrieval pair.

[0245] In some embodiments, the "determining a target seed retrieval pair that meets a preset condition among multiple candidate seed retrieval pairs through a condition determination model" in the above-mentioned step 1240 may include: determining a target confidence score for each candidate seed retrieval pair among multiple candidate seed retrieval pairs through a condition determination model; determining a candidate seed retrieval pair among multiple candidate seed retrieval pairs whose target confidence score is greater than or equal to a preset score as a target seed retrieval pair through a condition determination model.

[0246] In some embodiments, after finally obtaining the candidate seed retrieval pairs corresponding to each legal category through multiple rounds of clustering, the target confidence score of each candidate seed retrieval pair can be determined according to a preset scoring rule.

[0247] Among them, the target confidence score may be related to the degree of association between each candidate seed retrieval pair and the first event information, and the number of retrieval pairs in the legal category corresponding to each candidate seed retrieval pair. For example, the higher the degree of association between each candidate seed retrieval pair and the first event information, and the more retrieval pairs in the legal category corresponding to each candidate seed retrieval pair, the higher the target confidence score of each candidate seed retrieval pair; conversely, the lower the degree of association between each candidate seed retrieval pair and the first event information, and the fewer retrieval pairs in the legal category corresponding to each candidate seed retrieval pair, the lower the target confidence score of each candidate seed retrieval pair.

[0248] In some embodiments, when determining the target confidence score of each candidate seed retrieval pair, the first confidence score of each candidate seed retrieval pair may be determined according to the correlation between each candidate seed retrieval pair and the first event information. The higher the correlation between each candidate seed retrieval pair and the first event information, the higher the first confidence score of each candidate seed retrieval pair.

[0249] In some embodiments, the second confidence score of each candidate seed search pair can be determined according to the number of search pairs in the legal category corresponding to each candidate seed search pair, wherein the more search pairs each candidate seed search pair corresponds to, the higher the second confidence score of each candidate seed search pair.

[0250] In some embodiments, after determining the first confidence score and the second confidence score corresponding to each candidate seed retrieval pair, the target confidence score corresponding to each candidate seed retrieval pair can be determined according to the sum of the first confidence score and the second confidence score. For example, if the first confidence score score1 corresponding to the candidate seed retrieval pair S1 is 80 and the second confidence score score2 is 60, then the target confidence score corresponding to the candidate seed retrieval pair S1 is score=score1+score2=80+60=140.

[0251] Exemplarily, different weights may be set for the first confidence score and the second confidence score, respectively, and the target confidence score may be determined based on the first confidence score, the second confidence score and the corresponding weights. Using the above example, if the weight of the first confidence score is set to 0.6 and the weight of the second confidence score is set to 0.4, then the target confidence score corresponding to the candidate seed retrieval pair S1 is score = 0.6 × score1 + 0.4 × score2 = 0.6 × 80 + 0.4 × 60 = 72.

[0252] In some embodiments, then, candidate seed retrieval pairs whose target confidence scores are greater than or equal to the preset scores can be determined from multiple candidate seed retrieval pairs, and these candidate seed retrieval pairs are determined as target seed retrieval pairs. For example, if the target confidence score corresponding to candidate seed retrieval pair S1 is 80, the target confidence score corresponding to candidate seed retrieval pair S2 is 60, the target confidence score corresponding to candidate seed retrieval pair S3 is 50, the target confidence score corresponding to candidate seed retrieval pair S4 is 30, the target confidence score corresponding to candidate seed retrieval pair S5 is 70, and the preset score is 60, then the candidate seed retrieval pair S1, candidate seed retrieval pair S2, and candidate seed retrieval pair S5 whose target confidence scores are greater than or equal to 60 are target seed retrieval pairs.

[0253] Through the above scheme, the confidence score of each candidate seed retrieval pair is determined based on the correlation between each candidate seed retrieval pair and the first event information and the number of retrieval pairs in the legal category corresponding to each candidate seed retrieval pair, so that the target seed retrieval pair determined based on the confidence score of each candidate seed retrieval pair can be more relevant to the first event information and can more accurately represent each legal category, thereby further improving the accuracy of the subsequent determination of whether the first event information is established based on the target seed retrieval pair. Determining the confidence score of each candidate seed retrieval pair based on the correlation between each candidate seed retrieval pair and the first event information can improve the accuracy when determining the target seed retrieval pair; determining the confidence score of each candidate seed retrieval pair based on the number of retrieval pairs corresponding to each candidate seed retrieval pair can improve the universality when determining the target seed retrieval pair, improve the generalization ability, and reduce the problem of overfitting.

[0254] Fig.14 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Fig.14 As shown, the “determining the search content of the target seed search pair as event determination information” in the above step 1240 may include steps 1410 to 1440 .

[0255] Step 1410: If the ratio of the number of target seed search pairs to the number of multiple candidate seed search pairs is greater than or equal to a preset ratio, the search content of the target seed search pair is determined as event determination information.

[0256] In some embodiments, after obtaining multiple candidate seed retrieval pairs and determining the target confidence score of each candidate seed retrieval pair, it can be further determined whether the number of target seed retrieval pairs reaches a certain proportion in all candidate seed retrieval pairs. Exemplarily, the ratio of the number of target seed retrieval pairs to the number of all candidate seed retrieval pairs can be determined, and it can be determined whether the ratio is greater than or equal to a preset ratio. If the proportion of the target seed retrieval pair in all candidate seed retrieval pairs is greater than the preset ratio, the retrieval content of the target seed retrieval pair is determined as the event determination information corresponding to the first question information.

[0257] For example, if the total number of candidate seed search pairs is 5, the number of target seed search pairs is 3, and the preset ratio is 0.6, then the proportion of target seed search pairs in candidate seed search pairs is 3 / 5=0.6, that is, the proportion of target seed search pairs is equal to the preset ratio, so the search content of the target seed search pair can be determined as the event determination information corresponding to the first question information. If the search content of the target seed search pair S1 is "although the defaulting party breached the contract first, it was not a malicious breach of contract", the search content of the target seed search pair S2 is "the defaulting party continues to perform the contract, which is obviously unfair to it", and the search content of the target seed search pair S3 is "the abiding party refuses to terminate the contract, which violates the principle of good faith", then the event determination information corresponding to the first question information is the above search content.

[0258] Step 1420, if the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is less than a preset ratio, and the number of times the clustering is executed in a loop is less than or equal to the preset number of executions, then continue to cluster the multiple retrieval pairs until the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is greater than or equal to the preset ratio, or the number of times the clustering is executed in a loop is greater than the preset number of executions.

[0259] In some embodiments, if the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is less than a preset ratio, and the number of times multiple rounds of clustering are re-executed (i.e., the number of times clustering is cyclically executed) is less than or equal to the preset number of executions, then multiple rounds of clustering can be re-performed on the multiple retrieval pairs corresponding to the first preset text until the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs obtained is greater than or equal to the preset ratio, or the number of times multiple rounds of clustering are re-executed is greater than the preset number of executions.

[0260] For example, if the total number of candidate seed retrieval pairs corresponding to the first preset text is 10, the number of target seed retrieval pairs is 2, and the preset ratio is 0.6, and the preset number of executions is 5 times, then the proportion of target seed retrieval pairs in the candidate seed retrieval pairs is 2 / 10=0.2, that is, the proportion of target seed retrieval pairs is less than the preset ratio. Then, when the number of re-executions of multiple rounds of clustering is less than or equal to 5 times, the multiple retrieval pairs corresponding to the first preset text can be re-clustered for multiple rounds until the proportion of target seed retrieval pairs corresponding to the first preset text in the candidate seed retrieval pairs is greater than the preset ratio of 0.6, or the number of re-executions of multiple rounds of clustering is greater than 5 times.

[0261] Step 1430: If the number of times the clustering is executed in a loop is greater than the preset number of times, a second preset text among the plurality of preset texts is processed to obtain a plurality of search pairs corresponding to the second preset text.

[0262] In some embodiments, if after multiple re-clustering (such as the number of times the clustering is executed in a loop is greater than the preset number of executions), the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is still less than the preset ratio, then the establishment condition judgment model can re-select any preset text other than the first preset text (i.e., the second preset text) from the multiple preset texts, and process the second preset text to obtain multiple retrieval pairs corresponding to the second preset text.

[0263] Step 1440, clustering the multiple search pairs corresponding to the second preset text to determine the target seed search pair corresponding to the second preset text, and determining the search content of the target seed search pair corresponding to the second preset text as the event determination information corresponding to the first question information.

[0264] In some embodiments, the conditional determination model performs multiple rounds of clustering on the multiple search pairs corresponding to the second preset text to determine the multiple candidate seed search pairs and the target seed search pairs corresponding to the second preset text. If the ratio of the number of target seed search pairs corresponding to the second preset text to the number of multiple candidate seed search pairs corresponding to the second preset text is greater than or equal to the preset ratio, the search content of the target seed search pair is determined as event determination information; if the ratio of the number of target seed search pairs corresponding to the second preset text to the number of multiple candidate seed search pairs is less than the preset ratio, and the number of clustering cycles is less than or equal to the preset number of executions, the multiple search pairs continue to be clustered. And so on, until the ratio of the number of target seed search pairs corresponding to the second preset text to the number of multiple candidate seed search pairs is greater than or equal to the preset ratio, or the number of re-executions of multiple rounds of clustering is greater than the preset number of executions.

[0265] If it is impossible to obtain a target seed retrieval pair from the second preset text that can serve as the event judgment information corresponding to the first question information, continue to obtain any preset text (i.e., the third preset text) other than the first preset text and the second preset text from the multiple preset texts, and process the third preset text...and so on, until the target seed retrieval pair corresponding to any preset text among the multiple preset texts can serve as the event judgment information corresponding to the first question information, or all the preset texts cannot provide event judgment information corresponding to the first question information.

[0266] Fig.15 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Fig.15 As shown, the target legal model includes a similar case retrieval model, and the above step 120 of "obtaining the processing results corresponding to each target legal model based on the first question information through each target legal model" may include steps 1510 to 1530.

[0267] Step 1510: Acquire multiple preset texts through a similar case retrieval model, and determine feature information corresponding to each of the multiple preset texts and feature information corresponding to the first question information.

[0268] refer to Fig.16 The schematic diagram of a similar case retrieval model is shown in FIG. Fig.16 As shown, the similar case retrieval model 1600 may include a fifth neural network model 1610 , a sixth neural network model 1620 , a seventh neural network model 1630 and an eighth neural network model 1640 .

[0269] Exemplarily, the fifth neural network model 1610 may be a BERT model; the sixth neural network model 1620 may be a Convolutional Neural Network (CNN) model; the seventh neural network model 1630 may include a multi-layer bidirectional long short-term memory network (Bi-directional Long Short-Term Memory, Bi-LSTM) model and a conditional random field (Conditional Random Fields, CRF) layer; the eighth neural network model 1640 may be a term frequency-inverse document frequency (Term Frequency-Inverse Document Frequency, TF-IDF) model.

[0270] Exemplarily, the fifth neural network model 1610 (i.e., the BERT model) can obtain the first question information and multiple preset texts input by the user, and perform feature extraction on each preset text and the first question information in the multiple preset texts, to obtain the overall semantic features and word semantic features corresponding to each preset text and the first question information. Among them, the overall semantic features corresponding to each preset text and the first question information represent the chapter-level semantic features (i.e., the semantic features of the entire preset text) corresponding to each preset text and the first question information, and the word semantic features corresponding to each preset text and the first question information represent the semantic features corresponding to each word in each preset text and the first question information.

[0271] The sixth neural network model 1620 (i.e., the convolutional neural network model) can obtain the overall semantic features corresponding to each preset text and the first question information determined by the BERT model, and determine the core sentence features corresponding to each preset text and the first question information based on the overall semantic features corresponding to each preset text and the first question information. The core sentence features corresponding to each preset text and the first question information represent the core semantic features corresponding to each sentence in each preset text and the first question information.

[0272] The seventh neural network model 1630 can obtain the word semantic features corresponding to each preset text and the first question information determined by the BERT model, and based on the word semantic features corresponding to each preset text and the first question information, respectively sequence the sentences in each preset text and the first question information to determine the label information corresponding to each sentence in each preset text and the first question information, and the label information represents the legal meaning of each sentence.

[0273] The eighth neural network model 1640 can identify idiomatic sentences in each preset text. It is understandable that idiomatic sentences are not important for the similarity matching process, and idiomatic sentences also appear frequently in judgments. Therefore, a large number of idiomatic sentences in judgments that are irrelevant to similarity matching will increase the calculation amount of similarity matching, and have a greater negative impact on similarity matching. Thus, the similar case retrieval model 1600 can identify idiomatic sentences in each preset text through the eighth neural network model 1640, and does not use the idiomatic sentences in each preset text for similarity calculation.

[0274] In some embodiments, the preset text in the preset database may be a judgment of an existing legal case. The similar case retrieval model may retrieve similar case judgments in the preset database for the first question information input by the user, so that the similar case judgments may be used as the basis for legal advice, or the case judgments may be directly output for user reference.

[0275] In some embodiments, after obtaining the first question information and multiple preset texts, the feature information corresponding to each preset text and the feature information corresponding to the first question information can be determined through a similar case retrieval model, wherein the feature information includes overall semantic features, core sentence features and label information.

[0276] Step 1520: Determine the similarity between the first question information and each preset text based on the feature information corresponding to each preset text and the first question information through a similar case retrieval model.

[0277] In some embodiments, after determining the feature information corresponding to each preset text and the first question information, the similar case retrieval model can fuse the feature information corresponding to each preset text (such as vector concatenation or weighted fusion, etc.) to obtain the fused feature information corresponding to each preset text; and fuse the feature information corresponding to the first question information to obtain the fused feature information corresponding to the first question information. Then, based on the fused feature information corresponding to each preset text and the fused feature information corresponding to the first question information, the similarity between each preset text and the first question information is determined.

[0278] Step 1530 , determining and outputting a target preset text from a plurality of preset texts based on the similarity between the first question information and each preset text through a similar case retrieval model.

[0279] In some embodiments, the similar case retrieval model may then determine and output a target preset text from a plurality of preset texts based on the similarity between the first question information and each preset text.

[0280] Exemplarily, the similar case retrieval model can determine the preset text with a similarity greater than a preset similarity threshold as the target preset text among multiple preset texts based on the similarity corresponding to the above preset texts and output it; or, it can also sort the multiple preset texts in descending order based on the similarity corresponding to the above preset texts, and select the first N (N is a positive integer) preset texts from the sorted multiple preset texts as the target preset texts and output them. It should be noted that the above method of determining the target preset text among multiple preset texts based on similarity is only an example and is not limited to this in this embodiment.

[0281] In some embodiments, after determining the similarity between the first question information and each preset text, the similar case retrieval model can sort each preset text according to the similarity and obtain a sorting result. For example, each preset text can be sorted in descending order according to the similarity, that is, sorting each preset text from high to low; or, each preset text can be sorted in ascending order according to the similarity, that is, sorting each preset text from low to high.

[0282] In some embodiments, after obtaining the sorting result, the similar case retrieval model can determine one or more target preset texts to be output from the multiple preset texts according to the sorting result. Exemplarily, when the multiple preset texts are sorted in descending order, the first N preset texts in the sorting result can be determined as the target preset texts; wherein N is a positive integer. The first N target preset texts are the preset texts that are most similar to the first question information.

[0283] In some embodiments, after determining the target preset text, the similar case retrieval model can output the target preset text through the user interface of the central control system to provide consulting results to the user.

[0284] Through the above scheme, the similar case retrieval model can perform feature extraction on the legal consulting information input by the user (i.e., the first question information) and the judgment in the database (i.e., the preset text) to obtain different levels of feature information corresponding to each preset text and the first question information (including overall semantic features, core sentence meaning features and label information), and determine the similarity between each preset text and the first question information based on the different levels of feature information corresponding to each preset text and the first question information, thereby improving the effect of similarity matching and improving the accuracy of similar case retrieval.

[0285] Fig.17 A flowchart of another legal consultation question-and-answer method provided in some embodiments of the present application, such as Fig.17 As shown, in the above step 1510 , “determining feature information corresponding to each preset text among a plurality of preset texts” may include steps 1710 to 1730 .

[0286] Step 1710, determining the overall semantic features and word semantic features corresponding to each preset text through a similar case retrieval model.

[0287] In some embodiments, the BERT model can obtain the first question information and multiple preset texts input by the user, and perform feature extraction on each preset text in the multiple preset texts and the first question information to obtain the overall semantic features and word semantic features corresponding to each preset text and the first question information.

[0288] Exemplarily, the BERT model includes multiple encoding layers, each of which outputs the features of the text (i.e., feature extraction results). Among them, the last few encoding layers in the BERT model can capture the deeper global semantic features corresponding to the text, and the first few encoding layers can capture the shallower local semantic features corresponding to the text (such as the semantic features of each word in the text). That is, the lower the number of layers of the BERT model, the more the text features extracted by the BERT model can represent the semantic features of each word in the text; the higher the number of layers of the BERT model, the more the text features extracted by the BERT model can represent the chapter-level semantic features of the text. Therefore, in order to obtain different levels of semantic features corresponding to each preset text and the first question information, the second encoding layer in the BERT model can be a different encoding layer from the first encoding layer.

[0289] The number of layers of the first coding layer may be less than the number of layers of the second coding layer. For example, the first coding layer may be a relatively early coding layer in the BERT model, such as the second coding layer in the BERT model; the second coding layer in the BERT model may be a relatively late coding layer in the BERT model, such as the second coding layer may be the last coding layer in the BERT model.

[0290] In some embodiments, after obtaining the first feature extraction results corresponding to each preset text and the first question information respectively through the first encoding layer in the BERT model, the first feature extraction results corresponding to each preset text can be determined as the word semantic features corresponding to each preset text, and the first feature extraction results corresponding to the first question information can be determined as the word semantic features corresponding to the first question information. After obtaining the second feature extraction results corresponding to each preset text and the first question information respectively through the second encoding layer in the BERT model, the second feature extraction results corresponding to each preset text can be determined as the overall semantic features corresponding to each preset text, and the second feature extraction results corresponding to the first question information can be determined as the overall semantic features corresponding to the first question information.

[0291] Step 1720, determining the core sentence features corresponding to each preset text based on the overall semantic features corresponding to each preset text through a similar case retrieval model.

[0292] In some embodiments, the Convolutional Neural Network (CNN) model can obtain the overall semantic features corresponding to each preset text and the first question information determined by the BERT model, and respectively determine the core sentence semantic features corresponding to each preset text and the first question information based on the overall semantic features corresponding to each preset text and the first question information. Among them, the core sentence semantic features corresponding to each preset text and the first question information represent the core semantic features corresponding to each sentence in each preset text and the first question information.

[0293] In some embodiments, the second neural network model in the case-based retrieval model can determine the core semantic features of each preset text and the first question information based on the overall semantic features corresponding to each preset text and the first question information output by the first neural network model.

[0294] Exemplarily, the CNN model can divide the sentences in each preset text and the first question information based on the overall semantic features corresponding to each preset text and the first question information. For example, it can split the multiple sentences in each preset text and the first question information according to ". ". After determining the multiple sentences in each preset text and the first question information, the CNN model can perform semantic analysis on each sentence in each preset text and the first question information to determine the core semantic features of each sentence.

[0295] Exemplarily, during the process of the CNN model performing semantic analysis on each of the above sentences, the weights of non-core words and expressions (such as words and expressions like "of", "this court", "according to", etc.) can be reduced, so that the semantic features of each sentence obtained can represent the core meaning of each sentence.

[0296] Step 1730: Determine the label information corresponding to each preset text through the case-based retrieval model based on the word and expression semantic features corresponding to each preset text.

[0297] In some embodiments, the seventh neural network model (including a multi-layer Bi-LSTM model and a CRF layer) can obtain the word and expression semantic features corresponding to each preset text and the first question information determined by the BERT model, and respectively perform sequence labeling on the sentences in each preset text and the first question information based on the word and expression semantic features corresponding to each preset text and the first question information to determine the label information corresponding to each sentence in each preset text and the first question information, and this label information represents the legal meaning of each sentence.

[0298] Exemplarily, the seventh neural network model can perform sequence annotation on different parts of each sentence in each preset text and the first question information in units of words to extract key information in the sentence. In some examples, the seventh neural network model can annotate each sentence according to the preset label information to determine the legal meaning of each part in each sentence, that is, to determine the key information of each sentence. Among them, the preset label information can include elements of a crime, crime, legal basis, etc., which are not limited in this embodiment.

[0299] For example, in the sentence "Wang accidentally stepped on the accelerator, causing three people to be seriously injured, and Wang was fully responsible for the accident. According to Article 133 of the Criminal Law and Article 2 of the Interpretation of the Supreme People's Court on Several Issues Concerning the Specific Application of Laws in the Trial of Criminal Cases of Traffic Accidents, Wang's behavior constituted the crime of traffic accident", the label information of "Wang accidentally stepped on the accelerator, causing three people to be seriously injured, and Wang was fully responsible for the accident" can be "elements of the crime"; the label information of "according to Article 133 of the Criminal Law and Article 2 of the Interpretation of the Supreme People's Court on Several Issues Concerning the Specific Application of Laws in the Trial of Criminal Cases of Traffic Accidents" can be "legal basis"; the label information of "Wang's behavior constitutes the crime of traffic accident" can be "crime".

[0300] Through the above scheme, the overall semantic features, word semantic features, core sentence features and label information corresponding to each preset text and the first question information can be determined through the similar case retrieval model, that is, the feature information of different levels corresponding to each preset text and the first question information can be obtained, thereby improving the effect of similarity matching and improving the accuracy of similar case retrieval.

[0301] In some embodiments, the above method further includes: identifying idiomatic sentences in each preset text through a similar case retrieval model, and determining a processed preset text according to the idiomatic sentences in each preset text.

[0302] Exemplarily, after determining the overall semantic features, core sentence features and label information corresponding to each preset text and the first question information, the eighth neural network model (i.e., TFIDF model) in the similar case retrieval model can also be used to identify idiomatic sentences in each preset text, such as "The above evidence has been cross-examined in court in accordance with the law, and this court confirms it", "If you are dissatisfied with this judgment, you may submit a complaint to this court within ten days from the second day after receiving the judgment..." and other idiomatic sentences, so as to eliminate the influence of idiomatic sentences on the similarity matching between each preset text and the first question information.

[0303] Exemplarily, after determining the idiomatic sentences in each preset text, the idiomatic sentences in each preset text may be deleted from each preset text, or the weight of the idiomatic sentences in each preset text may be reduced, thereby obtaining a processed preset text.

[0304] In some embodiments, the above step 1520 includes: determining the similarity between the first question information and the processed preset text through a similar case retrieval model based on the overall semantic features, core sentence features and label information corresponding to the processed preset text and the first question information.

[0305] Exemplarily, after determining the processed preset text, the similarity between the first question information and the processed preset text can be determined through a similar case retrieval model based on the overall semantic features, core sentence features and label information corresponding to the processed preset text and the first question information.

[0306] Through the above solution, the TFIDF model can identify idiomatic sentences in the preset text that are likely to have a negative impact on similarity matching, so as not to use the idiomatic sentences for similarity calculation, thereby further improving the accuracy of similarity matching.

[0307] In some embodiments, the above step 1510 of "determining feature information corresponding to each preset text in multiple preset texts and feature information corresponding to the first question information" includes: determining the first event information corresponding to the first question information based on the question information features corresponding to the first question information and the core information corresponding to the first question information through a legal event detection model; determining event determination information based on the first event information through a condition determination model, and determining and outputting the second question information based on the event determination information and the first question information; obtaining the second reply information input by the user to the second question information through a similar case retrieval model, and determining the target question information based on the first question information and the second reply information; determining the feature information corresponding to each preset text and the feature information corresponding to the target question information through a similar case retrieval model.

[0308] Exemplarily, when the first question information currently input by the user lacks necessary information, after the similar case retrieval model matches the first question information with multiple preset texts in the preset database for similarity, the legal judgment results involving the multiple target preset texts that are relatively similar to the first question information may be based on different case situations. Therefore, if the corresponding multiple target preset texts are obtained directly based on the first question information that lacks necessary information and are output to the user, it will not be possible to provide the user with a good consulting result, and it will cause the user to distinguish and choose between different judgment results, thereby reducing the user experience. Therefore, the central control system can call other legal tools to obtain event judgment information for determining the necessary information missing in the first question information.

[0309] Therefore, the legal event (i.e., the first event information) corresponding to the first question information can be preliminarily determined through the legal event detection model. Then, the legal event establishment condition determination model determines the event determination information based on the first event information. The central control system generates the corresponding second question information (or information slot) based on the event determination information to ask the user, so that the user can reply based on the second question information. The similar case retrieval model can supplement and improve the original first question information based on the second reply information input by the user to obtain the target question information; then the target question information is matched with multiple preset texts for similarity, so as to provide users with better consulting results.

[0310] refer to Fig.18 A scenario diagram of similar case retrieval is shown in FIG. Fig.18 As shown, the first question information 1801 input by the user in the user interface 10 of the central control system is "I was hit by a car, can I defend my rights?" In the scenario involved in the first question information 1801, there may be criminal liability and civil liability in traffic accidents, and whether the user can defend his rights also involves information such as the allocation of accident responsibilities between the parties. Therefore, the central control system can determine the lack of necessary information such as the allocation of accident responsibilities (such as whether the user is at fault, whether the responsibility is clear), the degree of injury (minor or serious injury), whether the driver is suspected of drunk driving, drug driving or hit-and-run (whether criminal liability is involved), whether the police have been called and the accident identification certificate has been obtained in the first question information 1801 through legal tools such as legal event detection tools, legal information extraction tools, and legal event establishment condition determination tools; and generate corresponding one or more second question information 1802 based on the above one or more necessary information, such as "Who is responsible for the accident between you and the other party?", "Is the other party suspected of drunk driving, drug driving or hit-and-run?", "Is your injury level minor or serious?", etc. Thus, the user can reply to the second question text 802 of the necessary information output by the central control system, such as "the other party bears the responsibility for the accident", "the other party did not flee, but was suspected of drunk driving", "the degree of injury is minor", etc. Further, the similar case retrieval model can obtain the user's second reply information 1803, and supplement and improve the first question information 1801 based on the second reply information 1803 to obtain the target question information; then the target question information is matched with multiple preset texts for similarity, so as to output the final legal consultation result 1804 for the user.

[0311] Through the above scheme, when the consulting information input by the user lacks necessary information, the central control system can interact with the user by asking questions, so that the user can provide some necessary information that can make the similar case retrieval results more accurate based on the question information output by the central control system. In this way, the similar case retrieval model can perform similarity matching with the existing preset text based on the consulting information input by the user and the supplementary necessary information, so as to achieve more accurate similar case retrieval, and then provide users with better similar case retrieval results.

[0312] Fig.19 A flowchart of a training method for a central control model provided in some embodiments of the present application, wherein: Fig.19 The training method of the central control model shown in FIG. 1 can be applied to the central control model. Fig.19 As shown, the training method of the central control model may include steps 1910 to 1930.

[0313] Step 1910: Obtain a scored first training sample and an unscored second training sample through any language model, and score the second training sample based on the first training sample to obtain a seed sample.

[0314] refer to Fig. 20 The training diagram of a central control model is shown in FIG. Fig. 20 As shown, during the training of the central control model 2000, the central control model 2000 may include a first language model 2010 and a reward model 2020. The first language model 2010 is used to determine the legal model to be called according to the question information, and the reward model 2020 is used to score the legal model selected by the first language model 2010, so that the selection of the first language model 2010 is as inclined as possible to the optimal solution.

[0315] In some embodiments, the first language model may be fine-tuned (SFT) in advance by obtaining training samples related to legal consultation. The training samples include legal consultation questions and corresponding reply information. This training process is to ensure that the replies generated by the first language model 2010 are in the legal field, that is, to avoid generating reply information in other fields.

[0316] For example, the above training samples can be: Consultation question: "In the traffic accident, the insurance company and the driver who caused the accident all turned a blind eye. The injured were dragged to the hospital and the family members have been treating them on their own. How should the lawyer deal with it?", reply information: "1. Collect evidence: Collect all evidence related to the accident as soon as possible, such as photos, videos, eyewitness testimonies, etc., so that sufficient evidence can be provided when seeking legal means in the future. 2. Contact a lawyer: Seek the help of a professional lawyer to understand your rights and possible legal means. The lawyer will help you analyze the case and provide you with professional legal advice and action guidelines. 3. Communication and negotiation: Try to communicate with the insurance company and the driver who caused the accident, Understand their attitude and willingness, and strive to reach a settlement agreement. If the two parties cannot reach an agreement, they can seek help from a third-party mediation agency. 4. Litigation procedure: If the negotiation fails, you can consider resolving the problem through litigation. In this process, the lawyer will file a lawsuit on your behalf in court and strive to obtain reasonable compensation for you. 5. Pay attention to treatment: During the treatment process, make sure to pay close attention to the condition of the injured person and ensure that they receive timely and effective treatment. At the same time, keep all treatment-related expense receipts for future claims. Please note that these are just some suggestions and the specific circumstances may vary from case to case. It is recommended that you consult a professional lawyer to obtain legal advice for your specific situation. "

[0317] In some embodiments, the reward model can also be pre-trained. When training the reward model, consulting questions related to legal consultation, the selected legal model, and the processing results generated by the legal model can be obtained as a set of training samples. Among them, the legal model selected in the first training sample can be any legal model among multiple preset legal models, that is, the selected legal model does not have to match the consulting question. For example, the first training sample can be: {"Consulting question": "The neighbor's grandfather had a car accident. What compensation can he get?", "Legal model": "Legal event detection model", "Processing result": "Car accident"}.

[0318] After obtaining the above-mentioned multiple sets of training samples, some training samples can be selected and manually scored to obtain multiple sets of scored training samples (i.e., first training samples). Exemplarily, the legal models corresponding to the above-mentioned training samples can be scored manually. The scoring rule can be: the higher the accuracy of the processing result generated by the legal model, the higher the score.

[0319] Next, the manually scored first training sample can be input into any large language model, so that the large language model automatically scores the unscored training samples (i.e., the second training samples) in the above multiple groups of training samples based on the scored first training samples, thereby obtaining multiple groups of seed samples.

[0320] Step 1920: Train the reward model to be trained based on the seed sample to obtain a trained reward model.

[0321] In some embodiments, after obtaining the above-mentioned multiple groups of seed samples, each group of seed samples in the multiple groups of seed samples can be scored by the reward model to obtain the score corresponding to each group of seed samples, thereby completing the training of the reward model.

[0322] Exemplarily, the reward model can score the legal tools selected in each group of seed samples, and fine-tune the reward model using a low-rank adaptation (LoRA) method to make the scoring results of the reward model closer to the actual scoring results.

[0323] Step 1930: Train the first language model to be trained based on the trained reward model and the third training sample to obtain the trained first language model.

[0324] In some embodiments, after obtaining the above-mentioned trained reward model, consulting questions related to legal consultation can be obtained as third question samples, and multiple groups of third training samples can be input into the first language model to be trained to train the first language model to be trained.

[0325] The first language model can select the legal model to be called (i.e., the first target model) based on the third question sample, so as to generate the corresponding processing result based on the third question sample through the first target model. Therefore, the third question sample, the selected first target model, and the processing result generated by the first target model can be input into the reward model as the third question sample, so as to score the first target model selected by the first language model based on the third training sample through the reward model to obtain the scoring result. Then, the first language model is optimized based on the above scoring result to obtain the trained first language model. After completing the training of the reward model and the first language model, the trained central control model can be obtained.

[0326] Through the above scheme, the first language model can be trained through the reward model to obtain the central control model after training. The central control model after training can accurately call the corresponding legal model based on the legal consultation information input by the user to provide the user with more ideal legal consultation suggestions. In addition, there is no need to have too high requirements for the scoring accuracy of the reward model, as long as it meets the preset range, so that the fine-tuning of the reward model can be made less difficult.

[0327] In some embodiments, the "scoring the second training sample based on the first training sample to obtain a seed sample" in the above step 1910 includes: scoring the second model corresponding to the second training sample based on the first training sample, the first model score corresponding to the first training sample and the second training sample through any language model to obtain a second score corresponding to the second model, and determining the seed sample based on the second training sample and the second score.

[0328] Exemplarily, after manually scoring the legal models corresponding to each training sample, a scored first training sample and an unscored second training sample are obtained. The first training sample includes a first question sample, a legal model corresponding to the first question sample (i.e., the first model), a first processing result sample generated by the first model, and a first score corresponding to the first model; the second training sample includes a second question sample, a legal model corresponding to the second question sample (i.e., the second model), and a second processing result sample generated by the second model.

[0329] After the scored first training sample is input into any large language model, the large language model can score the second model corresponding to the unscored second training sample according to the first training sample to obtain a seed sample. The seed sample includes the second question sample, the second model, the second processing result sample, and the scoring result of the second model (i.e., the second score). For example, the seed sample obtained by the automatic scoring of the above large language model is as follows:

[0330] {"Hint":"Please play the role of a professional labeler to score the data. Scoring rules: Based on the consulting question entered by the user in the first training sample, the selected legal model and the processing result generated by the legal model, judge whether the selected legal model is reasonable. The score is 0 to 1","First training sample":"Consulting question: The old grandfather of the neighbor's house had a car accident. What compensation can he get? Selected legal model: [Legal event detection] Processing result: "car accident","Score":"1.0"}.

[0331] In some embodiments, the above step 1920 includes: scoring the seed samples respectively through multiple scoring models to obtain multiple scores corresponding to the seed samples; determining the target score corresponding to the seed samples based on the multiple scores corresponding to the seed samples through the reward model to be trained, and obtaining the trained reward model.

[0332] Exemplarily, the reward model may include multiple scoring models, and the scoring model may be a large language model. Each scoring model may score multiple groups of seed samples during training, that is, each group of seed samples corresponds to multiple scores; and the scoring process of each scoring model is independent of each other.

[0333] For example, the reward model can use a voting mechanism to process the scores corresponding to the seed samples determined by multiple scoring models. For example, the reward model can use the average score determined by multiple scoring models as the target score corresponding to each group of seed samples. In this way, the target scores corresponding to all seed samples can be generated by the reward model, thereby completing the training of the reward model.

[0334] Fig.21 A flowchart of another method for training a central control model provided in some embodiments of the present application, such as Fig.21 As shown, the above step 1930 may include steps 2110 to 2140.

[0335] Step 2110: Determine a first target model to be called from a plurality of preset legal models based on the third question sample using the first language model to be trained.

[0336] In some embodiments, the first language model may select a legal model to be called (ie, a first target model) based on the third question sample. The number of the first target models may be one or more.

[0337] Step 2120: Obtain, through the first language model to be trained, a third processing result sample obtained after the target model processes the third question sample.

[0338] In some embodiments, the first target model can generate a corresponding processing result (i.e., a third processing result sample) based on the third question sample, so that the third question sample, the first target model, and the third processing result sample can be input into the trained reward model as a third training sample.

[0339] Step 2130: Score the first target model based on the third training sample using the trained reward model to obtain a third score.

[0340] In some embodiments, the trained reward model may score the first target model selected by the first language model based on the third training sample to obtain a third score corresponding to the third training sample.

[0341] Step 2140: Optimize the parameters of the first language model to be trained based on the third score, and obtain the trained first language model.

[0342] In some embodiments, the first language model can then be optimized based on the third score corresponding to the third training sample to obtain a trained first language model. Exemplarily, the LoRA weights (i.e., parameters) of the first language model can be optimized based on the third score corresponding to the third training sample in a proximal strategy optimization manner to obtain a trained first language model. After completing the training of the reward model and the first language model, the trained central control model can be obtained.

[0343] Through the above scheme, the legal model selected by the first language model to be trained can be scored by the trained reward model to achieve reward feedback during the training process of the first language model, thereby ensuring that the first language model can call the appropriate legal model for the legal consultation questions input by the user.

[0344] Fig. 22 A flowchart of another method for training a central control model provided in some embodiments of the present application, such as Fig. 22 As shown, the above step 2140 may include steps 2210 to 2240.

[0345] Step 2210: Obtain a third question sample through the second language model, and determine a second target model to be called from multiple preset legal models based on the third question sample.

[0346] In some embodiments, Fig. 20 As shown, during the training of the first language model, a penalty can be added to the scoring result (i.e., the third score) of the reward model, that is, a second language model is introduced to further ensure that the legal model selected by the first language model is more stable and reliable based on the output of the second language model, and to improve the generalization ability of the first language model.

[0347] In some embodiments, the third question sample may be first input into the second language model, so as to determine the legal model to be called (i.e., the second target model) from among multiple preset legal models based on the third question sample through the second language model. The second language model may be a language model that has not been fine-tuned in a supervised manner; and the number of the second target models may be one or more.

[0348] Step 2220: Obtain a fourth processing result sample obtained by the second target model based on the third question sample.

[0349] In some embodiments, after the second language model calls the second target model, the third question sample is processed by the second target model to obtain a processing result (ie, a fourth processing result sample).

[0350] Step 2230: determine a divergence value based on the third processing result sample and the fourth processing result sample, and determine a loss function based on the third score and the divergence value.

[0351] In some embodiments, then, a KL (Kullback-Leibler) divergence value can be determined based on the third processing result sample obtained by the first language model through the first model and the fourth processing result sample obtained by the second language model through the second model. The KL divergence value is used to measure the probability distribution difference between the third processing result sample corresponding to the first language model and the fourth processing result sample corresponding to the second language model.

[0352] In some embodiments, the loss function may be determined based on the difference between a third score obtained by scoring the first target model based on the trained reward model and the KL divergence value.

[0353] Exemplarily, the loss function can be determined according to formula (3):

[0354] R(x,y)=r(x,y)-δKL(x,y); (3)

[0355] Among them, R(x,y) is the loss function; r(x,y) is the third score obtained by the trained reward model; the penalty term KL(x,y) is the KL divergence value between the first language model and the second language model; the hyperparameter δ is the weight coefficient of the KL divergence value, which is used to control the penalty intensity of the KL divergence value on the difference between the third processing result sample output by the first language model and the fourth processing result sample output by the second language model.

[0356] Step 2240: Optimize the parameters of the first language model to be trained based on the loss function, and obtain the trained first language model.

[0357] In some embodiments, based on the above loss function, the parameters of the first language model to be trained can be optimized to maximize the reward function r(x, y) and minimize the KL divergence value, thereby obtaining the trained first language model.

[0358] Through the above scheme, during the training process of the first language model, the second language model is introduced to increase the penalty on the output of the first language model, so as to avoid the first language model from over-relying on the feedback of the reward model, thereby avoiding the overfitting phenomenon of the first language model and improving the diversity of the output of the first language model.

[0359] Fig.23 A schematic diagram of a legal consultation question-and-answer device provided in some embodiments of the present application. Fig.23As shown, the question-and-answer device 2300 for legal consultation includes a determination module 2301 , a calling module 2302 and an output module 2303 .

[0360] The first determination module 2301 is configured to respond to the first question information input by the user, determine the target legal model to be called from multiple preset legal models based on the first question information, and determine the calling order corresponding to the target legal models.

[0361] The calling module 2302 is configured to call the target legal models according to the calling sequence, and obtain the processing results corresponding to each target legal model based on the first question information through each target legal model.

[0362] The output module 2303 is configured to generate and output first reply information to the first question information based on the processing results corresponding to each target legal model.

[0363] In some embodiments, the target legal model includes a legal event detection model and a legal information extraction model; the calling module 2302 is specifically configured to: determine multiple entities in the first question information and the entity relationships between each entity in the multiple entities through the legal information extraction model; determine the question information features corresponding to the first question information and the initial features corresponding to each entity based on the first question information and the multiple entities through the legal event detection model; wherein the initial features corresponding to each entity represent the context information corresponding to each entity; determine the core information corresponding to the first question information through the legal event detection model based on the multiple entities, the entity relationships between each entity and the initial features corresponding to each entity; determine the target event information corresponding to the first question information through the legal event detection model based on the question information features and the core information corresponding to the first question information; wherein the processing results corresponding to each target legal model include the target event information determined by the legal event detection model.

[0364] In some embodiments, the core information corresponding to the first question information includes the core information corresponding to each entity in the first question information and the core relationship between each entity; the calling module 2302 is specifically configured to: determine a syntactic graph through a legal event detection model with each entity as a node and the entity relationship between each entity as an edge; update the initial features corresponding to each entity based on the syntactic graph and the initial features corresponding to each entity through multiple neural network layers in the legal event detection model, and obtain updated features of each node determined by each neural network layer in the multiple neural network layers; determine the updated features of each node determined by the last neural network layer in the multiple neural network layers as the core information corresponding to each entity and the core relationship between each entity.

[0365] In some embodiments, the calling module 2302 is specifically configured to: obtain historical event information through a legal information extraction model, and vectorize the historical event information to obtain a supervision vector; extract features of the legal elements in the first question information through the legal information extraction model to obtain multiple element features corresponding to the first question information; determine the content features corresponding to the first question information based on the multiple element features and the supervision vector corresponding to the first question information through the legal information extraction model, and determine multiple entities based on the content features; extract entity relationships from the content features through the legal information extraction model to obtain entity relationships between entities; wherein the processing results corresponding to each target legal model include multiple entities determined by the legal information extraction model and the entity relationships between entities.

[0366] In some embodiments, the calling module 2302 is specifically configured as follows: concatenating or dot-multiplying the supervision vector and each element feature through a legal information extraction model to obtain a plurality of first element features; adjusting the weight of each first element feature in the plurality of first element features using an attention mechanism through the legal information extraction model to obtain a plurality of second element features after weight adjustment; performing feature fusion processing on the plurality of second element features through the legal information extraction model to obtain content features.

[0367] like Fig.23 As shown, the question-and-answer device 2300 for legal consultation further includes: a second determination module 2304 , a processing module 2305 , a third determination module 2306 , and a fourth determination module 2307 .

[0368] The second determination module 2304 is configured to: determine the current event information through the legal event detection model based on the entity and the entity relationship between each entity; the processing module 2305 is configured to: when the current event information is different from the historical event information, vectorize the current event information through the legal information extraction model to obtain the supervision vector corresponding to the current event information; the third determination module 2306 is configured to: determine the multiple entities in the question information through the legal information extraction model based on the supervision vector corresponding to the current event information and multiple element features; the fourth determination module 2307 is configured to: determine the entity relationship between each entity in the multiple entities corresponding to the current event information based on the multiple entities corresponding to the current event information through the legal information extraction model.

[0369] In some embodiments, the target legal model also includes a condition determination model; the calling module 2302 is specifically configured to: determine the first event information corresponding to the first question information through the legal event detection model based on the question information characteristics and the core information corresponding to the first question information; determine the event determination information based on the first event information through the condition determination model, and determine and output the second question information based on the event determination information and the first question information; obtain the second reply information input by the user to the second question information through the legal event detection model, and determine the target question information based on the first question information and the second reply information; determine the target event information based on the target question information characteristics corresponding to the target question information and the core information corresponding to the target question information through the legal event detection model.

[0370] In some embodiments, the calling module 2302 is specifically configured to: determine multiple preset texts associated with the first event information in a preset database based on the first event information through a condition determination model; process the first preset text through the condition determination model to obtain multiple retrieval pairs corresponding to the first preset text; wherein the first preset text is any preset text among the multiple preset texts, and each retrieval pair in the multiple retrieval pairs includes a retrieval identifier and a retrieval content; cluster the multiple retrieval pairs corresponding to the first preset text through the condition determination model to obtain multiple candidate seed retrieval pairs; determine a target seed retrieval pair that meets the preset conditions among the multiple candidate seed retrieval pairs through the condition determination model, and determine the retrieval content of the target seed retrieval pair as event determination information; wherein the processing results corresponding to each target legal model include the event determination information determined by the condition determination model.

[0371] In some embodiments, the calling module 2302 is specifically configured as follows: in the clustering process of the current round, a plurality of first seed retrieval pairs and a plurality of unclustered first retrieval pairs obtained in the clustering process of the previous round are obtained through the establishment condition determination model; wherein the plurality of retrieval pairs include a plurality of first seed retrieval pairs and a plurality of first retrieval pairs, and the sum of the number of the plurality of first seed retrieval pairs and the plurality of first retrieval pairs is equal to a preset number; the plurality of first seed retrieval pairs and the plurality of first retrieval pairs are clustered through the establishment condition determination model to obtain a plurality of second retrieval pairs corresponding to each legal category in the plurality of legal categories; the plurality of first seed retrieval pairs and the plurality of first retrieval pairs are clustered through the establishment condition determination model The model determines the second seed search pairs corresponding to each legal category among the multiple second search pairs corresponding to each legal category, and determines the multiple unclustered second search pairs among the multiple search pairs according to the preset number, the multiple first search pairs and the multiple second seed search pairs; the multiple second seed search pairs and the multiple second search pairs are clustered in the next round of clustering process through the establishment condition judgment model until there are no unclustered search pairs in the multiple search pairs, and multiple candidate seed search pairs determined by the last round of clustering process are obtained; wherein each candidate seed search pair in the multiple candidate seed search pairs corresponds to a different legal category.

[0372] In some embodiments, the calling module 2302 is specifically configured to: determine the semantic vector corresponding to each second retrieval pair in each legal category through the establishment condition judgment model; determine the total distance between each first semantic vector and the second semantic vector in each legal category based on the semantic vector corresponding to each second retrieval pair through the establishment condition judgment model; wherein the first semantic vector is the semantic vector corresponding to any second retrieval pair among the multiple second retrieval pairs corresponding to each legal category, and the second semantic vector is the semantic vector corresponding to the second retrieval pair other than the second retrieval pair corresponding to the first semantic vector; determine the target semantic vector with the shortest total distance to the second semantic vector among the multiple first semantic vectors through the establishment condition judgment model, and determine the second retrieval pair corresponding to the target semantic vector as the second seed retrieval pair corresponding to each legal category.

[0373] In some embodiments, the calling module 2302 is specifically configured to: determine the target confidence score of each candidate seed retrieval pair among multiple candidate seed retrieval pairs through a conditional determination model; wherein the target confidence score is related to the correlation between each candidate seed retrieval pair and the first event information, and the number of retrieval pairs in the legal category corresponding to each candidate seed retrieval pair; and determine the candidate seed retrieval pairs among multiple candidate seed retrieval pairs whose target confidence score is greater than or equal to a preset score as the target seed retrieval pair through the conditional determination model.

[0374] In some embodiments, the calling module 2302 is specifically configured as follows: if the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is greater than or equal to a preset ratio, the retrieval content of the target seed retrieval pairs is determined as event determination information; if the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is less than a preset ratio, and the number of times the clustering is executed in a loop is less than or equal to the preset number of executions, the multiple retrieval pairs continue to be clustered until the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is greater than or equal to the preset ratio, or the number of times the clustering is executed in a loop is greater than the preset number of executions; if the number of times the clustering is executed in a loop is greater than the preset number of executions, the second preset text among the multiple preset texts is processed to obtain multiple retrieval pairs corresponding to the second preset text; wherein the second preset text is any preset text among the multiple preset texts except the first preset text; the multiple retrieval pairs corresponding to the second preset text are clustered to determine the target seed retrieval pair corresponding to the second preset text, and the retrieval content of the target seed retrieval pair corresponding to the second preset text is determined as the event determination information corresponding to the first question information.

[0375] In some embodiments, the target legal model includes a similar case retrieval model; the calling module 2302 is specifically configured to: obtain multiple preset texts through a similar case retrieval model, and determine the feature information corresponding to each preset text in the multiple preset texts and the feature information corresponding to the first question information; wherein the feature information includes overall semantic features, core sentence features and label information; determine the similarity between the first question information and each preset text based on the feature information corresponding to each preset text and the feature information corresponding to the first question information through a similar case retrieval model; determine and output the target preset text from multiple preset texts based on the similarity between the first question information and each preset text through a similar case retrieval model; wherein the processing results corresponding to each target legal model include the target preset text determined by the similar case retrieval model.

[0376] In some embodiments, the calling module 2302 is specifically configured to: determine the overall semantic features and word semantic features corresponding to each preset text through a similar case retrieval model; determine the core sentence meaning features corresponding to each preset text based on the overall semantic features corresponding to each preset text through a similar case retrieval model; determine the label information corresponding to each preset text based on the word semantic features corresponding to each preset text through a similar case retrieval model.

[0377] like Fig.23 As shown, the question-and-answer device 2300 for legal consultation further includes: an identification module 2308 and a fifth determination module 2309 .

[0378] In some embodiments, the identification module 2308 is configured to: identify idiomatic sentences in each preset text through a similar case retrieval model, and determine the processed preset text based on the idiomatic sentences in each preset text; the fifth determination module 2309 is configured to: the calling module 2302 is specifically configured to: determine the similarity between the first question information and the processed preset text based on the overall semantic features, core sentence meaning features and label information corresponding to the processed preset text and the first question information through a similar case retrieval model.

[0379] In some embodiments, the target legal model also includes a legal event detection model and a legal information extraction model; the calling module 2302 is specifically configured to: determine the first event information corresponding to the first question information based on the question information features corresponding to the first question information and the core information corresponding to the first question information through the legal event detection model; determine the event determination information based on the first event information through the establishment condition determination model, and determine and output the second question information based on the event determination information and the first question information; obtain the second reply information input by the user to the second question information through the similar case retrieval model, and determine the target question information based on the first question information and the second reply information; determine the feature information corresponding to each preset text and the feature information corresponding to the target question information through the similar case retrieval model.

[0380] Fig.24 A schematic diagram of a training device for a central control model provided in some embodiments of the present application. Fig.24 As shown, the training device 2400 of the central control model includes a scoring module 2410 , a first training module 2420 and a second training module 2430 .

[0381] The scoring module 2410 is configured to obtain a scored first training sample and an unscored second training sample through any language model, and score the second training sample based on the first training sample to obtain a seed sample.

[0382] The first training module 2420 is configured to train the reward model to be trained based on the seed sample to obtain a trained reward model.

[0383] The second training module 2430 is configured to train the first language model to be trained based on the trained reward model and the third training sample to obtain the trained first language model; wherein the third training sample includes the third question sample, and the trained central control model includes the trained reward model and the trained first language model.

[0384] In some embodiments, the scoring module 2410 is specifically configured to: score the second model corresponding to the second training sample based on the first training sample, the first score corresponding to the first training sample and the second training sample through any language model to obtain the second score corresponding to the second model, and determine the seed sample according to the second training sample and the second score; wherein the first training sample includes a first question sample, a first model, a first processing result sample and a first score; the second training sample includes a second question sample, a second model and a second processing result sample; and multiple preset legal models include a first model and a second model.

[0385] In some embodiments, the reward model to be trained includes multiple scoring models; the first training module 2420 is specifically configured to: score the seed samples respectively through multiple scoring models to obtain multiple scores corresponding to the seed samples; determine the target score corresponding to the seed sample based on the multiple scores corresponding to the seed sample through the reward model to be trained, and obtain the trained reward model.

[0386] In some embodiments, the second training module 2430 is specifically configured to: determine the first target model to be called from multiple preset legal models based on the third question sample through the first language model to be trained; obtain the third processing result sample obtained after the target model processes the third question sample through the first language model to be trained; score the first target model based on the third training sample through the trained reward model to obtain a third score; wherein the third training sample also includes the first target model and the third processing result sample; optimize the parameters of the first language model to be trained based on the third score, and obtain the trained first language model.

[0387] In some embodiments, the central control model also includes a second language model; the second training module 2430 is specifically configured to: obtain a third question information sample through the second language model, and determine the second target model to be called in multiple preset legal models based on the third question information sample; obtain a fourth processing result sample obtained by the second target model based on the third question information sample; determine a divergence value based on the third processing result sample and the fourth processing result sample, and determine a loss function based on the third score and the divergence value; optimize the parameters of the first language model to be trained based on the loss function, and obtain the trained first language model.

[0388] Fig.25 A schematic diagram of an electronic device provided for some embodiments of the present application. In some embodiments, the electronic device includes one or more processors and a memory. The memory is configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the question-and-answer method for legal consultation or the training method for the central control model in the above-mentioned embodiments.

[0389] like Fig.25 As shown, the electronic device 2500 includes: a processor (processor) 2501 and a memory 2502. Exemplarily, the electronic device 2500 may also include: a communication interface (Communications Interface) 2503 and a communication bus 2504.

[0390] The processor 2501, the memory 2502 and the communication interface 2503 communicate with each other via the communication bus 2504. The communication interface 2503 is used to communicate with other devices such as client or other server network elements.

[0391] In some embodiments, the processor 2501 is used to execute the program 2505, which can specifically execute the relevant steps in the above-mentioned legal consultation question-answering method or the central control model training method embodiment. Specifically, the program 2505 may include program code, which includes computer executable instructions.

[0392] Exemplarily, the processor 2501 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement some embodiments of the present application. The electronic device 2500 may include one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0393] In some embodiments, the memory 2502 is used to store the program 2505. The memory 2502 may include a high-speed RAM memory, and may also include a non-volatile memory (NVM), such as at least one disk memory.

[0394] Program 2505 can be specifically called by processor 2501 to enable electronic device 2500 to execute the question-and-answer method of legal consultation or the training method operation of the central control model.

[0395] Some embodiments of the present application provide a computer-readable storage medium storing at least one executable instruction. When the executable instruction is executed on the electronic device 2500, the electronic device 2500 executes the question-and-answer method for legal consultation or the training method for the central control model in the above-mentioned embodiments.

[0396] The executable instructions can be specifically used to enable the electronic device 2500 to execute the question-and-answer method of legal consultation or the training method operation of the central control model.

[0397] For example, the computer readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0398] The beneficial effects that can be achieved by the computer-readable storage medium provided in some embodiments of the present application can be referred to the beneficial effects in the corresponding legal consultation question-and-answer method or the training method of the central control model provided above, and will not be repeated here.

[0399] It should be noted that, in the application, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0400] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0401] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.

[0402] For the purposes of this specification, a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by an instruction execution system, apparatus, or device or in conjunction with such instruction execution system, apparatus, or device.

[0403] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection having one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM).

[0404] In addition, the computer readable medium can even be a paper or other suitable medium on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, and then editing, interpreting or processing in other suitable ways as necessary, and then storing it in the computer memory. It should be understood that various parts of the present application can be implemented in hardware, software, firmware or a combination thereof.

[0405] In the above embodiments, multiple steps or methods may be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it may be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0406] The above-described embodiments of the present application do not constitute a limitation on the protection scope of the present application.

Claims

1. A question-and-answer method for legal consultation, characterized in that: Applied to the central control model, the method includes: In response to first question information input by a user, determining a target legal model to be called from a plurality of preset legal models based on the first question information, and determining a calling order corresponding to the target legal models; Calling the target legal models according to the calling order, and obtaining processing results corresponding to each target legal model based on the first question information through each target legal model; Based on the processing results corresponding to each of the target legal models, first reply information to the first question information is generated and output.

2. The method according to claim 1, characterized in that The target legal model includes a legal event detection model and a legal information extraction model; the processing results corresponding to each target legal model are obtained based on the first question information through each target legal model, including: Determine, by using the legal information extraction model, a plurality of entities in the first question information and entity relationships between each of the plurality of entities; Determine, by the legal event detection model, based on the first question information and the multiple entities, question information features corresponding to the first question information and initial features corresponding to each of the entities; wherein the initial features corresponding to each of the entities represent context information corresponding to each of the entities; Determining core information corresponding to the first question information by the legal event detection model based on the multiple entities, entity relationships between the entities, and initial features corresponding to the entities; The target event information corresponding to the first question information is determined by the legal event detection model based on the question information features and the core information corresponding to the first question information; wherein the processing results corresponding to each of the target legal models include the target event information determined by the legal event detection model.

3. The method according to claim 2, characterized in that The core information corresponding to the first question information includes the core information corresponding to each of the entities in the first question information and the core relationship between the entities; the determining the core information corresponding to the first question information by the legal event detection model based on the multiple entities, the entity relationships between the entities and the initial features corresponding to the entities includes: Determine a syntactic graph by using the legal event detection model with each of the entities as a node and the entity relationships between the entities as an edge; Based on the syntactic graph and the initial features corresponding to each of the entities, the initial features corresponding to each of the entities are updated through the multiple neural network layers in the legal event detection model to obtain updated features of each of the nodes determined by each of the neural network layers in the multiple neural network layers; The updated features of each of the nodes determined by the last neural network layer in the multiple neural network layers are determined as the core information corresponding to each of the entities and the core relationships between the entities.

4. The method according to claim 2, characterized in that: The determining, by using the legal information extraction model, multiple entities in the first question information and entity relationships between each of the multiple entities includes: Acquire historical event information through the legal information extraction model, and vectorize the historical event information to obtain a supervision vector; Extracting features of legal elements in the first question information by using the legal information extraction model to obtain multiple element features corresponding to the first question information; Determine, by the legal information extraction model, content features corresponding to the first question information based on the multiple element features corresponding to the first question information and the supervision vector, and determine the multiple entities according to the content features; The entity relationships of the content features are extracted through the legal information extraction model to obtain the entity relationships between the entities; wherein the processing results corresponding to each target legal model include the multiple entities determined by the legal information extraction model and the entity relationships between the entities.

5. The method according to claim 4, characterized in that The determining, by the legal information extraction model based on the multiple element features corresponding to the first question information and the supervision vector, content features corresponding to the first question information includes: The supervision vector and each of the element features are concatenated or dot-multiplied by the legal information extraction model to obtain the multiple first element features; The legal information extraction model uses an attention mechanism to adjust the weight of each of the multiple first factor features to obtain multiple second factor features after the weight adjustment; The legal information extraction model is used to perform feature fusion processing on the multiple second factor features to obtain the content feature.

6. The method according to claim 4, characterized in that The method further comprises: Determining current event information based on the entity and entity relationships between the entities through the legal event detection model; When the current event information is different from the historical event information, vectorizing the current event information through the legal information extraction model to obtain a supervision vector corresponding to the current event information; Determine multiple entities in the question information based on the supervision vector corresponding to the current event information and the multiple element features through the legal information extraction model; The entity relationship between each of the multiple entities corresponding to the current event information is determined through the legal information extraction model based on the multiple entities corresponding to the current event information.

7. The method according to any one of claims 2 to 6, characterized in that: The target legal model also includes a condition determination model; the step of determining the target event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information by the legal event detection model includes: Determining, by the legal event detection model, first event information corresponding to the first question information based on the question information feature and the core information corresponding to the first question information; determining event determination information based on the first event information through the establishment condition determination model, and determining and outputting second question information based on the event determination information and the first question information; Acquire second reply information input by the user to the second question information through the legal event detection model, and determine target question information based on the first question information and the second reply information; The target event information is determined by the legal event detection model based on the target question information features corresponding to the target question information and the core information corresponding to the target question information.

8. The method according to claim 7, characterized in that The determining event determination information based on the first event information by using the establishment condition determination model includes: Determining a plurality of preset texts associated with the first event information in a preset database based on the first event information by using the establishment condition determination model; The first preset text is processed by the establishment condition determination model to obtain a plurality of search pairs corresponding to the first preset text; wherein the first preset text is any preset text among the plurality of preset texts, and each of the plurality of search pairs includes a search identifier and a search content; Clustering the multiple search pairs corresponding to the first preset text using the establishment condition determination model to obtain multiple candidate seed search pairs; The establishment condition determination model is used to determine a target seed retrieval pair that meets preset conditions among the multiple candidate seed retrieval pairs, and the retrieval content of the target seed retrieval pair is determined as the event determination information; wherein, the processing results corresponding to each of the target legal models include the event determination information determined by the establishment condition determination model.

9. The method according to claim 8, characterized in that The clustering process of the plurality of search pairs corresponding to the first preset text by the establishment condition determination model to obtain a plurality of candidate seed search pairs includes: In the clustering process of the current round, the multiple first seed retrieval pairs obtained in the clustering process of the previous round and the multiple first retrieval pairs that are not clustered are obtained through the establishment condition judgment model; wherein the multiple retrieval pairs include the multiple first seed retrieval pairs and the multiple first retrieval pairs, and the sum of the number of the multiple first seed retrieval pairs and the number of the multiple first retrieval pairs is equal to the preset number; Clustering the plurality of first seed search pairs and the plurality of first search pairs is performed by using the establishment condition determination model to obtain a plurality of second search pairs corresponding to each of the plurality of legal categories; Determine, by using the establishment condition determination model, a second seed search pair corresponding to each of the legal categories among the plurality of second search pairs corresponding to each of the legal categories, and determine a plurality of unclustered second search pairs among the plurality of search pairs according to the preset number, the plurality of first search pairs and the plurality of the second seed search pairs; The plurality of second seed retrieval pairs and the plurality of second retrieval pairs are clustered in the next round of clustering process through the establishment condition judgment model until there are no unclustered retrieval pairs in the plurality of retrieval pairs, and the plurality of candidate seed retrieval pairs determined by the last round of clustering process are obtained; wherein each of the plurality of candidate seed retrieval pairs corresponds to a different legal category.

10. The method according to claim 9, characterized in that The determining, by using the establishment condition determination model, of the plurality of second search pairs corresponding to the legal categories, of the second seed search pairs corresponding to the legal categories comprises: Determining, in each of the legal categories, a semantic vector corresponding to each of the second search pairs by using the establishment condition determination model; Determine the total distance between each first semantic vector and the second semantic vector in each legal category according to the semantic vector corresponding to each second search pair through the establishment condition judgment model; wherein the first semantic vector is a semantic vector corresponding to any second search pair among the plurality of second search pairs corresponding to each legal category, and the second semantic vector is a semantic vector corresponding to a second search pair other than the second search pair corresponding to the first semantic vector; The establishment condition determination model is used to determine a target semantic vector with the shortest total distance to the second semantic vector among the plurality of first semantic vectors, and the second search pair corresponding to the target semantic vector is determined as the second seed search pair corresponding to each of the legal categories.

11. The method according to claim 8, characterized in that The determining of a target seed retrieval pair satisfying a preset condition from among the plurality of candidate seed retrieval pairs by using the establishment condition determination model comprises: Determining a target confidence score for each of the plurality of candidate seed retrieval pairs through the establishment condition determination model; wherein the target confidence score is related to the degree of association between each of the candidate seed retrieval pairs and the first event information, and the number of retrieval pairs in the legal category corresponding to each of the candidate seed retrieval pairs; The candidate seed retrieval pair whose target confidence score is greater than or equal to a preset score among the multiple candidate seed retrieval pairs is determined as the target seed retrieval pair through the establishment condition judgment model.

12. The method according to claim 8, characterized in that The step of determining the search content of the target seed search pair as the event determination information includes: If the ratio of the number of the target seed search pairs to the number of the plurality of candidate seed search pairs is greater than or equal to a preset ratio, the search content of the target seed search pairs is determined as the event determination information; If the ratio of the number of the target seed retrieval pairs to the number of the plurality of candidate seed retrieval pairs is less than the preset ratio, and the number of times the clustering is executed in a loop is less than or equal to the preset number of executions, then clustering the plurality of retrieval pairs continues to be performed until the ratio of the number of the target seed retrieval pairs to the number of the plurality of candidate seed retrieval pairs is greater than or equal to the preset ratio, or the number of times the clustering is executed in a loop is greater than the preset number of executions; If the number of times the clustering is executed in the loop is greater than the preset number of times, a second preset text among the multiple preset texts is processed to obtain multiple search pairs corresponding to the second preset text; wherein the second preset text is any preset text among the multiple preset texts except the first preset text; Clustering is performed on multiple search pairs corresponding to the second preset text to determine a target seed search pair corresponding to the second preset text, and the search content of the target seed search pair corresponding to the second preset text is determined as event determination information corresponding to the first question information.

13. The method according to claim 1, characterized in that The target legal model includes a similar case retrieval model; and obtaining the processing results corresponding to each target legal model based on the first question information through each target legal model includes: Acquire multiple preset texts through the similar case retrieval model, and determine feature information corresponding to each of the multiple preset texts and feature information corresponding to the first question information; wherein the feature information includes overall semantic features, core sentence features and label information; Determining the similarity between the first question information and each of the preset texts based on the feature information corresponding to each of the preset texts and the feature information corresponding to the first question information by using the similar case retrieval model; Based on the similarity between the first question information and each of the preset texts, the similar case retrieval model determines and outputs a target preset text from the multiple preset texts; wherein the processing results corresponding to each of the target legal models include the target preset text determined by the similar case retrieval model.

14. The method according to claim 13, characterized in that Determining feature information corresponding to each of the plurality of preset texts includes: Determine the overall semantic features and word semantic features corresponding to each of the preset texts through the similar case retrieval model; Determining the core sentence features corresponding to each of the preset texts based on the overall semantic features corresponding to each of the preset texts through the similar case retrieval model; The label information corresponding to each of the preset texts is determined through the similar case retrieval model based on the semantic features of the words corresponding to each of the preset texts.

15. The method according to claim 13, characterized in that The method further comprises: Identifying idiomatic sentences in each of the preset texts by using the similar case retrieval model, and determining processed preset texts according to the idiomatic sentences in each of the preset texts; The determining, by the similar case retrieval model, the similarity between the first question information and each of the preset texts based on the feature information corresponding to each of the preset texts and the feature information corresponding to the first question information includes: The similarity between the first question information and the processed preset text is determined by the similar case retrieval model based on the overall semantic features, core sentence features and label information corresponding to the processed preset text and the first question information.

16. The method according to any one of claims 13 to 15, characterized in that The target legal model also includes a legal event detection model and a legal information extraction model; the determining of the feature information corresponding to each of the plurality of preset texts and the feature information corresponding to the first question information includes: Determining, by the legal event detection model, first event information corresponding to the first question information based on question information features corresponding to the first question information and core information corresponding to the first question information; determining event determination information based on the first event information through the establishment condition determination model, and determining and outputting second question information based on the event determination information and the first question information; Acquire second reply information input by the user to the second question information through the similar case retrieval model, and determine target question information based on the first question information and the second reply information; The feature information corresponding to each of the preset texts and the feature information corresponding to the target question information are determined through the similar case retrieval model.

17. A training method for a central control model, characterized in that: Applied to a central control model, the central control model includes a first language model and a reward model, and the method includes: Obtaining a scored first training sample and an unscored second training sample through any language model, and scoring the second training sample based on the first training sample to obtain a seed sample; Training the reward model to be trained based on the seed sample to obtain a trained reward model; The first language model to be trained is trained based on the trained reward model and the third training sample to obtain the trained first language model; wherein the third training sample includes a third question sample, and the trained central control model includes the trained reward model and the trained first language model.

18. The method according to claim 17, characterized in that Scoring the second training sample based on the first training sample to obtain a seed sample includes: The second model corresponding to the second training sample is scored through any language model based on the first training sample, the first score corresponding to the first training sample and the second training sample to obtain the second score corresponding to the second model, and the seed sample is determined according to the second training sample and the second score; wherein the first training sample includes a first question sample, the first model, a first processing result sample and the first score; the second training sample includes a second question sample, the second model and a second processing result sample; and the multiple preset legal models include the first model and the second model.

19. The method according to claim 17, characterized in that The reward model to be trained includes a plurality of scoring models; the step of training the reward model to be trained based on the seed sample to obtain a trained reward model includes: Scoring the seed samples respectively using the multiple scoring models to obtain multiple scores corresponding to the seed samples; The reward model to be trained is used to determine the target score corresponding to the seed sample based on the multiple scores corresponding to the seed sample, and the trained reward model is obtained.

20. The method according to claim 17, characterized in that The step of training the first language model to be trained based on the trained reward model and the third training sample to obtain the trained first language model comprises: Determining a first target model to be called from among the plurality of preset legal models based on the third question sample by using the first language model to be trained; Obtaining, through the first language model to be trained, a third processing result sample obtained after the target model processes the third question sample; Scoring the first target model based on the third training sample by the trained reward model to obtain a third score; wherein the third training sample also includes the first target model and the third processing result sample; Parameters of the first language model to be trained are optimized based on the third score, and the trained first language model is obtained.

21. The method according to claim 20, characterized in that The central control model also includes a second language model; and the optimizing the parameters of the first language model to be trained based on the third score and obtaining the trained first language model includes: Acquire the third question information sample through the second language model, and determine a second target model to be called from the plurality of preset legal models based on the third question information sample; Obtain a fourth processing result sample obtained by the second target model based on the third question information sample; Determine a divergence value based on the third processing result sample and the fourth processing result sample, and determine a loss function based on the third score and the divergence value; Optimizing the parameters of the first language model to be trained based on the loss function, and obtaining the trained first language model.

22. An electronic device, characterized in that: include: one or more processors; and A memory configured to: store one or more programs; Wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the question-and-answer method for legal consultation according to any one of claims 1-16, or implement the training method for the central control model according to any one of claims 17-21.

23. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, it implements the question-and-answer method for legal consultation according to any one of claims 1-16, or implements the training method for the central control model according to any one of claims 17-21.

Citation Information

Patent Citations

  • Knowledge graph driving type law intelligent consultation system

    CN110765257A

  • Legal document generation method and system based on reading understanding and intention recognition model

    CN114297342A

  • Class case retrieval method and device, equipment and medium

    CN116501839A

  • Data question answering system and calling method thereof

    CN119045928A

  • Legal consultation method and device, terminal and readable storage medium

    CN119046413A