Multi-agent collaborative legal numerical calculation method based on large language model and related device
Patent Information
- Application Number
- CN202611297454.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-10-30
AI Technical Summary
[0008]鉴于上述问题,本发明实施例提供了一种基于大语言模型的多智能体协同法律数值计算方法、装置、计算机设备、计算机可读存储介质及计算机程序产品,用于解决现有技术中存在的在法律分析过程中分析检索不准确的问题
[0019]本发明实施例通过获取用户输入的待处理问题;根据所述待处理问题调用经过法律领域深度微调的嵌入模型在预设的法律法规数据库中进行全局密集检索,得到至少一个候选法规片段;利用重排序模型,对所述至少一个候选法规片段与目标案情文本进行交叉语义打分,得到与所述目标案情文本相关度最高的前N个核心法律条文;通过求解智能体根据所述待处理问题及所述核心法律条文进行推理生成,得到逻辑初稿;将所述逻辑初稿、至少一个候选法规片段中相关度排名靠前的N个候选法规片段及待处理问题输入评估智能体中进行审查后,得到最终的结构化答案,能够法律信息查询分析及计算的准确性。
Smart Images

Figure CN123012120A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of natural language processing technology, specifically to a multi-agent collaborative legal numerical calculation method, apparatus, computer equipment, computer-readable storage medium, and computer program product based on a large language model. Background Technology
[0002] Currently, for the problem of legal numerical calculation, existing technologies have mainly formed the following types of solutions: The first category is rule-based calculator systems. These are currently the most commonly used numerical calculation tools in legal practice, with typical examples including various online compensation calculators and tax calculators. The technical principle of these systems is: the legal formulas and parameters for specific types of numerical calculations are hard-coded into the program code, constructing a fixed calculation logic; users input relevant parameters (such as the victim's age, income level, disability level, etc.) through a form interface; the system automatically calculates and outputs the results according to the preset formulas. For example, traffic accident compensation calculators typically have built-in compensation items and calculation formulas stipulated in the "Road Traffic Safety Law" and related judicial interpretations. After the user inputs information such as the accident liability ratio, the victim's injuries, and medical expenses, the system automatically calculates the various compensation amounts.
[0003] The second category is large-scale model application solutions based on Retrieval-Augmented Generation (RAG) technology. The technical principle of this type of solution is as follows: First, a legal knowledge base is built, storing legal provisions in the form of text blocks. When a user raises a calculation question, the system uses text retrieval technology to retrieve relevant legal provisions from the knowledge base. The retrieved legal provisions are then input into the large-scale model along with the user's question. The large-scale model understands the case, extracts parameters, completes the calculation, and generates the answer. Compared to rule-based calculators, this type of solution has better versatility, capable of handling various types of calculation problems, and does not require separate program development for each type of calculation. However, for the generation-side model, without constraints on legal knowledge such as the principle of legal hierarchy, and without the injection of key dynamic data, such as the national urban residents' income for a certain year, it is very easy to produce illusions, making it difficult to guarantee the legal rigor of the calculation results.
[0004] The third category is large-scale model optimization schemes specifically designed for numerical reasoning tasks. For example, the system obtains the query statement input by the user and uses a large language model to extract key information query statements from the original sentence; then, it uses a traditional best-matching algorithm to perform a preliminary document retrieval in the background database; based on the large language model, it performs secondary filtering on the retrieved documents to extract sub-tables and sub-texts that match the target question; for numerical reasoning tasks, it uses a decomposition generator to transform the reasoning steps into chained mathematical expressions, and calls an external computational proxy algorithm (i.e., an external mathematical calculator or function) to perform the final numerical calculation and generate the answer.
[0005] The inventors of this application have discovered that the existing methods have the following drawbacks: Rule-based calculator systems suffer from fundamental flaws, including narrow applicability and insufficient flexibility. These systems hard-code legal rules into their programs, limiting each calculator to specific types of numerical calculations. When faced with complex and ever-changing cases in legal practice, users often need to use multiple calculators simultaneously and manually determine the relationships between the results. More seriously, when laws and regulations are revised, the entire calculator program must be redeveloped and re-deployed, resulting in high maintenance costs. Furthermore, these systems cannot understand facts described in natural language, requiring users to possess specialized knowledge to accurately extract and input parameters, making them extremely unfriendly to non-professional users.
[0006] Existing solutions lack a systematic mechanism for handling the principle of legal hierarchy. The principle of legal hierarchy in legal application (higher-level law prevails over lower-level law, special law prevails over general law, and newer law prevails over older law) is a fundamental guideline for ensuring the correctness of legal application, but existing technical solutions fail to effectively integrate this core legal logic. While large-scale models can understand the concept of hierarchical principles to some extent, they often make judgment errors in practical applications, especially when faced with complex situations where legal provisions conflict or overlap. This results in the system's output legal basis potentially not conforming to the rules of application in legal practice.
[0007] Existing large-scale model-based solutions suffer from an "illusion" problem regarding the accuracy of numerical reasoning. Large language models may generate seemingly reasonable but actually erroneous information, manifesting in numerical computation tasks as errors in calculation formulas, biases in parameter extraction, confusion in unit conversions, and skipping steps in the calculation process. Furthermore, existing large language models often embed socioeconomic data into their weights, making them highly susceptible to "knowledge illusions" that significantly deviate from reality when faced with annually changing statutory compensation bases. Existing solutions typically employ a single-stage generation model, where the large model completes all reasoning and calculations in one go, lacking effective verification and error correction mechanisms to promptly identify and correct errors in the reasoning process. While some existing solutions utilize large models for document filtering and sub-information extraction, they lack specific optimizations for the legal domain, failing to effectively handle the professionalism and complexity of legal provisions; the reasoning process lacks the constraints of legal rules, making it difficult to guarantee the legal rigor of the calculation results. Summary of the Invention
[0008] In view of the above problems, embodiments of the present invention provide a multi-agent collaborative legal numerical calculation method, apparatus, computer equipment, computer-readable storage medium and computer program product based on a large language model, to solve the problem of inaccurate analysis and retrieval in the legal analysis process in the prior art.
[0009] According to one aspect of the present invention, a multi-agent collaborative legal numerical calculation method based on a large language model is provided, the method comprising: Obtain the pending issues input by the user; the pending issues include target case text, which includes complex case details and implicit numerical claims information; Based on the problem to be processed, an embedded model that has been finely tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment. Using a reordering model, cross-semantic scoring is performed on at least one candidate legal fragment and the target case text to obtain the top N core legal provisions with the highest relevance to the target case text; The logic draft is generated by the solving agent based on the problem to be processed and the core legal provisions. The logic draft includes the initial calculation formula, initial numerical results, initial legal basis and initial thought process information corresponding to the target case text. The initial logical draft, the top N candidate legal segments with the highest relevance among at least one candidate legal segment, and the problem to be processed are input into the evaluation agent for review, and the final structured answer is obtained; the structured answer includes the final numerical result, the final legal basis, and complete thought process information.
[0010] In an alternative approach, before invoking the embedding model, which has been deeply fine-tuned in the legal domain, to perform a global intensive search in a pre-defined legal database based on the semantic vector to obtain at least one candidate legal fragment, the method further includes: Obtain a training set; the training set includes input training question samples and corresponding labeled standard answer tags; the training set includes user-queried input training question samples, positive example legal provisions, and negative example legal provisions triplet; The input training question samples from the training set are fed into the basic embedding model to obtain all the preliminary regulatory recall results. After sorting all the preliminary regulatory recall results through the initial re-ranking model, the preliminary Top-N regulatory recall results are obtained. In the Top-N legal recall results, positive example legal provisions corresponding to the labeled standard answer are removed, and in the remaining Top-N-1 legal recall provisions, the legal provisions with the middle ranking and semantic confusion are extracted as the difficult negative example legal provisions corresponding to the input training question samples. The difficult-to-bear example legal provisions are updated to the training set, and the basic embedding model and the initial reordering model are further trained to obtain the embedding model and reordering model that have been deeply fine-tuned in the legal domain.
[0011] In one alternative approach, the step of invoking a deeply fine-tuned embedding model based on the legal domain to perform a global intensive search in a pre-defined legal database, based on the problem to be addressed, to obtain at least one candidate legal fragment, including: The target case text is semantically vectorized to obtain the corresponding semantic vector; Based on the semantic vector, an embedding model that has been deeply fine-tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment.
[0012] In one optional approach, the solving agent includes a structured prompt-guided model and an inference engine; the structured prompt-guided model is configured to constrain the inference engine through structured prompts, causing the inference engine to generate calculation results according to predetermined steps based on the recalled regulations and user questions; before the solving agent generates a logical draft based on the problem to be processed and the core legal provisions, the method further includes: The model is guided by pre-constructed prompts; these prompts include at least role definitions, general reasoning principles, example learning samples, and output protocols; the role definitions specify the role of the reasoning engine and constrain it to reason strictly according to legal rules; the general reasoning principles embed legal professional rules, including parameter source principles and legal hierarchy principles; the example learning samples provide reasoning examples of standard answers; and the output protocols constrain the format of the output results. A language model with a small number of parameters is used as the inference engine to load and execute the structured prompt words.
[0013] In one alternative approach, the step of generating a preliminary logical draft by a problem-solving agent based on the problem to be solved and the core legal provisions includes: Input the problem to be processed and the core legal provisions into the reasoning engine; Under the constraints of the structured prompts, the reasoning engine extracts calculation parameters from the legal provisions and generates a calculation logic chain according to the predetermined reasoning steps to obtain a preliminary logic draft; the predetermined reasoning steps include case characterization, formula construction, legal provision screening, and numerical calculation.
[0014] In one optional approach, after inputting the initial logical draft, the top N candidate legal fragments ranked by relevance from at least one candidate legal fragment, and the question to be processed into the evaluation agent for knowledge exploration and information completion, logical error correction and parameter replacement are performed to obtain a structured answer, including: The evaluation agent classifies the user's intent according to preset legal categories based on the problem to be processed, and determines the user's true computational needs. The evaluation agent verifies the legal provisions cited by the solution agent from the perspective of legal provision citation review, based on legal rules. The verification includes: determining whether the cited legal provisions in the initial logic draft can form a complete logical chain, whether the judicial interpretation provides corresponding substantive legal support, whether there is a conflict between legal provisions, and whether the legal provisions conform to the hierarchy of validity and general principles. After the review is completed, the evaluation agent re-outputs the optimized results in the same format as the solution agent, as a structured answer.
[0015] According to another aspect of the present invention, a multi-agent collaborative legal numerical calculation device based on a large language model is provided, comprising: The acquisition module is used to acquire the pending issues input by the user; the pending issues include target case text, which includes complex case details and implicit numerical appeal information; The retrieval module is used to invoke an embedded model that has been finely tuned in the legal field to perform a global intensive search in a preset legal database based on the problem to be processed, and to obtain at least one candidate legal fragment. The filtering module is used to perform cross-semantic scoring on the at least one candidate legal fragment and the target case text using a re-ranking model, so as to obtain the top N core legal provisions with the highest relevance to the target case text. The solution module is used to generate a logical draft by reasoning based on the problem to be processed and the core legal provisions through a solution agent; the logical draft includes the initial calculation formula, initial numerical results, initial legal basis and initial thought process information corresponding to the target case text. The review module is used to input the initial logical draft, the top N candidate legal segments with the highest relevance among at least one candidate legal segment, and the question to be processed into the evaluation agent for review, and then obtain the final structured answer; the structured answer includes the final numerical result, the final legal basis, and complete thought process information.
[0016] According to another aspect of the present invention, a computer device is provided, comprising: It includes: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus; The memory is used to store at least one executable instruction, which causes the processor to perform the operation of the multi-agent collaborative legal numerical calculation method based on a large language model.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, the storage medium storing at least one executable instruction, which, when executed on a computer device, causes the computer device to perform the operation of the multi-agent collaborative legal numerical calculation method based on a large language model.
[0018] According to another aspect of the present invention, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the multi-agent collaborative legal numerical calculation method based on a large language model.
[0019] This invention, in its embodiments, acquires a user-input question; based on the question, it invokes an embedded model, deeply fine-tuned in the legal domain, to perform a global intensive search in a preset legal database, obtaining at least one candidate legal fragment; using a re-ranking model, it performs cross-semantic scoring on the at least one candidate legal fragment and the target case text, obtaining the top N core legal provisions with the highest relevance to the target case text; a solution agent generates a logical draft based on the question and the core legal provisions; the logical draft, the top N candidate legal fragments with the highest relevance, and the question are input into an evaluation agent for review, resulting in a final structured answer, thus improving the accuracy of legal information query analysis and calculation.
[0020] This invention provides a method for setting logical constraints on legal numerical calculations. This method forces the model to strictly follow a specific execution flow when performing legal calculations: “case characterization, construction of calculation formula, extraction of legal provisions based on parameter sources, and substitution of numerical calculations.” This method effectively solves the problem of logical chain breaks that easily occur in large models during complex mathematical calculations.
[0021] This invention innovatively proposes a two-stage architecture consisting of a weak and a strong solving agent and an evaluation agent. The solving agent rapidly generates an initial draft, while the evaluation agent performs multi-dimensional review and correction. The architecture includes a task division design between the solving and evaluation agents; a multi-dimensional review mechanism for the evaluation agent (intent recognition, legal citation review, and numerical review); and a correction and rewriting strategy based on the review results. The solving agent generates preliminary results using thought chain technology, and the evaluation agent then reviews and corrects these results from three dimensions: intent recognition, legal citation, and numerical calculation. This effectively avoids reasoning errors and significantly improves the accuracy of numerical calculations.
[0022] The above description is merely an overview of the technical solutions of the embodiments of the present invention. In order to better understand the technical means of the embodiments of the present invention and to implement them in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the embodiments of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0023] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A flowchart illustrating the multi-agent collaborative legal numerical calculation method based on a large language model provided in an embodiment of the present invention is shown. Figure 2A flowchart illustrating a multi-agent collaborative legal numerical calculation method based on a large language model, according to another embodiment of the present invention, is shown. Figure 3 This diagram illustrates the process of fine-tuning the embedded model and the rearrangement model in a multi-agent collaborative legal numerical calculation method based on a large language model according to an embodiment of the present invention. Figure 4 This diagram illustrates the workflow of the embedded model and rearranged model in a multi-agent collaborative legal numerical calculation method based on a large language model according to an embodiment of the present invention. Figure 5 This diagram illustrates the workflow of solving for agents in a multi-agent collaborative legal numerical calculation method based on a large language model provided by an embodiment of the present invention. Figure 6 This diagram illustrates the workflow of evaluating agents in a multi-agent collaborative legal numerical calculation method based on a large language model, according to an embodiment of the present invention. Figure 7 This diagram illustrates the structure of a multi-agent collaborative legal numerical calculation device based on a large language model provided in an embodiment of the present invention. Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention is shown. Detailed Implementation
[0024] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0025] Figure 1 A flowchart of a multi-agent collaborative legal numerical calculation method based on a large language model, provided by an embodiment of the present invention, is illustrated. This method is executed by a computer device. The computer device can be, for example, […]. Figure 1 As shown, the method includes the following steps: Step 110: Obtain the user-inputted question to be processed. The question to be processed includes the target case text, which includes complex case details and implicit numerical claims.
[0026] In this process, users input legal inquiries in natural language form on the front-end interface of a multi-agent collaborative legal numerical computing device based on a large language model. The question to be processed is the target case text input by the user, which contains a section containing complex case details and implicit numerical claims, such as compensation amount, points deduction, taxes, etc.
[0027] Step 120: Based on the problem to be processed, invoke the embedded model that has been deeply fine-tuned in the legal field to perform a global intensive search in the preset legal database to obtain at least one candidate legal fragment.
[0028] In this embodiment of the invention, the target case text is semantically vectorized to obtain a corresponding semantic vector; based on the semantic vector, an embedding model that has been deeply fine-tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment.
[0029] Specifically, such as Figure 4 As shown, an embedding model fine-tuned for the legal domain is invoked to transform the natural language query into a high-dimensional feature vector. After semantically vectorizing the target case text, the embedding model, deeply fine-tuned for the legal domain, is directly invoked to perform a global intensive search on a unified, high-quality, up-to-date legal database to recall candidate legal fragments. The vectorized query is then compared with the regulations in the legal vector database to calculate global similarity, quickly filtering and recalling the top 100 highly relevant candidate legal fragments. These candidate legal fragments are in the form of text blocks; this step is called vector coarse-ranking recall.
[0030] Step 130: Using a reordering model, perform cross-semantic scoring on the at least one candidate legal fragment and the target case text to obtain the top N core legal provisions with the highest relevance to the target case text.
[0031] Since the amount of data recalled in the coarse-ranking stage is large and contains some noise, this embodiment of the invention also inputs the Top-100 candidate laws and regulations along with the target case text of the original user query into a finely tuned reranking model. The reranking model performs deep attention mechanism cross-calculation and relevance scoring on the "query-legal provision" pair, and finally accurately extracts the top 10 (Top-10) core legal provisions as the absolute legal context for subsequent intelligent agent reasoning.
[0032] like Figure 3 As shown, in this embodiment of the invention, before executing steps 120 and 130, the embedding model and reranking model are pre-tuned and trained. This invention abandons traditional word frequency retrieval and adopts pure semantic dense vector retrieval. To adapt to the highly specialized and similar characteristics of legal texts, this invention performs domain-adaptation fine-tuning of the embedding model and reranker model in real-time offline, using a contrastive learning paradigm for fine-tuning training. The specific steps are as follows: Step 001: Obtain the training set.
[0033] The training set includes samples of legal industry-related input training questions and corresponding labeled standard answers. The training set also includes samples of user-queried input training questions, positive and negative legal provisions triples.
[0034] Step 002: Input the training question samples from the training set into the basic embedding model to obtain all preliminary regulatory recall results. Then, sort all the preliminary regulatory recall results through the initial re-ranking model to obtain the preliminary Top-N regulatory recall results.
[0035] Step 003: Remove the positive example legal provisions corresponding to the labeled standard answer tags from the Top-N legal recall results, and extract the middle-ranked legal provisions with semantic confusion from the remaining Top-N-1 legal recall provisions as the difficult negative example legal provisions corresponding to the input training question samples.
[0036] Step 004: Update the difficult-to-probable legal provisions to the training set, and further train the basic embedding model and the initial reordering model to obtain the embedding model and reordering model that have been deeply fine-tuned in the legal domain.
[0037] To address the challenges of legal texts involving transitions between old and new laws, and the issue of highly similar but differently effective higher-level and lower-level laws, this invention employs a Hard Negative Mining strategy. First, queries from the training set are input into a basic retrieval pipeline to obtain a preliminary Top-N legal recall. Then, manually annotated standard answers (positive examples) are removed from the recall results. From the remaining recall texts, laws with high semantic confusion and a moderate ranking are specifically extracted as Hard Negative Examples. These Hard Negative Examples structurally and semantically overlap with positive examples. By feeding these samples into the embedding and re-ranking models for supervised fine-tuning, the model is forced to learn key nuances in legal texts, such as "applicable conditions" and "specific subjects," and to distinguish between laws of different legal ranks and types. This significantly enhances the model's ability to deeply analyze highly similar and easily confused legal provisions.
[0038] Step 140: The solution agent generates a logical draft by reasoning based on the problem to be solved and the core legal provisions.
[0039] The initial logical draft includes the initial calculation formula, initial numerical results, initial legal basis, and initial thought process information corresponding to the target case text.
[0040] In this embodiment of the invention, the solving agent includes a structured prompt word guidance model and an inference engine; the structured prompt word guidance model is configured to impose inference constraints on the inference engine through structured prompt words, so that the inference engine generates calculation results according to predetermined steps based on the recalled regulations and user questions.
[0041] Before generating a preliminary logical draft by the solving agent based on the problem to be processed and the core legal provisions, the method further includes: guiding the model to pre-construct prompts through structured prompts; the structured prompts include at least role definitions, general reasoning principles, example learning samples, and output protocols; the role definitions are used to specify the role of the reasoning engine and constrain the reasoning engine to strictly reason according to legal rules; the general reasoning principles are embedded with legal professional rules, including parameter source principles and legal hierarchy principles; the example learning samples are used to provide reasoning examples of standard answers; the output protocol is used to constrain the format of the output results; a small-parameter, large-language model is used as the reasoning engine, loading and executing the structured prompts to construct the solving agent.
[0042] After obtaining the constructed intelligent agent for solving the problem, the problem to be processed and the core legal provisions are input into the reasoning engine. Under the constraints of the structured prompts, the reasoning engine extracts calculation parameters from the legal provisions and generates a calculation logic chain according to the predetermined reasoning steps to obtain a preliminary logical draft. The predetermined reasoning steps include case characterization, formula construction, legal provision selection, and numerical calculation.
[0043] Specifically, the solving agent quickly generates preliminary calculation results based on the recalled regulations and user questions. For example... Figure 5As shown, this solving agent uses a large language model with a relatively small number of parameters as its inference engine, guiding the model to complete inference according to predetermined steps through structured prompts. The structured prompts are the core of the solving agent and serve as constraints on the inference engine. The structured prompts consist of the following parts: a role definition section, explicitly specifying that the model plays the role of a "legal logic calculation engine," requiring it to strictly follow legal rules in its reasoning; a general principles section, embedding legal professional rules, including the principle of parameter source and the principle of legal hierarchy; an example learning section, providing a standard answer reasoning example, demonstrating how to extract parameters from legal provisions and form a complete computational logic chain; and an output protocol section, stipulating that the model must output the results in a unified JSON format, containing three fields: the reasoning process, the numerical answer, and the legal text. The execution process of the inference engine is controlled and constrained by structured prompts. Based on the problem to be processed and the core legal provisions, the inference engine, under the constraints of the structured prompts, characterizes the case, constructs a formula based on the case characterization, filters multiple core legal provisions based on the formula construction and structured prompts, and performs preliminary calculations based on the constructed formula and legal provisions to obtain the final result. Specifically, the model inference process of solving the agent is required to follow these four steps: First, case characterization, clarifying the legal type of the problem (e.g., civil compensation, administrative fines, tax calculation, etc.) and the core claims; Second, formula construction, abstracting the parameter structure required for numerical calculation, clarifying the legal source of each parameter in the calculation formula; Third, legal provision filtering, selecting provisions from the recalled core legal provisions that can provide direct legal basis for the parameters in the calculation formula based on the principle of parameter source and the principle of legal hierarchy; Fourth, numerical calculation, substituting the numerical values extracted from the case into the formula to complete the calculation and output the final result. The reasoning process output adopts a structured COT text format, which includes four clearly marked steps: [Qualitative] Briefly describe the case type and core claims; [Formula] Clarify the calculation formula and the legal source of each parameter; [Selection of Law] Select legal provisions based on the principle of parameter source and hierarchical principle; [Calculation] Substitute numerical values for calculation, use Arabic numerals, and retain the prescribed number of decimal places.
[0044] Step 150: Input the initial logic draft, the top N candidate regulatory fragments in terms of relevance from at least one candidate regulatory fragment, and the problem to be processed into the evaluation agent for review, and obtain the final structured answer; the structured answer includes the final numerical result, the final legal basis, and complete thought process information.
[0045] The embodiments of the present invention obtain the final structured answer through the following steps: The evaluation agent classifies the user's intent according to preset legal categories based on the problem to be processed, and determines the user's true computational needs. The evaluation agent verifies the legal provisions cited by the solution agent from the perspective of legal provision citation review, based on legal rules. The verification includes: determining whether the cited legal provisions in the initial logic draft can form a complete logical chain, whether the judicial interpretation provides corresponding substantive legal support, whether there is a conflict between legal provisions, and whether the legal provisions conform to the hierarchy of validity and general principles. After the review is completed, the evaluation agent re-outputs the optimized results in the same format as the solution agent, as a structured answer.
[0046] In embodiments of the present invention, such as Figure 6 As shown, the evaluation agent is responsible for multi-dimensional review and correction of the preliminary results generated by the solution agent. This evaluation agent uses a more powerful large language model as its evaluation engine, performing evaluations from three dimensions: intent recognition, legal citation review, and numerical review.
[0047] The intent recognition dimension is responsible for determining the user's true computational needs. Specifically, it includes: determining whether the user requests a single value or multiple values, for example, some problems may require separate calculations for multiple compensation items such as medical expenses, lost wages, and nursing care expenses; and classifying the user's intent according to preset legal categories, such as twelve categories including administrative penalties - financial and tax violations, administrative penalties - environmental resources and work safety, civil compensation - personal injury, and civil compensation - contract disputes.
[0048] The legal citation review dimension verifies the legal provisions cited by the solution agent based on legal rules. It judges whether the draft legal provisions can form a complete logical chain, whether the judicial interpretation provides corresponding substantive legal support, whether there are conflicts between legal provisions, and whether the legal provisions conform to the hierarchy of validity and general principles.
[0049] The numerical review dimension is responsible for checking the accuracy of the calculation process and results. Specifically, this includes: checking whether the units of calculation are correct; checking whether the numerical calculations conform to legal formulas and parameter requirements; and, if necessary, calling external dynamic data memories to verify the accuracy of the base used in the initial draft.
[0050] After review, the evaluation agent re-outputs the optimized results in the same format as the solving agent. If the review finds significant errors in the initial draft, the evaluation agent will regenerate the answer based on the recalled regulations and review comments; if the initial draft is generally correct, the evaluation agent will polish and revise it before outputting the result.
[0051] like Figure 2 The diagram illustrates a flowchart of another embodiment of the present invention: a multi-agent collaborative legal numerical calculation method based on a large language model. To clearly demonstrate the execution logic of this embodiment, the present invention employs a data flow-based retrieval and dual-agent reasoning pipeline architecture.
[0052] In this embodiment of the invention, the multi-agent collaborative legal numerical calculation based on a large language model is implemented using a multi-agent collaborative legal numerical calculation system based on a large language model. The overall operation of the system begins with the natural language input by the user. The user inputs a legal numerical calculation problem through the system interface, describing the facts of the case and the matters to be calculated in natural language. The system first performs semantic vectorization on the text. Subsequently, the retrieval enhancement generation module (embedded model and reranking model) performs a legal retrieval on the user's problem. The system directly calls the embedded model, which has been deeply fine-tuned in the legal domain, to perform a global intensive search in a high-quality, up-to-date legal database, recalling candidate legal fragments. Then, the reranking model is used to perform deep cross-semantic scoring on the candidate fragments, accurately selecting the top N core legal provisions with the highest relevance to the current case. Specifically, the embedded model first encodes the user's problem into a vector, recalling the Top-N relevant regulations in the vector index; then, the reranking model is used to fine-rank the recalled regulations, outputting the Top-K most relevant regulations.
[0053] After establishing reliable legal grounds, the system initiates the first phase, the "SolverAgent." The SolverAgent receives the user's question and the recalled regulations, performs reasoning based on structured prompts, and generates preliminary calculation results, including the reasoning process, numerical answers, and legal provisions. This agent is driven by a lightweight, large-language model with small parameters and extremely fast reasoning speed. After receiving the user's question and the recalled legal provisions, the SolverAgent, under strict constraints of structured instructions, executes a four-step CoT (Coding in Reasoning) process to generate a draft. It must complete the following steps in sequence: qualitative analysis of the legal relationships in the case; abstracting a specific calculation formula structure; extracting corresponding supporting legal provisions based on the parameter sources; and finally, substituting the numerical values into the formula for preliminary calculation.
[0054] Subsequently, the system enters the second phase, activating the Critic Agent, an evaluation agent with a larger parameter scale and stronger logical capabilities. The core task of the Critic Agent is to perform comprehensive, in-depth verification and error correction on the initial draft. During the review process, the Critic Agent first obtains dynamic economic data such as the current year's per capita disposable income of urban residents and average industry wages in real time by calling an external dynamic memory interface or an external network interface (when the memory bank contains relevant content), verifying and replacing any outdated parameters in the initial draft. Next, the Critic Agent module receives the initial draft and recalled regulations from the Solver Agent, reviews them from three dimensions: intent recognition, legal citation, and numerical calculation, and outputs the optimized final result. The Critic Agent rigorously reviews the legal citations and computational logic of the initial draft based on built-in general legal review logic (such as the exclusivity of applicable regulations and the matching of qualitative and quantitative clauses). After the review, the Critic Agent performs a second output.
[0055] Finally, the reviewed and polished content is formatted and output, and the results are sent back to the front end to be presented to the user. This includes three parts: the reasoning process, the numerical answer, and the legal provisions. The system not only returns the final numerical result to the user but also presents a list of clear legal bases supporting the result, as well as the rigorous reasoning process, resembling a professional legal document. Through this series of processes, this invention significantly improves the accuracy, timeliness, and interpretability of legal numerical calculations while ensuring operational efficiency.
[0056] Compared with the closest prior art, the embodiments of the present invention have the following significant advantages: First, the accuracy of legal retrieval is significantly improved. Existing technologies use the BM25 algorithm for document retrieval, a traditional retrieval method based on word frequency statistics. This method struggles to capture the deep semantics of legal provisions, resulting in a bottleneck in the accuracy of legal provision retrieval. This invention employs a domain-adapted embedding model and a re-ranking model. Through contrastive learning training, the model gains a deeper understanding of the professional semantics of legal provisions, and a difficult-to-distribute-example mining strategy enhances the model's ability to distinguish similar legal provisions. Experiments show that the legal retrieval accuracy of this invention is significantly improved compared to existing technologies, providing a more reliable legal basis for subsequent calculations.
[0057] Second, the systematic integration of legal professional rules. While existing technologies use large models for document filtering and sub-information extraction, they lack specific optimizations for the legal field and cannot effectively handle the professionalism and complexity of legal provisions. This invention embeds core legal logic, such as the principle of legal hierarchy and the principle of parameter source, into system prompts in a structured form, guiding the large model to strictly follow legal rules during the reasoning process, significantly improving the accuracy and standardization of legal basis citation.
[0058] Third, the two-stage reasoning mechanism improves computational accuracy. Existing technologies introduce large models at multiple stages, resulting in complex architectures prone to errors and illusions. Furthermore, the reasoning and computation are completed in one go by the decomposition generator and computational proxy algorithm, lacking a mechanism for reviewing and verifying intermediate results, thus failing to effectively avoid the illusion problem caused by large models. This invention innovatively proposes a two-stage architecture of "solution agent - evaluation agent." The solution agent generates preliminary results based on thought chain technology, and then the evaluation agent reviews and corrects them from three dimensions: intent recognition, legal citation, and numerical calculation. This effectively avoids reasoning errors and significantly improves the accuracy of numerical calculations.
[0059] Fourth, unified processing capabilities for multiple types of calculations. Existing technologies mainly target general numerical reasoning tasks and are not specifically designed for the various calculation types in the legal field. This invention achieves unified processing of multiple legal numerical calculation types, such as civil compensation, administrative fines, tax calculations, liquidated damages calculations, and social insurance, through a unified system architecture. Users do not need to determine which calculation tool to use; the system can automatically identify the calculation type and apply the correct legal basis, greatly improving user experience and system applicability.
[0060] Fifth, an interpretable reasoning process and clear legal basis. This invention requires the system to output the complete reasoning process in a structured format, including four steps: case characterization, formula construction, legal provision selection, and numerical calculation, as well as the specific legal provisions cited. This interpretable output method meets the requirements of legal practice for the auditability of calculation results, allowing users to clearly understand the source and basis of the calculation results, thus enhancing the system's credibility and practicality.
[0061] Figure 7 This diagram illustrates the structure of a multi-agent collaborative legal numerical calculation device based on a large language model, provided in an embodiment of the present invention. Figure 7 As shown, the device 300 includes: The acquisition module 310 is used to acquire the pending issues input by the user; the pending issues include target case text, which includes complex case details and implicit numerical appeal information; The retrieval module 320 is used to call an embedded model that has been finely tuned in the legal field to perform a global intensive search in a preset legal database based on the problem to be processed, and to obtain at least one candidate legal fragment. The filtering module 330 is used to use a re-ranking model to perform cross-semantic scoring on the at least one candidate legal fragment and the target case text to obtain the top N core legal provisions with the highest relevance to the target case text. The solution module 340 is used to generate a logical draft by reasoning based on the problem to be processed and the core legal provisions through a solution agent; the logical draft includes the initial calculation formula, initial numerical results, initial legal basis and initial thought process information corresponding to the target case text. The review module 350 is used to input the initial logic draft, the top N candidate regulatory fragments in terms of relevance among at least one candidate regulatory fragment, and the problem to be processed into the evaluation agent for review, and then obtain the final structured answer; the structured answer includes the final numerical result, the final legal basis, and complete thought process information.
[0062] The functions of each module in the multi-agent collaborative legal numerical calculation device based on a large language model in this embodiment of the invention are largely the same as the specific steps in the aforementioned method embodiment, and will not be repeated here.
[0063] This invention, in its embodiments, acquires a user-input question; based on the question, it invokes an embedded model, deeply fine-tuned in the legal domain, to perform a global intensive search in a preset legal database, obtaining at least one candidate legal fragment; using a re-ranking model, it performs cross-semantic scoring on the at least one candidate legal fragment and the target case text, obtaining the top N core legal provisions with the highest relevance to the target case text; a solution agent generates a logical draft based on the question and the core legal provisions; the logical draft, the top N candidate legal fragments with the highest relevance, and the question are input into an evaluation agent for review, resulting in a final structured answer, thus improving the accuracy of legal information query analysis and calculation.
[0064] This invention provides a method for setting logical constraints on legal numerical calculations. This method forces the model to strictly follow a specific execution flow when performing legal calculations: “case characterization, construction of calculation formula, extraction of legal provisions based on parameter sources, and substitution of numerical calculations.” This method effectively solves the problem of logical chain breaks that easily occur in large models during complex mathematical calculations.
[0065] This invention innovatively proposes a two-stage architecture consisting of a weak and a strong solving agent and an evaluation agent. The solving agent rapidly generates an initial draft, while the evaluation agent performs multi-dimensional review and correction. The architecture includes a task division design between the solving and evaluation agents; a multi-dimensional review mechanism for the evaluation agent (intent recognition, legal citation review, and numerical review); and a correction and rewriting strategy based on the review results. The solving agent generates preliminary results using thought chain technology, and the evaluation agent then reviews and corrects these results from three dimensions: intent recognition, legal citation, and numerical calculation. This effectively avoids reasoning errors and significantly improves the accuracy of numerical calculations.
[0066] Figure 8 The diagram shows a structural schematic of a computer device provided in an embodiment of the present invention. The specific embodiments of the present invention do not limit the specific implementation of the computer device.
[0067] like Figure 8 As shown, the computer device may include: a processor 402, a communications interface 404, a memory 406, and a communications bus 408.
[0068] The processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408. Communication interface 404 is used to communicate with other network elements such as clients or other servers. The processor 402 executes program 410, specifically performing the relevant steps described in the embodiment of the multi-agent collaborative legal numerical calculation method based on a large language model.
[0069] Specifically, program 410 may include program code, which includes computer-executable instructions.
[0070] Processor 402 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The computer device includes 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.
[0071] Memory 406 is used to store program 410. Memory 406 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0072] Specifically, program 410 can be called by processor 402 to cause the computer device to perform the following operations: Obtain the pending issues input by the user; the pending issues include target case text, which includes complex case details and implicit numerical claims information; Based on the problem to be processed, an embedded model that has been finely tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment. Using a reordering model, cross-semantic scoring is performed on at least one candidate legal fragment and the target case text to obtain the top N core legal provisions with the highest relevance to the target case text; The logic draft is generated by the solving agent based on the problem to be processed and the core legal provisions. The logic draft includes the initial calculation formula, initial numerical results, initial legal basis and initial thought process information corresponding to the target case text. The initial logical draft, the top N candidate legal segments with the highest relevance among at least one candidate legal segment, and the problem to be processed are input into the evaluation agent for review, and the final structured answer is obtained; the structured answer includes the final numerical result, the final legal basis, and complete thought process information.
[0073] In an alternative approach, before invoking the embedding model, which has been deeply fine-tuned in the legal domain, to perform a global intensive search in a pre-defined legal database based on the semantic vector to obtain at least one candidate legal fragment, the method further includes: Obtain a training set; the training set includes input training question samples and corresponding labeled standard answer tags; the training set includes user-queried input training question samples, positive example legal provisions, and negative example legal provisions triplet; The input training question samples from the training set are fed into the basic embedding model to obtain all the preliminary regulatory recall results. After sorting all the preliminary regulatory recall results through the initial re-ranking model, the preliminary Top-N regulatory recall results are obtained. In the Top-N legal recall results, positive example legal provisions corresponding to the labeled standard answer are removed, and in the remaining Top-N-1 legal recall provisions, the legal provisions with the middle ranking and semantic confusion are extracted as the difficult negative example legal provisions corresponding to the input training question samples. The difficult-to-bear example legal provisions are updated to the training set, and the basic embedding model and the initial reordering model are further trained to obtain the embedding model and reordering model that have been deeply fine-tuned in the legal domain.
[0074] In one alternative approach, the step of invoking a deeply fine-tuned embedding model based on the legal domain to perform a global intensive search in a pre-defined legal database, based on the problem to be addressed, to obtain at least one candidate legal fragment, including: The target case text is semantically vectorized to obtain the corresponding semantic vector; Based on the semantic vector, an embedding model that has been deeply fine-tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment.
[0075] In one optional approach, the solving agent includes a structured prompt-guided model and an inference engine; the structured prompt-guided model is configured to constrain the inference engine through structured prompts, causing the inference engine to generate calculation results according to predetermined steps based on the recalled regulations and user questions; before the solving agent generates a logical draft based on the problem to be processed and the core legal provisions, the method further includes: The model is guided by pre-constructed prompts; these prompts include at least role definitions, general reasoning principles, example learning samples, and output protocols; the role definitions specify the role of the reasoning engine and constrain it to reason strictly according to legal rules; the general reasoning principles embed legal professional rules, including parameter source principles and legal hierarchy principles; the example learning samples provide reasoning examples of standard answers; and the output protocols constrain the format of the output results. A language model with a small number of parameters is used as the inference engine to load and execute the structured prompt words.
[0076] In one alternative approach, the step of generating a preliminary logical draft by a problem-solving agent based on the problem to be solved and the core legal provisions includes: Input the problem to be processed and the core legal provisions into the reasoning engine; Under the constraints of the structured prompts, the reasoning engine extracts calculation parameters from the legal provisions and generates a calculation logic chain according to the predetermined reasoning steps to obtain a preliminary logic draft; the predetermined reasoning steps include case characterization, formula construction, legal provision screening, and numerical calculation.
[0077] In one optional approach, after inputting the initial logical draft, the top N candidate legal fragments ranked by relevance from at least one candidate legal fragment, and the question to be processed into the evaluation agent for knowledge exploration and information completion, logical error correction and parameter replacement are performed to obtain a structured answer, including: The evaluation agent classifies the user's intent according to preset legal categories based on the problem to be processed, and determines the user's true computational needs. The evaluation agent verifies the legal provisions cited by the solution agent from the perspective of legal provision citation review, based on legal rules. The verification includes: determining whether the cited legal provisions in the initial logic draft can form a complete logical chain, whether the judicial interpretation provides corresponding substantive legal support, whether there is a conflict between legal provisions, and whether the legal provisions conform to the hierarchy of validity and general principles. After the review is completed, the evaluation agent re-outputs the optimized results in the same format as the solution agent, as a structured answer.
[0078] This invention, in its embodiments, acquires a user-input question; based on the question, it invokes an embedded model, deeply fine-tuned in the legal domain, to perform a global intensive search in a preset legal database, obtaining at least one candidate legal fragment; using a re-ranking model, it performs cross-semantic scoring on the at least one candidate legal fragment and the target case text, obtaining the top N core legal provisions with the highest relevance to the target case text; a solution agent generates a logical draft based on the question and the core legal provisions; the logical draft, the top N candidate legal fragments with the highest relevance, and the question are input into an evaluation agent for review, resulting in a final structured answer, thus improving the accuracy of legal information query analysis and calculation.
[0079] This invention provides a method for setting logical constraints on legal numerical calculations. This method forces the model to strictly follow a specific execution flow when performing legal calculations: “case characterization, construction of calculation formula, extraction of legal provisions based on parameter sources, and substitution of numerical calculations.” This method effectively solves the problem of logical chain breaks that easily occur in large models during complex mathematical calculations.
[0080] This invention innovatively proposes a two-stage architecture consisting of a weak and a strong solving agent and an evaluation agent. The solving agent rapidly generates an initial draft, while the evaluation agent performs multi-dimensional review and correction. The architecture includes a task division design between the solving and evaluation agents; a multi-dimensional review mechanism for the evaluation agent (intent recognition, legal citation review, and numerical review); and a correction and rewriting strategy based on the review results. The solving agent generates preliminary results using thought chain technology, and the evaluation agent then reviews and corrects these results from three dimensions: intent recognition, legal citation, and numerical calculation. This effectively avoids reasoning errors and significantly improves the accuracy of numerical calculations.
[0081] This invention provides a computer-readable storage medium storing at least one executable instruction that, when executed on a computer device, causes the computer device to perform the multi-agent collaborative legal numerical calculation method based on a large language model in any of the above method embodiments.
[0082] Executable instructions can be used to cause computer devices to perform the following operations: Obtain the pending issues input by the user; the pending issues include target case text, which includes complex case details and implicit numerical claims information; Based on the problem to be processed, an embedded model that has been finely tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment. Using a reordering model, cross-semantic scoring is performed on at least one candidate legal fragment and the target case text to obtain the top N core legal provisions with the highest relevance to the target case text; The logic draft is generated by the solving agent based on the problem to be processed and the core legal provisions. The logic draft includes the initial calculation formula, initial numerical results, initial legal basis and initial thought process information corresponding to the target case text. The initial logical draft, the top N candidate legal segments with the highest relevance among at least one candidate legal segment, and the problem to be processed are input into the evaluation agent for review, and the final structured answer is obtained; the structured answer includes the final numerical result, the final legal basis, and complete thought process information.
[0083] In an alternative approach, before invoking the embedding model, which has been deeply fine-tuned in the legal domain, to perform a global intensive search in a pre-defined legal database based on the semantic vector to obtain at least one candidate legal fragment, the method further includes: Obtain a training set; the training set includes input training question samples and corresponding labeled standard answer tags; the training set includes user-queried input training question samples, positive example legal provisions, and negative example legal provisions triplet; The input training question samples from the training set are fed into the basic embedding model to obtain all the preliminary regulatory recall results. After sorting all the preliminary regulatory recall results through the initial re-ranking model, the preliminary Top-N regulatory recall results are obtained. In the Top-N legal recall results, positive example legal provisions corresponding to the labeled standard answer are removed, and in the remaining Top-N-1 legal recall provisions, the legal provisions with the middle ranking and semantic confusion are extracted as the difficult negative example legal provisions corresponding to the input training question samples. The difficult-to-bear example legal provisions are updated to the training set, and the basic embedding model and the initial reordering model are further trained to obtain the embedding model and reordering model that have been deeply fine-tuned in the legal domain.
[0084] In one alternative approach, the step of invoking a deeply fine-tuned embedding model based on the legal domain to perform a global intensive search in a pre-defined legal database, based on the problem to be addressed, to obtain at least one candidate legal fragment, including: The target case text is semantically vectorized to obtain the corresponding semantic vector; Based on the semantic vector, an embedding model that has been deeply fine-tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment.
[0085] In one optional approach, the solving agent includes a structured prompt-guided model and an inference engine; the structured prompt-guided model is configured to constrain the inference engine through structured prompts, causing the inference engine to generate calculation results according to predetermined steps based on the recalled regulations and user questions; before the solving agent generates a logical draft based on the problem to be processed and the core legal provisions, the method further includes: The model is guided by pre-constructed prompts; these prompts include at least role definitions, general reasoning principles, example learning samples, and output protocols; the role definitions specify the role of the reasoning engine and constrain it to reason strictly according to legal rules; the general reasoning principles embed legal professional rules, including parameter source principles and legal hierarchy principles; the example learning samples provide reasoning examples of standard answers; and the output protocols constrain the format of the output results. A language model with a small number of parameters is used as the inference engine to load and execute the structured prompt words.
[0086] In one alternative approach, the step of generating a preliminary logical draft by a problem-solving agent based on the problem to be solved and the core legal provisions includes: Input the problem to be processed and the core legal provisions into the reasoning engine; Under the constraints of the structured prompts, the reasoning engine extracts calculation parameters from the legal provisions and generates a calculation logic chain according to the predetermined reasoning steps to obtain a preliminary logic draft; the predetermined reasoning steps include case characterization, formula construction, legal provision screening, and numerical calculation.
[0087] In one optional approach, after inputting the initial logical draft, the top N candidate legal fragments ranked by relevance from at least one candidate legal fragment, and the question to be processed into the evaluation agent for knowledge exploration and information completion, logical error correction and parameter replacement are performed to obtain a structured answer, including: The evaluation agent classifies the user's intent according to preset legal categories based on the problem to be processed, and determines the user's true computational needs. The evaluation agent verifies the legal provisions cited by the solution agent from the perspective of legal provision citation review, based on legal rules. The verification includes: determining whether the cited legal provisions in the initial logic draft can form a complete logical chain, whether the judicial interpretation provides corresponding substantive legal support, whether there is a conflict between legal provisions, and whether the legal provisions conform to the hierarchy of validity and general principles. After the review is completed, the evaluation agent re-outputs the optimized results in the same format as the solution agent, as a structured answer.
[0088] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the multi-agent collaborative legal numerical calculation methods based on a large language model provided in this application.
[0089] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the multi-agent collaborative legal numerical calculation methods based on a large language model provided in this application.
[0090] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0091] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0092] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0093] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
[0094] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, the embodiments of the present invention are not directed to any particular programming language. It should be understood that the content of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the invention.
[0095] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0096] Similarly, it should be understood that, in order to streamline the invention and aid in understanding one or more of the various aspects of the invention, features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the above description of exemplary embodiments of the invention. However, this disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim.
[0097] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0098] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the order of execution.
Claims
1. A multi-agent collaborative legal numerical calculation method based on a large language model, characterized in that, The method includes: Obtain the pending issues input by the user; the pending issues include target case text, which includes complex case details and implicit numerical claims information; Based on the problem to be processed, an embedded model that has been finely tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment. Using a reordering model, cross-semantic scoring is performed on at least one candidate legal fragment and the target case text to obtain the top N core legal provisions with the highest relevance to the target case text; The logic draft is generated by the solving agent based on the problem to be processed and the core legal provisions. The logic draft includes the initial calculation formula, initial numerical results, initial legal basis and initial thought process information corresponding to the target case text. The initial logical draft, the top N candidate legal segments with the highest relevance among at least one candidate legal segment, and the problem to be processed are input into the evaluation agent for review, and the final structured answer is obtained; the structured answer includes the final numerical result, the final legal basis, and complete thought process information.
2. The method according to claim 1, characterized in that, Before invoking the embedding model, which has been deeply fine-tuned in the legal domain, based on the semantic vector to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment, the method further includes: Obtain a training set; the training set includes input training question samples and corresponding labeled standard answer tags; the training set includes user-queried input training question samples, positive example legal provisions, and negative example legal provisions triplet; The input training question samples from the training set are fed into the basic embedding model to obtain all the preliminary regulatory recall results. After sorting all the preliminary regulatory recall results through the initial re-ranking model, the preliminary Top-N regulatory recall results are obtained. In the Top-N legal recall results, positive example legal provisions corresponding to the labeled standard answer are removed, and in the remaining Top-N-1 legal recall provisions, the legal provisions with the middle ranking and semantic confusion are extracted as the difficult negative example legal provisions corresponding to the input training question samples. The difficult-to-bear example legal provisions are updated to the training set, and the basic embedding model and the initial reordering model are further trained to obtain the embedding model and reordering model that have been deeply fine-tuned in the legal domain.
3. The method according to claim 2, characterized in that, The process involves invoking a deeply fine-tuned embedding model based on the legal domain to perform a global intensive search in a pre-defined legal database, yielding at least one candidate legal fragment, including: The target case text is semantically vectorized to obtain the corresponding semantic vector; Based on the semantic vector, an embedding model that has been deeply fine-tuned in the legal field is invoked to perform a global intensive search in a preset legal database to obtain at least one candidate legal fragment.
4. The method according to any one of claims 1-3, characterized in that, The solving agent includes a structured prompt word guidance model and an inference engine; the structured prompt word guidance model is configured to impose inference constraints on the inference engine through structured prompt words, so that the inference engine generates calculation results according to predetermined steps based on the recalled regulations and user questions; Before the initial logic draft is generated by the solving agent based on the problem to be processed and the core legal provisions, the method further includes: The model is guided by pre-constructed prompts; these prompts include at least role definitions, general reasoning principles, example learning samples, and output protocols; the role definitions specify the role of the reasoning engine and constrain it to reason strictly according to legal rules; the general reasoning principles embed legal professional rules, including parameter source principles and legal hierarchy principles; the example learning samples provide reasoning examples of standard answers; and the output protocols constrain the format of the output results. A language model with a small number of parameters is used as the inference engine to load and execute the structured prompt words.
5. The method according to claim 4, characterized in that, The process involves a problem-solving agent generating a logical draft based on the problem to be solved and the core legal provisions, including: Input the problem to be processed and the core legal provisions into the reasoning engine; Under the constraints of the structured prompts, the reasoning engine extracts calculation parameters from the legal provisions and generates a calculation logic chain according to the predetermined reasoning steps to obtain a preliminary logic draft; the predetermined reasoning steps include case characterization, formula construction, legal provision screening, and numerical calculation.
6. The method according to any one of claims 1-3, characterized in that, The process involves inputting the initial logical draft, the top N candidate legal segments in terms of relevance from at least one candidate legal segment, and the question to be processed into the evaluation agent for knowledge exploration and information completion. Then, logical error correction and parameter replacement are performed to obtain a structured answer, including: The evaluation agent classifies the user's intent according to preset legal categories based on the problem to be processed, and determines the user's true computational needs. The evaluation agent verifies the legal provisions cited by the solution agent from the perspective of legal provision citation review, based on legal rules. The verification includes: determining whether the cited legal provisions in the initial logic draft can form a complete logical chain, whether the judicial interpretation provides corresponding substantive legal support, whether there is a conflict between legal provisions, and whether the legal provisions conform to the hierarchy of validity and general principles. After the review is completed, the evaluation agent re-outputs the optimized results in the same format as the solution agent, as a structured answer.
7. A multi-agent collaborative legal numerical calculation device based on a large language model, characterized in that, The device includes: The acquisition module is used to acquire the pending issues input by the user; the pending issues include target case text, which includes complex case details and implicit numerical appeal information; The retrieval module is used to invoke an embedded model that has been finely tuned in the legal field to perform a global intensive search in a preset legal database based on the problem to be processed, and to obtain at least one candidate legal fragment. The filtering module is used to perform cross-semantic scoring on the at least one candidate legal fragment and the target case text using a re-ranking model, so as to obtain the top N core legal provisions with the highest relevance to the target case text. The solution module is used to generate a logical draft by reasoning based on the problem to be processed and the core legal provisions through a solution agent; the logical draft includes the initial calculation formula, initial numerical results, initial legal basis and initial thought process information corresponding to the target case text. The review module is used to input the initial logical draft, the top N candidate legal segments with the highest relevance among at least one candidate legal segment, and the question to be processed into the evaluation agent for review, and then obtain the final structured answer; the structured answer includes the final numerical result, the final legal basis, and complete thought process information.
8. A computer device, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the operation of the multi-agent collaborative legal numerical calculation method based on a large language model as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The storage medium stores at least one executable instruction, which, when executed on a computer device, causes the computer device to perform the operation of the multi-agent collaborative legal numerical calculation method based on a large language model as described in any one of claims 1-6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the multi-agent collaborative legal numerical calculation method based on a large language model according to any one of claims 1-6.
