Interactive business intelligent analysis method and device, electronic equipment and storage medium

Through interactive business intelligence analysis methods, combined with metadata knowledge graphs and large model technology, the problem of inefficiency of traditional business intelligence analysis is solved, efficient and accurate data analysis and query are achieved, and the threshold for use is lowered.

CN119621741APending Publication Date: 2025-03-14INSPUR TIANYUAN COMM INFORMATION SYST CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411504091.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

Traditional business intelligence analysis methods are inefficient, and users need to have high technical proficiency to analyze data in depth, and the degree of intelligence is low, resulting in limited depth and breadth of data analysis.

Method used

Through interactive business intelligence analysis methods, using metadata knowledge graphs and large-model technology, users can query data through natural language input, and the system automatically parses the intention, generates SQL statements and executes it, and returns the target data.

Benefits of technology

It greatly reduces the need for manual intervention, improves the accuracy and efficiency of data analysis, improves the flexibility and efficiency of business intelligence analysis, and reduces the threshold for use, so that non-technical users can easily obtain data insights.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621741A_ABST
    Figure CN119621741A_ABST
Patent Text Reader

Abstract

The invention provides an interactive business intelligent analysis method and device, electronic equipment and a storage medium, and belongs to the technical field of artificial intelligence. Based on user query data, performing query through the metadata knowledge graph to obtain target table structure information; generating a target cue word based on the user query data and the target table structure information; inputting the target prompt word into the large model, and outputting an SQL statement corresponding to the user query data; and executing the SQL statement, and returning target data queried by the user. According to the interactive business intelligence analysis method provided by the invention, a data mode can be automatically found, predictive analysis and recommendation can be carried out, the requirement of manual intervention is greatly reduced, the accuracy and efficiency of data analysis are improved, and finally efficient and accurate query data extraction is realized, so that the flexibility and efficiency of business intelligence analysis are improved, and the user experience is improved. And meanwhile, the use threshold is reduced, so that non-technical users can easily obtain data insight through natural languages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an interactive business intelligence analysis method, device, electronic device and storage medium. Background Art

[0002] Business Intelligence (BI) refers to a system tool that helps enterprise managers make accurate decisions by collecting, analyzing, organizing and querying internal and external data of the enterprise, converting big data into meaningful information.

[0003] Traditional business intelligence analysis technology solutions mainly revolve around several core links: data source collection, data warehouse data integration, visual report presentation and data analysis. They focus on centralized analysis models driven by artificial intelligence, and emphasize stable data warehouses and fixed report generation.

[0004] Traditional business intelligence analysis methods often rely on predefined reports, dashboards and fixed queries. Users analyze data by dragging the interface or writing Structured Query Language (SQL). They rely on manually set rules and predefined queries, and have high technical requirements for users. The depth and breadth of data analysis are limited by the preset data query model and the user's technical proficiency. The level of intelligence is low, resulting in low efficiency. Summary of the invention

[0005] The present invention provides an interactive business intelligence analysis method, device, electronic device and storage medium, which are used to solve the problem of low efficiency of business intelligence analysis in the prior art.

[0006] In a first aspect, the present invention provides an interactive business intelligence analysis method, comprising: Get user query data; Based on the user query data, query through the metadata knowledge graph to obtain the target table structure information; Generate a target prompt word based on the user query data and the target table structure information; Input the target prompt word into the big model to obtain the SQL statement corresponding to the user query data output by the big model; Execute the SQL statement and return the target data queried by the user.

[0007] In one embodiment, the query based on the user query data is performed through the metadata knowledge graph to obtain the target table structure information, including: Performing intent analysis on the user query data to obtain the query intent; Based on the query intent, generate a query task prompt; Using thought chain technology, generating a thought chain based on the query task prompt; Generate query conditions based on the query task prompt and the thinking chain; Based on the query conditions, a query is performed through the metadata knowledge graph to obtain the target table structure information.

[0008] In one embodiment, the query condition is based on the metadata knowledge graph to obtain the target table structure information, including: Extract keywords based on the query conditions to obtain initial keywords; Performing vocabulary generalization processing based on the initial keywords to obtain target keywords; Based on the target keyword, searching for directly related target nodes in the metadata knowledge graph; Based on the metadata knowledge graph, determining multiple local subgraphs within N hops of the target node; Based on the target keyword, the multiple local subgraphs are traversed and searched to obtain target table structure information.

[0009] In one embodiment, generating a target prompt word based on the user query data and the target table structure information includes: Based on the user query data and the target table structure information, the predefined first prompt word, second prompt word, third prompt word and fourth prompt word are filled in respectively to obtain the first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word; the first prompt word is used to reflect the scenario to which the query data is applied; the second prompt word is used to instruct the model to perform a specific operation; the third prompt word is used to guide the output format of the large model; the fourth prompt word is used to reflect the user query demand; The first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word are integrated to obtain a target prompt word.

[0010] In one embodiment, obtaining user query data includes: Acquire user input text, and determine the user input text as user query data; Or, the audio content input by the user is obtained, speech recognition is performed on the audio content, the text content of the audio file is obtained, and the text content is determined as the user query data.

[0011] In one embodiment, the interactive business intelligence analysis method further includes: Obtain input data requested by users to generate visualization reports; Inputting the input data into a pre-trained reinforcement learning model to obtain a drawing code output by the reinforcement learning model; Execute the drawing code and return the target visualization report generated by the user's request.

[0012] In one embodiment, the reinforcement learning model is obtained by pre-training in the following manner: Through the interaction between the agent and the environment, multiple experience samples are obtained, and the multiple experience samples are stored in the experience pool; each experience sample includes a current state, an action, a current reward and a next state; the current state represents sample input data for a user's request to generate a visualization report; the action represents a sample drawing code for generating a visualization report; Randomly extracting a fixed number of target experience samples from the experience pool for model training; Based on the target experience sample, calculating the advantage value of each state-action pair; Calculate the policy gradient based on multiple advantage values; Based on the policy gradient, updating policy parameters; The step of randomly extracting a fixed number of target experience samples from the experience pool for model training is iteratively executed until the strategy converges or the preset performance target is met, thereby obtaining a pre-trained reinforcement learning model.

[0013] In a second aspect, the present invention further provides an interactive business intelligence analysis device, comprising: The acquisition module is used to obtain user query data; A query module, used to query the metadata knowledge graph based on the user query data to obtain the target table structure information; A prompt word generation module, used for generating target prompt words based on the user query data and the target table structure information; An SQL statement generation module, used for inputting the target prompt word into the big model, and obtaining the SQL statement corresponding to the user query data output by the big model; The query data return module is used to execute the SQL statement and return the target data queried by the user.

[0014] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any one of the above-described interactive business intelligence analysis methods are implemented.

[0015] In a fourth aspect, the present invention further provides a computer-readable storage medium, comprising a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the interactive business intelligence analysis methods described above are implemented.

[0016] The interactive business intelligence analysis method, device, electronic device and storage medium provided by the present invention enable users to query the system for required data in an interactive manner. The system can understand natural language instructions, and through the combination of knowledge graph and big model technology, it can perform corresponding data analysis tasks, and can automatically discover data patterns, perform predictive analysis and recommendations, which greatly reduces the need for manual intervention and improves the accuracy and efficiency of data analysis, and ultimately achieves efficient and accurate query data extraction, thereby improving the flexibility and efficiency of business intelligence analysis, while lowering the usage threshold, so that non-technical users can also easily obtain data insights through natural language. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 It is a flowchart of the interactive business intelligence analysis method provided by the present invention.

[0019] Figure 2 It is a structural schematic diagram of the interactive business intelligence analysis device provided by the present invention.

[0020] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0022] The terms "first", "second", etc. in the present invention are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described herein.

[0023] Combine the following Figure 1-Figure 3 The interactive business intelligence analysis method, device, electronic device and storage medium provided by the present invention are described.

[0024] It should be noted that the interactive business intelligence analysis method provided by the embodiment of the present invention is implemented based on an interactive business intelligence analysis device. The interactive business intelligence analysis method provided by the present invention allows users to interact with the system through natural language, that is, allows users to directly input text or interact with the system through voice. In the process of interacting with the system, the developed Text2SQL agent can be used to enable users to interact with the database through natural language, thereby simplifying the process of data query and data analysis. In addition, the developed Text2Code agent can also be used to realize the generation of intelligent and diversified visual reports, breaking the traditional fixed report model.

[0025] The embodiment of the present invention describes the interactive business intelligence analysis method by taking an interactive business intelligence analysis device as an execution subject as an example.

[0026] Combination Figure 1 , Figure 1 It is a flowchart of the interactive business intelligence analysis method provided by the present invention.

[0027] like Figure 1 As shown, the method includes the following: Step 101: Obtain user query data; Step 102: Based on the user query data, query through the metadata knowledge graph to obtain target table structure information; Step 103: Generate a target prompt word based on the user query data and the target table structure information; Step 104: input the target prompt word into the big model to obtain the SQL statement corresponding to the user query data output by the big model; Step 105: Execute the SQL statement to return the target data queried by the user.

[0028] In step 101, since the interactive business intelligence analysis device allows the system to interact using natural language, when the user needs to query the required data, the user can enter text or voice on the interactive page provided by the interactive business intelligence analysis device. If the input is text, the system can directly recognize it. If the input is voice, the system needs to implement voice-to-text conversion through an integrated voice-to-text function module to obtain the user query data.

[0029] Before executing step 102, it is necessary to first obtain all table structure information in the database. Each table structure information includes table name, annotation information, field name, field annotation and other information. Further, all table structure information obtained from the database is subjected to triple extraction to convert all table structure information in the database into a series of triples. Based on this series of triples, a metadata knowledge graph is constructed and written into a graph database (such as neo4j-graph database), so that it can be retrieved and used in the retrieval-augmented generation (RAG) technology to generate more accurate and relevant outputs, such as SQL statements. The constructed metadata knowledge graph helps to improve the intelligence and automation level of data query.

[0030] A triple usually consists of three parts, namely, subject, predicate, and object. The subject usually refers to the name of a table or field, the predicate is a word that describes the relationship between the subject and other information, and the object is information related to the subject, such as table comments, field comments, etc. The extracted triples may include: table name-with comments-comment information, table name-contained fields-field name, field name-with comments-field comments, which are only examples and are not limited to this.

[0031] Therefore, in step 102, a metadata knowledge graph is obtained from the graph database, and the user's intention to query data is analyzed based on the obtained user query data. According to the user's intention, a query is performed in the metadata knowledge graph to obtain the table structure information most relevant to the user input, which is the target table structure information.

[0032] In step 103, based on the user query data and the target table structure information, the pre-defined prompt word template is filled in, and the filled prompt word template is determined as the target prompt word. The user inputs it into the big model to tell the big model the task usage scenario or background content, what operations should be performed, what content should be output, what format should be output, etc.

[0033] In step 104, the generated target prompt word is input into the big model, which performs intelligent analysis and finally outputs the SQL statement corresponding to the user's query data, that is, the SQL statement that can retrieve the data that the user wants to query.

[0034] In step 105, the system executes the SQL statement corresponding to the user query data to obtain the target data most relevant to the user query data, and feeds back the target data of the user query to the user through the interactive page.

[0035] The interactive business intelligence analysis method provided by the present invention allows users to query the system for required data in an interactive manner. The system can understand natural language instructions and execute corresponding data analysis tasks by combining knowledge graphs and big model technologies. It can automatically discover data patterns, perform predictive analysis and recommendations, greatly reducing the need for manual intervention and improving the accuracy and efficiency of data analysis. Ultimately, efficient and accurate query data extraction is achieved, thereby improving the flexibility and efficiency of business intelligence analysis, while lowering the usage threshold so that non-technical users can also easily obtain data insights through natural language.

[0036] In some embodiments, based on step 101, obtaining user query data includes: Acquire user input text, and determine the user input text as user query data; Or, the audio content input by the user is obtained, speech recognition is performed on the audio content, the text content of the audio file is obtained, and the text content is determined as the user query data.

[0037] Specifically, when the user needs to query data, he chooses to input text, and then the system obtains the user input text and determines the user input text as the user query data.

[0038] Alternatively, when the user needs to query data, he chooses to input audio content. The system then obtains the audio content input by the user and performs speech recognition on the audio content. The audio content can be pre-processed and feature processed before being input into the speech recognition model. The speech recognition model performs text analysis and predicts the text content of the audio content, and determines the text content as the user query data.

[0039] For example, the training process of a speech recognition model mainly includes the audio preprocessing stage, feature extraction, model training and optimization, prediction and output. These processes will be described separately below.

[0040] 1. Audio preprocessing stage: Get the audio samples for training the model. Before model training begins, the audio samples need to go through a series of preprocessing operations to optimize the input quality and ensure that the model can learn from clear and clean signals. Preprocessing steps may include: noise reduction: remove background noise and improve speech clarity; audio segmentation: divide long audio samples into smaller and more manageable segments; resampling: unify the audio sampling rate to ensure that all input data formats are consistent, which is conducive to model processing.

[0041] 2. Feature extraction: When building a neural network model, a STTformer model can be used. This model is an encoder-decoder structure, in which the encoder consists of two feedforward layers FFM, in which the multi-head self-attention module and the convolution module are sandwiched between the two feedforward neural networks, followed by the Layernorm layer.

[0042] In order to reduce the complexity of the model, a new attention mechanism called "Grouped Attention" is adopted. This mechanism reduces the computational complexity of the self-attention module by introducing grouping operations. Specifically, without grouping, the computational complexity of the self-attention module is O(n2d), where n represents the length of the sequence (or time dimension) and d is the hidden layer dimension of the model. By referring to grouped attention, the computational complexity can be reduced to O(n2d / g), where g represents the size of each group (i.e., group size). This improvement effectively reduces the computational cost and makes the model more efficient when processing long sequences.

[0043] 3. Model training and optimization: The model is trained using a large set of audio samples with text labels, with the goal of allowing the model to learn to infer the corresponding text from the audio features. The training process includes: feature mapping: taking the extracted audio features as input and converting them into text output through a neural network; iterative learning: repeatedly adjusting the network weights to minimize the difference between the predicted text and the real text, thereby improving the accuracy and generalization ability of the model.

[0044] 4. Prediction and output: Once the model training is completed and reaches satisfactory performance standards, it can be applied to actual speech recognition tasks: Real-time / offline conversion: receiving audio input, through preprocessing, feature extraction and model prediction, and finally outputting the corresponding text content; Result verification: checking and correcting the output text content to ensure the accuracy of the conversion.

[0045] Therefore, through the above process, a trained speech recognition model can be obtained, which is used to convert the audio content input by the user into text content, so as to determine the user query data.

[0046] The embodiments of the present invention introduce natural language processing technology and speech recognition technology to enable users to ask questions in natural language and obtain instant answers, thereby lowering the technical threshold. Therefore, users no longer need to master complex query languages ​​or interface operations and can directly interact with data, thereby improving user experience.

[0047] In some embodiments, based on step 102, the query based on the user query data is performed through the metadata knowledge graph to obtain the target table structure information, including: Performing intent analysis on the user query data to obtain the query intent; Based on the query intent, generate a query task prompt; Using thought chain technology, generating a thought chain based on the query task prompt; Generate query conditions based on the query task prompt and the thinking chain; Based on the query conditions, a query is performed through the metadata knowledge graph to obtain the target table structure information.

[0048] Specifically, the user query data is analyzed for intent to obtain the query intent, and further, based on the query intent, a query task prompt is generated.

[0049] Furthermore, the thinking chain technology is a technology that imitates the human thinking process. It constructs a chain of steps to solve problems by simulating human thinking logic. Therefore, the thinking chain technology can be used to generate a thinking chain based on the query task prompt. The thinking chain is a series of logically related thinking steps that are interconnected to form a complete thinking process. This chain can span multiple sentences or paragraphs, connecting different concepts, topics or arguments together to form a coherent thinking path. It can not only help better understand and analyze problems, but also effectively solve problems.

[0050] Furthermore, query conditions are generated based on the query task prompts and thinking chains.

[0051] Furthermore, based on the query conditions, the metadata knowledge graph is queried to obtain the target table structure information.

[0052] The embodiment of the present invention generates correct reasoning steps step by step through the thought chain technology, and finally determines the query conditions, and then queries the metadata knowledge graph according to the query conditions to obtain the target table structure information. Without relying entirely on predefined reports, it automatically discovers patterns and associations in the data, provides a deeper and broader analysis perspective, and can greatly improve the accuracy and efficiency of queries. At the same time, it enriches the semantic relevance and information content of the query results, and realizes a more intelligent data retrieval experience. At the same time, this method reduces the dependence on user technical requirements, allowing non-technical users to perform complex data exploration.

[0053] According to the above steps, based on the query condition, the query is performed through the metadata knowledge graph to obtain the target table structure information, including: Extract keywords based on the query conditions to obtain initial keywords; Performing vocabulary generalization processing based on the initial keywords to obtain target keywords; Based on the target keyword, searching for directly related target nodes in the metadata knowledge graph; Based on the metadata knowledge graph, determining multiple local subgraphs within N hops of the target node; Based on the target keyword, the multiple local subgraphs are traversed and searched to obtain target table structure information.

[0054] Specifically, based on the query conditions, that is, taking the query task prompts and thinking chains as queries, keyword extraction is performed through the large language model service capabilities to obtain initial keywords.

[0055] Furthermore, through the large language model service capability, the initial keywords are subjected to vocabulary generalization processing, including but not limited to case generalization processing, alias generalization processing, synonym generalization processing, etc., to obtain the target keywords.

[0056] Furthermore, based on the target keywords, directly related target nodes are found in the metadata knowledge graph.

[0057] Furthermore, based on the metadata knowledge graph, multiple local subgraphs within N hops of the target node are determined, where N is set according to actual conditions.

[0058] Furthermore, based on the target keywords, depth-first search or breadth-first search can be used to traverse and search multiple local subgraphs, and finally recall the target table structure information that is most relevant to the user input. During this query process, if the recalled table structure information is wrong, the current thinking step will be corrected again based on the target keywords until the correct target table structure information is recalled.

[0059] The embodiments of the present invention combine the knowledge graph and retrieval enhancement generation technology to perform data query under the correct reasoning steps, which can greatly improve the accuracy and efficiency of the query, while enriching the semantic relevance and information volume of the query results, achieving a more intelligent data retrieval experience, and greatly reducing the need for manual intervention.

[0060] In some embodiments, based on step 103, generating a target prompt word based on the user query data and the target table structure information includes: Based on the user query data and the target table structure information, the predefined first prompt word, second prompt word, third prompt word and fourth prompt word are filled in respectively to obtain the first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word; the first prompt word is used to reflect the scenario to which the query data is applied; the second prompt word is used to instruct the model to perform a specific operation; the third prompt word is used to guide the output format of the large model; the fourth prompt word is used to reflect the user query demand; The first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word are integrated to obtain a target prompt word.

[0061] Before executing this step, the first prompt word, the second prompt word, the third prompt word and the fourth prompt word are pre-defined, wherein the first prompt word is used to reflect the scenario in which the query data is applied, the second prompt word is used to instruct the model to perform a specific operation, the third prompt word is used to guide the output format of the large model, and the fourth prompt word is used to reflect the user's query requirements. These prompt words can be used to guide the large model to perform analysis and predict the corresponding SQL statement to return the data queried by the user.

[0062] Specifically, based on the user query data and the target table structure information, the predefined first prompt word, second prompt word, third prompt word and fourth prompt word are filled in respectively to obtain the first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word.

[0063] Furthermore, the first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word are integrated to obtain the target prompt word.

[0064] The embodiment of the present invention can effectively guide the large model to generate accurate SQL statements through a refined prompt word filling and integration method, significantly improve the conversion efficiency and quality of natural language queries to SQL statements, ensure accurate parsing of user input data and efficient use of target table structure information, provide more dynamic and personalized analysis results, and thus enhance the overall query intelligence level and user-friendliness.

[0065] In one embodiment, the interactive business intelligence analysis method further includes: Obtain input data requested by users to generate visualization reports; Inputting the input data into a pre-trained reinforcement learning model to obtain a drawing code output by the reinforcement learning model; Execute the drawing code and return the target visualization report generated by the user's request.

[0066] It should be noted that the interactive business intelligence analysis method also includes the development of Text2Code agents to achieve intelligent and diversified visual report generation, breaking the traditional fixed report model. It aims to enable users to raise data exploration and visualization requirements in a dialogue manner through natural language processing technology, and obtain responsive icons or reports in a timely manner.

[0067] Specifically, the input data for the user's request to generate a visualization report is obtained. The input data can be the input text for the user's request to generate a visualization report, or the input audio for the user's request to generate a visualization report. It needs to be further converted into input text. The conversion method is the same as above and will not be repeated here.

[0068] Furthermore, the input data is input into the pre-trained reinforcement learning model to obtain the drawing code output by the reinforcement learning model.

[0069] Furthermore, the drawing code is executed to return the target visualization report generated by the user's request.

[0070] The embodiments of the present invention utilize advanced algorithms and reinforcement learning techniques to process larger amounts of data, and to achieve the generation of intelligent and diversified visual reports without relying entirely on predefined rules, thereby breaking the traditional fixed report model and providing more flexible and personalized analysis solutions, thereby better supporting the enterprise's data-driven decision-making and continuous optimization.

[0071] In some embodiments, the reinforcement learning model is obtained by pre-training in the following manner: Through the interaction between the agent and the environment, multiple experience samples are obtained, and the multiple experience samples are stored in the experience pool; each experience sample includes a current state, an action, a current reward and a next state; the current state represents sample input data for a user's request to generate a visualization report; the action represents a sample drawing code for generating a visualization report; Randomly extracting a fixed number of target experience samples from the experience pool for model training; Based on the target experience sample, calculating the advantage value of each state-action pair; Calculate the policy gradient based on multiple advantage values; Based on the policy gradient, updating policy parameters; The step of randomly extracting a fixed number of target experience samples from the experience pool for model training is iteratively executed until the strategy converges or the preset performance target is met, thereby obtaining a pre-trained reinforcement learning model.

[0072] Specifically, a large amount of sample input data of user requests to generate visualization reports and sample drawing codes for generating visualization reports are collected, and they are associated and paired to obtain sample input data-sample drawing code pairs, which are used as training sets. The visualization part uses the echarts framework language, so the collected sample input data and sample drawing codes should both be drawing-related data, especially the code part should be the sample drawing code implemented using echarts.

[0073] Furthermore, we build a reinforcement learning framework called Reinforcement Learning from Human Feedback (RLHF). The RLHR process uses a pre-trained model and fine-tunes it in a supervised manner, and then further aligns it through proximal policy optimization (PPO). The RLHR process is divided into the following steps.

[0074] Step 1 of the RLHR process: supervised fine-tuning of the pre-trained model. In this stage, the collected paired sample input data-sample drawing code pairs are mainly used. During the training process of this process, the input is text and the output is the code written by echarts.

[0075] RLHR Pipeline Step 2: Create a Reward Model. In this step, the supervised fine-tuned model is used to create a reward model. For each input text, multiple code replies (usually 4 to 9) are generated using the supervised fine-tuned model from the previous step. These code replies are then ranked based on personal preferences. After collating the ranked dataset, a reward model is designed to output a reward score for the subsequent optimization phase in RLHF Step 3.

[0076] The overall architecture of the reward model (RM) is based on the fine-tuned model obtained in the previous supervised fine-tuning step. In order to convert the model in the first step into a reward model, its output layer is replaced by a regression layer, which has only one output node. That is, the last layer does not use softmax, but is replaced by a linear layer, so that the modified model can generate continuous numerical values ​​as reward signals for subsequent reinforcement learning processes. The advantage of using a fine-tuned model is that the trained model parameters can be reused, which means that there is no need to retrain large models from scratch, thus saving a lot of training time and computing resources.

[0077] In the loss function part, the loss function design of the reward model is also a key link. It usually consists of two parts: one is to evaluate the accuracy of the reward model's prediction, and the other is to punish the difference between the predicted reward score and the real human feedback. Considering the smoothness of the reward, when the reward is within a certain range, the function is relatively smooth, which helps the model avoid excessive fluctuations during the learning process. In addition, by adjusting hyperparameters, such as the value of λ, the intensity of the penalty can be controlled to ensure that the model can effectively optimize its predicted reward score during the learning process.

[0078] The loss function of the reward model uses Pairwise Ranking Loss, and the formula is as follows:

[0079] in: D: Dataset where answers are manually ranked; x: question in dataset D; and : Two of the K answers to question x, and The sort ratio High, because it is a pair, it is also called pairwise; : The RM model to be trained, the scalar score obtained for the input pair x and y; θ: Parameters that need to be optimized in the RM model.

[0080] The goal of the RM model is to make the answers with high ranking The corresponding scalar score is higher than the answer with lower ranking The corresponding scalar score, and the higher the better, that is, making the loss function The larger the difference, the better. The subtracted scores are passed through the sigmoid function, and the difference becomes between -1 and 1. Since the sigmoid function is a monotonically increasing function, The bigger the better. The closer it is to 1, the Compare The higher the ranking, the higher the 1 category, and the lower the ranking, the lower the 1 category, so this can also be seen as a binary classification problem. Adding the logistic function, it is equivalent to the cross entropy loss function. For each question, there are K answers, and the loss function is divided by , so that the loss function value will not change too much due to the change of K. The ultimate goal of the loss function is to minimize , and maximize Corresponding.

[0081] RLHF Step 3: Fine-tuning via Proximal Policy Optimization (PPO). In this step, the model is updated using Proximal Policy Optimization (PPO) based on the reward scores output by the reward model (in RLHF Step 2). The core idea of ​​PPO is to limit the magnitude of the policy update so that the policy does not deviate too much from the original policy when it is updated. To achieve this, a concept called "trust region" is introduced. The trust region refers to the maximum range of differences allowed between the new policy and the old policy after the policy is updated. Within this range, the policy update is considered safe and will not cause instability in the learning process.

[0082] The implementation of this strategy can be implemented using Python's Stable Baselines3 library. The detailed steps are as follows: 1. Experience acquisition. First, through the interaction between the agent and the environment, multiple experience samples are obtained and stored in the experience pool. Each experience sample includes the current state, action, current reward and next state. The current state represents the sample input data for the user's request to generate a visualization report, and the action represents the sample drawing code for generating a visualization report. These experience samples form the basis of learning and help the agent understand the consequences of its behavior.

[0083] 2. Advantage calculation. Randomly extract a fixed number of target experience samples from the experience pool for model training. Based on the target experience samples, calculate the advantage value of each state-action pair. The advantage function measures the deviation of the benefit of taking an action in a given state from the average expected benefit. This can be estimated by a variety of techniques, such as the Generalized Advantage Estimation (GAE) technique, which can provide more stable gradient estimates and reduce variance.

[0084] 3. Policy update. The policy gradient algorithm is applied to calculate the policy gradient based on multiple advantage values, and the policy parameters are updated based on the policy gradient, with the goal of making the agent tend to take actions with higher advantages. In the PPO algorithm, a shearing mechanism is introduced when updating the policy to limit the degree of change of the new policy relative to the old policy to prevent performance collapse caused by overly aggressive policy updates. Specifically, the shearing factor controls the range of variation of the probability ratio of the new and old policies, and is usually set within a reasonable range, such as [0.8, 1.2], to ensure a smooth transition of the policy.

[0085] 4. Iteration loop. This process is a cycle that requires repeated experience acquisition, advantage calculation, and policy update steps until policy convergence is achieved or the predetermined performance target is met. With each iteration, the agent gradually learns how to act more effectively in the environment, eventually reaching a higher level of performance.

[0086] Through the pre-training process, the embodiment of the present invention can effectively learn the strategy for generating visualization reports, so that the model can automatically generate corresponding drawing codes according to the input data requested by the user, thereby improving the automation and efficiency of visualization report generation, while ensuring that the generated visualization report can meet the needs of the user, achieving the purpose of accurately matching input data with drawing actions.

[0087] Based on the above, it can be concluded that the interactive business intelligence analysis method provided by the embodiment of the present invention achieves the following effects: (1) Using artificial intelligence and machine learning technologies, especially large-scale pre-trained models, it is possible to process and analyze unstructured and semi-structured data, as well as to perform more complex data relationship understanding and pattern recognition. Users can interact through natural language, query data and generate reports in the form of dialogue, which lowers the threshold for use.

[0088] (2) For traditional BI, users interact with data through fixed reports, dashboards, and query tools, and usually need to have certain technical knowledge to construct queries or understand complex data views. BI based on big models introduces conversational interaction, where users can ask questions directly. The system can understand natural language instructions and perform corresponding data analysis tasks, which improves flexibility and efficiency, lowers the threshold for use, and enables business personnel with non-technical backgrounds to easily obtain data insights.

[0089] (3) The large model BI has a high level of intelligence, with built-in advanced artificial intelligence and automated learning mechanisms. It can automatically discover data patterns, perform predictive analysis and make recommendations, greatly reducing the need for human intervention and improving the accuracy and efficiency of analysis.

[0090] (4) Providing more flexible analytical capabilities that can dynamically explore data, identify new trends and anomalies, and support more in-depth and detailed analysis, including the discovery of nonlinear relationships and the inference of complex causal relationships.

[0091] (5) It has the ability of self-learning and optimization, and can continuously improve the accuracy of analysis models and results based on user feedback and new data input.

[0092] The interactive business intelligence analysis device provided by the present invention is described below. The interactive business intelligence analysis device described below and the interactive business intelligence analysis method described above can be referenced to each other.

[0093] Reference Figure 2 , Figure 2 It is a structural schematic diagram of the interactive business intelligence analysis device provided by the present invention.

[0094] The interactive business intelligence analysis device comprises: The acquisition module 210 is used to acquire user query data.

[0095] The query module 220 is used to query the metadata knowledge graph based on the user query data to obtain the target table structure information.

[0096] The prompt word generation module 230 is used to generate target prompt words based on the user query data and the target table structure information.

[0097] The SQL statement generation module 240 is used to input the target prompt word into the large model to obtain the SQL statement corresponding to the user query data output by the large model.

[0098] The query data return module 250 is used to execute the SQL statement and return the target data queried by the user.

[0099] The interactive business intelligence analysis device provided by the present invention allows users to query the system for required data in an interactive manner. The system can understand natural language instructions, and by combining knowledge graphs and big model technologies, it can perform corresponding data analysis tasks, automatically discover data patterns, perform predictive analysis and recommendations, greatly reducing the need for manual intervention and improving the accuracy and efficiency of data analysis. Ultimately, efficient and accurate query data extraction is achieved, thereby improving the flexibility and efficiency of business intelligence analysis, while lowering the usage threshold, so that non-technical users can also easily obtain data insights through natural language.

[0100] Furthermore, the acquisition module 210 is also used for: Acquire user input text, and determine the user input text as user query data; Or, the audio content input by the user is obtained, speech recognition is performed on the audio content, the text content of the audio file is obtained, and the text content is determined as the user query data.

[0101] Furthermore, the query module 220 is also used for: Performing intent analysis on the user query data to obtain the query intent; Based on the query intent, generate a query task prompt; Using thought chain technology, generating a thought chain based on the query task prompt; Generate query conditions based on the query task prompt and the thinking chain; Based on the query conditions, a query is performed through the metadata knowledge graph to obtain the target table structure information.

[0102] Furthermore, the query module 220 is also used for: Extract keywords based on the query conditions to obtain initial keywords; Performing vocabulary generalization processing based on the initial keywords to obtain target keywords; Based on the target keyword, searching for directly related target nodes in the metadata knowledge graph; Based on the metadata knowledge graph, determining multiple local subgraphs within N hops of the target node; Based on the target keyword, the multiple local subgraphs are traversed and searched to obtain target table structure information.

[0103] Furthermore, the prompt word generating module 230 is also used for: Based on the user query data and the target table structure information, the predefined first prompt word, second prompt word, third prompt word and fourth prompt word are filled in respectively to obtain the first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word; the first prompt word is used to reflect the scenario to which the query data is applied; the second prompt word is used to instruct the model to perform a specific operation; the third prompt word is used to guide the output format of the large model; the fourth prompt word is used to reflect the user query demand; The first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word are integrated to obtain a target prompt word.

[0104] Furthermore, the interactive business intelligence analysis device is also used for: Obtain input data requested by users to generate visualization reports; Inputting the input data into a pre-trained reinforcement learning model to obtain a drawing code output by the reinforcement learning model; Execute the drawing code and return the target visualization report generated by the user's request.

[0105] Furthermore, the interactive business intelligence analysis device is also used for: Through the interaction between the agent and the environment, multiple experience samples are obtained, and the multiple experience samples are stored in the experience pool; each experience sample includes a current state, an action, a current reward and a next state; the current state represents sample input data for a user's request to generate a visualization report; the action represents a sample drawing code for generating a visualization report; Randomly extracting a fixed number of target experience samples from the experience pool for model training; Based on the target experience sample, calculating the advantage value of each state-action pair; Calculate the policy gradient based on multiple advantage values; Based on the policy gradient, updating policy parameters; The step of randomly extracting a fixed number of target experience samples from the experience pool for model training is iteratively executed until the strategy converges or the preset performance target is met, thereby obtaining a pre-trained reinforcement learning model.

[0106] It should be noted that the interactive business intelligence analysis device provided by the present invention can execute the interactive business intelligence analysis method described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.

[0107] Figure 3is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310, a communications interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communications interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the interactive business intelligence analysis method, which includes: obtaining user query data; querying through the metadata knowledge graph based on the user query data to obtain target table structure information; generating target prompt words based on the user query data and the target table structure information; inputting the target prompt words into the big model to obtain the SQL statement corresponding to the user query data output by the big model; executing the SQL statement to return the target data of the user query.

[0108] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0109] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the interactive business intelligence analysis method provided by the above-mentioned embodiments, and the method includes: obtaining user query data; based on the user query data, querying through a metadata knowledge graph to obtain target table structure information; based on the user query data and the target table structure information, generating target prompt words; inputting the target prompt words into a large model to obtain an SQL statement corresponding to the user query data output by the large model; executing the SQL statement to return the target data of the user query.

[0110] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the interactive business intelligence analysis method provided in the above-mentioned embodiments, the method comprising: obtaining user query data; based on the user query data, querying through a metadata knowledge graph to obtain target table structure information; based on the user query data and the target table structure information, generating a target prompt word; inputting the target prompt word into a large model to obtain an SQL statement corresponding to the user query data output by the large model; executing the SQL statement to return the target data of the user query.

[0111] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.

[0112] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An interactive business intelligence analysis method, characterized in that: include: Get user query data; Based on the user query data, query through the metadata knowledge graph to obtain the target table structure information; Generate a target prompt word based on the user query data and the target table structure information; Input the target prompt word into the big model to obtain the SQL statement corresponding to the user query data output by the big model; Execute the SQL statement and return the target data queried by the user.

2. The interactive business intelligence analysis method according to claim 1, characterized in that: The query based on the user query data is performed through the metadata knowledge graph to obtain the target table structure information, including: Performing intent analysis on the user query data to obtain the query intent; Based on the query intent, generate a query task prompt; Using thought chain technology, generating a thought chain based on the query task prompt; Generate query conditions based on the query task prompt and the thinking chain; Based on the query conditions, a query is performed through the metadata knowledge graph to obtain the target table structure information.

3. The interactive business intelligence analysis method according to claim 2, characterized in that: Based on the query condition, querying through the metadata knowledge graph to obtain the target table structure information includes: Extract keywords based on the query conditions to obtain initial keywords; Performing vocabulary generalization processing based on the initial keywords to obtain target keywords; Based on the target keyword, searching for directly related target nodes in the metadata knowledge graph; Based on the metadata knowledge graph, determining multiple local subgraphs within N hops of the target node; Based on the target keyword, the multiple local subgraphs are traversed and searched to obtain target table structure information.

4. The interactive business intelligence analysis method according to claim 1, characterized in that: The generating of target prompt words based on the user query data and the target table structure information includes: Based on the user query data and the target table structure information, the predefined first prompt word, second prompt word, third prompt word and fourth prompt word are filled in respectively to obtain the first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word; the first prompt word is used to reflect the scenario to which the query data is applied; the second prompt word is used to instruct the model to perform a specific operation; the third prompt word is used to guide the output format of the large model; the fourth prompt word is used to reflect the user query demand; The first target prompt word, the second target prompt word, the third target prompt word and the fourth target prompt word are integrated to obtain a target prompt word.

5. The interactive business intelligence analysis method according to claim 1, characterized in that: The obtaining of user query data includes: Acquire user input text, and determine the user input text as user query data; Or, the audio content input by the user is obtained, speech recognition is performed on the audio content, the text content of the audio file is obtained, and the text content is determined as the user query data.

6. The interactive business intelligence analysis method according to claim 1, characterized in that: The interactive business intelligence analysis method further includes: Obtain input data requested by users to generate visualization reports; Inputting the input data into a pre-trained reinforcement learning model to obtain a drawing code output by the reinforcement learning model; Execute the drawing code and return the target visualization report generated by the user's request.

7. The interactive business intelligence analysis method according to claim 6, wherein the reinforcement learning model is obtained by pre-training in the following manner: Through the interaction between the agent and the environment, multiple experience samples are obtained, and the multiple experience samples are stored in the experience pool; each experience sample includes a current state, an action, a current reward and a next state; the current state represents sample input data for a user's request to generate a visualization report; the action represents a sample drawing code for generating a visualization report; Randomly extracting a fixed number of target experience samples from the experience pool for model training; Based on the target experience sample, calculating the advantage value of each state-action pair; Calculate the policy gradient based on multiple advantage values; Based on the policy gradient, updating policy parameters; The step of randomly extracting a fixed number of target experience samples from the experience pool for model training is iteratively executed until the strategy converges or the preset performance target is met, thereby obtaining a pre-trained reinforcement learning model.

8. An interactive business intelligence analysis device, characterized in that: include: Acquisition module, used to obtain user query data; A query module, used to query the metadata knowledge graph based on the user query data to obtain the target table structure information; A prompt word generation module, used for generating target prompt words based on the user query data and the target table structure information; An SQL statement generation module, used for inputting the target prompt word into the big model, and obtaining the SQL statement corresponding to the user query data output by the big model; The query data return module is used to execute the SQL statement and return the target data queried by the user.

9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the interactive business intelligence analysis method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, the computer-readable storage medium comprising a non-transitory computer-readable storage medium, having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the interactive business intelligence analysis method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Generative BI method and device based on voice dialogue and storage medium

    CN120496516A

  • Data query method, device and equipment based on APaaS platform and medium

    CN121501969A

  • Automatic report query method and query device

    CN121722768A