Natural language based data query analysis method

By constructing dynamic semantic intent tensors and side effect tensors, decomposing them into the smallest semantic units, and dynamically adjusting the complexity of operations, the problems of execution failure and logical conflict in the generation of natural language to SQL queries in existing technologies are solved, and the transparency and stability of multimodal data analysis and enterprise-level data governance are achieved.

CN121070951BActive Publication Date: 2026-04-07BEIJING POWER LAW SPACE-TIME TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies lack deep perception and dynamic feedback in the generation of natural language to SQL queries, leading to execution failures and logical conflicts. They are unable to handle complex multi-round query tasks, cannot support multimodal data analysis, lack causal chain reasoning capabilities and enterprise-level data accountability mechanisms, and have insufficient resource awareness, resulting in limited system stability and scalability.

Method used

By constructing a dynamic semantic intent tensor, generating a side effect tensor for predicting potential execution consequences, decomposing it into the smallest semantic units, dynamically adjusting the complexity of operations, establishing a causal dependency tensor, realizing cross-modal data querying, and supporting enterprise-level operation auditing and resource awareness.

Benefits of technology

It enables dynamic validation and correction of complex queries, improving query success rate and stability, supporting multimodal data analysis, reducing resource impact, and enhancing user interactivity and enterprise-level data governance transparency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121070951B_ABST
    Figure CN121070951B_ABST
Patent Text Reader

Abstract

This invention relates to a natural language-based data query and analysis method. It parses user-input natural language query requests into dynamic semantic intent tensors, including operation types, comparison relationships, time constraints, and data role semantic dimensions. These tensors are dynamically combined according to task semantics to form a complete data query and analysis operation expression. The natural language intent is mapped to a controllable data operation space in the database, generating a preliminary data operation chain. Side effect perception processing is applied to the operation tensors to predict the potential execution consequences of operations, generating a side effect tensor to simulate the side effects of database operations. If any indicator in the side effect tensor exceeds a preset threshold, the operation tensor is locally corrected. A step-by-step semantic resolution mechanism is employed to decompose complex natural language query tasks into multiple smallest semantic units, each mapped to a specific tensor operation. The dependencies between these operation units are dynamically inferred to generate an operation execution chain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to data query and analysis methods, specifically data query and analysis methods based on natural language. Background Technology

[0002] Existing technologies, such as Chinese patent CN118861081A "An Intelligent SQL Query Generation Method and System Based on a Large Language Model," have made some progress in the automated generation of natural language to SQL, but still have several shortcomings and technical drawbacks, mainly in the following aspects: First, this technical solution adopts a training mechanism based on a large language model (such as the LLAMA-Factory framework combined with Qlora fine-tuning), treating the Text-to-SQL task as a pure language mapping problem. Although it can gradually generate SQL statements through chained reasoning and decompose complex queries with the help of a task planner, it is essentially still stuck in a one-way mapping. The current approach lacks deep awareness and dynamic feedback at the data execution level. Specifically, while it supports feedback and correction of erroneous SQL queries, this process largely relies on single-step rollbacks and retries by the executor, which is a reactive correction. It cannot detect potential side effects and logical conflicts of operations in advance during the generation phase, leading to problems such as logically correct queries failing to execute in real database environments. These problems include hidden errors such as deadlocks, resource exhaustion, empty set returns, and inconsistent data dimensions. Especially in tasks involving complex multi-table joins, time series analysis, window functions, and multi-round interactions, the existing method cannot guarantee the executability of SQL and the rationality of business logic.

[0003] Secondly, existing technical solutions suffer from unpredictable cumulative risks in multi-round query tasks. For example, consecutive rounds of natural language queries can easily lead to state accumulation, gradually increasing the database load and even triggering chain-like side effects such as cache overflow, intermediate table explosion, and logical blind spots. Existing technologies do not model the evolution trajectory of query tasks, lack contextual awareness of historical query behavior, and cannot form dynamic risk prediction of query chains. This makes the system prone to falling into a gradually failing execution mode in long-cycle complex analysis scenarios (such as BI analysis and enterprise multidimensional data analysis), resulting in business continuity being hindered. Furthermore, this patent primarily focuses on structured SQL generation and lacks sufficient support for multimodal data analysis. Real-world enterprise scenarios often involve heterogeneous data from multiple sources, such as structured data, semi-structured logs, unstructured text, images, and time-series data. Existing technologies only support mapping natural language to SQL and cannot simultaneously schedule text analysis, time-series operations, and structured queries within a unified operating space. The lack of cross-modal data operation tensor modeling prevents users from completing comprehensive analysis tasks in one go using natural language. For example, scenarios such as "predicting slow-moving goods based on sales, inventory, reviews, and logistics" can only be split into multiple rounds of operations, reducing user experience and system usability.

[0004] Furthermore, while existing technologies mention chain-like reasoning in SQL generation, they lack explicit modeling of causal dependencies between operations and lack causal chain reasoning capabilities. They cannot handle conditional triggering relationships in multi-stage reasoning tasks. For example, some operations require dynamic decisions on whether to proceed to the next calculation based on the results of the previous query. This non-linear process is difficult to implement in this patent, resulting in complex tasks being generated step-by-step through serial execution, lacking intelligent process control and dynamic path selection. Moreover, existing technologies do not provide enterprise-level data accountability and operational auditing capabilities. Existing methods cannot transparently map the operational logic, side effect risks, and user interaction adjustments of natural language query tasks to the enterprise knowledge management system. They lack a traceable and reproducible metadata management mechanism, leading to opaque, difficult-to-audit, and non-compliant operational processes when enterprises use large language models to automatically generate SQL, which is detrimental to enterprise-level data governance. Furthermore, existing technologies primarily rely on the inherent learning capabilities of large language models, lacking an adaptive generation mechanism based on the actual resource status of the database environment. They cannot dynamically adjust the complexity and execution plan of operations according to the current database load, memory pressure, and IO bottlenecks. This can easily lead to situations where the query logic generated by the model is semantically correct, but times out or fails during actual database execution due to insufficient resources. Existing technologies cannot achieve resource-aware query generation and lack system-level collaborative control, further limiting the scalability of the system and the implementation of large-scale application scenarios. Summary of the Invention

[0005] The purpose of this invention is to provide a data query and analysis method based on natural language, thereby addressing some of the shortcomings and deficiencies pointed out in the background art.

[0006] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows: a data query and analysis method based on natural language, comprising: parsing the natural language query request input by the user into a dynamic semantic intent tensor, wherein the semantic intent tensor is a multi-dimensional operation tensor, including operation type, comparison relationship, time constraint and data role semantic dimension, and dynamically combining according to task semantics to form a complete data query and analysis operation expression;

[0007] Based on the operation tensor, natural language intent is mapped to the controllable data operation space of the database to generate a preliminary data operation chain. During the operation generation process, the operation tensor is subjected to side effect perception processing to predict the potential execution consequences of the operation and generate a side effect tensor. The side effect tensor is used to simulate the side effects of database operations, including the probability of returning an empty set, performance risks, and logical conflicts. If any indicator in the side effect tensor exceeds a preset threshold, the operation tensor is locally corrected. The correction includes splitting the operation tensor, supplementing boundary conditions, or replacing subqueries.

[0008] Based on side-effect awareness correction of operation tensors, a step-by-step semantic resolution mechanism is adopted to decompose complex natural language query tasks into multiple smallest semantic units. Each unit is mapped to a specific tensor operation, and the dependencies between operation units are dynamically inferred to generate operation execution chains. The operation execution chains clearly distinguish the logical dependencies between concurrent execution and sequential execution, so that the generated data query and analysis operation sequences have executability, verifiability and the ability to express complex tasks.

[0009] Furthermore, the generation process of the side effect tensor includes establishing a latent variable modeling mechanism for operational behavior, encoding the execution behavior pattern that cannot be directly observed as a latent variable, and reasoning through the implicit behavioral characteristics of the operational tensor; the generation of the side effect tensor is based on the evolution trajectory of the operational tensor, constructing a time series correlation analysis mechanism, predicting the cumulative side effects of the state in consecutive rounds of natural language queries, and supporting trend warnings for the chain-like side effects generated in the query history.

[0010] Furthermore, in the side effect awareness process, the side effect tensor is coupled with the system resource status in real time, the complexity threshold of the generated operation tensor is dynamically adjusted, and the operation generation strategy is adjusted according to the current database load, storage status or network bottleneck, forming a resource-aware query generation system.

[0011] Furthermore, the local correction process of the operation tensor includes constraining and pulling back the operation tensor space, and avoiding high-risk operations at the tensor level by fine-tuning the tensor space boundary; the step-by-step semantic resolution supports multi-path generation for inference-type operation tensors, forms a parallel set of operation chain candidates based on different resolution strategies, and dynamically selects operation paths by using side-effect tensors as optimization indicators.

[0012] Furthermore, during the generation of the operation execution chain, a causal dependency tensor across operation tensors is established to explicitly encode the causal order and conditional triggering relationship between operations, supporting the dynamic expansion of nonlinear operation chains.

[0013] Furthermore, the side effect perception processing, combined with the reverse reachability analysis of the operation tensor, detects unsolvable operation patterns caused by data dependency errors, and discovers potential query deadlocks or data blind spots in advance by reasoning the reverse operation path.

[0014] During the query generation phase, reverse risk propagation modeling is performed on candidate operation tensor paths. A reachability mapping function is constructed based on structural dependencies and semantic constraints to assess whether there are logically closed-loop unreachable issues, empty result sets, or deadlock hidden side effects. A reverse reachability mapping function is introduced for side effect prediction.

[0015]

[0016] in:

[0017] This represents the currently generated operation tensor, which is a structured semantic operation representation; To represent tensors The reverse dependency domain contains all possible values ​​as... The operational path from the upstream source; This is a feasibility weighting function for the reverse path nodes, measuring the feasibility of nodes. arrive Logical reachability; The path consistency scoring function characterizes the path consistency score from arrive The degree of matching between data types / dimensions / conditions; This is a side effect tensor variogram function used to evaluate the path. Should high-risk factors be introduced, among which For dynamic risk control parameters; The final output is the inverse risk integral value, used to represent the tensor. The reversibility safety is such that the lower the value, the more likely the path is to be unreachable or has a logical dead end.

[0018] When a user poses a natural language question to identify the product with the fastest sales growth but continuously declining inventory, the system generates an operational tensor. It involves time series aggregation, grouped window functions, and negative growth detection; through the formula of this invention... After calculation, certain historical paths were discovered. In the structure matching function The score is zero, and the side effect function is also zero. The system detected a high risk of deadlock, so it preemptively disassembled the aggregation order and reconstructed the operation tensor to avoid blind spots.

[0019] Furthermore, the side effect tensor is used for operation correction and for dynamically generating system prompts to provide feedback on potential risks of the operation in natural language, allowing users to participate in collaborative correction during the generation phase.

[0020] Furthermore, the operation tensor is extended to be multimodal, supporting the embedding of query operations for text, numerical, time series and unstructured data into the same operation tensor space, enabling unified side effect awareness and step-by-step execution of cross-modal data query tasks.

[0021] Furthermore, the operation tensor, side effect tensor, and step-by-step semantic resolution results are dynamically mapped to the enterprise knowledge asset management system, enabling transparent recording and traceability of natural language queries and data usage in the knowledge base, and supporting enterprise-level data accountability and operational auditability mechanisms.

[0022] The beneficial effects of this invention are as follows: Through side effect awareness processing and reverse reachability analysis, the system can proactively discover potential problems such as unreachable logical loops, data dependency conflicts, deadlock risks, or empty set returns during the operation generation stage. This enables dynamic verification and automatic correction of query logic, avoiding the execution failure problems of traditional Text-to-SQL methods in complex business scenarios, and significantly improving query success rate and execution stability. It supports embedding structured data (such as sales and inventory), semi-structured data (such as logs and time series), and unstructured data (such as text and comments) into the same operation tensor space, realizing unified scheduling, analysis, and reasoning of multimodal data using natural language. This expands upon the limitation of traditional SQL, which can only operate on structured tabular data, and meets the heterogeneous data analysis needs of enterprises. By coupling the side effect tensor with the real-time resource status of the system, the complexity of the operation tensor can be dynamically adjusted. The query logic is adaptively adjusted based on CPU, memory, IO, and network status, reducing the impact of large-scale query tasks on the database system, ensuring query response stability in multi-user environments, and avoiding resource overload.

[0023] The system dynamically generates operational risk prompts using natural language, translating risk indicators from side-effect tensors into understandable language prompts for users. This allows for interactive and collaborative correction during the generation phase, overcoming the black-box problem of traditional SQL generation. It enables collaborative decision-making for query optimization between business personnel and the system, lowering the operational threshold. The introduction of causal dependency tensors allows for explicit encoding of data dependencies and conditional triggering relationships in the operation chain, supporting dynamic expansion of non-linear query processes and automatically selecting parallel, sequential, or conditional execution paths. This meets the expressive capabilities required for complex business scenarios such as attribution analysis, anomaly tracing, and composite prediction. Attached Figure Description

[0024] Figure 1 This invention describes the natural language data query and analysis process.

[0025] Figure 2 This is a diagram showing the relationship between the side effects of natural language query and the intelligent optimization function of the execution chain in this invention.

[0026] Figure 3 This is a relational diagram for the end-to-end security optimization of natural language queries driven by reverse reachability, as presented in this invention.

[0027] Figure 4 This is a simplified flowchart of the natural language query side effect perception and optimization for retail enterprises in Embodiment 1 of the present invention.

[0028] Figure 5 This is a flowchart of the side effect perception and intelligent correction process for multimodal natural language data analysis in retail enterprises, as described in Embodiment 2 of the present invention. Detailed Implementation

[0029] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0030] Combined with appendix Figure 1 This invention provides a natural language-based data query and analysis method. By constructing a dynamic semantic intent tensor, it transforms natural language input into executable data operation expressions, achieving automated mapping from natural language to database query and analysis. The system receives natural language query requests input by users, performs semantic parsing on the requests, and extracts key operation elements from the task. To this end, the system maps the original natural language input into a dynamic semantic intent tensor based on a language understanding model. The semantic intent tensor is a multi-dimensional operation tensor representation, including but not limited to operation type dimension, comparison relation dimension, time constraint dimension, and data role dimension. The system employs several key semantic tensors. The first dimension represents the basic operation categories involved in the query request, such as filtering, sorting, aggregation, association, grouping, and time windows. The second dimension represents the judgment relationships in the natural language request, such as operators like greater than, less than, equal to, not equal to, contain, and between. Tensor mapping transforms ambiguous or polysemous natural language expressions into explicit comparison operators. The third dimension expresses the time logic in the query request, including fixed time ranges, dynamic time windows, and relative time descriptions (such as the past week, year-on-year comparison, etc.). The system uses a time semantic understanding component to deconstruct natural language time expressions into time condition tensors that can be used for data operations. The fourth dimension clarifies the functional roles of each field in the task, such as indicator fields (e.g., sales revenue, clicks), dimension fields (e.g., region, category), primary keys, and grouping fields. Role labeling provides structured support for subsequent data operations. The construction of these multidimensional semantic tensors is dynamic; it does not use fixed templates or predefined slots but rather combines various semantic dimensions in real-time based on the specific semantics of the natural language task to form a complete operational tensor expression. Specifically, when users ask questions involving single-table queries or simple filtering, the operation tensor has fewer dimensions; however, for query requests involving multi-table joins, complex conditions, and multi-layered logic, the operation tensor will dynamically expand to form a high-dimensional operation expression, enabling the system to flexibly handle query tasks of varying complexity.

[0031] A combined mechanism of operation tensors and side-effect awareness processing is employed to achieve intelligent conversion and secure execution of natural language queries. After a user's natural language query request is parsed into a dynamic semantic intent tensor, the system uses the operation tensor as input and further maps it to the controllable data operation space of the database. The controllable data operation space refers to the set of all executed query operations and their combinations in the database. Through the tensor mapping mechanism, the system matches the corresponding database operation module according to the dimensional content of the semantic intent tensor, completing the initial mapping from natural language expression to data operation statements and generating a preliminary data operation chain. The data operation chain is an execution flow arranged in a sequence of operations, including steps such as data filtering, association, grouping, aggregation, and sorting. However, due to the uncertainty of natural language descriptions and the complexity of the data environment, directly mapping operation tensors to data operation chains can lead to risks in operational logic. For example, over-filtering may result in an empty set being returned, join operations may lead to data explosion or performance bottlenecks, or there may be logical conflicts in the query logic. To address the aforementioned issues, side effect awareness processing is performed concurrently with the generation of the operation chain during the operation generation process. The core of this processing is predicting the potential consequences of each operation unit within the operation tensor, constructing a side effect tensor to quantify the side effects caused by the generated data operation chain during execution. The side effect tensor is characterized by multi-dimensional metrics, including: the probability of an empty set return (the system analyzes the filtering conditions, field distribution, data sparsity, and historical query statistics within the operation tensor to predict whether overly strict filtering will result in no data being returned after execution); performance risk (estimating execution costs and potential performance bottlenecks by assessing the complexity of multi-table joins, index usage, expected number of scanned rows, and current database load); and logical conflict (detecting semantic contradictions or conflicts in the combination of conditions within the operation tensor, such as empty time interval intersections or overlapping conditions leading to constant falsehood). Each metric of the side effect tensor is mapped to a quantifiable risk value and compared to a preset threshold. If any metric in the side effect tensor exceeds the threshold, the system determines that the operation chain has an unacceptable side effect risk and subsequently performs local operation correction. Local operation corrections include, but are not limited to, splitting operation tensors, which breaks down complex operation chains into multiple sub-operation tensors and executes them step by step to reduce overall risk; supplementing boundary conditions to add fault tolerance boundaries to filtering conditions, such as expanding the query range and adding default value processing, to reduce the probability of empty sets; and subquery replacement to transform highly complex nested queries into simpler staged queries, avoiding performance pressure or logical confusion caused by executing all at once.

[0032] To address the challenges of complexity, ambiguity, and multiple operational dependencies in natural language query tasks, a step-by-step semantic resolution mechanism based on side-effect awareness and correction is designed. This ensures that the generated data query operations not only conform to user intent but also possess high executability and operational verification capabilities. After the aforementioned operational tensor undergoes side-effect awareness processing and local correction, the system further performs step-by-step semantic resolution based on this optimized operational tensor, decomposing the complex natural language query task into multiple minimal semantic units. A minimal semantic unit refers to a basic operation module that can be independently completed within the query logic, such as simple filtering operations, single-field sorting, single-index aggregation, or simple table joins. Each semantic unit is transformed into a specific tensor operation through tensor mapping, ensuring its independent executability and result observability. To guarantee the correctness and efficiency of the operation chain, the system constructs an operation execution chain by dynamically reasoning the dependencies between each operational unit. The reasoning of dependencies is based on the semantic dimension expressed by the tensor, such as data flow dependencies, conditional trigger dependencies, primary-foreign key association dependencies, and temporal dependencies. The execution order and data transmission path of the operational units are deduced through the relation matrix within the tensor. During the generation of the operation execution chain, the system explicitly distinguishes between the logical dependencies of concurrent and sequential execution. This includes: for the smallest semantic units that have no data dependencies and can be executed independently, the system marks them as concurrently executable tasks, such as parallel calculation of multiple indicators or independent filtering of multiple dimensions; for semantic units with strong data dependencies, such as the output of a preceding operation serving as the input of a subsequent operation, the system marks them as sequentially executable tasks, forming a serial dependency chain, such as filtering before aggregation or association before calculation. By labeling and managing the concurrency and sequence of the execution chain, the system schedules the execution order and resource allocation of operations to ensure that the overall task is executed optimally in the database or computing environment. This mechanism makes the generated query and analysis operation sequences highly executable, avoiding execution failures due to incorrect operation order or data dependency conflicts; simultaneously, because each operation unit remains independent and verifiable, the system can progressively verify the correctness of the operation chain before execution, improving the system's stability and security. Furthermore, through step-by-step semantic resolution, the system has the ability to express complex tasks and can support multi-stage data analysis processes, such as first querying basic data, then performing statistical analysis, and finally outputting attribution explanations, forming a closed-loop data operation sequence.

[0033] Combined with appendix Figure 2To address the potential execution risks in natural language-driven data queries, a side effect tensor generation mechanism based on latent variable modeling of operational behavior and time series correlation analysis is designed to predict, perceive risks, and provide trend warnings for complex query behaviors. The generation of the side effect tensor not only addresses the static risks of a single operation but also models the unobservable characteristics of operational behavior patterns. To this end, a latent variable modeling mechanism for operational behavior is established, encoding the implicit behavioral characteristics of the operational tensor as latent variables. Latent variables refer to the intrinsic characteristics of database operations that cannot be explicitly described in surface data operation expressions but have a significant impact on execution results, such as data distribution sensitivity, query pattern inertia, caching effects under the influence of operation frequency, and skewed evolution of query logic. By jointly modeling the structural dimension, parameter dimension, and historical behavioral data of the operational tensor, the system constructs a latent variable space. Each evolution of the operational tensor is considered a sampling in the latent variable space. Through unsupervised learning or semi-supervised inference mechanisms, the current position and potential behavioral bias of the operational tensor in the latent variable space are derived, and this information is encoded into the side effect tensor, forming a behavioral-level prediction of execution risks. Furthermore, to capture the cumulative side effects of user queries across multiple rounds of natural language queries, a time-series correlation analysis mechanism is constructed based on the evolution trajectory of operation tensors. This mechanism treats the historical multi-round operation tensor sequence as a temporal evolution process, recording the change paths of the operation tensor and side effect tensor in each round, establishing a state transition matrix and a risk accumulation model, and modeling the chain effect between consecutive operations. Through time-series correlation, the system can identify potential system side effects caused by the gradual convergence or diffusion of continuously initiated user queries. Examples include data silos due to a gradually narrowing query scope, system cache degradation due to frequent multi-table joins, and performance backlog due to repeated calculation of metrics. The system provides trend warnings for these chain side effects. Specifically, when the cumulative side effect metric exceeds a dynamic threshold, the system issues a warning signal, indicating that the current query sequence has entered a high-risk zone, and triggering query strategy adjustments or prompting the user to optimize the query logic if necessary.

[0034] To address the resource consumption issues of database query tasks in real-world execution environments, a dynamic adjustment mechanism for operation tensors, which is coupled in real-time with side effect awareness and system resource status, is designed. This results in a resource-aware query generation system. Specifically, during the side effect awareness process, the system not only predicts the logical side effects of the operation tensor itself, such as the probability of returning an empty set, logical conflicts, and performance risks, but also couples the side effect tensor with the current resource status of the database in real time. The resource status includes, but is not limited to, system operation status indicators such as database CPU utilization, memory usage, I / O load, network bandwidth bottlenecks, storage space availability, and the number of concurrent sessions. The system collects these indicators in real time through a resource monitoring module, forming a resource status vector. This vector is used as a dynamic correction factor for the side effect tensor. Specifically, based on the real-time resource status, the complexity threshold of the operation tensor is dynamically adjusted. The complexity threshold refers to the upper limit of the allowed operational complexity when the system generates data, including the number of tables queried. The complexity thresholds for operations tensors, such as the number of join chain levels, subquery nesting depth, aggregation computation complexity, and window function sliding step size, can be appropriately relaxed if the current system resources are in good condition, allowing the generation of more complex operation tensors to meet users' complex query needs. However, if the database is under high load, the system lowers the complexity threshold, limiting the types or scale of operations in the operation tensor that cause high resource consumption, thereby avoiding system crashes or service delays due to excessive operation complexity. For example, when the system detects that the IO bandwidth is close to saturation, it adjusts the generation strategy, reduces full table scan operations, and prioritizes generating index-based query paths; when memory usage is high, it splits large-scale join queries into segmented executions to reduce memory pressure on intermediate results; if network latency is abnormal, the system will avoid cross-regional data calls and prioritize local table operations; in addition, the system will dynamically adjust the query result caching strategy and temporary table generation logic based on the available storage space to prevent task failures due to cache overflow.

[0035] To address the high-risk operations that occur during natural language query generation, an intelligent optimization mechanism is designed that combines operation tensor space constraint pullback with multi-path step-by-step semantic resolution to ensure that query operations not only satisfy user intent but also have security and efficiency at the execution level. After side effect awareness processing, if an operation tensor is determined to have a potentially high risk of side effects, such as empty set return, data explosion, logical deadlock, or system resource overload, the system does not simply remove the tensor operation. Instead, it performs constraint pullback on the operation tensor space. Constraint pullback means that the system applies boundary conditions to the generation space of the operation tensor, and gradually removes or reduces the weight of high-risk operations from the current tensor space by fine-tuning the value range, dimension combination, or parameter configuration of the operation operator, thereby achieving risk avoidance. Specific operations include relaxing and adjusting the screening conditions, such as changing equality screening to range screening, or simplifying the table join path of multi-table join operations to reduce the join level. Through this perturbation within the tensor space, the system brings the generated operation tensors back from the high-risk area to the controllable area, ensuring the executability and stability of subsequent operations. After completing constraint pullback, a step-by-step semantic resolution mechanism is further adopted, especially for inference-type operation tensors, which perform multi-path generation. Inference-type operation tensors refer to those containing non-direct... For complex semantic requirements of query operations, such as attribution analysis, trend prediction, and anomaly detection, due to their complex semantic structures and diverse expression paths, the system generates multiple parallel candidate operation chains based on different resolution strategies. Each candidate operation chain represents a task implementation path. The system generates various execution logics through tensor deduction, including different aggregation methods, different data grouping strategies, different time window decomposition schemes, or different external knowledge reasoning processes. For example, for the natural language task of "finding the product with the fastest sales decline and its reasons," the system can generate operation chains based on year-on-year calculation, operation chains based on time window sliding, or reasoning chains based on outlier detection in parallel. All candidate operation chains are included in the side effect tensor evaluation. The system uniformly maps the risk indicators and execution costs of each path to the side effect tensor. By comparing the side effect tensor values ​​of each candidate chain, the system dynamically selects the operation path with the least side effect as the final execution scheme, achieving dynamic path selection of the optimal solution and ensuring that the generated query operation meets business requirements.

[0036] To address the operational dependencies in complex natural language query tasks, a causal dependency modeling mechanism across operation tensors is designed. By establishing a causal dependency tensor, the intelligent generation of operation execution chains and the dynamic unfolding of nonlinear operation processes can be achieved. After natural language queries are parsed and mapped into multiple minimal semantic units and corresponding operation tensors, the system does not simply chain these operation tensors into a linear execution flow. Instead, it constructs cross-tensor causal dependency tensors based on the implicit causal relationships and conditional triggering logic between these operation tensors. Causal dependency tensors are used to explicitly encode the causal order and conditional execution relationships between operations. Essentially, they are multi-dimensional tensor matrices, where each element represents the degree of causal influence and triggering dependency between operation tensors. For example, the execution result of a filtering operation determines whether a subsequent aggregation operation is executed; the success or failure of a correlation operation affects the selection of subsequent analysis paths; or the output of a reasoning operation is used to dynamically modify the parameters of subsequent queries. The system generates causal dependency tensors through comprehensive analysis of the input-output characteristics, parameter dependencies, data flow, and semantic logic of the operation tensors. These tensors not only record the explicit order of operations but also express conditional triggering relationships. For example, Boolean tensors can be used to indicate whether one operation is a prerequisite for the execution of another, or weights can be used to... Tensors represent the strength of causal dependencies. The system parses the causal dependency tensor in real time during execution chain generation, enabling dynamic expansion of the operation chain. Specifically, this supports non-linear flow control. When certain conditions are met, the system expands additional operation paths. For example, if a user's question includes "If inventory is below a threshold, perform replenishment analysis; otherwise, only perform a sales query," the system dynamically generates an operation chain based on the causal dependency tensor branches, avoiding resource waste from full-path execution. When there are multi-stage inferences or progressively refined query requirements, the system recursively expands the causal dependency tensor to form a dynamic control flow, supporting mechanisms such as on-demand expansion, backtracking adjustment, and operation pruning. This breaks the problem of fixed linear order in traditional query generation, achieving more flexible and efficient execution chain construction. Furthermore, this causal dependency tensor can also be linked with side-effect tensors to monitor the execution risks of each branch path in real time and dynamically adjust the causal chain expansion strategy, ensuring that in complex query scenarios, both business semantics are satisfied while avoiding logical conflicts and resource waste during execution.

[0037] Combined with appendix Figure 3To address the data dependency errors and logical conflicts that easily arise in complex natural language query tasks during multi-table joins, time series analysis, and conditional judgment, a query generation mechanism combining side-effect awareness and reverse reachability analysis is designed to achieve security verification and risk prediction of operation tensors. After parsing the natural language query and generating preliminary operation tensors, the system does not directly generate operation chains. Instead, it performs reverse risk propagation modeling on candidate operation tensor paths. Based on structural dependencies and semantic constraints, the system constructs a reachability mapping function to detect whether there are logical loops that are unreachable, data dependency conflicts, query deadlocks, or potential empty result sets in the operation sequence. To this end, a reverse reachability mapping function for side-effect prediction is introduced, specifically defined as follows:

[0038]

[0039] in, The operation tensor represents the structured semantic representation of the data query operation to be executed. The operation tensor contains the type of query action, field relationships, filtering conditions, and data flow logic. For tensor The reverse dependency domain represents all that are... The set of upstream source operation paths is used to capture the potential impact of historical dependencies and intermediate operations; This is a feasibility weighting function for the reverse path nodes, measuring the feasibility of nodes. arrive Logical reachability, considering the correctness of dependencies, the executability of data associations, and the validity of paths; This is a path consistency scoring function used to characterize the path consistency score. arrive The score is zero if there is a mismatch in field types or a conflict in conditions. The score is based on the data type matching, field dimension compatibility, time window alignment, and consistency of query logic. The side effect tensor mutation function represents the path. The level of risk introduced includes the probability of returning an empty set, the risk of index failure, and the potential for deadlocks caused by multi-table joins. These parameters serve as dynamic risk control parameters to manage the sensitivity and tolerance of side effect assessments; ultimately, This represents the integral value of the adverse risk; the lower the value, the more likely it is that the operation tensor is in a certain position. The reverse path carries a higher risk of logical unreachability, leading to deadlocks, logical blind spots, or data silos during query execution. For example, in a natural language query like "find the products with the fastest sales growth but continuously decreasing inventory," the system maps this request to an operation tensor. This tensor involves time series aggregation, grouping calculation, negative growth trend detection, and multi-table joins. The system calculates using the above formula. In the reverse dependency domain In the process, some historical paths were discovered. In path consistency scoring function A score of zero indicates a mismatch in data dimensions or a conflict in time windows, and also suggests side effects. The system displays a high risk of deadlock, indicating potential logical loop problems and system resource contention conflicts in the current operation path. Based on this, the system proactively decomposes the aggregation order, reconstructs the operation tensor, adjusts the window function boundaries, simplifies the association path, and avoids unreachable logical blind spots during the query generation stage. This ensures that the final generated operation chain is executable and secure, avoiding runtime failures or long-term blocking problems caused by complex dependencies in traditional database queries. It also realizes intelligent side effect prediction and dynamic optimization of natural language query to data operation mapping.

[0040] To address the lack of transparency regarding operational risks during natural language query generation, a mechanism is designed that uses side-effect tensors for both internal system operation correction and user interaction prompts, achieving visualization of operation-level side effects and human-computer collaborative correction. After the natural language query is converted into an operation tensor and processed for side effects awareness, the system generates a side-effect tensor. This tensor is used not only for internal system operation correction, including local tensor splitting, boundary condition supplementation, and query path adjustment, but also for dynamically generating natural language prompts to clearly inform users of potential operational risks, thus achieving an interpretable query generation process. The dimensions of the side-effect tensor include, but are not limited to, empty set risk, logical conflict probability, resource consumption estimation, and execution path complexity. The system uses a multimodal mapping mechanism to convert the numerical expression of the side-effect tensor into natural language prompts, constructs risk prompt templates, and fills in side-effect indicators to generate interactive language. For example, when the side-effect tensor shows an empty set return probability higher than a threshold, the system generates the prompt "The current query conditions result in empty results; it is recommended to broaden the filtering range." When a logical conflict indicator is triggered, the system prompts "There is an overlap in time intervals or a logical contradiction in the conditions; is it necessary to..." "Adjust the time window?" For resource-intensive operations, the system prompts, "The current operation involves large-scale data computation, which is expected to affect system performance. It is recommended to optimize the query logic or execute in steps." This natural language side effect prompt explicitly displays the risk information of the side effect tensor to the user, breaking the black box mode of the traditional query generation process. It allows users to obtain understandable feedback during the operation generation stage. Users can actively adjust their query intent based on the prompts, modify the input natural language, or select recommended optimization strategies through the system interface to participate in the collaborative correction of the query logic. This realizes a human-machine co-decision-making query generation mechanism. Furthermore, the system supports real-time refreshing of dynamic prompts. If the user adjusts the query description, the system regenerates the operation tensor and calculates the new side effect tensor, and the prompt is updated synchronously, forming an interactive optimization closed loop, which improves the usability, transparency, and user experience of the natural language database query system.

[0041] To address the limitation of existing technologies that only support tabular or single data types for natural language to structured queries, a multimodal extension mechanism for operation tensors is designed to achieve a unified expression of query operations for text, numerical, time series, and unstructured data. When generating operation tensors, the system not only constructs tensor representations for field operations in relational databases, but also supports embedding data operations from different modalities into the same tensor space, forming cross-modal operation tensors. Multimodal operation tensors include the joint encoding of structured and unstructured data operation units. Specifically, text query operations support keyword retrieval, sentiment analysis, and summary extraction for fields such as product reviews, user feedback, and log text. Numerical operations cover conventional filtering, sorting, aggregation calculations, and indicator inference. Time series operations support tensor-based expressions for behaviors such as time window sliding, periodic comparison, and abnormal fluctuation detection. Unstructured data operations include classification, annotation, and correlation extraction of images, documents, and log files. After all these operations are encoded into the same tensor space, they form directly combinable data query and analysis operation expressions. The system achieves modal differentiation and operation compatibility through tensor dimension expansion, using modal indicators and data type markers, ensuring that all modal operations are combinable and inferable within a unified space. After generating the operation tensor, the system performs unified side effect awareness processing on the multimodal operation tensor to identify risks caused by cross-modal operation combinations, such as sample alignment issues when joining structured and unstructured data, ambiguity risks in text matching, synchronization issues between time series and classification labels, and format anomalies in image data processing. The side effect tensor is used to quantitatively evaluate the operational complexity, data consistency, and processing resource consumption of each modality, ensuring the executability of the operation chain and system load balancing. Furthermore, the system supports step-by-step execution of the multimodal operation tensor, adopting a step-by-step semantic resolution mechanism to decompose complex cross-modal tasks into the smallest operation units. For example, sentiment analysis can be performed on text data first, followed by joint statistics with sales data, or image data can be classified first, followed by association with product tables to generate reports. During the execution of the step-by-step execution chain, the operation order, concurrency strategy, and data flow logic can be dynamically adjusted based on the real-time feedback of the side effect tensor, ensuring that multimodal query tasks still have controllability and flexibility in high-complexity scenarios.

[0042] To address the compliance, auditability, and operational transparency requirements of enterprise-level data query and analysis tasks, a mechanism was designed to dynamically map operation tensors, side effect tensors, and step-by-step semantic resolution results to the enterprise knowledge asset management system, thereby achieving full-process traceability and transparent recording of natural language query tasks. During the process of parsing natural language queries into operation tensors, the system structurally expresses the user's input natural language request, forming an operation tensor. This tensor records the structured semantics of the query intent, including operation type, data source, logical conditions, time window, aggregation indicators, and data roles. Simultaneously, the side effect tensor generated during side effect awareness processing is also included in the record. This side effect tensor contains the potential execution risks of the operation, resource consumption estimates, logical conflict detection, data dependency links, and quantitative outputs of side effect indicators. Furthermore, during the step-by-step semantic resolution process, the system decomposes complex query tasks into multiple smallest semantic units, and the resulting operation execution chain is also included as part of the execution process record in the full-process tracking. The system dynamically maps the aforementioned operation tensors, side effect tensors, and semantic resolution paths to the enterprise knowledge asset management system in a standardized metadata format. Through interface integration with the enterprise data governance platform, it achieves metadata registration and version management of natural language query tasks, forming a one-to-one mapping of operation and semantic links, ensuring that all natural language data queries and resolutions are effectively handled. The system ensures traceability and auditability of analytical activities, including versioned archiving of query logic, synchronized on-chain recording of risk alerts and corrections, and full-process marking of the execution order and parameters of the operation chain. It supports retrospective queries of historical query tasks, enabling reverse retrieval of specific data tables, indicator fields, or query logic to quickly locate the context of data usage. This achieves full-chain traceability of data sources, operational intentions, execution side effects, and analysis paths, meeting enterprise management requirements for data accountability, audit compliance, and internal risk control. Furthermore, the system supports associating query behavior with specific users or business roles, recording the operator, operation time, execution environment, and modification history to form a complete operation log. This ensures that the role and impact of each natural language query task in the business process can be restored, reproduced, and verified, improving the transparency and security of enterprise-level data operations. It avoids the ambiguity, uncertain semantics, and unreproducibility issues that can easily arise from natural language interaction, achieving deep integration of natural language querying and enterprise knowledge asset management, and providing highly reliable underlying support for enterprise data governance.

[0043] Example 1:

[0044] Combined with appendix Figure 4In this embodiment, a large retail enterprise deployed a natural language-based data query and analysis system for its daily operations analysis. Operations analysts in the business department interact with the enterprise's data platform using natural language to query and analyze multi-dimensional data such as sales, inventory, and promotions. In one business scenario, before the monthly summary meeting, an analyst initiated a series of complex natural language queries. The initial query was "Please list the sales revenue and year-on-year growth rate of all stores nationwide in the past 30 days." After parsing the query, the system generated an operation tensor. The operation type is time window filtering, group aggregation, and year-on-year calculation. The data roles are store, sales amount, and date. Because this query involves window calculations on data from the previous month and the same period last year, the system generates... The side effect tensor generation process is initiated, employing an operational behavior latent variable modeling mechanism. Based on historical query behavior and the current operational structure, it is inferred that the data reading pattern of this operation is a full table scan. In the latent variable encoding, the selectivity field is assigned a value. It is found that the "stores" field has a high cardinality (3000 stores nationwide), and the sales table has 50 million rows. Historical behavior patterns indicate that each full table scan at the national store level easily leads to accumulated memory pressure. Latent variables... The pattern label assigned the value "high-concurrency scan + high-cardinality grouping", the side effect tensor The inherent risks of this behavior pattern are recorded, with an empty set risk of 0 and logical conflicts of 0. However, the system memory pressure index is assigned a value of 0.82 (between 0 and 1, with 1 representing full load). The system prompts the user that "the current query consumes high memory resources; it is recommended to execute in regions or cache in stages." The user chooses to continue, and then initiates a second round of query: "Please filter the list of stores whose sales have declined year-on-year for three consecutive days." The system generates an operation tensor. Because it involves a time-series sliding window, with a sliding granularity of one day and a window length of three days, the system records the tensor evolution trajectory and establishes... arrive Operation chain, time series correlation analysis revealed rely The query results are from chained operations, and the side effects are tensors. During generation, not only are latent variables calculated based on the current operational structure, but cumulative side effects are also predicted based on the tensor evolution trajectory. Specifically, the three-day sliding window leads to increased data redundancy, resulting in repeated scanning of intermediate results. Combined with resource status, the system detects a decrease in cache hit rate and an increase in IO frequency, and cumulatively assigns the chain-like side effect indicators to... The cache pressure index rose to 0.9, and the memory pressure index rose to 0.88. The system issued a trend warning: "The current query chain has continuously accumulating memory and IO pressure. It is recommended to switch to offline batch processing or increase the time window span to reduce the operation granularity." The user ignored the suggestion and continued with the third round of queries: "For stores with continuous year-on-year sales declines, analyze the reasons for the slow sales of their main product categories." This operation tensor... This involves complex multi-table relationships, linking the product category table with the sales transaction table, and system identification. The operational latent variable is "large-scale cross-table join + conditional dependency on upstream window output", and the side effect tensor is... The calculation is based on evolutionary trajectory records. By examining the entire chain, cross-table join conditional dependencies were discovered. If the upstream output is an empty set, then the output of the function will be affected. The path consistency scoring function will fail to execute. Partial path score is 0, side effect function The system displayed a deadlock probability of 0.2 and an empty set return probability of 0.65. A high-priority warning was issued: "There is an execution blind spot; most branch paths are expected to fail due to data flow dependencies." Based on the side effect tensor output, the system suggested the user refactor the query, breaking down the slow-moving sales analysis into preprocessing and phased execution. Following the prompts, the user adjusted the operation chain to first perform the major category sales decline analysis, then filter sub-categories based on classification. This step-by-step execution avoided the risk of a complete chain failure. Actual calculations showed that the estimated execution time before adjustment was 3 hours, with an estimated memory usage of 95%, exceeding the system's capacity. However, after system side effect tensor inference and chained side effect trend warnings, the final execution time was reduced to 40 minutes, and memory usage decreased to 70%, successfully completing the analysis task.

[0045] After the operations analyst completed the aforementioned analysis of slow-moving goods, the business department raised a new request: "Based on stores with year-on-year sales declines over the past 30 days, combined with inventory levels, product reviews, and logistics anomalies, predict the risk of slow-moving goods in the coming week and provide optimization suggestions for product categories." Upon receiving this natural language request, the system activates the side-effect awareness and resource status coupling mechanism. First, it analyzes the real-time load status of the current database system. The system monitoring module detects that the database CPU utilization is 85%, memory usage is 78%, disk I / O is nearing a bottleneck, network latency is stable at 150ms, and cache hit rate is only 60%. Based on this resource status, the system dynamically adjusts the complexity threshold of the generated operation tensors. The initially generated operation tensors... The system encompasses multi-table joins, text sentiment analysis, inventory time-series forecasting, and anomaly detection. The system assessed that its complexity exceeded the current resource tolerance and immediately implemented constraints to pull back the operational tensor. Specific operations included replacing full text sentiment analysis with keyword summary matching, adjusting the multi-table join strategy from full outer join to segmented inner join, and reducing the time-series window for inventory anomalies from 7 days to 5 days, decreasing the number of sliding steps and intermediate data caching. This boundary fine-tuning of the operational tensor space significantly reduced the task's resource consumption. Calculations and estimates show that the reduced complexity of the operational tensor... Memory consumption is expected to decrease from 80% to 55%, CPU load to decrease by 15%, and disk I / O pressure to decrease by 20%. The system then enters a step-by-step semantic resolution process. Since this query is an inference-based task involving inventory change prediction, comment text analysis, and cross-referencing of logistics data, the system employs a multi-path generation strategy, forming three candidate operation chain paths: path A is inventory-driven analysis, path B is comment-driven analysis, and path C is logistics anomaly-driven analysis. Side effect tensors are calculated for each operation chain. , , The system assesses execution risks and resource consumption separately. The results show that path A has a side effect tensor memory risk of 0.4, path B has a logical conflict risk of 0.6 (due to missing mappings between comment category tags and product categories), and path C has an IO risk of 0.7 (due to long-tail scanning caused by uneven distribution of logistics table data). Based on the side effect tensor optimization strategy, the system dynamically selects path A as the primary execution chain, with paths B and C as alternatives. Furthermore, during the generation of operation execution chains, the system establishes a causal dependency tensor across operation tensors, explicitly encoding the causal order and conditional triggering relationships between inventory analysis, comment sentiment analysis, and logistics anomaly detection. The causal dependency tensor represents the primary causal chain of inventory anomaly being the main cause of product slow sales, with comments and logistics as auxiliary triggering conditions. Specifically, the encoding is: inventory decrease → slow sales prediction as the main chain. Negative sentiment in comments → slow-moving inventory prediction is an additional path; logistics delays → high inventory backlog is a parallel triggering path. The system dynamically unfolds a non-linear operation chain based on the actual operating status. If inventory is significantly abnormal, it directly enters the slow-moving inventory prediction path. If comments or logistics anomalies reach a threshold, additional analysis is triggered. During actual data operation, the system found that the inventory turnover rate of some stores dropped continuously to 80%, while the logistics delay rate exceeded 20%, but the comment sentiment analysis score was neutral. The system followed the causal dependency tensor logic and only unfolded the inventory + logistics path, skipping the sentiment analysis path, saving 30% of computing resources. The final output included a list of slow-moving product categories and logistics scheduling suggestions. The execution time was reduced from the original estimated 2 hours to 40 minutes, memory usage was stable at 60%, network I / O was stable, and no deadlocks or resource blockages occurred.

[0046] Example 2:

[0047] Combined with appendix Figure 5 When preparing an end-of-quarter inventory analysis report, a regional operations manager of a retail company submitted a natural language query to the system: "Find the products with the fastest sales growth but continuously decreasing inventory." The system generated an operation tensor based on the request. This tensor includes multi-dimensional time series aggregation (calculating year-on-year sales growth rate), window functions (sliding detection of consecutive days of inventory decline), and logical combination filtering (simultaneously satisfying growth and decline). Because this request involves multi-table joins (sales table, inventory table), historical comparisons across time periods, and semantic conflict detection, the system initiates side-effect awareness processing and reverse reachability analysis mechanisms during the query generation phase, and operates on the tensor. The feasibility and data dependency closed loop are used to predict risks and prevent operation failures or empty query sets due to logical blind spots or broken data paths.

[0048] To evaluate the operational tensor Reverse reachability security, the system's upstream path set All potential dependency paths Calculate the reverse risk propagation integral using the reverse reachability mapping function:

[0049]

[0050] In this example, the system identified three critical upstream paths. , , :

[0051] 1. Time-based aggregation path based on sales table (total sales in the last 30 days, year-on-year calculation);

[0052] 2. : Continuous daily inventory sliding window path based on inventory table;

[0053] 3. Cross-table association path between the sales table and the inventory table at the SKU dimension.

[0054] Next, the corresponding function value is calculated for each path:

[0055] Feasibility weight function : Indicates a path Whether the system is connected within the current architecture is calculated based on factors such as primary and foreign key constraints and time indices; the value range is... , where 1 indicates that it is fully reachable.

[0056] In this example: , , .

[0057] Path consistency scoring function : Indicates a path With target operation The degree of matching in field type, time alignment, and data dimension; the value range is... , where 0 indicates a dimension mismatch or type conflict.

[0058] In this example: , , (The inventory table is missing some SKU fields, which is inconsistent with the sales data, resulting in a structural mismatch.)

[0059] Side effect variation function : Indicates a path The execution may introduce logical conflicts, performance bottlenecks, or risks associated with empty sets. The value range is... Where 1 indicates high risk. The core of this function is determined by system control parameters. control, It is used to amplify or reduce the sensitivity to high-risk paths.

[0060] Set the current system ,but:

[0061]

[0062] Based on the above parameters, the system calculates the product terms for each path:

[0063] : ;

[0064] : ;

[0065] : ;

[0066] The final risk score is as follows:

[0067]

[0068] According to the settings, when When the system considers a tensor path as "high-risk" and it needs to be corrected; when Between When the value is less than 0.75, it is marked as "executable but optimization is recommended"; when it is greater than 0.75, the path is considered stable and reachable.

[0069] The result 0.6345 in this example falls within the middle range, and the system indicates that there is a structural mismatch path (i.e., (Causing SKU association failure), and side effect function This implies that if this path is executed, it will cause a deadlock or return no result. Therefore, the system immediately triggers the operation tensor reconstruction mechanism to reconstruct the original tensor. Split into two sub-tensors: Responsible for sales growth analysis, The system is responsible for mitigating inventory decline by using an intermediate table to avoid direct joins. Simultaneously, the aggregation order of the original window function has been rearranged from "sales + inventory" to "sales aggregation first, then inventory trend correlation," ultimately increasing the accessibility score. It has entered the safety threshold.

[0070] The reconstructed query chain execution time was reduced from the original estimated 180 seconds to 95 seconds, the intermediate cache for data writing to disk was reduced by 40%, and no connection timeouts or empty set errors were triggered. The side effect identification and correction mechanism based on reachability integral modeling can be used to predict query blind spots in advance, optimize operation paths, and avoid query failures caused by dependency errors. It is particularly suitable for enterprise-level application scenarios such as multi-source data fusion, time series analysis, and natural language query generation.

[0071] The regional operations manager of the retail enterprise continued to submit a more complex natural language query request: "Please combine sales growth, inventory decline, user review text, and logistics anomalies to comprehensively analyze the slow-moving risk of each SKU and generate audit records that can be used for management review." Upon receiving this multimodal natural language query, the system further applied side-effect tensor collaborative correction, cross-modal operation tensor expansion, and enterprise-level knowledge asset mapping mechanisms. First, the system generated a cross-modal operation tensor based on the user request. The system includes structured sales data, inventory time series, unstructured product review text, and logistics delay records. The modal decomposition of the tensor is as follows: Sales growth is calculated using year-on-year growth rates, with the input being a sales log table involving 50 million rows of data. Inventory time series data uses a sliding window to detect continuous inventory declines, with the input being an inventory table at a daily granularity, containing approximately 10 million rows of data. User reviews utilize a product review table with 8 million reviews, requiring sentiment classification and keyword extraction, and employing a lightweight BERT model for inference. Logistics anomaly analysis involves delayed delivery logs, totaling 20 million rows, requiring anomaly identification. Because this operation tensor encompasses multimodal operations such as text, numerical values, time series, and anomaly detection, the system implements a unified multimodal side effect awareness mechanism to calculate the side effect tensor. The system found that resource usage in sales and inventory was within expectations, but text sentiment analysis posed a risk of model inference latency. The estimated latency for a single inference was 0.15 seconds, meaning it would take 180,000 seconds to process 1.2 million product reviews, exceeding the business time window. Logistics anomalies involved sparse matrix operations, and data skew resulted in scarce samples for some SKUs. The sparsity index of the side effect tensor reached 0.92 (range 0-1, 1 indicating complete sparsity). Consequently, the system generated a natural language risk warning: "The current query involves large-scale text analysis, the estimated processing time exceeds resource limits, and some SKUs lack sufficient review samples. It is recommended to simplify sentiment analysis or use sample caching." After considering this warning, the operations manager adjusted the review analysis from full inference to high-frequency word matching, reduced the BERT inference call ratio to 10%, and implemented a rollback logic for supplementing sparse logistics samples, filling missing parts with the most recent valid logistics status. The operation tensor... After local corrections, the side-effect tensor was recalculated, reducing overall resource consumption by 45% and text analysis latency to within 18,000 seconds. Subsequently, the system adopted a step-by-step semantic resolution mechanism to decompose the operation tensor into sub-tasks. The first step performed joint analysis of sales and inventory data, the second step performed parallel text sentiment matching, and the third step performed logistics anomaly completion and summarization. The system dynamically adjusted the execution order based on the resource awareness of the side-effect tensor, prioritizing low-risk branches to ensure overall task stability. After the operation is completed, the system dynamically maps the operation tensor, side effect tensor, step-by-step resolution path, and the final generated query chain to the enterprise knowledge asset management system. The recorded content includes the original natural language request text, the operation tensor structure (modal composition, operation type, data source), side effect tensor indicators (resource consumption, logical conflict, sparsity, latency estimation), user interaction correction records (the user selected "sentiment analysis simplification + logistics rollback strategy"), the step-by-step execution path (a breakdown of the four operations: sales analysis, inventory analysis, sentiment analysis, and logistics analysis), and a summary of the operation execution results. The system forms a complete operation audit chain for this task within the knowledge asset repository, supporting subsequent accountability and post-mortem audits. The governance team can query all data usage trajectories for this analysis in the background. The system marks the data with the tag "risk controllable + user collaborative correction", ensuring that the enterprise can maintain the flexibility and real-time performance of task execution in complex natural language multimodal analysis, while also achieving accountability and auditability through transparent recording. Actual operation data shows that the final execution time of the task was 62 minutes, the peak system memory usage was 65%, and the text processing was reduced from the original plan of 1.8 million seconds for full inference to within 18,000 seconds. The rollback logic for sparse logistics data processing effectively covered 92% of the SKUs. The query chain formed a multi-dimensional traceability view in the enterprise knowledge management platform, meeting the enterprise's full-process requirements for data security, operational transparency, and automated composite analysis.

[0072] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A data query and analysis method based on natural language, characterized in that, Includes the following steps: The user's input natural language query request is parsed into a dynamic semantic intent tensor. The semantic intent tensor is a multi-dimensional operation tensor, which includes operation type, comparison relationship, time constraint and data role semantic dimension. It is dynamically combined according to the task semantics to form a complete data query and analysis operation expression. Based on the operation tensor, natural language intent is mapped to the controllable data operation space of the database, generating a preliminary data operation chain; During the operation generation process, the operation tensor undergoes side effect awareness processing to predict the potential execution consequences of the operation and generate a side effect tensor. This side effect tensor is used to simulate the side effects of database operations, including the probability of returning an empty set, performance risks, and logical conflicts. If any indicator in the side effect tensor exceeds a preset threshold, the operation tensor is locally corrected. This correction includes splitting the operation tensor, supplementing boundary conditions, or replacing subqueries. The local correction process of the operation tensor includes constraining and pulling back the operation tensor space. By fine-tuning the tensor space boundaries, high-risk operations are avoided at the tensor level. Based on side-effect awareness correction of operation tensors, a step-by-step semantic resolution mechanism is adopted to decompose complex natural language query tasks into multiple smallest semantic units. Each unit is mapped to a specific tensor operation, and the dependencies between operation units are dynamically inferred to generate operation execution chains. The operation execution chains clearly distinguish the logical dependencies between concurrent execution and sequential execution, so that the generated data query and analysis operation sequences have executability, verifiability and the ability to express complex tasks. In the side effect perception process, the side effect tensor is coupled with the system resource status in real time, the complexity threshold of the generated operation tensor is dynamically adjusted, and the operation generation strategy is adjusted according to the current database load, storage status or network bottleneck to form a resource-aware query generation system. The side effect perception processing, combined with the reverse reachability analysis of the operation tensor, detects unsolvable operation patterns caused by data dependency errors, and discovers potential query deadlocks or data blind spots in advance by reasoning the reverse operation path. The operation tensor is extended to be multimodal, which supports embedding query operations of text, numerical, time series and unstructured data into the same operation tensor space, enabling unified side effect awareness and step-by-step execution of cross-modal data query tasks.

2. The data query and analysis method based on natural language according to claim 1, characterized in that... The generation process of the side effect tensor includes establishing a latent variable modeling mechanism for operational behavior, encoding the execution behavior pattern that cannot be directly observed as a latent variable, and reasoning through the implicit behavioral characteristics of the operational tensor; the generation of the side effect tensor is based on the evolution trajectory of the operational tensor, constructing a time series correlation analysis mechanism, predicting the cumulative side effects of the state in consecutive rounds of natural language queries, and supporting trend warning of chain side effects generated in the query history.

3. The data query and analysis method based on natural language according to claim 1, characterized in that... The step-by-step semantic resolution supports multi-path generation of inference-type operation tensors, forms a parallel set of operation chain candidates based on different resolution strategies, and dynamically selects operation paths by using side-effect tensors as optimization indicators.

4. The data query and analysis method based on natural language according to claim 3, characterized in that... During the generation of the operation execution chain, a causal dependency tensor across operation tensors is established to explicitly encode the causal order and conditional triggering relationship between operations, supporting the dynamic expansion of nonlinear operation chains.

5. The data query and analysis method based on natural language according to claim 1, characterized in that... The side effect tensor is used for operation correction and for dynamically generating system prompts to provide feedback on potential risks of the operation in natural language, allowing users to participate in collaborative correction during the generation phase.

6. The data query and analysis method based on natural language according to claim 1, characterized in that... The operation tensor, side effect tensor, and step-by-step semantic resolution results are dynamically mapped to the enterprise knowledge asset management system, enabling transparent recording and traceability of natural language queries and data usage in the knowledge base, and supporting enterprise-level data accountability and operational auditability mechanisms.

Citation Information

Patent Citations

  • Intelligent SQL query generation method and system based on large language model

    CN118861081A

  • Prompt word optimization method in combination with expert evaluation rule and large language model

    CN118886427A

  • Construction management method based on digitization

    CN118964440A