Metric acquisition method and apparatus, electronic device and computer readable storage medium

By decomposing the natural language query information input by the user into sub-problems using a large language model, and generating target indicators by utilizing the conversion relationship between operators and indicators, the problems of low accuracy and insufficient flexibility in existing technologies are solved, and more efficient SQL statement generation is achieved.

WO2025246833A1PCT designated stage Publication Date: 2025-12-04BEIJING DIPEAK TECHNOLOGY CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/093328
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-05-31
Filing Date
2025-05-08
Publication Date
2025-12-04

AI Technical Summary

Technical Problem

In existing technologies, the accuracy rate is low due to the diversity of user queries and semantic ambiguity during the natural language to SQL conversion process, and the flexibility is insufficient in the process of converting natural language to indicators and then to SQL.

Method used

The large language model is used to break down the information to be queried into multiple sub-problems. The target indicator is generated by combining the target operator and the operation data through the conversion relationship between operators and indicators. Finally, the target indicator is converted into an SQL statement.

Benefits of technology

It improves the accuracy and flexibility of converting natural language into target metrics, enhances the ability to understand user input, and improves the accuracy of query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025093328_04122025_PF_FP_ABST
    Figure CN2025093328_04122025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the field of artificial intelligence, and provide a metric acquisition method and apparatus, an electronic device and a computer readable storage medium. The method comprises: acquiring information to be queried expressed in a natural language; inputting said information into a pre-trained large language model to obtain a target metric output by the large language model; and inputting the target metric into a preset metric system to obtain a corresponding SQL statement, and calling the SQL statement to obtain a query result from a database. The embodiments of the present application use the large language model to split said information expressed in the natural language into a plurality of subproblems, use an operator to represent each subproblem, and provide strong interpretability for natural language while remaining independent of service scenarios, thereby significantly enhancing the accuracy and generalizability of the target metric.
Need to check novelty before this filing date? Find Prior Art

Description

Indicator acquisition methods, devices, electronic equipment, and computer-readable storage media

[0001] This disclosure claims priority to Chinese Patent Application No. CN202410699298.3, filed on May 31, 2024, entitled "Method, Apparatus, Electronic Device and Computer-Readable Storage Medium for Obtaining Indicators", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of artificial intelligence, and more specifically, to a method, apparatus, electronic device, and computer-readable storage medium for acquiring indicators. Background Technology

[0003] Natural Language to SQL (NLP) is the process of converting human-language natural languages ​​(such as Chinese or English) into Structured Query Language (SQL). In this process, the system typically needs to parse and understand the user's questions or requests in natural language, then translate them into equivalent SQL statements that can be executed on the database to retrieve the required data.

[0004] In related technologies, user queries can be converted into corresponding SQL statements by directly converting natural language to SQL (NL2SQL) and converting natural language to metrics and then to SQL (NL2Metric2SQL).

[0005] For methods that directly convert natural language to SQL, user questions vary widely, with the same meaning expressed in multiple ways. Questions often contain business abbreviations or are semantically ambiguous, so the accuracy of the resulting SQL statements is limited as the large language model itself is required to understand the user's questions. Furthermore, methods that convert natural language to metrics and then to SQL statements decouple the task into natural language using metrics as a medium before extracting parameters and converting metrics to SQL lose some flexibility. Summary of the Invention

[0006] This application provides an indicator acquisition method, apparatus, electronic device, and computer-readable storage medium, which can solve the above-mentioned problems of the prior art.

[0007] In a first aspect, embodiments of this disclosure provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, a metric acquisition process is performed. The metric acquisition process includes:

[0008] Obtain the query information expressed in natural language;

[0009] The query information is input into a pre-trained large language model to obtain the target index output by the large language model.

[0010] The target indicator is input into a preset indicator system to obtain the corresponding SQL statement, and the SQL statement is called to obtain the query result from the database;

[0011] The step of inputting the query information into a pre-trained large language model to obtain the target metric output by the large language model includes:

[0012] The query information is input into the large language model to obtain at least one target operator, which includes a target operator and target operation data, wherein the target operation data is an entity in the query information;

[0013] Based on the conversion relationship between operators and indices, and combining the target operators and target operation data in each target operator, the target indices output by the large language model are obtained.

[0014] In one possible implementation, during the indicator acquisition process executed by the processor, the conversion relationship between the operator and the indicator includes a first mapping relationship between the indicator name and the indicator type, and a second mapping relationship between the indicator attribute and the operator; the large language model includes a first sub-model and a second sub-model.

[0015] The step of obtaining the target index output by the large language model based on the conversion relationship between operators and indices, combined with the target operators and target operation data in each target operator, includes:

[0016] Each target operator that includes a preset first operator is designated as the first operator;

[0017] Input the target operation data of the first operator into the first sub-model, and obtain the first indicator name corresponding to the target operation data of the first operator output by the first sub-model;

[0018] Based on the first mapping relationship, obtain the first indicator type corresponding to the first indicator name;

[0019] Obtain the preset indicator attributes of the first indicator type as candidate indicator attributes;

[0020] According to the second mapping relationship, the operator corresponding to each candidate indicator attribute is obtained as the second operator. Each second operator is matched with the target operator of each target operator, and the target operator that is successfully matched is used as the second operator. According to the second mapping relationship, the indicator attribute corresponding to the target operator of each second operator is obtained from the candidate indicator attributes.

[0021] The operators that are different from the first operator in each of the second operators are taken as the third operators. The target operation data of each third operator is input into the second sub-model to obtain the attribute values ​​of the index attributes output by the second sub-model that correspond one-to-one with the target operators of each third operator.

[0022] Obtain the index attributes corresponding to the target operators of the first operator and the index attributes corresponding to the target operators of the third operator from the index attributes corresponding to the target operators of each second operator; use the first index name as the attribute value of the index attribute corresponding to the target operator of the first operator;

[0023] The target indicator is generated based on the indicator attribute corresponding to the target operator of the first operator, the first indicator name, the indicator attribute corresponding to the target operator of each third operator, and the attribute value of the indicator attribute corresponding to the target operator of each third operator.

[0024] In one possible implementation, during the metric acquisition process executed by the processor, the first sub-model is trained using the operation data of the sample operator as the training sample and the metric name corresponding to the operation data of the sample operator as the training label.

[0025] The second sub-model is trained using the operation data of the sample operator as the training sample and the attribute values ​​of the indicator attributes corresponding to the operation data of the sample operator as the training labels.

[0026] In one possible implementation, during the metric acquisition process executed by the processor, the large language model includes a third sub-model;

[0027] The step involves inputting the information to be queried into the third sub-model to obtain at least one target operator. The target operator includes a target operator and target operation data, including:

[0028] The query information is input into the third sub-model, which decomposes the query information into at least one sub-problem and performs semantic analysis on each sub-problem to obtain the syntactic structure and entity of each sub-problem, as well as the reference relationship between the sub-problems.

[0029] For each subproblem, the third sub-model determines the target operator corresponding to the subproblem based on the syntactic structure of the subproblem and at least one of the entities;

[0030] For each subproblem, the third sub-model, based on the reference relationship between subproblems, takes the target operator of the subproblem that has a reference relationship with the subproblem as the fourth operator, obtains the output data of the fourth operator, and takes at least one of the entity of the subproblem and the output data of the fourth operator as the target operation data of the target operator corresponding to the subproblem.

[0031] For each subproblem, the third sub-model outputs a target operator that corresponds one-to-one with the subproblem, based on the target operator and target operation data of the subproblem.

[0032] In one possible implementation, during the metric acquisition process executed by the processor, the step of using at least one of the entity of the subproblem and the output data of the fourth operator as the target operation data of the target operator corresponding to the subproblem includes:

[0033] If it is determined that all entities of the subproblem are unrelated to the output data of the target operator of the subproblem that has a reference relationship with the subproblem, then the entities of the subproblem are used as the target operation data of the target operator corresponding to the subproblem.

[0034] If it is determined that all entities of the subproblem are related to the output data of the target operator corresponding to the subproblem that has a reference relationship with the subproblem, then the output data of the operator is used as the target operation data of the target operator corresponding to the subproblem.

[0035] If it is determined that the first entity of the subproblem is unrelated to the output data of the target operator corresponding to the subproblem that is related to the subproblem, and the second entity of the subproblem is related to the output data of the target operator corresponding to the subproblem that is related to the subproblem, then the first entity and the output data of the target operator are used as the target operation data of the target operator corresponding to the subproblem.

[0036] In one possible implementation, during the metric acquisition process performed by the processor, the processor is also configured to perform:

[0037] For each target operator, the target operator, target operation data, and output data of the target operator are each treated as a node;

[0038] For each target operator, a directed edge is constructed between the node corresponding to the target operation data of the target operator and the node corresponding to the target operator of the target operator, and a directed edge is constructed between the node corresponding to the target operator of the target operator and the node corresponding to the output data of the target operator;

[0039] Based on each node and the directed edges between each node, a directed acyclic graph is constructed. The directed acyclic graph is used to represent the relationship between composite operations between target operators.

[0040] In one possible implementation, during the indicator acquisition process executed by the processor, the indicator system includes a preset third mapping relationship between indicator attributes and SQL statement keywords;

[0041] The step of inputting the target indicator into a preset indicator system to obtain the corresponding SQL statement includes:

[0042] The indicator system obtains the keywords of the SQL statements corresponding to each indicator attribute in the target indicator based on the third mapping relationship;

[0043] The first indicator name of the target indicator and the attribute values ​​of each indicator attribute are used as the parameters corresponding to the keywords.

[0044] Based on the keywords of the SQL statement and the parameters corresponding to each keyword, obtain the SQL statement corresponding to the target indicator.

[0045] Secondly, embodiments of this disclosure provide a method for obtaining indicators, including:

[0046] Obtain the query information expressed in natural language;

[0047] The query information is input into a pre-trained large language model to obtain the target index output by the large language model.

[0048] The target indicator is input into a preset indicator system to obtain the corresponding SQL statement, and the SQL statement is called to obtain the query result from the database;

[0049] The step of inputting the query information into a pre-trained large language model to obtain the target metric output by the large language model includes:

[0050] The query information is input into the large language model to obtain at least one target operator, which includes a target operator and target operation data, wherein the target operation data is an entity in the query information;

[0051] Based on the conversion relationship between operators and indices, and combining the target operators and target operation data in each target operator, the target indices output by the large language model are obtained.

[0052] In one possible implementation, the conversion relationship between the operator and the index includes a first mapping relationship between the index name and the index type, and a second mapping relationship between the index attribute and the operator; the large language model includes a first sub-model and a second sub-model.

[0053] The step of obtaining the target index output by the large language model based on the conversion relationship between operators and indices, combined with the target operators and target operation data in each target operator, includes:

[0054] Each target operator that includes a preset first operator is designated as the first operator;

[0055] Input the target operation data of the first operator into the first sub-model, and obtain the first indicator name corresponding to the target operation data of the first operator output by the first sub-model;

[0056] Based on the first mapping relationship, obtain the first indicator type corresponding to the first indicator name;

[0057] Obtain the preset indicator attributes of the first indicator type as candidate indicator attributes;

[0058] According to the second mapping relationship, the operator corresponding to each candidate indicator attribute is obtained as the second operator. Each second operator is matched with the target operator of each target operator, and the target operator that is successfully matched is used as the second operator. According to the second mapping relationship, the indicator attribute corresponding to the target operator of each second operator is obtained from the candidate indicator attributes.

[0059] The operators that are different from the first operator in each of the second operators are taken as the third operators. The target operation data of each third operator is input into the second sub-model to obtain the attribute values ​​of the index attributes output by the second sub-model that correspond one-to-one with the target operators of each third operator.

[0060] Obtain the index attributes corresponding to the target operators of the first operator and the index attributes corresponding to the target operators of the third operator from the index attributes corresponding to the target operators of each second operator; use the first index name as the attribute value of the index attribute corresponding to the target operator of the first operator;

[0061] The target indicator is generated based on the indicator attribute corresponding to the target operator of the first operator, the first indicator name, the indicator attribute corresponding to the target operator of each third operator, and the attribute value of the indicator attribute corresponding to the target operator of each third operator.

[0062] In one possible implementation, the first sub-model is trained using the operation data of the sample operator as the training sample and the indicator name corresponding to the operation data of the sample operator as the training label.

[0063] The second sub-model is trained using the operation data of the sample operator as the training sample and the attribute values ​​of the indicator attributes corresponding to the operation data of the sample operator as the training labels.

[0064] In one possible implementation, the large language model includes a third sub-model;

[0065] The step involves inputting the information to be queried into the third sub-model to obtain at least one target operator. The target operator includes a target operator and target operation data, including:

[0066] The query information is input into the third sub-model, which decomposes the query information into at least one sub-problem and performs semantic analysis on each sub-problem to obtain the syntactic structure and entity of each sub-problem, as well as the reference relationship between the sub-problems.

[0067] For each subproblem, the third sub-model determines the target operator corresponding to the subproblem based on the syntactic structure of the subproblem and at least one of the entities;

[0068] For each subproblem, the third sub-model, based on the reference relationship between subproblems, takes the target operator of the subproblem that has a reference relationship with the subproblem as the fourth operator, obtains the output data of the fourth operator, and takes at least one of the entity of the subproblem and the output data of the fourth operator as the target operation data of the target operator corresponding to the subproblem.

[0069] For each subproblem, the third sub-model outputs a target operator that corresponds one-to-one with the subproblem, based on the target operator and target operation data of the subproblem.

[0070] In one possible implementation, taking at least one of the entity of the subproblem and the output data of the fourth operator as the target operation data of the target operator corresponding to the subproblem includes:

[0071] If it is determined that all entities of the subproblem are unrelated to the output data of the target operator of the subproblem that has a reference relationship with the subproblem, then the entities of the subproblem are used as the target operation data of the target operator corresponding to the subproblem.

[0072] If it is determined that all entities of the subproblem are related to the output data of the target operator corresponding to the subproblem that has a reference relationship with the subproblem, then the output data of the operator is used as the target operation data of the target operator corresponding to the subproblem.

[0073] If it is determined that the first entity of the subproblem is unrelated to the output data of the target operator corresponding to the subproblem that is related to the subproblem, and the second entity of the subproblem is related to the output data of the target operator corresponding to the subproblem that is related to the subproblem, then the first entity and the output data of the target operator are used as the target operation data of the target operator corresponding to the subproblem.

[0074] One possible implementation also includes:

[0075] For each target operator, the target operator, target operation data, and output data of the target operator are each treated as a node;

[0076] For each target operator, a directed edge is constructed between the node corresponding to the target operation data of the target operator and the node corresponding to the target operator of the target operator, and a directed edge is constructed between the node corresponding to the target operator of the target operator and the node corresponding to the output data of the target operator;

[0077] Based on each node and the directed edges between each node, a directed acyclic graph is constructed. The directed acyclic graph is used to represent the relationship between composite operations between target operators.

[0078] In one possible implementation, the indicator system includes a preset third mapping relationship between indicator attributes and SQL statement keywords;

[0079] The step of inputting the target indicator into a preset indicator system to obtain the corresponding SQL statement includes:

[0080] The indicator system obtains the keywords of the SQL statements corresponding to each indicator attribute in the target indicator based on the third mapping relationship;

[0081] The first indicator name of the target indicator and the attribute values ​​of each indicator attribute are used as the parameters corresponding to the keywords.

[0082] Based on the keywords of the SQL statement and the parameters corresponding to each keyword, obtain the SQL statement corresponding to the target indicator.

[0083] Thirdly, embodiments of this disclosure also provide an indicator acquisition device, including:

[0084] The first acquisition module is used to acquire the query information expressed in natural language.

[0085] The second acquisition module is used to input the information to be queried into a pre-trained large language model to obtain the target index output by the large language model.

[0086] The third acquisition module is used to input the target indicator into a preset indicator system, obtain the corresponding SQL statement, and call the SQL statement to obtain query results from the database;

[0087] The step of inputting the query information into a pre-trained large language model to obtain the target metric output by the large language model includes:

[0088] The query information is input into the large language model to obtain at least one target operator, which includes a target operator and target operation data, wherein the target operation data is an entity in the query information;

[0089] Based on the conversion relationship between operators and indices, and combining the target operators and target operation data in each target operator, the target indices output by the large language model are obtained.

[0090] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the second aspect above, or any possible implementation of the second aspect.

[0091] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings.

[0092] The beneficial effects of the technical solutions provided in this application are:

[0093] This application uses a large language model to decompose the query information into multiple sub-problems, overcoming the problem of low flexibility caused by directly converting user-input query information into indicators in existing technologies. Simultaneously, the large language model converts each sub-problem into a target operator. Since the target operator is closer to natural language, it has excellent interpretability for the sub-problems and is independent of business scenarios. It can serve as an independent task to assist natural language understanding of user-input query information, significantly improving the accuracy and generalization of target indicators. The embodiments of this application, based on the conversion relationship between operators and indicators, and combining the target operators and target operation data in each target operator, obtain the target indicator output by the large language model. This overcomes the problem of low flexibility caused by directly converting user-input query information into indicators in existing technologies, effectively improving the accuracy of converting query information into target indicators. Attached Figure Description

[0094] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0095] Figure 1 is a schematic diagram of the system architecture of the indicator acquisition method provided in the embodiment of this application;

[0096] Figure 2 is a flowchart illustrating an indicator acquisition method provided in an embodiment of this application;

[0097] Figure 3 is a schematic diagram of a directed acyclic graph provided in an embodiment of this application;

[0098] Figure 4 is a flowchart illustrating how information to be queried is converted into SQL statements according to an embodiment of this application;

[0099] Figure 5 is a schematic diagram of an indicator acquisition device provided in an embodiment of this application;

[0100] Figure 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0101] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0102] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.

[0103] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”

[0104] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0105] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0106] First, let's introduce and explain several terms used in this application:

[0107] Natural language: Natural language is the primary tool for communication in human society and the main carrier of information between people. It includes various languages ​​used by humans, such as Chinese, English, and French. These languages ​​were formed by humans over a long period of historical development and have complex grammatical rules, vocabulary, and expressions.

[0108] Entities: In the field of natural language processing, entities typically refer to nominal objects or concepts that have specific meanings or identities. Entities can be words or phrases with clear referential meanings, such as names of people, places, organizations, dates, and times.

[0109] Large Language Models (LLMs) are deep learning models in the field of Natural Language Processing (NLP). They typically contain a large number of parameters and are pre-trained on large-scale corpora to understand and generate human language. These models have powerful language representation capabilities and can handle a variety of complex language tasks.

[0110] Operator: In computer science, an operator is a symbol used to manipulate data. An operator consists of an operator and the data to be manipulated.

[0111] Directed Acyclic Graph (DAG): A DAG is a special graph structure that contains directed edges but no cycles. In a DAG, each edge has a definite direction, and starting from any vertex and moving along the direction of an edge, it is impossible to return to that vertex, thus forming a closed cycle.

[0112] Natural Language to SQL (NLP) is the process of converting human-language natural languages ​​(such as Chinese or English) into Structured Query Language (SQL) statements. In this process, the system typically needs to parse and understand the user's questions or requests in natural language, then translate them into equivalent SQL statements that can be executed on the database to retrieve the required data.

[0113] In related technologies, user queries can be converted into corresponding SQL statements through two methods: direct natural language to SQL (NL2SQL) and natural language to metrics and then to SQL (NL2Metric2SQL). However, regardless of the method used, some difficulties in natural language understanding are encountered, mainly including:

[0114] Users ask questions in a variety of ways, and the same meaning can be expressed in multiple ways. Questions often contain business abbreviations or are semantically ambiguous. Without structured analysis of natural language, we can only rely on the parsing model or the capabilities of the large language model itself to understand them, which has limited accuracy.

[0115] Furthermore, a complex problem needs to be broken down into multiple subproblems for step-by-step solution. Determining whether a problem needs to be broken down and how to break it down correctly tests not only the ability to understand natural language but also the ability to understand SQL. It should be possible to translate each subproblem into a simple SQL statement. Existing solutions do not provide a good solution to this problem.

[0116] The indicator acquisition method, apparatus, electronic device, and computer-readable storage medium provided in this application are intended to solve the above-mentioned technical problems of the prior art.

[0117] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0118] Figure 1 is a schematic diagram of the system architecture of the indicator acquisition method provided in the embodiment of this application, including a terminal 101 and a server 102. The terminal 101 and the server 102 are connected via a wired or wireless network. Optionally, the terminal 101 can be a personal computer (PC), an in-vehicle terminal, a tablet computer, a smartphone, a wearable device, an intelligent robot, or other terminal with data computing, processing, and storage capabilities. The server 102 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0119] In this embodiment, terminal 101 can be used to send query information expressed in natural language by the user, and terminal 101 sends the query information to server 102. Server 102 includes a pre-trained large language model. The query information is input into the pre-trained large language model to obtain at least one target operator. The target operator includes a target operator and target operation data, where the target operation data is the entity in the query information. Server 102 also includes a conversion relationship between operators and indicators. Based on the conversion relationship between operators and indicators, and combining the target operator and target operation data in each target operator, the target indicator output by the pre-trained large language model is obtained.

[0120] Server 102 inputs the target indicator into the preset indicator system, obtains the corresponding SQL statement for the target indicator, calls the SQL statement to obtain the query result from the database, and sends the query result to terminal 101 as the answer to the query information entered by the user.

[0121] Those skilled in the art will understand that the number of servers 102 described above can be more or less. For example, there may be only one server, or there may be dozens or hundreds of servers, or even more. This application does not limit the number or type of servers.

[0122] In some embodiments, server 102 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0123] In some embodiments, server 102 undertakes the main computing work and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work and terminal 101 undertakes the main computing work; or, server 102 and terminal 101 collaborate on computing using a distributed computing architecture.

[0124] The indicator acquisition method in this application embodiment is mainly performed by the server. The following description uses the server as the execution entity to illustrate the scheme in this application embodiment.

[0125] Figure 2 is a flowchart illustrating an indicator acquisition method provided in an embodiment of this application. As shown in Figure 2, the method includes:

[0126] S201. Obtain the query information expressed in natural language.

[0127] In this embodiment, the user inputs query information expressed in natural language on terminal 101. The query information can be a question, a description, or any other form of data, aimed at obtaining an answer corresponding to the query information. For example, the query information input by the user in Chinese is "What is the total operating expense of branches with a branch number greater than 71?".

[0128] It should be noted that the natural language in this application embodiment can be not only Chinese, but also English, French, etc.; the information to be queried is a question in a specific field, which, in addition to the banking field mentioned above, can also be the manufacturing field, meteorology field, etc. This application does not limit the specific type of natural language or the field to which the information to be queried belongs.

[0129] S202. Input the information to be queried into the pre-trained large language model to obtain the target index output by the large language model.

[0130] In this embodiment of the application, the pre-trained large language model can decompose the input query information into multiple sub-problems. Taking the query information "What is the total operating expenses of branches with a branch number greater than 71?" as an example, the large language model decomposes the query information into two sub-problems: sub-problem 1 "What is the total operating expenses?" and sub-problem 2 "What is the total operating expenses of branches with a branch number greater than 71?".

[0131] In this embodiment, the large language model can obtain the grammatical structure and entity of each subproblem. Based on at least one of the grammatical structure and entity of the subproblem, the target operator corresponding to the subproblem can be determined from the pre-set operators. The pre-set operators in this embodiment are shown in Table 1.

[0132] Table 1 Operators

[0133] Specifically, Table 1 shows the operators for each subproblem, along with their behavior and function. Based on the syntactic structure and entities of subproblems 1 and 2, the target operator for subproblem 1 is determined to be "SELECT", and the target operator for subproblem 2 is "FILTER". Simultaneously, the large language model can also identify the entities in each subproblem and use these entities as the target operation data for the corresponding subproblem. Specifically, the entity in subproblem 1 is "total operating expenses"; the entities in subproblem 2 are "branch number greater than 71" and "total operating expenses". Therefore, the target operation data for subproblem 1 is "total operating expenses", and the target operation data for subproblem 2 are "branch number greater than 71" and "total operating expenses". Based on the target operator and target operation data for each subproblem, the target operator for that subproblem can be obtained.

[0134] After obtaining the target operator corresponding to the subproblem, the target operator is transformed into the target indicator through the conversion relationship between the operator and the indicator; for example, the target operator corresponding to subproblem 1 and the target operator corresponding to subproblem 2 are transformed into the corresponding target indicator, which can be represented as: [metricNames: Operating Expenses_SUM; where: Branch Number>71].

[0135] S203. Input the target indicator into the preset indicator system, obtain the corresponding SQL statement, and call the SQL statement to obtain the query result from the database.

[0136] In this embodiment, the indicator system includes a front-end graphical configuration interface and a back-end system. The front-end graphical configuration interface provides an input dialog box where users can input the information they want to query. The back-end system translates the indicators into SQL statements. Users input the query information into the graphical interface, and the trained large language model generates indicators from the query information; all processing is handled by the back-end system, seamlessly integrated with the user's experience. Simultaneously, the graphical configuration interface allows for adding, deleting, querying, and modifying the generated indicators, including but not limited to adding indicator attributes and modifying attribute values. Furthermore, the graphical configuration interface includes a click button; when the user clicks the button, the back-end system converts the indicators into SQL statements, calls the SQL statements to retrieve query results from the database, and displays the query results on the front-end graphical interface.

[0137] This application addresses the problems of low accuracy and low flexibility caused by directly converting user-input query information into SQL statements and indicators in the prior art. By using target operators to represent sub-problems, the flexibility of converting query information into indicators is effectively improved. At the same time, by using the conversion relationship between operators and indicators, the target operators are converted into corresponding indicators, thereby improving the accuracy of converting query information into target indicators.

[0138] Based on the above embodiments, as an optional embodiment, the conversion relationship between operators and indicators includes a first mapping relationship between indicator names and indicator types, and a second mapping relationship between indicator attributes and operators; the large language model includes a first sub-model and a second sub-model;

[0139] Based on the conversion relationship between operators and metrics, and combining the target operators and target operation data in each target operator, the target metrics output by the large language model are obtained, including:

[0140] S301. Take each target operator that includes a preset first operator as the first operator.

[0141] In this embodiment of the application, the first operator includes "SELECT" and "PROJECT". After obtaining the target operator corresponding to the subproblem, all target operators that include the first operator are taken as the first operator.

[0142] S302. Input the target operation data of the first operator into the first sub-model, and obtain the first indicator name corresponding to the target operation data of the first operator output by the first sub-model.

[0143] In this embodiment of the application, the target operation data of the first operator is input into the first sub-model to obtain the first indicator name. For example, if the target operation data of a certain first operator is "total operating expenses", the corresponding first indicator name can be "total expenses_SUM".

[0144] S303. Based on the first mapping relationship, obtain the first indicator type corresponding to the first indicator name; obtain the preset indicator attributes of the first indicator type as candidate indicator attributes.

[0145] In this embodiment of the application, there is a first mapping relationship between the first indicator name and the first indicator type. After obtaining the first indicator name, the first indicator type can be determined according to the first mapping relationship.

[0146] It should be noted that in the embodiments of this application, multiple first indicator names may correspond to the same first indicator type. For example, when the first indicator name is profit margin or KPI achievement rate, it can be mapped to the percentage type, that is, there is a many-to-one mapping relationship between the first indicator name and the indicator type; the first indicator name and the first indicator type may also have a one-to-one correspondence, that is, one first indicator name corresponds to one first indicator type.

[0147] It should also be noted that, in this embodiment of the application, after determining the first indicator type, preset indicator attributes of the first indicator type can be obtained as candidate indicator attributes. For example, when the first indicator type is determined to be a query type, preset indicator attributes of the query type can be obtained. The indicator attributes included in the query type include, but are not limited to, metricNames, where, filter, and groupBys. Therefore, metricNames, where, filter, and groupBys can be used as candidate indicator attributes.

[0148] S304. According to the second mapping relationship, obtain the operator corresponding to each candidate indicator attribute as the second operator, match each second operator with the target operator of each target operator, and take the successfully matched target operator as the second operator; according to the second mapping relationship, obtain the indicator attribute corresponding to the target operator of each second operator from the candidate indicator attributes.

[0149] In the embodiments of this application, the second mapping relationship between index attributes and operators is shown in Table 2.

[0150] Table 2 Mapping Relationship between Indicator Attributes and Operators

[0151] Specifically, as shown in Table 2, a mapping relationship table between some indicator attributes and operators in the embodiments of this application is given. According to the mapping relationship in Table 2, the operator corresponding to each candidate indicator attribute can be obtained as the second operator. For example, the operators corresponding to the indicator attribute metricNames are SELECT and PROJECT, the operator corresponding to the indicator attribute groupBys is GROUP, the operators corresponding to the indicator attribute where are FILTER, PROJECT and INTERSECTION, and the operators corresponding to the indicator attribute orderBys are SORT and TOP.

[0152] In this embodiment of the application, after obtaining the second operator, the second operator is matched with the target operator in the target operator, and the successfully matched target operator is taken as the second operator. For example, when the second operator includes SELECT, FILTER, and SORT, there are two target operators. The target operator of the first target operator is SELECT, and the target operator of the second target operator is FILTER. Then the first target operator matches SELECT in the second operator, and the second target operator matches FILTER in the second operator. Therefore, the first target operator and the second target operator are taken as the second operator.

[0153] Furthermore, after determining the second operator, based on the second mapping relationship between indicator attributes and operators, the indicator attribute corresponding to the target operator of each second operator is determined from the candidate indicator attributes. For example, the indicator attribute corresponding to the target operator of the first target operator is metricNames, and the indicator attribute corresponding to the target operator of the second target operator is where.

[0154] S305. Take the operators in each second operator that are different from the first operator as third operators, input the target operation data of each third operator into the second sub-model, and obtain the attribute values ​​of the index attributes output by the second sub-model that correspond one-to-one with the target operators of each third operator.

[0155] In this embodiment, the second operator includes the first operator. Since the target operation data in the first operator containing the first operator has been converted into the first indicator name using the large language model, the first operator needs to be removed from the second operator to avoid duplicate operations, thus obtaining the third operator. The target operation data of the third operator is input into the second sub-model, and the attribute value of the indicator attribute corresponding to the target operator of the target operator is output. For example, the third operator is #2.FILTER: #1of "line number greater than 71", where FILTER is the target operator of the third operator. According to the second mapping relationship, the indicator attribute corresponding to the target operator FILTER is where. The target operation data "line number greater than 71" is used to obtain the attribute value "line number > 71" corresponding to the indicator attribute where.

[0156] S306. Obtain the index attributes corresponding to the target operators of the first operator and the index attributes corresponding to the target operators of the third operator from the index attributes corresponding to the target operators of each second operator; use the first index name as the attribute value of the index attribute corresponding to the target operator of the first operator.

[0157] The target indicator is generated based on the indicator attribute corresponding to the target operator of the first operator, the first indicator name, the indicator attribute corresponding to the target operator of each third operator, and the attribute value of the indicator attribute corresponding to the target operator of each third operator.

[0158] In this embodiment, the second operator includes a first operator and a third operator. Therefore, the index attributes corresponding to the target operators of the first operator and the index attributes corresponding to the target operators of each third operator can be obtained from the index attributes corresponding to the target operators of the second operator. In this embodiment, the first index name is the attribute value of the index attribute corresponding to the target operator of the first operator.

[0159] In this embodiment of the application, a target indicator is generated based on the indicator attribute corresponding to the target operator of the first operator, the first indicator name, the indicator attribute corresponding to the target operator of each third operator, and the attribute value of the indicator attribute corresponding to the target operator of each third operator; for example, the target indicator can be: [metricNames: Operating Expenses_SUM; where: Branch Number>71].

[0160] Wherein, metricNames is the metric attribute corresponding to the target operator of the first operator, where is the metric attribute corresponding to the target operator of the third operator; “Operating Expenses_SUM” is the name of the first metric, and “Branch Number>71” is the attribute value of the metric attribute where corresponding to the target operator of the third operator.

[0161] Based on the above embodiments, as an optional embodiment, the first sub-model is trained using the operation data of the sample operator as the training sample and the indicator name corresponding to the operation data of the sample operator as the training label.

[0162] The second sub-model is trained using the operation data of the sample operators as training samples and the attribute values ​​of the indicator attributes corresponding to the operation data of the sample operators as training labels.

[0163] In this embodiment, the large language model includes a first sub-model and a second sub-model. The first sub-model is used to convert the target operation data of the first operator into a first indicator name, and the second sub-model is used to convert the target operation data of the third operator into the attribute value of the indicator attribute corresponding to the target operator of the third operator. For example, if the target operation data of the first operator is "total operating expenses", inputting "total operating expenses" into the first sub-model will output the first indicator name "operating expenses_SUM"; if the target operation data of the third operator is "line number greater than 71", inputting "line number greater than 71" into the second sub-model will output the attribute value of the indicator attribute "line number > 71".

[0164] It should be noted that in the embodiments of this application, the first sub-model and the second sub-model are trained using training samples until convergence. For example, when the loss values ​​of the first sub-model and the second sub-model meet the preset convergence conditions, the iterative training of the first sub-model and the second sub-model is stopped.

[0165] In some embodiments, the preset convergence condition may be: the total number of training rounds reaches a first threshold, or the number of times the calculated loss function's loss value is continuously lower than a second threshold reaches a third threshold, wherein the values ​​of the first threshold, the second threshold, and the third threshold are set according to the actual processing needs.

[0166] Based on the above embodiments, as an optional embodiment, the large language model includes a third sub-model;

[0167] The information to be queried is input into the third sub-model to obtain at least one target operator. The target operator includes the target operator and the target operation data, including:

[0168] S401. Input the information to be queried into the third sub-model. The third sub-model decomposes the information to be queried into at least one sub-problem and performs semantic analysis on each sub-problem to obtain the syntactic structure and entity of each sub-problem, as well as the reference relationship between the sub-problems.

[0169] In this embodiment, the large language model further includes a third sub-model, which is used to decompose the user-input query information into at least one sub-problem and output a target operator corresponding to each sub-problem. For example, if the user-input query information is "What is the total operating expenses of branches with branch numbers greater than 71?", the query information is input into the third sub-model, which outputs two sub-problems related to the query information: sub-problem 1 "What is the total operating expenses?" and sub-problem 2 "What is the total operating expenses of branches with branch numbers greater than 71?".

[0170] It should be noted that the third sub-model needs to be trained before use. The third sub-model is trained using the query information as training samples and at least one target operator corresponding to the query information as training labels. When the loss value of the third sub-model meets the preset convergence condition, the iterative training of the third sub-model stops. The preset convergence condition of the third sub-model is the same as that of the first and second sub-models.

[0171] S402. For each subproblem, the third sub-model determines the target operator corresponding to the subproblem based on the syntactic structure of the subproblem and at least one of the entities.

[0172] In this embodiment, the third sub-model can perform semantic analysis on each sub-problem to obtain the subject, predicate, object, attributive, adverbial, complement, and interrogative word of the sub-problem. By analyzing these grammatical components, the grammatical structure of the sub-problem is determined. Furthermore, the target operator corresponding to the sub-problem can be determined by combining the entities in the sub-problem. The following explanation uses sub-problem 2, "What is the total operating expense for branches with a branch number greater than 71?", as an example.

[0173] The subject of subproblem 2 is "total operating expenses of branches", the predicate is "is", the modifier is "branch number is greater than 71", and the complement is "how much". Therefore, the grammatical structure of subproblem 2 is: subject (total operating expenses) + predicate (is) + modifier (branch number is greater than 71) + complement (how much). Simultaneously, the trained large language model can also determine the entities in subproblem 2, which include "total operating expenses" and "branch number is greater than 71". Based on the grammatical structure and entities of subproblem 2, it can be determined that subproblem 2 requires querying the total operating expenses of branches with branch numbers greater than 71. Therefore, it can be determined that this subproblem requires aggregation of the operating expenses of branches with branch numbers greater than 71, and the operator corresponding to "aggregation" is "FILTER". Thus, the target operator for subproblem 2 can be determined to be FILTER.

[0174] S403. For each subproblem, the third sub-model, based on the reference relationship between subproblems, takes the operator of the subproblem that has a reference relationship with the subproblem as the fourth operator, obtains the output data of the fourth operator, and takes at least one of the entity of the subproblem and the output data of the fourth operator as the target operation data of the operator corresponding to the subproblem.

[0175] In this embodiment, subproblems have a referencing relationship. For example, the entity of subproblem 2, "What is the total operating expense for branches with a branch number greater than 71?", includes "total operating expense" and "branch number greater than 71". "Total operating expense" is the output data of subproblem 1, "What is the total operating expense?". Therefore, subproblem 1 and subproblem 2 have a referencing relationship, and subproblem 2 depends on the output data of the subproblem. For subproblem 2, subproblem 1 is the fourth operator; therefore, the output data of the target operator corresponding to subproblem 1 can be obtained. For subproblem 2, the entity "branch number greater than 71" is not included in subproblem 1; therefore, "branch number greater than 71" is unrelated to the output data of the target operator corresponding to subproblem 1. Finally, the entity "branch number greater than 71" of subproblem 2 and the output data of the target operator corresponding to subproblem 1 can be used together as the target operation data of the target operator corresponding to subproblem 2.

[0176] S404. For each subproblem, the third sub-model outputs the target operator corresponding to the subproblem one-to-one, based on the target operator and target operation data of the subproblem.

[0177] In this embodiment, after obtaining the target operator and target operation data of the subproblem, the third sub-model can obtain the target operator corresponding to the subproblem. Taking subproblem 2 as an example, the target operator corresponding to subproblem 2 is SELECT, the target operation data of subproblem 2 is "line number greater than 71" and the output data of the target operator corresponding to subproblem 1. In this embodiment, "#" and Arabic numerals are used to represent the output data of the target operator corresponding to the subproblem. Therefore, the target operator corresponding to subproblem 2 can be represented as: #2.FILTER: #1of "line number greater than 71", where "#1" represents the output data of the operator corresponding to subproblem 1.

[0178] Based on the above embodiments, as an optional embodiment, at least one of the entity of the subproblem and the output data of the fourth operator is used as the target operation data of the operator corresponding to the subproblem, including:

[0179] If it is determined that all entities of a subproblem are unrelated to the output data of the target operator of a subproblem that has a reference relationship with the subproblem, then the entities of the subproblem are used as the target operation data of the target operator corresponding to the subproblem.

[0180] If it is determined that all entities of a subproblem are related to the output data of the target operator of a subproblem that has a reference relationship with the subproblem, then the output data of the operator is used as the target operation data of the target operator corresponding to the subproblem.

[0181] If it is determined that the first entity of the subproblem is unrelated to the output data of the target operator of the subproblem that is related to the subproblem, and the second entity of the subproblem is related to the output data of the target operator of the subproblem that is related to the subproblem, then the first entity and the output data of the target operator are used as the target operation data of the target operator corresponding to the subproblem.

[0182] In this embodiment, for each subproblem, if the subproblem does not require the output results of other subproblems, then all entities in the subproblem are unrelated to the output data of the target operator corresponding to the subproblem that has a reference relationship with the subproblem. Conversely, if the subproblem requires the output results of other subproblems, then the entities in the subproblem are related to the output data of the target operator corresponding to the subproblem that has a reference relationship with the subproblem. It should be noted that, in the latter case, it is possible that some entities in the subproblem are related to the output data of the target operator corresponding to the subproblem that has a reference relationship with the subproblem, while other entities in the subproblem are unrelated to the output data of the target operator corresponding to the subproblem that has a reference relationship with the subproblem. For each subproblem, after determining the relationship between the entities in the subproblem and the output data of the target operator corresponding to the subproblem that has a reference relationship with the subproblem, the target operation data of the target operator corresponding to the subproblem can be determined.

[0183] In addition to the above embodiments, as an optional embodiment, it further includes:

[0184] For each target operator, the target operator, target operation data, and output data of the target operator are each treated as a node;

[0185] For each target operator, a directed edge is constructed between the node corresponding to the target operation data of the target operator and the node corresponding to the target operator of the target operator, and a directed edge is constructed between the node corresponding to the target operator of the target operator and the node corresponding to the output data of the target operator;

[0186] Based on each node and the directed edges between them, a directed acyclic graph is constructed. The directed acyclic graph is used to represent the relationship between the composite operations of the target operators.

[0187] In this embodiment, a directed acyclic graph (DAG) is used to illustrate the composite operations between operators. A specific example is given below to illustrate how to construct a directed acyclic graph.

[0188] Figure 3 is a schematic diagram of a directed acyclic graph provided in an embodiment of this application. As shown in Figure 3, rectangular nodes represent target operators, and circular nodes represent target operation data and output data. Node "Total Operating Expenses" is the target operation data of #1, node "#1SELECT" is the target operator of #1, and node "#1 Output Data" represents the output data of #1. Therefore, directed edges from the target operation data of #1 to the target operator and from the target operator of #1 to the output data can be constructed. Similarly, node "#2FILTER" is the target operator of #2, node "#1 Output Data" is also the target operation data of #2, and another target operation data of #2 is node "Line Number Greater Than 71". Node "#2 Output Data" represents the output data of #2. Therefore, directed edges from the target operation data of #2 to the target operator and from the target operator of #2 to the output data can be constructed. Through the above-mentioned nodes and the directed edges between nodes, a directed acyclic graph of #1 and #2 can be generated. A directed acyclic graph can clearly show the relationship between the composite operations of #1 and #2.

[0189] It should be noted that in this embodiment of the application, in order to distinguish between the node corresponding to the target operator and the node corresponding to the target operator data, different graphics can be used to represent them. For example, a rectangle can be used to represent the node corresponding to the target operator, and a circle can be used to represent the node corresponding to the target operation data and the output data.

[0190] It should also be noted that in the embodiments of this application, the output data of one target operator may be the target operation data of another target operator. In this case, a single node is used to represent both the output data and the target operation data, rather than using multiple nodes to represent them separately.

[0191] Based on the above embodiments, as an optional embodiment, the indicator system includes a third mapping relationship between preset indicator attributes and SQL statement keywords;

[0192] Input the target metric into the preset metric system to obtain the corresponding SQL statement, including the following steps:

[0193] S501. The indicator system obtains the keywords of the SQL statement corresponding to each indicator attribute in the target indicator based on the third mapping relationship.

[0194] In this embodiment of the application, the indicator attributes and the keywords of the SQL statement have a corresponding relationship. For example, the indicator attribute "metricNames" corresponds to the SQL statement keyword "SELECT", and the indicator attribute "where" corresponds to the SQL statement keyword "where". Therefore, the indicator attributes can be converted into the corresponding SQL statement keywords.

[0195] S502. Use the first indicator name of the target indicator and the attribute values ​​of each indicator attribute as the parameters corresponding to the keywords.

[0196] In this embodiment of the application, after obtaining the keywords of the SQL statement, the attribute values ​​of the corresponding indicator attributes can be used as the parameters corresponding to the SQL statement keywords. The parameters corresponding to the keywords include, but are not limited to, column names, table names, and expressions.

[0197] S503. Based on the keywords of the SQL statement and the parameters corresponding to each keyword, obtain the SQL statement corresponding to the target indicator.

[0198] After obtaining the keywords and parameters of the SQL statement, the keywords can be concatenated to obtain the SQL statement. Assuming the target metric is: [metricNames: Operating Expenses_SUM; where: Line Number>71], the corresponding SQL statement would be:

[0199] select Operating Expenses_SUM

[0200] from table

[0201] where line number > 71;

[0202] In this embodiment, `select`, `from`, and `where` are all keywords in SQL statements. "Operating Expenses_SUM" is the first indicator name, serving as the attribute value of the indicator attribute `select`. "Row Number > 71" is the attribute value of the indicator attribute `where`. It should be noted that in this embodiment, the data in the SQL database is stored in tables. When the indicator attribute is "select", it is necessary to specify which table to query the data from. Therefore, a `from table` statement is added during the conversion of the target indicator into an SQL statement. Here, "from" is the keyword in the SQL statement, and `table` is the table name that contains both "Operating Expenses_SUM" and "Row Number". In this embodiment, the table name containing both "Operating Expenses_SUM" and "Row Number" can be pre-set or determined through table selection logic. This embodiment does not limit how the table name is determined.

[0203] The following flowchart illustrates the process of converting user-inputted query information into SQL statements in this application.

[0204] Figure 4 is a flowchart illustrating the process of converting information to be queried into SQL statements according to an embodiment of this application. As shown in the figure, the information to be queried is input into a pre-trained large language model. The pre-trained large language model decomposes the information to be queried into at least one sub-problem and generates a target operator corresponding to each sub-problem. Each target operator includes a target operator and target operation data. Based on the conversion relationship between the operator and the indicator and the pre-trained large language model, the target operator and target operation data in each target operator are subjected to indicator parameter extraction to obtain the indicator name, indicator attribute, and attribute value of the indicator attribute. Based on the indicator name, indicator attribute, and attribute value of the indicator attribute, the target indicator is generated. The target indicator is then SQL-escaped. Specifically, based on the correspondence between the indicator attribute and the SQL statement keyword, the indicator attribute is converted into the corresponding SQL statement keyword. The obtained SQL statement keywords are concatenated, and the attribute value of the indicator attribute is used as the parameter of the corresponding SQL statement keyword to obtain the corresponding SQL statement. The parameter of the keyword can be at least one of column name, table name, or expression.

[0205] To facilitate understanding of the technical solutions in this application by those skilled in the art, the method for obtaining indicators in this application is described below through a complete embodiment.

[0206] S601. Train the large language model to be trained to obtain a pre-trained large language model.

[0207] In this embodiment of the application, a large language model to be trained is deployed on server 102. The large language model to be trained includes three sub-models, namely a first sub-model, a second sub-model, and a third sub-model. The first sub-model, the second sub-model, and the third sub-model are trained in multiple rounds of iterations using training samples until convergence, thereby obtaining a pre-trained large language model.

[0208] S602. Obtain the query information expressed in natural language by the user.

[0209] In this embodiment of the application, the information to be queried by the user can be Example 0: What is the total operating expenses of branches with branch numbers greater than 71?

[0210] S603. Input the information to be queried into a pre-trained large language model. The trained large language model will split the information to be queried into multiple sub-problems and determine the reference relationship between the sub-problems.

[0211] In this application embodiment, Example 0 can be broken down into the following two sub-problems:

[0212] Sub-question 1: What is the total operating expense?

[0213] Sub-question 2: What is the total operating expenses for branches with branch numbers greater than 71?

[0214] There is a referencing relationship between subproblem 1 and subproblem 2, and subproblem 2 needs to use the calculation result of "total operating expenses" in subproblem 1.

[0215] S604. The pre-trained large language model transforms each subproblem into an objective operator, and each objective operator includes an objective operator and objective operation data.

[0216] Transforming each subproblem into an objective operator using a pre-trained large language model includes the following sub-steps:

[0217] S6041. The pre-trained large language model obtains the grammatical structure and entity of each subproblem, and determines the target operator corresponding to the subproblem based on at least one of the grammatical structure and entity of the subproblem.

[0218] In this embodiment of the application, a pre-trained large language model performs semantic analysis on each sub-problem to obtain the subject, predicate, object, attributive, adverbial, complement, and interrogative words of the sub-problem. By analyzing these grammatical components, the grammatical structure of the sub-problem is determined. At the same time, the entity in the sub-problem can be combined to help determine the target operator corresponding to the sub-problem.

[0219] For example, the subject of subproblem 1 is "total operating expenses", the predicate is "is", and the complement is "how much". Therefore, the grammatical structure of subproblem 1 is: subject (total operating expenses) + predicate (is) + complement (how much). At the same time, the pre-trained large language model can also determine that the entity in subproblem 1 is "total operating expenses". Based on the grammatical structure and entity of subproblem 1, it can be determined that subproblem 1 needs to query the total operating expenses, and the operator corresponding to "query" is "SELECT". Thus, it can be determined that the target operator corresponding to subproblem 1 is SELECT.

[0220] The subject of subproblem 2 is "total operating expenses of branches", the predicate is "is", the modifier is "branch number is greater than 71", and the complement is "how much". Therefore, the grammatical structure of subproblem 2 is: subject (total operating expenses) + predicate (is) + modifier (branch number is greater than 71) + complement (how much). Simultaneously, the trained large language model can also determine the entities in subproblem 2, which include "total operating expenses" and "branch number is greater than 71". Based on the grammatical structure and entities of subproblem 2, it can be determined that subproblem 2 requires querying the total operating expenses of branches with branch numbers greater than 71. Therefore, it can be determined that this subproblem requires aggregation of the operating expenses of branches with branch numbers greater than 71, and the operator corresponding to "aggregation" is "FILTER". Thus, the target operator for subproblem 2 can be determined to be FILTER.

[0221] S6042. Based on the referencing relationships between subproblems, determine the target operation data of the target operator corresponding to each subproblem.

[0222] In this embodiment of the application, subproblem 1 is "what is the total operating expenses" and the entity "total operating expenses" of subproblem 1 is unrelated to the output data of the operator corresponding to subproblem 2; therefore, the entity of subproblem 1 can be used as the target operation data of the target operator corresponding to subproblem 1.

[0223] The entities of subproblem 2 are "total operating expenses" and "branch number greater than 71". Clearly, "total operating expenses" in subproblem 2 is related to the output data of the target operator corresponding to subproblem 1, while "branch number greater than 71" in subproblem 2 is unrelated to the output data of the target operator corresponding to subproblem 1. Therefore, the operational data for subproblem 2 are "branch number greater than 71" and the output data of the target operator corresponding to subproblem 1.

[0224] S6043. After determining the target operator and target operation data corresponding to each subproblem, the target operator corresponding to that subproblem can be generated.

[0225] The target operator for subproblem 1 is "SELECT", and the target data is "total operating expenses". Therefore, the target operator for subproblem 1 can be expressed as:

[0226] #1.SELECT: "Total Operating Expenses"

[0227] The target operator for subproblem 2 is "FILTER", and the target operation data are "total operating expenses" and "branch number greater than 71". Since "total operating expenses" is the output data of the target operator for subproblem 1, the target operator for subproblem 2 can be expressed as:

[0228] #2.FILTER: #1 of "line number greater than 71".

[0229] It should be noted that in this application, "#" and Arabic numerals are used to represent a target operator. In addition, "#" and Arabic numerals can also represent the output data of the target operator.

[0230] S6044. Generate directed acyclic graphs #1 and #2.

[0231] In this embodiment, node "Total Operating Expenses" is the target operation data for #1, node "#1SELECT" is the target operator for #1, and node "#1 Output Data" represents the output data of #1 and is also one of the target operation data for #2. Therefore, directed edges can be constructed from the target operation data of #1 to the target operator, and from the target operator of #1 to the output data. Similarly, node "#2FILTER" is the target operator for #2, and node "#1 Output Data" is also the target operation data for #2. Another target operation data for #2 is node "Line Number Greater Than 71," and node "#2 Output Data" represents the output data of #2. Therefore, directed edges can be constructed from the target operation data of #2 to the target operator, and from the target operator of #2 to the output data. Through the directed edges between these nodes, a directed acyclic graph of #1 and #2 can be generated.

[0232] S605. Based on the conversion relationship between operators and indicators, and combining the target operators and target operation data in each target operator, obtain the target indicators output by the large language model.

[0233] In this embodiment of the application, obtaining the target index output by the large language model includes the following sub-steps:

[0234] S6051. Take the target operator containing the first operator as the first operator, and use the pre-trained large language model to convert the operation data of the first operator into the first indicator name.

[0235] In this application, the first operator includes "SELECT" and "PROJECT". In the target operator corresponding to Example 0, #1 contains the first operator "SELECT". Therefore, #1 is the first operator. The target operation data of the first operator is "total operating expenses". Inputting "total operating expenses" into the first sub-model yields the first indicator name "operating expenses_SUM".

[0236] S6052. Based on the first mapping relationship between indicator name and indicator type, determine the first indicator type corresponding to the first indicator name.

[0237] In this embodiment of the application, the first indicator type corresponding to the first indicator name "Operating Expenses_SUM" is a lookup type.

[0238] S6053. Obtain the preset indicator attributes of the first indicator type as candidate indicator attributes.

[0239] In this embodiment of the application, the first indicator type is a data lookup type. The preset indicator attributes of the data lookup type include, but are not limited to, metricNames, where, filter, and groupBys, which are candidate indicator attributes for the data lookup type.

[0240] S6054. Based on the second mapping relationship between the indicator attributes and the operators, determine the second operator and the third operator, and obtain the indicator attributes corresponding to the target operators of each second operator and the attribute values ​​of the indicator attributes corresponding to each third operator.

[0241] In this embodiment, Table 2 shows the operators corresponding to each candidate metric attribute. Specifically, the operators for `metricNames` are `SELECT` and `PROJECT`, for `where` is `GROUP`, for `filter` are `FILTER`, `PROJECT`, and `INTERSECTION`, and for `groupBys` are `SORT` and `TOP`. These operators are used as the second operators. After obtaining the second operators, they are matched against target operator #1 and target operator #2. Both #1 and #2 match successfully; therefore, #1 and #2 are used as the second operators. Based on the second mapping relationship between metric attributes and operators, the metric attributes corresponding to the target operators of #1 and #2 are categorized as `metricNames` and `where`.

[0242] Since #1 is the first operator, the only target operator in the second operator that differs from the first operator is #2. Therefore, #2 is used as the third operator. The target operation data of #2 is input into the second sub-model to obtain the attribute value "line number > 71" of the indicator attribute corresponding to the target operation data of #2.

[0243] S6055. Generate the target indicator based on the indicator attribute corresponding to the target operator of the first operator, the first indicator name, the indicator attributes of each third operator, and the attribute values ​​of the indicator attributes of each third operator.

[0244] In this embodiment, metricNames is the metric attribute corresponding to the target operator "SELECT" in #1, and "Operating Expenses_SUM" is the name of the first metric; where is the metric attribute corresponding to the target operator "FILTER" in #2, and "Line Number > 71" is the attribute value of the metric attribute corresponding to the target operator "FILTER" in #2. Therefore, the target metric corresponding to Example 0 is as follows: [metricNames: Operating Expenses_SUM; where: Line Number > 71].

[0245] It should be noted that the first indicator name in the embodiments of this application can be regarded as the attribute value of a special indicator attribute.

[0246] S606. Use the indicator system to translate the generated target indicators into SQL statements, and use the SQL statements to retrieve the query results from the database as the answer to the query information.

[0247] In this embodiment, the metric attributes and SQL statement keywords have a corresponding relationship. The metric attribute "metricNames" corresponds to the SQL statement keyword "SELECT", and the metric attribute "where" corresponds to the SQL statement keyword "where". Therefore, the metric attributes can be converted into corresponding SQL statement keywords, and then the SQL statement keywords can be concatenated to obtain the SQL statement. The attribute value of the metric attribute corresponds to the parameter of the SQL statement keyword. The parameter of the keyword includes, but is not limited to, column names, table names, and expressions. Therefore, the SQL statement corresponding to Example 0 can be obtained:

[0248] select Operating Expenses_SUM

[0249] from table

[0250] where line number > 71;

[0251] It should be noted that in this embodiment, the data in the SQL database is stored in data tables. When the indicator attribute is "select", it is necessary to specify which table to query the data from. Therefore, a "from table" statement will be added during the process of converting the target indicator into an SQL statement. Here, "from" is the keyword of the SQL statement, and "table" is the name of the table that contains both "operating expenses_SUM" and "branch number". In this embodiment, the name of the table that contains both "operating expenses_SUM" and "branch number" can be preset or determined by the table selection logic. This embodiment does not limit how the table name is determined.

[0252] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0253] Figure 5 is a schematic diagram of an indicator acquisition device provided in an embodiment of this application. As shown in Figure 5, the indicator acquisition device 1000 includes: a first acquisition module 1001, a second acquisition module 1002 and a third acquisition module 1003.

[0254] The first acquisition module is used to acquire the query information expressed in natural language.

[0255] The second acquisition module is used to input the information to be queried into a pre-trained large language model and obtain the target index output by the large language model.

[0256] The third acquisition module is used to input the target indicator into the preset indicator system, obtain the corresponding SQL statement, and call the SQL statement to obtain the query result from the database;

[0257] The process involves inputting the information to be queried into a pre-trained large language model to obtain the target metrics output by the pre-trained large language model, including:

[0258] The information to be queried is input into a pre-trained large language model to obtain at least one target operator. The target operator includes a target operator and target operation data, where the target operation data is the entity in the information to be queried.

[0259] Based on the conversion relationship between operators and indicators, and combining the target operators and target operation data in each target operator, the target indicators output by the large language model are obtained.

[0260] The indicator acquisition device of this application embodiment can execute the indicator acquisition method provided in the embodiment of this application. The implementation principle is similar. The actions performed by each module in the indicator acquisition device of each embodiment of this application are corresponding to the steps in the indicator acquisition method of each embodiment of this application. For detailed functional descriptions of each module of the indicator acquisition device, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.

[0261] Figure 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. As shown in Figure 6, the electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one unit, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.

[0262] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0263] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in Figure 6, but this does not indicate that there is only one bus or one type of bus.

[0264] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.

[0265] The memory 4003 stores computer programs that execute embodiments of this application, and its execution is controlled by the processor 4001. The processor 4001 executes the computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.

[0266] The electronic device package may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. The electronic device shown in Figure 6 is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of this disclosure.

[0267] This application provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it can achieve the following:

[0268] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium, a computer-readable medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0269] This application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it can achieve:

[0270] The terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the figures or text.

[0271] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.

[0272] The above are only optional implementation methods for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application, without departing from the technical concept of this application, also fall within the protection scope of the embodiments of this application.

Claims

An electronic device, characterized by comprising: The method comprises the following steps: A processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor communicates with the memory through the bus, the machine readable instructions are executed by the processor to execute an index acquisition process, the index acquisition process comprises: Obtaining natural language expression of information to be queried; Input the information to be queried into a pre-trained large language model to obtain a target index output by the large language model; Input the target index into a preset index system to obtain a corresponding SQL statement, and call the SQL statement to obtain a query result from a database; Wherein, the inputting the information to be queried into the pre-trained large language model to obtain the target index output by the large language model comprises: Input the information to be queried into the large language model to obtain at least one target operator, the target operator includes a target operator and target operation data, and the target operation data is an entity in the information to be queried; According to the conversion relationship between the operator and the index, the target operator and the target operation data in each target operator are combined to obtain the target index output by the large language model. The electronic device of claim 1, wherein In the index acquisition process executed by the processor, the conversion relationship between the operator and the index includes a first mapping relationship between an index name and an index type, and a second mapping relationship between an index attribute and an operator; the large language model includes a first sub model and a second sub model; According to the conversion relationship between the operator and the index, the target operator and the target operation data in each target operator are combined to obtain the target index output by the large language model, comprising: Each operator including a preset first operator in all target operators is taken as a first operator; The target operation data of the first operator is input into the first sub model to obtain the target operation data of the first operator corresponding to the first index name output by the first sub model; According to the first mapping relationship, the first index type corresponding to the first index name is obtained; The index attribute of the first index type is obtained as a candidate index attribute; According to the second mapping relationship, the operator corresponding to each candidate index attribute is obtained as a second operator, each second operator is matched with the target operator of each target operator, and the target operator of the target operator matched successfully is taken as a second operator; according to the second mapping relationship, the index attribute corresponding to the target operator of each second operator is obtained from the candidate index attribute; The operator different from the first operator in each second operator is taken as a third operator, the target operation data of each third operator is input into the second sub model, and the attribute value of the index attribute corresponding to the target operator of each third operator output by the second sub model is obtained. obtain the index attribute corresponding to the target operator of the first operator and the index attribute corresponding to the target operator of each third operator from the index attributes corresponding to the target operators of the second operators; and take the first index name as the attribute value of the index attribute corresponding to the target operator of the first operator; generate the target index according to the index attribute corresponding to the target operator of the first operator, the first index name, the index attribute corresponding to the target operator of each third operator, and the attribute value of the index attribute corresponding to the target operator of each third operator. The electronic device according to claim 2, characterized in that, In the index obtaining process performed by the processor, the first sub-model is trained by taking the operation data of the sample operator as a training sample and taking the index name corresponding to the operation data of the sample operator as a training label. The second sub-model is trained by taking the operation data of the sample operator as a training sample and taking the attribute value of the index attribute corresponding to the operation data of the sample operator as a training label. The electronic device of claim 1, wherein In the index obtaining process performed by the processor, the large language model comprises a third sub-model. The third sub-model comprises a third sub-model. The third sub-model comprises a third sub-model. The third sub-model comprises a third sub-model. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. The electronic device of claim 4, wherein For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. For each sub-problem, the third sub-model determines the target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem. If it is determined that the first entity of the sub-problem is irrelevant to the output data of the target operator corresponding to the sub-problem having a reference relationship with the sub-problem, and the second entity of the sub-problem is relevant to the output data of the target operator corresponding to the sub-problem having a reference relationship with the sub-problem, the first entity and the output data of the target operator are taken as the target operation data of the target operator corresponding to the sub-problem. The electronic device of claim 5, wherein In the index acquisition process performed by the processor, the processor is further configured to perform: For each target operator, the target operator, the target operation data and the output data of the target operator are taken as a node respectively; For each target operator, a directed edge between the node corresponding to the target operation data of the target operator and the node corresponding to the target operator of the target operator is constructed, and a directed edge between the node corresponding to the target operator of the target operator and the node corresponding to the output data of the target operator is constructed; According to each node and the directed edges between the nodes, a directed acyclic graph is constructed, which is used to represent the relationship between the composite operations of the target operators. The electronic device of claim 1, wherein The index system includes a third mapping relationship between the preset index attributes and the SQL statement keywords; The target index is input into the preset index system to obtain a corresponding SQL statement, which includes: The index system obtains the keywords of the SQL statement corresponding to each index attribute in the target index according to the third mapping relationship; The first index name of the target index and the attribute values of each index attribute are taken as the parameters corresponding to the corresponding keywords; The SQL statement corresponding to the target index is obtained according to the keywords of the SQL statement and the parameters corresponding to each keyword. A method for acquiring an index, characterized in that It includes: Obtain the natural language expression of the information to be queried; The target index output by the large language model is obtained by inputting the information to be queried into the pre-trained large language model; The target index is input into the preset index system to obtain a corresponding SQL statement, which calls the SQL statement to obtain the query result from the database; The target index output by the large language model is obtained by inputting the information to be queried into the pre-trained large language model, which includes: The target operator including the target operator and the target operation data in the target information is obtained by inputting the target information into the large language model; According to the conversion relationship between the operators and the indexes, the target index output by the large language model is obtained by combining the target operator and the target operation data in each target operator. The method of claim 8, wherein The conversion relationship between the operators and the indexes includes a first mapping relationship between the index name and the index type, and a second mapping relationship between the index attribute and the operator; the large language model includes a first sub-model and a second sub-model; The target index output by the large language model is obtained by combining the target operator and the target operation data in each target operator according to the conversion relationship between the operators and the indexes, which includes: Each operator in all target operators, including a preset first operator, is taken as a first operator; Target operation data of the first operator is input into the first sub-model, and a first index name corresponding to the target operation data of the first operator output by the first sub-model is obtained; According to the first mapping relationship, a first index type corresponding to the first index name is obtained; An index attribute preset for the first index type is taken as a candidate index attribute; According to the second mapping relationship, an operator corresponding to each candidate index attribute is obtained as a second operator, each second operator is matched with a target operator of each target operator, and a target operator of a target operator that matches successfully is taken as a second operator; according to the second mapping relationship, an index attribute corresponding to the target operator of each second operator is obtained from the candidate index attribute; An operator different from the first operator in each second operator is taken as a third operator, target operation data of each third operator is input into the second sub-model, and attribute values of index attributes corresponding to target operators of each third operator output by the second sub-model are obtained; The target operator corresponding to the index attribute of the first operator and the target operator corresponding to the index attribute of each third operator are obtained from the index attribute corresponding to the target operator of each second operator; the first index name is taken as the attribute value of the index attribute corresponding to the target operator of the first operator; The target index is generated according to the index attribute corresponding to the target operator of the first operator, the first index name, the index attribute corresponding to the target operator of each third operator, and the attribute value of the index attribute corresponding to the target operator of each third operator. The method of claim 9, wherein The first sub-model is trained by taking operation data of a sample operator as a training sample and taking an index name corresponding to the operation data of the sample operator as a training label; The second sub-model is trained by taking operation data of a sample operator as a training sample and taking an attribute value of an index attribute corresponding to the operation data of the sample operator as a training label. The method of claim 8, wherein The large language model includes a third sub-model; The target operator includes a target operator and target operation data, and includes: The third sub-model decomposes the to-be-queried information into at least one sub-problem, performs semantic analysis on each sub-problem, obtains a syntax structure and an entity of each sub-problem, and an reference relationship between sub-problems; For each sub-problem, the third sub-model determines a target operator corresponding to the sub-problem according to at least one of the syntax structure and the entity of the sub-problem; For each sub-problem, the third sub-model obtains output data of a fourth operator by taking, as the fourth operator, a target operator of a sub-problem having a reference relationship with the sub-problem according to the reference relationship between sub-problems, and takes at least one of the entity of the sub-problem and the output data of the fourth operator as target operation data of the target operator corresponding to the sub-problem; The third sub-model outputs a target operator corresponding to each sub-problem according to the target operator of the sub-problem and target operation data. The method of claim 11, wherein The entity of the sub-problem and at least one of the output data of the fourth operator are taken as the target operation data of the target operator corresponding to the sub-problem, including: If it is determined that all entities of the sub-problem are irrelevant to the output data of the target operator corresponding to the sub-problem having a reference relationship with the sub-problem, the entity of the sub-problem is taken as the target operation data of the target operator corresponding to the sub-problem; If it is determined that all entities of the sub-problem are relevant to the output data of the target operator corresponding to the sub-problem having a reference relationship with the sub-problem, the output data of the operator is taken as the target operation data of the target operator corresponding to the sub-problem; If it is determined that the first entity of the sub-problem is irrelevant to the output data of the target operator corresponding to the sub-problem having a reference relationship with the sub-problem, and the second entity of the sub-problem is relevant to the output data of the target operator corresponding to the sub-problem having a reference relationship with the sub-problem, the first entity and the output data of the target operator are taken as the target operation data of the target operator corresponding to the sub-problem. The method of claim 12, wherein Further comprising: For each target operator, the target operation operator, target operation data and output data of the target operator are taken as a node respectively; For each target operator, a directed edge between the node corresponding to the target operation data of the target operator and the node corresponding to the target operation operator of the target operator is constructed, and a directed edge between the node corresponding to the target operation operator of the target operator and the node corresponding to the output data of the target operator is constructed; According to each node and the directed edges between the nodes, a directed acyclic graph is constructed, which is used to represent the relationship of composite operations between target operators. The method of claim 8, wherein The index system includes a third mapping relationship between a preset index attribute and a SQL statement keyword; The index system includes a third mapping relationship between a preset index attribute and a SQL statement keyword; The index system includes a third mapping relationship between a preset index attribute and a SQL statement keyword; The index system includes a third mapping relationship between a preset index attribute and a SQL statement keyword; The index system includes a third mapping relationship between a preset index attribute and a SQL statement keyword. An index acquisition device characterized by comprising: The first acquisition module is configured to acquire natural language expressed to-be-queried information. The second acquisition module is configured to input the to-be-queried information into a pre-trained large language model to obtain target indexes output by the large language model. The third acquisition module is configured to input the target indexes into a preset index system to obtain corresponding SQL statements, and call the SQL statements to obtain query results from a database. The to-be-queried information is input into the pre-trained large language model to obtain the target indexes output by the large language model, including: ​ input the to-be-queried information into the large language model to obtain at least one target operator, the target operator including a target operator and target operation data, the target operation data being an entity in the to-be-queried information; According to the conversion relationship between the operator and the index, combined with the target operator and the target operation data in each target operator, the target index output by the large language model is obtained. A computer-readable storage medium, characterized by, The computer readable storage medium stores a computer program, and the computer program is run by the processor to execute the steps of the method according to any one of claims 8 to 14.

Citation Information

Patent Citations

  • Data processing method, device and equipment and computer readable storage medium

    CN116821103A

  • SQL statement generation method, device and equipment

    CN117056351A

  • Method, device, equipment and medium for converting natural language problem into SQL (Structured Query Language) statement

    CN117667992A

  • SQL (Structured Query Language) statement generation method and device based on large language model, equipment and medium

    CN117743371A

  • Index acquisition method and device, electronic equipment and computer readable storage medium

    CN118673038A