Data retrieval system and method based on AI
By constructing a dual-module fusion model of XGBoost and BERT and large-scale semantic parsing, the problems of unclear document segmentation and low matching degree were solved, achieving high-precision data retrieval and report generation, and reducing the workload of manual review.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG LAMBES INFORMATION TECH CO LTD
- Filing Date
- 2025-11-04
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies often suffer from unclear document segmentation and low vector matching accuracy, failing to meet the precision requirements of public authority systems.
By constructing a dual-module fusion model of XGBoost and BERT, combining regular expressions and manual cleaning, the rule documents are decomposed into atomic rule items, and the large model is used for semantic parsing and semantic reasoning, combined with case time for accurate retrieval and matching.
It achieves the integrity and granularity of the data structure of the regulations, with a matching accuracy of 91% and a recall rate of 80%, meeting the high precision requirements of the public power system. The report generation time has been shortened from several hours to minutes, reducing the workload of manual review.
Smart Images

Figure CN122019799A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data information technology, and in particular to an AI-based data retrieval system and method. Background Technology
[0002] Currently, the most widely used large-scale retrieval model is RAG (Reinforced Text Retrieval). When applied to public authority systems, RAG involves segmenting regulations into vectorized fragments and storing them in a vectorized database. During retrieval, cases are also vectorized, and algorithms such as cosine similarity and Euclidean distance are used to find the regulations that best match the cases from the vector database. However, this method suffers from several drawbacks. The regulations may not be clearly segmented, resulting in multiple regulations within a single fragment, or a complete regulation being split into two fragments. Furthermore, the accuracy of vector matching is not high enough to meet the requirements of public authority systems. Summary of the Invention
[0003] Purpose of the invention: The purpose of this invention is to provide an AI-based data retrieval system and method that can solve the problems of unclear document segmentation and low accuracy of vector matching.
[0004] Technical Solution: To solve the above-mentioned technical problems, according to one aspect of the present invention, more specifically, an AI-based data retrieval method, which includes the following steps:
[0005] S1. Historical Data Preprocessing: Based on the historical case dataset containing information on personnel involved in the case, event details, and case classification labels, the historical regulation matching result set containing regulation matching records of the corresponding historical cases, and the historical structured report set containing generated public power reports, report filling content, and manual quality assessment records, the training dataset is constructed by removing redundancy and filtering invalid records through regular expressions, combined with manual review and data standardization annotation of multi-dimensional quality labels.
[0006] S2. Extracting Deep Features: Analyze and extract the basic features of historical big data, calculate cross-dimensional correlation features, and use large models to mine semantic deep features;
[0007] S3. Construct a report evaluation model: Using preprocessed historical data, basic features, correlation features, and deep features as input, construct a dual-module fusion model of XGBoost and BERT, optimize hyperparameters, and evaluate various indicators of the model;
[0008] S4. Construct a structured regulations knowledge base: Use regular expressions and manual cleaning of regulations data, break them down into atomic regulations items according to "Article .x", and after the large model analyzes the illegal characteristics, store the "illegal characteristics-regulation-effective time" related data into a MySQL database;
[0009] S5. Obtain case data and construct search instructions: Obtain case data through API, filter the effective regulations corresponding to the case time, and populate the dynamic prompt word model to generate search instructions;
[0010] S6. AI-driven precise retrieval and matching: The large model analyzes the case time and illegal behavior, and semantically matches the most suitable regulation item in the time-limited regulations;
[0011] S7. Generate a structured report: Using the Jinja2 report template, the report is generated by integrating case studies and regulations data through the docxtpl engine. The basic, related, and deep features of the generated report are extracted to form a report feature vector.
[0012] S8. Report Evaluation Model: Triggers the report evaluation model by inputting the report feature vector, outputting a quality score, providing suggestions for problems, and accumulating data for model iteration.
[0013] Furthermore, step S2 specifically includes the following steps:
[0014] S21. Extract basic features from historical cases, regulation matching results, and report data, including: historical features: case type, job level of personnel involved, time duration, number of keywords related to illegal behavior; historical condition matching: matching documents mentioned in the regulations, duration of regulations in effect, number of sub-behaviors of illegal features; historical reports: report template type, number of fields to be filled, field missing rate, and report generation time.
[0015] S22. Based on basic features, extract the correlation features among cases, regulations, and reports, including: case-regulation time matching degree, case-regulation illegal feature matching degree, report-template field fit degree, and historical matching stability features;
[0016] S23. Based on basic features and related features, an open-source large language model is used to perform deep semantic mining on unstructured text in historical data to extract high-order semantic features, including: semantic granularity features of illegal behavior, logical coherence features of report content, semantic compliance features of application of regulations, and semantic transfer features across cases.
[0017] Furthermore, in step S3, the preprocessed historical data samples are concatenated with the corresponding basic features, related features, and deep features to form a feature matrix. The comprehensive quality label is used as the core label, and the matching accuracy, content completeness, and compliance labels are used as auxiliary labels. The training set and validation set are divided in an 8:2 ratio. The XGBoost and BERT dual-module architecture is used to adapt each feature. The training objective is to minimize the mean square error between the model prediction score and the manually labeled label. The model is trained until the comprehensive quality score accuracy, the Pearson correlation coefficient between the scores of each dimension and the manually labeled label, and the matching accuracy prediction accuracy all reach the target, and then training stops.
[0018] Furthermore, in step S4, non-core clause content is matched and deleted using a custom regular expression. An online editing interface is provided for the system-cleaned file, allowing manual correction of omissions, redundancies, or erroneously deleted content. Based on the clauses starting with "Article .x", the regular expression "^Article .*?" is used as the starting point to precisely decompose the cleaned clause file into independent, atomic clause items. A customized prompt word engineering-driven large language model is used to perform semantic parsing on each clause item: the system role is set as a legal specialist familiar with laws and regulations, clarifying the professional positioning of the large model; the user requirement is set to extract multiple illegal acts in the clauses and condense them into a paragraph, outputting in the format of 'number of clauses, extracted content', retaining all core information; the output result of the large model is the illegal feature corresponding to the clause item; the illegal feature-clause item association data is stored in a MySQL database, with core fields including: f_index: illegal feature, f_content: original text of the clause item, f_title: clause file name, f_number: clause item number, start_time / end_time: clause effective time interval, with the clause item number + clause file name as the unique key.
[0019] Furthermore, in step S5, inspection instructions adapted to the large model are dynamically generated based on case data. All rule items with case time ∈ [start_time, end_time] in the knowledge base are filtered, and the candidate rules are filled into the lawer variable of the prompt word template in JSON format. The prompt word template includes: system role 1, system role 2, and user content. System role 1: As a legal expert, it parses the case and outputs it in the format [name]:xxx; [serial number]:xxx; [illegal behavior]:xxx. System role 2: Candidate rule library: {json.dumps(lawer,ensure_ascii=False)}, which must retain all fields, not modify the data structure, and not omit the text content. User content: Existing case {case data}, combined with the candidate rule library, determines the most matching rule that is violated.
[0020] Furthermore, in step S6, the large model extracts the precise event occurrence time from the case data through semantic reasoning. Using the case time as a constraint, it quickly filters out effective candidate regulations in the MySQL knowledge base through time indexing. Based on dynamic prompt words, the large model deeply analyzes the illegal behavior in the case and the illegal characteristics of the candidate regulations, calculates the matching degree through semantic reasoning, and finally outputs the unique most matching regulation.
[0021] Furthermore, in step S7, the corresponding structured template is called from the template library according to business needs, supporting Jinja2 template syntax, including: dynamic content style inheritance, header and footer variable support, logical control statements, multi-source data fusion and filling, creation of docx format template files, construction of a data model in the Python program, mapping of template variables to actual data, loading of templates and rendering of data, generation of standardized public power reports, automatic extraction of the basic features, related features, and deep features of the report to form a report feature vector, which is directly input into the report evaluation model.
[0022] Furthermore, in step S8, the evaluation triggering mechanism is divided into automatic triggering and manual triggering. Automatic triggering: After the report is generated, the system automatically inputs "report data + report feature vector" into the evaluation model via API, without manual operation. Manual triggering: Supports staff to initiate re-evaluation of historical reports. The evaluation model outputs a structured evaluation result based on the input report feature vector, including a comprehensive score, problem identification and improvement suggestions, and historical comparison references. The score output includes: scores for each sub-item (matching accuracy, content completeness, semantic compliance, logical coherence) and a comprehensive quality score. Problem identification and improvement suggestions: If a sub-item score is less than the preset sub-item score... The evaluation model combines feature analysis to identify the causes of problems and provide suggestions. If the overall quality score is lower than the preset value, a high-risk report is automatically marked, prompting a re-generation of the report. Different actions are performed based on the overall quality score: when the overall quality score is not lower than the first threshold, the report directly enters the subsequent business process; when the overall quality score is lower than the first threshold but not lower than the second threshold, it is automatically marked as requiring random inspection, and staff conduct random inspections according to a preset ratio; when the overall quality score is lower than the second threshold, it is corrected according to the model's suggestions and re-evaluated. The evaluation score output, problem location and suggestions, and report data are stored in the historical dataset as training data for model iteration.
[0023] According to another aspect of the present invention, an AI-based data retrieval system is provided. This system is used to implement the AI-based data retrieval method described above, including: a historical data preprocessing module, a deep feature extraction module, a report evaluation model construction module, a structured rule knowledge base module, a case data acquisition and retrieval instruction construction module, an AI precise retrieval matching module, a structured report generation module, and a report evaluation and data accumulation module.
[0024] Historical data preprocessing module: Based on historical case datasets containing information on personnel involved in cases, event details, and case classification tags, historical regulation matching result sets containing regulation matching records of corresponding historical cases, and historical structured report sets containing generated public power reports, report filling content, and manual quality assessment records, this module uses regular expressions to remove redundancy and filter invalid records, and combines manual review and data standardization annotation with multi-dimensional quality labels to construct a training dataset.
[0025] Deep feature extraction module: used to analyze and extract basic features of historical big data, calculate cross-dimensional correlation features, and mine semantic deep features using large models;
[0026] The report evaluation model building module is used to construct a dual-module fusion model of XGBoost and BERT by taking preprocessed historical data, basic features, correlation features, and deep features as input, optimizing hyperparameters, and evaluating various indicators of the model.
[0027] The structured regulations knowledge base module is used to clean regulations data using regular expressions and manual cleaning. It breaks down the data into atomic regulations by "Article X". After the large model analyzes the illegal characteristics, it stores the "illegal characteristics-regulation-effective time" related data into a MySQL database.
[0028] Case data acquisition and retrieval instruction building module: used to acquire case data through API, filter the effective regulations corresponding to the case time, and fill the dynamic prompt word model to generate retrieval instructions;
[0029] AI-powered precise retrieval and matching module: used for large-scale model analysis of case time and illegal behavior, semantically matching the most suitable clause in time-limited regulations;
[0030] Structured report generation module: Used to call Jinja2 report templates, integrate case and regulation data through the docxtpl engine to generate reports, and extract the basic features, related features, and deep features of the generated reports to form report feature vectors;
[0031] Report evaluation and data accumulation module: This module is used to trigger the report evaluation model, which inputs the report feature vector, outputs a quality score, provides suggestions for problems, and accumulates data for model iteration.
[0032] Beneficial effects: By cleaning the regulation data through "custom regular expressions + manual review" and using "^No.*?Article" as the identifier, the regulations are broken down into independent and atomic regulation items, which completely avoids the problems of "multiple regulations mixed in a single fragment" and "single regulations being split up", ensuring the integrity and uniformity of the regulation data structure, laying the foundation for subsequent accurate matching; abandoning the literal matching algorithms such as cosine similarity and Euclidean distance that traditional RAG relies on, a "large model semantic reasoning + dynamic prompt word engineering" is adopted to achieve deep semantic matching between cases and regulations. Combined with the timeliness screening of "case time ∈ regulation effective period", the measured matching accuracy is ≥91% and the average recall rate is ≥80%, which fully meets the high-precision requirements of the public power system for the correspondence between "illegal behavior and regulation". The structured report generation module, based on Jinja2 templates and the docxtpl engine, automates the filling of "case data + matching regulations." Dynamic content automatically inherits the template format, avoiding formatting errors and content omissions caused by manual filling. Simultaneously, the report evaluation model (XGBoost + BERT dual-module fusion) outputs a quality score of 0-100 points across four dimensions: "matching accuracy, content completeness, semantic compliance, and logical coherence." The overall score accuracy is ≥90%, and the Pearson correlation coefficient between the scores of each dimension and the manual labels is ≥0.8, accurately identifying report quality issues. The evaluation module can automatically analyze the reasons for low scores (such as "insufficient semantic similarity between the case and the regulations" or "missing required fields") and output targeted improvement solutions (such as optimizing prompt descriptions and supplementing missing fields). This eliminates the need for manual verification, significantly reducing the difficulty and error rate of report quality control in public power operations.
[0033] From "API acquisition of case data → filtering of time-sensitive regulations → generating search instructions → matching the optimal regulations → generating structured reports," the entire process requires no manual intervention and can be completed simply by triggering an action. Compared to the traditional model of "manually searching for regulations + manually filling in reports," this reduces business processing time from several hours to minutes. After the report is generated, an evaluation model is automatically triggered, and intelligent triage is achieved based on the comprehensive score: "excellent reports are directly approved, good reports are sampled for inspection, and unqualified reports are prompted to be regenerated." The staff sampling inspection ratio is ≤20%, which significantly reduces the amount of ineffective manual review work and focuses on high-value business links. The report evaluation results (including scores and suggestions) and report data are automatically stored in the historical dataset and used periodically (e.g., quarterly) for incremental model training. Through the cycle of "data preprocessing → deep feature extraction → model optimization", the model matching accuracy and evaluation reliability are continuously improved, preventing the model from becoming ineffective due to business changes (such as regulation updates or new case types). The "manual review" in the historical data preprocessing stage and the "problem localization" in the report evaluation stage can continuously correct data deviations and supplement missing information, continuously optimizing the quality of the historical dataset and regulation knowledge base, forming a positive closed loop of "business data → data quality improvement → model accuracy improvement → business efficiency improvement".
[0034] The AI-powered precise search and matching process uses a MySQL time index to filter regulations within their effective period based on the case's occurrence time. This automatically excludes expired or ineffective regulations, avoiding legal risks caused by using outdated regulations and ensuring that search results meet the timeliness requirements of public authority operations. The "manual review" of regulation data cleaning, the "format and field verification" of report generation, and the "compliance scoring" in the evaluation module ensure compliance across the entire chain from data input to report output (such as correct regulation citation format and consistency between case description and illegal characteristics), aligning with the strict standards of compliance for public authority operations. Attached Figure Description
[0035] Figure 1 This is a flowchart illustrating the method.
[0036] Figure 2 This is a schematic diagram of the system principle. Detailed Implementation
[0037] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0038] Example 1
[0039] This example focuses on a case processed in March 2024, with the goal of generating an "initial verification report (verifyrepo)" and completing an automated quality assessment.
[0040] Step 1: Historical Data Preprocessing
[0041] Three types of historical data were selected from 2019 to 2023:
[0042] Historical case dataset (500 records in total): Includes 320 similar cases, each containing "name, job title, description of illegal behavior, and time of event";
[0043] Historical rule matching result set (500 records): the rule records that correspond to the case matching "matching precision 91%, recall 80%";
[0044] Historical structured report set (500 documents): all are "verifyrepo initial verification reports", including records of manual quality assessment (such as "accurate matching: yes, complete content: yes, compliance: compliant").
[0045] Data cleaning and standardization
[0046] Regular expression cleaning: Use \s*
Note: .*?
Note: This case needs to supplement equipment value
[0047] Manual review: 75 data entries were randomly selected at a rate of 15%, 3 erroneously deleted valid cases were corrected (due to the regular expression misjudging "vague description of event time" as missing), and manual evaluation records of 8 reports were added.
[0048] Standardization: Case time is uniformly marked as "YYYY-MM-DDHH:MM:SS" (e.g., "2022-05-20 00:00:00"), regulation number is uniformly marked as "Article X", and report type is marked as "verifyrepo".
[0049] Quality labeling
[0050] Based on manual evaluation records with labeled (0-1 points):
[0051] Match accuracy label: Out of 320 cases, 288 had a match accuracy of ≥90%, marked with 1 point;
[0052] Content Completeness Tag: 100% completion rate for required fields (such as "description of illegal behavior" and "matching regulations") in 480 reports, 1 point awarded;
[0053] Comprehensive quality label: The training dataset is constructed by weighting the data according to "matching accuracy 40% + completeness 30% + compliance 30%" and ensuring that the comprehensive label of 450 data points is ≥0.8.
[0054] Step 2: Extract depth features
[0055] 1. Basic Feature Extraction
[0056] Case dimensions: case type, job level of personnel involved, duration of the incident, number of keywords related to illegal activities;
[0057] Matching dimensions for regulations: matching the document to which the regulation belongs, the duration of the regulation's effectiveness, and the number of sub-behaviors with illegal characteristics;
[0058] Report dimensions: Report template type "verifyrepo", number of fields to be filled "12 (12 required fields in total)", field missing rate "0%", report generation time "5 minutes".
[0059] 2. Calculation of association features
[0060] Case-regulation time matching degree: 1.0 (the case time is within the effective period of the regulation, and the overlapping time = the total effective period of the regulation).
[0061] Case-Regulations Violation Feature Matching Degree: (TF-IDF Similarity 0.85 + BERT Semantic Similarity 0.88) / 2 = 0.865;
[0062] Report - Template field fit: 12 / 12 = 1.0;
[0063] Historical matching stability characteristics: 290 out of 320 similar cases matched, accounting for 90.6% → 0.906.
[0064] 3. Semantic deep feature mining
[0065] Parsing using the open-source large model Llama3-70B:
[0066] Semantic granularity features of illegal behavior: "subject-method-object", decomposition completeness 1.0;
[0067] The report demonstrates excellent logical coherence: the logical flow from "case description → regulation matching → preliminary review opinion" is seamless, earning a score of 0.95.
[0068] Semantic compliance characteristics of the regulations: The semantics of the case are consistent with the semantics of the regulations, with a score of 0.92;
[0069] Cross-case semantic transfer features: The semantic similarity with a similar case in 2023 is 0.89, and the overall quality of the case report is 0.9 → 0.89 × 0.9 = 0.801.
[0070] Step 3: Construct a report evaluation model
[0071] Training data configuration
[0072] Feature matrix: 450 training samples × 16-dimensional features (8 basic features + 4 related features + 4 semantic features);
[0073] Labeling: Based on comprehensive quality labels, the training set (360 labels) and validation set (90 labels) are divided in an 8:2 ratio.
[0074] Model building and optimization
[0075] XGBoost submodule: tree depth 4, learning rate 0.05, input "basic + related features", output "matching accuracy score 0.92, content integrity score 1.0";
[0076] BERT submodule: batch size 16, learning rate 3e-5, input "semantic feature embedding vector", output "semantic compliance score 0.91, logical coherence score 0.93";
[0077] Hyperparameter optimization: Minimize MSE (model prediction error of 0.03 compared to human label) through grid search. Validation set metrics met: overall quality score accuracy of 92%, Pearson correlation coefficient of 0.83, and matching accuracy prediction precision of 91%.
[0078] Step 4: Construct a structured regulations knowledge base
[0079] Regulation Data Processing
[0080] Cleaning: Use the regular expression Part 1\s*General Rules(?:[\s\S](?!Part 2\s*Specific Rules))*[\s\S]*(?=Part 2\s*Specific Rules|$) to delete the "General Rules" chapter of the regulations, and manually review and correct the two mistakenly deleted "Specific Rules" articles;
[0081] Disassembly: Cut using ^the.*? to obtain the complete clause;
[0082] Analysis of illegal characteristics: The prompt words are set as "system: legal expert; user: extract illegal behavior, output by 'number of items, content'", and the large model output is used.
[0083] MySQL database
[0084] Core field values:
[0085] f_index, f_content, f_title, f_number, start_time, unique key.
[0086] Step 5: Obtain case data and construct search instructions
[0087] Case Data API Acquisition
[0088] Calling the business system API returns the following data: "[Name]; [Job Level]; [Event]; [Event Time]".
[0089] Search instruction construction
[0090] Time-limited clause filtering: Case time 2024-03-10∈[2023-01-01,9999-12-31];
[0091] Prompt word assembly.
[0092] Step Six: AI-Driven Precise Search and Matching
[0093] Case Time Analysis
[0094] The large model extracted the precise event time: "2024-03-10 09:00:00", confirming that it was within the effective period of the regulations.
[0095] semantic matching results
[0096] The large model analyzes the semantic relationship between the case and the regulation, calculates a matching degree of 0.89, and outputs the unique most matching regulation item: "[Name]; [Serial Number]; [Illegal Behavior]; [Complete Regulation Data]".
[0097] Step 7: Generate a structured report
[0098] Template calling and data population
[0099] The "verifyrepo initial report" Jinja2 template is invoked. The template's dynamic area includes... , , , ;
[0100] The docxtpl engine populates the data: , , , ;
[0101] Formatting Inheritance: The fill content automatically matches the template "SimSun, size 12, fixed 20pt spacing", the header displays the name of the preliminary audit report, and the footer displays the generation time.
[0102] Report feature vector generation
[0103] The system automatically extracts the "basic features (12 fields to fill, 0% missing rate) + related features (time matching degree 1.0) + semantic features (logical coherence 0.95)" from the report to form a 16-dimensional feature vector.
[0104] Step 8: Report Evaluation Model Evaluation Report
[0105] Evaluation triggers and result output
[0106] Automatic triggering: After the report is generated, the API sends "report data + feature vector" to the evaluation model;
[0107] Score Output: Overall Quality Score 92 (Excellent), Matching Accuracy 93, Content Completeness 100, Semantic Compliance 90, Logical Coherence 95;
[0108] Issues and suggestions: None (each sub-item score ≥ 90 points); Historical comparison: Ranked 15th in 120 verifyrepo reports over the past 6 months.
[0109] Business offloading and data accumulation
[0110] Triage: If the overall score is ≥90, the report will directly enter the "verification and approval stage";
[0111] Data accumulation: The "full report + evaluation score (92 points)" will be stored in the historical dataset, and the historical structured report set will be updated to 501 for model iteration in the next quarter.
[0112] Example 2
[0113] This example addresses a case handled in April 2024, with the goal of generating an "invrepo" report and completing an automated quality assessment.
[0114] Step 1: Historical Data Preprocessing
[0115] Historical dataset definition
[0116] Three types of historical data were selected from 2019 to 2023:
[0117] Historical case dataset (480 records in total): Includes 280 similar cases, each containing "name, job title, description of illegal behavior, and time of event";
[0118] Historical rule matching result set (480 records): the rules that match the corresponding cases, recording "matching precision 90% and recall 78%";
[0119] Historical structured report set (480 documents): all are "invrepo audit reports", including records of manual quality assessment (such as "Accurate matching: Yes, Complete content: Supplementary enterprise information is required, Compliance: Meets the standard").
[0120] Data cleaning and standardization
[0121] Regular expression cleaning: Use \s*
Review Comments: .*?
Review Comments: Shareholding Ratio Needs Verification
[0122] Manual review: 58 data points were randomly selected at a rate of 12%, 2 cases of erroneous deletion were corrected, and manual evaluation records of 6 reports were supplemented;
[0123] Standardization: Case time is uniformly marked as "YYYY-MM-DDHH:MM:SS" (e.g., "2022-08-15 00:00:00"), regulation number is uniformly marked as "Article X", and report type is marked as "invrepo".
[0124] Quality labeling
[0125] Label (0-1 point):
[0126] Match accuracy label: 252 out of 280 similar cases have a match accuracy rate of ≥90%, marked with 1 point;
[0127] Content completeness label: 420 out of 460 reports had a 100% completion rate for required fields, 1 point awarded;
[0128] Overall quality label: The weighted overall label of the 430 data points is ≥0.8, and a training dataset (430 data points) is constructed.
[0129] Step 2: Extract depth features
[0130] 1. Basic Feature Extraction
[0131] Case dimensions: case type, job level of personnel involved, duration of the incident, number of keywords related to illegal activities;
[0132] Matching dimensions for regulations: matching the document to which the regulation belongs, the duration of the regulation's effectiveness, and the number of sub-behaviors with illegal characteristics;
[0133] Report dimensions: Report template type "invrepo", number of fields to be filled "15 (out of 16 required fields, 'Unified Social Credit Code' is missing)", field missing rate "6.25%", report generation time "8 minutes".
[0134] 2. Calculation of association features
[0135] Case-regulation time matching degree: 0.95 (the case time part is within the effective period of the regulation, the overlap period is 15 months / the total effective period → 0.95);
[0136] Case-Regulations Violation Feature Matching Degree: (TF-IDF Similarity 0.82 + BERT Semantic Similarity 0.86) / 2 = 0.84;
[0137] Report - Template field fit: 15 / 16 = 0.9375;
[0138] Historical matching stability characteristics: 245 out of 280 similar cases matched, accounting for 87.5% → 0.875.
[0139] 3. Semantic deep feature mining
[0140] Parsing is performed using the open-source large model BERT-base-chinese:
[0141] Semantic granularity features of illegal behavior: "subject-method-object", decomposition completeness 1.0;
[0142] The report demonstrates strong logical coherence: the sequence of "case description → regulation matching → review comments" is logically complete, earning a score of 0.88.
[0143] Semantic compliance characteristics of the regulations: The semantics of the case are consistent with the semantics of the regulations, with a score of 0.90;
[0144] Cross-case semantic transfer features: Semantic similarity with the case is 0.85, and the overall quality of the case report is 0.86 → 0.85 × 0.86 = 0.731.
[0145] Step 3: Construct a report evaluation model
[0146] Training data configuration
[0147] Feature matrix: 430 training samples × 16-dimensional features;
[0148] Label splitting: The training set and validation set are split in an 8:2 ratio.
[0149] Model building and optimization
[0150] XGBoost submodule: tree depth 3, learning rate 0.08, input "basic + related features", output "matching accuracy score 0.89, content integrity score 0.87";
[0151] BERT submodule: batch size 12, learning rate 2.5e-5, input "semantic feature embedding vector", output "semantic compliance score 0.90, logical coherence score 0.88";
[0152] Hyperparameter optimization: MSE=0.04, validation set indicators met: overall quality score accuracy 91%, Pearson correlation coefficient 0.81, and matching accuracy prediction precision 90%.
[0153] Step 4: Construct a structured regulations knowledge base
[0154] Regulation Data Processing
[0155] Cleaning: Use the regular expression Part 1\s*General Rules(?:[\s\S](?!Part 2\s*Specific Rules))*[\s\S]*(?=Part 2\s*Specific Rules|$) to delete "General Rules", and manually review and correct one mistakenly deleted clause;
[0156] Disassembly: Cut using ^the.*? to obtain the complete clause;
[0157] Illegal activity analysis: Prompt word output.
[0158] MySQL database
[0159] Core field values:
[0160] f_index, f_content, f_title, f_number, start_time, unique key.
[0161] Step 5: Obtain case data and construct search instructions
[0162] Case Data API Acquisition
[0163] Calling the business system API returns the following data: "[Name]; [Job Level]; [Event]; [Event Time]; [Company Name]".
[0164] Search instruction construction
[0165] Validity period filtering: If the case date of 2022-10-01 falls within a certain period of regulations, then the relevant regulations will be filtered out.
[0166] Prompt word assembly.
[0167] Step Six: AI-Driven Precise Search and Matching
[0168] Case Time Analysis
[0169] The large model extracts precise event times, confirming that they fall within the effective period of the regulations.
[0170] semantic matching results
[0171] The large model analyzes the semantic relationships of the cases, with a matching degree of 0.87. The output is: "[Name]; [Serial Number]; [Illegal Behavior]; [Complete Regulations Data]".
[0172] Step 7: Generate a structured report
[0173] Template calling and data population
[0174] The "invrepo audit report" Jinja2 template is invoked, and the dynamic area includes... , , , , ;
[0175] The docxtpl engine populates the data: , , , , ;
[0176] Formatting Inheritance: Fill content matches the template "SimSun, size 12, fixed 20pt spacing", header displays "Review Report Name", footer displays "Generation Time".
[0177] Report feature vector generation
[0178] The system automatically extracts the "basic features (15 fields to fill, missing rate 6.25%) + related features (time matching degree 0.95) + semantic features (logical coherence 0.88)" from the report, forming a 16-dimensional feature vector.
[0179] Step 8: Report Evaluation Model Evaluation Report
[0180] Evaluation triggers and result output
[0181] Automatic triggering: After the report is generated, the API sends "report data + feature vector" to the evaluation model;
[0182] Score output: Overall quality score 85 (good), matching accuracy 89, content completeness 82 (missing "Unified Social Credit Code for Enterprises"), semantic compliance 90, logical coherence 88;
[0183] Suggested issues: "Content completeness score: 82 points: The 'Unified Social Credit Code for Enterprises' field is missing. It is recommended to add this information to improve the completeness of the report"; Historical comparison: Ranked 32nd in 90 invrepo reports in the past 6 months.
[0184] Business offloading and data accumulation
[0185] Triage: If the overall score is 80-89 points, it is marked as "needs random inspection". Staff will conduct random inspections at a rate of 15%, and after supplementing the enterprise credit code, the report will enter the "approval process".
[0186] Data accumulation: The "supplementary report + evaluation score (85 points) + problem suggestions" will be stored in the historical dataset, and the historical structured report set will be updated to 481 documents for model iteration in the next quarter.
[0187] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. An AI-based data retrieval method, characterized in that, Specifically, the following steps are included: S1. Historical Data Preprocessing: Based on the historical case dataset containing information on personnel involved in the case, event details, and case classification labels, the historical regulation matching result set containing regulation matching records of the corresponding historical cases, and the historical structured report set containing generated public power reports, report filling content, and manual quality assessment records, the training dataset is constructed by removing redundancy and filtering invalid records through regular expressions, combined with manual review and data standardization annotation of multi-dimensional quality labels. S2. Extracting Deep Features: Analyze and extract the basic features of historical big data, calculate cross-dimensional correlation features, and use large models to mine semantic deep features; S3. Construct a report evaluation model: Using preprocessed historical data, basic features, correlation features, and deep features as input, construct a dual-module fusion model of XGBoost and BERT, optimize hyperparameters, and evaluate various indicators of the model; S4. Construct a structured regulations knowledge base: Use regular expressions and manual cleaning of regulations data, break them down into atomic regulations items according to "Article .x", and after the large model analyzes the illegal characteristics, store the "illegal characteristics-regulation-effective time" related data into a MySQL database; S5. Obtain case data and construct search instructions: Obtain case data through API, filter the effective regulations corresponding to the case time, and populate the dynamic prompt word model to generate search instructions; S6. AI-driven precise retrieval and matching: The large model analyzes the case time and illegal behavior, and semantically matches the most suitable regulation item in the time-limited regulations; S7. Generate a structured report: Using the Jinja2 report template, the report is generated by integrating case studies and regulations data through the docxtpl engine. The basic, related, and deep features of the generated report are extracted to form a report feature vector. S8. Report Evaluation Model: Triggers the report evaluation model by inputting the report feature vector, outputting a quality score, providing suggestions for problems, and accumulating data for model iteration.
2. The AI-based data retrieval method according to claim 1, characterized in that: Step S2 specifically includes the following steps: S21. Extract basic features from historical cases, regulation matching results, and report data, including: historical features: case type, job level of personnel involved, time duration, number of keywords related to illegal behavior; historical condition matching: matching documents mentioned in the regulations, duration of regulations in effect, number of sub-behaviors of illegal features; historical reports: report template type, number of fields to be filled, field missing rate, and report generation time. S22. Based on basic features, extract the correlation features among cases, regulations, and reports, including: case-regulation time matching degree, case-regulation illegal feature matching degree, report-template field fit degree, and historical matching stability features; S23. Based on basic features and related features, an open-source large language model is used to perform deep semantic mining on unstructured text in historical data to extract high-order semantic features, including: semantic granularity features of illegal behavior, logical coherence features of report content, semantic compliance features of application of regulations, and semantic transfer features across cases.
3. The AI-based data retrieval method according to claim 1, characterized in that: In step S3, the preprocessed historical data samples are concatenated with the corresponding basic features, related features, and deep features to form a feature matrix. The comprehensive quality label is used as the core label, and the matching accuracy, content completeness, and compliance labels are used as auxiliary labels. The training set and validation set are divided in an 8:2 ratio. The XGBoost and BERT dual-module architecture is used to adapt each feature. The training objective is to minimize the mean square error between the model prediction score and the manually labeled label. The model is trained until the comprehensive quality score accuracy, the Pearson correlation coefficient between the scores of each dimension and the manually labeled label, and the matching accuracy prediction accuracy all reach the target, and then training stops.
4. The AI-based data retrieval method according to claim 1, characterized in that: In step S4, non-core clause content is matched and deleted using a custom regular expression. An online editing interface is provided for the system-cleaned file, allowing manual correction of omissions, redundancies, or erroneously deleted content. Based on the clauses starting with "Article .x", the regular expression "^Article .*?" is used as the starting point to precisely decompose the cleaned clause file into independent, atomic clause items. A customized prompt word engineering-driven large language model is used to perform semantic parsing on each clause item: the system role is set as a legal specialist familiar with laws and regulations, clarifying the professional positioning of the large model; the user requirement is set to extract multiple illegal acts in the clauses and condense them into a paragraph, outputting in the format of 'number of clauses, extracted content', retaining all core information; the output of the large model is the illegal feature corresponding to the clause item. The data linking violation characteristics and regulation items is stored in a MySQL database. The core fields include: f_index: violation characteristic, f_content: original text of regulation item, f_title: regulation document name, f_number: regulation item number, start_time / end_time: regulation effective time range, with the regulation item number + regulation document name as the unique key.
5. The AI-based data retrieval method according to claim 1, characterized in that: In step S5, inspection instructions adapted to the large model are dynamically generated based on case data. All rule items with case time ∈ [start_time, end_time] in the knowledge base are filtered, and the candidate rules are filled into the lawer variable of the prompt word template in JSON format. The prompt word template includes: system role 1, system role 2, and user content. System role 1: As a legal expert, it parses the case and outputs it in the format [name]:xxx; [serial number]:xxx; [illegal behavior]:xxx. System role 2: Candidate rule library: {json.dumps(lawer,ensure_ascii=False)}, which must retain all fields, not modify the data structure, and not omit the text content. User content: Existing case {case data}, combined with the candidate rule library, determines the most matching rule that is violated.
6. The AI-based data retrieval method according to claim 1, characterized in that: In step S6, the big model extracts the precise event occurrence time from the case data through semantic reasoning. With the case time as a constraint, it quickly filters out effective candidate regulations in the MySQL knowledge base through time index. Based on dynamic prompt words, the big model deeply analyzes the illegal behavior in the case and the illegal characteristics of the candidate regulations, calculates the matching degree through semantic reasoning, and finally outputs the unique most matching regulation.
7. The AI-based data retrieval method according to claim 1, characterized in that: In step S7, the corresponding structured template is called from the template library according to business needs. It supports Jinja2 template syntax and includes: dynamic content style inheritance, header and footer variable support, logical control statements, multi-source data fusion and filling, creation of docx format template files, construction of data model in Python program, mapping of template variables and actual data, loading of template and rendering of data, generation of standardized public power report, automatic extraction of basic features, related features and deep features of the report to form report feature vector, which is directly input into the report evaluation model.
8. The AI-based data retrieval method according to claim 1, characterized in that: In step S8, the evaluation triggering mechanism is divided into automatic triggering and manual triggering. Automatic triggering: After the report is generated, the system automatically inputs "report data + report feature vector" into the evaluation model via API, without manual operation. Manual triggering: Supports staff to initiate re-evaluation of historical reports. The evaluation model outputs a structured evaluation result based on the input report feature vector, including a comprehensive score, problem identification and improvement suggestions, and historical comparison references. The score output includes: scores for each sub-item (matching accuracy, content completeness, semantic compliance, logical coherence) and a comprehensive quality score. Problem identification and improvement suggestions: If the score for a certain sub-item is less than the preset value for that sub-item, the evaluation... The model combines feature analysis to identify the causes of problems and provides suggestions. If the overall quality score is lower than the preset value, it automatically marks the report as high-risk and prompts the reporter to regenerate the report. Different actions are performed based on the overall quality score: when the overall quality score is not lower than the first threshold, the report directly enters the subsequent business process; when the overall quality score is lower than the first threshold but not lower than the second threshold, it is automatically marked as requiring random inspection, and staff conduct random inspections according to a preset ratio; when the overall quality score is lower than the second threshold, it is corrected according to the model's suggestions and re-evaluated. The evaluation score output, problem location and suggestions, and report data are stored in the historical dataset as training data for model iteration.
9. An AI-based data retrieval system, characterized in that: This system is used to implement an AI-based data retrieval method as described in any one of claims 1-8, comprising: a historical data preprocessing module, a deep feature extraction module, a report evaluation model construction module, a structured regulations knowledge base module, a case data acquisition and retrieval instruction construction module, an AI-based precise retrieval and matching module, a structured report generation module, and a report evaluation and data accumulation module; Historical data preprocessing module: Based on historical case datasets containing information on personnel involved in cases, event details, and case classification tags, historical regulation matching result sets containing regulation matching records of corresponding historical cases, and historical structured report sets containing generated public power reports, report filling content, and manual quality assessment records, this module uses regular expressions to remove redundancy and filter invalid records, and combines manual review and data standardization annotation with multi-dimensional quality labels to construct a training dataset. Deep feature extraction module: used to analyze and extract basic features of historical big data, calculate cross-dimensional correlation features, and mine semantic deep features using large models; The report evaluation model building module is used to construct a dual-module fusion model of XGBoost and BERT by taking preprocessed historical data, basic features, correlation features, and deep features as input, optimizing hyperparameters, and evaluating various indicators of the model. The structured regulations knowledge base module is used to clean regulations data using regular expressions and manual cleaning. It breaks down the data into atomic regulations by "Article X". After the large model analyzes the illegal characteristics, it stores the "illegal characteristics-regulation-effective time" related data into a MySQL database. Case data acquisition and retrieval instruction building module: used to acquire case data through API, filter the effective regulations corresponding to the case time, and fill the dynamic prompt word model to generate retrieval instructions; AI-powered precise retrieval and matching module: used for large-scale model analysis of case time and illegal behavior, semantically matching the most suitable clause in time-limited regulations; Structured report generation module: Used to call Jinja2 report templates, integrate case and regulation data through the docxtpl engine to generate reports, and extract the basic features, related features, and deep features of the generated reports to form report feature vectors; Report evaluation and data accumulation module: This module is used to trigger the report evaluation model, which inputs the report feature vector, outputs a quality score, provides suggestions for problems, and accumulates data for model iteration.