Personalized interactive intelligent report method based on large model
By adopting a personalized interactive intelligent reporting method based on a large model, the problem of insufficient depth and flexibility in data analysis of the public security industry's information system has been solved. It realizes multi-turn dialogue interaction and personalized report presentation, improves the depth and flexibility of data analysis, meets the diverse needs of grassroots police officers, and improves work efficiency and information sharing capabilities.
Patent Information
- Application Number
- CN202511538455.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-01-23
AI Technical Summary
Existing information systems in the public security sector suffer from insufficient depth of data analysis and poor flexibility, failing to meet the diverse and real-time information needs of grassroots police officers. Furthermore, their user interaction methods are limited, making it difficult to adapt to the personalized needs of different positions and tasks, thus restricting work efficiency and decision-making quality.
We adopt a personalized interactive intelligent reporting method based on a large model. By constructing a multimodal prompting engineering, fine-tuning the SQL expert model, constructing output correction and adjustment, multimodal intent perception and context construction, multi-granular insight generation and narrative arrangement, we can achieve multi-turn dialogue interaction and personalized report presentation.
It has enhanced the depth and flexibility of data analysis, met personalized needs, lowered the threshold for data use, improved operational convenience and response accuracy, promoted efficient information sharing, enhanced the emergency response capabilities of grassroots police officers, and propelled police work towards intelligence, efficiency, and precision.
Smart Images

Figure CN121387985A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of telecom fraud governance and prevention, and particularly relates to a personalized interactive intelligent report method based on a large model. BACKGROUND
[0002] With the rapid development of informatization, there are a large number of information systems in the public security industry. These systems play an important role in data collection, processing and preliminary analysis. However, due to the limitations of traditional technology, the depth of data analysis is insufficient, and the flexibility is poor, which cannot fully meet the diversified and real-time information needs of grassroots police, especially in complex case research and cross-system data fusion scenarios. At the same time, the existing system generates reports with fixed templates, which cannot adapt to the individual needs of different positions and tasks, resulting in limited work efficiency and decision-making quality. In addition, the interaction between users and the system is relatively single, lacking natural language understanding ability and dynamic feedback mechanism, hindering deep data exploration and intelligent application.
[0003] The purpose of the present application is to overcome the shortcomings of the prior art and provide a personalized interactive intelligent report method based on a large language model, which aims to reduce the data usage threshold and enable users to interact with the data system through natural language for multiple rounds of deep dialogue. The system can automatically generate, interpret and continuously optimize reports to provide a truly personalized, insight-driven and real-time interactive data analysis experience. SUMMARY
[0004] The purpose of the present application is to overcome the limitations of existing carrier synchronization methods and propose a carrier synchronization system and method without interconnection lines.
[0005] The present application adopts the following technical solutions: A personalized interactive intelligent report method based on a large model, characterized in that the method comprises: S1. Constructing a multi-modal prompt project: structurally process the data table and column data input into the model and construct a fixed instruction template, and also construct a fixed instruction template from the successfully executed SQL in history; S2. Fine-tuning the SQL expert model construction: when the model is trained and inferred, not only natural language questions are provided, but also target database information related to the questions is dynamically provided; the training process uses standard answer SQL as a label, and the SQL generated by the model is executed on the target database, and the result of comparing the executed SQL with the standard answer SQL is used as a reward signal to be integrated into the training cycle of the model; S3. Construct output correction and revision: For the same problem, the model trained by step S2 generates multiple candidate SQLs, which are checked by the multi-agent simulated jury system, and the final decision score of each checked candidate SQL is obtained through a weighted decision mechanism, and the candidate SQL with the highest final decision score is selected as the SQL generated by the model; S4. Construct output security performance correction: Before the model generates the final SQL, the system injects the current user's data access permission information into the SQL, and intercepts the SQL of dangerous operations at the system level; when the SQL generated by the model is lengthy, the model is required to optimize and rewrite the SQL; S5. Multi-modal intent perception and context construction: Based on the initial data input into the model in step S1, a dynamic knowledge sub-graph is constructed, entities and relationships in the current and historical context are obtained, and the entities are linked with the knowledge graph, the user's expression is parsed into a structured intent, and a dynamic context is constructed; S6. Multi-modal dynamic query SQL generation and execution: Based on the intent and context parsed in step S5, the model automatically identifies whether to generate a structured SQL data query statement or call a system pre-installed data analysis API; the structured SQL data query statement is the SQL after injecting the data access permission information in step S4; S7. Multi-granularity insight generation and narrative arrangement: The data returned in step S6 is analyzed and core insights are extracted, a narrative report is obtained to reply to the user according to the extracted core insights, and a visualization chart type is recommended and corresponding chart configuration parameters are generated according to the analysis intent and data characteristics; S8. Personalized interactive report presentation and multi-round dialogue: Based on the narrative report and the visualization chart, an initial intelligent report is formed, and subsequent exploratory questions or drilling analysis suggestions are automatically generated.
[0006] Preferably, the multi-agent simulated jury system checks the candidate SQL in step S3, which includes: the multi-agent simulated jury system performs syntax and semantic verification when reviewing, and alarms and refuses to execute the SQL when it is found that it does not meet the specification, and generates error information, and requires the model to be modified and iterated according to the error information until it meets the specification.
[0007] Preferably, step S5 includes: after linking the entity with the knowledge graph, using DeepSeek-R1 to reason the thinking chain, parsing the user's expression into a structured intent, using RAG to retrieve Schema, rules, and examples, constructing a dynamic context, assembling prompt words, and identifying the user's core analysis intent, target entity, and key indicators; adopting an active questioning mechanism and / or synonym and term mapping to disambiguate the user's input natural language.
[0008] Preferably, step S6 includes: before generating the query statement, the model interacts with the data directory, correctly understands the database schema, table relationships and field meanings according to step S2, ensures the syntactic and semantic correctness of the query through step S3, and ensures the security and performance correctness of the query statement through step S4; the generated query statement is sent to the target database for execution to obtain the original, structured data result set.
[0009] Preferably, step S5, disambiguating the natural language input by the user, includes: a) Proactive questioning mechanism: Query the dynamic knowledge subgraph to check whether the key attributes of the core entities are missing or whether the relationship path is interrupted. The model will use these missing attributes and interrupted relationship path nodes to proactively generate clarifying questions. b) Synonym and terminology mapping: When the user inputs key indicators in natural language, the model automatically queries the mapping dictionary knowledge base of public security business terms and technical fields.
[0010] Preferably, step S5 includes: automatically recommending key indicators that the unit has used frequently in the past based on the intent analysis results; obtaining the current user's identity information, historical query records, preference settings and data access permissions to construct a user profile.
[0011] Preferably, step S3 includes: constructing a multi-agent simulated review panel system to simulate multiple review panels composed of experts from different domains. The agents include a syntax inspector, a performance engineer, a business logic expert, and a rule auditor. Each agent checks the candidate SQL, and finally obtains the final decision score through a weighted decision mechanism.
[0012] Preferably, the final decision score formula is: Final_Scoreᵢ = (S_syntax * W_syntax) +(S_performance * W_performance) + (S_business * W_business) + (S_rule * W_rule), where Final_Scoreᵢ is the final decision score, S_syntax is the score checked by the syntax inspector, W_syntax is the weight of the syntax inspector, S_performance is the score checked by the performance engineer, W_performance is the weight of the performance engineer, S_business is the score checked by the business logic expert, W_business is the weight of the business logic expert, S_rule is the score checked by the rule auditor, and W_rule is the weight of the rule auditor; the SQL with the highest Final_Score is selected as the optimal output.
[0013] Preferably, in step S1, during the natural language interaction process, the system identifies the user's questions by dynamically embedding Few-Shot examples, structured descriptions, and fixed instruction templates.
[0014] The beneficial effects achieved by this invention are: 1. Enhance the depth and flexibility of data analysis: Compared with traditional data processing methods, this invention can more accurately analyze users' complex query needs, and automate the entire process from data input to analysis output, enabling deeper data analysis.
[0015] 2. Meeting Personalized Needs: Through the flexible combination of dynamic template engine and visualization components, the system significantly improves report generation efficiency and interactivity, reduces manual intervention costs, and meets the personalized needs of different users.
[0016] 3. Personalized Service Capabilities: The continuous learning mechanism and role-based access control module endow the system with stronger personalized service capabilities and business fit, significantly improving the intelligence level and application efficiency of data analysis in the public security industry.
[0017] 4. Multimodal Interaction: By deeply applying multimodal interaction mechanisms, the system achieves intelligent recognition and fusion processing of diverse user input methods, effectively improving operational convenience and response accuracy.
[0018] 5. Cross-system data statistical analysis: Relying on a unified data indicator pool and natural language interaction capabilities, the system promotes efficient information sharing and improves joint operation efficiency.
[0019] 6. Mobile Terminal Adaptation: The multimodal feedback mechanism is adapted to mobile terminals, enabling grassroots police officers to access data and obtain analysis results at any time during their work on the front lines, thereby enhancing their emergency response capabilities.
[0020] 7. Lowering the barrier to data use: This intelligent and personalized data service model will significantly lower the barrier to data use for police officers, enabling technology to truly serve practical needs.
[0021] 8. Continuous optimization and learning: As the system is continuously optimized and its learning capabilities are enhanced, its widespread application in the public security industry will drive police work towards intelligence, efficiency, and precision.
[0022] To further understand the features and technical content of the present invention, please refer to the following detailed description and drawings of the present invention. However, the drawings provided are for reference and illustration only and are not intended to limit the present invention. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the process of Embodiment 1 of the present invention; Figure 2 This is a flowchart illustrating Embodiment Six of the present invention; Detailed Implementation
[0024] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can understand the advantages and effects of the present invention from the content disclosed in this specification. The present invention can be implemented or applied through other different specific embodiments, and various details in this specification can also be modified and changed based on different viewpoints and applications without departing from the spirit of the present invention. Furthermore, the accompanying drawings of the present invention are for simple illustrative purposes only and are not depictions of actual dimensions; this is stated in advance. The following embodiments will further describe the relevant technical content of the present invention in detail, but the disclosed content is not intended to limit the scope of protection of the present invention.
[0025] Example 1: As Figure 1 As shown, this embodiment provides a personalized interactive intelligent reporting method based on a large model. The method includes the following steps: S1. Construct a multimodal prompting project: perform structured processing on the data tables and column data input into the model and construct fixed instruction templates, while also using historically successfully executed SQL statements as fixed instruction templates; S2. Fine-tuning the SQL expert model construction: During model training and inference, not only natural language questions are provided, but also target database information related to the questions is dynamically provided; the standard answer SQL is used as a label during the training process, and the SQL generated by the model is executed on the target database. The result of comparing the executed SQL with the standard answer SQL is used as a reward signal and incorporated into the model's training loop. S3. Constructing output correction and adjustment: For the same problem, the model trained in step S2 generates multiple candidate SQL statements. The candidate SQL statements are checked by a multi-agent simulated review panel system. A weighted decision mechanism is used to obtain the final decision score of each candidate SQL statement after the check. The candidate SQL statement with the highest final decision score is selected as the SQL statement generated by the model. S4. Build output security performance correction: Before the model generates the final SQL, the system injects the current user's data access permission information into the SQL, and intercepts dangerous SQL operations at the system level; when the SQL generated by the model is verbose, the model is required to optimize and rewrite the SQL. S5. Multimodal Intent Perception and Context Construction: Based on the initial data input into the model in step S1, a dynamic knowledge subgraph is constructed to obtain entities and relationships in the current and historical contexts, and the entities are linked to the knowledge graph to parse the user's expression into a structured intent and construct a dynamic context. S6. Multimodal dynamic query SQL generation and execution: Based on the intent and context parsed in step S5, the model automatically identifies whether to generate a structured SQL data query statement or call the system's pre-built data analysis API; the structured SQL data query statement is the SQL after injecting data access permission information in step S4; S7. Multi-granularity insight generation and narrative arrangement: Analyze the data returned in step S6 and extract core insights. Based on the extracted core insights, obtain the narrative report of the responding user. At the same time, recommend visualization chart types and generate corresponding chart configuration parameters based on the analysis intent and data characteristics. S8. Personalized interactive report presentation and multi-turn dialogue: Based on narrative reports and visual charts, it generates preliminary intelligent reports and proactively generates subsequent exploratory questions or drill-down analysis suggestions.
[0026] Preferably, in step S1, during the natural language interaction process, the system identifies the user's questions by dynamically embedding Few-Shot examples, structured descriptions, and fixed instruction templates.
[0027] Preferably, the multi-agent simulation review panel system in step S3 checks the candidate SQL, including: the multi-agent simulation review panel system prioritizes syntax and semantic verification during the review, and when it finds that the SQL does not conform to the specifications, it issues an alarm and refuses to execute the SQL, while generating error information and requiring the model to correct and iterate according to the error information until it meets the specifications.
[0028] Preferably, step S6 includes: before generating the query statement, the model interacts with the data directory to correctly understand the database schema, table relationships, and field meanings according to step S2, and ensures the syntactic and semantic correctness of the query through step S3, and ensures the security and performance correctness of the query statement through step S4; the generated query statement is sent to the database for execution to obtain the original, structured data result set. The data directory is a summary schema of the target database.
[0029] The beneficial effects of this embodiment are: Enhance the depth and flexibility of data analysis: Through multimodal prompting engineering, SQL expert model fine-tuning, output correction and security performance correction, the system can more accurately parse users' complex query needs and achieve more in-depth data analysis.
[0030] Meeting personalized needs: The system supports flexible combinations of dynamic template engines and visualization components, significantly improving report generation efficiency and interactivity, and meeting the personalized needs of different users.
[0031] Multimodal interaction: The system realizes intelligent recognition and fusion processing of diverse user input methods, improving the ease of operation and response accuracy.
[0032] Example 2: This example should be understood as including at least all the features of any of the foregoing examples, and further improving upon them; Preferably, step S1, which involves structuring and constructing a fixed instruction template, includes: Structured schema description: Instead of directly providing the database schema (table names, column names, types) to the model, it performs structured processing. During implementation, comments (` / * ... * / `) are added to each column to explain its business meaning, value range, and relationship with other tables (such as ` / / foreign key`), enabling the model to understand the business semantics.
[0033] Dynamic Few-Shot Examples: During natural language interaction with users, a small number of similar examples are dynamically embedded to "teach" the model to answer questions in the current context and identify accurate questions.
[0034] Command templates: By automatically building fixed command templates from historically successfully executed SQL queries, commonly used query patterns, and important business rules, these templates are recommended on the interactive page to constrain user input and model output, reducing the need for multiple rounds of user dialogue correction.
[0035] The beneficial effects of this embodiment are: Enhance the model's understanding of business semantics: Through structured schema descriptions, dynamic Few-Shot examples, and instruction templates, the model can better understand the database structure and business meaning, thereby improving query accuracy.
[0036] Improved query efficiency: Interactive clarification and disambiguation mechanisms reduce errors caused by unclear intent and improve query efficiency.
[0037] Ensuring the correctness of query results: The execution result feedback fine-tuning mechanism incorporates "result correctness" as a reward signal into the training loop, ensuring the correctness of query results.
[0038] Example 3: This example should be understood as including at least all the features of any of the foregoing examples, and further improving upon them; Preferably, step S2 includes: 1. Domain-adaptive fine-tuning: Constructing a high-quality Natural Language (Natural Language, SQL) pairing dataset: Based on historical real queries, manually labeled, or synthetic data, construct a training dataset closely related to the target database. The core of constructing a high-quality Natural Language (Natural Language, SQL) pairing dataset mainly focuses on input-side optimization, providing the model with clearer context and instructions. The goal is to reduce the model's understanding difficulty, transforming ambiguous natural language into precise technical questions. Specific methods are as follows: First, the enhanced suggestion engineering adopts a structured schema description, instead of directly providing the database schema (table names, column names, types) to the model, it performs structured processing. Comments ( / * ... * / ) are added to each column, explaining its business meaning, value range, and relationship with other tables (e.g., / / foreign key, related to dim_user.id). This greatly improves the model's understanding of business semantics. Simultaneously, dynamic Few-Shot examples are used, dynamically embedding a small number of examples into the suggestions. Furthermore, instruction templates are used, employing fixed instruction templates to constrain user input and model output.
[0039] Secondly, interactive clarification and disambiguation, along with a proactive questioning mechanism, prevent the model from directly generating SQL when a user's query is ambiguous or incomplete. Instead, it proactively generates clarifying questions, which significantly reduces errors caused by unclear intent. Simultaneously, it performs synonym and terminology mapping, maintaining a dictionary of business terms and technical fields.
[0040] Model Fine-tuning: The open-source large-scale model SQLCoder-70B was supervised and fine-tuned using the aforementioned dataset. First, dynamic context enhancement was employed. During training and inference, not only natural language questions were provided, but also database information related to those questions (such as table names, column names, sample data, and foreign key relationships) were dynamically provided, simulating the process of a real developer consulting documentation. This solved the problem of the model "forgetting" when faced with a new database. Second, execution result feedback fine-tuning was used. During training, not only were "standard answer SQL" used as labels, but the SQL generated by the model was also executed on the target database. The execution results were compared with the standard answer's execution results, and this "result correctness" was incorporated into the training loop as an additional reward signal. This directly optimized the model towards the ultimate goal of "result correctness," rather than just "syntactic correctness." Supervised fine-tuning based on these two points ultimately yielded a "SQL expert model" specifically designed for the internal data environment of the public security system.
[0041] 2. Retrieval Enhancement Generation (RAG): Building an "SQL knowledge base": This involves constructing a vector database from historically successfully executed SQL queries, commonly used query patterns, and important business rules. Retrieval-Generation Pattern: When a new question is received, several relevant successful SQL examples and rules are retrieved from the RAG knowledge base. The retrieved rules and examples, database schema context, and user question are then recombine into a dynamic prompt containing "database schema information, SQL writing rules to be followed, successful SQL examples to reference, and my question." This prompt is then injected as context into the prompt, allowing the SQLCoder model to generate the final SQL. This effectively standardizes and guides model behavior, preventing low-level errors and generating high-quality, compliant SQL.
[0042] Preferably, the domain adaptive fine-tuning step (1) also exists in the structured processing and fixed instruction template construction in step S1. Step S1 adds its table structure and table relationships, which can better recommend and correct the user's true intent based on the context. Step S2 adds its table structure and table relationships in order to adjust the fine-tuning SQL expert model to accurately generate successful SQL.
[0043] The beneficial effects of this embodiment are: Constructing high-quality training datasets: Training datasets built based on historical real queries, manually labeled data, or synthetic data can better reflect the internal data environment of public security and improve the generalization ability of the model.
[0044] Enhanced Model Memory Capacity: The dynamic context enhancement mechanism solves the problem of model "forgetting" when facing new databases, and improves the model's memory capacity.
[0045] Improve query result quality: The retrieval enhancement generation mechanism can retrieve relevant successful SQL examples and rules, guiding the model to generate high-quality SQL queries.
[0046] Example 4: This example should be understood as including at least all the features of any of the foregoing examples, and further improving upon them; Preferably, step S3 includes: constructing a multi-agent simulated review panel system to simulate multiple review panels composed of experts from different domains. The agents include a syntax inspector, a performance engineer, a business logic expert, and a rule auditor. Each agent checks the candidate SQL, and finally obtains the final decision score through a weighted decision mechanism.
[0047] Preferably, the final decision score formula is: Final_Scoreᵢ = (S_syntax * W_syntax) +(S_performance * W_performance) + (S_business * W_business) + (S_rule * W_rule), where Final_Scoreᵢ is the final decision score, S_syntax is the score checked by the syntax inspector, W_syntax is the weight of the syntax inspector, S_performance is the score checked by the performance engineer, W_performance is the weight of the performance engineer, S_business is the score checked by the business logic expert, W_business is the weight of the business logic expert, S_rule is the score checked by the rule auditor, and W_rule is the weight of the rule auditor; the SQL with the highest Final_Score is selected as the optimal output.
[0048] Preferably, step S3 includes: SQL syntax and semantic validation: Static checking: Immediately after generation, the SQL parser sqlglot is used to perform a syntax check to ensure that it is executable.
[0049] Execution plan analysis: Before actual execution, the `EXPLAIN` command is used to analyze the SQL execution plan. If high-risk or low-performance operations such as full table scans or Cartesian products are found, alerts will be triggered and execution will be refused, requiring the model to be optimized and regenerated.
[0050] Self-correction and iterative optimization Execution feedback loop: This enables the model to "learn from errors." If the generated SQL fails to execute, the error message is fed back to the model, requiring it to correct itself based on the error. This process can iterate multiple times until it succeeds.
[0051] Multiple Candidate Generation and Selection: For the same problem, the model generates multiple candidate SQL statements. Then, a multi-agent simulated review panel system is constructed to simulate a review panel composed of multiple experts (agents) from different domains. The specific agents mainly include the following: Syntax checker: The most basic check. Uses a database parser to check the SQL syntax for correctness and outputs a binary score (1: pass, 0: fail). It has a veto power; syntax errors result in immediate rejection.
[0052] Performance Engineer: Evaluate the potential performance of SQL queries. This is done by analyzing the execution plan and outputting a normalized score (e.g., 0-1).
[0053] Business Logic Expert: Executes SQL on a secure test database environment, simultaneously executing either a "standard answer SQL" or a "gold standard query," and compares the result sets returned by the two to ensure complete consistency. Outputs either a similarity score or a logical compliance score (0-1 points).
[0054] Rule Auditor: Checks whether the SQL strictly adheres to the hard rules in the SQL rule base and outputs a compliance score (e.g., 0.2 points are deducted for each rule violation, with a minimum of 0 points). Each agent plays a role, evaluating SQL from different dimensions. They "debate" and "score" candidate SQL statements from their unique perspectives (such as performance, syntax, and business logic), ultimately unifying all rules towards an optimal result through a weighted decision mechanism. The following is a complete weighted decision and unification process, along with the steps: Step 1: Generate candidate set The fine-tuned SQLCoder model (based on the previously mentioned dynamic context method) generates N (e.g., 5-7) different candidate SQL statements [SQL1, SQL2, ..., SQL] for the same question. n ].
[0055] Step 2: Parallel evaluation of multiple agents In a multi-agent simulation review panel system, each agent plays a role and evaluates SQL from different dimensions. For each candidate SQL, SQLᵢ gives a score Sᵢᵥ (where v represents different perspectives).
[0056] Step 3: Weighted Decision-Making and Unified Direction First, the system needs to pre-define a weight matrix to represent the degree of importance given to different dimensions. For example: W_business = 0.4 (Business logic is the most important) W_performance = 0.3 (Second-best performance) W_rule = 0.2 (Rule compliance) W_syntax = 0.1 (Syntax basics) Final decision score calculation Final_Scoreᵢ = (S_syntax * W_syntax) + (S_performance * W_performance) + (S_business * W_business) + (S_rule * W_rule) Unified direction: Select the SQL with the highest final score (Final_Score) as the optimal output. Step 4: Self-correction and iterative optimization loop
[0057] If all candidate SQL queries score below a certain threshold (e.g., low business logic scores indicate incorrect results), the system will not simply select the least problematic one, but will trigger a self-correcting loop. First, the debate records of the judging panel (the reasons for each agent's low score) are compiled into a detailed error report. This error report is used as feedback to reassemble a new, more detailed set of prompts and send them to the model. Based on the reassembled prompts rich in feedback information, the model generates a new generation of candidate SQL, which is then evaluated again.
[0058] Ultimately, the best option is selected based on scoring rules such as grammatical correctness, conformity to common patterns, and inclusion of high-performance operations.
[0059] The beneficial effects of this embodiment are: Ensuring query security: The multi-agent simulated review panel system can evaluate candidate SQL from multiple dimensions such as syntax, performance, business logic, and rule compliance, ensuring query security.
[0060] Improve query efficiency: The multi-candidate generation and selection mechanism can generate multiple candidate SQL statements and select the optimal result through a weighted decision-making mechanism, thereby improving query efficiency.
[0061] Self-correction and iterative optimization: The execution feedback loop mechanism enables the model to "learn from mistakes" and improve the quality of query results through iterative optimization.
[0062] Example 5: This example should be understood as including at least all the features of any of the foregoing examples, and further improving upon them; Preferably, step S4 includes: security and access control. Access control injection: Before generating the final SQL, the system automatically injects the current user's data access permission constraints as comments and appends them directly to the `WHERE` clause of the generated SQL to achieve row-level data security.
[0063] High-risk operation interception: Directly intercept any SQL statements containing dangerous operations such as `DELETE`, `UPDATE`, and `DROP` at the system level.
[0064] Performance optimization SQL simplification and optimization: When the SQL generated by a large model becomes verbose, the model is required to rewrite and optimize the generated SQL.
[0065] Caching mechanism: Successful `<user question, SQL>` queries are cached. When a question with a similarity greater than a preset value is encountered again, the cached result is returned directly, which greatly reduces model call latency and database pressure.
[0066] The beneficial effects of this embodiment are: Ensuring data security: The permission injection mechanism can inject user data access permission constraints into SQL queries, thus ensuring data security.
[0067] Improve query efficiency: The high-risk operation interception mechanism can block SQL queries containing dangerous operations, ensuring query security.
[0068] Optimize query performance: SQL simplification and optimization mechanisms can optimize lengthy SQL queries and improve query efficiency.
[0069] Example 6: This example should be understood as including at least all the features of any of the foregoing examples, and further improving upon them; Preferably, step S5 includes: after linking entities with the knowledge graph, using DeepSeek-R1 to perform thought chain reasoning, parsing the user's expression into a structured intent, using RAG to retrieve schemas, rules, and examples, constructing a dynamic context, assembling prompt words, and identifying the user's core analytical intent, target entities, and key indicators; and using an active questioning mechanism and / or synonym and term mapping to disambiguate the natural language input by the user.
[0070] Preferably, step S5, disambiguating the natural language input by the user, includes: a) Proactive questioning mechanism: Query the dynamic knowledge subgraph to check whether the key attributes of the core entities are missing or whether the relationship path is interrupted. The model will use these missing attributes and interrupted relationship path nodes to proactively generate clarifying questions. b) Synonym and terminology mapping: When the user inputs key indicators in natural language, the model automatically queries the mapping dictionary knowledge base of public security business terms and technical fields.
[0071] Preferably, step S5 includes: automatically recommending key indicators that the unit has frequently used in the past based on the intent analysis results; obtaining the current user's identity information, historical query records, preference settings, and data access permissions to construct a user profile. The unit mentioned is the unit where the current user is located.
[0072] Preferably, step S5 includes: Based on the initial query request received from the user in natural language input in step S1, a dynamic knowledge subgraph is constructed. Entities and relationships extracted from the current and historical context of the query are linked to the knowledge graph. DeepSeek-R1 large model is used for deep reasoning of thought chains to parse the fuzzy user expression into a structured intent. RAG is used to retrieve schemas, rules, and examples to construct a dynamic context and assemble prompt words (structured intent + retrieved relevant schemas + rules + examples + original question). This achieves end-to-end transparency of intent, greatly reducing interference from irrelevant contextual information to identify the core analytical intent (such as trend analysis, comparative analysis, attribution analysis), target entities (such as case information, crime location, victims), and key indicators (such as amount defrauded, method of defrauding).
[0073] Interactive methods are used to clarify and disambiguate the natural language input by users. One method is the proactive questioning mechanism: when a user's query is ambiguous or incomplete, the dynamic knowledge subgraph is queried to check whether the key attributes of the core entities are missing and whether the relationship path is interrupted. The model will use these missing attributes and interrupted relationship path nodes to proactively generate clarifying questions.
[0074] Second, synonym and terminology mapping: When the user inputs key indicators in natural language, the model automatically queries the mapping dictionary knowledge base of public security business terms and technical fields.
[0075] It integrates a knowledge base for managing statistical report indicators, and automatically recommends key indicators that the organization has used frequently throughout history based on intent analysis results.
[0076] The system integrates a user profiling module to obtain the current user's identity information, historical query records, preference settings, and data access permissions, thereby building a rich user context.
[0077] The beneficial effects of this embodiment are as follows: the dynamic knowledge subgraph, the DeepSeek-R1 large model, and the RAG mechanism can parse ambiguous user expressions into structured intents, improving the model's understanding of user intents. The proactive questioning mechanism and the synonym and terminology mapping mechanism can reduce errors caused by unclear intents and improve query efficiency. The user profiling module can recommend indicators and charts that better meet user needs based on the user's historical query records and preference settings, thus enhancing the user experience.
[0078] Example 7: This example should be understood as including at least all the features of any of the foregoing examples, and further improving upon them; Preferably, step S6 includes: Based on the intent and context parsed in step S5, the large language model automatically identifies whether to generate a structured SQL data query statement or to call the system's pre-built data analysis API.
[0079] Before generating a query, the model interacts with the data catalog to correctly understand the database schema, table relationships, and field meanings according to step S2, and ensures the syntactic and semantic correctness of the query through step S3, and ensures the security and performance correctness of the query statement through step S4.
[0080] The generated query statement is sent to the data warehouse for execution to obtain the raw, structured data result set.
[0081] Preferably, step S7 includes: Core Insight Extraction: The large language model performs in-depth analysis on the data results returned in step S6 to identify key statistical features (such as current period numbers, same period numbers, significant changes), trends, and patterns in the data.
[0082] Narrative report generation: The extracted core insights are organized and arranged in narrative language that matches the user's role and knowledge level, generating a concise and easy-to-understand text summary that directly answers the user's initial question and highlights the most important findings.
[0083] Visualization component recommendation: Based on the analysis intent and data characteristics (such as time series, proportional distribution, geographic information), the large language model recommends the most suitable visualization chart type (such as line chart, bar chart, pie chart, scatter plot) and generates the corresponding chart configuration parameters.
[0084] Preferably, step S8 includes: The generated text summaries and recommended visualizations are integrated into a unified interactive interface to form a preliminary intelligent report.
[0085] The system proactively generates follow-up exploratory questions or drill-down analysis suggestions (e.g., "Would you like to further examine the spatiotemporal distribution of theft cases in this jurisdiction over the past three months?") to guide users in in-depth data exploration.
[0086] Users can initiate a new round of interaction using natural language based on the current report results (such as asking follow-up questions, modifying chart types, or requesting drill-down / roll-up analysis). The system will understand the user's new intent based on previous dialogue history and environmental context, and repeat steps S5-S8 to achieve true multi-turn conversational analysis.
[0087] The beneficial effects of this embodiment are: Ensuring query security: The system can automatically inject user data access permission constraints into SQL queries to ensure query security.
[0088] Ensuring the correctness of query results: The system can ensure the syntactic and semantic correctness of query statements and intercept SQL queries containing dangerous operations, thus guaranteeing the correctness of query results.
[0089] Enhancing User Experience: Core insight extraction, narrative report generation, and visualization component recommendations can present data analysis results to users in a more understandable way, thus improving the user experience.
[0090] Multi-turn conversational analysis: The system can conduct multi-turn conversational analysis based on user feedback, helping users to explore data more deeply.
[0091] The content disclosed above is only a preferred and feasible embodiment of the present invention, and is not intended to limit the scope of protection of the present invention. Therefore, all equivalent technical changes made based on the content of the present invention specification and drawings are included within the scope of protection of the present invention. Furthermore, the elements therein can be updated as technology develops.
Claims
1. A personalized interactive intelligent reporting method based on a large model, characterized in that, The method includes: S1. Constructing a multimodal prompting project: structuring the data tables and column data input into the model and constructing fixed instruction templates, while also using historically successfully executed SQL statements as fixed instruction templates; S2. Fine-tuning the SQL expert model construction: During model training and inference, not only natural language questions are provided, but also target database information related to the questions is dynamically provided; the standard answer SQL is used as a label during the training process, and the SQL generated by the model is executed on the target database. The result of comparing the executed SQL with the standard answer SQL is used as a reward signal and incorporated into the model's training loop. S3. Constructing output correction and adjustment: For the same problem, the model trained in step S2 generates multiple candidate SQL statements. The candidate SQL statements are checked by a multi-agent simulated review panel system. A weighted decision mechanism is used to obtain the final decision score of each candidate SQL statement after the check. The candidate SQL statement with the highest final decision score is selected as the SQL statement generated by the model. S4. Build output security performance correction: Before the model generates the final SQL, the system injects the current user's data access permission information into the SQL, and intercepts dangerous SQL operations at the system level; when the SQL generated by the model is verbose, the model is required to optimize and rewrite the SQL. S5. Multimodal Intent Perception and Context Construction: Based on the initial data input into the model in step S1, a dynamic knowledge subgraph is constructed to obtain entities and relationships in the current and historical contexts, and the entities are linked to the knowledge graph to parse the user's expression into a structured intent and construct a dynamic context. S6. Multimodal dynamic query SQL generation and execution: Based on the intent and context parsed in step S5, the model automatically identifies whether to generate a structured SQL data query statement or call the system's pre-built data analysis API; the structured SQL data query statement is the SQL after injecting data access permission information in step S4; S7. Multi-granularity insight generation and narrative arrangement: Analyze the data returned in step S6 and extract core insights. Based on the extracted core insights, obtain the narrative report of the responding user. At the same time, recommend visualization chart types and generate corresponding chart configuration parameters based on the analysis intent and data characteristics. S8. Personalized interactive report presentation and multi-turn dialogue: Based on narrative reports and visual charts, it generates preliminary intelligent reports and proactively generates subsequent exploratory questions or drill-down analysis suggestions.
2. The personalized interactive intelligent reporting method based on a large model as described in claim 1, characterized in that, Step S3, the multi-agent simulation review panel system checks the candidate SQL, including: during the review, the multi-agent simulation review panel system prioritizes syntax and semantic verification. When it finds that the SQL does not conform to the specifications, it issues an alarm and refuses to execute the SQL. At the same time, it generates error information and requires the model to correct and iterate according to the error information until it meets the specifications.
3. The personalized interactive intelligent reporting method based on a large model as described in claim 1, characterized in that, Step S5 includes: after linking entities with the knowledge graph, using DeepSeek-R1 to perform thought chain reasoning, parsing the user's expression into a structured intent, using RAG to retrieve schemas, rules, and examples, constructing a dynamic context, assembling prompt words, and identifying the user's core analytical intent, target entities, and key indicators; and using an active questioning mechanism and / or synonym and term mapping to disambiguate the natural language input by the user.
4. The personalized interactive intelligent reporting method based on a large model as described in claim 1, characterized in that, Step S6 includes: before generating the query statement, the model interacts with the data directory, correctly understands the database schema, table relationships and field meanings according to step S2, ensures the syntactic and semantic correctness of the query through step S3, and ensures the security and performance correctness of the query statement through step S4; the generated query statement is sent to the target database for execution to obtain the original, structured data result set.
5. The personalized interactive intelligent reporting method based on a large model as described in claim 3, characterized in that, Step S5 disambiguates the natural language input by the user, including: a) Proactive questioning mechanism: Query the dynamic knowledge subgraph to check whether the key attributes of the core entities are missing or whether the relationship path is interrupted. The model will use these missing attributes and interrupted relationship path nodes to proactively generate clarifying questions. b) Synonym and terminology mapping: When the user inputs key indicators in natural language, the model automatically queries the mapping dictionary knowledge base of public security business terms and technical fields.
6. The personalized interactive intelligent reporting method based on a large model as described in claim 3, characterized in that, Step S5 includes: automatically recommending key indicators that the unit has used frequently in the past based on the intent analysis results; and obtaining the current user's identity information, historical query records, preference settings and data access permissions to build a user profile.
7. The personalized interactive intelligent reporting method based on a large model as described in claim 2, characterized in that, Step S3 includes: constructing a multi-agent simulated review panel system to simulate multiple review panels composed of experts from different domains. The agents include syntax inspectors, performance engineers, business logic experts, and rule auditors. Each agent checks the candidate SQL, and finally obtains the final decision score through a weighted decision mechanism.
8. The personalized interactive intelligent reporting method based on a large model as described in claim 7, characterized in that, The final decision score formula is: Final_Scoreᵢ = (S_syntax * W_syntax) + (S_performance * W_performance) + (S_business * W_business) + (S_rule * W_rule), where Final_Scoreᵢ is the final decision score, S_syntax is the syntax inspector's score, W_syntax is the syntax inspector's weight, S_performance is the performance engineer's score, W_performance is the performance engineer's weight, S_business is the business logic expert's score, W_business is the business logic expert's weight, S_rule is the rule auditor's score, and W_rule is the rule auditor's weight. The SQL with the highest Final_Score is selected as the optimal output.
9. The personalized interactive intelligent reporting method based on a large model as described in claim 1, characterized in that, In step S1, during the natural language interaction process, the system identifies the user's questions by dynamically embedding Few-Shot examples, structured descriptions, and fixed instruction templates.
Citation Information
Cited By
AI-based interactive data query method and apparatus, and electronic device
CN122064793A