Model fine tuning and data query method and device and storage medium

By constructing the target sample and fine-tuning the language model, the data table association difficulties of the NL2SQL solution in the case of multi-data table and diversified table structure are solved, and efficient and accurate query requirements are achieved automatic association between data tables.

CN120104592APending Publication Date: 2025-06-06HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311668178.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-06
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

NL2SQL solutions based on large language models are difficult to determine the data tables required for query requirements, especially when multiple data tables are included in the data source and the table structure information is diverse.

Method used

By obtaining conceptual information of the target field, operation statement information of the data table in the data source, and query requirements samples, the target sample is constructed to fine-tune the pre-trained language model, learn the correlation between the query requirements and the data table, and thus determine the data table required for query requirements.

Benefits of technology

It realizes automatic correlation of query requirements and data tables in the data source, improves the accuracy and efficiency of data tables required to determine query requirements, and avoids the difficulty of manually providing data table structure information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104592A_ABST
    Figure CN120104592A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a model fine tuning and data query method and device and a storage medium. In the embodiment of the invention, the query demand sample aiming at the data source is combined with the concept information of the target field and the operation statement information of the data table, so that the target sample which speculates the association between the query demand aiming at the data source and the data table can be constructed. Therefore, the pre-trained language model is finely adjusted by using the target sample, so that the language model can learn the association between the query demand for the data source and the data table. Therefore, when the data source is queried online, the query demand can be associated with the data table by using the target language model subjected to fine tuning, and the data table required by the query demand can be determined according to the association between the query demand and the data table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a model fine-tuning and data query method, device and storage medium. Background Art

[0002] With the continuous advancement of data technology, data-based decision analysis is being used by more and more companies and organizations. Data-based decision analysis is generally developed based on data warehouses, which requires developers to query the data required for decision analysis from the data warehouse.

[0003] In order to facilitate the query of data from the data warehouse, the Natural Language to Structured Query Language (NL2SQL) solution based on the Large Language Model (LLM) came into being. The NL2SQL solution based on LLM can automatically convert the query requirements expressed in natural language entered by the user into the Structured Query Language (SQL) corresponding to the data warehouse. The important part of the calculation of the NL2SQL solution based on LLM is to determine the data table that needs to be queried for the query requirement, which is also the difficulty of the solution. Summary of the invention

[0004] Multiple aspects of the present application provide a model fine-tuning and data query method, device and storage medium to achieve the association between query requirements and data tables, which can provide a basis for determining the data tables required for the query requirements.

[0005] The present application embodiment provides a model fine-tuning method, comprising:

[0006] Acquire concept information of a target domain, operation statement information of a data table in a data source, and a first query requirement sample for the data source; the target domain is the domain to which the data stored in the data table belongs;

[0007] Based on the concept information of the target domain, the operation statement information and the first query requirement sample, construct a target sample for inferring the association between the query requirement for the data source and the data table;

[0008] The pre-trained language model is fine-tuned using the target sample to obtain a target language model for querying the data source.

[0009] Optionally, the model fine-tuning method further includes: obtaining a query sentence sample corresponding to the second query requirement sample and a second thinking chain example corresponding to the second query requirement sample;

[0010] Using the target language model according to the reasoning process described in the second thought chain example, an association relationship between the second query requirement sample and the data table is generated, and a second reasoning process in which the target language model infers the association relationship between the second query requirement sample and the data table from the second query requirement sample;

[0011] According to the association relationship between the second query requirement sample and the data table, determining from the data source a second data table to be queried corresponding to the second query requirement sample;

[0012] The second data table, the second reasoning process and the query statement sample are used as training samples to fine-tune the pre-trained query statement generation model to obtain the target query statement generation model.

[0013] The present application also provides a data query method, including:

[0014] Get query requirement description information;

[0015] Using the target language model, generating an association relationship between the query requirement description information and the data table; the target language model is obtained by fine-tuning the pre-trained language model using the above-mentioned model fine-tuning method;

[0016] According to the association relationship between the second query requirement description information and the data table, the data table to be queried corresponding to the query requirement description information is determined from the data source.

[0017] Optionally, the data query method further includes: obtaining a thought chain example corresponding to the query requirement description information; the thought chain example is used to describe the reasoning process of the target language model inferring the association relationship between the output query requirement and the data table from the input query requirement;

[0018] The generating the association relationship between the query requirement description information and the data table by using the target language model includes:

[0019] Inputting the thought chain example and the query requirement description information into the target language model;

[0020] Using the target language model to generate the association relationship between the query requirement description information and the data table according to the reasoning process described in the thought chain example, and the first reasoning process in which the target language model infers the association relationship between the query requirement description information and the data table from the query requirement description information;

[0021] The data query method further includes:

[0022] Inputting the data table to be queried and the first reasoning process into a target query statement generation model;

[0023] A target query statement generation model is used to generate a query statement corresponding to the query requirement description information according to the data table to be queried and the first reasoning process.

[0024] The embodiment of the present application further provides a computing device, comprising: a memory and a processor; wherein the memory is used to store a computer program;

[0025] The processor is coupled to the memory and is configured to execute the computer program to perform the steps in the above-mentioned model fine-tuning method and / or data query method.

[0026] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned model fine-tuning method and / or data query method.

[0027] In an embodiment of the present application, a query demand sample for a data source is combined with the concept information of the target domain and the operation statement information of the data table to construct a target sample for inferring the association between the query demand for the data source and the data table. Therefore, by using the target sample, the pre-trained language model is fine-tuned, so that the language model can learn the association between the query demand for the data source and the data table. In this way, when performing an online query on the data source, the fine-tuned target language model can be used to associate the query demand with the data table, and then the data table required for the query demand can be determined based on the association between the query demand and the data table. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0029] Figure 1 A schematic diagram of a flow chart of a model fine-tuning method provided in an embodiment of the present application;

[0030] Figure 2 A flowchart of a data query method provided in an embodiment of the present application;

[0031] Figure 3 A schematic diagram of a flow chart of another model fine-tuning method provided in an embodiment of the present application;

[0032] Figure 4 A flowchart of another data query method provided in an embodiment of the present application;

[0033] Figure 5 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

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

[0036] The inventor of the present application has found that the NL2SQL solution based on the language model needs to include the table structure information of the data table in the prompt when querying data, that is, it is necessary to inform the language model of the table structure information of the data table to be used when querying. However, since the data source contains many data tables and the table structure information of the data tables is also diverse, it is difficult to list the table structure information of all data tables in the data source in the prompt of the language model, which makes it difficult for the NL2SQL solution based on the language model to determine the data table required for the query requirement.

[0037] It should be noted that in this application, data source refers to the source of data, which is a medium for storing data and can also provide data query services. The data source can be a data warehouse or a database. Among them, a data warehouse is a subject-oriented data management system such as business intelligence (BI) activities (especially analysis). It is only applicable to query and analysis, and usually involves a large amount of historical data. In practical applications, the data in the data warehouse generally comes from a wide range of sources such as application log files and transaction applications. The data warehouse can concentrate and integrate large amounts of data from multiple sources. With the help of the analysis function of the data warehouse, enterprises can obtain reference information from the data and improve decision-making. At the same time, over time, it will also establish a historical record that is of reference value to data scientists and data analysts.

[0038] Databases are transaction-oriented. Data is generated by daily applications or services and is frequently updated. Databases are generally used to store current transactional data, such as transaction data.

[0039] In order to determine the data table required for the query demand, in some embodiments of the present application, the query demand sample for the data source is combined with the concept information of the target field and the operation statement information of the data table to construct a target sample for inferring the association between the query demand for the data source and the data table. Therefore, using the target sample, the pre-trained language model is fine-tuned, so that the language model can learn the association between the query demand for the data source and the data table. In this way, when performing an online query on the data source, the fine-tuned target language model can be used to associate the query demand with the data table, and then the data table required for the query demand can be determined based on the association between the query demand and the data table.

[0040] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0041] It should be noted that the same reference numerals denote the same objects in the following drawings and embodiments, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in the subsequent drawings and embodiments.

[0042] Figure 1 The following is a flow chart of the model fine tuning method provided in the embodiment of the present application. Figure 1 As shown in Figure 2, the model fine-tuning method mainly includes:

[0043] 101. Obtain conceptual information of a target domain, operation statement information of a data table in a data source, and a first query requirement sample for the data source; the target domain is the domain to which the data stored in the data table belongs.

[0044] 102. Based on the concept information, operation statement information and the first query requirement sample of the target domain, a target sample for inferring the association between the query requirement for the data source and the data table is constructed.

[0045] 103. Use the target sample to fine-tune the pre-trained language model to obtain a target language model for querying the data source.

[0046] In the embodiment of the present application, the data source is output and stored for the target domain, and the data stored in the data table in the data source is the data of the target domain. The data source can be a data warehouse or a database, with the focus on the data warehouse. The target domain can be any application field that provides specific services to a limited group, such as the transportation field, medical field, business field, education field, entertainment field, environmental protection field or sports field, etc.

[0047] The solution of converting natural language into query statements based on language models is to automatically generate query statements based on the query requirement description information (abbreviated as Query) input by the user. Among them, the query requirement description information is the query requirement information described in natural language, generally in text form, and of course it can also be in the form of voice or video. The query statement is a query statement written in the programming language supported by the data source, and the query statement can be a query statement written in structured query language (SQL), cache query language (LQL) or domain-specific language (DSL). Generally, the query statement is an SQL statement. For example, NL2SQL converts the query requirements described in natural language into SQL query statements.

[0048] In an embodiment of the present application, the language model is a neural network model. In some embodiments, when the number of model parameters of the language model is large, for example, the number of parameters of the language model is millions, hundreds of millions, billions or even more, the language model may also be referred to as a large model, such as a large language model (LLM). In an embodiment of the present application, a large model is defined as a neural network model whose number of model parameters conforms to a preset parameter number range. Among them, the number of model parameters corresponding to the preset parameter number range is very large, which can be millions, hundreds of millions, billions or even more, and the specific value can be determined by the standard in the field of artificial intelligence (AI).

[0049] The language model can be trained in two stages: pre-training and fine-tuning. In the pre-training stage, the model is trained on large-scale natural languages ​​in general fields to learn the basic structure of the language and various common sense. Then, in the fine-tuning stage, the pre-trained language model is further trained on a smaller, more specific field dataset. Fine-tuning allows the model to better understand and generate the language in this specific field, so as to better complete specific tasks.

[0050] In the embodiments of the present application, the specific implementation architecture of the language model is not limited. The language model can adopt a language model architecture with permission to use and open source, or a self-developed language model architecture. Optionally, the large language model can be a generative pre-training (GPT) model, a general language model (GLM), a language dialogue model based on the GLM architecture (such as ChatGLM-6B, etc.), or a variation of these models.

[0051] In an embodiment of the present application, a pre-trained large language model can be used as the language model to be fine-tuned, and the pre-trained language model can be fine-tuned using a sample set of the target domain to obtain a target language model for querying the data source. Among them, determining the data table that needs to be queried according to the query requirement description information input by the user is an important part of the solution based on the language model to convert the natural language into a query statement. The difficulty of this link lies in how to make the language model understand the conceptual information of the target domain and the structural information of the data source. Therefore, in this embodiment, fine-tuning the language model requires the background knowledge corpus of the target domain and the information corpus of the data source, that is, the background knowledge of the target domain and the structural knowledge of the data source need to be input into the language model to fine-tune the pre-trained language model.

[0052] The inventors of this application have studied the data source of the target domain and found that what is stored in the data source is the data generated by the entity objects in the target domain during the service execution process. The core is the attributes of the entity objects themselves, the relationship between different entity objects, the behavior of the entity objects, and the impact of the behavior on other entity objects. In order to ensure the integrity of the data, the data source will also store the corresponding environmental information and background information of the target domain. Therefore, the key to understanding the data source is to understand the conceptual information of the target domain. Among them, the conceptual information of the target domain includes: one or more of the entity objects, the attributes of the entity objects, the behavior of the entity objects, the background information and environmental information of the target domain, etc., but is not limited to this. Multiple refers to 2 or more.

[0053] Different target fields have different conceptual information. For example, in the field of traffic, the entity objects in the conceptual information of the target field may include: vehicles, intersections, road sections, lane lines, traffic lights and signs, etc. Environmental information may include weather information and road condition information, etc. The attributes of entity objects, such as the attributes of vehicles, may include: driving speed, driving time and driving distance, etc. The background information of the target field may include: traffic rules information, etc.

[0054] The language model is fine-tuned using the concept information of the target domain. When organizing the concept information of the target domain, certain rules or templates can be followed, such as organizing the concept information of the target domain according to templates such as entity objects, relationships between different entity objects, behaviors of entity objects, environmental information of the target domain, and the impact of environmental information on entity objects or behaviors.

[0055] The concept information of the target domain can be manually sorted out based on the background knowledge corpus of the target domain and the specific conditions of the data source. The background knowledge corpus of the target domain can be any basic knowledge of the target domain, such as standard documents, papers, books and industry rules of the target domain.

[0056] If the language model is to determine the data table that needs to be queried for the query requirement description information according to the query requirement description information of the target domain, it is necessary to understand the concept information of the target domain contained in the query requirement description information. Therefore, in this embodiment, fine-tuning the language model requires providing the concept information of the target domain. Based on this, in step 101, the concept information of the target domain can be obtained.

[0057] The concept information of the target domain provides the basic knowledge of the target domain. If you want to determine the data table that needs to be queried for the query requirement description information, you also need to associate the concept information of the target domain with the table structure information of the data table in the data source. Among them, the table structure information of the data table is the information that describes the structure of the data table, which may include: the table name of the data table, the field names contained in the data table, the data type stored in the field name, and annotation information. One or more of the following. Multiple refers to 2 or more. Among them, the annotation information may include the annotation information of the data table and the annotation information of the fields in the data table.

[0058] The inventor of the present application has found that the operation statement information of a data table often includes the table structure information of the data table. The operation statement information of a data table includes: the operation statement of the data table and the annotation information of the operation statement, etc. The operation statement of a data table may include: the creation statement of the data table and / or the generation statement of the data table.

[0059] The statement for creating a data table refers to a statement for creating a data table from scratch. The statement for creating a data table can be a data definition language (DDL) statement for creating a data table, such as a CREATE table statement. The statement for creating a data table defines the structure of the data table, data types, and links between data tables. Therefore, the statement for creating a data table contains the table structure information of the data table.

[0060] The statement for generating a data table refers to a statement that generates a new data table based on an upstream data table, such as a generated SQL statement. For example, a generated SQL statement can be a select into statement or an insert into statement. The select into statement automatically generates a temporary table based on the upstream data table, and does not need to be created in advance. The insert into statement is used to insert new records into a data table.

[0061] In this embodiment, in order to establish the association between the concept information of the target domain and the data table, the annotation information of the operation statement of the data table can be manually checked and written. The annotation information of the operation statement may include: the annotation information of the data table, the annotation information of the fields in the data table, and the annotation information of the function included in the operation statement. The function included in the operation statement can be a built-in function or a user-defined function (UDF).

[0062] The annotation information of the data table is used to describe the correspondence between the data table and the conceptual information of the target field, and to reflect the data organization scheme. For example, in the field of transportation, the annotation information of the data table can be "basic attribute table of road sections, updated quarterly"; "average speed table of road sections, including the average speed of motor vehicles on the road sections at the minute level"; and "signal timing plan table, which saves the default timing plans for all intersections during peak hours, daytime off-peak hours, and nighttime on weekdays, non-working days, and holidays".

[0063] Field annotation information is used to describe the correspondence between fields and conceptual information, and to supplement some design information, such as "regional code, where the division of regions and administrative divisions is consistent, and the finest granularity is the district or county level; the regional code is consistent with the postal code of the administrative district"; "the 1-minute average speed of motor vehicles on the road section without waiting for the traffic light", etc.

[0064] Function annotation information refers to the functions included in the operation statement, and the function's function and interface description need to be provided. For example, generated SQL often contains UDFs, and the function and interface description of these UDFs need to be provided. For example, "UDF used to calculate the 1-minute average speed of a road section from the driving trajectory of motor vehicles, the input is the GPS trajectory data of all motor vehicles on a certain road section, and the output is the 1-minute average speed of the road section".

[0065] Among them, the annotation information of the operation statement can be described by the conceptual information of the target domain, which is consistent with the background knowledge corpus; and the table structure information of the data table can be provided, such as the design specifications of the data table and fields, the range of stored data, and other information not included in the corpus.

[0066] Based on the above description of the operation statement information of the data table, it can be known that the operation statement information of the data table reflects the association between the conceptual information of the target field and the data table to a certain extent. Therefore, in step 101, the operation statement information of the data table in the data source can also be obtained.

[0067] The conceptual information of the target domain provides the basic knowledge of the target domain, and the operation statement information of the data table can associate the conceptual information of the target domain with the data table in the data source to a certain extent. To determine the data table required for the query requirement, it is also necessary to associate the query conditions contained in the query requirement with the fields in the data table and the conceptual information of the target domain, which requires the language model to understand the query conditions. Based on this, in step 101, a query requirement sample for the data source can also be obtained. The query requirement sample can be the historical query requirement description information of the data source, or it can be the manually constructed query requirement description information, which is not limited here. The query requirement sample contains query conditions that reflect the query requirement. For example, the query requirement sample is "query the total number of alarms, total alarm duration and total alarm mileage of each alarm type for all enterprises in Province A on May 1, 2023", and the query conditions include: Province A, May 1, 2023 and all enterprises, etc.

[0068] Based on the above description of the concept information of the target domain, the operation statement information of the data table and the query demand sample, it can be known that: the concept information of the target domain can provide the basic knowledge of the target domain, and based on the concept information of the target domain, the language model can learn the basic knowledge of the target domain; the operation statement information of the data table can associate the concept information of the target domain with the data table, and based on the operation statement information of the data table, the language model can learn the association between the concept information of the target domain and the data table. Therefore, the query demand sample is combined with the concept information of the target domain and the operation statement information of the data table, and the language model can learn the association between the query demand for the data source and the data table. Moreover, after associating the query demand for the data source with the data source in the data source, the data table required for the query demand can be determined according to the association between the query demand for the data source and the data source in the data source.

[0069] Based on the above analysis, in step 102, based on the concept information of the target domain, the operation statement information of the data table in the data source, and the query demand sample, a sample for inferring the association between the query demand for the data source and the data table can be constructed. For the convenience of description, the sample here is defined as a target sample. The target sample refers to the first text and the second text logically associated with the context. In some embodiments, the first text and the second text can be implemented in the form of a question-answer pair, and the target sample is a question-answer pair sample. Each question-answer pair sample may include: a question and the answer information of the question. The first text may be a question, and the second text may be the answer information of the question. The question in the question-answer pair sample may be a question asked in the form of a question, and the answer information is the answer to the question. For example, the question in the question-answer pair sample is "What is the alarm attribute in the query demand [query the total number of alarms, total alarm duration, and total alarm mileage of each alarm type for all enterprises in Province A on May 1, 2023]?" Then the answer information is: alarm duration, alarm mileage. Of course, the question in the question-answer pair sample can also be a question stem represented by a declarative statement, and the answer information is the answer information that meets the requirements of the question stem, etc. For example, the question in the question-answer pair sample is "Extract the alarm attributes in the query requirement [query the total number of alarms, total alarm duration, and total alarm mileage of each alarm type for all enterprises in Province A on May 1, 2023]; then the answer information is: alarm duration, alarm mileage.

[0070] In the embodiment of the present application, the specific implementation method of constructing the target sample for inferring the association between the query demand for the data source and the data table based on the conceptual information of the target domain, the operation statement information of the data table in the data source and the query demand sample in the aforementioned step 102 is not limited, nor is the specific content of the target sample limited.

[0071] In some embodiments, the target sample is implemented in the form of a question-answer pair. The question-answer pair serving as the target sample can be defined as a target question-answer pair sample. The target question-answer pair sample includes: a target question and the answer information of the target question. Optionally, a target question for asking questions to infer the information required for the association between the query demand and the data table can be constructed based on the conceptual information of the target domain, the operation statement information of the data table in the data source, and the query demand sample. In the embodiments of the present application, the specific content of the information required for inferring the association between the query demand and the data table is not limited.

[0072] Since the language model determines the association between the query demand and the data table, it is necessary to learn the basic knowledge of the target domain, that is, the concept information of the target domain, and the information required to infer the association between the query demand and the data table may include: the association between different concept information in the target domain. Accordingly, based on the concept information of the target domain, a question (defined as the first question) for asking about the association between different concept information can be constructed.

[0073] The inventors of the present application have found that the association between different conceptual information generally includes: the relationship between one conceptual information and another conceptual information; the influence of one conceptual information on another conceptual information, etc., but not limited to this. For example, in the field of transportation, the first question may be "What is the relationship between intersections and road sections?", "What is the impact of weather on motor vehicle travel efficiency?", etc. The association between different conceptual information can be in the form of setting some question templates (defined as first question templates) for asking questions about the association between conceptual information, such as "What is the impact of A on B?", "What is the relationship between A and B?", etc. Based on the pre-set question templates, the first question for asking questions about the association between different conceptual information can be constructed by enumerating the conceptual information in the target field.

[0074] Specifically, different concept information can be obtained from the concept information of the target field, and a first question for asking about the relationship between different concept information can be constructed according to a pre-set first question template. Specifically, the obtained different concept information can be filled into the corresponding position of the first question template to obtain the first question for asking about the relationship between different concept information.

[0075] For example, the first question and answer information for asking about the relationship between different concept information may be: First question: "What is the relationship between intersections and road sections?" Answer information: "An intersection connects several road sections, and a road section connects two intersections." For another example, the first question is "What is the impact of weather on motor vehicle travel efficiency?" The answer information is "Bad weather, such as rain, snow, and fog, will affect the speed of motor vehicles and reduce traffic efficiency; at the same time, bad weather will increase the demand for motor vehicle travel, further affecting traffic efficiency."

[0076] The language model determines the association between query requirements and data tables, which requires not only learning the basic knowledge of the target domain, but also learning the association between the concept information of the target domain and the data table, such as the association between the concept information of the target domain and the table structure information of the data table, and the association between different table structure information. Based on this, the information required to infer the association between query requirements and data tables may also include: the association between the concept information of the target domain and the table structure information of the data table, and the association between different table structure information.

[0077] The association between different table structure information includes but is not limited to: the relationship between different fields and the relationship between fields and data tables, etc. The association between concept information and table structure information of data tables includes but is not limited to: the relationship between concept information and data tables, the relationship between concept information and fields, and the association process of different concept information in data tables, etc.

[0078] Based on the above description of the operation statement information of the data table, it can be known that the operation statement information can associate the concept information of the target field with the data table. Therefore, when constructing a target question for asking information required to infer the association between the query demand for the data source and the data table, it is also possible to construct a question for asking the association between the concept information of the target field and the table structure information of the data table (defined as the second question) and a question for asking the association between different table structure information (defined as the third question) based on the operation statement information.

[0079] Specifically, the table structure information can be determined based on the operation statement information; further, according to the pre-set second question template, a second question for asking about the relationship between the concept information of the target field and the table structure information, and a third question for asking about the relationship between different table structure information are constructed. Among them, the second question template includes: a question template for asking about the relationship between concept information and table structure information. For example, "Which table is a certain concept information in?" "Which field does a certain concept information correspond to?" "The physical meaning of a certain field, that is, the corresponding concept information", etc.

[0080] For example, the second question can be to input a certain concept information and ask which table the concept information is in, which field it corresponds to, etc. For example, the second question is: "In which data table and which fields is the average speed of a road section in 1 minute?" The answer information can be "The average speed of all road sections in 1 minute is in the road_avg_speed.one_min field in the data table named road_avg_speed."

[0081] For another example, the second question may input a data table or a field of a data table, and inquire about a certain type of information, including the conceptual information or generation logic involved. For example, the second question is "Please explain the meaning and generation logic of the field xxx.yyy". The meaning of the field can answer the conceptual information corresponding to the field. The generation logic of the field can be the processing logic of the field involved in the generative SQL. If it is directly copied from the upstream data table, the field of the upstream data table can be answered; if it is processed from the field of the upstream data table, the processing logic of the field obtained from the field of the upstream data table can be answered.

[0082] For another example, the second question may input different concept information of the target field and ask about the association between the two different concept information. Correspondingly, the answer information may give the association process of the corresponding fields of the two different concept information in the data table. For example, the second question is "How should the average speed of the region and the average speed of the section be associated?" The answer information may be "From the "average speed of the section", get the "section" where it is located, and then from the "section", get the "region" where the "section" is located, and finally get the "average speed of the region" through the "region".

[0083] In the embodiment of the present application, the second question template also includes: a question template that asks about the association between different table structure information. For example, "What is the upstream field of field X?", "What is the downstream field of field X?", "What are the primary key and foreign key fields of data table Y?", "What fields of other tables are associated with the primary key and foreign key fields of data table Y and / or the generation logic of a certain field", etc. "The generation logic of a certain field" mainly refers to how to obtain the field based on the upstream field. For example, it is obtained by copying from the fields of the upstream data table, or by performing data processing on the fields of the upstream data table, etc.

[0084] For example, the generated SQL of the input table asks what upstream fields a field in the table has. For example, the third question is: "The generated SQL is insert into websites(id,name,url)select id,app_name,url fromapps; what is the upstream field of websites.id?" The answer information of the third question is: apps.id. For another example, the creation statement and / or generated SQL of the input table asks which sets of primary key and foreign key fields of the data table are associated with which fields in other tables, etc.

[0085] The association between the concept information of the target domain and the table structure information may include: a direct association relationship between the concept information of the target domain and the table structure information, such as which table a certain concept information is in, which field it corresponds to, etc. Of course, the association between the concept information of the target domain and the table structure information may also include: the association process of different concept information in the data table. For example, the average speed is obtained by dividing the driving distance field and the driving time field.

[0086] Based on this, when constructing the second question for asking about the relationship between the concept information and the table structure information of the target field according to a pre-set second question template, questions for asking about the direct relationship between the concept information and the table structure information, and questions for asking about the relationship process of different concept information in the data table can be constructed according to the question template for asking about the relationship between the concept information and the table structure information; and questions for asking about the direct relationship between the concept information and the table structure information, and questions for asking about the relationship process of different concept information in the data table are used as the second question.

[0087] The above-mentioned embodiment exemplifies the optional implementation methods of the second question constructed based on the association between the conceptual information of the target domain and the table structure information of the data table and the third question for asking about the association between different table structure information, but does not constitute a limitation.

[0088] The conceptual information of the target domain provides the basic knowledge of the target domain, and the operation statement information of the data table can, to a certain extent, associate the conceptual information of the target domain with the data table in the data source. To determine the data table required for the query requirement, it is also necessary to associate the query conditions contained in the query requirement with the fields in the data table and the conceptual information of the target domain. The inventors of this application have found that the query conditions have clear data understanding requirements and can be divided into the following categories:

[0089] (1) The association between the data contained in the query conditions and the conceptual information of the target domain: used to determine which conceptual information of the target domain the data contained in the query conditions belongs to. For example, XXX Company belongs to the enterprise (entity object); the number of alarms and the duration of alarms belong to alarm attributes, etc.

[0090] (2) The relationship between the query conditions and the data in the data table. For example, before the data in the query conditions are compared with the data in the field, whether the data in the query conditions needs to be converted, and how to convert the data. Data conversion includes the conversion of data format and data expression. For example, if the query conditions include: yesterday; and the date in the data table is stored in the format of X year X month X day, then "yesterday" needs to be converted to the format of "X year X month X day".

[0091] Of course, data conversion may also include calling a function to convert data into data of another concept. For example, calling a division function to convert driving distance and driving time into average driving speed, etc. For another example, calling a time expression function to convert "yesterday" into a timestamp format, etc.

[0092] In order to help the language model understand the data in the data table (such as field values), the field values ​​can also be annotated in the annotation information of the aforementioned operation statement. The annotations of the field values ​​corresponding to the field include but are not limited to: (1) If the field is of numeric type and has a physical unit, the physical unit of the field is clearly annotated; (2) If the field is of enumeration type, if the number of enumeration values ​​is less than the set number, the meaning of each value can be listed one by one in the annotation information; if the number of enumeration values ​​exceeds the set number, a dimension table can be defined to store the enumeration values ​​of the field in the dimension table; and the dimension table associated with the field is described in the annotation information; (3) If the field value needs to be converted by a function before use, the function used is annotated. For example, the information stored in the field is a date or a timestamp, but it is stored in the form of a string. It is necessary to indicate whether the type of the field is date, datetime, etc. Accordingly, the data in the data table can be determined based on the annotation information of the operation statement of the data table. For example, the field value of the data table can be obtained from the comment information of the operation statement; or the dimension table associated with the field of the data table can be obtained from the comment information of the operation statement, and the field value can be obtained from the dimension table associated with the field as the data in the data table.

[0093] Therefore, the information required to infer the association between the query demand and the data table may also include: the association between the query condition and the conceptual information of the target field and the association between the query condition and the data in the data table. The data in the data table specifically refers to the field values ​​in the data table. Accordingly, when constructing the information required to ask questions about the association between the inferred query demand and the data table, it is also possible to construct questions about the association between the query condition and the conceptual information contained in the query demand sample (defined as the fourth question) and questions about the association between the query condition and the data in the data table (defined as the fifth question) based on the query demand sample and the data in the data table.

[0094] Specifically, the query conditions can be obtained from the query requirement sample; and according to the set question template (defined as the third question template), the fourth question for asking the association between the query conditions contained in the query requirement sample and the concept information of the target field is constructed. For example, the set question template can be "Which concept information does a certain data in the query condition belong to?" For another example, the set question template can be "Please extract a certain concept information in the query requirement" and so on.

[0095] For the fifth question for asking about the association between the query conditions and the data in the data table, the query conditions can be obtained from the query requirement sample; and the data in the data table can be determined based on the operation statement information of the data table; according to the query conditions and the data in the data table, the fifth question for asking about the association between the query conditions and the data in the data table is constructed according to the set question template (defined as the fourth question template).

[0096] For example, to understand the association between the query conditions and the conceptual information of the target field, the fourth question can be constructed by enumerating the field values. Usually, there is no need to traverse all possible field values, and sampling a part of them is sufficient. For example, the fourth question is: Which conceptual information does XXX company belong to? The answer information is: enterprise. For another example, the fourth question is: Extract the alarm attributes in the query requirement [Query the total number of alarms, total alarm duration, and total alarm mileage of each alarm type for all enterprises in Province A on May 1, 2023]. The answer information is: alarm duration, alarm mileage.

[0097] The fifth question about the relationship between the query condition and the data in the data table may include: understanding of numerical conversion; if the time condition of the query condition is "yesterday", the fifth question may be "how should yesterday be calculated?"; the answer information is: "Yesterday is a date type, and the method to calculate yesterday is datediff(now(),-1)". For another example, the fifth question about the relationship between the query condition and the data in the data table may include: query condition judgment. For example, the fifth question is "how should yesterday be judged?", and the answer information is "assuming that the field recording the date in the table is dt, the method to judge yesterday is dt=datediff(now(),-1)" and the like.

[0098] The above-mentioned embodiment exemplifies a specific implementation method for constructing information required for asking questions to infer the association between query requirements and data tables, but it does not constitute a limitation. Accordingly, the first question for asking questions about the association between different concept information, the second question for asking questions about the association between concept information and the table structure information of the data table, the third question for asking questions about the association between different table structure information, the fourth question for asking questions about the association between query conditions contained in the query requirement sample and concept information, and the fifth question for asking questions about the association between query conditions and data in the data table constructed in the above-mentioned embodiment can be used as target questions. These target questions contain the information required for asking questions to infer the association between query requirements and data tables.

[0099] After constructing a target question for asking information required for inferring the association between the query demand and the data table, it is necessary to determine the answer information of the target question. In the embodiment of the present application, the specific implementation method of determining the answer information of the target question is not limited.

[0100] Since the pre-trained language model has learned general knowledge, this general knowledge may contain background knowledge corpus in the target field. Therefore, the pre-trained language model can be used to generate the answer information of the target question. That is, the target question is input into the pre-trained language model for answer prediction to obtain the answer information of the target question.

[0101] For the aforementioned second question for asking about the relationship between the concept information and the table structure information of the data table, the constructed second question and the operation statement information for the data table can also be input as questions into the pre-trained language model; and the pre-trained language model is used to generate the answer information of the constructed second question and the operation statement information for the data table as the answer information of the second question. This can provide more useful basis information for the pre-trained language model to predict the answer to the question, which helps to improve the accuracy of the answer predicted by the language model.

[0102] After determining the answer information of the target question, a target question-answer pair sample can be determined based on the target question and the answer information of the target question as a target sample. In some embodiments, each target question and the answer information of the target question can be regarded as a target question-answer pair sample. In other embodiments, in order to improve the accuracy of the answer information in the target question-answer pair sample, the target question and the answer information of the target question generated by the pre-trained language model can also be output; and an answer information adjustment interface is provided, so that the answer information of the target question can be manually adjusted to make the answer information of the target question more accurate. Accordingly, in response to the call to the answer information adjustment interface, the adjusted answer information of the target question can be obtained; and the target question and the adjusted answer information corresponding to the target question can be used as the target question-answer pair sample.

[0103] For the first question, the second question, the fourth question and the fifth question mentioned above, the pre-trained language model can be used to generate the answer information of the target question; and the answer information of the target question can be manually adjusted or corrected.

[0104] Of course, the pre-trained language model may not have learned some private domain knowledge of the data source. For example, the third question mentioned above, which is used to ask about the relationship between different table structure information, needs to be associated with the table structure information of the data table, which belongs to the private domain knowledge of the data source.

[0105] The inventor of the present application has found that the operation statement information of the data table includes the association between different table structure information. Based on this, the answer information of the third question can be determined by parsing the operation statement information. Specifically, the operation statement information can be parsed to obtain the association relationship between different table structure information; and the answer information of the third question can be selected from the association relationship between different table structure information.

[0106] After determining the constructed target question and the answer information of the target question, a target question-answer pair sample can be determined based on the target question and the answer information of the target question as a target sample. For example, each target question and the answer information of the target question can be used as a target question-answer pair sample, that is, as a target sample.

[0107] After constructing a target sample that can infer the association between the query demand and the data table, in step 103, the target sample can be used to fine-tune the pre-trained language model to obtain a target language model for querying the data source.

[0108] In the process of fine-tuning the pre-trained language model using the target sample, the pre-trained language model can learn the association between the query demand and the data table through the target sample, thereby obtaining a target language model that can infer the association between the query demand description information and the data table in the data source. In this way, using the association between the query demand description information output by the target language model and the data table in the data source, the data table to be queried corresponding to the query demand description information, that is, the data table required by the query demand, can be determined.

[0109] In this embodiment, in the stage of fine-tuning the language model using the target sample, the loss function minimization can be used as the training goal, the questions in the target question-answer pair sample can be used as the model input, and the answer information in the target question-answer pair sample can be used as the actual result corresponding to the model input to fine-tune the pre-trained language model to obtain the target language model provided in this embodiment. Among them, the loss function can be determined by the difference between the answer information output by the language model in the model fine-tuning stage and the actual result corresponding to the above model input (i.e., the answer information in the target question-answer pair sample).

[0110] The difference between the answer information output by the language model and the actual result corresponding to the above model input (i.e., the answer information in the target question-answer pair sample) can be expressed as: the cross entropy between the answer information predicted by the model and the answer information in the target question-answer pair sample; or, the distance between the answer information predicted by the model and the answer information in the target question-answer pair sample, such as the Euclidean distance or the cosine distance, etc. Or, the mean square error between the answer information predicted by the model and the answer information in the target question-answer pair sample, etc.

[0111] In this embodiment, the query demand sample for the data source is combined with the concept information of the target domain and the operation statement information of the data table to construct a target sample for inferring the association between the query demand for the data source and the data table. Therefore, by using the target sample, the pre-trained language model is fine-tuned, so that the language model can learn the association between the query demand for the data source and the data table. In this way, when performing an online query on the data source, the fine-tuned target language model can be used to associate the query demand with the data table, and then the data table required for the query demand can be determined based on the association between the query demand and the data table.

[0112] On the other hand, this embodiment does not need to exhaustively enumerate the structural information of all data tables in the data source. It can use the language model learned by the target language model to learn the relationship between the query requirements for the data source and the data tables, automatically associate the query requirements with the data tables, and determine the data tables required for the query requirements, thereby improving the accuracy of the determined data tables.

[0113] When fine-tuning the pre-trained language model using the target question-answer sample pairs, information prompts for the questions can be randomly selected from the background knowledge corpus of the target domain, or no information prompts can be provided to force the language model to use the knowledge that has been learned. Specifically, in the process of fine-tuning the pre-trained language model, the background knowledge corpus of the target domain can be added to the questions of the target question-answer sample pairs. Afterwards, the pre-trained language model is fine-tuned using the target question-answer sample pairs with the background knowledge corpus added to obtain the target language model for querying the data source. In this way, fine-tuning in the form of pre-training can be avoided, the fine-tuning process can be simplified, and the fine-tuning efficiency can be improved.

[0114] In some embodiments, during the whole process of fine-tuning the pre-trained language model, background knowledge corpus of the target domain can be randomly added to the questions of the target question-answer pair samples to force the language model to use the knowledge it has learned. This fine-tuning method takes a long time to train.

[0115] In order to reduce the training time and improve the model training efficiency, the background knowledge corpus related to the questions of the target question-answer pair samples provided at the beginning of fine-tuning can gradually become irrelevant information or no prompt information as the fine-tuning proceeds, which can improve the training efficiency. Accordingly, in the initial stage of fine-tuning the pre-trained language model, the background knowledge corpus of the target field related to the questions of the target question-answer pair samples can be added to the questions of the target question-answer pair samples; and as the time of fine-tuning the pre-trained language model increases, the background knowledge corpus is gradually added to the questions of the target question-answer pair samples randomly; wherein, the longer the time of fine-tuning the pre-trained language model is, the greater the proportion of questions with randomly added background knowledge corpus. Alternatively, as the time of fine-tuning the pre-trained language model increases, the number of questions with the background knowledge corpus of the target field related to the questions is gradually reduced; wherein, the longer the time of fine-tuning the pre-trained language model is, the smaller the number of questions with the background knowledge corpus of the target field related to the questions is.

[0116] For the fine-tuned target language model, in some embodiments of the present application, test question-answer pair samples can be sorted to detect the target language model's degree of understanding of the data source and the background knowledge of the target field. Among them, the questions and answer information in the test question-answer pair samples can be integrated with the question-answer information in the aforementioned target question-answer pair samples to obtain a comprehensive question-answer pair. For example, the test question-answer pair samples may include: question-answer pairs for asking and answering the relationship between different conceptual information. For example, the question is "What is the relationship between roads and provinces?" The answer information is "Roads belong to administrative regions, and administrative regions can be associated with provinces through their cities."

[0117] The test question and answer samples may also include: question and answer pairs used to reflect the understanding of the query requirements. For example, the question is "Please list the concepts and fields involved in the query requirement [query the total number of alarms, total alarm duration and total alarm mileage of each alarm type for all enterprises in Province A on May 1, 2023] based on the data warehouse information." The answer information is "The concept information includes Province A (province), May 1, 2023 (date), enterprise, alarm, which also involves the attributes of the alarm: alarm duration, alarm mileage. The table containing the alarm attributes is [If there are multiple tables, list them all. If a specific table can be located based on the query information, continue reasoning; if it cannot be located, it will prompt that the information is incomplete and multiple rounds of dialogue will be conducted], [and the fields of relevant concept information in the table will be listed one by one]". Among them, the [ ] part needs to be supplemented manually according to the actual situation.

[0118] For another example, the question is "Please complete the hidden information in the query requirement [query the total number of alarms, total alarm duration and total alarm mileage of each alarm type for all enterprises in Province A on May 1, 2023] based on the data warehouse information." The answer information is "The alarm of the enterprise is the alarm of the motor vehicle owned by the enterprise. The enterprise in Province A is the enterprise where the city is located in Province A. Province A is represented by the code aaaaa. The total number of alarms refers to the count of all alarms, the total alarm duration refers to the sum of the alarm duration, and the total alarm mileage refers to the sum of the alarm mileage."

[0119] For another example, the question is "Please analyze the tables needed to query the total number of alarms, total alarm duration, and total alarm mileage of each alarm type for all enterprises in Province A on May 1, 2023 based on the data warehouse information." The answer information is "[Based on the results of the above analysis, list the tables of original query requirements and supplementary information]". Among them, the [ ] part is the content that needs to be manually supplemented according to the actual situation. [ ] describes what the content that needs to be supplemented is and the form of supplementation.

[0120] After obtaining the test question-answer pair samples, the test question-answer pair samples can be used to test the target language model's understanding of the background knowledge of the target field and the data source. Specifically, the questions in the test question-answer pair samples can be input into the target language model, and the target language model can be used to generate answers to the questions in the test question-answer pair samples; then, the similarity between the answers to the questions generated by the target language model and the answers to the questions in the test question-answer pair samples can be calculated.

[0121] In the embodiments of the present application, the specific implementation method of calculating the similarity between the answer to the question generated by the target language model and the answer to the question in the test question and answer pair sample is not limited. In some embodiments, the answer to the question generated by the target language model and the answer to the question in the test question and answer pair sample can be vectorized respectively to obtain a first answer vector corresponding to the answer to the question generated by the target language model and a second answer vector corresponding to the answer to the question in the test question and answer pair sample.

[0122] Optionally, a word vector model such as a word2vec model, an embedded language model (Embedding from languagemodel, ELMo model), a generative pre-train model (GPT model) or a transformer-based bidirectional encoding representation Bidirectional Encoder Representations from Transformers, BERT) model can be used to vectorize the answer to the question generated by the target language model and the answer to the question in the test question and answer pair sample, respectively, to obtain a first answer vector corresponding to the answer to the question generated by the target language model, and a second answer vector corresponding to the answer to the question in the test question and answer pair sample.

[0123] Further, the distance between the first answer vector and the second answer vector may be calculated as the similarity between the answer to the question generated by the target language model and the answer to the question in the test question-answer pair sample. The greater the distance between the first answer vector and the second answer vector, the lower the similarity between the answer to the question generated by the target language model and the answer to the question in the test question-answer pair sample. Optionally, the distance between the first answer vector and the second answer vector may be a cosine distance, a Euclidean distance, a Mahalanobis distance, a Mahalanobis distance, a Hamming distance, etc., but is not limited thereto.

[0124] After determining the similarity between the answer to the question generated by the target language model and the answer to the question in the test question and answer pair sample, a first test question and answer pair sample can be selected from the test question and answer pair sample, the similarity between the answer contained in it and the answer to the question generated by the target language model satisfies the set similarity condition. For an embodiment in which the similarity between the answer to the question generated by the target language model and the answer to the question in the test question and answer pair sample is characterized by vector distance, the similarity condition may include: the distance between the first answer vector corresponding to the answer to the question generated by the target language model and the second answer vector corresponding to the answer to the question in the test question and answer pair sample is less than or equal to the set distance threshold. Accordingly, a test question and answer sample pair in which the distance between the second answer vector and the first answer vector is less than or equal to the set distance threshold can be selected from the test question and answer pair sample as the first test question and answer pair sample that satisfies the set similarity condition.

[0125] Furthermore, the number of first test question-answer pair samples and their proportion to the test question-answer sample pairs can be calculated; and the proportion can be used to characterize the target language model's understanding of the background knowledge and data source of the target domain, thereby quantifying the target language model's understanding of the background knowledge and data source of the target domain. The larger the number of first test question-answer pair samples and their proportion to the test question-answer sample pairs, the higher the target language model's understanding of the background knowledge and data source of the target domain.

[0126] Based on the model fine-tuning method provided in the above embodiment, a target language model for querying a data source can be obtained. The target language model learns the association between the query demand and the data table. Therefore, when the target language model is used to query the data source online, the target language model can automatically determine the association between the input query demand and the data table in the data source. The data query method provided in the embodiment of the present application is exemplarily described below.

[0127] Figure 2 A flow chart of a data query method provided in an embodiment of the present application. Figure 2 As shown, the data query method mainly includes:

[0128] 201. Obtain first query requirement description information for a data source.

[0129] 202. Determine the association relationship between the first query requirement description information and the data table by using the target language model.

[0130] 203. According to the association relationship between the first query requirement description information and the data table, determine from the data source a first data table to be queried corresponding to the first query requirement description information.

[0131] In this embodiment, the target language model is obtained by fine-tuning the pre-trained language model using the model fine-tuning method provided in the above embodiment. The query requirement description information can be text information provided by the user to describe the query requirement when querying the data source using the target language model online, including query conditions, etc.

[0132] The association relationship between the query requirement description information and the data table may include: the correspondence between the query conditions contained in the query requirement description information and the data table, the correspondence between the query conditions and the fields of the data table, and the correspondence between the query conditions and the field values ​​of the data table. That is, the association relationship between the query requirement description information and the data table may reflect which data table the query requirement needs to query, which fields of the data table need to be queried, and which field values ​​of these fields need to be queried, etc. Therefore, the data table to be queried corresponding to the query requirement description information may be determined based on the association relationship between the query requirement description information and the data table determined by the target language model.

[0133] In this embodiment, the target language model learns the association between the query requirements and the data table for the data source during the fine-tuning stage. Thus, when performing online queries on the data source, the fine-tuned target language model can be used to associate the query requirements with the data table, and then the data table required for the query requirements can be determined based on the association between the query requirements and the data table.

[0134] On the other hand, this embodiment does not need to exhaustively enumerate the structural information of all data tables in the data source. It can use the language model learned by the target language model to learn the relationship between the query requirements for the data source and the data tables, automatically associate the query requirements with the data tables, and determine the data tables required for the query requirements, thereby improving the accuracy of the determined data tables.

[0135] In some embodiments, in order to clearly understand the reasoning process of the target language model, if the determined data table is inaccurate, the cause can be traced back and a Chain-of-thought (CoT) method is introduced. Among them, CoT is an improved prompt strategy used to improve the performance of language models in complex reasoning tasks, such as arithmetic reasoning, common sense reasoning, and symbolic reasoning. CoT combines intermediate reasoning steps that can introduce the final output into the prompt. Simply put, the chain of thought is a discrete prompt learning. Compared with the traditional context learning as input to let the language model complete the output, CoT has more intermediate derivation prompts.

[0136] For the CoT method, it is necessary to pre-build a CoT example to describe the reasoning process of the target language model inferring the association relationship between the output query demand and the data table from the input query demand. Among them, the CoT example can be generated according to the preset CoT example template of the target language model using the target language model using the generative knowledge prompting (GKP) method. Specifically, a CoT example template of a preset target language model can be obtained. Among them, the CoT example template of the target language model can be manually sorted; and the target language model is used to generate a CoT example according to the CoT example template using the generative knowledge prompting method. Further, the CoT example can be added to the CoT example library.

[0137] In order to improve the accuracy of the CoT example, the CoT example generated by the target language model can also be output, and a CoT example adjustment interface is provided, and the CoT example can be manually adjusted based on the CoT example adjustment interface. Accordingly, in response to a call to the CoT example adjustment interface, a CoT example adjusted based on the CoT example adjustment interface can be obtained; and the adjusted CoT example is entered into the CoT example library. Among them, the CoT example library includes one or more CoT examples. Multiple refers to 2 or more. Generally, a large number of CoT examples are included.

[0138] The CoT sample template can be implemented as follows:

[0139] Query requirements: the query requirement description information entered by the user;

[0140] Query understanding: expand query requirements and complete the knowledge hidden in the original query requirements;

[0141] Query target: the query target described by entity objects, relationships, attributes, and indicators;

[0142] Query conditions: Query conditions described by entity objects, relationships, attributes, and indicators; query conditions are divided into three categories: filter conditions, grouping conditions, and connection conditions. Filter conditions are connected with logical "and" or logical "or", and parentheses can be added to indicate priority.

[0143] Target fields: List the field names corresponding to each query target, including the table name. If a query target has multiple fields that meet the conditions, list all the fields that meet the conditions; if a query target has no fields that directly correspond to it, give the calculation logic and the fields that the calculation query target depends on.

[0144] Condition fields: List the field names corresponding to each query condition, including the table name. If a query condition has multiple fields that meet the condition, list all the fields that meet the condition. If a query target does not have a field directly corresponding to it, give the calculation logic and the fields that the calculation query target depends on.

[0145] Data table to be queried: Based on the above information, the data table to be queried corresponding to the query requirement description information entered by the user is given.

[0146] When the CoT method is used online to determine the reasoning process of the target language model, a CoT example corresponding to the query requirement description information in the aforementioned step 201 can be obtained. The CoT example can be used to describe the reasoning process of the target language model inferring the association relationship between the output query requirement and the data table from the input query requirement.

[0147] In some embodiments, the similarity between the query requirement description information in step 201 and the query requirement examples in the CoT example library may be calculated, wherein the query requirement examples in the CoT example library are query requirements included in each CoT example in the CoT example library.

[0148] Optionally, the query requirement description information in step 201 and the query requirement examples in the CoT example library may be vectorized respectively to obtain a first vector corresponding to the query requirement description information in step 201 and a second vector corresponding to the query requirement examples in the CoT example library. For the specific implementation of vectorizing the query requirement description information in step 201 and the query requirement examples in the CoT example library respectively, please refer to the aforementioned content of vectorizing the answer to the question generated by the target language model and the answer to the question in the test question and answer pair sample respectively, which will not be repeated here.

[0149] Further, the distance between the first vector and the second vector may be calculated as the similarity between the query requirement description information and the query requirement examples in the CoT example library in step 201. The greater the distance between the first vector and the second vector, the lower the similarity between the query requirement description information and the query requirement examples in the CoT example library in step 201. Optionally, the distance between the first vector and the second vector may be cosine distance, Euclidean distance, Mahalanobis distance, Mahalanobis distance, or Hamming distance, but is not limited thereto.

[0150] After determining the similarity between the query requirement description information in step 201 and the query requirement examples in the CoT example library, a CoT example corresponding to the query requirement example whose similarity satisfies the set similarity condition may be selected from the CoT example library as the CoT example corresponding to the query requirement description information in step 201. If there are multiple CoT examples corresponding to the query requirement example whose similarity satisfies the set similarity condition, a CoT example with the greatest similarity is selected from the multiple CoT examples whose similarity satisfies the set similarity condition as the CoT example corresponding to the query requirement description information in step 201.

[0151] For an embodiment in which the vector distance is used to characterize the similarity between the query requirement description information and the query requirement examples in the CoT example library, the similarity condition may include: the distance between the first vector corresponding to the query requirement description information and the second vector corresponding to the query requirement examples in the CoT example library is less than or equal to a set distance threshold. Accordingly, from the CoT example library, a CoT example corresponding to the query requirement example whose distance between the second vector and the first vector is less than or equal to the set distance threshold is selected as the CoT example corresponding to the query requirement description information in step 201.

[0152] After determining the CoT example corresponding to the query requirement description information in step 201, when determining the association relationship between the query requirement description information and the data table using the target language model in step 202, the CoT example corresponding to the query requirement description information and the query requirement description information can be input into the target language model together. Further, the target language model can be used to generate the association relationship between the query requirement description information and the data table according to the reasoning process described by the CoT example corresponding to the query requirement description information, and the reasoning process of the target language model inferring the association relationship between the query requirement description information and the data table from the query requirement description information.

[0153] Further, in step 203, the data table to be queried corresponding to the query requirement description information can be determined from the data source according to the association relationship between the query requirement description information and the data table. In this embodiment, the data table to be queried corresponding to the query requirement description information and the reasoning process of the target language model inferring the association relationship between the query requirement description information and the data table from the query requirement description information can also be output. For example, the data table to be queried corresponding to the query requirement description information and the reasoning process of the target language model inferring the association relationship between the query requirement description information and the data table from the query requirement description information are displayed. In this way, the user can intuitively know the reasoning process of the target language model. If the data table corresponding to the determined query requirement description information is incorrect, the cause can be traced back according to the above reasoning process, and then samples for fine-tuning the language model can be added in a targeted manner.

[0154] In an embodiment of the present application, in addition to providing a language model for determining the association between query requirements and data tables, a language model for converting query requirements into query statements supported by a data source is also provided. For ease of description and distinction, the language model is referred to as a query statement generation model. Among them, the language model for determining the association between query requirements and data tables, combined with the query statement generation model, can convert the input query requirement description information into a query statement supported by the data source, such as an SQL statement, to achieve end-to-end output of query requirement text to query statements. The following is an exemplary description of the fine-tuning process of the query statement generation model and the query statement generation process.

[0155] Figure 3 Schematic diagram of another model fine-tuning method provided in an embodiment of the present application. The model fine-tuning method is mainly used to fine-tune the query statement generation model. Figure 3 As shown in Figure 2, the model fine-tuning method mainly includes:

[0156] 301. Obtain a query statement sample corresponding to a second query requirement sample and a second thinking chain example corresponding to the second query requirement sample.

[0157] 302. Utilize the target language model to generate the association relationship between the second query requirement sample and the data table according to the reasoning process described in the second thinking chain example, and generate the second reasoning process in which the target language model infers the association relationship between the second query requirement sample and the data table from the second query requirement sample.

[0158] 303. According to the association relationship between the second query requirement sample and the data table, determine from the data source the second data table to be queried corresponding to the second query requirement sample.

[0159] 304. Using the second data table, the second reasoning process and the query statement sample as training samples, fine-tune the pre-trained query statement generation model to obtain a target query statement generation model.

[0160] The following first explains and defines some concepts involved in the embodiments of the present application. Figure 1The query requirement sample used in the fine-tuning method of the target language model shown (i.e., the query requirement sample in the aforementioned step 101) is defined as the first query requirement sample; the query requirement sample used in the fine-tuning process of the query statement generation model in this embodiment (i.e., the query requirement sample in step 301) is defined as the second query requirement sample. The second query requirement sample may be the same query requirement sample as the first query requirement sample, or may be a different query requirement sample. Optionally, the second query requirement sample may be part or all of the first query requirement sample; or, the first query requirement sample may be part or all of the second query requirement sample, and so on.

[0161] Further, the above Figure 2 The CoT example corresponding to the query requirement description information used in the embodiment of the data query method shown is defined as the first CoT example; accordingly, the reasoning process of the target language model generated by the aforementioned target language model according to the reasoning process described in the first CoT example to infer the association relationship between the query requirement description information and the data table from the query requirement description information is defined as the first reasoning process. Accordingly, the CoT example corresponding to the second query requirement sample in this embodiment is defined as the second CoT example. Among them, the number of second CoT examples is the same as the number of second query requirement samples. The reasoning process of the association relationship between the second query requirement sample and the data table inferred from the second query requirement sample generated in step 302 of this embodiment is defined as the second reasoning process.

[0162] In step 301 of this embodiment, the second query requirement sample may be historical query requirement description information of the data source, or may be manually constructed query requirement description information. The query statement sample corresponding to the second query requirement sample may be a query statement pre-written by a technician based on the second query requirement sample, such as an SQL statement, or a query statement generated based on historical query requirement description information using other NL2SQL models.

[0163] Obtaining the second CoT example corresponding to the second query requirement sample in step 301 can be implemented as follows: calculating the similarity between the second query requirement sample and the query requirement examples in the CoT example library; and selecting, from the CoT example library, a CoT example corresponding to the query requirement example whose similarity satisfies the set similarity condition as the second CoT example. Among them, regarding the specific implementation of calculating the similarity between the second query requirement sample and the query requirement examples in the CoT example library, and selecting, from the CoT example library, a CoT example corresponding to the query requirement example whose similarity satisfies the set similarity condition, can be found in the aforementioned embodiment, the relevant contents of calculating the similarity between the query requirement description information and the query requirement examples in the CoT example library, and selecting, from the CoT example library, the first CoT example corresponding to the query requirement description information, which will not be repeated here.

[0164] Further, in step 302, the second query requirement sample and its corresponding second CoT example can be input into the target language model; and the target language model can be used to generate the association relationship between the second query requirement sample and the data table according to the reasoning process described by the second thinking chain example, and the target language model can generate the second reasoning process of inferring the association relationship between the second query requirement sample and the data table from the second query requirement sample.

[0165] In step 303, the data table to be queried corresponding to the second query requirement sample (defined as the second data table) can be determined from the data source according to the association relationship between the second query requirement sample and the data table. Among them, the data table to be queried corresponding to the query requirement description information determined in step 203 of the aforementioned embodiment is defined as the first data table.

[0166] Further, in step 304, the second data table, the second reasoning process of the target language model inferring the association relationship between the second query requirement sample and the data table from the second query requirement sample, and the query statement sample can be used as training samples to fine-tune the pre-trained query statement generation model to obtain the target query statement generation model.

[0167] In this embodiment, in the stage of fine-tuning the query statement generation model, the second data table, the second reasoning process of the above-mentioned target language model to infer the association relationship between the second query requirement sample and the data table from the second query requirement sample, and the query statement sample are used as training samples. The loss function can be minimized as the training goal, the second data table and the second reasoning process are used as model inputs, and the query statement sample corresponding to the second query requirement sample is used as the actual result corresponding to the model input. The pre-trained query statement generation model is fine-tuned to obtain the target query statement generation model provided in this embodiment. Among them, the loss function can be determined by the difference between the query statement output by the query statement generation model in the model fine-tuning stage and the query statement sample corresponding to the above-mentioned second query requirement sample.

[0168] The difference between the query statement output by the query statement generation model and the query statement sample corresponding to the second query requirement sample can be expressed as: the cross entropy between the query statement output by the model prediction and the query statement sample; or the distance between the query statement output by the model prediction and the query statement sample, such as the Euclidean distance or the cosine distance, etc. Or, the mean square error between the query statement output by the model prediction and the query statement sample, etc.

[0169] In this embodiment, the CoT example gives the knowledge required for the query statement generation process. Therefore, in the stage of fine-tuning the query statement generation model, the second reasoning process of using the standard language model to infer the association relationship between the second query requirement sample and the data table from the second query requirement sample can enable the query statement generation model to learn the knowledge required for the query statement generation process, which helps to improve the accuracy of query statement generation.

[0170] It is worth noting that the pre-trained query sentence generation model can also be implemented as a language model, which can be the same language model as the pre-trained language model provided in the above embodiment, or a different language model can be used. For the implementation form of the language model, please refer to the relevant content of the above embodiment, which will not be repeated here.

[0171] In an embodiment of the present application, the target language model that determines the association between the query requirement and the data table can also be combined with the target query statement generation model to form a complete NL2SQL model, which can convert the input query requirement description information into a query statement supported by the data source, such as an SQL statement, to achieve end-to-end output of the query requirement text to the query statement. The following is an exemplary description of the data query process of the data source using the target language model combined with the target query statement generation model.

[0172] Figure 4 FIG. 1 is a flow chart of another data query method provided in an embodiment of the present application. Figure 4As shown, the method mainly includes:

[0173] 401. Obtain second query requirement description information and a third thinking chain example corresponding to the second query requirement description information.

[0174] 402. Utilize the target language model to generate the association relationship between the second query requirement description information and the data table according to the reasoning process described in the third thinking chain example, and generate the third reasoning process in which the target language model infers the association relationship between the second query requirement description information and the data table from the second query requirement description information.

[0175] 403. According to the association relationship between the second query requirement description information and the data table, determine from the data source a third data table to be queried corresponding to the second query requirement description information.

[0176] 404. Generate a query statement corresponding to the second query requirement description information by using the target query statement generation model according to the third data table and the third reasoning process.

[0177] In the embodiments of the present application, for the convenience of description and distinction, the aforementioned Figure 2 The query requirement description information obtained in step 201 is defined as the first query requirement description information; the query requirement description information obtained in step 401 is defined as the second query requirement description information. The second query requirement description information and the first query requirement description information may be the same query requirement description information or different query requirement description information.

[0178] Accordingly, the CoT example corresponding to the second query requirement description information is defined as the third CoT example. For the specific implementation of obtaining the third CoT example corresponding to the second query requirement description information, please refer to the relevant content of obtaining the first CoT example corresponding to the query requirement description information (i.e., the first query requirement description information) in step 201 in the aforementioned embodiment, which will not be repeated here.

[0179] In this embodiment, the query statement generation model learns the knowledge required for the query statement generation process, and when the query statement generation model is used online, the CoT example provides the knowledge required for the query statement generation process, which helps to improve the accuracy of query statement generation.

[0180] Similarly, the rendering method provided in the embodiment of the present application can be deployed on any computing device. Optionally, the rendering method provided in the embodiment of the present application can also be deployed on a cloud server as a software as a service (SaaS) application. For a cloud server deployed with the SaaS application, each step in the aforementioned model fine-tuning method and / or data query method can be executed in response to a request to call the target service.

[0181] In this embodiment, the target service refers to a service that provides a model fine-tuning method and / or a data query method. The processing resources corresponding to the target service refer to the processing resources required to execute the above rendering method, including but not limited to: processor resources, memory resources, and input / output (IO) resources.

[0182] The model fine-tuning method and / or data query method provided in this embodiment can be deployed on a cloud server to provide users with the model fine-tuning method and / or data query method, i.e., the target service. Optionally, the cloud server may provide an application programming interface (API) to the user. The service requester (i.e., the user) may call the API to call the target service. Accordingly, the request to call the target service is implemented as a call event generated by calling the API. The service requester (i.e., the user) may also call the target service through remote procedure call (RPC) or remote direct memory access (RDMA) technology.

[0183] For the cloud server, in response to the request to call the target service, the processing resources corresponding to the target service can be determined; and the processing resources corresponding to the target service can be used to execute each step in the model fine-tuning method and / or the data query method. For the description of each step in the model fine-tuning method and the data query method, please refer to the relevant content of the aforementioned embodiment, which will not be repeated here.

[0184] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 401 and 402 can be device A; for another example, the execution subject of step 401 can be device A, and the execution subject of step 402 can be device B; and so on.

[0185] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the sequence numbers of the operations, such as 401, 402, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.

[0186] Accordingly, an embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned model fine-tuning method and / or data query method.

[0187] Figure 5 This is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. Figure 5 As shown, the computing device includes: a memory 50a and a processor 50b. The memory 50a is used to store computer programs.

[0188] The processor 50b is coupled to the memory 50a, and is used to execute the computer program to execute the steps in the model fine-tuning method and / or data query method provided in the above embodiments. The specific implementation of the model fine-tuning method and the data query method steps can be found in the relevant description of the above embodiments, which will not be repeated here.

[0189] In some optional embodiments, such as Figure 5 As shown, the computing device may also include optional components such as a communication component 50c, a power component 50d, a display component 50e and an audio component 50f. Figure 5 The components are shown schematically only and do not necessarily include Figure 5 The components shown do not necessarily mean that the computing device can only include Figure 5 Components shown.

[0190] in addition, Figure 5 The components in the dashed box are optional components, not mandatory components, and may depend on the product form of the computing device. The computing device of this embodiment may be implemented as a terminal device such as a desktop computer, a laptop computer, a mobile phone, or an IoT device; or it may be various server devices such as a traditional server, a cloud server, or a server cluster.

[0191] In an embodiment of the present application, the memory is used to store a computer program and can be configured to store various other data to support operations on the device where it is located. Among them, the processor can execute the computer program stored in the memory to implement the corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random-Access Memory, SRAM), electrically erasable programmable read only memory (Electrically Erasable Programmable Read Only Memory, EEPROM), erasable programmable read only memory (Electrical Programmable Read Only Memory, EPROM), programmable read only memory (Programmable Read Only Memory, PROM), read only memory (Read Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0192] In the embodiment of the present application, the processor can be any hardware processing device that can execute the logic of the above method. Optionally, the processor can be a central processing unit (CPU), a graphics processing unit (GPU) or a microcontroller unit (MCU); it can also be a field programmable gate array (FPGA), a programmable array logic device (PAL), a general array logic device (GAL), a complex programmable logic device (CPLD) and other programmable devices; or an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (SoC), etc., but not limited to this.

[0193] In an embodiment of the present application, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology or other technologies.

[0194] In an embodiment of the present application, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0195] In an embodiment of the present application, a power supply component is configured to provide power to various components of the device in which it is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component is located.

[0196] In an embodiment of the present application, the audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (Microphone, MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal. For example, for a device with a language interaction function, voice interaction with a user can be achieved through an audio component.

[0197] It should be noted that the descriptions such as “first” and “second” in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit “first” and “second” to different types.

[0198] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical storage, etc.) that contain computer-usable program code.

[0199] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0200] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0201] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0202] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.

[0203] Memory may include non-permanent storage in a computer-readable medium, random-access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0204] The storage medium of a computer is a readable storage medium, which may also be referred to as a readable medium. The readable storage medium includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be a computer-readable instruction, a data structure, a module of a program, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

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

[0206] The above contents are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A model fine-tuning method, It is characterized in that include Acquire concept information of the target domain, operation statement information of a data table in a data source, and a first query requirement sample for the data source; The target domain is the domain to which the data stored in the data table belongs; Based on the concept information of the target domain, the operation statement information and the first query requirement sample, construct a target sample for inferring the association between the query requirement for the data source and the data table; The pre-trained language model is fine-tuned using the target sample to obtain a target language model for querying the data source.

2. The method according to claim 1, It is characterized in that The constructing a target sample for inferring the association between the query demand for the data source and the data table based on the concept information of the target domain, the operation statement information and the first query demand sample includes: Based on the concept information of the target domain, the operation statement information and the first query requirement sample, construct a target question for asking information required to infer the association between the query requirement and the data table; Determining answer information of the target question; Based on the target question and the answer information of the target question, a target question-answer pair sample is determined as the target sample.

3. The method according to claim 2, It is characterized in that The step of constructing a target question for asking information required for inferring the association between the query demand for the data source and the data table based on the concept information of the target domain, the operation statement information and the first query demand sample includes: Based on the concept information of the target domain, construct a first question for asking about the relationship between different concept information; Based on the operation statement information, construct a second question for asking about the association between the concept information and the table structure information of the data table and a third question for asking about the association between different table structure information; Based on the first query requirement sample and the data in the data table, construct a fourth question for asking about the association between the query condition included in the first query requirement sample and the concept information, and a fifth question for asking about the association between the query condition and the data in the data table; The first question, the second question, the third question, the fourth question pair and the fifth question are taken as the target questions.

4. The method according to claim 3, It is characterized in that The step of constructing a first question for asking about the relationship between different conceptual information based on the conceptual information of the target domain includes: Acquire different concept information from the concept information of the target domain; According to a preset first question template, a first question for asking about the relationship between the different concept information is constructed; the first question template is a question template for asking about the relationship between the concept information.

5. The method according to claim 3, It is characterized in that Based on the operation statement information, constructing a second question for asking about the association between the concept information and the table structure information of the data table, including: Based on the operation statement information, determining the table structure information; According to a pre-set second question template, a second question for asking about the relationship between the concept information and the table structure information, and a third question for asking about the relationship between the different table structure information are constructed; the second question template includes: a question template for asking about the relationship between the concept information and the table structure information and a question template for asking about the relationship between different table structure information.

6. The method according to claim 5, It is characterized in that The second question for asking about the association between the concept information and the table structure information is constructed according to a preset second question template, including: According to the question template for asking about the association between the concept information and the table structure information, questions for asking about the direct association between the concept information and the table structure information and questions for asking about the association process of different concept information in the data table are constructed; The question for inquiring about the association between the concept information and the table structure information and the question for inquiring about the association process of different concept information in the data table are used as the second question.

7. The method according to claim 3, It is characterized in that The target question includes the third question; and the step of determining the answer information to the target question includes: Parsing the operation statement information to obtain the association relationship between the different table structure information; The answer information of the third question is selected from the association relationship between the different table structure information.

8. The method according to claim 2, It is characterized in that The step of determining the answer information to the target question includes: Generate answer information of the target question using the pre-trained language model; The step of determining a target question-answer pair sample based on the target question and the answer information of the target question includes: Outputting the target question and the answer information of the target question so as to adjust the answer information of the target question based on the target question; Obtaining adjusted answer information corresponding to the target question; The target question and the adjusted answer information corresponding to the target question are used as the target question-answer pair sample.

9. The method according to claim 8, It is characterized in that The target question includes a second question; and using the pre-trained language model to generate answer information for the target question includes: Inputting the second question and the operation statement information into the pre-trained language model; The pre-trained language model is used to generate answer information for the second question and the operation statement information as answer information for the second question.

10. The method according to any one of claims 2 to 9, It is characterized in that The method of fine-tuning the pre-trained language model by using the target question-answer sample pair to obtain a target language model for querying the data source includes: In the process of fine-tuning the pre-trained language model, adding background knowledge corpus of the target domain to the questions of the target question-answer pair samples; The pre-trained language model is fine-tuned using the target question-answer sample pairs added with the background knowledge corpus to obtain a target language model for querying the data source.

11. The method according to claim 10, It is characterized in that In the process of fine-tuning the pre-trained language model, adding background knowledge corpus of the target domain to the questions of the target question-answer pair samples includes: In the initial stage of fine-tuning the pre-trained language model, background knowledge corpus related to the question of the target question-answer pair sample is added to the question of the target question-answer pair sample; As the time for fine-tuning the pre-trained language model increases, background knowledge corpus is gradually randomly added to the questions of the target question-answer pair samples; wherein, the longer the time for fine-tuning the pre-trained language model is, the greater the proportion of questions with randomly added background knowledge corpus; Alternatively, as the time for fine-tuning the pre-trained language model increases, the number of questions in the background knowledge corpus of the target domain related to the question is gradually reduced; wherein, the longer the time for fine-tuning the pre-trained language model, the smaller the number of questions in the background knowledge corpus of the target domain related to the question is added.

12. The method according to any one of claims 1 to 9, It is characterized in that Also includes: Obtaining first query requirement description information for the data source; Determine the association relationship between the first query requirement description information and the data table by using the target language model; According to the association relationship between the first query requirement description information and the data table, a first data table to be queried corresponding to the first query requirement description information is determined from the data source.

13. The method according to claim 12, It is characterized in that Also includes: Obtaining a first thought chain example corresponding to the first query requirement description information; the first thought chain example is used to describe the reasoning process of the target language model inferring the association relationship between the output query requirement and the data table from the input query requirement; The determining the association relationship between the first query requirement description information and the data table by using the target language model includes: Inputting the first thought chain example and the first query requirement description information into the target language model; The target language model is used to generate the association relationship between the first query requirement description information and the data table according to the reasoning process described in the first thinking chain example, and the target language model uses the first reasoning process to infer the association relationship between the first query requirement description information and the data table from the first query requirement description information.

14. The method according to claim 13, It is characterized in that The example of obtaining the first thought chain corresponding to the first query requirement description information includes: Calculating the similarity between the first query requirement description information and the query requirement examples in the thinking chain example library; A thinking chain example corresponding to a query requirement example whose similarity satisfies a set similarity condition is selected from the thinking chain example library as the first thinking chain example.

15. The method according to claim 14, It is characterized in that Also includes: Obtaining a preset thought chain example template of the target language model; The target language model is used to adopt a generative knowledge prompting method to generate a thinking chain example in the thinking chain example library according to the thinking chain example template.

16. The method according to claim 13, It is characterized in that Also includes: Obtaining a query sentence sample corresponding to a second query requirement sample and a second thinking chain example corresponding to the second query requirement sample; Using the target language model according to the reasoning process described in the second thought chain example, an association relationship between the second query requirement sample and the data table is generated, and a second reasoning process in which the target language model infers the association relationship between the second query requirement sample and the data table from the second query requirement sample; According to the association relationship between the second query requirement sample and the data table, determining from the data source a second data table to be queried corresponding to the second query requirement sample; The second data table, the second reasoning process and the query statement sample are used as training samples to fine-tune the pre-trained query statement generation model to obtain the target query statement generation model.

17. The method according to claim 16, It is characterized in that Also includes: Obtaining second query requirement description information and a third thinking chain example corresponding to the second query requirement description information; Using the target language model according to the reasoning process described by the third thought chain example, generate the association relationship between the second query requirement description information and the data table and the third reasoning process in which the target language model infers the association relationship between the second query requirement description information and the data table from the second query requirement description information; According to the association relationship between the second query requirement description information and the data table, determining from the data source a third data table to be queried corresponding to the second query requirement description information; The target query statement generation model is used to generate a query statement corresponding to the second query requirement description information according to the third data table and the third reasoning process.

18. A data query method, It is characterized in that include: Get query requirement description information; Using the target language model, generating an association relationship between the query requirement description information and the data table; The target language model is obtained by fine-tuning a pre-trained language model using the method described in any one of claims 1 to 17; According to the association relationship between the second query requirement description information and the data table, the data table to be queried corresponding to the query requirement description information is determined from the data source.

19. The method according to claim 18, It is characterized in that Also includes: Obtaining a thought chain example corresponding to the query requirement description information; the thought chain example is used to describe the reasoning process of the target language model inferring the association relationship between the output query requirement and the data table from the input query requirement; The generating the association relationship between the query requirement description information and the data table by using the target language model includes: Inputting the thought chain example and the query requirement description information into the target language model; Using the target language model to generate the association relationship between the query requirement description information and the data table according to the reasoning process described in the thought chain example, and the first reasoning process in which the target language model infers the association relationship between the query requirement description information and the data table from the query requirement description information; The method further comprises: Inputting the data table to be queried and the first reasoning process into a target query statement generation model; A target query statement generation model is used to generate a query statement corresponding to the query requirement description information according to the data table to be queried and the first reasoning process.

20. A computing device, It is characterized in that include: A memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and configured to execute the computer program for performing the steps of the method according to any one of claims 1 to 19.

21. A computer-readable storage medium storing computer instructions, It is characterized in that When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the method according to any one of claims 1 to 19.