Intelligent query method for relational database based on machine learning

By collecting and dynamically aligning multimodal stream data in real time, a dynamic psychological state map is constructed, which solves the temporal semantic changes and contextual dependencies of multimodal psychological dialogue data, realizes continuous understanding and personalized analysis of users' psychological states, and improves query accuracy.

CN121560908APending Publication Date: 2026-02-24LUSHAN COLLEGE OF GUANGXI UNIV OF SCI & TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511508258.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-21
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

Existing database query technologies based on static knowledge graphs and rule-based reasoning struggle to handle the temporal semantic changes in multimodal psychological dialogue data and the contextual dependencies of users' natural language queries, resulting in intelligent query results deviating from users' true psychological states and consultation needs.

Method used

By collecting multimodal stream data in real time, aligning different modal signals using a dynamic time warping algorithm, constructing a dynamic psychological state map, modeling the evolution of psychological states using a time-series graph neural network and neural ordinary differential equation mechanism, and generating personalized analysis reports by combining a causal discovery algorithm and a neural symbolic reasoning engine.

Benefits of technology

It effectively solves the problems of timing deviation and context association of multimodal signals, improves the accuracy and personalization of queries in psychological dialogue scenarios, and realizes continuous understanding and personalized analysis of users' psychological states.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121560908A_ABST
    Figure CN121560908A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a relational database intelligent query method based on machine learning, which comprises the following steps of: processing multi-modal flow data through time sequence alignment, generating a unified semantic representation vector, constructing a dynamic psychological state map, and modeling a psychological state evolution track by utilizing a neural common differential equation mechanism. After user query is received, historical dialogue nodes are retrieved from the graph, enhanced query intention representation is generated, the enhanced query intention representation is converted into an execution plan through a neural symbol inference engine, and a graph neural network is adopted to predict execution cost. And finally, a personalized analysis report is generated by combining a causal discovery algorithm, and system adaptive optimization is realized through feedback signals. According to the method, the problems of inconsistent time sequence semantics and strong context dependency of the multi-modal psychological data are effectively solved, and the query accuracy and the personalized level in a psychological dialogue scene are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to an intelligent query method for relational databases based on machine learning. Background Technology

[0002] Database query technology based on static knowledge graphs and rule-based reasoning relies on a pre-built knowledge graph where entities and relationships are stored in a structured form. By introducing logical rules, the system can execute a reasoning process, deriving implicit conclusions from explicit knowledge, thus supporting complex queries. For example, rules can define transitive relationships or constraints between entities. The reasoning engine matches the knowledge graph data based on these rules, progressively generating new facts and ultimately returning the query results, thereby enhancing the database's semantic understanding capabilities. Existing database query technologies based on static knowledge graphs and rule-based reasoning suffer from the following technical challenges when processing multimodal psychological dialogue data: Firstly, the semantics of a user's text, voice, and micro-expressions undergo semantic shift over time during the dialogue. For instance, a user mentioning stress in a depressed tone in the early stages of the conversation might primarily relate it to academic burden, but after several rounds of communication, mentioning stress again could shift to emotional distress. Static knowledge graphs struggle to capture this temporal semantic evolution. Secondly, users' natural language queries heavily rely on dialogue history. For example, a simple question about recent low mood requires contextual understanding of previously discussed family conflicts to be accurately grasped. However, existing query engines lack the ability to dynamically model contextual relationships, resulting in the system returning generalized depressive symptoms rather than personalized analysis results tailored to the current consultation progress. This severely impacts the accuracy of AI-powered psychological dialogue systems in judging a user's true state. Summary of the Invention

[0003] To address the shortcomings of existing technologies, this invention provides an intelligent query method for relational databases based on machine learning. This invention solves the technical problem that existing query engines based on static knowledge graphs and rule reasoning are unable to achieve accurate and coherent cross-modal sentiment semantic understanding and intent recognition due to the semantic inconsistency of multimodal psychological data under dynamic changes over time and the strong contextual dependence of users' natural language queries. This results in intelligent query results deviating from the user's true psychological state and consultation needs.

[0004] To solve the above-mentioned technical problems, the specific contents of the present invention are as follows: The intelligent query method for relational databases based on machine learning provided by this invention includes: Step 1: Collect multimodal stream data of user conversations in real time through the interactive interface of the artificial intelligence psychological dialogue platform. The multimodal stream data includes dialogue text stream, audio stream and video stream. A distributed message queue is used to buffer and asynchronously process the multimodal stream data. A time sequence identifier is added to each stream data packet. A dynamic time warping algorithm is used to align the acquisition time points of different modal signals to obtain time-aligned multimodal stream data. Step 2: The time-aligned multimodal stream data obtained in Step 1 is segmented by timestamp, the text content of the same timestamp is extracted, the audio stream is converted into text content through speech recognition, the key frame image sequence is extracted from the video stream, and the text content, the speech-converted text content and the key frame image sequence are input into the multimodal large language model to generate a unified semantic representation vector containing cross-modal semantic associations. The unified semantic representation vector is stored as a high-level semantic feature. Step 3: Arrange the unified semantic representation vectors generated in Step 2 in chronological order to form a vector sequence. Use the vector sequence as node features to construct an initial graph structure with dialogue rounds as nodes. Use a temporal graph neural network to learn the dynamic embedding of each node and label the emotional state in the graph node embedding. Introduce a neural ordinary differential equation mechanism to model the evolution trajectory of psychological state in continuous time. When a new dialogue round is added, dynamically adjust the full graph node embedding to obtain a dynamic psychological state map. Step 4: Receive the user's natural language query, retrieve historical dialogue nodes related to the current query semantics from the dynamic mental state graph obtained in Step 3, extract the dialogue history summary corresponding to the historical dialogue node and the sentiment state label marked in Step 3, organize the current query, dialogue history summary and sentiment state label into structured prompt words through prompt template, and input them into the multimodal big language model to generate an enhanced query intent representation; Step 5: The enhanced query intent representation generated in Step 4 is converted into an intermediate logical expression through a rule template. The intermediate logical expression and database schema information are then input into the neural symbolic reasoning engine to generate candidate query execution plans. Execution cost estimation parameters are defined for each candidate execution plan. A graph neural network model is used to predict the execution cost of the candidate query execution plans. The execution plan with the lowest cost is selected and executed by the database engine. Step 6: Using a causal discovery algorithm, identify the causal relationships between key psychological state variables from the original results returned by the query in Step 5. Based on the identified causal relationships, perform counterfactual reasoning to generate explanatory content. Attach the explanatory content to the original results to generate a personalized analysis report. Simultaneously, use changes in the user's emotional tendencies in subsequent conversations as feedback signals to adjust the evolution parameters of the neural ordinary differential equation mechanism in Step 3 of the dynamic psychological state map and the execution cost estimation parameters defined in Step 5 of the query execution plan.

[0005] Furthermore, in the machine learning-based intelligent query method for relational databases described in this invention, step 1, the real-time acquisition of multimodal stream data of user sessions includes: transmitting the dialogue text stream, audio stream, and video stream via the WebRTC streaming media protocol; the use of a distributed message queue for buffering and asynchronous processing of the multimodal stream data includes: setting different topic partitions to process each modal data stream separately; adding a time sequence identifier to each stream data packet includes: using a high-precision timestamp synchronized by a network time protocol; and aligning different modal signals using a dynamic time warping algorithm includes: calculating the minimum path cost between the speech feature sequence and the video frame sequence to complete the sampling point-level alignment.

[0006] Furthermore, in the intelligent query method for relational databases based on machine learning described in this invention, step 2 involves the multimodal large language model being a pre-trained model based on the Transformer architecture, and fine-tuned using dialogue data from the field of mental health; generating a unified semantic representation vector includes extracting the vector corresponding to the classification label of the last hidden layer of the model; storing the unified semantic representation vector includes storing the vector in the semantic feature table of the relational database and establishing an index association with the original data.

[0007] Furthermore, in the machine learning-based intelligent query method for relational databases described in this invention, step 3, the construction of the initial graph structure includes: using the temporal relationship between dialogue rounds as edge connections to nodes; the temporal graph neural network adopts gated recurrent unit evolution graph convolution parameters; the neural ordinary differential equation mechanism solves the node state evolution through an adaptive step-size numerical solution method; the dynamic adjustment of the full graph node embedding includes: backpropagating historical node representations through the adjoint method.

[0008] Furthermore, in the intelligent query method for relational databases based on machine learning described in this invention, step 4, retrieving relevant historical dialogue nodes from the dynamic mental state graph includes: calculating the similarity between query semantics and node features, and selecting top-K nodes; generating structured prompt words includes: using thought chain prompting technology to organize query intent, historical context, and sentiment trends; generating enhanced query intent representation includes: outputting a time-aware vector representation through the model's cross-attention mechanism.

[0009] Furthermore, in the machine learning-based intelligent query method for relational databases described in this invention, step 5, the conversion to an intermediate logical expression includes: mapping the intent representation to a first-order logical form using a rule template; the generation of candidate query execution plans includes: a neural symbolic reasoning engine performing joint reasoning between the logical expression and the database schema; the graph neural network model abstracting the execution plan into a computation graph and predicting the cost through a message passing network; and the selection of the optimal plan includes: instantiating and generating a native SQL statement.

[0010] Furthermore, in the intelligent query method for relational databases based on machine learning described in this invention, step 6, the application of the causal discovery algorithm includes: using the NOTEARS algorithm to identify the causal graph structure between psychological state variables; the counterfactual reasoning includes: using dual machine learning techniques to estimate the intervention effect; the adjustment of the evolution parameters of the dynamic psychological state graph includes: using changes in user emotional tendencies as reward signals, and updating the node update strategy through the policy gradient method; the adjustment of the cost estimation parameters includes: optimizing the model weights through online learning.

[0011] Furthermore, in the machine learning-based intelligent query method for relational databases described in this invention, the distributed message queue is Apache Kafka; the timestamp accuracy of the network time protocol synchronization reaches the millisecond level; and the dynamic time warping algorithm, when aligning audio and video signals, also includes timestamp matching of the text stream to achieve strict temporal consistency of multimodal data.

[0012] Furthermore, in the machine learning-based intelligent query method for relational databases described in this invention, the instruction fine-tuning includes supervised fine-tuning using psychological dialogue corpora; before extracting the classification label vector, the input multimodal prompt words are normalized; and when storing the vector, consistency verification of foreign key associations is also included.

[0013] Furthermore, in the machine learning-based intelligent query method for relational databases described in this invention, the temporal graph neural network is based on the EvolveGCN architecture; the numerical solution is based on the Runge-Kutta method; and when dynamically adjusting node embedding, the emotional drift index in user dialogue is also considered, making the graph evolution more consistent with changes in psychological state.

[0014] Beneficial effects of this invention; This invention effectively solves the temporal deviation problem in the multimodal signal acquisition process by using temporal alignment processing and dynamic time warping algorithms for multimodal streaming data, providing a data foundation with strict temporal consistency for subsequent processing. The unified semantic representation vector generated by the multimodal large language model overcomes the semantic fragmentation caused by existing modal processing, establishing deep semantic associations across modalities. The dynamic mental state graph constructed using temporal graph neural networks and neural ordinary differential equations can continuously depict the evolutionary trajectory of mental states, effectively capturing semantic drift phenomena. By retrieving historical dialogue nodes from the dynamic mental state graph and combining it with thought chain prompting technology, a deep understanding of the user's query intent is achieved. The combination of a neural symbolic reasoning engine and graph neural network cost prediction improves the fit between query planning and actual data distribution. Finally, explanatory content is generated through causal discovery algorithms and counterfactual reasoning mechanisms, and system adaptive optimization is achieved through online learning, significantly improving the accuracy and personalization of query results in psychological dialogue scenarios. Attached Figure Description

[0015] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on the drawings without creative effort.

[0016] Figure 1 A flowchart of a machine learning-based intelligent query method for relational databases provided in an embodiment of the present invention. Detailed Implementation

[0017] To make the technical solution of the present invention clearer, the present invention will be clearly and completely described below with reference to specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. The present invention provided by various embodiments will be described in detail below with reference to the accompanying drawings. To better understand the purpose of the present invention, the present invention will be described in further detail below.

[0018] Please see Figure 1 The intelligent query method for relational databases based on machine learning provided by this invention includes: Step 1: Collect multimodal stream data of user conversations in real time through the interactive interface of the artificial intelligence psychological dialogue platform. The multimodal stream data includes dialogue text stream, audio stream and video stream. A distributed message queue is used to buffer and asynchronously process the multimodal stream data. A time sequence identifier is added to each stream data packet. A dynamic time warping algorithm is used to align the acquisition time points of different modal signals to obtain time-aligned multimodal stream data. Step 2: The time-aligned multimodal stream data obtained in Step 1 is segmented by timestamp, the text content of the same timestamp is extracted, the audio stream is converted into text content through speech recognition, the key frame image sequence is extracted from the video stream, and the text content, the speech-converted text content and the key frame image sequence are input into the multimodal large language model to generate a unified semantic representation vector containing cross-modal semantic associations. The unified semantic representation vector is stored as a high-level semantic feature. Step 3: Arrange the unified semantic representation vectors generated in Step 2 in chronological order to form a vector sequence. Use the vector sequence as node features to construct an initial graph structure with dialogue rounds as nodes. Use a temporal graph neural network to learn the dynamic embedding of each node and label the emotional state in the graph node embedding. Introduce a neural ordinary differential equation mechanism to model the evolution trajectory of psychological state in continuous time. When a new dialogue round is added, dynamically adjust the full graph node embedding to obtain a dynamic psychological state map. Step 4: Receive the user's natural language query, retrieve historical dialogue nodes related to the current query semantics from the dynamic mental state graph obtained in Step 3, extract the dialogue history summary corresponding to the historical dialogue node and the sentiment state label marked in Step 3, organize the current query, dialogue history summary and sentiment state label into structured prompt words through prompt template, and input them into the multimodal big language model to generate an enhanced query intent representation; Step 5: The enhanced query intent representation generated in Step 4 is converted into an intermediate logical expression through a rule template. The intermediate logical expression and database schema information are then input into the neural symbolic reasoning engine to generate candidate query execution plans. Execution cost estimation parameters are defined for each candidate execution plan. A graph neural network model is used to predict the execution cost of the candidate query execution plans. The execution plan with the lowest cost is selected and executed by the database engine. Step 6: Using a causal discovery algorithm, identify the causal relationships between key psychological state variables from the original results returned by the query in Step 5. Based on the identified causal relationships, perform counterfactual reasoning to generate explanatory content. Attach the explanatory content to the original results to generate a personalized analysis report. Simultaneously, use changes in the user's emotional tendencies in subsequent conversations as feedback signals to adjust the evolution parameters of the neural ordinary differential equation mechanism in Step 3 of the dynamic psychological state map and the execution cost estimation parameters defined in Step 5 of the query execution plan.

[0019] The intelligent query method for relational databases based on machine learning provided by this invention is implemented as follows: Multimodal stream data of user conversations is collected in real time through the interactive interface of an artificial intelligence psychological dialogue platform. This multimodal stream data includes dialogue text streams, audio streams, and video streams. A distributed message queue is used to buffer and asynchronously process the multimodal stream data, and different topic partitions are set to process each modal data stream separately. A high-precision time sequence identifier based on network time protocol synchronization is added to each stream data packet, and a dynamic time warping algorithm is used to calculate the minimum path cost between the speech feature sequence and the video frame sequence, achieving sampling point-level alignment of different modal signals, ultimately obtaining time-aligned multimodal stream data.

[0020] The time-aligned multimodal stream data obtained in the previous steps is segmented by timestamp. Text content at the same timestamp is extracted. Audio streams are converted into text content using a speech recognition engine, and video streams are used to obtain representative image sequences through a keyframe extraction algorithm. The text content, speech-converted text content, and keyframe image sequences are concatenated into multimodal cue words using a specific template and input into a multimodal large language model based on the Transformer architecture. This model is fine-tuned using instructions from dialogue data in the field of mental health. By extracting the classification label vectors corresponding to the last hidden layer, a unified semantic representation vector containing cross-modal semantic associations is generated. The unified semantic representation vector is stored as a high-level semantic feature in a semantic feature table of a relational database and a foreign key relationship is established with the original data.

[0021] The unified semantic representation vectors generated in each step are arranged chronologically to form a vector sequence. This vector sequence is used as node features to construct an initial graph structure with dialogue turns as nodes. A temporal graph neural network is employed to learn the dynamic embedding of each node, specifically using the EvolveGCN architecture, which evolves graph convolution parameters through gated recurrent units. Emotional state labels are annotated in the graph node embeddings, and a neural ordinary differential equation mechanism is introduced. The Runge-Kutta method with adaptive step size is used to solve for the continuous evolution of node states in the time dimension. When a new dialogue turn is added, the historical node representation is adjusted through backpropagation using the adjoint method to achieve continuous modeling of psychological state drift, ultimately obtaining a dynamic psychological state graph.

[0022] After receiving a user's natural language query, the system retrieves historical dialogue nodes semantically related to the current query from a dynamic mental state graph. It calculates the similarity between the query semantics and node features, selects the historical dialogue node with the highest similarity, and extracts the corresponding dialogue history summary and sentiment state label. Using a thought chain suggestion technique, the current query, dialogue history summary, and sentiment state label are organized into structured suggestion words, which are then input into a multimodal large language model. The model's cross-attention mechanism fuses the query intent with the graph context, outputting an enhanced query intent representation that includes time awareness.

[0023] The enhanced query intent representation is mapped to an intermediate logical expression in first-order logical form using rule templates. This intermediate logical expression, along with database schema information, is input into a neural symbolic inference engine for joint inference to generate candidate query execution plans. Execution cost estimation parameters are defined for each candidate execution plan. A graph neural network model is used to abstract the execution plan into a computational graph, and global features are aggregated through a message passing network to predict the execution cost. The execution plan with the lowest cost is selected and instantiated to generate a native SQL statement, which is then executed by the database engine.

[0024] The NOTEARS algorithm is used to identify the causal graph structure between key psychological state variables in the raw query results. Based on the identified causal relationships, dual machine learning techniques are used to estimate the intervention effect, and counterfactual inference is performed to generate explanatory content. This explanatory content is then appended to the raw results to generate a personalized analysis report. Simultaneously, changes in the user's emotional tendency in subsequent conversations are used as reward signals. The node update strategy of the dynamic psychological state graph is updated using a policy gradient method, and the cost estimation parameters of the query execution plan are optimized through online learning, achieving continuous optimization of system performance.

[0025] Specifically, in the machine learning-based intelligent query method for relational databases described in this invention, step 1, the real-time acquisition of multimodal stream data from user sessions includes: transmitting the dialogue text stream, audio stream, and video stream via the WebRTC streaming media protocol; the use of a distributed message queue for buffering and asynchronous processing of the multimodal stream data includes: setting up different topic partitions to process each modal data stream separately; adding a time sequence identifier to each stream data packet includes: using a high-precision timestamp synchronized using a network time protocol; and aligning different modal signals using a dynamic time warping algorithm includes: calculating the minimum path cost between the speech feature sequence and the video frame sequence to complete the sampling point-level alignment.

[0026] In the multimodal streaming data acquisition scheme of this invention, a real-time communication channel is established through the WebRTC streaming media protocol to transmit dialogue text streams, audio streams, and video streams. Different topic partitions of a distributed message queue are set up to process text, audio, and video modal data streams respectively, achieving parallel data processing. A high-precision timestamp synchronized by the Network Time Protocol is used to add a millisecond-level time sequence identifier to each stream data packet. A dynamic time warping algorithm is used to calculate the minimum path cost between the Mel-frequency cepstral coefficient feature sequence and the video frame sequence. A dynamic programming algorithm is then used to find the optimal alignment path, completing the sampling point-level alignment of the multimodal signals.

[0027] Specifically, in step 2 of the intelligent query method for relational databases based on machine learning described in this invention, the multimodal large language model is a pre-trained model based on the Transformer architecture, and is fine-tuned using dialogue data from the field of mental health; generating a unified semantic representation vector includes: extracting the vector corresponding to the classification label of the last hidden layer of the model; storing the unified semantic representation vector includes: storing the vector in the semantic feature table of the relational database, and establishing an index association with the original data.

[0028] In the semantic representation generation scheme of this invention, the multimodal large language model adopts a pre-trained model based on the Transformer architecture, and uses dialogue data from the field of mental health for instruction fine-tuning through supervised learning. When generating a unified semantic representation vector, the vector corresponding to the classification label of the last hidden layer of the model is extracted as the semantic representation output. When storing the unified semantic representation vector, the vector data is stored in the semantic feature table of a relational database, and an index is established with the original data table through foreign key constraints to maintain data consistency.

[0029] Specifically, in the intelligent query method for relational databases based on machine learning described in this invention, step 3, the construction of the initial graph structure includes: using the temporal relationship between dialogue rounds as edge connections to nodes; the temporal graph neural network adopts gated recurrent unit evolution graph convolution parameters; the neural ordinary differential equation mechanism solves the node state evolution through an adaptive step-size numerical solution method; the dynamic adjustment of the full graph node embedding includes: backpropagating historical node representations through the adjoint method.

[0030] In the graph construction scheme of this invention, the temporal relationship between dialogue rounds is used as directed edge connections to nodes when constructing the initial graph structure. The temporal graph neural network uses gated recurrent units to dynamically evolve the weight parameters of the graph convolutional layer. The neural ordinary differential equation mechanism solves the evolution trajectory of node states in the continuous time domain through an adaptive step-size numerical solution. When dynamically adjusting the embedding of nodes in the entire graph, the gradient is calculated through the adjoint method and backpropagation is used to update the historical node representation.

[0031] Specifically, in step 4 of the intelligent query method for relational databases based on machine learning described in this invention, retrieving relevant historical dialogue nodes from the dynamic mental state graph includes: calculating the similarity between query semantics and node features, and selecting top-K nodes; generating structured prompt words includes: using thought chain prompting technology to organize query intent, historical context, and sentiment trends; generating an enhanced query intent representation includes: outputting a time-aware vector representation through the model's cross-attention mechanism.

[0032] In the intent understanding scheme of this invention, when retrieving relevant historical dialogue nodes from a dynamic mental state graph, the cosine similarity between the query semantic embedding vector and the node feature vector is calculated, and the K nodes with the highest similarity are selected. When generating structured prompts, a thought chain prompting technique is used to organize the query intent, historical dialogue context, and sentiment trend information into a hierarchical prompt template. When generating an enhanced query intent representation, the relevance weights between the query and the context are calculated through the model's cross-attention mechanism, and a time-aware vector representation is output.

[0033] Specifically, in the machine learning-based intelligent query method for relational databases described in this invention, step 5, the conversion to an intermediate logical expression includes: using a rule template to map the intent representation to a first-order logical form; the generation of candidate query execution plans includes: a neural symbolic reasoning engine performing joint reasoning between the logical expression and the database schema; the graph neural network model abstracting the execution plan into a computation graph and predicting the cost through a message passing network; and the selection of the optimal plan includes: instantiating and generating a native SQL statement.

[0034] In the query execution scheme of this invention, when converting to an intermediate logical expression, a predefined rule template is used to map the intent representation into a first-order logical predicate form. When generating candidate query execution plans, the neural symbolic reasoning engine performs joint reasoning between the logical expression and database schema metadata, generating multiple execution plan variants. The graph neural network model abstracts the execution plan into a directed computation graph, predicting the execution cost by aggregating node features through a message passing network. When selecting the optimal plan, the execution plan with the lowest cost is instantiated into a standard SQL query statement.

[0035] Specifically, in step 6 of the intelligent query method for relational databases based on machine learning described in this invention, the application of the causal discovery algorithm includes: using the NOTEARS algorithm to identify the causal graph structure between psychological state variables; the counterfactual reasoning includes: using dual machine learning techniques to estimate the intervention effect; the adjustment of the evolution parameters of the dynamic psychological state graph includes: using changes in user emotional tendencies as reward signals to update the node update strategy through the policy gradient method; and the adjustment of the cost estimation parameters includes: optimizing the model weights through online learning.

[0036] In the result optimization scheme of this invention, when applying the causal discovery algorithm, the NOTEARS algorithm is used to learn the directed acyclic graph structure between psychological state variables. When performing counterfactual reasoning, a dual machine learning technique is used to estimate the average treatment effect of the intervention variables on the outcome. When adjusting the evolution parameters of the dynamic psychological state graph, changes in user emotional tendencies are used as reward signals, and the node update policy function is updated through the policy gradient method. When adjusting the cost estimation parameters, an online learning method is used to dynamically update the weights of the graph neural network model.

[0037] Specifically, the intelligent query method for relational databases based on machine learning described in this invention uses Apache Kafka as the distributed message queue; the timestamp accuracy of the network time protocol synchronization reaches the millisecond level; and the dynamic time warping algorithm, when aligning audio and video signals, also includes timestamp matching of the text stream to achieve strict temporal consistency of multimodal data.

[0038] In the data processing scheme of this invention, the distributed message queue adopts the Apache Kafka framework, setting up three independent topic partitions to process text, audio, and video data streams respectively. The network time protocol synchronizes timestamps with millisecond-level precision, adding accurate timestamps to each data packet. While the dynamic time warping algorithm processes audio and video signal alignment, it simultaneously performs timestamp matching verification on the text stream, maintaining the temporal consistency of multimodal data.

[0039] Specifically, the intelligent query method for relational databases based on machine learning described in this invention includes the following steps: the instruction fine-tuning includes supervised fine-tuning using psychological dialogue corpus; before extracting the classification label vector, the input multimodal prompt words are normalized; and when storing the vector, consistency verification of foreign key associations is also performed.

[0040] In the model optimization scheme of this invention, the instruction fine-tuning process uses psychological dialogue corpus to train model parameters through supervised learning. Before extracting the classification label vector, the input multimodal prompt words are subjected to layer normalization to stabilize the training process. When storing vector data, referential integrity checks are performed on foreign key associations to ensure data consistency.

[0041] Specifically, the machine learning-based intelligent query method for relational databases described in this invention uses the EvolveGCN architecture for the temporal graph neural network; the Runge-Kutta method is used for the numerical solution; and when dynamically adjusting node embedding, the emotional drift index in user dialogue is also considered to make the graph evolution more consistent with changes in psychological state.

[0042] In the graph optimization scheme of this invention, the temporal graph neural network adopts the EvolveGCN architecture, and dynamically updates the graph convolution parameters through a gating mechanism. The numerical solution uses the fourth-order Runge-Kutta method to solve ordinary differential equations, improving computational accuracy. When dynamically adjusting node embeddings, an emotion drift index is introduced to quantify the degree of change in the user's psychological state, optimizing the fit between the graph evolution process and changes in psychological state.

[0043] This invention addresses semantic inconsistency by using temporal alignment processing of multimodal streaming data. It employs a dynamic time warping algorithm to calculate the minimum path cost between speech feature sequences and video frame sequences, achieving sampling-point-level alignment of multimodal signals and providing a strictly temporally consistent data foundation for subsequent processing. Furthermore, it generates unified semantic representation vectors containing cross-modal semantic associations through a multimodal large language model, overcoming the semantic fragmentation problem caused by existing modal processing methods and establishing deep semantic connections between text, speech, and video information.

[0044] To address the issue of strong contextual dependencies, this invention constructs a dynamic mental state graph, uses a temporal graph neural network to learn dynamic node embeddings, and introduces a neural ordinary differential equation mechanism to model the evolution trajectory of mental states over continuous time. This design can capture the temporal evolution of user mental states and effectively handle semantic drift. When a new dialogue turn is added, the system adjusts the representation of historical nodes through backpropagation using the adjoint method, achieving a continuous characterization of long-term dependencies.

[0045] In the query intent understanding stage, this invention retrieves historical dialogue nodes related to the current query semantics from a dynamic mental state graph, extracts dialogue history summaries and sentiment state tags, and organizes them into structured prompts using mind chain hint technology. A multimodal large language model utilizes a cross-attention mechanism to fuse query intent with the graph context, generating a time-aware enhanced query intent representation, enabling the system to understand the user's query intent in conjunction with the complete dialogue history.

[0046] During the query execution phase, a neural symbolic reasoning engine is used to convert the enhanced query intent representation into an intermediate logical expression, which is then used in conjunction with database schema information to generate candidate execution plans. A graph neural network model abstracts the execution plan into a computational graph and predicts the execution cost through a message passing network, replacing existing cost models based on statistical information and improving the alignment between query planning and actual conditions.

[0047] In the results generation phase, a causal discovery algorithm is applied to identify causal relationships between key psychological state variables, and counterfactual reasoning based on dual machine learning techniques is used to generate explanatory content. The system uses changes in the user's emotional tendency in subsequent conversations as reward signals, updates the node update strategy of the dynamic psychological state graph using a policy gradient method, and optimizes the cost estimation parameters of the query execution plan through online learning, achieving continuous adaptive optimization for individual users.

[0048] The technical solution of this invention effectively solves the technical limitations of existing static knowledge graph methods in dealing with temporal semantic changes and contextual dependencies through the synergistic effect of multimodal fusion, temporal modeling, neural symbolic reasoning and causal intervention, and significantly improves the query accuracy and personalization level in psychological dialogue scenarios.

Claims

1. A machine learning-based intelligent query method for relational databases, characterized in that: include: Step 1: Collect multimodal stream data of user conversations in real time through the interactive interface of the artificial intelligence psychological dialogue platform. The multimodal stream data includes dialogue text stream, audio stream and video stream. A distributed message queue is used to buffer and asynchronously process the multimodal stream data. A time sequence identifier is added to each stream data packet. A dynamic time warping algorithm is used to align the acquisition time points of different modal signals to obtain time-aligned multimodal stream data. Step 2: The time-aligned multimodal stream data obtained in Step 1 is segmented by timestamp, the text content of the same timestamp is extracted, the audio stream is converted into text content through speech recognition, the key frame image sequence is extracted from the video stream, and the text content, the speech-converted text content and the key frame image sequence are input into the multimodal large language model to generate a unified semantic representation vector containing cross-modal semantic associations. The unified semantic representation vector is stored as a high-level semantic feature. Step 3: Arrange the unified semantic representation vectors generated in Step 2 in chronological order to form a vector sequence. Use the vector sequence as node features to construct an initial graph structure with dialogue rounds as nodes. Use a temporal graph neural network to learn the dynamic embedding of each node and label the emotional state in the graph node embedding. Introduce a neural ordinary differential equation mechanism to model the evolution trajectory of psychological state in continuous time. When a new dialogue round is added, dynamically adjust the full graph node embedding to obtain a dynamic psychological state map. Step 4: Receive the user's natural language query, retrieve historical dialogue nodes related to the current query semantics from the dynamic mental state graph obtained in Step 3, extract the dialogue history summary corresponding to the historical dialogue node and the sentiment state label marked in Step 3, organize the current query, dialogue history summary and sentiment state label into structured prompt words through prompt template, and input them into the multimodal big language model to generate an enhanced query intent representation; Step 5: The enhanced query intent representation generated in Step 4 is converted into an intermediate logical expression through a rule template. The intermediate logical expression and database schema information are then input into the neural symbolic reasoning engine to generate candidate query execution plans. Execution cost estimation parameters are defined for each candidate execution plan. A graph neural network model is used to predict the execution cost of the candidate query execution plans. The execution plan with the lowest cost is selected and executed by the database engine. Step 6: Using a causal discovery algorithm, identify the causal relationships between key psychological state variables from the original results returned by the query in Step 5. Based on the identified causal relationships, perform counterfactual reasoning to generate explanatory content. Attach the explanatory content to the original results to generate a personalized analysis report. Simultaneously, use changes in the user's emotional tendencies in subsequent conversations as feedback signals to adjust the evolution parameters of the neural ordinary differential equation mechanism in Step 3 of the dynamic psychological state map and the execution cost estimation parameters defined in Step 5 of the query execution plan.

2. The intelligent query method for relational databases based on machine learning according to claim 1, characterized in that, In step 1, the real-time acquisition of multimodal stream data of user sessions includes: transmitting the dialogue text stream, audio stream, and video stream via the WebRTC streaming media protocol; the use of distributed message queues for buffering and asynchronous processing of multimodal stream data includes: setting up different topic partitions to process each modal data stream separately; adding a time sequence identifier to each stream data packet includes: using a high-precision timestamp synchronized by the Network Time Protocol; and applying a dynamic time warping algorithm to align different modal signals includes: calculating the minimum path cost between the speech feature sequence and the video frame sequence to complete the sampling point-level alignment.

3. The intelligent query method for relational databases based on machine learning according to claim 2, characterized in that, In step 2, the multimodal large language model is a pre-trained model based on the Transformer architecture, and is fine-tuned using dialogue data from the mental health domain. The generation of the unified semantic representation vector includes: extracting the vector corresponding to the classification label of the last hidden layer of the model; the storage of the unified semantic representation vector includes: storing the vector in the semantic feature table of the relational database and establishing an index association with the original data.

4. The intelligent query method for relational databases based on machine learning according to claim 3, characterized in that, In step 3, the construction of the initial graph structure includes: using the temporal relationship between dialogue rounds as edge connections to nodes; the temporal graph neural network adopts gated recurrent unit evolution graph convolution parameters; the neural ordinary differential equation mechanism solves the node state evolution through an adaptive step-size numerical solution method; and the dynamic adjustment of the full graph node embedding includes: backpropagating historical node representations through the adjoint method.

5. The intelligent query method for relational databases based on machine learning according to claim 4, characterized in that, In step 4, retrieving relevant historical dialogue nodes from the dynamic mental state graph includes: calculating the similarity between query semantics and node features, and selecting the top-K nodes; generating structured prompt words includes: using mind chain prompting technology to organize query intent, historical context, and sentiment trends; generating enhanced query intent representation includes: outputting a time-aware vector representation through the model's cross-attention mechanism.

6. The intelligent query method for relational databases based on machine learning according to claim 5, characterized in that, In step 5, the conversion to an intermediate logical expression includes: mapping the intent representation to a first-order logical form using a rule template; the generation of candidate query execution plans includes: a neural symbolic reasoning engine performing joint reasoning between the logical expression and the database schema; the graph neural network model abstracting the execution plan into a computation graph and predicting the cost through a message passing network; and the selection of the optimal plan includes: instantiating and generating a native SQL statement.

7. The intelligent query method for relational databases based on machine learning according to claim 6, characterized in that, In step 6, the application of the causal discovery algorithm includes: using the NOTEARS algorithm to identify the causal graph structure between psychological state variables; the counterfactual reasoning includes: using dual machine learning techniques to estimate the intervention effect; the adjustment of the evolution parameters of the dynamic psychological state graph includes: using changes in user emotional tendencies as reward signals to update the node update policy through the policy gradient method; the adjustment of the cost estimation parameters includes: optimizing the model weights through online learning.

8. The intelligent query method for relational databases based on machine learning according to claim 7, characterized in that, The distributed message queue is Apache Kafka; the timestamp accuracy of the network time protocol synchronization reaches the millisecond level; when the dynamic time warping algorithm processes audio and video signal alignment, it also includes timestamp matching of the text stream to achieve strict temporal consistency of multimodal data.

9. The intelligent query method for relational databases based on machine learning according to claim 8, characterized in that, The instruction fine-tuning includes supervised fine-tuning using psychological dialogue corpus; before extracting the classification label vector, the input multimodal prompt words are also normalized; when storing the vector, consistency verification of foreign key associations is also included.

10. The intelligent query method for relational databases based on machine learning according to claim 9, characterized in that, The temporal graph neural network is based on the EvolveGCN architecture; the numerical solution is the Runge-Kutta method; and when dynamically adjusting node embedding, the emotional drift index in user dialogue is also considered to make the graph evolution more consistent with changes in psychological state.

Citation Information

Cited By

  • Method and device for generating SQL instruction by dialogue type natural language

    CN121764951A

  • A method and device for generating SQL instructions in a conversational natural language

    CN121764951B