A query method, device and equipment based on a large language model and a medium
By decomposing and validating the query intent of indicators using a large language model, the problem of query errors caused by users' non-technical terms was solved, and efficient and accurate acquisition of economic indicator data was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG-HONG KONG-MACAO GREATER BAY AREA DIGITAL ECONOMY RESEARCH INSTITUTE (INTERNATIONAL ADVANCED TECHNOLOGY APPLICATION PROMOTION CENTER (SHENZHEN)
- Filing Date
- 2025-07-18
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, the query information entered by non-professional users contains non-standard terminology, making it difficult for rule engines to accurately identify economic indicator data, resulting in incorrect or failed query results.
The query intent of the indicator is obtained by a large language model, decomposed into a structured indicator representation, and the results are calculated using a pre-set indicator query database. An initial indicator query dataset is constructed by combining the decomposed example dataset and historical reports for verification and fine-tuning to optimize model performance.
It significantly improves the accuracy and efficiency of indicator queries, avoids query errors caused by non-technical terms, supports adaptive processing of complex nested calculation scenarios, and enhances model performance.
Smart Images

Figure CN120910097B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a query method, apparatus, device and medium based on a large language model. Background Technology
[0002] Industry economic data is a crucial reference for enterprise development decisions. Comprehensive and accurate industry economic data can help enterprises gain a competitive edge in decision-making and market competition, playing a vital role in their development. Currently, rule engines are commonly used to query economic indicator data. However, since users are usually not economic professionals, their query information often contains non-standard terminology, making it difficult for rule engines to accurately identify the information the user is looking for, leading to incorrect query results or query failures.
[0003] Therefore, existing technologies still need to be improved and enhanced. Summary of the Invention
[0004] The technical problem to be solved by this application is to provide a query method, apparatus, device and medium based on a large language model, addressing the shortcomings of existing technologies.
[0005] To address the aforementioned technical problems, the first aspect of this application provides a query method based on a large language model, wherein the query method based on a large language model specifically includes:
[0006] In response to user interaction queries, the first query intent of the metric is obtained through a large language model.
[0007] Based on the query intent of the first indicator, the first indicator result of the indicator query is obtained through the large language model;
[0008] Based on the query intent of the first indicator and the constructed decomposed example dataset, the second indicator result of the query is obtained through a large language model;
[0009] The first indicator result is verified based on the second indicator result to obtain the final indicator result of the indicator query.
[0010] The query method based on a large language model, wherein obtaining the first indicator result of the indicator query through the large language model according to the first indicator query intent specifically includes:
[0011] Based on the first indicator query intent, the indicator query is decomposed into a structured indicator representation using a large language model. The structured indicator representation is used to reflect the calculation content of the indicator query.
[0012] The query results of the indicator query are calculated based on the structured indicator representation and the preset indicator query database to obtain the first indicator result.
[0013] The query method based on a large language model, wherein obtaining the second indicator result of the indicator query through a large language model based on the first indicator query intent and the constructed decomposed example dataset specifically includes:
[0014] Select several reference queries for the indicator query in the constructed decomposed example dataset;
[0015] Based on the aforementioned reference queries, and according to the first indicator query intent, the indicator query is decomposed into a structured indicator representation using a large language model. The structured indicator representation is used to reflect the calculation content of the indicator query.
[0016] The index results of the index query are calculated based on the structured index representation and the preset index query database to obtain the second index result.
[0017] The query method based on a large language model, wherein the step of decomposing the index query into a structured index representation based on the first index query intent using a large language model specifically includes:
[0018] When the first indicator query intent is a first indicator query, the semantic similarity between the indicator query and each formula in the preset indicator calculation formula library is calculated, and a preset number of candidate indicator calculation formulas are selected based on the semantic similarity.
[0019] The index query is decomposed into a first structured index representation by using a large language model based on the preset number of candidate index calculation formulas, so as to obtain the structured index representation of the first index query.
[0020] The query method based on a large language model, wherein determining the query result of the indicator query using the large language model based on the structured indicator representation and a preset indicator query database specifically includes:
[0021] The second structured index representation required for the first structured index representation is obtained through a large language model. The second structured index representation reflects the structured index representation of the second index query.
[0022] The intermediate index results are obtained by retrieving them from the preset index query database based on the second structured index representation using a large language model.
[0023] The result of the first indicator query is calculated based on the intermediate indicator result.
[0024] The query method based on a large language model, wherein the step of decomposing the index query into a structured index representation based on the first index query intent using a large language model specifically includes:
[0025] When the query intent of the first indicator is a query for the second indicator, the indicator query is decomposed into a second structured indicator representation through the large language model;
[0026] The large language model retrieves the structured index representation of the second index query from the preset index query database based on the second structured index representation to obtain the structured index representation of the second index query.
[0027] The query method based on a large language model, wherein verifying the first indicator result based on the second indicator result to obtain the final indicator result of the indicator query specifically includes:
[0028] Compare the result of the second indicator with the result of the first indicator;
[0029] If the result of the second indicator is the same as the result of the first indicator, then the result of the first indicator shall be taken as the final result of the indicator query.
[0030] If the result of the second indicator is different from the result of the first indicator, then the steps of obtaining the first indicator query intent of the indicator query through the large language model and obtaining the first indicator result of the indicator query through the large language model based on the first indicator query intent are re-executed.
[0031] The query method based on a large language model, wherein, before obtaining the first query intent of the indicator query through the large language model in response to user interaction, the method further includes:
[0032] An initial indicator query dataset is constructed based on data tables from several historical reports. The initial indicator query dataset includes several indicator query data tuples, and each indicator query data tuple includes historical indicator queries and historical query results.
[0033] The second indicator query intent is obtained by using a large language model to query historical indicators.
[0034] Based on the query intent of the second indicator, the third indicator result of the indicator query is obtained through the large language model;
[0035] The results of the third indicator are verified using the historical query results.
[0036] If the verification passes, a decomposed example dataset is constructed for the historical indicator query based on the results of the third indicator.
[0037] The query method based on a large language model, wherein the step of constructing a decomposed example dataset for querying the historical indicators based on the results of the third indicator specifically includes:
[0038] Obtain the correct data item corresponding to the result of the third indicator;
[0039] The parameters of the correct data item are used as decomposition example data to obtain a decomposition example dataset, wherein the parameters of the correct data item include historical indicator queries, the second structured indicator representation required for the historical indicator queries, and the indicator calculation formula.
[0040] The query method based on a large language model, wherein the step of verifying the third indicator result using the historical query results further includes:
[0041] If the verification fails, the corresponding erroneous data item in the third indicator result is located and the erroneous data item is marked.
[0042] The parameters of the error data items are used as a fine-tuning data group to obtain a fine-tuning dataset, wherein the parameters of the error data items include task content, error result, error cause, and annotation result;
[0043] The large language model is fine-tuned using the fine-tuning dataset.
[0044] A second aspect of this application provides a query device based on a large language model, wherein the query device based on the large language model specifically includes:
[0045] The acquisition module is used to respond to the indicator query of the user interaction and obtain the first indicator query intent of the indicator query through the large language model;
[0046] The first query module is used to obtain the first indicator result of the indicator query through a large language model based on the first indicator query intent.
[0047] The second query module is used to obtain the second indicator result of the indicator query through a large language model based on the first indicator query intent and the constructed decomposed example dataset;
[0048] The verification module is used to verify the first indicator result based on the second indicator result in order to obtain the final indicator result of the indicator query.
[0049] A third aspect of this application provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps in the query method based on a large language model as described above.
[0050] A fourth aspect of this application provides a terminal device, which includes: a processor and a memory;
[0051] The memory stores a computer-readable program that can be executed by the processor;
[0052] When the processor executes the computer-readable program, it implements the steps in any of the above-described query methods based on a large language model.
[0053] Beneficial effects:
[0054] 1. This application decomposes the indicator query into a structured indicator representation based on the indicator query intent, clarifies the precise path of the indicator query, and performs cross-level queries based on this path, effectively avoiding query errors or failures caused by the inclusion of non-technical terms in the indicator query, thereby significantly improving the accuracy of the indicator query.
[0055] 2. This application constructs a structured indicator representation for the first indicator query (composite indicator query) and a structured indicator representation for the second indicator query (atomic indicator query), and automatically switches the structured indicator representation according to the indicator query intent, realizing a three-level linkage between the indicator query intent, the first indicator query, and the second indicator query, avoiding the risk of misjudgment from a single structured indicator representation, and further improving the accuracy of indicator queries.
[0056] 3. This application constructs an automated closed loop for the first indicator query, which includes formula retrieval, dynamic binding of the second structured indicator representation, and function-based calculation. This overcomes the limitations of manually configuring formulas, supports adaptive processing of complex nested calculation scenarios, and significantly improves the calculation efficiency and accuracy of complex indicators.
[0057] 4. This application utilizes a large model to automatically construct an initial indicator query dataset from the data tables in historical reports, and uses the initial indicator query dataset to verify the query process to identify erroneous data groups. The erroneous data groups are then used to fine-tune the large language model, optimizing the bias process in the large language model and improving its performance.
[0058] 5. This application constructs a decomposed example dataset using the initial indicator query dataset, and uses the constructed decomposed example dataset to verify the indicator results determined by the large language model. On the one hand, this effectively constrains the logical deviations caused by the model's free play, and on the other hand, it solves the implicit calculation errors caused by the lack of formula library or semantic ambiguity. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] Figure 1 This is a schematic diagram illustrating an application scenario of the query method based on a large language model provided in the embodiments of this application.
[0061] Figure 2 A flowchart illustrating the query method based on a large language model provided in this application embodiment.
[0062] Figure 3 This is a flowchart of the process for obtaining the results of the first indicator.
[0063] Figure 4 This is a flowchart of the process for obtaining the first structured index representation.
[0064] Figure 5 This is a flowchart of the process for obtaining the results of the second indicator.
[0065] Figure 6 A schematic diagram of the query device based on a large language model provided in the embodiments of this application.
[0066] Figure 7 A schematic block diagram of the terminal device provided in the embodiments of this application. Detailed Implementation
[0067] This application provides a query method, apparatus, device, and medium based on a large language model. To make the objectives, technical solutions, and effects of this application clearer and more explicit, the following detailed description is provided with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit this application.
[0068] 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 term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0069] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0070] It should be understood that the sequence number and size of each step in this embodiment do not imply the order of execution. The execution order of each process is determined by its function and internal logic, and should not constitute any limitation on the implementation process of this application embodiment.
[0071] Research has shown that industry economic data is a crucial reference for corporate development decisions. Comprehensive and accurate industry economic data can help companies gain a competitive edge in decision-making and market competition, playing a vital role in their development. Currently, rule engines are commonly used to query economic indicator data. However, since users are usually not economic professionals, their query information often contains non-standard terminology, making it difficult for rule engines to accurately identify the information the user is looking for, leading to incorrect query results or query failures.
[0072] To address the aforementioned issues, in this embodiment, in response to a user-interacted indicator query, a first indicator query intent is obtained using a large language model; a first indicator result is obtained using the large language model based on the first indicator query intent; a second indicator result is obtained using the large language model based on the first indicator query intent and a constructed decomposed example dataset; and the first indicator result is verified based on the second indicator result to obtain the final indicator result. This application determines the first query result of the indicator query based on the indicator query intent, then obtains the second indicator result based on prior knowledge provided by several reference queries, and verifies the first indicator result using the second indicator result. This effectively avoids query errors or failures caused by the inclusion of non-technical terms in the indicator query, thus improving the accuracy of the indicator query.
[0073] An application environment diagram of the query method based on a large language model provided in this application embodiment can be shown as follows: Figure 1 As shown. (Refer to...) Figure 1 The query system based on a large language model includes a user terminal 110 and a server 120. The user terminal 110 and server 120 are connected via a network. The user terminal 110 can be a desktop user terminal or a mobile user terminal, specifically a mobile phone, tablet computer, laptop computer, or at least one of these. The server 120 can be a standalone server or a cluster of multiple servers. The user terminal 110 receives the indicator query input by the user. The server 120 retrieves the indicator query from the user terminal 110, responds to the user's interactive indicator query, obtains a first indicator query intent through the large language model, obtains a first indicator result based on the first indicator query intent through the large language model, obtains a second indicator result based on the first indicator query intent and a constructed decomposed example dataset through the large language model, and verifies the first indicator result based on the second indicator result to obtain the final indicator result of the indicator query.
[0074] The application content will be further explained below with reference to the accompanying drawings and the description of the embodiments.
[0075] This application provides a query method based on a large language model, such as... Figure 2 As shown, the query method based on the large language model specifically includes:
[0076] S10. Respond to the indicator query of the user interaction and obtain the first indicator query intent of the indicator query through the large language model.
[0077] Specifically, the indicator query is used to retrieve the indicator result corresponding to the query for a given indicator. For example, if the indicator query is "the contribution points of manufacturing to industrial growth in XXX region in XXX year", then the corresponding query indicator is the contribution points, and the indicator result is the result of the contribution points. Indicator queries can be economic indicator queries, business indicator queries, etc.
[0078] The first indicator query intent reflects the indicator type of the queried indicator. It can include both a first indicator query and a second indicator query. A first indicator query can retrieve composite indicators that require derivative calculations using a second indicator (atomic indicator) to obtain the query result, such as pull points, contribution rate, percentage, and growth rate. Composite indicators require the results of atomic indicators to calculate the result. A second indicator query can retrieve indivisible atomic indicators, such as GDP and industrial output. Atomic indicators can be basic indicators whose results are directly retrieved from a pre-defined indicator query database. The first indicator query intent can be identified using a large language model. Specifically, when responding to a user's interactive indicator query, the query can be input into a large language model. The model then classifies the query intent to obtain the first indicator query intent. During this classification, intent classification prompts can be constructed, which can include the indicator query and task requirements. The task requirements inform the model of the task to be performed.
[0079] Example: Intent classification prompts:
[0080] Indicator Query: {Indicator Query}
[0081] Task Requirements: As an economic analyst, please determine which category of indicator query it belongs to: 1. Primary indicator query (such as percentage, driving points, growth rate, etc.); 2. Secondary indicator query (such as GDP, industrial output, etc.); 3. Other cases (non-data query)".
[0082] This application embodiment uses a large language model to classify the intent query of the indicator query to obtain the first indicator query intent, so as to obtain the query result of the indicator query based on the first indicator query intent and improve the accuracy of the indicator query result.
[0083] S20. Based on the query intent of the first indicator, obtain the first indicator result of the indicator query through the large language model.
[0084] Specifically, the first indicator result is obtained by the large language model based on the first indicator query intent. When obtaining the first indicator result, the large language model first converts the indicator query into a structured indicator representation, and then calculates the first indicator result of the indicator query based on the structured indicator representation.
[0085] For example, such as Figure 3 As shown, the step of obtaining the first indicator result of the indicator query through a large language model based on the first indicator query intent specifically includes:
[0086] S21. Based on the query intent of the first indicator, the indicator query is decomposed into a structured indicator representation using a large language model;
[0087] S22. Calculate the query result of the indicator query based on the structured indicator representation and the preset indicator query database to obtain the first indicator result.
[0088] In step S21, the structured index representation reflects the calculation content of the index query, and the index result can be obtained according to this calculation content. Since the first index query intent includes a first index query for querying composite indicators and a second index query for querying atomic indicators, the atomic indicators can directly obtain the index results from the preset index query database, while the composite indicators need to be decomposed into atomic indicators first, and then the index results of the atomic indicators are used to calculate to obtain the final index result. Therefore, structured index representations can be constructed for the first index query and the second index query respectively, wherein the structured index representation constructed for the first index query is denoted as the first structured index representation, and the structured index representation constructed for the second index query is denoted as the second structured index representation. In this way, when decomposing an indicator query into a structured indicator representation based on the first indicator query intent, if the first indicator query intent is a first indicator query, then the indicator query is decomposed into a first structured indicator representation; if the first indicator query intent is a second indicator query, then the indicator query is decomposed into a second structured indicator representation. This allows for automatic switching of structured indicator representations based on the first indicator query intent, achieving three-level linkage between first indicator query intent recognition, first indicator query, and second indicator query. This avoids the risk of misjudgment from a single calculation method and further improves the accuracy of indicator queries.
[0089] In one embodiment, such as Figure 4 As shown, the step of decomposing the index query into a structured index representation using a large language model based on the first index query intent specifically includes:
[0090] S211. When the first indicator query intent is a first indicator query, calculate the semantic similarity between the indicator query and each formula in the preset indicator calculation formula library, and select a preset number of candidate indicator calculation formulas based on the semantic similarity.
[0091] S212. The index query is decomposed into a first structured index representation by using a large language model based on the preset number of candidate index calculation formulas, so as to obtain the structured index representation of the first index query.
[0092] Specifically, the first structured indicator representation includes a second structured indicator representation and a composite indicator function used to calculate the first indicator query. The composite indicator function is a calculation function for calculating the indicator result of the first indicator query. The calculation function may include the indicator calculation formula and code calculation function (such as Python function) used to calculate the first indicator query using the second structured indicator representation.
[0093] The preset indicator calculation formula library is pre-built and includes multiple indicator calculation formulas for the first indicator query. These formulas can be used to calculate the result of the first indicator query. For example, if the first indicator query is "the contribution of manufacturing to industry in region XXX in year XXX", the calculation formula for the first indicator query is: "Contribution = (This year's added value by industry - Last year's added value by industry) / Last year's added value of industry * 100".
[0094] Semantic similarity can be the semantic similarity between the words included in the index query and the words included in the index calculation formula, or the overlap between the second index included in the index query and the second index used in the index calculation formula. The preset quantity can be pre-set to limit the number of candidate index calculation formulas selected from a preset index calculation formula library. The preset quantity of candidate index calculation formulas is selected in descending order of semantic similarity. This application embodiment automatically selects candidate index calculation formulas based on semantic similarity, solving the inefficiency problem of formula matching relying on manual experience in traditional methods and improving the query efficiency of index queries.
[0095] Furthermore, after obtaining a preset number of candidate indicator calculation formulas, these formulas are used as prior knowledge for the large language model. This allows the large language model to determine the second structured indicator representation and composite indicator function required for the indicator query based on these formulas, thus obtaining the first structured indicator representation for the indicator query. This application uses the large language model to precisely decompose the first indicator query into the second structured indicator representation and composite indicator function required for calculating the first indicator query, ensuring strict alignment between the calculation logic and business rules. Furthermore, the composite indicator function can automatically call the second structured indicator representation, forming a closed-loop process of obtaining the indicator calculation formula for the first indicator query – obtaining the indicator result (second structured indicator representation) for the second indicator query – dynamically calculating the indicator result for the first indicator query, further improving the query efficiency.
[0096] When determining the first structured indicator representation using a large language model, a prompt word for the first structured indicator representation is constructed for the large language model. This prompt word includes the indicator query, a preset number of candidate indicator calculation formulas, and task requirements. Furthermore, in practical applications, the prompt word for the first structured indicator representation may also include several example parsings to provide prior knowledge for parsing.
[0097] For example, the first structured indicator represents the prompt words as:
[0098] Indicator query: {Indicator query};
[0099] Candidate indicator calculation formula: {Preset number of candidate indicator calculation formulas};
[0100] Task Requirements: As an expert in economic formula analysis, please strictly follow the following rules to determine the representation of the first structured indicator:
[0101] 1. Identify composite indicators (such as percentage, growth rate, number of driving points, contribution rate, etc.) and the calculation formulas for composite indicators;
[0102] 2. Specify the second indicator required for the indicator calculation formula (using the indicator name from the database by querying the preset indicator), and the parameters required for the indicator calculation formula;
[0103] 3. Output the indicator calculation formula, including the expression of the indicator calculation formula (including mathematical symbols and variable descriptions);
[0104] 4. Output Python code functions.
[0105] Example Analysis:
[0106] Input: "The contribution of manufacturing to industrial growth in XXX region in XXX year";
[0107] Output:
[0108] {
[0109] "Atomic Indicators": ["Manufacturing Value Added in Region XXX, Year XXX", "Manufacturing Value Added in Region XXX, Year XXX", "Industrial Value Added in Region XXX, Year XXX"];
[0110] "Indicator Calculation Formula": "Dramatic Points = (Current Year's Added Value by Industry - Last Year's Added Value by Industry) / Last Year's Added Value of Industry * 100";
[0111] "Python function":"XXXX"
[0112] }
[0113] Please output the parsed results in strict JSON format. If the query does not involve composite indicators, return an empty object.
[0114] In this embodiment, a preset number of candidate indicator calculation formulas are retrieved from a preset indicator calculation formula library based on semantic similarity. Then, a large language model is used to parse the indicator query of the first indicator query based on the candidate indicator calculation formulas to convert it into a first structured indicator representation. This accurately obtains the calculation logic and data required for the first indicator query, thus achieving efficient and accurate calculation of the first indicator.
[0115] Further, in step S22, the indicator result of the first indicator query is calculated based on the first structured indicator representation. Specifically, when the intent of the first indicator query is a first indicator query, the step of determining the query result of the indicator query through a large language model based on the structured indicator representation and a preset indicator query database specifically includes:
[0116] The second structured index representation required for the first structured index representation is obtained through a large language model, and the second structured index representation is the structured index representation for the second index query.
[0117] The intermediate index results are obtained by retrieving them from the preset index query database based on the second structured index representation using a large language model.
[0118] The result of the first indicator query is calculated based on the intermediate indicator result.
[0119] Specifically, the second structured indicator representation is the structured indicator representation for the second indicator query, and also the second structured indicator representation required by the first structured indicator representation. The first structured indicator representation can invoke the decomposition process of the second structured indicator representation and retrieve indicator results from a preset indicator query database based on the second structured indicator representation, thereby realizing the automatic calculation process of the indicator results of the first indicator query. For example, the composite indicator function in the first structured indicator representation can trigger the decomposition process of the second indicator query into the second structured indicator representation and the retrieval process of obtaining intermediate indicator results based on the second structured indicator representation, and automatically input the retrieved indicator results into the composite indicator function. The composite indicator function automatically calculates the indicator results of the first indicator query, realizing a closed-loop process for calculating the indicator results of the first indicator query, and improving the query efficiency of the first indicator query.
[0120] This application constructs query paths for indicator results for both the first and second indicator queries. Then, by identifying the query intent of the first indicator query, it determines the corresponding query path and determines the indicator result according to that path. This achieves a three-level linkage between the first indicator query intent identification, the first indicator query, and the second indicator query, avoiding the risk of misjudgment from a single query path and further improving the accuracy of indicator queries. Simultaneously, it constructs an automated closed loop for the first indicator query, encompassing formula retrieval, dynamic binding of the first indicator, and function-based calculation. This overcomes the limitations of manually configuring formulas, supports adaptive processing of complex nested calculation scenarios, and significantly improves the calculation efficiency and accuracy of complex indicators.
[0121] In one embodiment, the step of decomposing the indicator query into a structured indicator representation using a large language model based on the first indicator query intent specifically includes:
[0122] When the query intent of the first indicator is a query for the second indicator, the indicator query is decomposed into a second structured indicator representation through the large language model;
[0123] The large language model retrieves the structured index representation of the second index query from the preset index query database based on the second structured index representation to obtain the structured index representation of the second index query.
[0124] Specifically, the second structured indicator representation includes several path nodes, which include restriction nodes and indicator name nodes. Restriction nodes provide limiting information for the indicator name and can include one or more. These restriction nodes progressively restrict the indicator name, enabling cross-level queries of atomic indicators and avoiding query errors or failures caused by non-technical terms in the indicator query. The restriction nodes include one or more of the following: time nodes, region nodes, and industry nodes. For example, restriction nodes may include time nodes, region nodes, and industry nodes.
[0125] When decomposing an indicator query into a second structured indicator representation using a large language model, the structural specification corresponding to the second structured indicator representation can be obtained. Then, the large language model can be used to structurally decompose the indicator query according to this structural specification to convert it into a second structured indicator representation. For example, if the structural specification is to decompose the second indicator query into a second structured indicator representation including time nodes, region nodes, industry nodes, and indicator name nodes, then for an indicator query whose first indicator query intent is to query the second indicator: "Total Industrial Output Value of Region XXX in Year XXX", it will be decomposed into "Time Node: Year XXX; Region Node: Region XXX; Industry Node: Industry; Indicator Name Node: Total Output Value", to obtain the second structured indicator representation of the indicator query, which is (Time Node: Year XXX; Region Node: Region XXX; Industry Node: Industry; Indicator Name Node: Total Output Value). This application decomposes an indicator query intended as a second indicator query into a second structured indicator representation. This not only avoids the risk of misprocessing composite indicators or non-data queries, but also ensures the uniqueness and consistency of the second indicator query in the preset indicator query database through standard fields in the second structured indicator representation, improving the automation and speed of indicator queries. Furthermore, this application incorporates implicit time identification when decomposing the second indicator query. Implicit time identification is used to identify the time node for indicator queries that do not contain a time node (e.g., inferring the current year when the period is not specified). The combination of implicit time identification and hierarchical path node extraction eliminates the ambiguity of indicator queries, further improving the accuracy and completeness of query results.
[0126] Furthermore, when decomposing the index query into a second structured index representation through a large language model, second structured index representation prompts can be constructed for the large language model. These prompts include the index query and task requirements, and can also include several example parsings to provide prior knowledge of the parsing.
[0127] For example, the second structured indicator represents the prompt words as follows:
[0128] Indicator Query: {Indicator Query}
[0129] Task requirement: As an economic data preprocessing engineer, please strictly follow the structural specifications to determine the representation of the second structured indicator;
[0130] Structural specifications:
[0131] Time range (accurate to year / quarter / month; if not explicitly stated, the implied time period needs to be identified; this year is 2025).
[0132] Geographical scope (including province / city / district / county levels, etc.)
[0133] Industry classification (using standard industry terminology, requiring normalized expression)
[0134] Indicator Name (Strictly refers to the indicator name retrieved from the preset indicator database)
[0135] Example Analysis:
[0136] Input: Total industrial output value of region XXX in year XXX
[0137] Output:
[0138] {
[0139] "Time Node": "Year XXX"
[0140] "Regional Node":"XXX Region",
[0141] "Industry Node":"Industry",
[0142] Indicator Name: "Total Output Value"
[0143] }
[0144] Please output the parsing results in strict JSON format.
[0145] Furthermore, the result of the second indicator query is obtained directly from the preset indicator query database. Accordingly, the step of determining the query result of the indicator query using the large language model based on the structured indicator representation and the preset indicator query database specifically involves:
[0146] The large language model retrieves index results from the preset index query database based on the second structured index representation.
[0147] Specifically, when the intent of the first indicator query is to query the second indicator, the indicator result is retrieved from the preset indicator query database based on the second structured indicator representation. The retrieval process can perform a hierarchical search in the preset indicator query database based on the path nodes in the second structured indicator representation to obtain the indicator result for the second indicator query.
[0148] S30. Based on the query intent of the first indicator and the constructed decomposed example dataset, obtain the second indicator result of the indicator query through a large language model.
[0149] Specifically, the constructed decomposed example dataset includes several decomposed example data for first indicator queries. This decomposed example data may include historical indicator queries, the second structured indicator representation required for historical indicator queries, and indicator calculation formulas. Furthermore, the historical query results for historical indicator queries are identical to the query results obtained by using historical indicator queries as indicator queries. This improves the accuracy of the constructed decomposed example dataset. The constructed decomposed example dataset serves to provide prior knowledge of indicator query decomposition for the large language model, thereby improving the accuracy of the large language model's decomposition of indicator queries.
[0150] Furthermore, since the result of the second indicator query is directly obtained from the preset indicator query database, it is not affected by the query results of other indicator queries. Therefore, for an indicator query whose first indicator query intent is the second indicator query, the first indicator result can be directly used as the final indicator result, without needing to obtain the second indicator result for that indicator query, and the first indicator result is verified based on the second indicator result. Based on this, before obtaining the second indicator result of the indicator query through a large language model according to the first indicator query intent and the constructed decomposed example dataset, it may include detecting whether the first indicator query intent of the indicator query is the first indicator query. If it is the first indicator query, then the second indicator result of the indicator query is obtained through a large language model according to the first indicator query intent and the constructed decomposed example dataset; if it is not the first indicator query, then the first query result is used as the final query result of the indicator query.
[0151] In one embodiment, such as Figure 5 As shown, the step of obtaining the second indicator result of the indicator query through a large language model based on the first indicator query intent and the constructed decomposed example dataset specifically includes:
[0152] S31. Select several reference queries for the indicator query in the constructed decomposed example dataset;
[0153] S32. Based on the aforementioned reference queries, the index query is decomposed into a structured index representation using a large language model according to the first index query intent. The structured index representation is used to reflect the calculation content of the index query.
[0154] S33. Calculate the index result of the index query based on the structured index representation and the preset index query database to obtain the second index result.
[0155] Specifically, the reference query is included in the constructed decomposed example dataset, and the semantic similarity between the reference query and the indicator query meets preset requirements. For example, the semantic similarity between the indicator query and each historical indicator query in the constructed decomposed example dataset is calculated, and then a historical indicator query with a semantic similarity greater than a preset similarity threshold is selected as the reference query. Alternatively, historical indicator queries of specified data are selected as reference queries in descending order of semantic similarity. Furthermore, after obtaining the reference query, it is used as a prior knowledge example for the large language model. The large language model is then controlled to use the reference query as prior knowledge to obtain the second indicator result by decomposing the indicator query into a structured indicator representation according to the intent of the first indicator query. This process can be referred to the above description and will not be described in detail here. Only an example of the prompt words of the first structured indicator representation constructed with the reference query as prior knowledge is given.
[0156] For example, the first structured indicator represents the prompt words:
[0157] Indicator query: {Indicator query};
[0158] Reference decomposition results: {Reference queries and reference structured index representations};
[0159] Task Requirements: As an expert in economic formula analysis, please strictly follow the following rules to determine the representation of the first structured indicator:
[0160] 1. Identify composite indicators (such as percentage, growth rate, number of driving points, contribution rate, etc.) and the calculation formulas for composite indicators;
[0161] 2. Define the atomic indicators required for the indicator calculation formula (using the indicator names from the database using preset indicator queries), and the parameters required for the indicator calculation formula;
[0162] 3. Output the composite indicator function, including the expression of the indicator calculation formula (including mathematical symbols and variable descriptions) and the Python code function.
[0163] Example Analysis:
[0164] Input: "The contribution of manufacturing to industrial growth in XXX region in XXX year";
[0165] Output:
[0166] {
[0167] "Atomic Indicators": ["Manufacturing Value Added in Region XXX, Year XXX", "Manufacturing Value Added in Region XXX, Year XXX", "Industrial Value Added in Region XXX, Year XXX"];
[0168] "Composite indicator function": "Dragging points = (Current year's added value by industry - Last year's added value by industry) / Last year's added value of industry * 100", "Python function": "XXXX"
[0169] }
[0170] Please output the parsed results in strict JSON format. If the query does not involve composite indicators, return an empty object.
[0171] S40. Verify the first indicator result based on the second indicator result to obtain the final indicator result of the indicator query.
[0172] Specifically, the result of the second indicator is used as the basis for judging whether the result of the first indicator can be used as the final indicator result. The result of the second indicator can be used to determine whether the result of the first indicator can be used as the final indicator result, thereby improving the accuracy of the final indicator result.
[0173] In one embodiment, verifying the first indicator result based on the second indicator result to obtain the indicator result of the indicator query specifically includes:
[0174] Compare the result of the second indicator with the result of the first indicator;
[0175] If the result of the second indicator is the same as the result of the first indicator, then the result of the first indicator shall be taken as the final result of the indicator query.
[0176] If the result of the second indicator is different from the result of the first indicator, then the steps of obtaining the first indicator query intent of the indicator query through the large language model and obtaining the first indicator result of the indicator query through the large language model based on the first indicator query intent are re-executed.
[0177] Specifically, when the second indicator result is the same as the first indicator result, it indicates that the accuracy of the first indicator result meets the requirements, and the first indicator result can be used as the final indicator result of the indicator query. Conversely, when the second indicator result is different from the first indicator result, it indicates that the accuracy of the first indicator result does not meet the requirements, and steps S10-S40 are re-executed to re-obtain the first indicator result. After re-obtaining the first indicator result, it can be directly used as the final result, or the process of verifying the first indicator result based on the second indicator result can continue until the second indicator result is the same as the first indicator result, or the number of re-executions reaches a preset threshold.
[0178] This application provides a method to use reference queries selected from a constructed decomposed example dataset based on semantic similarity as prior knowledge. The prior knowledge is then used to further decompose the index query using a large language model to obtain a second index result. The second index result is then used to verify the first index result. This effectively constrains the logical deviations caused by the free play of the large language model, solves the hidden error risk of a single calculation path, and improves the accuracy of the index result.
[0179] In one embodiment, before obtaining the first indicator query intent of the indicator query through a large language model in response to user interaction, the method further includes:
[0180] An initial indicator query dataset was constructed based on data tables from several historical reports;
[0181] The second indicator query intent is obtained by using a large language model to query historical indicators.
[0182] Based on the query intent of the second indicator, the third indicator result of the indicator query is obtained through the large language model;
[0183] The results of the third indicator are verified using the historical query results.
[0184] If the verification passes, a decomposed example dataset is constructed for the historical indicator query based on the results of the third indicator.
[0185] Specifically, the historical report includes several historical indicators and their historical results, stored in tabular form. The initial indicator query dataset includes several indicator query data tuples, each containing a historical indicator query and its historical result. For example, the indicator query data tuple might be "(the contribution of manufacturing to industry in region XXX in year XXX, 3.7)," where "the contribution of manufacturing to industry in region XXX in year XXX" is the historical indicator query and "3.7" is the historical indicator result.
[0186] The indicator query data tuples are obtained by splitting the data tables in historical reports. Specifically, after extracting the data tables from the historical reports, a large model can be used to split the data tables into several indicator query data tuples. When splitting the data tables into several indicator query data tuples using the large model, splitting prompts can be constructed for the large model. These prompts can include task requirements and data tables.
[0187] For example:
[0188] Split prompt words:
[0189] "Provide a data table in a preset format: {Table data extracted from historical reports};"
[0190] Task requirements:
[0191] Extract the indicator results of all indicators from the tabular data according to the following processing rules and return them in standard binary tuple format;
[0192] The processing rules are as follows:
[0193] Data retention: Strictly adhere to the indicator names (including qualifiers such as time, region, and industry) and numerical precision in the data table output.
[0194] Format conversion: Convert the data content in the data table into a binary array containing historical indicator queries and historical query results, such as ("XXX year XXX region manufacturing industry's contribution to industrial growth", 3.7);
[0195] Error handling: If the data table does not contain an indicator or the data is ambiguous (e.g., "approximately 3.7"), return an empty list.
[0196] Unit handling: Percentages (e.g., 25.5%) need to be converted to decimals (e.g., 0.255).
[0197] After constructing the initial indicator query dataset, an indicator calculation formula is built for the first indicator query in the historical indicator queries to obtain a preset indicator calculation formula library; a second structured indicator representation is built for the second indicator query in the historical indicator queries to obtain a preset indicator query database. The indicator calculation formula is the indicator calculation formula for the query result of the first indicator query in the historical indicator queries, and the query result of the first indicator query in the historical indicator queries can be calculated through this indicator calculation formula. Furthermore, in practical applications, after constructing the indicator calculation formula for the first indicator query in the historical indicator queries, the indicator calculation formula can be associated with the corresponding indicator query data tuple of the historical indicator queries to construct a high-quality training dataset for the first indicator query, thereby improving the model performance of the large language model trained based on the training dataset.
[0198] Furthermore, since the results of the second indicator query can be directly retrieved from the preset indicator query database, they do not require processing using the large language model. Therefore, to improve fine-tuning efficiency, only the first indicator query from historical indicator queries is selected to construct a fine-tuning dataset for fine-tuning the large language model. That is, after obtaining the second indicator query intent of the aforementioned historical indicator queries, if the second indicator query intent is the first indicator query, then the third indicator result of the indicator query is obtained through the large language model. The process of obtaining the third indicator result is the same as the process of obtaining the first indicator result, and will not be elaborated here.
[0199] After obtaining the third indicator result, it is checked whether the historical query results of the historical query indicator are the same as the third indicator result to verify the third indicator result. If the historical query results are the same as the third indicator result, the third indicator result is considered to have passed the verification; otherwise, if the historical query results are different from the third indicator result, the third indicator result is considered to have failed the verification. When the third indicator result passes the verification, a decomposed example dataset can be constructed for the historical indicator query based on the third indicator result. Specifically, constructing the decomposed example dataset for the historical indicator query based on the third indicator result includes:
[0200] Obtain the correct data item corresponding to the result of the third indicator;
[0201] The parameters of the correct data item are used as decomposition example data to obtain a decomposition example dataset, wherein the parameters of the correct data item include historical indicator queries and the structured indicator representation of the historical indicator queries.
[0202] Specifically, the correct data item is the data item used to construct the decomposed example data in the verification data group corresponding to the historical indicator query that passed the verification of the third indicator result. This verification data group consists of (historical indicator query, second indicator query, indicator calculation formula (if the intention of the first indicator query is the second indicator query, then the indicator space is empty), the query result of the second indicator query, the third indicator result, and the historical query result). In other words, after obtaining the third indicator result, the indicator calculation formula of the historical indicator query, the required second indicator query, the query result of the second indicator query, and the historical query result of the historical indicator query can be read. Based on the historical indicator query, the indicator calculation formula, the required second indicator query, the query result of the second indicator query, the third indicator result, and the historical query result of the historical indicator query, a verification data group is constructed. Then, the correct data item used to construct the decomposed example data is selected from the verification data group. The correct data item includes the historical indicator query, the second structured indicator representation required by the historical indicator query, and the indicator calculation formula.
[0203] It's important to note that after obtaining the validation data set corresponding to each historical metric query, the query accuracy of the large language model can be determined based on the validation data set. This accuracy is the proportion of validation data sets whose query results are identical to historical query results out of all validation data sets. Furthermore, the query accuracy can also be used as a basis for deciding whether to fine-tune the large language model. For example, if the accuracy is greater than a preset accuracy threshold, no fine-tuning is performed; if the accuracy is less than or equal to the preset accuracy threshold, fine-tuning is performed. This explanation will focus on fine-tuning the large language model.
[0204] In one embodiment, the step of verifying the third indicator result using the historical query results further includes:
[0205] If the verification fails, the corresponding erroneous data item in the third indicator result is located and the erroneous data item is marked.
[0206] The parameters of the error data items are used as a fine-tuning data group to obtain a fine-tuning dataset, wherein the parameters of the error data items include task content, error result, error cause, and annotation result;
[0207] The large language model is fine-tuned using the fine-tuning dataset.
[0208] Specifically, erroneous data items are data items in the validation data group where the third indicator result failed validation. The error reason is the reason why the third indicator result passed validation. The process of obtaining the error reason can be as follows: first, obtain the erroneous data items in the validation data group that contain errors, and then analyze the reasons that caused the errors in the erroneous data items to obtain the error reason. For example, if the erroneous data item "Query result of the second indicator query" contains query failures (i.e., the query result of the second indicator query has incorrect parameters), analyzing the reasons for the errors in the query result of the second indicator query reveals that the second structured indicator in the second indicator query is incorrect. Therefore, the error reason for the erroneous data group is that the first structured indicator in the second indicator query is incorrect.
[0209] Furthermore, when constructing the fine-tuning dataset based on the error cause, the annotation results of the erroneous data items and the corresponding task content can be obtained. Then, a fine-tuning data group is generated based on the task content corresponding to the erroneous data item, the error result of the erroneous data item, the error cause, and the annotation result of the erroneous data item. The dataset composed of all the fine-tuning data groups is the fine-tuning dataset. That is, each fine-tuning data group in the fine-tuning dataset includes the task content, error result, error cause, and annotation result corresponding to the erroneous data item. For example, when the atomic indicator result in the erroneous data group is an erroneous data item, the task content corresponding to the erroneous data item is the decomposition of the first structured indicator representation, the error result of the erroneous data item is the atomic indicator result in the erroneous data group, the error cause is the error in the first structured indicator representation of the atomic indicator, and the annotation result of the erroneous data item is the annotation indicator result of the second indicator query, then the fine-tuning data group corresponding to the erroneous data group is (the decomposition of the first structured indicator representation, the query result of the second indicator query in the erroneous data group, the error in the second structured indicator representation, and the annotation indicator result).
[0210] It should be noted that after obtaining the error cause, the error data group can be filtered based on the error cause. Then, the user can be prompted to annotate the filtered error data items to obtain the annotation results. The filtering basis can be a preset error cause dataset. The filtering process involves retaining error data groups whose error causes belong to the preset error cause dataset and deleting error data groups whose error causes do not belong to the preset error cause dataset. Of course, in practical applications, other methods can also be used to filter the error data group, such as randomly selecting a preset number of error data groups; no specific restrictions are placed here.
[0211] This application's embodiments calculate the query results of the initial indicator query dataset and generate a verification data set based on the query results, thereby achieving quality monitoring of the first indicator query from the second indicator query. Furthermore, in the quality monitoring of the first indicator query from the second indicator query, the deviation points of the large language model (such as the parsing of indicator calculation formulas or the acquisition of indicator results from the second indicator query) can be located based on the error data sets in the verification data set. A fine-tuning dataset is then formed for these deviation points of the large language model, and the large language model is fine-tuned using this dataset. This optimizes the deviation points of the large language model, improves its performance, and ultimately enhances the accuracy of the indicator query.
[0212] In summary, this embodiment provides a query method based on a large language model. The method includes responding to a user interaction query for an indicator; obtaining a first indicator query intent using a large language model; obtaining a first indicator result using the large language model based on the first indicator query intent; obtaining a second indicator result using the large language model based on the first indicator query intent and a constructed decomposed example dataset; and verifying the first indicator result based on the second indicator result to obtain the final indicator result. This application determines the first query result by analyzing the indicator query intent, then obtains the second indicator result based on prior knowledge provided by several reference queries, and verifies the first indicator result using the second indicator result. This effectively avoids query errors or failures caused by the inclusion of non-technical terms in the indicator query, thus improving the accuracy of the indicator query.
[0213] Based on the above-described query method based on a large language model, this embodiment provides a query device based on a large language model, such as... Figure 6 As shown, the query device based on the large language model specifically includes:
[0214] The acquisition module 100 is used to respond to the indicator query of the user interaction and obtain the first indicator query intent of the indicator query through the large language model.
[0215] The first query module 200 is used to obtain the first indicator result of the indicator query through a large language model according to the first indicator query intent.
[0216] The second query module 300 is used to obtain the second indicator result of the indicator query through a large language model based on the first indicator query intent and the constructed decomposed example dataset;
[0217] The verification module 400 is used to verify the first indicator result based on the second indicator result in order to obtain the final indicator result of the indicator query.
[0218] Based on the above-described query method based on a large language model, this embodiment provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps in the query method based on a large language model as described in the above embodiment.
[0219] Based on the above query method based on a large language model, this application also provides a terminal device, such as... Figure 7 As shown, it includes at least one processor 20; a display screen 21; and a memory 22, and may also include a communications interface 23 and a bus 24. The processor 20, display screen 21, memory 22, and communications interface 23 can communicate with each other via the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setup mode. The communications interface 23 can transmit information. The processor 20 can invoke logical instructions in the memory 22 to execute the methods described in the above embodiments.
[0220] Furthermore, the logical instructions in the aforementioned memory 22 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0221] The memory 22, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, such as program instructions or modules corresponding to the methods in the embodiments of this disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions, or modules stored in the memory 22, thereby implementing the methods in the above embodiments.
[0222] The memory 22 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 22 may include high-speed random access memory (RAM) and non-volatile memory. Examples include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, as well as transient storage media.
[0223] Furthermore, the specific process of loading and executing multiple instruction processors in the aforementioned storage medium and terminal device has been described in detail in the above method, and will not be repeated here.
[0224] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A query method based on a large language model, characterized in that, The query method based on the large language model specifically includes: In response to user interaction for index query, the first index query intent of the index query is obtained through the large language model, wherein the first index query intent includes a first index query for querying composite indexes and a second index query for querying atomic indexes. Based on the query intent of the first indicator, the first indicator result of the indicator query is obtained through the large language model; Based on the first indicator query intent and the constructed decomposed example dataset, the second indicator result of the indicator query is obtained through a large language model. The decomposed example dataset includes several decomposed example data of the first indicator query. The decomposed example data includes historical indicator queries, the second structured indicator representation required for historical indicator queries, and the indicator calculation formula. The historical query results of historical indicator queries are the same as the query results obtained by using historical indicator queries as indicator queries. The first indicator result is verified based on the second indicator result to obtain the final indicator result of the indicator query. Specifically, obtaining the first indicator result of the indicator query through a large language model based on the first indicator query intent includes: Based on the first indicator query intent, the indicator query is decomposed into a structured indicator representation using a large language model. If the first indicator query intent is a first indicator query, the indicator query is decomposed into a first structured indicator representation. If the first indicator query intent is a second indicator query, the indicator query is decomposed into a second structured indicator representation. The first structured indicator representation includes the second structured indicator representation and composite indicator function required to calculate the first indicator query. The second structured indicator representation includes several path nodes, including restriction nodes and indicator name nodes. The restriction nodes contain restriction information for the indicator name. The query results of the indicator query are calculated based on the structured indicator representation and the preset indicator query database to obtain the first indicator result.
2. The query method based on a large language model according to claim 1, characterized in that, The step of obtaining the second indicator result of the indicator query based on the first indicator query intent and the constructed decomposed example dataset through a large language model specifically includes: Select several reference queries for the indicator query in the constructed decomposed example dataset; Based on the aforementioned reference queries, and according to the first indicator query intent, the indicator query is decomposed into a structured indicator representation using a large language model. The structured indicator representation is used to reflect the calculation content of the indicator query. The index results of the index query are calculated based on the structured index representation and the preset index query database to obtain the second index result.
3. The query method based on a large language model according to claim 1 or 2, characterized in that, The step of decomposing the index query into a structured index representation using a large language model based on the query intent of the first index specifically includes: When the first indicator query intent is a first indicator query, the semantic similarity between the indicator query and each formula in the preset indicator calculation formula library is calculated, and a preset number of candidate indicator calculation formulas are selected based on the semantic similarity. The index query is decomposed into a first structured index representation by using a large language model based on the preset number of candidate index calculation formulas, so as to obtain the structured index representation of the first index query.
4. The query method based on a large language model according to claim 3, characterized in that, The step of determining the query results of the indicator query based on the structured indicator representation and the preset indicator query database using a large language model specifically includes: The second structured index representation required for the first structured index representation is obtained through a large language model; The intermediate index results are obtained by retrieving them from the preset index query database based on the second structured index representation using a large language model. The result of the first indicator query is calculated based on the intermediate indicator result.
5. The query method based on a large language model according to claim 1 or 2, characterized in that, The step of decomposing the index query into a structured index representation using a large language model based on the query intent of the first index specifically includes: When the intent of the first indicator query is to query the second indicator, the large language model retrieves the structured indicator representation from the preset indicator query database based on the second structured indicator representation to obtain the structured indicator representation of the second indicator query.
6. The query method based on a large language model according to claim 1, characterized in that, The step of verifying the first indicator result based on the second indicator result to obtain the final indicator result of the indicator query specifically includes: Compare the result of the second indicator with the result of the first indicator; If the result of the second indicator is the same as the result of the first indicator, then the result of the first indicator shall be taken as the final result of the indicator query. If the result of the second indicator is different from the result of the first indicator, then the steps of obtaining the first indicator query intent of the indicator query through the large language model and obtaining the first indicator result of the indicator query through the large language model based on the first indicator query intent are re-executed. 7.The query method based on a large language model according to claim 1, characterized in that, Before obtaining the first query intent of the indicator query through a large language model in response to user interaction, the method further includes: An initial indicator query dataset is constructed based on data tables from several historical reports. The initial indicator query dataset includes several indicator query data tuples, and each indicator query data tuple includes historical indicator queries and historical query results. The second indicator query intent is obtained by using a large language model to query historical indicators. Based on the query intent of the second indicator, the third indicator result of the indicator query is obtained through the large language model; The results of the third indicator are verified using the historical query results. If the verification passes, a decomposed example dataset is constructed for the historical indicator query based on the results of the third indicator. 8.The query method based on a large language model according to claim 7, characterized in that, The step of constructing a decomposed example dataset for querying the historical indicators based on the results of the third indicator specifically includes: Obtain the correct data item corresponding to the result of the third indicator; The parameters of the correct data item are used as decomposition example data to obtain a decomposition example dataset, wherein the parameters of the correct data item include historical indicator queries, the second structured indicator representation required for the historical indicator queries, and the indicator calculation formula. 9.The query method based on a large language model according to claim 8, characterized in that, The step of verifying the third indicator result using the historical query results also includes: If the verification fails, the corresponding erroneous data item in the third indicator result is located and the erroneous data item is marked. The parameters of the error data items are used as a fine-tuning data group to obtain a fine-tuning dataset, wherein the parameters of the error data items include task content, error result, error cause, and annotation result; The large language model is fine-tuned using the fine-tuning dataset.
10. A query device based on a large language model, characterized in that, The query device based on the large language model specifically includes: The acquisition module is used to respond to the indicator query of the user interaction and obtain the first indicator query intent of the indicator query through the large language model; The first query module is used to obtain the first indicator result of the indicator query through a large language model according to the first indicator query intent, wherein the first indicator query intent includes a first indicator query for querying composite indicators and a second indicator query for querying atomic indicators. The second query module is used to obtain the second indicator result of the indicator query through a large language model based on the first indicator query intent and the constructed decomposed example dataset. The decomposed example dataset includes several decomposed example data of the first indicator query. The decomposed example data includes historical indicator queries, the second structured indicator representation required for historical indicator queries, and the indicator calculation formula. The historical query result of the historical indicator query is the same as the query result obtained by using the historical indicator query as the indicator query. The verification module is used to verify the first indicator result based on the second indicator result in order to obtain the final indicator result of the indicator query. Specifically, obtaining the first indicator result of the indicator query through a large language model based on the first indicator query intent includes: Based on the first indicator query intent, the indicator query is decomposed into a structured indicator representation using a large language model. If the first indicator query intent is a first indicator query, the indicator query is decomposed into a first structured indicator representation. If the first indicator query intent is a second indicator query, the indicator query is decomposed into a second structured indicator representation. The first structured indicator representation includes the second structured indicator representation and composite indicator function required to calculate the first indicator query. The second structured indicator representation includes several path nodes, including restriction nodes and indicator name nodes. The restriction nodes contain restriction information for the indicator name. The query results of the indicator query are calculated based on the structured indicator representation and the preset indicator query database to obtain the first indicator result.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps in the query method based on a large language model as described in any one of claims 1-9.
12. A terminal device, characterized in that, include: Processor and memory; The memory stores a computer-readable program that can be executed by the processor; When the processor executes the computer-readable program, it implements the steps of the query method based on a large language model as described in any one of claims 1-9.
Citation Information
Patent Citations
Data query method, device, equipment and product
CN119166654A
Data query method and system based on large language model
CN119557330A