Data query method and system

The data query system built using the knowledge distillation model automatically converts natural language into SQL statements, solving the problem of data silos within enterprises, improving data query efficiency, and reducing costs.

CN121255828APending Publication Date: 2026-01-02HANGZHOU ALIBABA INTERNATIONAL DIGITAL COMMERCE CO LTD

Patent Information

Application Number
CN202511151961.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2026-01-02

AI Technical Summary

Technical Problem

Enterprises often have large amounts of internal data, which is often siloed and fragmented, making data retrieval difficult. Existing technologies require high hardware costs and demand high levels of user R&D capabilities, making it difficult to effectively solve the data query problem.

Method used

A data query system is constructed using a knowledge distillation model. By identifying query intent information, query prompts are generated, and a target distillation model is used to process and generate data query sequences, thereby achieving automatic conversion from natural language to SQL statements and automating the data query process.

Benefits of technology

It improves the convenience and accuracy of data retrieval, reduces user technical requirements and hardware costs, and enables efficient management and convenient use of data within enterprises.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121255828A_ABST
    Figure CN121255828A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data query method and system. The data query method comprises the steps that a data query request associated with a target field is received; identifying query intention information corresponding to the data query request, and constructing a query prompt word corresponding to the data query request according to the query intention information; the query prompt word is input into a target distillation model to be processed, a data query sequence corresponding to the data query request is obtained, and the data query sequence comprises a data query statement and a data query reasoning chain associated with the data query statement; and executing the data query statement to obtain data query information, and reading target data in a target data table associated with the target field based on the data query information to serve as a response of the data query request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of data processing technology, and in particular to data query methods and systems. Background Technology

[0002] With the development of computer and internet technologies, data has become a core production factor for enterprises. Data is widely used in data analysis, decision support, business operations, and risk control. However, as the amount of data within enterprises gradually increases, the difficulty of finding and using data also increases. Furthermore, issues such as data silos, knowledge fragmentation, and information quality within enterprise data severely restrict the efficiency of intelligent and data-driven operation of data assets and decision-making. Currently, to address this issue, most enterprises purchase separate equipment and software for data maintenance. While this ensures data is used in a secure environment, difficulties in data retrieval remain. It also requires a certain level of R&D capability from the user and incurs significant hardware costs. Therefore, an effective solution to address these problems is urgently needed. Summary of the Invention

[0003] In view of this, embodiments of this specification provide a data query method. One or more embodiments of this specification also relate to a data query system, a data query device, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.

[0004] According to a first aspect of the embodiments of this specification, a data query method is provided, including:

[0005] Receive data query requests related to the target domain;

[0006] Identify the query intent information corresponding to the data query request, and construct query suggestion words corresponding to the data query request based on the query intent information;

[0007] The query prompts are input into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement.

[0008] The data query statement is executed to obtain data query information, and target data is read from the target data table associated with the target domain based on the data query information, as a response to the data query request.

[0009] According to a second aspect of the embodiments of this specification, another data query method is provided, applied to a cloud-side device, wherein the cloud-side device stores service data uploaded by the end-side device, including:

[0010] Receive the data query request submitted by the end-side device;

[0011] Identify the query intent information corresponding to the data query request, and construct query suggestion words corresponding to the data query request based on the query intent information;

[0012] The query prompts are input into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement.

[0013] Execute the data query statement to obtain data query information, and read the target data from the target data table uploaded on the terminal side based on the data query information;

[0014] The target data is sent to the end device as a response to the data query request.

[0015] According to a third aspect of the embodiments of this specification, a data query system is provided, including a client and a server, comprising:

[0016] The client is used to receive data query requests entered by users through the data query page and send the data query requests to the server.

[0017] The server is configured to identify the query intent information corresponding to the data query request, and construct query hints corresponding to the data query request based on the query intent information; input the query hints into the target distillation model for processing to obtain the data query sequence corresponding to the data query request, the data query sequence including a data query statement and a data query inference chain associated with the data query statement; execute the data query statement to obtain data query information, and read target data from the target data table associated with the data query request based on the data query information, and feed the target data back to the client.

[0018] According to a fourth aspect of the embodiments of this specification, a data query apparatus is provided, comprising:

[0019] The receiving module is configured to receive data query requests related to the target domain;

[0020] The identification module is configured to identify the query intent information corresponding to the data query request, and construct query prompt words corresponding to the data query request based on the query intent information;

[0021] The processing module is configured to input the query suggestion into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement.

[0022] The reading module is configured to execute the data query statement to obtain data query information, and read target data from the target data table associated with the target domain based on the data query information, as a response to the data query request.

[0023] According to a fifth aspect of the embodiments of this specification, another data query apparatus is provided, applied to a cloud-side device, wherein the cloud-side device stores service data uploaded by the end-side device, including:

[0024] The receiving module is configured to receive data query requests submitted by the end-side device;

[0025] The identification module is configured to identify the query intent information corresponding to the data query request, and construct query prompt words corresponding to the data query request based on the query intent information;

[0026] The processing module is configured to input the query suggestion into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement.

[0027] The reading module is configured to execute the data query statement to obtain data query information, and read target data from the target data table uploaded on the terminal side based on the data query information;

[0028] The sending module is configured to send the target data to the end-side device as a response to the data query request.

[0029] According to a sixth aspect of the embodiments of this specification, a computing device is provided, comprising:

[0030] Memory and processor;

[0031] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the above-described data query method.

[0032] According to a seventh aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the data query method described above.

[0033] According to an eighth aspect of the embodiments of this specification, a computer program product is provided, including a computer program or instructions that, when executed by a processor, implement the steps of the data query method described above.

[0034] The data query method provided in this embodiment aims to solve the data silo problem, improve the efficiency of data querying within an enterprise, and reduce the technical requirements on users. Upon receiving a data query request related to the target domain, it first identifies the query intent information corresponding to the data query request and constructs query hints based on this intent. Then, the query hints are input into a target distillation model for processing to obtain a data query sequence corresponding to the data query request. This data query sequence includes a data query statement and a related data query inference chain. The data query inference chain characterizes the thinking and reasoning process of the target distillation model in generating the data query statement corresponding to the data query request, thereby making the generated data query statement more interpretable and helping users understand the statement generation process. This process is automated by the model, enabling automatic conversion from natural language to SQL statements without requiring additional user intervention or extensive R&D background. This effectively improves the convenience of data querying. Furthermore, by combining the processing capabilities of a large language model, it makes enterprise data more structured and readily usable. The target distillation model is achieved through knowledge distillation. Compared with traditional machine learning models, it can achieve the same or better prediction accuracy with lower precision, thereby effectively reducing local deployment costs. Based on this, data query statements can be executed to obtain data query information. Subsequently, target data can be read from the target data table associated with the target domain based on the data query information as a response to the data query request. This automates the management and use of enterprise data, effectively reducing human resources, saving costs, improving the efficiency of enterprise data management, and facilitating the access and use of data at any time. Attached Figure Description

[0035] Figure 1 This is a flowchart illustrating a data query method provided in one embodiment of this specification;

[0036] Figure 2 This is a schematic diagram of the knowledge distillation process in a data query method provided in one embodiment of this specification;

[0037] Figure 3 This is a flowchart of another data query method provided in one embodiment of this specification;

[0038] Figure 4 This is a flowchart illustrating the processing procedure of a data query method provided in one embodiment of this specification;

[0039] Figure 5a This is a schematic diagram of the structure of a data query system provided in one embodiment of this specification;

[0040] Figure 5b This is an interactive schematic diagram of a data query system provided in one embodiment of this specification;

[0041] Figure 6 This is a schematic diagram of the structure of a data query device provided in one embodiment of this specification;

[0042] Figure 7 This is a schematic diagram of another data query device provided in one embodiment of this specification;

[0043] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0044] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0045] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0046] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0047] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0048] The models in the technical solutions provided in this application can be deep learning models with relatively large parameter scales, such as large models containing billions or even more model parameters. However, the large model is merely an example, and this application does not limit the number of model parameters supported by the deep learning model used, with the goal of meeting actual needs.

[0049] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0050] Knowledge distillation involves transferring knowledge from a complex, large model (the teacher model) to a smaller, more efficient model (the student model). The student model mimics the teacher's soft labels, allowing it to maintain a lightweight design while achieving performance as close as possible to that of the teacher model.

[0051] NL2SQL is a technology that automatically converts queries described in natural language into Structured Query Language (SQL). It belongs to the intersection of Natural Language Processing (NLP) and database systems, aiming to allow users to interact with natural language without needing to master complex SQL syntax.

[0052] RAG (Retrieval-Augmented Generation) is a hybrid artificial intelligence technology framework that combines information retrieval and text generation, aiming to improve the quality, accuracy, and reliability of generated content by introducing external knowledge sources.

[0053] This specification provides a data query method. One or more embodiments of this specification also relate to a data query system, a data query device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0054] In practical applications, modeling techniques offer an effective solution to the problem of difficult data retrieval. NL2SQL, implemented through models, automatically converts natural language into SQL statements for data querying, thus solving the data retrieval difficulty. However, existing model applications suffer from model illusion, easily creating information based on input features. Some service providers directly use general-purpose base model capabilities to implement NL2SQL solutions, but the results are poor, leading to the introduction of RAG solutions to improve query accuracy. While RAG can address some of the generation illusion problems in NL2SQL solutions, it lacks the ability to explain the underlying table structure of private domains. Implementing SQL solutions across all codebases is quite difficult, mainly because private domain data is difficult to understand, leading to difficulties in querying private domain data and low data hit accuracy. Therefore, an effective solution is urgently needed to address these issues.

[0055] The data query method provided in this embodiment aims to solve the data silo problem, improve the efficiency of data querying within an enterprise, and reduce the technical requirements on users. Upon receiving a data query request related to the target domain, it first identifies the query intent information corresponding to the data query request and constructs query hints based on this intent. Then, the query hints are input into a target distillation model for processing to obtain a data query sequence corresponding to the data query request. This data query sequence includes a data query statement and a related data query inference chain. The data query inference chain characterizes the thinking and reasoning process of the target distillation model in generating the data query statement corresponding to the data query request, thereby making the generated data query statement more interpretable and helping users understand the statement generation process. This process is automated by the model, enabling automatic conversion from natural language to SQL statements without requiring additional user intervention or extensive R&D background. This effectively improves the convenience of data querying. Furthermore, by combining the processing capabilities of a large language model, it makes enterprise data more structured and readily usable. The target distillation model is achieved through knowledge distillation. Compared with traditional machine learning models, it can achieve the same or better prediction accuracy with lower precision, thereby effectively reducing local deployment costs. Based on this, data query statements can be executed to obtain data query information. Subsequently, target data can be read from the target data table associated with the target domain based on the data query information as a response to the data query request. This automates the management and use of enterprise data, effectively reducing human resources, saving costs, improving the efficiency of enterprise data management, and facilitating the access and use of data at any time.

[0056] See Figure 1 , Figure 1A flowchart of a data query method according to an embodiment of this specification is shown, which specifically includes the following steps.

[0057] Step S102: Receive a data query request related to the target domain.

[0058] Step S104: Identify the query intent information corresponding to the data query request, and construct query prompt words corresponding to the data query request based on the query intent information.

[0059] Step S106: Input the query prompt words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes the data query statement and the data query inference chain associated with the data query statement.

[0060] Step S108: Execute the data query statement to obtain data query information, and read target data from the target data table associated with the target domain based on the data query information as a response to the data query request.

[0061] The data query method provided in this embodiment can be applied to data query scenarios in any private domain, such as querying data within an enterprise. By deploying a distillation model in this scenario, data processing, querying, and access operations can be completed within the private domain. This not only ensures data security but also solves the data silo problem in the private domain, improving data access efficiency while saving more costs. Furthermore, the distillation model deployed in this scenario can achieve the effect of even closed-source models in the corresponding vertical domain, while providing a more accurate understanding of private domain knowledge, thereby meeting the usage needs of different scenarios.

[0062] This embodiment uses the application of data query methods in enterprise data management scenarios as an example to illustrate the data query method. Data query methods in other private domain scenarios can refer to the same or corresponding descriptions in this embodiment, and will not be elaborated on further here.

[0063] Specifically, the target domain refers to the domain to which the data to be queried belongs. Considering that in a private domain scenario, the relevant data of an enterprise may be associated with different domains, such as employee data, service project data (e.g., sales data, product distribution data in a shopping scenario), and salary data, all of which belong to different domains, clearly defining the target domain associated with the data query request when the user submits it ensures that subsequent processing can accurately target the data tables within that domain, improving data query efficiency while avoiding access to irrelevant data tables. The data query request specifically refers to the data query description request submitted by the user, which is natural language description information. By providing users with a data query request interface that accepts natural language input, the requirement for users' professional knowledge can be reduced, thereby improving applicability. For example, a data query request could be "Count the number of RTS products."

[0064] Accordingly, query intent information specifically refers to the intent information obtained after semantic analysis of the data query request. This can be achieved through an intent recognition model or a large language model, used to accurately determine the intent information corresponding to the data query request. This facilitates the subsequent construction of data query statements with higher relevance to the data query request, thereby ensuring the accuracy of the data query. Correspondingly, query prompts specifically refer to prompts constructed based on the query intent information and a preset prompt template. These prompts clarify the specific requirements of the data query request. Inputting them into the target distillation model allows the model to output the corresponding data query statement based on the prompt. The prompt template can be constructed based on prompt engineering; this embodiment does not impose any limitations on it.

[0065] Accordingly, the target distillation model specifically refers to a distillation model used to input query suggestions and output data query statements. It can be built using a large language model, and by distilling specified functional layers, the model size is reduced while maintaining predictive ability. Deploying this model in private domain scenarios can effectively reduce costs and better meet the needs of private domain usage. The capabilities of the target distillation model can be obtained by pre-training a large language model and then distilling it to obtain a smaller target distillation model for deployment in private domain scenarios. Correspondingly, the data query sequence specifically refers to the model output result composed of the data query statement output by the target distillation model and its associated data query inference chain. The data query inference chain specifically refers to the thought process of the target distillation model in considering and reasoning about the data query statement, used to improve the interpretability and accuracy of the data query statement. Correspondingly, the data query statement specifically refers to the SQL statement corresponding to the data query request, used for subsequent access to the target data. For example, if the data query request is "statistically count the quantity of RTS products", the corresponding SQL statement is as follows:

[0066] SELECT COUNT(*) AS RTS Quantity

[0067] FROM Product List

[0068] WHERE category = 'RTS';

[0069] RTS stands for Ready to Ship, indicating "ready to ship" or "ship immediately." Correspondingly, the data query information specifically refers to the physical table schema information and descriptive information of the physical table obtained after executing the data query statement, such as table name, column names, data types, nullability, primary key information, and default values. Based on the data query information, the target data table in the related target domain can be accessed to retrieve the target data corresponding to the data query request, which can then be fed back to the user. The target data table is the data table to which the data to be queried at the current moment belongs, and the target data is the data retrieved in the related data query request.

[0070] Therefore, in order to solve the data silo problem, improve the efficiency of data query within the enterprise, and reduce the technical requirements for users, after receiving a data query request related to the target domain, the query intent information corresponding to the data query request can be identified first, and query prompts corresponding to the data query request can be constructed based on the query intent information.

[0071] Based on this, query suggestions can be input into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes the data query statement and the data query inference chain associated with the data query statement. The data query inference chain can represent the thinking and reasoning process of the target distillation model when generating the data query statement corresponding to the data query request, thereby making the generated data query statement more interpretable and helping users understand the statement generation process. This process is completed automatically by the model, realizing automatic conversion from natural language to SQL statements without requiring additional user operations or advanced R&D background. This effectively improves the convenience of data query and, by combining the processing capabilities of a large language model, makes enterprise data more structured and easier to use at any time.

[0072] The target distillation model is achieved through knowledge distillation. Compared with traditional machine learning models, it can achieve the same or better prediction accuracy with lower precision, thereby effectively reducing local deployment costs. Based on this, data query statements can be executed to obtain data query information. Subsequently, target data can be read from the target data table associated with the target domain based on the data query information as a response to the data query request. This automates the management and use of enterprise data, effectively reducing human resources, saving costs, improving the efficiency of enterprise data management, and facilitating the access and use of data at any time.

[0073] For example, Company A offers a variety of services, involving data related to product sales, customer service, and logistics. Data from these different areas is recorded in one or more tables. When employees need to use some of this data for processing (e.g., using product data to generate annual reports, or using logistics data to analyze customer satisfaction), they need to query the data from the databases storing each area. To improve data query efficiency and eliminate the need for employees to manually input SQL queries, the system can support users inputting data queries in natural language.

[0074] Based on this, if the received user-submitted data query request is for "the number of newly signed customers and revenue data of newly signed members in Region A in the last 180 days" related to the product domain, then intent recognition can be performed on the received data query request. Based on the recognition result, the user intent is determined to be "statistics on revenue data in Region A within the last 180 days." Based on this, query hints related to the query intent can be constructed. These query hints record the query statement construction requirements, as well as the names of the tables to be accessed and model processing requirements (such as specified time periods, user identifiers, etc.). Then, the query hints can be input into the target distillation model for processing. Based on the processing results, a data query sequence corresponding to the data query request can be obtained, and this data query sequence contains the SQL statement and its corresponding COT inference chain. The SQL statement is as follows:

[0075] --Get the number of new customers and revenue in Region A over the past 180 days

[0076]

[0077]

[0078] Based on this, the physical table schema and descriptive information (such as table name, column name, data type, whether it is nullable, primary key information, default value, etc.) can be obtained by executing the above SQL statement. Based on this, the data about the physical table schema and descriptive information in the corresponding physical table can be accessed, and then the number of newly signed customers and revenue data of newly signed members in region A in the last 180 days can be obtained. At this time, the data can be fed back to the user so that the user can perform subsequent processing based on the data.

[0079] Furthermore, the data query method provided in this embodiment can compress the model size from 671B to 32B through knowledge distillation, thereby reducing the model deployment cost and improving the accuracy of table lookup. This enables the integration of enterprise private domain knowledge with large models and reduces deployment costs, thereby improving the efficiency and convenience of data query in private domain scenarios.

[0080] In practical implementation, considering that data query requests are natural language descriptions submitted by users, they may correspond to multiple query intents. For example, if a user submits a data query request for "user A's account information," this request needs to obtain user A's basic information, transaction order information within the platform, and user A's account balance or points. Thus, it can be seen that this data query request needs to obtain data from multiple data tables, and the relationship between the data to be obtained is a parallel relationship. Therefore, after intent recognition and processing through the target distillation model, the data query sequence corresponding to the data query request will have three data query statements and three inference chains corresponding to the data query statements. Specifically, SQL1 corresponds to user A's basic information, SQL2 corresponds to user A's transaction order information, and SQL3 corresponds to user A's account balance or points.

[0081] Furthermore, after obtaining multiple data query statements, since the data query statements are in parallel, it further indicates that the data query requests can be executed concurrently. Therefore, multiple data query statements can be executed concurrently, and the data query information corresponding to each data query statement after execution can be obtained. Subsequently, one or more data tables associated with the target domain can be accessed according to the multiple data query information to obtain the target data corresponding to each statement, which can then be used for subsequent service processing.

[0082] For example, user information is stored in the users table, order information is stored in the orders table, and order_items table. After obtaining the three SQL statements, each query can be executed concurrently to obtain data query information related to the users, orders, and orders_items tables. Subsequently, the corresponding data tables can be accessed according to the data query information of each table to concurrently obtain the basic information, order information, and account balance information of user A for downstream use.

[0083] Furthermore, after mentioning query suggestions, considering that the query operation for target data requires the target data table to be located based on the data query request before the corresponding query statement can be constructed, the target distillation model can first locate the target data table and then construct the statement. In this embodiment, the specific implementation method is as follows:

[0084] The query suggestion is input into the target distillation model, and the target distillation model is used to determine the target data table associated with the data query request according to the query suggestion; the architecture information corresponding to the target data table is determined, and the architecture information is processed by the target distillation model to obtain the data query sequence corresponding to the data query request.

[0085] Specifically, the architecture information refers to the schema information of the associated target data table, and the target data table refers to the data table to which the data to be accessed by the data query request belongs.

[0086] Based on this, considering that the target distillation model is used to generate data query statements, and the generated statements need to access data within a private domain, in order for the model to output statements related to the accessed data, query prompts need to be input into the target distillation model. The target distillation model then uses the query prompts to determine the target data table for the related data query request, and further determines the data table that the data query request needs to access. Based on this, the architecture information corresponding to the target data table can be determined. After obtaining the architecture information, all the necessary elements for accessing the target data packet can be identified. Therefore, the architecture information can be processed through the target distillation model to automatically generate the data query sequence corresponding to the data query request, so that the data query information can be obtained by executing the data query statement for subsequent data reading and use.

[0087] In summary, the distillation model automatically parses query suggestions, accurately locates the target data table, and extracts architectural information to generate efficient SQL queries. Compared to methods relying on manual rules or complex algorithms, this approach significantly improves the automation and accuracy of data queries while reducing manual intervention costs. The distillation model has the ability to quickly adapt to different data table structures and reduces model illusions, thereby optimizing query generation efficiency. It effectively solves problems such as high error rates and slow response times caused by complex architectural information processing, making it suitable for efficient query needs in dynamic data environments.

[0088] Based on this, and considering that the system can serve all employees within the enterprise, after obtaining the target data table, the relevant information corresponding to the target data table can be displayed to the user, allowing the user to decide whether to perform subsequent processing operations based on their needs. In this embodiment, the specific implementation method is as follows:

[0089] Determine the table information corresponding to the target data table and display the table information and the architecture information; in response to the determination instruction submitted for the table information and the architecture information, execute the step of processing the architecture information through the target distillation model to obtain the data query sequence corresponding to the data query request.

[0090] Specifically, table information refers to the information corresponding to the target data table, including but not limited to table name, table size, columns contained in the table, etc. Confirmation instructions refer to the confirmation instructions submitted by the user regarding table information and architecture information. They are used to display the architecture information and table information to the user, who then confirms the information before proceeding with subsequent processing operations.

[0091] Based on this, after determining the target data table and its corresponding architecture information through the target distillation model, considering that subsequent processing requires the model to generate data query statements according to the target data table and its corresponding architecture information, and that the table information and architecture information are important factors in ensuring the generation of data query statements, since accuracy can be improved through interaction with the user, the table information and the architecture information can be displayed to the user. Upon receiving a confirmation instruction from the user regarding the table information and architecture information, it indicates that the obtained table information and architecture information are consistent with the data query request at the current moment. Therefore, the step of processing the architecture information through the target distillation model to obtain the data query sequence corresponding to the data query request can be executed.

[0092] Continuing with the previous example, after inputting query suggestions into the target distillation model, the model can locate the target data table associated with the data query request based on the query suggestions. At this point, through the user's question-and-answer page with the target distillation model, the following information can be displayed: {Parsing response data:}

[0093] {'table':['icbucdm.dws_en_crm_slr_sales_cgs_rvn_1d','icbucdn,dim_en_org_with_zone']}}

[0094] Recommended list:

[0095] icbucdm.dws_en_crm_slr_sales_cgs_rvn_1d

[0096] icbucdm.dim_en_org_with_zone}

[0097] While displaying the above information to the user, a confirmation control can also be provided to the user to confirm whether the above information is associated with a data query request. If the confirmation instruction submitted by the user is received, an SQL query statement that associates with the target data table can be constructed based on the above information so that the data related to "the number of new customers and revenue data of new members in region A in the last 180 days" can be accessed according to the SQL query statement, which is convenient for users.

[0098] Furthermore, after the target distillation model determines the list of recommended tables, there may be physical tables identified by the target distillation model that do not exist in the current database. Subsequent data queries based on these tables will fail to retrieve the data required for the current query scenario. Therefore, after the target distillation model locates the target data table associated with the data query request based on query suggestions, a table existence check can be performed. This can be done using a database connection or metadata interface (such as SHOWTABLES). Example pseudocode is as follows:

[0099]

[0100]

[0101] In other words, after determining the parsed response data, the existence of the target data table can be verified, and a maximum of n retries can be set. Each time, error information can be fed back to the target distillation model, which will then correct the table name until a valid table name is successfully determined, or until the n retries are reached. Here, n can be set according to actual needs; this embodiment does not impose any limitations. Furthermore, if the table name determined by the target distillation model in a certain retry cycle exists and corresponds to the target data table, the relevant information of that target data table can be used for subsequent data query operations.

[0102] In summary, by using an interactive approach to determine the table information and architecture information corresponding to the target data table, subsequent processing operations can be made more accurate, thereby improving data query efficiency while ensuring data query accuracy.

[0103] Furthermore, since the target distillation model is the student model obtained by distilling the teacher model, in order to make the model have more accurate predictive capabilities, it can be configured with a domain adaptation module and a perception module to achieve dual construction of query statements from both the data analysis level and the information perception level. In this embodiment, the specific implementation method is as follows:

[0104] The query suggestion is input into the target distillation model, which includes a domain adaptation module and a perception module. The domain adaptation module processes the query suggestion to obtain a first data query sequence, and the perception module processes the query suggestion to obtain a second data query sequence. The first data query statement in the first data query sequence and the second data query statement in the second data query sequence are fused together, and the data query sequence is generated based on the fusion result.

[0105] Specifically, the domain adaptation module refers to a lightweight model in the target distillation model that uses knowledge distillation to extract a suitable model for sentence construction in a private domain scenario from the large language model, exhibiting stronger generalization capabilities. The perception module refers to a module that understands user query requirements while fully utilizing metadata in the database schema to generate sentences; it can be understood as a schema-aware model. Correspondingly, the first data query sequence is the data query sequence output by the domain adaptation module, and the second data query sequence is the data query sequence output by the perception module. The relevant descriptions and corresponding structures of the first and second data query sequences can be found in the description of data query sequences in the above embodiments, and will not be elaborated upon further in this embodiment. The fusion of the first and second data query statements can be achieved using a weighted fusion method or through fusion using the large language model; this embodiment does not impose any limitations on this.

[0106] Therefore, to ensure that data query statements better match data query requests, they can be constructed and merged separately using two different modules within the target distillation model. Specifically, query suggestions can be input into the target distillation model, which includes a domain adaptation module and a perception module. The domain adaptation module processes the query suggestions to obtain a first data query sequence, and the perception module processes them to obtain a second data query sequence. After obtaining two potentially identical, similar, or different data query sequences output by the two modules, the first data query statement in the first data query sequence and the second data query statement in the second data query sequence can be merged. This achieves fusion at the statement level. Furthermore, the inference chains within the sequences are merged to obtain the final data query sequence for subsequent use.

[0107] In addition to the statement fusion processing mentioned above, the data query reasoning chain corresponding to the data query statement in the data query sequence can also be generated separately for the data query statement after obtaining the data query statement after the fusion of the first and second data query statements, thereby improving the interpretability of the statement.

[0108] In practice, the data query statements output by the domain adaptation module and the perception module are generated by predicting the corresponding capabilities of the model, in order to comprehensively consider the actual situation in the private domain scenario and thus ensure the accuracy of the data query statement construction.

[0109] In practical applications, after obtaining the data query statements contained in the sequences output by the two modules, a dynamic weight allocation mechanism can be used to construct the final data query statement. The purpose is to dynamically determine the contribution ratio of each module based on the language complexity, schema complexity, and prediction confidence of each module. The input difficulty can be judged by the meta-controller model, the softmax output entropy of each module can be calculated, its uncertainty can be evaluated, and the output results of multiple modules can be combined using a weighted average method. This can be achieved by the following formula (1):

[0110] FinalSQL=w1·Model1+w2·Model2 (1)

[0111] Where w1+w2=1 represents the weights of the domain adaptation module and the perception module respectively, Model1 and Model2 are the prediction results output by the domain adaptation module and the perception module respectively, and FinalSQL is the data query statement of the final output model.

[0112] Following the previous example, after inputting the query suggestion into the target distillation model, it can be processed by the domain adaptation module in the target distillation model to obtain the SQL1 query statement. At the same time, it can be processed by the schema-aware module to obtain the SQL2 query statement. Then, the two query statements can be weighted and merged according to the above formula (1) to obtain the SQL query statement for accessing the target data table. This allows users to access the data related to "the number of new customers and revenue data of new members in region A in the last 180 days" according to the SQL query statement, which is convenient for users.

[0113] In summary, by employing a dual-path collaborative processing approach involving both the domain adaptation module and the perception module to process query suggestions, each module generates a separate query statement, which is then fused and optimized before the final result is output. This approach effectively combines domain knowledge with general perception capabilities, significantly improving the accuracy and robustness of statement generation in complex query scenarios. Compared to single-model processing methods, this solution reduces the error rate caused by semantic ambiguity or structural differences, enhances adaptability to varying data table structures, and is suitable for efficient data querying needs in highly dynamic environments.

[0114] Based on this, in order to enable the target distillation model to have strong predictive capabilities, during the model training phase, different data can be used to train and optimize the domain adaptation module and the perception module in the model. In this embodiment, the specific implementation method is as follows:

[0115] A global data table associated with the target domain is identified, and the corresponding metadata of the global data table is extracted. A mapping relationship between the data in the global data table and the service scenario is constructed by parsing the metadata, and the data in the global data table is standardized to obtain structured data. The initial domain adaptation module in the distillation model is trained using the mapping relationship, and the initial perception module in the distillation model is fine-tuned using the structured data. Based on the training results and the fine-tuning results, the target distillation model that meets the training stopping condition is generated.

[0116] Specifically, the global data table refers to all data tables related to the target domain, and is the core asset table associated with the target domain, used to ensure high-quality data tables for subsequent use. Metadata refers to the metadata corresponding to each data table within the target domain, including metadata corresponding to the original data such as table structure, field descriptions, and business rules. Correspondingly, mapping relationships refer to the mapping relationships between data and service scenarios. The purpose is to allow the model to learn the mapping knowledge of data-related scenarios during model training, thereby improving the accuracy of the model in locating tables. For example, mapping relationship records order data to order statistics scenarios, revenue statistics scenarios, etc., and website order amount to revenue statistics scenarios, etc.

[0117] Correspondingly, structured data specifically refers to structured data obtained after standardizing the data contained in various data tables within the target domain. Standardization includes, but is not limited to, missing value imputation, format unification, and outlier detection. Correspondingly, training stopping conditions specifically refer to the conditions for stopping the training of the target distillation model, including but not limited to loss value comparison conditions, iteration number conditions, and validation set verification conditions. Training stopping conditions can be selected according to actual needs, and this embodiment does not impose any limitations on them.

[0118] Based on this, to ensure the target distillation model has strong predictive capabilities and is more closely aligned with private domain scenarios, enabling access to all data within those scenarios, a global data table for the target domain can be identified first. Metadata corresponding to this global data table can then be extracted. Next, the mapping relationship between data in the global data table and the service scenario can be constructed by parsing the metadata. Simultaneously, the data in the global data table can be standardized to obtain structured data. After obtaining the mapping relationship and structured data, the initial domain adaptation module in the distillation model can be trained using the mapping relationship, enhancing its generalization ability. Simultaneously, the initial perception module in the distillation model can be fine-tuned using the structured data, allowing it to accurately understand the user's data query intent when predicting data queries. This process is iterated, ultimately generating a target distillation model that meets the training stopping condition based on the training and fine-tuning results. Deploying this model in real-world scenarios can save significant resources.

[0119] In practical applications, considering that there are many data tables associated with the target domain and their quality varies, in order to use the core asset table associated with the target domain as a global data table for subsequent model training, the data tables associated with the target domain can be subjected to quality analysis and filtering to select data tables with higher service value, higher quality, and stronger stability for model training.

[0120] In practice, quality analysis and filtering of data tables related to the target domain can be achieved using a rule-plus-model strategy. Rules include, but are not limited to, integrity rules (checking the proportion of null values ​​in key fields of the table), accuracy rules (determining whether data meets expectations by validating field formats (such as date formats and number lengths), uniqueness rules (checking for duplicate values ​​in primary key or unique index fields), consistency rules (cross-table field value consistency verification), timeliness rules (checking whether the update time of data in the table is within a reasonable range), and stability rules (determining the stability of the table structure or data distribution through historical data fluctuation analysis), ensuring the importance and quality of the tables.

[0121] Meanwhile, large language models can be used to supplement complex scenarios that rule engines cannot cover, thereby improving the depth and intelligence of analysis. For table importance assessment, table names, field names, field types, service descriptions, etc., can be input into the model, which then scores the importance of each data table. Simultaneously, historical quality scores, field distributions, and lineage relationships of tables can be input into the large language model to predict future quality trends. Furthermore, automated anomaly localization and repair can be achieved through large language models. Tables and fields with quality anomalies can be input into the large language model, which then outputs suggested modification strategies. Based on this, higher-quality and more important data tables can be output as global data tables, combining rules and models. This allows the model to learn relevant knowledge within the domain during subsequent model training, improving its predictive ability and accuracy after deployment and preventing the model from generating more illusions.

[0122] In summary, by constructing data-service mapping relationships through metadata parsing and standardization, and combining domain adaptation module training with perception module fine-tuning, the distillation model's dynamic adaptability and query accuracy across multiple domains are significantly improved. This effectively solves the mapping ambiguity problem caused by data heterogeneity, reduces the error rate caused by differences in data structure, and shortens the model training cycle through dual-module collaborative optimization, achieving faster query response speeds in complex scenarios and enhancing the system's robustness and generalization ability in dynamic data environments.

[0123] In practical implementation, to improve the prediction accuracy of the domain adaptation model, the initial training of the domain adaptation model can be completed by constructing multiple prompt word templates in conjunction with mapping relationships. Furthermore, specific model layers can be distilled to achieve the desired predictive capabilities while reducing the model size. In this embodiment, the specific implementation method is as follows:

[0124] Multiple preset prompt word templates are obtained. Based on the multiple prompt word modules and the mapping relationship, the initial domain adaptation module in the distillation model is trained to obtain an intermediate domain adaptation module. Distillation is performed on the intent sample generation layer, knowledge graph association layer, and logic parsing layer in the intermediate domain adaptation module to obtain the domain adaptation module. The intent sample generation layer is used to extract the association relationship between the corresponding fields of the data and the architecture information. The knowledge graph association layer is used to construct the domain knowledge network associated with the target domain. The logic parsing layer is used to parse the statement code logic.

[0125] Specifically, multiple prompt word templates refer to prompt word templates pre-set by the prompt word engineering for all possible data query scenarios. These templates are used to combine with the aforementioned constructed mapping relationships to form samples for training the domain adaptation module. Correspondingly, the intermediate domain adaptation module refers to the domain adaptation module obtained after training but before distillation. Correspondingly, the intent sample generation layer is the network layer used to extract the association between corresponding fields in the data and architectural information; the knowledge graph association layer is the network layer used to construct a domain knowledge network related to the target domain; and the logic parsing layer is the network layer used to parse the logic of the statement code.

[0126] Therefore, in order to enable the domain adaptation module to have strong predictive capabilities while reducing model size and deployment costs in private domain scenarios, multiple prompt word templates corresponding to different data query requests can be pre-constructed. At this time, the initial domain adaptation module in the distillation model can be trained based on multiple prompt word modules and mapping relationships, and an intermediate domain adaptation module can be generated based on the training results. Then, in order to ensure that the intermediate domain adaptation module still has the processing capabilities of the teacher model after distillation, the intent sample generation layer, knowledge graph association layer, and logic parsing layer in the intermediate domain adaptation module can be distilled to obtain the domain adaptation module.

[0127] For specific implementation, please refer to the following: Figure 2 The schematic diagram illustrates that the data query method provided in this embodiment can be divided into an input layer, a data processing layer, a model layer, a service layer, and an output layer. The input layer, associated with metadata, receives metadata including table structures, field descriptions, and service rules—original data assets. Metadata parsing allows for the construction of a mapping relationship between data and service scenarios. The data processing layer, associated with automated preprocessing, involves data transformation. By performing data standardization processes, including missing value imputation, format unification, and outlier detection, it outputs structured data to the service layer. Simultaneously, it can receive the metadata parsing results from the input layer as the basis for data processing.

[0128] Furthermore, the model layer is associated with a hierarchical distillation engine for knowledge distillation. It employs a three-level distillation architecture: an intent sample generation layer to extract the relationship between fields and schemas; a knowledge graph association layer to construct a domain knowledge network; and a complex logic enhancement layer to parse SQL code logic. This achieves up to 10 times compression of data asset information, outputting a domain adaptation module (domain adaptation model) to the hybrid inference gateway for SQL statement generation. Simultaneously, the model layer can also be used for schema-aware model fine-tuning (awareness module). It can fine-tune the parameters of the schema-aware model based on the structured data output from the data processing layer, optimizing model parameters using a schema-aware mechanism. This improves the model's adaptability to specific service scenarios, and the optimized model is also synchronized to the hybrid inference gateway for SQL statement generation.

[0129] Furthermore, the service layer is associated with a hybrid inference gateway for intelligent routing. By performing multi-model fusion inference, it integrates the domain-adaptive model and schema-aware fine-tuning model of the hierarchical distillation engine, and generates SQL statements using a dynamic weight allocation mechanism. This allows it to output SQL generation results with confidence scores for subsequent service layer verification.

[0130] In practical applications, in the knowledge distillation process, in addition to mining the explicit knowledge in the base table, it is also necessary to consider the implicit requirements in specific service scenarios. For example, if the original knowledge is "query the quantity of overseas spot goods", the explicit knowledge is extracted as "the product data of overseas spot goods", while the implicit knowledge is associated with "the need to add the setting of valid products, and the default of invalid products not being counted", so as to make the trained model more accurate and have stronger generalization ability.

[0131] Specifically, the implicit requirements considered during the distillation process mainly rely on the learning of reasoning relationships used in the distillation process. For example, if the original problem is "query the quantity of overseas spot goods", the corresponding implicit requirement is "filter invalid products (is_valid_prod = 'N')". The processing logic is to automatically add the filtering condition AND is_valid_prod = 'Y' during the SQL generation stage to ensure that only valid products are counted. This can be understood as directly referencing service rules (such as the definition of is_good_prod: total_score > 85 AND is_have_pic = "Y") when generating SQL, transforming implicit requirements into explicit constraints. This allows for a dual-channel processing flow design. For the explicit knowledge channel, the task can be set to extract fields and relationships (such as cate_id related to dim_en_pcate_v) based on the table structure (dim_en_prod); while the implementation can ensure syntactic correctness through field mapping and type validation (such as TO_CHAR(mdf_time, 'yyyymmdd')). Implicit knowledge channels can be tasked with identifying and processing implicit logic in business scenarios (such as time range, performance optimization, and obsolete fields). The implementation can be achieved through time series analysis (automatically converting mdf_time to date format and adding partition filtering (ds = '${bizdate}')), obsolete field detection (marking invalid fields such as prod_type_cd and suggesting alternative solutions (such as related dimension tables)), and performance optimization (forcing the use of bucketing (CLUSTERED BY prod_id) and partitioning (ds) to reduce the amount of scanning).

[0132] Furthermore, for implicit requirement coverage in the training corpus, counterexample enhancement can be performed by introducing incorrect field mappings into the corpus (e.g., mistaking `cate_id` for a category name) and providing correction suggestions (e.g., associating `dim_en_pcate_v` to obtain the description). Service rule inference can be achieved by automatically embedding service rules (e.g., combined conditions of `is_good_prod`) during SQL generation, rather than relying on explicit user declarations. For implicit knowledge verification, implicit requirements can be explicitly handled in the training corpus through obsolete field detection and alternative suggestion recommendations. This allows the model to infer service rules from natural language problems through its reasoning capabilities, thereby achieving the goal of learning implicit knowledge. This ensures that the distilled model inherits the service understanding capabilities of the undistilled model, enabling it to perform predictions more accurately and with less resource consumption in service scenarios.

[0133] For example, to enable the distilled model to learn implicit knowledge and implicit needs, the prompt for the constructed reasoning corpus can be as follows:

[0134] 1. You are now a senior data technology expert with over 10 years of experience. You need to break down and solve problems in the user's data retrieval and usage stages from multiple dimensions based on the provided table schema or DDL statements, including NL2SQL aspects. Please refer to the syntax of the configured ODPS.

[0135] 2. The dimensions of the construction include: multi-condition combined queries, cross-table joins and semantic understanding, handling invalid fields and business rule reasoning, complex business indicator calculation, time series analysis, corpus enhancement suggestions, and adding counterexamples: incorrect field mapping (such as mistaking cate_id for category name), ignoring partitions leading to full table scans; multi-step reasoning: such as multi-level joins, if the category name does not exist, the description needs to be obtained from cate_id joined with dim_en_pcate_v; introducing service knowledge: service rules such as: the requirement for "strong and good products" (is_good_prod): total_score>85 AND is_have_pic="Y", etc.

[0136] 3. Key reasoning patterns for data assets:

[0137] (1) Problem decomposition framework: original problem -> core condition extraction -> implicit requirement discovery -> business rule verification;

[0138] (2) Field association logic: Natural language -> Table fields -> Type validation -> Dimension table mapping -> Code conversion;

[0139] (3) Anomaly handling path: detect obsolete fields -> trace alternative solutions -> issue warnings -> provide correction suggestions;

[0140] (4) Performance optimization mindset: Partition filtering -> Bucket optimization -> Index utilization -> Pre-computation -> Execution plan analysis.

[0141] Based on the prompt above, the following format of the corpus for training the model can be constructed:

[0142]

[0143]

[0144] For example, following the above corpus format, the following corpus can be constructed for model training:

[0145]

[0146] In this scenario, the corpus used to train the model can be constructed based on the DDL content of related scenarios (such as prod_id BIGINT COMMENT 'product id'; crt_time STRING COMMENT 'creation time'; mdf_time STRING COMMENT 'modification time'; mbr_idSTRING COMMENT 'member ID'; mbr_seq BIGINT COMMENT 'member SEQ', etc.).

[0147] Based on this, different prompt modules can be used to generate base tables, fields, and NL2SQL-related training data through large language models. Furthermore, for different tasks, the teacher model's response methods and styles can be optimized according to the task characteristics. For example, for data finding tasks, the application layer base tables can be searched first, and the core base tables of some data domains can be given higher priority. For NL2SQL tasks, the user's problem can be broken down and executed step by step. By finding matching data, the use of joins can be reduced (for example, the model building stage can be set to solve the problem within 1-3 tables, so that the application stage can use the minimum table joins to solve the user's needs). At the same time, additional attention can be paid to service dates and aggregation methods.

[0148] Based on the above processing, corpora for training the domain awareness module can be generated. Since the generated domains cover different scenarios, they can be automatically merged into the corresponding files according to the topics corresponding to the corpora, so that they can be used directly during the model training stage.

[0149] Furthermore, knowledge of the distilled corpus can be enhanced, such as by increasing the understanding of asset corpus, model design rules and base table rules, and by setting negative sample corpus, such as which fields are not in the table, negative SQL queries, etc. It is also possible to construct corpus of physical tables directly based on user queries, thereby improving the generalization ability and robustness of the model.

[0150] Furthermore, in addition to the knowledge distillation processing described above, the hierarchical distillation engine can also be associated with the asset corpus understanding module for enterprise metadata association (such as constructing a semantic graph containing a set number of field attributes and parsing the mapping relationship between fields and service KPIs), service rule encoding (such as converting service rules in fields such as finance / supply chain into executable logical constraints), historical SQL parsing (such as analyzing a set number of historical query statements and extracting table association patterns and field usage frequency), and base table rule modeling (such as establishing a physical table feature library containing primary key constraints, foreign key relationships, and index distribution). The model design rule engine can set schema association rules (mandatory requirement that fields must exist in the target table schema, establishing a three-level mapping between fields, tables, and industry service domains), domain adaptation rules (preset knowledge templates for vertical domains such as finance / manufacturing, including industry-specific aggregation logic (such as debt-to-asset ratio calculation)), and logic enhancement rules (performing syntax tree reinforcement training for complex operations such as GROUP BY / HAVING, supporting multi-level nested queries), thereby improving the model's applicability in private domain scenarios.

[0151] In summary, by optimizing the domain adaptation module through multi-layer distillation and combining it with a three-layer architecture of intent sample generation, knowledge graph association, and logical parsing, the model's ability to accurately capture data field-architecture relationships and its efficiency in domain knowledge transfer are significantly improved. Layered distillation enables deep compression of model parameters and knowledge extraction, effectively improving domain adaptation accuracy while reducing logical parsing error rates in complex query scenarios, thus enhancing the model's adaptability to dynamic data architectures and its cross-scenario generalization ability.

[0152] Furthermore, considering that the data query information obtained from executing the data query statement may not meet the current user's data query needs, the data query statement can be regenerated by optimizing the prompt words, thereby improving the accuracy of data query.

[0153] In this embodiment, the specific implementation method is as follows:

[0154] Execute the data query statement to obtain initial data query information; if the initial data query information does not meet the data query conditions, adjust the query suggestion words based on the initial data query information to obtain target query suggestion words; merge the target query suggestion words with the query intent information, and input the merging result into the target distillation model for processing to obtain the target data query statement corresponding to the data query request; execute the target data query statement to obtain data query information.

[0155] Specifically, the initial data query information refers to the data query information obtained based on the data query statement, which may not match the data query request. Correspondingly, the data query conditions refer to the conditions used to check the initial data query information, such as checking whether the information is related to the target data table, whether the information is complete, or checking field information. Correspondingly, the target query suggestion term refers to the new query suggestion term obtained after adjusting the original query suggestion term. The target data query statement is the data query statement generated by the distillation model based on the adjusted query suggestion term.

[0156] Therefore, in order to ensure that the final data query information meets the current data query requirements, and considering that the model may create its own tables or fields to answer user questions when processing tasks, which would seriously affect the accuracy of subsequent task execution, we can first execute a data query statement to obtain initial data query information. At this time, we can check the initial data query information. If the check results determine that it meets the data query conditions, then the initial data query information can be used as the data query information, and subsequent processing operations can be performed.

[0157] If the initial data query information does not meet the data query conditions, it means that the initial data query information cannot find data that matches the data query request. Therefore, the query suggestions can be adjusted based on the initial data query information to obtain the target query suggestions. At this time, the target query suggestions can be merged with the query intent information, and the merged result can be input into the target distillation model for processing to obtain the target data query statement corresponding to the data query request. This process can be continuously iterated until the data query information obtained at a certain moment meets the subsequent data query requirements, and can then be used for subsequent data query operations.

[0158] In summary, by dynamically adjusting the fusion of query suggestions and query intent, and iteratively optimizing query statements using a distillation model, the accuracy and efficiency of data queries in complex scenarios are significantly improved. The feedback mechanism automatically corrects the query logic, reducing the error rate caused by data heterogeneity or semantic ambiguity, while shortening query response time and enhancing the system's real-time responsiveness to dynamic data environments and changes in user intent. It also reduces model illusions, thereby achieving more accurate and intelligent query results.

[0159] Furthermore, after obtaining the data query statement, since the accuracy of the data query statement determines the precision of subsequent data queries, it can be verified before the statement is executed, and this can be done from multiple dimensions. In this embodiment, the specific implementation is as follows:

[0160] The process involves determining the time information, statistical logic information, table association information, and permission information corresponding to the data query statement; performing time verification on the data query statement based on the time information, statistical logic verification on the data query statement based on the statistical logic information, table association verification on the data query statement based on the table association information, and permission verification on the data query statement based on the permission information; and, if the confidence level of the data query statement is determined to be greater than a preset confidence threshold based on the verification results, executing the step of obtaining data query information using the data query statement.

[0161] Specifically, time information refers to the time of the corresponding data query statement; statistical logic information refers to the aggregation method of the related data query statement; table relationship information refers to the join logic of the related data query statement; and permission information refers to the data access permissions of the related data query statement.

[0162] Therefore, to ensure the use of high-quality data query statements in subsequent data query operations, the data query statements can be verified from four dimensions. This process involves determining the time information, statistical logic information, table join information, and permission information corresponding to the data query statement. Based on this, time verification can be performed on the data query statement, statistical logic verification can be performed on the data query statement based on the statistical logic information, table join verification can be performed on the data query statement based on the table join information, and permission verification can be performed on the data query statement based on the permission information. The confidence level of the data query statement can be obtained from the verification results of each dimension. Then, a weighted average of the confidence levels of each dimension can be calculated to obtain the overall confidence level of the data query statement. If the confidence level of the data query statement is greater than a preset confidence threshold, the step of obtaining data query information using the data query statement can be executed. Otherwise, the statement needs to be regenerated to ensure that high-quality statements can be used for subsequent data queries.

[0163] In specific implementation, such as Figure 2 As shown in the diagram, after obtaining the SQL statement output by the model fusion, the service layer can also associate a dynamic verification module for quality control of the statement. During this process, four-dimensional verification can be performed: service date verification (time dimension verification), aggregation method verification (statistical logic verification), table association verification (JOIN logic check), and permission verification (data access control). This ensures that statements with a confidence level greater than the confidence level threshold are used for subsequent processing.

[0164] Furthermore, the output layer is associated with an edge deployment interface to achieve terminal adaptation. By providing a lightweight API interface, it supports adapting the validated SQL structure to different terminal devices, thereby completing the complete closed loop from metadata to executable SQL output, enabling rapid deployment of the terminal environment, and thus ensuring data query efficiency.

[0165] In addition to the quality control mentioned above, the dynamic verification module can also construct a negative corpus, such as a fake field database (maintaining a blacklist containing a set number of non-existent fields for real-time interception), a bad SQL pattern database (including dangerous query templates such as Cartesian products and full table scans, and establishing an execution cost prediction model), and permission conflict detection (verifying field-level access permissions based on the RBAC model to block unauthorized queries (such as access to salary fields)), thereby improving the quality of SQL statements. In practical implementation, when detecting the existence of fields and tables, the corresponding database environment (mcp) can be directly requested to determine this, thus ensuring the accuracy of the detection.

[0166] Furthermore, when implementing terminal adaptation, the edge deployment interface can also configure a physical table positioning engine, including a semantic mapping dictionary (building a two-way mapping table containing business terms and field aliases (such as "customer" - T_CUSTOMERS.CUST_ID)), a fuzzy matching algorithm (using a hybrid algorithm of edit distance and word vectors to handle synonym scenarios such as "user" and "customer"), a joint query planner (automatically parsing multi-table join requirements and generating JOIN condition suggestions (supporting star / snowflake architecture)), and a dynamic feedback mechanism (recording the accuracy feedback of each positioning result and continuously optimizing the semantic matching model), thereby ensuring strong adaptability when deployed to any private domain scenario.

[0167] Following the previous example, after obtaining the SQL query statement, we can retrieve its corresponding time information, statistical logic information, table join information, and permission information. Based on this, we can combine the time information, statistical logic information, table join information, and permission information to perform business time verification, aggregation method verification, table join verification, and permission verification on the SQL query statement. Based on the verification results, the confidence level of the SQL query statement is determined to be 90%, which is greater than the confidence threshold of 80. At this point, the SQL query statement can be executed to obtain the physical table schema and descriptive information (such as table name, column names, data types, nullability, primary key information, default values, etc.) of the target data table. This information can then be used to retrieve the number of newly signed customers and revenue data of newly signed members in region A over the past 180 days from the target data table. The data can then be fed back to the user, allowing them to perform subsequent processing. During this process, if the physical table schema and descriptive information obtained after executing the SQL statement do not meet the data query requirements, the query suggestions can be dynamically adjusted, and the statement and information can be regenerated and confirmed until a physical table schema and descriptive information that meets the query requirements is obtained, which can then be used for data querying.

[0168] In practice, in addition to performing multi-dimensional verification of time, statistical logic, table relationships, and permissions as mentioned above, the schema of the accessed data table and related fields can be checked at any time before the data query statement is executed to obtain the data query information. This can reduce the illusion of the model and improve the accuracy of model processing.

[0169] In summary, by dynamically evaluating the confidence level of data query statements through a multi-dimensional verification mechanism (time, statistical logic, table joins, and permissions), and combining this with intelligent decision-making on execution paths based on preset thresholds, query accuracy and security are significantly improved. Four-dimensional collaborative verification reduces the query failure rate caused by data timeliness, logical errors, abnormal joins, or out-of-bounds permissions, while also reducing the consumption of ineffective query resources. This enhances the system's adaptability to complex business scenarios and its data governance level, achieving reliable and intelligent control over query results.

[0170] In practical applications, to ensure more accurate data queries within private domains, an iterative approach of applying and optimizing simultaneously can be used. In this embodiment, the specific implementation is as follows:

[0171] Collect user behavior data associated with the target data, and construct a query optimization task based on the user behavior data; optimize the intent recognition operation, prompt word construction operation, and target distillation model by executing the query optimization task.

[0172] Specifically, user behavior data refers to the user's behavioral responses after the target data is presented to them. This data characterizes whether the target data meets the user's query needs. Positive and negative samples can be constructed based on user behavior data. These samples can then be used to build query optimization tasks to optimize intent recognition, prompt word construction, and the target distillation model. Optimization of intent recognition refers to improving the accuracy of query intent recognition; prompt word construction optimization refers to improving the accuracy of query prompts; and target distillation model optimization refers to improving the accuracy of the target distillation model in predicting data query statements.

[0173] Based on this, user behavior data associated with the target data is collected, and a query optimization task is constructed based on the user behavior data; by executing the query optimization task, the intent recognition operation, the prompt word construction operation, and the target distillation model are optimized.

[0174] In practice, considering that the purpose of the query optimization task is to optimize the intent recognition operation, prompt word construction operation, and target distillation model, in order to achieve better optimization results, basic user information, permission data, and other content can be collected to construct a more complex query optimization task, thereby achieving better optimization results after task execution.

[0175] The data query method provided in this embodiment aims to solve the data silo problem, improve the efficiency of data querying within an enterprise, and reduce the technical requirements on users. Upon receiving a data query request related to the target domain, it first identifies the query intent information corresponding to the data query request and constructs query hints based on this intent. Then, the query hints are input into a target distillation model for processing to obtain a data query sequence corresponding to the data query request. This data query sequence includes a data query statement and a related data query inference chain. The data query inference chain characterizes the thinking and reasoning process of the target distillation model in generating the data query statement corresponding to the data query request, thereby making the generated data query statement more interpretable and helping users understand the statement generation process. This process is automated by the model, enabling automatic conversion from natural language to SQL statements without requiring additional user intervention or extensive R&D background. This effectively improves the convenience of data querying. Furthermore, by combining the processing capabilities of a large language model, it makes enterprise data more structured and readily usable. The target distillation model is achieved through knowledge distillation. Compared with traditional machine learning models, it can achieve the same or better prediction accuracy with lower precision, thereby effectively reducing local deployment costs. Based on this, data query statements can be executed to obtain data query information. Subsequently, target data can be read from the target data table associated with the target domain based on the data query information as a response to the data query request. This automates the management and use of enterprise data, effectively reducing human resources, saving costs, improving the efficiency of enterprise data management, and facilitating the access and use of data at any time.

[0176] See Figure 3 , Figure 3 A flowchart of another data query method according to an embodiment of this specification is shown. The method is applied to a cloud-side device, wherein the cloud-side device stores service data uploaded by the end-side device, and specifically includes the following steps.

[0177] Step S302: Receive the data query request submitted by the end-side device.

[0178] Step S304: Identify the query intent information corresponding to the data query request, and construct query prompt words corresponding to the data query request based on the query intent information.

[0179] Step S306: Input the query prompt words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes the data query statement and the data query inference chain associated with the data query statement.

[0180] Step S308: Execute the data query statement to obtain data query information, and read the target data from the target data table uploaded on the terminal side based on the data query information.

[0181] Step S310: Send the target data to the end device as a response to the data query request.

[0182] For any data query method not described in detail in this embodiment, please refer to the same or corresponding descriptions in the above embodiments. This embodiment will not elaborate further here. Specifically, cloud-side devices refer to devices that provide data query services, while edge devices are terminal devices owned by enterprises or individuals. Cloud-side devices are responsible for providing data query services and can also manage cloud storage space for the data on edge devices. Edge devices use cloud storage space through leasing, thereby saving costs and improving data processing efficiency.

[0183] In summary, to address the data silo problem and improve data query efficiency within enterprises while reducing technical requirements for users, after receiving data query requests related to the target domain, the system first identifies the query intent information corresponding to the data query request and constructs query hints based on this intent. Then, the query hints are input into the target distillation model for processing, obtaining the data query sequence corresponding to the data query request. This sequence includes the data query statement and the associated data query inference chain. The inference chain represents the thinking and reasoning process of the target distillation model in generating the data query statement, thus enhancing the interpretability of the generated statement and helping users understand the statement generation process. This process is automated by the model, enabling automatic conversion from natural language to SQL statements without requiring additional user intervention or extensive R&D background. This effectively improves the convenience of data queries. Furthermore, by combining the processing capabilities of a large language model, enterprise data becomes more structured and readily accessible. The target distillation model is achieved through knowledge distillation. Compared with traditional machine learning models, it can achieve the same or better prediction accuracy with lower precision, thereby effectively reducing local deployment costs. Based on this, data query statements can be executed to obtain data query information. Subsequently, target data can be read from the target data table associated with the target domain based on the data query information as a response to the data query request. This automates the management and use of enterprise data, effectively reducing human resources, saving costs, improving the efficiency of enterprise data management, and facilitating the access and use of data at any time.

[0184] The following is in conjunction with the appendix Figure 4Taking the application of the data query method provided in this specification in an internal enterprise data query scenario as an example, the data query method will be further explained. Figure 4 The present specification shows a flowchart of a data query method according to an embodiment, which includes the following steps.

[0185] Step S402: Receive a data query request related to the target domain.

[0186] Step S404: Identify the query intent information corresponding to the data query request, and construct query prompts corresponding to the data query request based on the query intent information.

[0187] Step S406: Input the query prompts into the target distillation model, and use the target distillation model to determine the target data table for the related data query request according to the query prompts.

[0188] Step S408: Determine the architecture information corresponding to the target data table, process the architecture information through the target distillation model, and obtain the data query sequence corresponding to the data query request. The data query sequence includes the data query statement and the data query inference chain associated with the data query statement.

[0189] Step S410: Execute the data query statement to obtain the initial data query information.

[0190] Step S412: If the initial data query information does not meet the data query conditions, adjust the query suggestions based on the initial data query information to obtain the target query suggestions.

[0191] Step S414: Merge the target query prompts and query intent information, and input the merged result into the target distillation model for processing to obtain the target data query statement corresponding to the data query request.

[0192] Step S416: Determine the time information, statistical logic information, table relationship information, and permission information corresponding to the data query statement.

[0193] Step S418: Perform time verification on the data query statement based on time information, statistical logic verification on the data query statement based on statistical logic information, table association verification on the data query statement based on table association information, and permission verification on the data query statement based on permission information.

[0194] Step S420: If the confidence level of the data query statement is greater than the preset confidence threshold based on the verification results, execute the target data query statement to obtain data query information.

[0195] Step S422: Based on the data query information, read the target data from the target data table associated with the target domain as a response to the data query request.

[0196] Step S424: Collect user behavior data related to the target data, and construct a query optimization task based on the user behavior data.

[0197] Step S426: Optimize the intent recognition operation, prompt word construction operation, and target distillation model by performing a query optimization task.

[0198] In summary, to address the data silo problem and improve data query efficiency within enterprises while reducing technical requirements for users, after receiving data query requests related to the target domain, the system first identifies the query intent information corresponding to the data query request and constructs query hints based on this intent. Then, the query hints are input into the target distillation model for processing, obtaining the data query sequence corresponding to the data query request. This sequence includes the data query statement and the associated data query inference chain. The inference chain represents the thinking and reasoning process of the target distillation model in generating the data query statement, thus enhancing the interpretability of the generated statement and helping users understand the statement generation process. This process is automated by the model, enabling automatic conversion from natural language to SQL statements without requiring additional user intervention or extensive R&D background. This effectively improves the convenience of data queries. Furthermore, by combining the processing capabilities of a large language model, enterprise data becomes more structured and readily accessible. The target distillation model is achieved through knowledge distillation. Compared with traditional machine learning models, it can achieve the same or better prediction accuracy with lower precision, thereby effectively reducing local deployment costs. Based on this, data query statements can be executed to obtain data query information. Subsequently, target data can be read from the target data table associated with the target domain based on the data query information as a response to the data query request. This automates the management and use of enterprise data, effectively reducing human resources, saving costs, improving the efficiency of enterprise data management, and facilitating the access and use of data at any time.

[0199] Corresponding to the above method embodiments, this specification also provides embodiments of a data query system. Figure 5a A schematic diagram of the structure of a data query system provided in one embodiment of this specification is shown. Figure 5a As shown, the data query system 500 includes a client 510 and a server 520, including:

[0200] The client 510 is used to receive a data query request input by a user through a data query page and send the data query request to the server.

[0201] The server 520 is used to identify the query intent information corresponding to the data query request, and construct query prompt words corresponding to the data query request based on the query intent information; input the query prompt words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request, the data query sequence including the data query statement and the data query inference chain associated with the data query statement; execute the data query statement to obtain data query information, and read target data from the target data table associated with the data query request based on the data query information, and feed the target data back to the client.

[0202] Specifically, when the server responds to a data query request submitted by the client and performs automated data query processing, it can use different deployed modules to complete different processing tasks, such as... Figure 5b The interactive diagram shown illustrates how an intent recognition module can be deployed to identify the intent corresponding to a data query request and obtain query intent information. A PROMPT and RAG module can be deployed to construct query suggestions based on the query intent information. A distillation model module can be deployed to process the query suggestions using the embedded target distillation model, determine the data query sequence, and then obtain data query information based on the data query statements within the data query sequence. This data query information can then be sent to the physical table query module, which reads the target data according to the query information and returns it to the client for use.

[0203] During this process, considering that the model output may not be directly usable, iterative optimization can be used to determine the data query information that satisfies the intent of the data query request and complete the target data query. This can be understood as follows: after receiving the data query information, the physical table query module can provide the PROMPT and RAG modules with the query physical table schema and descriptive information. This allows the PROMPT and RAG modules to dynamically adjust the query suggestions based on the physical table schema and descriptive information provided by the physical table query module. The adjusted query suggestions are then merged with the query intent information and sent to the distillation model module. The target distillation model iterates through this process, i.e., re-distillation and inference, until a certain iteration cycle determines that the query intent information is satisfied. At this point, the retrieved target data is fed back to the client for subsequent processing.

[0204] The detailed descriptions of the intent recognition process of the intent recognition module, the prompt word construction process of the PROMPT and RAG modules, the model processing process of the distillation model module, and the query processing process of the physical table query module can be found in the descriptions of the above embodiments. This embodiment will not elaborate further here.

[0205] In an optional embodiment, executing the data query statement to obtain data query information includes:

[0206] Execute the data query statement to obtain initial data query information; if the initial data query information does not meet the data query conditions, adjust the query suggestion words based on the initial data query information to obtain target query suggestion words; merge the target query suggestion words with the query intent information, and input the merging result into the target distillation model for processing to obtain the target data query statement corresponding to the data query request; execute the target data query statement to obtain data query information.

[0207] In an optional embodiment, the step of inputting the query suggestion words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request includes:

[0208] The query suggestion is input into the target distillation model, and the target distillation model is used to determine the target data table associated with the data query request according to the query suggestion; the architecture information corresponding to the target data table is determined, and the architecture information is processed by the target distillation model to obtain the data query sequence corresponding to the data query request.

[0209] In an optional embodiment, after the step of determining the architecture information corresponding to the target data table is executed, the method further includes:

[0210] Determine the table information corresponding to the target data table and display the table information and the architecture information; in response to the determination instruction submitted for the table information and the architecture information, execute the step of processing the architecture information through the target distillation model to obtain the data query sequence corresponding to the data query request.

[0211] In an optional embodiment, the step of inputting the query suggestion words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request includes:

[0212] The query suggestion is input into the target distillation model, which includes a domain adaptation module and a perception module. The domain adaptation module processes the query suggestion to obtain a first data query sequence, and the perception module processes the query suggestion to obtain a second data query sequence. The first data query statement in the first data query sequence and the second data query statement in the second data query sequence are fused together, and the data query sequence is generated based on the fusion result.

[0213] In an optional embodiment, training the target distillation model includes:

[0214] A global data table associated with the target domain is identified, and the corresponding metadata of the global data table is extracted. A mapping relationship between the data in the global data table and the service scenario is constructed by parsing the metadata, and the data in the global data table is standardized to obtain structured data. The initial domain adaptation module in the distillation model is trained using the mapping relationship, and the initial perception module in the distillation model is fine-tuned using the structured data. Based on the training results and the fine-tuning results, the target distillation model that meets the training stopping condition is generated.

[0215] In an optional embodiment, training the initial domain adaptation module in the distillation model using the mapping relationship includes:

[0216] Multiple preset prompt word templates are obtained. Based on the multiple prompt word modules and the mapping relationship, the initial domain adaptation module in the distillation model is trained to obtain an intermediate domain adaptation module. Distillation is performed on the intent sample generation layer, knowledge graph association layer, and logic parsing layer in the intermediate domain adaptation module to obtain the domain adaptation module. The intent sample generation layer is used to extract the association relationship between the corresponding fields of the data and the architecture information. The knowledge graph association layer is used to construct the domain knowledge network associated with the target domain. The logic parsing layer is used to parse the statement code logic.

[0217] In an optional embodiment, before the step of executing the data query statement to obtain data query information is executed, the method further includes:

[0218] The process involves determining the time information, statistical logic information, table association information, and permission information corresponding to the data query statement; performing time verification on the data query statement based on the time information, statistical logic verification on the data query statement based on the statistical logic information, table association verification on the data query statement based on the table association information, and permission verification on the data query statement based on the permission information; and, if the confidence level of the data query statement is determined to be greater than a preset confidence threshold based on the verification results, executing the step of obtaining data query information using the data query statement.

[0219] In an optional embodiment, after the step of reading target data from the target data table associated with the target domain based on the data query information as a response to the data query request is executed, the method further includes:

[0220] Collect user behavior data associated with the target data, and construct a query optimization task based on the user behavior data; optimize the intent recognition operation, prompt word construction operation, and target distillation model by executing the query optimization task.

[0221] In summary, to address the data silo problem and improve data query efficiency within enterprises while reducing technical requirements for users, after receiving data query requests related to the target domain, the system first identifies the query intent information corresponding to the data query request and constructs query hints based on this intent. Then, the query hints are input into the target distillation model for processing, obtaining the data query sequence corresponding to the data query request. This sequence includes the data query statement and the associated data query inference chain. The inference chain represents the thinking and reasoning process of the target distillation model in generating the data query statement, thus enhancing the interpretability of the generated statement and helping users understand the statement generation process. This process is automated by the model, enabling automatic conversion from natural language to SQL statements without requiring additional user intervention or extensive R&D background. This effectively improves the convenience of data queries. Furthermore, by combining the processing capabilities of a large language model, enterprise data becomes more structured and readily accessible. The target distillation model is achieved through knowledge distillation. Compared with traditional machine learning models, it can achieve the same or better prediction accuracy with lower precision, thereby effectively reducing local deployment costs. Based on this, data query statements can be executed to obtain data query information. Subsequently, target data can be read from the target data table associated with the target domain based on the data query information as a response to the data query request. This automates the management and use of enterprise data, effectively reducing human resources, saving costs, improving the efficiency of enterprise data management, and facilitating the access and use of data at any time.

[0222] The above is an illustrative scheme of a data query system according to this embodiment. It should be noted that the technical solution of this data query system and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the data query system, please refer to the description of the technical solution of the data query method described above.

[0223] Corresponding to the above method embodiments, this specification also provides embodiments of a data query device. Figure 6 A schematic diagram of a data query device according to one embodiment of this specification is shown. Figure 6 As shown, the device includes:

[0224] The receiving module 602 is configured to receive data query requests related to the target domain;

[0225] The identification module 604 is configured to identify the query intent information corresponding to the data query request, and construct query prompt words corresponding to the data query request based on the query intent information;

[0226] Processing module 606 is configured to input the query prompt words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement.

[0227] The reading module 608 is configured to execute the data query statement to obtain data query information, and read target data from the target data table associated with the target domain based on the data query information as a response to the data query request.

[0228] In an optional embodiment, executing the data query statement to obtain data query information includes:

[0229] Execute the data query statement to obtain initial data query information; if the initial data query information does not meet the data query conditions, adjust the query suggestion words based on the initial data query information to obtain target query suggestion words; merge the target query suggestion words with the query intent information, and input the merging result into the target distillation model for processing to obtain the target data query statement corresponding to the data query request; execute the target data query statement to obtain data query information.

[0230] In an optional embodiment, the step of inputting the query suggestion words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request includes:

[0231] The query suggestion is input into the target distillation model, and the target distillation model is used to determine the target data table associated with the data query request according to the query suggestion; the architecture information corresponding to the target data table is determined, and the architecture information is processed by the target distillation model to obtain the data query sequence corresponding to the data query request.

[0232] In an optional embodiment, after the step of determining the architecture information corresponding to the target data table is executed, the method further includes:

[0233] Determine the table information corresponding to the target data table and display the table information and the architecture information; in response to the determination instruction submitted for the table information and the architecture information, execute the step of processing the architecture information through the target distillation model to obtain the data query sequence corresponding to the data query request.

[0234] In an optional embodiment, the step of inputting the query suggestion words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request includes:

[0235] The query suggestion is input into the target distillation model, which includes a domain adaptation module and a perception module. The domain adaptation module processes the query suggestion to obtain a first data query sequence, and the perception module processes the query suggestion to obtain a second data query sequence. The first data query statement in the first data query sequence and the second data query statement in the second data query sequence are fused together, and the data query sequence is generated based on the fusion result.

[0236] In an optional embodiment, training the target distillation model includes:

[0237] A global data table associated with the target domain is identified, and the corresponding metadata of the global data table is extracted. A mapping relationship between the data in the global data table and the service scenario is constructed by parsing the metadata, and the data in the global data table is standardized to obtain structured data. The initial domain adaptation module in the distillation model is trained using the mapping relationship, and the initial perception module in the distillation model is fine-tuned using the structured data. Based on the training results and the fine-tuning results, the target distillation model that meets the training stopping condition is generated.

[0238] In an optional embodiment, training the initial domain adaptation module in the distillation model using the mapping relationship includes:

[0239] Multiple preset prompt word templates are obtained. Based on the multiple prompt word modules and the mapping relationship, the initial domain adaptation module in the distillation model is trained to obtain an intermediate domain adaptation module. Distillation is performed on the intent sample generation layer, knowledge graph association layer, and logic parsing layer in the intermediate domain adaptation module to obtain the domain adaptation module. The intent sample generation layer is used to extract the association relationship between the corresponding fields of the data and the architecture information. The knowledge graph association layer is used to construct the domain knowledge network associated with the target domain. The logic parsing layer is used to parse the statement code logic.

[0240] In an optional embodiment, before the step of executing the data query statement to obtain data query information is executed, the method further includes:

[0241] The process involves determining the time information, statistical logic information, table association information, and permission information corresponding to the data query statement; performing time verification on the data query statement based on the time information, statistical logic verification on the data query statement based on the statistical logic information, table association verification on the data query statement based on the table association information, and permission verification on the data query statement based on the permission information; and, if the confidence level of the data query statement is determined to be greater than a preset confidence threshold based on the verification results, executing the step of obtaining data query information using the data query statement.

[0242] In an optional embodiment, after the step of reading target data from the target data table associated with the target domain based on the data query information as a response to the data query request is executed, the method further includes:

[0243] Collect user behavior data associated with the target data, and construct a query optimization task based on the user behavior data; optimize the intent recognition operation, prompt word construction operation, and target distillation model by executing the query optimization task.

[0244] In summary, to address the data silo problem and improve data query efficiency within enterprises while reducing technical requirements for users, after receiving data query requests related to the target domain, the system first identifies the query intent information corresponding to the data query request and constructs query hints based on this intent. Then, the query hints are input into the target distillation model for processing, obtaining the data query sequence corresponding to the data query request. This sequence includes the data query statement and the associated data query inference chain. The inference chain represents the thinking and reasoning process of the target distillation model in generating the data query statement, thus enhancing the interpretability of the generated statement and helping users understand the statement generation process. This process is automated by the model, enabling automatic conversion from natural language to SQL statements without requiring additional user intervention or extensive R&D background. This effectively improves the convenience of data queries. Furthermore, by combining the processing capabilities of a large language model, enterprise data becomes more structured and readily accessible. The target distillation model is achieved through knowledge distillation. Compared with traditional machine learning models, it can achieve the same or better prediction accuracy with lower precision, thereby effectively reducing local deployment costs. Based on this, data query statements can be executed to obtain data query information. Subsequently, target data can be read from the target data table associated with the target domain based on the data query information as a response to the data query request. This automates the management and use of enterprise data, effectively reducing human resources, saving costs, improving the efficiency of enterprise data management, and facilitating the access and use of data at any time.

[0245] The above is an illustrative scheme of a data query device according to this embodiment. It should be noted that the technical solution of this data query device and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the data query device, please refer to the description of the technical solution of the data query method described above.

[0246] Corresponding to the above method embodiments, this specification also provides another embodiment of a data query device. Figure 7 A schematic diagram of another data query device provided in one embodiment of this specification is shown. Figure 7 As shown, this device is applied to cloud-side equipment, wherein the cloud-side equipment stores service data uploaded by the end-side equipment, including:

[0247] The receiving module 702 is configured to receive data query requests submitted by the end-side device;

[0248] The identification module 704 is configured to identify the query intent information corresponding to the data query request, and construct query prompt words corresponding to the data query request based on the query intent information;

[0249] Processing module 706 is configured to input the query prompt words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement.

[0250] The reading module 708 is configured to execute the data query statement to obtain data query information, and read target data from the target data table uploaded on the terminal side based on the data query information;

[0251] The sending module 710 is configured to send the target data to the end-side device as a response to the data query request.

[0252] The above is an illustrative scheme of another data query device according to this embodiment. It should be noted that the technical solution of this data query device and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the data query device, please refer to the description of the technical solution of the data query method described above.

[0253] Figure 8 A structural block diagram of a computing device 800 according to one embodiment of this specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.

[0254] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a network interface controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.

[0255] In one embodiment of this specification, the above-described components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0256] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 800 can also be a mobile or stationary server.

[0257] The processor 820 is used to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-described data query method.

[0258] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the data query method described above.

[0259] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described data query method.

[0260] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the data query method described above.

[0261] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described data query method.

[0262] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the data query method described above belong to the same concept. Details not described in detail in the technical solution of the computer program can be found in the description of the technical solution of the data query method described above.

[0263] An embodiment of this specification also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described data query method.

[0264] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the data query method described above.

[0265] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0266] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0267] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0268] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0269] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A data query method, comprising: Receive data query requests related to the target domain; Identify the query intent information corresponding to the data query request, and construct query suggestion words corresponding to the data query request based on the query intent information; The query prompts are input into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement. The data query statement is executed to obtain data query information, and target data is read from the target data table associated with the target domain based on the data query information, as a response to the data query request.

2. The data query method according to claim 1, wherein executing the data query statement to obtain data query information includes: Execute the data query statement to obtain initial data query information; If the initial data query information does not meet the data query conditions, the query suggestion words are adjusted based on the initial data query information to obtain the target query suggestion words; The target query suggestion words are merged with the query intent information, and the merged result is input into the target distillation model for processing to obtain the target data query statement corresponding to the data query request; Execute the target data query statement to obtain data query information.

3. The data query method according to claim 1, wherein inputting the query prompt words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request includes: The query suggestion is input into the target distillation model, and the target distillation model is used to determine the target data table associated with the data query request according to the query suggestion. The architecture information corresponding to the target data table is determined, and the architecture information is processed through the target distillation model to obtain the data query sequence corresponding to the data query request.

4. The data query method according to claim 3, after the step of determining the architecture information corresponding to the target data table is executed, further comprising: Determine the table information corresponding to the target data table, and display the table information and the architecture information; In response to the determination instruction submitted for the table information and the architecture information, the step of processing the architecture information through the target distillation model to obtain the data query sequence corresponding to the data query request is executed.

5. The data query method according to claim 1, wherein inputting the query prompt words into the target distillation model for processing to obtain the data query sequence corresponding to the data query request includes: The query suggestions are input into the target distillation model, wherein the target distillation model includes a domain adaptation module and a perception module; The domain adaptation module processes the query prompts to obtain a first data query sequence, and the perception module processes the query prompts to obtain a second data query sequence. The first data query statement in the first data query sequence and the second data query statement in the second data query sequence are merged, and the data query sequence is generated based on the fusion result.

6. The data query method according to claim 5, wherein training the target distillation model includes: Identify the global data table associated with the target domain and extract the metadata corresponding to the global data table; By parsing the metadata, a mapping relationship between the data in the global data table and the service scenario is constructed, and the data in the global data table is standardized to obtain structured data; The initial domain adaptation module in the distillation model is trained using the mapping relationship, and the initial perception module in the distillation model is fine-tuned using the structured data. The target distillation model that satisfies the training stopping condition is generated based on the training results and fine-tuning results.

7. The data query method according to claim 6, wherein training the initial domain adaptation module in the distillation model using the mapping relationship includes: Obtain multiple preset prompt word templates, and train the initial domain adaptation module in the distillation model based on the multiple prompt word modules and the mapping relationship to obtain the intermediate domain adaptation module; Distillation is performed on the intent sample generation layer, knowledge graph association layer, and logic parsing layer in the intermediate domain adaptation module to obtain the domain adaptation module; The intent sample generation layer is used to extract the association between the corresponding fields of the data and the architecture information; the knowledge graph association layer is used to construct the domain knowledge network associated with the target domain; and the logic parsing layer is used to parse the statement code logic.

8. The data query method according to any one of claims 1 to 7, wherein before the step of executing the data query statement to obtain data query information is performed, it further includes: Determine the time information, statistical logic information, table relationship information, and permission information corresponding to the data query statement; The data query statement is validated based on the time information, statistical logic is validated based on the statistical logic information, table association is validated based on the table association information, and permission is validated based on the permission information. If the confidence level of the data query statement is determined to be greater than the preset confidence threshold based on the verification results, the step of executing the data query statement to obtain data query information is performed.

9. The data query method according to any one of claims 1 to 7, after the step of reading target data from the target data table associated with the target domain based on the data query information as a response to the data query request is executed, it further includes: Collect user behavior data associated with the target data, and construct a query optimization task based on the user behavior data; By performing the query optimization task, the intent recognition operation, the prompt word construction operation, and the target distillation model are optimized.

10. A data query method applied to cloud-side devices, wherein, The service data uploaded by the cloud-side storage device includes: Receive the data query request submitted by the end-side device; Identify the query intent information corresponding to the data query request, and construct query suggestion words corresponding to the data query request based on the query intent information; The query prompts are input into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement. Execute the data query statement to obtain data query information, and read the target data from the target data table uploaded on the terminal side based on the data query information; The target data is sent to the end device as a response to the data query request.

11. A data query system, comprising a client and a server, including: The client is used to receive data query requests entered by users through the data query page and send the data query requests to the server. The server is used to identify the query intent information corresponding to the data query request, and to construct query prompts corresponding to the data query request based on the query intent information; The query prompts are input into the target distillation model for processing to obtain the data query sequence corresponding to the data query request. The data query sequence includes a data query statement and a data query inference chain associated with the data query statement. The system executes the data query statement to obtain data query information, and reads the target data from the target data table associated with the data query request based on the data query information, and then feeds the target data back to the client.

12. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 10.

13. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.

14. A computer program product comprising a computer program or instructions which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Large language model training method and device, medium and electronic equipment

    CN117932019A

  • Distillation to target device based on observed query patterns

    CN118401998A

  • Knowledge distillation method, device, equipment, storage medium and computer program product

    CN119005176A

  • Language conversion method and device based on retrieval enhancement and storage medium

    CN119441261A

  • Processing method of composite query task

    CN120045698A

Cited By

  • Atmospheric ocean heterogeneous data query method and query system

    CN121560921A

  • A method and system for querying atmospheric and oceanic heterogeneous data

    CN121560921B