Regulation retrieval processing method and device of large language model

By combining a large language model with multi-dimensional vector decomposition and metadata verification rules, a legal retrieval method has been developed, which solves the problems of inaccurate intent identification and dirty data in vector retrieval in existing technologies. This method enables in-depth processing and structured output of legal queries, thereby improving the accuracy and efficiency of retrieval.

CN122153134APending Publication Date: 2026-06-05SHANGHAI ZHIHE NETWORK TECH CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI ZHIHE NETWORK TECH CO LTD
Filing Date
2026-05-11
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing legal retrieval systems suffer from inaccurate intent recognition, messy and unstructured vector retrieval data, and an inability to accurately match user needs, resulting in inaccurate and redundant search results.

Method used

The system employs a large language model for intent recognition, generates retrieval element objects through a multi-dimensional vector decomposition algorithm, sends concurrent query requests to the legal vector database, performs secondary cleaning and filtering based on preset metadata verification rules, and finally renders structured legal analysis data according to the priority order of substantive law and procedural law analysis.

Benefits of technology

It enables in-depth processing of legal queries, ensuring the purity and anti-illusion traceability of output data, improving the accuracy and structure of retrieval, reducing noisy data, and improving the system's operating efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122153134A_ABST
    Figure CN122153134A_ABST
Patent Text Reader

Abstract

The application provides a legal regulation retrieval processing method and device of a large language model, which comprises receiving a legal query, identifying the intention of the legal query by the large language model, routing the legal query to an intention processing branch, performing characteristic fission on the legal query when it is determined to be a legal regulation retrieval branch, generating a plurality of retrieval element objects, encapsulating and sending the retrieval element objects to a legal regulation vector database, sorting the legal regulation vector database according to a similarity score to obtain an initial legal regulation metadata set, splicing the metadata set and a query string, inputting the spliced result into the large language model, performing secondary cleaning and filtering on the spliced result according to a preset metadata verification rule set, outputting a correlation determination identifier, removing irrelevant legal regulations, constructing a precise legal regulation data set, inputting the data set into the large language model, and rendering and outputting a structured legal analysis data object to a client according to a preset entity law and procedural law analysis priority order and a legal regulation reference regular expression. Through the processing scheme, the absolute purity and anti-illusion traceability of the output data are effectively ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence technology, and in particular relates to a method and apparatus for legal retrieval and processing using a large language model. Background Technology

[0002] The sheer number and variety of laws and regulations issued by the state present a significant challenge for legal professionals: retrieving the necessary laws and regulations accurately and efficiently from this vast amount of data within a limited timeframe. While the rapid development of information technology has led to the emergence of numerous products that combine legal and information technology, these legal retrieval systems are largely based on keyword matching or basic vector similarity retrieval, exhibiting significant technical limitations.

[0003] Existing product intent understanding and distribution capabilities are weak, failing to accurately distinguish user intent, resulting in a simplistic recall strategy and results that do not match users' actual needs. When processing long text case descriptions, traditional search engines directly input the entire text into a vector database. A large number of irrelevant and redundant words (such as sentiment words and non-core facts) cause vector space shifts, leading to search failures. Simple vector retrieval can easily recall legal provisions that are superficially similar but completely inapplicable due to insufficient validity, expiration, or mismatch with industry verticals. The system lacks a secondary cross-validation and cleaning mechanism based on regulatory metadata. Existing systems only return a loose set of legal provisions; the backend lacks a mandatory logical sorting and regular expression constraint mechanism, failing to automatically render logically rigorous, illusion-proof, and standard reference anchor structured data objects.

[0004] To address these issues, it is urgent to design a legal retrieval processing method based on a large language model, in order to solve the problems of inaccurate intent recognition, excessive dirty data in vector retrieval, and unstructured backend output in existing technologies. Summary of the Invention

[0005] Therefore, in order to overcome the shortcomings of the prior art, the present invention provides a legal retrieval processing method and apparatus for large language models, so as to solve the problems of inaccurate intent recognition, excessive dirty data in vector retrieval, and unstructured background output in the prior art.

[0006] To achieve the above objectives, this invention provides a legal retrieval processing method based on a large language model, comprising: receiving a legal query string from a client; calling a built-in large language model engine for intent recognition; routing the query string to a preset intent processing branch; when the intent processing branch corresponding to the query string is determined to be a legal retrieval branch, calling a multi-dimensional vector decomposition algorithm to perform feature fission on the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct retrieval element objects; encapsulating the multiple retrieval element objects into concurrent query requests; sending the concurrent query requests to a legal vector database; the legal vector database retrieving matching legal articles based on the multiple retrieval element objects; sorting the legal articles by similarity score to form an initial legal metadata set; the large language model performing secondary cleaning and filtering on the initial legal metadata set fed back by the legal vector database according to a preset metadata verification rule set and the query string, outputting a relevance determination identifier corresponding to each legal article, and constructing a precise legal dataset; inputting the precise legal dataset into the large language model; rendering and outputting structured legal analysis data objects to the client according to a preset priority order of substantive law and procedural law analysis and regular expressions for legal article citation.

[0007] In one embodiment, receiving a legal query string from a client, calling the built-in large language model engine for intent recognition, and routing the query string to a preset intent processing branch includes: receiving legal query text from the client, preprocessing the text to remove invalid interference information, extracting the query string from the text, and inputting the query string into the large language model; the intent recognition module of the large language model performs semantic understanding and classification on the query string, and outputs standardized intent labels; and matching the intent processing branch corresponding to the query string according to the identified intent labels.

[0008] In one embodiment, the invocation of a multi-dimensional vector decomposition algorithm performs feature fission on the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct retrieval element objects. This includes: parsing the number of legal subjects contained in the query string according to a preset three-element rule based on subject-behavior-dispute point, wherein the number of legal subjects is determined based on the identified legal subjects; extracting the core legal name of the query string, ensuring that only a single legal name can be contained in the same retrieval element object; constraining the number and format of retrieval element strings in the retrieval element objects; and filtering preset interference feature phrases using an exclusive dictionary on the retrieval element objects.

[0009] In one embodiment, the step of encapsulating the plurality of search element objects into concurrent query requests and sending the concurrent query requests to a regulatory vector database, wherein the regulatory vector database retrieves matching regulatory articles based on the plurality of search element objects and sorts the regulatory articles by similarity score to form an initial regulatory metadata set, includes: structurally encapsulating the plurality of search element objects to generate concurrent query requests; sending the concurrent query requests to the regulatory vector database, wherein the regulatory vector database performs high-dimensional similarity calculations on the plurality of search element objects and regulatory entries in the database, wherein the regulatory vector database retrieves matching regulatory articles based on the plurality of search element objects; and sorting the regulatory articles according to the similarity score from high to low to obtain and output the initial regulatory metadata set.

[0010] In one embodiment, the large language model performs secondary cleaning and filtering on the initial set of legal metadata returned by the legal vector database based on a preset set of metadata verification rules and the query string, outputting a relevance determination identifier corresponding to each legal provision, and constructing an accurate legal dataset. This includes: the large language model performing semantic understanding on the initial set of legal metadata returned by the legal vector database; the large language model performing secondary cleaning and filtering on the initial set of legal metadata returned by the legal vector database based on the preset set of metadata verification rules and the query string, filtering the initial set of legal metadata, and outputting a list of candidate legal provisions; and performing relevance determination on the list of candidate legal provisions, removing irrelevant legal provisions, and constructing and outputting an accurate legal dataset.

[0011] In one embodiment, the preset metadata verification rule set includes: timestamp blocking rule: extract the implementation date field from a single piece of regulatory metadata; if the date is found to be earlier than the baseline year set by the system, the identifier is directly output as false; vertical domain mapping rule: extract the domain features of the query string; if it is identified as a specific domain, the industry classification field of the single piece of regulatory metadata is forcibly verified to be the corresponding system; if they do not match, the identifier is output as false; file type filtering rule: unless there is a clear specific file type trigger word in the query string, metadata containing guiding cases, judicial cases, or modification decisions in the regulatory name is automatically intercepted and removed.

[0012] In one embodiment, the step of inputting the precise legal dataset into the large language model, rendering and outputting a structured legal analysis data object to the client according to a preset priority order for substantive and procedural law analysis and regular expressions for legal citation, includes: inputting the precise legal dataset into the large language model; the large language model loading preset priority rules for substantive and procedural law analysis and regular expressions for legal citation to constrain the analysis logic and output format of the large language model; the large language model generation engine performing legal reasoning and legal citation matching based on the precise legal dataset, analysis priority rules, and regular expressions for legal citation to generate initial legal analysis content; performing structured parsing on the initial legal analysis content, extracting core analysis fields, verifying the authenticity and accuracy of legal citations, and generating a standardized structured legal analysis data object; rendering the structured legal analysis data object, converting it into a format that can be displayed by the client, and outputting it to the client.

[0013] In one embodiment, the specific execution steps for rendering and outputting the structured legal analysis data object include: based on the validity level field and issuing authority field of each legal provision in the precise legal dataset, according to the descending weight of laws, judicial interpretations, and administrative regulations, prioritizing the substantive law logical reasoning of high-weight legal provisions, followed by procedural law logical reasoning; at the end of each logical point in the generated analysis data object, calling a preset text formatting function to force the injection of reference anchors according to a specific nested syntax format containing the law name, provision number, and unique identifier of the underlying law.

[0014] In one embodiment, the method includes: sending a query text received by a client device to a terminal; the terminal performing intent recognition, feature splitting, high-dimensional batch processing retrieval, large model secondary cleaning and filtering, and formatted rendering with regularization constraints based on the query text; and returning the rendering result to the client device; sending the query text processed by the terminal to a regulatory vector database; and the regulatory vector database, based on the query text and the regulatory articles matching the retrieval database, feeding back to the terminal an initial set of regulatory metadata sorted from high to low according to similarity scores.

[0015] A regulatory retrieval and processing device based on a large language model, installed on a terminal, the device comprising: The system comprises the following modules: **Intent Recognition Module:** Receives legal query strings from the client, calls the built-in large language model engine for intent recognition, and routes the query string to a preset intent processing branch. **Feature Fission Module:** When the intent processing branch corresponding to the query string is determined to be a legal retrieval branch, the feature fission module calls a multi-dimensional vector decomposition algorithm to fission the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct retrieval element objects. **Concurrent Recall Module:** Initiates concurrent retrieval to the legal vector database and receives the initial legal metadata set from the database. **Cross-Cleaning Module:** Performs secondary cleaning and filtering on the initial legal metadata set from the legal vector database based on a preset metadata verification rule set and the query string, outputting a relevance determination identifier corresponding to each legal provision, and constructing a precise legal dataset. **Output Module:** Inputs the precise legal dataset into the large language model, renders and outputs structured legal analysis data objects to the client based on the preset priority order of substantive law and procedural law analysis and regular expressions for legal provision citations.

[0016] Compared with existing technologies, the advantages of this invention are: it constructs a full-link workflow of "intent recognition → multi-dimensional feature fission → high-dimensional batch processing recall → large model secondary cleaning and filtering → formatted rendering with regularization constraints," achieving in-depth processing of legal query strings. In particular, it innovatively proposes a multi-dimensional vector decomposition algorithm based on character thresholds and exclusive thesaurus filtering, as well as cross-validation rules based on timestamp truncation and strong vertical domain matching, thoroughly filtering out noisy data generated by vector retrieval and ensuring the absolute purity and anti-illusion traceability of the output data. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the legal retrieval processing method for a large language model in an embodiment of the present invention; Figure 2 This is a structural block diagram of the legal retrieval processing device for a large language model in an embodiment of the present invention; Figure 3 This is an intent processing branch distribution graph of the large language model in an embodiment of the present invention; Figure 4 This is a flowchart illustrating the legal retrieval branch in an embodiment of the present invention. Detailed Implementation

[0019] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0020] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. This application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] It should be noted that the following description covers various aspects of embodiments within the scope of protection of this invention. It will be apparent that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this application, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number and aspects set forth herein can be used to implement the device and / or practice the method. Additionally, this device and / or method can be implemented using other structures and / or functionalities besides one or more of the aspects set forth herein.

[0022] It should also be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0023] Furthermore, specific details are provided in the following description to facilitate a thorough understanding of the examples. However, those skilled in the art will understand that the aspects described can be practiced without these specific details.

[0024] Existing legal retrieval methods suffer from weak product intent understanding and distribution capabilities, failing to accurately distinguish user intent and resulting in simplistic recall strategies that do not match actual user needs. When processing long text case descriptions, traditional search engines directly input the entire text into a vector database. Numerous irrelevant and redundant words (such as sentimental terms and non-core facts) cause vector space shifts, leading to retrieval failures. Simple vector retrieval can easily recall legal provisions that are superficially similar but completely inapplicable due to insufficient validity, expiration, or mismatch with industry verticals. The system lacks a secondary cross-validation and cleaning mechanism based on legal metadata. Existing systems only return a loose set of legal provisions; the backend lacks a mandatory logical sorting and regular expression constraint mechanism, failing to automatically render logically rigorous, illusion-proof, and standard citation anchors into structured data objects.

[0025] In view of this, the present invention proposes a legal retrieval processing method based on a large language model to solve the problems of inaccurate intent recognition, excessive dirty data in vector retrieval, and unstructured backend output in the prior art.

[0026] The legal retrieval processing method of this large language model can be applied to servers or terminals. Terminals can be, but are not limited to, various personal computers, laptops, smartphones, tablets and portable smart devices. Servers can be implemented using independent servers or server clusters composed of multiple servers.

[0027] like Figure 1 As shown, this application provides a legal retrieval processing method for a large language model. Taking the application of this method to a server as an example, it includes the following steps: Step 101: Receive a legal query string from the client, call the built-in large language model engine to perform intent recognition, and route the query string to the preset intent processing branch.

[0028] The server receives legal query text from the client, preprocesses the text, filters out meaningless interference information such as spaces, line breaks, redundant punctuation, modal particles, irrelevant nonsense, and repeated sentences, standardizes the text format, accurately extracts core legal query keywords and complete query statements, generates standardized query strings, and inputs the standardized query strings into the built-in large language model to carry out legal question analysis, legal provision matching, and consultation response.

[0029] The intent recognition module of the large language model performs semantic parsing, contextual understanding, and request classification on the query string, and outputs standardized intent labels.

[0030] Based on the identified intent tags, the system matches the corresponding intent processing branch pre-configured by the system, and simultaneously sends the original query text, the extracted query string, and the intent tags to the matched target processing branch.

[0031] Step 102: When it is determined that the intent processing branch corresponding to the query string is the legal retrieval branch, the multi-dimensional vector decomposition algorithm is called to perform feature fission on the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct retrieval element objects.

[0032] The server determines that the current query string matches the legal retrieval intent branch, triggers the corresponding retrieval processing logic, and starts the built-in multi-dimensional vector decomposition algorithm. Based on preset structured rules for the three elements of subject, behavior, and point of contention, the server performs semantic feature decomposition and fragmentation analysis on the query statement.

[0033] Extract the core elements of the legal subject, legal act, and dispute, and then decompose the semantic information into discrete parts. For example, a query might be: "Tenant is in arrears with rent, landlord demands termination of the lease and payment of outstanding fees." The three key elements are: Subject: Landlord, Tenant; Act: Rent arrears, refusal to fulfill contractual obligations; Dispute: Termination of lease agreement, rent collection.

[0034] Step 103: Encapsulate the multiple search element objects into a concurrent query request, and send the concurrent query request to the regulatory vector database. The regulatory vector database retrieves matching regulatory articles based on the multiple search element objects, and sorts the regulatory articles by similarity score to form an initial regulatory metadata set.

[0035] The server processes and encapsulates multiple search element objects to generate concurrent query requests. These concurrent query requests can be structured semantic retrieval data packages, containing search elements grouped into various dimensions, Boolean logic matching structures between elements, a normalized feature vector array of legal provisions, and structured metadata such as classification labels, weights, and search scope.

[0036] The server sends concurrent query requests to the regulatory vector database. Based on a high-dimensional semantic space, the database calculates high-dimensional similarity between the retrieved element objects and the regulatory entries in the database, outputting a semantic similarity score for each retrieved element object. The database then sorts the matching regulatory entries from highest to lowest based on the obtained similarity scores, forming an initial set of regulatory metadata.

[0037] The legal vector database is a specialized structured semantic database that pre-stores various legal provisions, judicial interpretations and their corresponding high-dimensional semantic feature vectors, enabling efficient concurrent semantic retrieval and high-dimensional vector similarity comparison operations.

[0038] Step 104: The large language model performs secondary cleaning and filtering on the initial set of legal metadata returned by the legal vector database based on the preset set of metadata verification rules and the query string, and outputs the relevance judgment identifier corresponding to each legal article to construct an accurate legal dataset.

[0039] The server concatenates the query string with each individual piece of legal metadata from the initial set of legal metadata to generate standardized input text that conforms to the input format requirements of the large language model. The server then inputs this text into the large language model, which performs in-depth semantic understanding, contextual analysis, and legal provision suitability assessment. Following a pre-defined set of metadata verification rules, the large language model performs multi-level secondary cleaning and filtering of the retrieved legal entries, outputting a relevance level determination label for each legal provision.

[0040] Based on the relevance assessment results, legal provisions with low relevance, semantic irrelevant, and redundant interference are removed. The effective matching legal provisions are then organized and summarized to finally construct a precise legal dataset with high semantic fit, accurate and standardized content, and adaptability to legal application scenarios.

[0041] Step 105: Input the precise legal dataset into the large language model, and render and output a structured legal analysis data object to the client according to the preset priority order of substantive law and procedural law analysis and the regular expression of legal citation.

[0042] The server inputs the precise legal dataset into the large language model, which automatically loads two core rules: the priority order of substantive and procedural law analysis and the regular expression for citation of legal provisions. These preset rules serve as the logical basis for legal analysis, ensuring that the analysis process conforms to legal practice norms and avoiding problems such as incorrect citation of legal provisions and chaotic analysis logic.

[0043] The large language model generation engine initiates the legal analysis process, combining preset priority orders and regular expressions for legal citations. It performs a comprehensive and in-depth legal analysis of the input case-related information, and then renders the analysis results in a structured manner, generating standardized legal analysis data objects. These data objects are then output to the client via a preset communication protocol, ensuring the stability, security, and efficiency of the output process. The system also supports client-side parsing, display, and subsequent operations on the data objects.

[0044] The above method provides a method for retrieving and processing regulations of a large language model, constructs a full-link workflow of "intent recognition → multi-dimensional feature fission → high-dimensional batch processing recall → secondary cleaning and filtering of the large model → formatted rendering with regular constraints", and realizes the deep processing of legal query strings. In particular, an innovative multi-dimensional vector decomposition algorithm based on character threshold and exclusive vocabulary filtering, as well as a cross-validation rule based on timestamp truncation and strong matching in vertical fields, are proposed, which thoroughly filters the noise data generated by vector retrieval and ensures the absolute purity and hallucination-proof traceability of the output data.

[0045] As Figure 3 shown, in one embodiment, a legal query string from a client is received, and the built-in large language model engine is called for intent recognition, and the query string is routed to a preset intent processing branch, including the following steps: Step 1, receive the legal query text from the client, preprocess the text, remove meaningless information, extract the query string from the text, and input the query string into the built-in large language model.

[0046] The server receives the user natural language legal query text uploaded by the client terminal, performs text preprocessing operations on the accessed legal query text, and filters out meaningless interference information such as spaces, line breaks, punctuation redundancy, modal particles, irrelevant nonsense, and repeated statements.

[0047] The server obtains a preset dictionary library corresponding to the language of the query text, corrects spelling mistakes in the cleaned query problem according to the dictionary library, and obtains the corrected query problem. The dictionary library contains a large amount of vocabulary memory-related information, such as word nature, word meaning, synonyms, antonyms, word frequency, etc.

[0048] According to the dictionary library, spelling mistakes in the query text are corrected, and the grammar and syntax errors of the query problem are corrected, so as to improve the semantic accuracy and text confidence of the query problem. For example: the confusion between "power" and "right" in the text, the legitimate rights of citizens, which are easily misspelled as "power". The confusion between "legality" and "rule of law" in the text, the rule of law society and governance according to law, which are often misspelled as "legality". Identify and correct homophonic misspelled words such as "qichai" → "qisu", "zhongcai" → "zhongcai", "bianhu" → "bianhu". Identifying such spelling mistakes can improve the matching degree of legal provisions and regulations retrieval.

[0049] Filter out interference information from the query text, correct spelling mistakes, extract the query string, and input the query string into the built-in large language model.

[0050] Step 2, the intent recognition module of the large language model performs semantic understanding and classification on the query string, and outputs a standardized intent label.

[0051] The large language model inference engine combines legal semantic vectors, contextual features of legal provisions, and semantic logic of judicial scenarios. It performs deep semantic analysis of query strings, legal scenario-based matching, multi-dimensional breakdown of claims, dispute type determination, and hierarchical identification of consultation purposes. The model's output intent tags are matched against a local pre-defined legal intent classification database, with ambiguity checks and confidence assessments performed to filter high-confidence valid intents and exclude ambiguous intents and irrelevant claims. It automatically categorizes and outputs standardized, hierarchical, and structured searchable legal intent tags.

[0052] Step 3: Match the intent processing branch corresponding to the query string based on the identified intent tag.

[0053] Based on legal intent tags and following a preset routing strategy, the server dynamically distributes corresponding legal query requests to matching dedicated target processing branches. Target processing branches include: legal provision retrieval processing branches for single or batch legal provisions and specific article searches; legal retrieval branches for specific topic legal searches, legal basis queries, and Q&A; argumentation branches for in-depth analysis of specific articles of specific laws; and abnormal query branches for queries unrelated to law, exceeding geographical limits, or with unclear intent.

[0054] The above method receives legal query texts from clients and uses a built-in large language model to perform semantic intent recognition, automatically routing query requests to corresponding preset intent processing branches. This effectively improves the accuracy of legal consultation request classification and reduces the workload of manual semantic judgment. It enables automated triage of various types of legal business requests, significantly shortening the response time for legal retrieval and case analysis. Simultaneously, relying on standardized branch scheduling logic, it avoids cross-business logic confusion, improves the standardization and stability of legal Q&A processing, and adapts to diverse user demands such as single regulations, batch legal provisions, case consultations, and document generation, significantly improving the overall operational efficiency and service accuracy of the intelligent legal query system.

[0055] To prevent attacks involving non-legal, out-of-bounds queries, or malicious keyword injection, the system has implemented dedicated abnormal query interception and plain text security guidance branches to ensure system compliance and data security.

[0056] like Figure 4 As shown, in one embodiment, when it is determined that the intent processing branch corresponding to the query string is a legal retrieval branch, a multi-dimensional vector decomposition algorithm is invoked to perform feature fission on the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct retrieval element objects, including the following steps: Step 1: When it is determined that the intent processing branch corresponding to the query string is the legal retrieval branch, the multi-dimensional vector decomposition algorithm is invoked.

[0057] When the server determines that the intent processing branch corresponding to the query string is the legal retrieval branch, it triggers the corresponding retrieval processing logic and starts the built-in multi-dimensional vector decomposition algorithm.

[0058] Step two: Based on the multi-dimensional vector decomposition algorithm, the semantic features of the query statement are decomposed and split according to the pre-defined structural rules of the three elements of subject, behavior and dispute point.

[0059] The server uses a multi-dimensional vector decomposition algorithm to perform multi-level semantic feature decomposition and structured fission parsing on user query statements according to the pre-defined three-element structured rules of subject, behavior and dispute point, and extracts standardized legal semantic element vectors.

[0060] The extracted content includes: **Preset subject extraction:** Extracting the parties clearly identified as having rights and obligations, involved in the case, and liable for responsibility, including but not limited to natural persons, legal persons, administrative organs, and third parties, clarifying the apparent identities of each subject. **Behavioral extraction:** Extracting the specific legal actions, civil acts, administrative acts, tortious acts, or contractual performance acts carried out by the subjects, clarifying the core actions and basic characteristics of the acts. **Dispute point extraction:** Extracting the conflicts of rights, legal disagreements, contradictory claims, or focal points of judgment between the subjects, clarifying the core content of the dispute. For example, a query: A tenant is in arrears with rent, and the landlord demands termination of the lease and payment of outstanding fees. The three key characteristics are: Subjects: Landlord, Tenant; Acts: Rent arrears, refusal to perform; Dispute points: Termination of the lease contract, rent collection.

[0061] Step 3: Dynamically calculate the number of generated search element objects based on the complexity of the query string, and constrain the search element strings in each search element object to meet the preset minimum character length threshold and part-of-speech exclusion rules.

[0062] The server imposes constraints on the extracted standardized legal semantic element vectors. If fewer than two legal entities are identified, 4 to 7 search element objects are generated; if multiple different legal entities are identified, at least 10 search element objects are generated. The core legal name of the query string is extracted as a keyword field, and within the same search element object, this field is restricted to containing only a single legal name. The search element string in the search element object is constrained to be at least 15 characters long and in declarative sentence format. In the generated search element strings, an exclusive dictionary is used for filtering, removing feature strings containing preset interfering words such as "problem," "risk prevention," "case," and "legal responsibility," locking legal terminology from modification, constraining the error correction range of the large model, and improving the accuracy and rigor of legal queries.

[0063] The above method, designed for complex legal issues, employs a unique three-element decomposition approach: "subject, behavior, and point of contention." It transforms a single natural language query into a multi-dimensional search vector, and enforces character limits and full dimensional coverage in the decomposition, significantly improving the matching hit rate in vectorized retrieval of legal provisions.

[0064] In one embodiment, the plurality of search element objects are encapsulated into concurrent query requests, and the concurrent query requests are sent to a regulatory vector database. The regulatory vector database retrieves matching regulatory articles based on the plurality of search element objects and sorts the regulatory articles by similarity score into an initial regulatory metadata set, including the following steps.

[0065] Step 1: Encapsulate multiple search element objects in a structured manner to generate concurrent query requests.

[0066] The server performs input validation and standardization, verifying the validity of the input set of search element objects, checking whether each object contains required fields such as query ID and query text, and confirming that their number is within the limit.

[0067] The server performs batch vectorization of retrieved element objects, converting the collection of retrieved element objects into high-dimensional numerical vectors to improve processing efficiency. After vectorization, specific request parameters need to be configured. This includes setting core search parameters, such as the maximum number of results returned per query, similarity score threshold, similarity calculation method used, and vector index-specific search parameters. Simultaneously, filtering conditions are embedded as needed, such as restricting the geographical scope, type, effective time interval, and validity status of regulations to ensure the relevance and compliance of search results. Then, all the above components are assembled into a structured concurrent query request body. The concurrent query request body contains globally unique request IDs, timestamps, protocol versions, and other metadata, as well as a list of all query items, where each query item contains its original text, converted vector, and associated metadata. Search parameters, filtering conditions, and extended options (such as timeout settings and consistency levels) are also integrated into this body. This request body is serialized into JSON or binary formats and a message header is added for transmission.

[0068] Before sending, a comprehensive integrity verification of the encapsulated result is required, including checking data integrity, format conformity, and whether the request size exceeds database limits, to ensure the compliance and reliability of the request.

[0069] Step two: Send concurrent query requests to the regulatory vector database. The regulatory vector database performs high-dimensional similarity calculations between multiple search element objects and regulatory articles in the database. The regulatory vector database then retrieves matching regulatory articles based on the multiple search element objects.

[0070] The server sends concurrent query requests to the regulatory vector database. Upon receiving the request, the system generates a retrieval task. The database extracts the retrieval element object corresponding to the query and obtains the pre-generated high-dimensional vector representation (i.e., the query vector) from its associated metadata. It loads the locally stored set of regulatory entry vectors, which are typically generated using the same embedding model during the database entry phase, maintaining the same dimensionality as the query vector. Next, the database focuses on similarity calculation in the high-dimensional vector space, comparing the "query vector of the retrieval element object" with the "vector of each regulatory entry in the database" one by one. The calculation method typically uses cosine similarity (dot product, Euclidean distance, etc. are also supported), measuring the closeness of two vectors in direction to determine the strength of semantic relevance. During the calculation, all vectors are generally normalized to ensure comparability of scores under the same dimension, and the results are mapped to a score range of 0 to 1.

[0071] Step 3: Sort the retrieved element objects according to the similarity score from high to low, and obtain and output the initial set of regulatory metadata.

[0072] Based on the obtained similarity scores, all retrieved element objects are sorted in descending order of score value, prioritizing those with higher relevance and placing those with lower relevance later. After sorting, all sorted retrieved element objects are integrated into a structured set to obtain the initial regulatory metadata set, which is then output.

[0073] The aforementioned method, through its core design of batch processing, standardization, and semantic markup, achieves comprehensive optimization across multiple key dimensions, including system throughput, response speed, result relevance, resource utilization, and engineering maintainability. It not only directly improves the efficiency of single-retrieval searches but also lays a solid technical foundation for building a high-performance, scalable intelligent legal retrieval system, serving as an effective paradigm for handling large-scale, high-concurrency semantic retrieval scenarios. Furthermore, it provides an orderly and reliable data foundation for subsequent filtering, optimization, verification, and result generation processes.

[0074] In one embodiment, the large language model performs secondary cleaning and filtering on the initial set of regulatory metadata returned by the regulatory vector database based on a preset set of metadata verification rules and the query string, outputs a relevance determination identifier corresponding to each regulatory article, and constructs an accurate regulatory dataset, including the following steps.

[0075] Step 1: The large language model performs semantic understanding on the initial set of regulatory metadata returned by the regulatory vector database.

[0076] The server uses a preset text template to concatenate the query string with each piece of legal metadata in the initial set of legal metadata, generating a series of well-formatted "query-legal provision" combined texts, which are the model input texts.

[0077] For example, the query string is "Tenant owes rent, landlord demands termination of contract and payment of outstanding fees".

[0078] The initial set of regulatory metadata contains the following regulatory metadata: Article 1: Article 722 of the Civil Code of the People's Republic of China: The regulation states: "If the lessee fails to pay or delays paying the rent without justifiable reason, the lessor may request the lessee to pay within a reasonable period; if the lessee fails to pay within the period, the lessor may terminate the contract." Article 2: Article 563 of the Civil Code of the People's Republic of China: The regulations state: "A party may terminate a contract under any of the following circumstances: (i) the purpose of the contract cannot be achieved due to force majeure; (ii) before the expiration of the performance period, one party expressly states or indicates by its conduct that it will not perform its principal obligations; (iii) one party delays performance of its principal obligations and fails to perform within a reasonable period after being urged to do so; (iv) one party delays performance of its obligations or commits other breaches of contract that render the purpose of the contract impossible to achieve; (v) other circumstances stipulated by law. For indefinite-term contracts with obligations to be performed continuously, a party may terminate the contract at any time, but shall notify the other party within a reasonable period in advance." A pre-defined template is used to concatenate the query string and each piece of regulatory metadata one by one, ensuring clear formatting and unambiguous instructions. The concatenated result is: [User Inquiries] The tenant is behind on rent, and the landlord is demanding termination of the lease and payment of outstanding fees. [Relevant legal provisions for reference] According to Article 722 of the Civil Code of the People's Republic of China: If the lessee fails to pay or delays paying the rent without justifiable reason, the lessor may request the lessee to pay within a reasonable period; if the lessee fails to pay within the period, the lessor may terminate the contract.

[0079] The server inputs the text from each model into the large language model one by one. The large language model, with its deep semantic understanding, logical reasoning and contextual analysis capabilities, performs intent analysis and relational interpretation on each combination to understand the true intent of the query and the core meaning of the legal provisions.

[0080] Step 3: The large language model performs secondary cleaning and filtering on the initial set of legal metadata returned by the legal vector database based on the preset set of metadata verification rules and the query string, and outputs a list of candidate legal provisions.

[0081] The large language model performs secondary cleaning and filtering based on a preset set of metadata verification rules. These rules include: Timestamp blocking rules: Extracting the implementation date field from a single piece of regulatory metadata; if the date is earlier than the system's set base year, it is directly marked as false. Vertical domain mapping rules: Extracting the domain features of the query string; if it is identified as a specific domain, it forcibly verifies whether the industry classification field of the single piece of regulatory metadata corresponds to the system; if not, it is marked as false. File type filtering rules: Unless the query string contains explicit trigger words for a specific file type, metadata containing guiding cases, judicial cases, or amendment decisions in the regulatory name is automatically blocked and removed.

[0082] Output a more reliable list of candidate legal provisions after objective rule validation.

[0083] Step four: Determine the relevance of the candidate legal provisions list, remove irrelevant provisions, and construct and output an accurate legal dataset.

[0084] After receiving the candidate legal provisions list, the server initiates a judgment task for each provision, executes the core judgment logic, and generates a binary judgment result of "relevant" or "irrelevant" based on semantic matching degree, direct solution degree, and applicability strength. Irrelevant provisions are removed, and relevant provisions are retained. All retained relevant provisions are encapsulated according to a preset data structure. Each provision contains standardized fields such as a unique identifier, full text of the provision, validity status, similarity score, core relevance points, applicable scenarios, and validity level, ensuring the structure and standardization of the dataset, and constructing and outputting an accurate legal dataset.

[0085] The above method innovatively introduces a "large language model secondary cleaning and filtering" mechanism after basic vector retrieval. By concatenating user commands with the initially recalled single-leg metadata (such as issuing authority and level of validity), the method utilizes the logical reasoning ability of the large language model to determine relevance, effectively eliminating irrelevant legal provisions that are similar in form but not in essence, and completely solving the pain point of high noise in traditional vector retrieval.

[0086] In one embodiment, the precise legal dataset is input into a large language model generation engine, and a structured legal analysis data object is rendered and output to the client according to the preset priority order of substantive law and procedural law analysis and the regular expression of legal citation. This includes the following steps.

[0087] Step 1: Input the accurate legal dataset into the large language model generation engine. The large language model loads the preset priority rules for entity law and procedural law analysis and the regular expressions for citation of legal provisions, which constrain the analysis logic and output format of the large language model.

[0088] The server inputs a precise legal dataset into the large language model generation engine. During model analysis, two sets of core preset rules are loaded and applied simultaneously: Priority rules for substantive law and procedural law analysis: The analysis priority order is substantive law over procedural law. The model first analyzes the provisions of laws and regulations regarding rights, obligations, and responsibilities (substantive law), and then processes the relevant content of procedures, steps, and jurisdiction for realizing these rights (procedural law). Based on the validity level field and issuing authority field of each legal provision in the precise legal dataset, according to the descending weight of laws, judicial interpretations, and administrative regulations, the model prioritizes the substantive law logical reasoning for higher-weighted legal provisions, followed by the procedural law logical reasoning.

[0089] Legal citation regular expression rules: By using legal citation regular expressions, at the end of each logical point in the generated analysis data object, a preset text formatting function is called to force the injection of citation anchors according to a specific nested syntax format that includes the law name, article number, and the unique identifier ID of the underlying law. For example, "Based on Article N of the XX Law", thus establishing a preliminary network of relationships between legal provisions.

[0090] Step two: The large language model generation engine performs legal reasoning and legal provision matching based on the precise legal dataset, analysis priority rules, and regular expressions for legal citations to generate initial legal analysis content.

[0091] The large language model generation engine is based on accurate legal datasets, guided by analysis priority rules, and uses regular expressions for legal citation as standards to conduct legal reasoning and legal citation matching, generating initial legal analysis content that fits the norms.

[0092] Step 3 involves performing structured parsing of the initial legal analysis content, extracting core analysis fields, verifying the authenticity and accuracy of legal citations, and generating standardized structured legal analysis data objects.

[0093] The server performs a structured breakdown of the initial legal analysis content, accurately extracting core fields such as case facts, points of contention, legal basis, liability determination, and judgment conclusions. It verifies the current validity of cited legal provisions and the match between the provision numbers and the content. It checks whether the legal provisions are invalid, incorrectly cited, or improperly applied. Finally, it organizes and generates standardized, reusable structured legal analysis data objects according to a unified format.

[0094] Step four: Render the structured legal analysis data object, convert it into a format that can be displayed by the client, and output it to the client.

[0095] The server renders and processes the structured legal analysis data objects, performing preprocessing such as null value completion, status coloring, long text formatting, and hierarchical sorting. It then breaks down the front-end into modular components according to case information, legal provision verification, logical analysis, and legal conclusions, adapting them to PC and mobile interface styles, and adding interactive effects such as highlighting, collapsing / expanding, and legal jumps. After completing the format and interface adaptation rendering, the final visualization is displayed on the client page.

[0096] The above method not only achieves accurate retrieval but also generates logically rigorous analysis reports based on reliable cleaned datasets. By constraining the analysis logic and output format of the large language model within the system, and enforcing the use of hyperlink anchor references in the format of "[[Legal Name Article Number]]" (Legal ID), the method prevents AI entities from fabricating legal provisions, ensuring the rigor and traceability of the generated content.

[0097] In one embodiment, a method for legal retrieval processing using a large language model is provided, the method comprising: The client device sends the received query text to the terminal, which then performs intent recognition, feature splitting, high-dimensional batch processing recall, large model secondary cleaning and filtering, and formatted rendering with regularization constraints based on the query text, and returns the rendering result to the client device. The terminal sends the high-dimensional batch-processed query text to the regulatory vector database. Based on the query text and the regulatory articles that match in the retrieval database, the regulatory vector database returns to the terminal an initial set of regulatory metadata sorted from high to low according to similarity scores.

[0098] like Figure 2 As shown, in one embodiment, a regulatory retrieval processing device for a large language model is installed on a terminal and includes: an intent recognition module 201, a feature splitting module 202, a concurrent recall module 203, a cross-cleaning module 204, and an output module 205.

[0099] Intent recognition module 201: Used to receive legal query strings from the client, call the built-in large language model engine to perform intent recognition, and route the query string to a preset intent processing branch; Feature fission module 202: When it is determined that the intent processing branch corresponding to the query string is a legal retrieval branch, the feature fission module calls the multi-dimensional vector decomposition algorithm to perform feature fission on the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct retrieval element objects; Concurrent Recall Module 203: Used to initiate concurrent retrieval to the regulatory vector database and receive the initial set of regulatory metadata from the regulatory vector database; Cross-cleaning module 204: Used to perform secondary cleaning and filtering on the initial set of regulatory metadata returned by the regulatory vector database based on the preset set of metadata verification rules and the query string, output the relevance judgment identifier corresponding to each regulatory article, and construct an accurate regulatory dataset; Output module 205: Used to input the precise legal dataset into the large language model, and render and output a structured legal analysis data object to the client according to the preset priority order of substantive law and procedural law analysis and the regular expression of legal citation.

[0100] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for legal retrieval processing using a large language model, characterized in that, include: Receive a legal query string from the client, call the built-in large language model engine to perform intent recognition, and route the query string to a preset intent processing branch; When it is determined that the intent processing branch corresponding to the query string is the legal retrieval branch, the multi-dimensional vector decomposition algorithm is invoked to perform feature fission on the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct retrieval element objects; Multiple search element objects are encapsulated into concurrent query requests, which are then sent to a regulatory vector database. The regulatory vector database retrieves matching regulatory articles based on the multiple search element objects and sorts the regulatory articles by similarity score to form an initial set of regulatory metadata. The large language model performs secondary cleaning and filtering on the initial set of legal metadata returned by the legal vector database based on the preset set of metadata verification rules and the query string, and outputs the relevance judgment identifier corresponding to each legal article to construct an accurate legal dataset. The precise legal dataset is input into the large language model, and the model renders and outputs a structured legal analysis data object to the client based on the preset priority order of substantive law and procedural law analysis and the regular expression for citation of legal provisions.

2. The legal retrieval processing method for a large language model as described in claim 1, characterized in that, Receive a legal query string from the client, invoke the built-in large language model engine for intent recognition, and route the query string to a preset intent processing branch, including: Receive legal query text from the client, preprocess the text to remove invalid interference information, extract the query string from the text, and input the query string into the large language model; The intent recognition module of the large language model performs semantic understanding and classification on the query string and outputs standardized intent labels; Based on the identified intent tag, match the intent processing branch corresponding to the query string.

3. The legal retrieval processing method for a large language model as described in claim 1, characterized in that, The multi-dimensional vector decomposition algorithm is invoked to perform feature fission on the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct search element objects, including: The number of legal entities contained in the query string is analyzed according to a preset three-element rule based on subject-behavior-point of contention, and the number of legal entities is determined based on the identified legal entities; Extract the core regulation name from the query string; only a single regulation name can be contained in the same search element object. Constrain the number and format of the search element strings in the search element object; An exclusive dictionary is used to filter out preset interference feature words for the retrieved element objects.

4. The legal retrieval processing method for a large language model as described in claim 1, characterized in that, The process involves encapsulating the multiple search element objects into concurrent query requests, sending the concurrent query requests to a regulatory vector database, and the regulatory vector database retrieving matching regulatory articles based on the multiple search element objects, and sorting the initial regulatory metadata by similarity score to form an initial regulatory metadata set, including: The multiple search element objects are structured and encapsulated to generate concurrent query requests; The concurrent query request is sent to the regulatory vector database, which performs high-dimensional similarity calculation between the multiple search element objects and the regulatory articles in the database, and retrieves the regulatory article to be matched based on the multiple search element objects. The regulations are sorted from high to low according to their similarity scores to obtain and output an initial set of regulatory metadata.

5. The legal retrieval processing method for a large language model as described in claim 1, characterized in that, The large language model performs secondary cleaning and filtering on the initial set of regulatory metadata returned by the regulatory vector database based on a preset set of metadata verification rules and the query string, outputting a relevance determination identifier corresponding to each initial set of regulatory metadata, and constructing an accurate regulatory dataset, including: The large language model performs semantic understanding on the initial set of regulatory metadata fed back from the regulatory vector database; The large language model performs secondary cleaning and filtering on the initial set of legal metadata returned by the legal vector database based on the preset set of metadata verification rules and the query string, and outputs a list of candidate legal provisions. The candidate legal provisions list is relevance-based, irrelevant provisions are removed, and an accurate legal dataset is constructed and output.

6. The legal retrieval processing method for a large language model as described in claim 1, characterized in that, The preset metadata verification rule set includes: Timestamp blocking rule: Extract the implementation date field from the metadata of a single regulation. If the date is found to be earlier than the base year set by the system, output a false flag directly. Vertical domain mapping rules: Extract the domain features of the query string. If it is identified as a specific domain, then forcibly verify whether the industry classification field of a single piece of regulatory metadata is the corresponding system. If they do not match, output a false flag. File type filtering rules: Unless there is a specific file type trigger word in the query string, metadata containing guiding cases, judicial cases or amendment decisions in the regulatory name will be automatically blocked and removed.

7. The legal retrieval processing method for a large language model as described in claim 1, characterized in that, The process of inputting the precise legal dataset into the large language model, rendering and outputting structured legal analysis data objects to the client according to the preset priority order of substantive law and procedural law analysis and regular expressions for legal citation, includes: The precise legal dataset is input into the large language model, which loads preset priority rules for entity law and procedural law analysis and regular expressions for citation of legal provisions to constrain the analysis logic and output format of the large language model. The large language model generation engine performs legal reasoning and legal provision matching based on the precise legal dataset, analysis priority rules, and regular expressions for legal citation, and generates initial legal analysis content. The initial legal analysis content is structured and parsed to extract core analysis fields, verify the authenticity and accuracy of legal citations, and generate standardized structured legal analysis data objects. The structured legal analysis data object is rendered and converted into a format that can be displayed by the client, and then output to the client.

8. The legal retrieval processing method for a large language model as described in claim 1, characterized in that, The specific execution steps for rendering and outputting structured legal analysis data objects include: Based on the validity level field and issuing authority field of each legal provision in the aforementioned precise legal dataset, and in descending order of weight of laws, judicial interpretations, and administrative regulations, the provisions with higher weights are prioritized for substantive legal reasoning, followed by procedural legal reasoning. At the end of each logical point in the generated analysis data object, a preset text formatting function is called to force the injection of reference anchors according to a specific nested syntax format that includes the law name, article number, and the unique identifier of the underlying law.

9. A legal retrieval processing method for a large language model, characterized in that, The method includes: The terminal sends the query text received by the client device to the terminal, and the terminal performs intent recognition, feature splitting, high-dimensional batch processing recall, large model secondary cleaning and filtering, and formatted rendering with regularization constraints based on the query text, and returns the rendering result to the client device. The terminal-processed query text is sent to the regulatory vector database. Based on the query text and the regulatory articles that match in the retrieval database, the regulatory vector database returns an initial set of regulatory metadata sorted from high to low according to similarity scores to the terminal.

10. A legal retrieval and processing device for a large language model, installed in a terminal, the device comprising: Intent recognition module: Used to receive legal query strings from clients, call the built-in large language model engine to perform intent recognition, and route the query string to the preset intent processing branch; Feature fission module: When it is determined that the intent processing branch corresponding to the query string is the legal retrieval branch, the feature fission module calls the multi-dimensional vector decomposition algorithm to perform feature fission on the query string based on the three-element rule of subject-behavior-dispute point, generating multiple distinct retrieval element objects; Concurrent recall module: Used to initiate concurrent retrieval to the legal vector database and receive the initial set of legal metadata returned by the legal vector database; Cross-cleaning module: Used to perform secondary cleaning and filtering on the initial set of regulatory metadata returned by the regulatory vector database based on the preset set of metadata verification rules and the query string, output the relevance judgment identifier corresponding to each regulatory article, and construct an accurate regulatory dataset; Output module: Used to input the precise legal dataset into the large language model, and render and output structured legal analysis data objects to the client according to the preset priority order of substantive law and procedural law analysis and the regular expression of legal citation.