Data trend analysis method, device, equipment, storage medium and program product

By using large language models and preset deep learning models and time series models, the problem of professional knowledge required by traditional data analysis methods is solved, and natural language query directly interacts with the database, improving data analysis efficiency and prediction accuracy.

CN118227742BActive Publication Date: 2025-03-07RAJAX NETWORK &TECHNOLOGY (SHANGHAI) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410650072.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2025-03-07
Estimated Expiration
2044-05-24

AI Technical Summary

Technical Problem

Traditional data analysis methods require users to have the basis of structured query language, which increases the difficulty of data analysis, resulting in low efficiency and poor flexibility.

Method used

By obtaining target question and answer examples that match the user's natural language query text, a large language model is called to generate structured query statements, and data trend analysis is performed in combination with preset deep learning models and time series models.

Benefits of technology

It improves the relevance and accuracy of statement generation, reduces the difficulty of user operations, improves data analysis efficiency and prediction accuracy, and enables non-technical users to use natural language query to achieve complex data analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118227742B_ABST
    Figure CN118227742B_ABST
Patent Text Reader

Abstract

The present application discloses a data trend analysis method, device, equipment, storage medium and program product, which relates to the field of computer technology. The method includes: obtaining a target question and answer example that matches a natural language query text; calling a large language model to generate a structured query statement based on the target question and answer example and the natural language query text; using the structured query statement to query the target database to obtain the query result; calling a deep learning model and a time series model to perform trend analysis based on the query result. Since the target question and answer example can guide the large language model to generate a structured query statement for the natural language query text, the relevance and accuracy of the statement generation can be improved, so that the user can directly interact with the database in the form of natural language, which reduces the difficulty of user operation, and combines the respective advantages of the two models to predict future trends based on the query results, which can effectively learn the linear and nonlinear characteristics of the data and effectively improve the prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data trend analysis method, device, equipment, storage medium and program product. Background Art

[0002] In the sales industry, analytical insights into product data are key considerations in the formulation of platform business strategies. For example, when preparing for a marketing campaign, operators need to know which popular categories are currently on the entire network to help them select circles with better results for delivery.

[0003] Traditional solutions require users to write structured query statements to query the product database according to their needs, and then users perform insight analysis on the queried product data.

[0004] However, this solution requires users to have a basic knowledge of structured query language, which increases the difficulty of data analysis and leads to low efficiency and poor flexibility. Summary of the invention

[0005] The purpose of this application is to propose a data trend analysis method, device, equipment, storage medium and program product to address the deficiencies of the above-mentioned prior art, and this purpose is achieved through the following technical solutions.

[0006] The first aspect of the present application proposes a data trend analysis method, the method comprising:

[0007] Obtaining a target question and answer example that matches the user's natural language query text; the target question and answer example is used to provide a reference for a large language model to generate a structured query statement for the natural language query text;

[0008] Based on the target question and answer example and the natural language query text, calling the large language model to generate a structured query statement of the natural language query text;

[0009] Querying the target database using the structured query statement to obtain query results;

[0010] Based on the query results, a preset deep learning model and a preset time series model are called to perform data trend analysis.

[0011] In an optional embodiment, the step of calling the large language model to generate a structured query statement of the natural language query text based on the target question and answer example and the natural language query text includes:

[0012] Obtaining historical interaction records between the user and the large language model;

[0013] According to the target question and answer example, the historical interaction record and the natural language query text, the large language model is called to obtain a structured query statement of the natural language query text.

[0014] In an optional embodiment, the step of calling the large language model to obtain a structured query statement of the natural language query text according to the target question and answer example, the historical interaction record, and the natural language query text includes:

[0015] Constructing a prompt of the large language model according to a preset prompt template, the target question and answer example, and the natural language query text;

[0016] Using the prompt and the historical interaction record to call the large language model;

[0017] Verifying the output text of the large language model to obtain a verification result;

[0018] If the verification result is successful, using the output text as a structured query statement of the natural language query text;

[0019] When the verification result is a failure, a structured query statement of the natural language query text is generated using keywords in the output text and a preset structured statement rule template; the keywords are information extracted from the natural language query text.

[0020] In an optional embodiment, verifying the output text of the large language model to obtain a verification result includes:

[0021] Performing regular expression matching on the output text to obtain query statement structure information;

[0022] Performing syntax calibration on the query statement structure information to obtain a verification result; and / or,

[0023] Keyword calibration is performed on the query sentence structure information to obtain a verification result.

[0024] In an optional embodiment, obtaining a target question and answer example matching the user's natural language query text includes:

[0025] Vectorizing the natural language query text to obtain a text vector;

[0026] Querying a target vector matching the text vector in a preset example library; the example library records a plurality of question-and-answer examples, each of which includes a general query text, a query statement of the general query text, and a vector of the general query text;

[0027] The question and answer example corresponding to the target vector in the example library is used as the target question and answer example.

[0028] In an optional embodiment, based on the query result, calling a preset deep learning model and a preset time series model to perform data trend analysis includes:

[0029] Extracting time series data from the query results;

[0030] Extracting features of different dimensions based on the time series data; the different dimensions include any combination of trend dimension, seasonal dimension and residual component dimension;

[0031] Calling the time series model to predict future trends based on the extracted features of different dimensions to obtain a first prediction value; the time series model is used to predict the linear characteristics of the data trend;

[0032] Calling the deep learning model to predict future trends based on the extracted features of different dimensions to obtain a second prediction value; the deep learning model is used to predict the nonlinear characteristics of data trends;

[0033] A weighted fusion result of the first prediction value and the second prediction value is used as a trend analysis result.

[0034] In an optional embodiment, extracting features of different dimensions based on the time series data includes:

[0035] Using a target window to perform movement estimation in the time series data to obtain trend characteristics;

[0036] After subtracting the trend feature from the time series data, the average value in each seasonal cycle is calculated to obtain the seasonal feature;

[0037] The trend characteristic and the seasonal characteristic are subtracted from the time series data to obtain the residual component characteristic.

[0038] In an optional embodiment, after calling a preset deep learning model and a preset time series model to perform data trend analysis based on the query result, the method further includes:

[0039] The query result and the trend analysis result are returned to the client of the user, so that the client displays the query result and the trend analysis result.

[0040] A second aspect of the present application provides a data trend analysis device, the device comprising:

[0041] An example acquisition module is used to acquire a target question and answer example that matches the user's natural language query text; the target question and answer example is used to provide a reference for the large language model to generate a structured query statement for the natural language query text;

[0042] A conversion module, configured to call the large language model to generate a structured query statement of the natural language query text based on the target question and answer example and the natural language query text;

[0043] A data query module, used to query the target database using the structured query statement to obtain the query result;

[0044] The prediction module is used to call a preset deep learning model and a preset time series model to perform data trend analysis based on the query results.

[0045] The third aspect of the present application proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect above.

[0046] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the program is executed by a processor to implement the method described in the first aspect above.

[0047] An embodiment of the fifth aspect of the present application provides a computer program product, including a computer program, wherein the computer program is executed by a processor to implement the method described in the first aspect above.

[0048] Based on the data trend analysis method described in the first aspect above, the present application has at least the following beneficial effects or advantages:

[0049] By using a large language model based on the user's natural language query text and a target question and answer example that matches the natural language query text, a structured query statement of the natural language query text is obtained, and the structured query statement is executed to query the database. Since the target question and answer example can guide the large language model to generate a structured query statement of the natural language query text, the relevance and accuracy of the statement generation can be improved, so that the user can directly interact with the database in the form of natural language, reducing the difficulty of user operation. Further, by using a preset deep learning model and a preset time series model, the deep learning model is used to learn the nonlinear characteristics of the data, and the time series model is used to learn the linear characteristics of the data, so as to combine the respective advantages of the two models to perform real-time future trend prediction based on the query results returned by the database, which can effectively learn the linear and nonlinear characteristics of the data, effectively improve the prediction accuracy, and assist users in data insight analysis. It can be seen that the data analysis efficiency and automation can be improved through the present application scheme, so that non-technical users can use natural language queries to realize the analysis of complex data.

[0050] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0052] Figure 1 is an architecture diagram of a data trend analysis system according to an exemplary embodiment;

[0053] Figure 2 is an architecture diagram of another data trend analysis system according to an exemplary embodiment;

[0054] Figure 3 is a flow chart of a data trend analysis method according to an exemplary embodiment;

[0055] Figure 4 This is a diagram showing an implementation architecture of data trend analysis according to an exemplary embodiment;

[0056] Figure 5A This is a schematic diagram of an interface for a client to initiate a request according to an exemplary embodiment;

[0057] Figure 5BThis is a schematic diagram of an interface for displaying results on a client according to an exemplary embodiment;

[0058] Figure 6 A flow chart is generated for a structured query statement in a data trend analysis method according to an exemplary embodiment;

[0059] Figure 7 is a structural schematic diagram of a data trend analysis device according to an exemplary embodiment;

[0060] Figure 8 is a schematic diagram of a hardware structure of an electronic device according to an exemplary embodiment;

[0061] Fig. 9 The figure is a schematic diagram of the structure of a storage medium according to an exemplary embodiment. DETAILED DESCRIPTION

[0062] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of systems and methods consistent with some aspects of the present application as detailed in the appended claims.

[0063] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0064] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0065] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0066] In order to reduce the difficulty of user operation and improve the efficiency of data analysis, this application proposes a data trend analysis method. By converting the user's natural language into database query statements, the user is allowed to interact with the database directly in natural language, thereby realizing interactive question-and-answer capabilities based on the database. At the same time, by predicting future trends of the database's return results, real-time trend analysis results are obtained to help users gain data insights.

[0067] The implementation process is: obtain the target question and answer examples that match the user's natural language query text, and use the large language model to obtain the structured query statement of the natural language query text based on the user's natural language query text and the target question and answer examples, and execute the structured query statement to implement database query, thereby reducing the difficulty of user operation. Further, by using the preset deep learning model and the preset time series model, the deep learning model is used to learn the nonlinear characteristics of the data, and the time series model is used to learn the linear characteristics of the data. The respective advantages of the two models are combined to perform real-time future trend prediction based on the query results returned by the database. It can effectively learn the linear and nonlinear characteristics of the data, effectively improve the prediction accuracy, and assist users in data insight analysis.

[0068] It can be seen that the present application solution can improve the efficiency and automation of data analysis, allowing non-technical users to use natural language queries to analyze complex data.

[0069] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The several specific embodiments listed can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0070] See also Figure 1 , Figure 1 An architecture diagram of a data trend analysis system provided by an embodiment of the present specification is shown. The data trend analysis system may include a client 100 and a server 200;

[0071] The client 100 is used to send a natural language query text to the server 200;

[0072] The server 200 is used to obtain a target question and answer example that matches the user's natural language query text; the target question and answer example is used to provide a reference for the large language model to generate a structured query statement for the natural language query text; based on the target question and answer example and the natural language query text, the large language model is called to generate a structured query statement for the natural language query text; the structured query statement is used to query the target database to obtain the query result; based on the query result, a preset deep learning model and a preset time series model are called to perform data trend analysis;

[0073] The client 100 is also used to receive the trend analysis results and query results sent by the server 200.

[0074] The solution of the embodiment of this specification is applied. Since the user only needs to interact with the database directly in natural language, the user operation difficulty is low. In addition, in the process of generating structured query statements for the user's natural language query text, the large language model combines the reference information provided by the target question and answer examples that match the natural language query text, so that the large language model can use the target question and answer examples to generate query statements that are closer to the intention of the natural language query text, thereby improving the relevance and accuracy of query statement generation. At the same time, by using a combination of a preset deep learning model and a preset time series model, real-time future trend predictions are performed based on the query results returned by the database, effectively improving the prediction accuracy, and assisting users in data insight analysis. In summary, this solution can improve the efficiency and automation of data analysis, allowing non-technical users to use natural language queries to perform complex data analysis.

[0075] See also Figure 2 , Figure 2 The architecture diagram of another data trend analysis system provided by an embodiment of the present specification is shown. The data trend analysis system may include multiple clients 100 and a server 200, wherein the client 100 may be a terminal device and the server 200 may be a cloud device. A communication connection may be established between multiple clients 100 through the server 200. In the data trend analysis scenario, the server 200 is used to provide data trend analysis services between multiple clients 100. Multiple clients 100 may serve as a sender or a receiver respectively, and communication is achieved through the server 200.

[0076] The user can interact with the server 200 through the client 100 to receive data sent by other clients 100, or send data to other clients 100, etc. In the data trend analysis scenario, the user can publish a data stream to the server 200 through the client 100, and the server 200 returns the processing result according to the data stream and pushes the processing result to other clients that have established communication.

[0077] The client 100 and the server 200 are connected via a network. The network provides a medium for a communication link between the client 100 and the server 200. The network may include various connection types, such as wired or wireless communication links or optical fiber cables, etc. The data transmitted by the client 100 may need to be encoded, transcoded, compressed, etc. before being released to the server 200.

[0078] The client 100 can be a browser, an APP (Application), or a web application such as an H5 (HyperText Markup Language 5, the fifth edition of Hypertext Markup Language) application, or a light application (also known as a mini-program, a lightweight application) or a cloud application, etc. The client 100 can be based on the software development kit (SDK, Software Development Kit) of the corresponding service provided by the server 200, such as based on the real-time communication (RTC, Real Time Communication) SDK development and acquisition. The client 100 can be deployed in an electronic device, and needs to rely on the device to run or some APPs in the device to run. For example, the electronic device can have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications can also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, mailbox clients, social platform software, etc.

[0079] The server 200 may include servers that provide various services, such as servers that provide communication services to multiple clients, servers for background training that provide support for models used on clients, and servers that process data sent by clients. It should be noted that the server 200 can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. The server can also be a server of a distributed system, or a server combined with a blockchain. The server can also be a cloud server for basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0080] It is worth noting that the data trend analysis method provided in the embodiments of this specification is generally executed by the server, but in other embodiments of this specification, the client may also have similar functions to the server, thereby executing the data trend analysis method provided in the embodiments of this specification. In other embodiments, the data trend analysis method provided in the embodiments of this specification may also be jointly executed by the client and the server.

[0081] See also Figure 3 , Figure 3 A flow chart of a data trend analysis method provided by an embodiment of this specification is shown. This embodiment is based on a server in a data trend analysis system as an execution subject and includes the following steps:

[0082] Step 301: Obtain a target question and answer example that matches the user's natural language query text, where the target question and answer example is used to guide the large language model to generate a structured query statement for the natural language query text;

[0083] Step 302: Based on the target question and answer example and the natural language query text, call the large language model to generate a structured query statement of the natural language query text;

[0084] Step 303: query the target database using the structured query statement to obtain query results;

[0085] Step 304: Based on the query result, call the preset deep learning model and the preset time series model to perform data trend analysis.

[0086] In this embodiment, the natural language query text is a specific query requirement described by the user in natural language, which is used to indicate what kind of data to be understood or queried, for example, "I want to know the recent hot trends", "Query the hot categories in a certain area in the past 7 days", "Query the names of products with a click rate greater than 0.1 in the past 7 days", etc. The natural language query text can be a query text directly input by the user, or a query text obtained by converting the voice input by the user, which is not specifically limited in this application.

[0087] The target question and answer example can be understood as a related example of an existing text-converted query statement, which is used to provide learning reference information for the large language model to generate structured query statements of natural language query text. The target question and answer example may include a query text and a query statement of the query text, and the semantics or content of the user's natural language query text may be close to the semantics or content of the query text. In addition, there may be one or more target question and answer examples that match the natural language query text, which is not limited in this application.

[0088] The large language model can be understood as a large language model (LLM) with large-scale model parameters, which can realize the understanding and generation of text. In the embodiment of the present application, the target question and answer example enables the large language model to generate structured query statements that are closer to the intention of the natural language query text.

[0089] A structured query statement can be understood as a statement constructed using the Structured Query Language (SQL) for retrieving data from a database. It can also be called an SQL statement. By establishing and executing an SQL statement with a target database, database queries can be implemented.

[0090] The target database is a database that can be operated by SQL statements, which can be a relational database system. In different application scenarios, different data tables are built in the target database. For example, in the commodity trend insight scenario, the data tables built in the target database can cover all aspects of the commodity data: popular commodities, category trends, search term recommendations, etc.

[0091] The query result can be understood as the query data returned by the target database according to the structured query statement. The query result can include time series data and / or non-time series data. For example, the click rate of a brand in the past 7 days is time series data, and the search terms that appeared in the past month are non-time series data.

[0092] A deep learning model is a model used to capture the nonlinear characteristics and short-term fluctuations of input data, that is, a model used to predict the nonlinear characteristics of data trends. For example, LSTM (Long Short-Term Memory) model, RNN (Recurrent Neural Network) model, GRU (Gated Recurrent Unit) network, TCNs (Temporal Convolutional Networks) model, etc. can be used. As long as it can realize the prediction of nonlinear characteristics of sequence data, this application does not limit the structural type of deep learning models.

[0093] A time series model is a model used to capture the long-term and periodic characteristics of input data, that is, a linear characteristic used to predict data trends. For example, ARIMA (Autoregressive Integrated Moving Average Model), SARIMA (Seasonal Autoregressive Integrated Moving Average), etc. can be used. As long as the linear characteristics of the sequence data can be predicted, this application does not limit the structural type of the time series model.

[0094] For example, the user's natural language query text query="Query the sales of brand 1" obtains the target question and answer example that matches "Query the sales of brand 1". Assume that there is a sales_data table in the target database, which contains the fields: brand_name (brand name) and sales_volume (sales volume); then based on the target question and answer example and "Query the sales of brand 1", call the large language model to obtain the SQL statement = SELECT SUM(sales_volume) AS total_sales FROMsales_data WHERE brand_name = 'Brand 1'. In this SQL statement, SELECT SUM(sales_volume) AS total_sales calculates the total sales of "Brand 1", and the WHERE clause limits the queried brand to "Brand 1"; finally, use this SQL statement to query the target database to obtain the query results, and call the deep learning model and time series model based on the query results to perform data trend analysis.

[0095] At this point, the above Figure 3The data trend analysis process shown, by using a large language model based on the user's natural language query text and the target question and answer example matching the natural language query text, obtains the structured query statement of the natural language query text, and executes the structured query statement to query the database. Since the target question and answer example can guide the large language model to generate the structured query statement of the natural language query text, it can improve the relevance and accuracy of the statement generation, so that the user can directly interact with the database in the form of natural language, reducing the difficulty of user operation. Further, by using a preset deep learning model and a preset time series model, the deep learning model is used to learn the nonlinear characteristics of the data, and the time series model is used to learn the linear characteristics of the data, so as to combine the respective advantages of the two models to perform real-time future trend prediction based on the query results returned by the database, which can effectively learn the linear and nonlinear characteristics of the data, effectively improve the prediction accuracy, and assist users in data insight analysis. It can be seen that the data analysis efficiency and automation can be improved through the present application scheme, so that non-technical users can use natural language queries to realize the analysis of complex data.

[0096] The above-mentioned data trend analysis method provided in the embodiment of the present application can be applied to, but is not limited to, application scenarios involving data trend analysis in the fields of e-commerce services, educational services, legal services, medical services, conference services, social network services, financial product services, logistics services, etc., for example: the scenario of analyzing the sales trend of goods in e-commerce services, the scenario of analyzing the click-through rate trend of training courses in educational services, the scenario of analyzing the case attention trend in legal services, etc., which are not limited here.

[0097] In an optional embodiment of the present application, the above step 301 obtains a target question and answer example matching the user's natural language query text, including the following specific steps:

[0098] Vectorize the natural language query text to obtain a text vector;

[0099] A target vector matching the text vector is searched in a preset example library; the example library records a plurality of question-and-answer examples, each of which includes a general query text, a query statement of the general query text, and a vector of the general query text;

[0100] The question and answer example corresponding to the target vector in the example library is used as the target question and answer example.

[0101] The text vector can be understood as the result of representing the natural language query text using a vector, which facilitates subsequent vector matching.

[0102] The example library can be understood as a pre-built database of relevant examples of converting existing text into query statements, which is used to give a priori indications that match the current user input, that is, to provide similar question and answer examples for the user's natural language query text. In each question and answer example recorded in the example library, there are general query texts, query statements for general query texts, and vectors for general query texts. Among them, general query texts and query statements for general query texts are used to provide learning references for large language models, improving the relevance and accuracy of query statements generated by large language models; vectors for general query texts facilitate vector matching.

[0103] The target vector is a vector in the example library whose similarity with the text vector is higher than the similarity between other vectors and the text vector. The similarity between vectors can be calculated using algorithms such as vector inner product, cosine similarity, inner product and cosine similarity, Euclidean distance, Manhattan distance, etc., and this application does not limit this.

[0104] For example, assuming that the natural language query text query="query the sales volume of brand 1", the following three target question and answer examples similar to query="query the sales volume of brand 1" are obtained through the example library:

[0105] "Query the sales volume of brand 2":

[0106] SQL statement: SELECT sales FROM table name WHERE brand = 'Brand 2';

[0107] "View monthly sales of Brand 1":

[0108] SQL statement: SELECT SUM(sales) AS monthly sales FROM table name WHERE brand = 'Brand 1' GROUP BY month;

[0109] "Retrieve sales records for brand 1":

[0110] SQL: SELECT * FROM table name WHERE brand = 'Brand 1';

[0111] In this embodiment, a pre-built example library is queried to obtain question-and-answer examples similar to the natural language query text to provide prior knowledge that matches the current input, thereby improving the relevance and accuracy of sentence generation of the large language model.

[0112] In an optional embodiment of the present application, the above step 302 calls the large language model to generate a structured query statement of the natural language query text based on the target question and answer example and the natural language query text, including the following specific steps:

[0113] Obtain historical interaction records between users and large language models;

[0114] Based on the target question and answer examples, historical interaction records, and natural language query text, the large language model is called to obtain the structured query statement of the natural language query text.

[0115] The historical interaction record can be understood as the historical interaction information between the current user and the large language model that the model remembers, so that the large language model can generate coherent responses. The historical interaction record contains information such as the user's historical input, model-generated sentences, time, ID, etc.

[0116] It is understandable that each time the large language model generates a reply, it also updates the historical interaction record. Therefore, the model returns the generated reply and the updated historical interaction record each time for use in the next request.

[0117] Correspondingly, the historical interaction records between the user and the large language model are obtained by parsing the user input parameters. In addition to the historical interaction records, the user input parameters may also include the user's natural language query text, user time, user city, query scenario and other information.

[0118] In this embodiment, by obtaining historical interaction records and providing them to the large language model for processing together with target question and answer examples and natural language query text, the historical interaction records can provide the contextual information required by the large language model, and the target question and answer examples can provide the large language model with generated sentences of similar texts. It can be seen that this is more conducive to the large language model to generate more relevant and accurate sentences.

[0119] In an optional embodiment of the present application, based on the target question and answer example, the historical interaction record and the natural language query text, calling the large language model to obtain the structured query statement of the natural language query text includes the following specific steps:

[0120] Build the prompts of the large language model based on the preset prompt template, target question and answer examples, and natural language query text;

[0121] Using the prompt and historical interaction records to call a large language model;

[0122] Verify the output text of the large language model to obtain the verification result;

[0123] If the verification result is successful, the output text is used as a structured query statement of a natural language query text;

[0124] When the verification result is failure, a structured query statement of the natural language query text is generated using the keywords in the output text and a preset structured statement rule template; the keywords are information extracted from the natural language query text.

[0125] The prompt template can be understood as a pre-built structured text used to guide the large language model to perform specific tasks or generate specific types of output. The prompt template can consist of four parts: role specification, input statement, table structure information, and question and answer examples. Among them, the role specification part is used to specify the relevant fields and specific requirements of problem processing, as well as the role or identity expected to be played by the model, which helps the model understand the background and context of the problem; the input statement part is the user's query description, which is used to fill in the user's natural language query text, indicating the task or problem that the model needs to handle; the table structure information part is used to provide the table structure information of the database to be queried, including table name, field name and field description, etc., which helps the model understand the data to be queried or processed; the question and answer example part is used to fill in previous similar query texts and query statements, so that the model can better understand the content of the input statement part and generate more accurate output.

[0126] Prompts can be understood as text used as input to a large language model to guide the model to produce relevant outputs.

[0127] According to the preset prompt template, target question and answer examples and natural language query text, the prompt of the large language model is constructed. The specific method is: determine the query scenario of the natural language query text, obtain the preset prompt template corresponding to the query scenario, fill the target question and answer examples and natural language query text in the obtained prompt template, and generate the prompt of the large language model.

[0128] Among them, since different query scenarios need to query different databases, different prompt templates can be used in different query scenarios, so that the table structure information can be fully filled in when constructing the prompt template. Optionally, the query scenario can be obtained by parsing user input parameters. For example, in the commodity query scenario, the database used is the commodity database, and the table structure information part in the corresponding prompt template is the table structure information describing the commodity database.

[0129] For example, in a product query scenario, the table information and field information of the product database include: table_1 'Product Information' (desc 'Product ID', item_id, 'Product Name', item_name), the user's natural language query text query = "Query the popular categories in a certain area in the past 7 days", and the target question and answer examples matching the query include: Q: "What are the products in a certain area in the past month?", A: "SELECT product name, SUM (sales quantity) AS total sales FROM table name WHERE location = 'Region 1' AND sales date >= DATE_SUB (CURRENT_DATE, INTERVAL 1MONTH) GROUP BY product name ORDER BY total sales DESC; ", and the constructed prompt is as follows:

[0130] Role assignment: As an e-commerce data analyst, please help me find

[0131] Input sentence: "Query the categories of a certain area in the last 7 days"

[0132] Table structure information: table_1 'Product information' (desc 'Product id', item_id, 'Product name', item_name)

[0133] Question and answer example: Q: "What products are sold in a certain region in the past month?", A: "SELECT product name, SUM(sales quantity) AS total sales FROM table name WHERE location = 'region 1' AND sales date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY product name ORDER BY total sales DESC; "

[0134] The large language model is called by using the prompt and the historical interaction record. Specifically, the request parameters of the large language model are constructed by using the prompt and the historical interaction record, and the large language model is called by HTTP (Hypertext Transfer Protocol).

[0135] The output text is the result of the large language model, that is, the structured query statement, which contains keywords extracted from the natural language query text and structured query language information. For example, the output text = "SELECT sales FROM table name WHERE brand = 'brand 2'; ", where sales, table name, and brand 2 are keywords, and SELECT [ ] FROM [ ] WHERE [ ] is structured query language information.

[0136] In order to make the structured query statements generated by the large language model meet the requirements of the standard query syntax, the output text needs to be verified, so the verification result is the syntax verification result of the output text.

[0137] A structured statement rule template can be understood as a set of predefined SQL query structures, which can be predefined according to query requirements. For example, a structured statement rule template is defined as: SELECT [columns] FROM [table] WHERE [conditions]. When using the rule template, a reasonable structured query statement can be generated by filling in the corresponding keywords in "[ ]".

[0138] In this embodiment, according to the target question and answer examples and the natural language query text, the prompts are automatically assembled by combining the prompt template to provide instructions and inputs to the large language model, and the user's historical interaction records are also provided to the large language model to provide contextual information, thereby improving the accuracy of the output text of the large language model. By verifying the output text, the rationality of the output text as a structured query statement can be ensured, and in the event of a verification failure, a reasonable structured query statement is assembled through the keywords in the output text and the structured statement rule template to ensure the normal progress of the subsequent process.

[0139] In an optional embodiment of the present application, the output text of the large language model is verified to obtain a verification result, which specifically includes:

[0140] Perform regular expression matching on the output text to obtain query statement structure information;

[0141] Performing syntax calibration on the query statement structure information to obtain a verification result; and / or,

[0142] Perform keyword calibration on the query statement structure information to obtain verification results.

[0143] The query statement structure information can be understood as the structural description content of the output text. The query statement structure information may include partial information such as the SELECT statement, the FROM clause, and the WHERE condition. For example, a regular expression is used to match the part beginning with SELECT to obtain the field keyword to be queried, match the part beginning with FROM to obtain the table name keyword to be queried, and match the part beginning with WHERE to obtain the query condition keyword.

[0144] Optionally, syntax calibration may be to check whether the field name, table name, and condition in the query statement structure information exist. If they all exist, it indicates that the verification is successful, otherwise, the verification fails.

[0145] Optionally, keyword calibration may include any one or more combinations of distance calibration, vector calibration, rule calibration, etc. Distance calibration is to check whether the keywords of each part of the query statement structure information exist in the target database, for example, the city name "a certain area" exists in the target database; vector calibration is to check whether the semantics of the keywords of each part of the query statement structure information matches the user's intention; rule calibration is to check whether the keywords of each part of the query statement structure information are within the definition range of the target database, for example, the query date range is within the definition range of the database.

[0146] It is understandable that the above-mentioned calibration strategies of syntax calibration and keyword calibration are merely exemplary and do not constitute a limitation of the protection scheme of the present application.

[0147] In this embodiment, by performing regular expression matching processing on the output text, query sentence structure information is obtained, thereby facilitating subsequent grammar calibration and / or keyword calibration to ensure the rationality of the output text of the large language model.

[0148] In an optional embodiment of the present application, the above step 304 calls a preset deep learning model and a preset time series model to perform data trend analysis based on the query result, including the following specific steps:

[0149] Extract time series data from the query result;

[0150] Extract features of different dimensions based on time series data; different dimensions include any combination of trend dimension, seasonal dimension and residual component dimension;

[0151] The time series model is called to predict future trends based on the extracted features of different dimensions to obtain the first prediction value; the time series model is used to predict the linear characteristics of data trends;

[0152] The deep learning model is called to predict future trends based on the extracted features of different dimensions to obtain a second prediction value; the deep learning model is used to predict the nonlinear characteristics of data trends;

[0153] The weighted fusion result of the first prediction value and the second prediction value is used as the trend analysis result.

[0154] Time series data can be understood as a collection of data arranged in chronological order, where each data point is associated with a specific point in time. Time series data can be used to analyze trends over time. For example, transaction data of a commodity category arranged in chronological order can be used to analyze future transaction trends of that commodity category.

[0155] Different dimensions include any combination of trend dimension, seasonal dimension and residual component dimension. Trend dimension is the overall direction of long-term changes in time series data, reflecting the overall growth or decrease trend of the data; seasonal dimension is the periodic change of time series data in a specific time period, reflecting the periodic fluctuation and repetitive pattern of data in each time period; residual component dimension is the random fluctuation part of time series data after removing trend and seasonality, reflecting the impact of other factors on the data except trend and seasonality.

[0156] The first prediction value is the future trend data of the time series data returned by the time series model. The time series model is a model used to capture the long-term and periodic characteristics of the input data, that is, the linear characteristics used to predict the data trend.

[0157] The second prediction value is the future trend data of the time series data returned by the deep learning model. A deep learning model is a model used to capture the nonlinear characteristics and short-term fluctuations of the input data, that is, the nonlinear characteristics used to predict data trends.

[0158] The weighted fusion result is an integration of the first prediction value returned by the time series model and the second prediction value returned by the deep learning model to improve the accuracy and robustness of the prediction. The specific method of weighted fusion is: by setting a weight for the result returned by the deep learning model and a weight for the result returned by the time series model, the first prediction value and the second prediction value are weighted and summed using these two weights to obtain the weighted fusion result.

[0159] Exemplarily, assume that the query results include the search terms of all network users in the past month and the daily click-through rate of the search terms, where the daily click-through rate of the search terms is a data set arranged in chronological order and belongs to time series data. Features of different dimensions are extracted based on the daily click-through rate of the search terms, and then the time series model is called to predict the future click-through rate trend based on the extracted features to obtain a first prediction value. The deep learning model is called to predict the future click-through rate trend based on the extracted features to obtain a second prediction value, and the weighted sum of the first prediction value and the second prediction value is used as the future click-through rate trend analysis result.

[0160] In this embodiment, features of different dimensions are extracted from the time series data in the query results to comprehensively consider features of different dimensions such as trend, seasonality, and residual components of the time series. Future trends of the sequence data are predicted by combining the respective advantages of the deep learning model and the time series model. Since the two models perform trend prediction analysis from different angles of the sequence data, weighted fusion of the prediction results of the two models can improve the accuracy of trend prediction.

[0161] In an optional embodiment of the present application, extracting features of different dimensions based on time series data specifically includes the following steps:

[0162] Use the target window to perform moving estimation in time series data to obtain trend characteristics;

[0163] After subtracting the trend characteristics from the time series data, the average value in each seasonal cycle is calculated to obtain the seasonal characteristics;

[0164] Subtract trend characteristics and seasonal characteristics from time series data to obtain residual component characteristics.

[0165] The target window can be understood as a moving window for estimating time series data. The window size can be determined dynamically or pre-set. This application does not impose any restrictions on this. For example, a moving average estimation method can be used to determine a window, and then the window is used to perform an average estimate of the time series data. That is, at each time point, the average value of all observations in the window is calculated as the trend estimate at that time point. Ultimately, the trend estimates at each time point constitute a trend feature.

[0166] The trend feature can be understood as the overall growth trend or decrease trend of time series data, which is a trend data of long-term changes in data.

[0167] The seasonal cycle can be understood as a specific time period, such as a week, a month, a quarter, etc. The seasonal cycle is used to estimate seasonal factors from time series data with detrended characteristics.

[0168] Seasonal characteristics can be understood as the periodic changing trend of time series data within the seasonal cycle, reflecting the periodic fluctuations and repetitive patterns of data in each time period.

[0169] The residual component characteristics can be understood as the random fluctuation part of the data that cannot be explained by trend and seasonality, reflecting the impact of other factors on the data besides trend and seasonality.

[0170] In this embodiment, by decomposing the time series data into trend, seasonality, and residual components, the all-round structural characteristics of the time series data can be obtained, so as to facilitate more accurate prediction and analysis.

[0171] In an optional embodiment of the present application, after calling the preset deep learning model and the preset time series model to perform data trend analysis based on the query results in step 304, the following specific steps are also included: returning the query results and trend analysis results to the user's client, so that the client displays the query results and trend analysis results to assist the user in making decision analysis.

[0172] See also Figure 4 , Figure 4 This is an implementation architecture diagram of a data trend analysis according to an exemplary embodiment, including a client interface, an LLM interaction module, a database module and a trend prediction module. The execution details of each module are introduced below using the commodity trend analysis scenario as an example.

[0173] Among them, the client interface is used to receive the natural language query text entered by the user, and to obtain other relevant parameters such as time, city, query scenario, etc., and then initiate a request to the LLM interaction module. It is also used to visualize the results returned by the LLM interaction module in the form of graphics or charts.

[0174] See also Figure 5A , the user enters "I want to know the recent hot trends" according to the needs in the client interface, and clicks "Send", and the client interface initiates a request to the LLM interaction module.

[0175] See also Figure 5BIn the client interface, data on three parts are displayed: popular products, category trends, and recommended search terms across the entire network. In the popular products section, popular brands, product names, recommendation scores, and user demand are displayed in a table; in the category trend section, three categories are displayed in a graphical form: Category 1, Category 2, and Category 3. These three categories have sales data in six dimensions, and based on the sales data in these dimensions, the trend growth score of Category 1 is predicted to be 95.56, the trend growth score of Category 2 is 94.72, and the trend growth score of Category 3 is 85.28; in the recommended search terms across the entire network, search terms that have appeared recently are displayed: Search term 1, Search term 2, and Search term 3.

[0176] The LLM interaction module is used to parse the user's natural language query text, historical interaction records and other parameters from the request, and pre-process the natural language query text, such as removing irrelevant characters, punctuation, stop words, etc., and then query the target question and answer examples that match the natural language query text in the pre-built example library, and assemble the target question and answer examples and the natural language query text according to the preset prompt template to obtain the prompt, interact with the large language model (LLM) according to the assembled prompt and historical interaction records, and verify the output text of the LLM (that is, the structured query statement). If the verification is successful, the structured query statement is sent to the database module for execution, and the trend prediction module is called for trend analysis based on the query results returned by the database module. Finally, the trend analysis results and query results are returned to the client interface in json format for visual display.

[0177] The database module is used to establish a connection with the product database and execute the received structured query statement to retrieve relevant data from the product database. Specifically, the data table established in the product database covers three aspects of data: popular products, category trends, and search term recommendations.

[0178] The trend prediction module is used to extract the time series data from the query results and preprocess the time series data, such as removing outliers, filling missing values, normalizing the data, etc. It then extracts features of different dimensions from the time series data and combines the deep learning model and the time series model to perform trend prediction analysis on features of different dimensions to obtain the final trend analysis results.

[0179] It should be noted that the preferred implementation of this embodiment can be found in Figure 3 The relevant description in the illustrated embodiment will not be repeated here.

[0180] Based on the above embodiments, see Figure 6 As shown, Figure 6A flowchart for generating a structured query statement in a data trend analysis method according to an exemplary embodiment includes the following steps:

[0181] User input question, i.e. user inputs natural language query text;

[0182] Statement preprocessing: preprocessing natural language query text, such as removing irrelevant characters, punctuation, stop words, duplicate values, abnormal values, etc.

[0183] Prompt construction: after vectorizing the natural language query text, query the pre-built sample library to obtain the target question and answer example. The sample library is pre-built based on the existing query text and query statement, and then construct the prompt based on the target question and answer example, the prompt template and the natural language query text;

[0184] Calling LLM, based on the constructed prompt and the historical interaction record between the user and LLM;

[0185] Syntax verification: perform regular matching, syntax calibration, and keyword calibration on the output text of LLM to obtain calibration results;

[0186] The fallback processing is to use the output text as a structured query statement when the calibration is successful; and to generate a structured query statement based on the keywords in the output text and the structured statement rule template when the calibration fails.

[0187] It should be noted that the preferred implementation of this embodiment can be found in Figure 3 The relevant description in the illustrated embodiment will not be repeated here.

[0188] Corresponding to the above-mentioned data trend analysis method embodiment, the present application also provides an embodiment of a data trend analysis device.

[0189] Figure 7 FIG. 1 is a schematic diagram of a data trend analysis device according to an exemplary embodiment. The device is used to execute the data trend analysis method provided in any of the above embodiments. Figure 7 As shown, the data trend analysis device comprises:

[0190] An example acquisition module 710 is used to acquire a target question and answer example that matches the user's natural language query text; the target question and answer example is used to provide a reference for the large language model to generate a structured query statement for the natural language query text;

[0191] A conversion module 720, configured to call the large language model to generate a structured query statement of the natural language query text based on the target question and answer example and the natural language query text;

[0192] The data query module 730 is used to query the target database using the structured query statement to obtain the query result;

[0193] The prediction module 740 is used to call a preset deep learning model and a preset time series model to perform data trend analysis based on the query results.

[0194] In an optional implementation, the conversion module 720 is specifically used to obtain the historical interaction records between the user and the large language model; based on the target question and answer example, the historical interaction records and the natural language query text, the large language model is called to obtain a structured query statement of the natural language query text.

[0195] In an optional implementation, the conversion module 720 is specifically used to construct the prompt of the large language model according to the preset prompt template, the target question and answer example and the natural language query text in the process of calling the large language model to obtain the structured query statement of the natural language query text according to the target question and answer example, the historical interaction record and the natural language query text; call the large language model using the prompt and the historical interaction record; verify the output text of the large language model to obtain the verification result; if the verification result is successful, use the output text as the structured query statement of the natural language query text; if the verification result is failed, use the keywords in the output text and the preset structured statement rule template to generate the structured query statement of the natural language query text; the keywords are information extracted from the natural language query text.

[0196] In an optional implementation, the conversion module 720 is specifically used to perform regular matching on the output text of the large language model to obtain query statement structure information during the process of verifying the output text of the large language model to obtain the verification result; perform syntax calibration on the query statement structure information to obtain the verification result; and / or perform keyword calibration on the query statement structure information to obtain the verification result.

[0197] In an optional implementation, the example acquisition module 710 is specifically used to vectorize the natural language query text to obtain a text vector; search for a target vector matching the text vector in a preset example library; the example library records a plurality of question and answer examples, each question and answer example includes a general query text, a query statement of the general query text, and a vector of the general query text; and the question and answer example corresponding to the target vector in the example library is used as the target question and answer example.

[0198] In an optional implementation, the prediction module 740 is specifically used to extract time series data from the query results; extract features of different dimensions based on the time series data; the different dimensions include any combination of trend dimensions, seasonal dimensions and residual component dimensions; call the time series model to predict future trends based on the extracted features of different dimensions to obtain a first prediction value; the time series model is used to predict the linear characteristics of data trends; call the deep learning model to predict future trends based on the extracted features of different dimensions to obtain a second prediction value; the deep learning model is used to predict the nonlinear characteristics of data trends; and use the weighted fusion result of the first prediction value and the second prediction value as the trend analysis result.

[0199] In an optional implementation, the prediction module 740 is specifically used to use a target window to perform moving estimation in the time series data to obtain trend features during the process of extracting features of different dimensions based on the time series data; calculate the average value in each seasonal cycle after subtracting the trend features from the time series data to obtain seasonal features; and subtract the trend features and the seasonal features from the time series data to obtain residual component features.

[0200] In an optional implementation, the device further includes ( Figure 7 not shown):

[0201] A feedback module is used to return the query results and trend analysis results to the user's client after calling a preset deep learning model and a preset time series model to perform data trend analysis based on the query results, so that the client can display the query results and trend analysis results.

[0202] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0203] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, 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, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0204] In an embodiment of the present application, a structured query statement of a natural language query text is obtained by using a large language model based on the user's natural language query text and a target question and answer example that matches the natural language query text, and the structured query statement is executed to query the database. Since the target question and answer example can guide the large language model to generate a structured query statement of the natural language query text, the relevance and accuracy of the statement generation can be improved, so that the user can directly interact with the database in the form of natural language, reducing the difficulty of user operation. Further, by using a preset deep learning model and a preset time series model, the deep learning model is used to learn the nonlinear characteristics of the data, and the time series model is used to learn the linear characteristics of the data, so as to combine the respective advantages of the two models to perform real-time future trend prediction based on the query results returned by the database, which can effectively learn the linear and nonlinear characteristics of the data, effectively improve the prediction accuracy, and assist users in data insight analysis. It can be seen that the data analysis efficiency and automation can be improved through the present application scheme, so that non-technical users can use natural language queries to realize the analysis of complex data.

[0205] The embodiment of the present application also provides an electronic device corresponding to the data trend analysis method provided in the above embodiment to execute the above data trend analysis method.

[0206] Figure 8 6 is a hardware structure diagram of an electronic device according to an exemplary embodiment, the electronic device includes: a communication interface 601, a processor 602, a memory 603 and a bus 604; wherein the communication interface 601, the processor 602 and the memory 603 communicate with each other through the bus 604. The processor 602 can execute the data trend analysis method described above by reading and executing the machine executable instructions corresponding to the control logic of the data trend analysis method in the memory 603. The specific content of the method is referred to the above embodiment, which will not be repeated here.

[0207] The memory 603 mentioned in this application can be any electronic, magnetic, optical or other physical storage system, and can contain storage information, such as executable instructions, data, etc. Specifically, the memory 603 can be RAM (Random Access Memory), flash memory, storage drive (such as hard disk drive), any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 601 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used.

[0208] The bus 604 may be an ISA bus, a PCI bus or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 603 is used to store programs, and the processor 602 executes the programs after receiving execution instructions.

[0209] Processor 602 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in processor 602 or an instruction in software form. The above-mentioned processor 602 can be a general-purpose processor, including a network processor (Network Processor, referred to as NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor are combined to execute.

[0210] The electronic device provided in the embodiment of the present application and the data trend analysis method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.

[0211] The present application also provides a computer-readable storage medium corresponding to the data trend analysis method provided in the above embodiment. Fig. 9 As shown, the computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the data trend analysis method provided by any of the aforementioned embodiments will be executed.

[0212] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0213] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the data trend analysis method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0214] An embodiment of the present application also provides a computer program product corresponding to the data trend analysis method provided in the aforementioned embodiment. The computer program product includes a computer program, and the computer program is executed by a processor to implement the data trend analysis method provided in the aforementioned embodiment.

[0215] The computer program product provided by the above-mentioned embodiments of the present application and the data trend analysis method provided by the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0216] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0217] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0218] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A data trend analysis method, characterized in that: The method comprises: Obtaining a target question and answer example that matches the user's natural language query text; the target question and answer example is used to provide a reference for a large language model to generate a structured query statement for the natural language query text; Based on the target question and answer example and the natural language query text, calling the large language model to generate a structured query statement of the natural language query text; Querying the target database using the structured query statement to obtain query results; Based on the query results, calling a preset deep learning model and a preset time series model to perform data trend analysis; The step of calling the large language model to generate a structured query statement of the natural language query text based on the target question and answer example and the natural language query text includes: Obtaining historical interaction records between the user and the large language model; According to the target question and answer example, the historical interaction record and the natural language query text, calling the large language model to obtain a structured query statement of the natural language query text; Wherein, based on the query result, calling a preset deep learning model and a preset time series model to perform data trend analysis includes: Extracting time series data from the query results; Extracting features of different dimensions based on the time series data; the different dimensions include any combination of trend dimension, seasonal dimension and residual component dimension; Calling the time series model to predict future trends based on the extracted features of different dimensions to obtain a first prediction value; the time series model is used to predict the linear characteristics of the data trend; Calling the deep learning model to predict future trends based on the extracted features of different dimensions to obtain a second prediction value; the deep learning model is used to predict the nonlinear characteristics of data trends; taking a weighted fusion result of the first predicted value and the second predicted value as a trend analysis result; The extracting features of different dimensions based on the time series data includes: Using a target window to perform movement estimation in the time series data to obtain trend characteristics; After subtracting the trend feature from the time series data, the average value in each seasonal cycle is calculated to obtain the seasonal feature; The trend characteristic and the seasonal characteristic are subtracted from the time series data to obtain the residual component characteristic.

2. The method according to claim 1, characterized in that The step of calling the large language model to obtain a structured query statement of the natural language query text according to the target question and answer example, the historical interaction record, and the natural language query text includes: Constructing a prompt of the large language model according to a preset prompt template, the target question and answer example, and the natural language query text; Using the prompt and the historical interaction record to call the large language model; Verifying the output text of the large language model to obtain a verification result; If the verification result is successful, using the output text as a structured query statement of the natural language query text; When the verification result is a failure, a structured query statement of the natural language query text is generated using keywords in the output text and a preset structured statement rule template; the keywords are information extracted from the natural language query text.

3. The method according to claim 2, characterized in that The verifying the output text of the large language model to obtain a verification result includes: Performing regular expression matching on the output text to obtain query statement structure information; Performing syntax calibration on the query statement structure information to obtain a verification result; and / or, Keyword calibration is performed on the query sentence structure information to obtain a verification result.

4. The method according to claim 1, characterized in that The step of obtaining a target question and answer example that matches the user's natural language query text includes: Vectorizing the natural language query text to obtain a text vector; Querying a target vector matching the text vector in a preset example library; the example library records a plurality of question-and-answer examples, each of which includes a general query text, a query statement of the general query text, and a vector of the general query text; The question and answer example corresponding to the target vector in the example library is used as the target question and answer example.

5. The method according to claim 1, characterized in that After calling a preset deep learning model and a preset time series model to perform data trend analysis based on the query result, the method further includes: The query result and the trend analysis result are returned to the client of the user, so that the client displays the query result and the trend analysis result.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor executes the program to implement the method according to any one of claims 1 to 5.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method according to any one of claims 1 to 5.

8. A computer program product, comprising a computer program, characterized in that The computer program is executed by a processor to implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Load prediction method and device and resource scheduling method and device for multiple cloud data centers

    CN113220450A

  • Method for generating structural query language and data query equipment

    CN117112590A

  • Metering chip anomaly detection method and system based on artificial intelligence

    CN117574308A