Text-to-SQL training data synthesis methods, devices, and media for domain-specific data
By extracting local table topology subgraphs, Markov decision interactions, and inference trajectory verification, high-quality Text-to-SQL training data is generated, solving the problems of logical illusion and semantic bias in existing technologies and improving the training efficiency and generalization ability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2026-05-09
- Publication Date
- 2026-07-31
AI Technical Summary
Existing methods for synthesizing Text-to-SQL training data struggle to generate logically correct, semantically aligned, and highly natural training data when dealing with complex domain data. They suffer from logical illusions, ambiguous referencing, and semantic biases, resulting in poor model generalization ability.
By planning an agent to extract local table topology subgraphs to generate structured query intents, an SQL agent interacts with the database through Markov decision-making, a problem synthesis agent generates natural language questions, and a thought chain agent verifies the reasoning trajectory to form high-quality training data.
The generated training data is logically correct and semantically aligned, which improves the training efficiency and effectiveness of the model and significantly enhances the model's generalization ability in complex business questions.
Smart Images

Figure CN122489587A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of large language model technology, and in particular relates to a method, device, and medium for synthesizing Text-to-SQL training data for domain-specific data. Background Technology
[0002] With the rapid development of Large Language Modeling (LLM) technology, the "Text-to-SQL" task has been widely applied in academia and industry. Building high-performance Text-to-SQL models heavily relies on the quality of fine-tuning the training data, which places extremely high demands on the data in core dimensions such as semantic alignment, naturalness of expression, and logical complexity. To meet these data requirements, the field currently relies heavily on automated data synthesis techniques.
[0003] The closest existing technologies generally employ a SQL-centric, linear, open-loop generation paradigm. This approach typically maintains structural isolation, executing SQL synthesis and natural language question generation as independent modules sequentially: first, a large language model is used to directly generate structured SQL query statements based solely on database table and column names; then, back-translation technology is used to transform the generated SQL statements into corresponding natural language questions.
[0004] However, when faced with complex domain data scenarios, the aforementioned existing generation paradigms struggle to generate high-quality, deep reasoning data that simultaneously satisfies logical correctness, semantic alignment, and linguistic naturalness, specifically exhibiting the following prominent technical shortcomings: 1. Existing SQL synthesis methods mostly adopt an end-to-end single-mapping paradigm when synthesizing SQL, which severely lacks interactive awareness of the actual data distribution in the underlying database and feedback from the execution environment. Due to the lack of dynamic verification at the execution level, the generated SQL is often only compliant in code form, but it is very easy to mislead the model to establish incorrect mapping biases in specific function usage and schema mapping, resulting in a large number of logical illusion samples.
[0005] 2. Existing technologies directly translate underlying SQL logic into equivalent or reverse-translated natural language questions, resulting in overly structured and formulaic question expressions. This shallow interaction mapping causes the synthetic data to lose the ambiguous references and implicit intentions commonly found in real-world questions. This directly leads the model to tend to learn simple keyword matching mechanisms during training, resulting in extremely poor generalization and comprehension capabilities when faced with complex business questions that possess genuine ambiguity.
[0006] 3. In the existing linear pipeline framework, the SQL synthesis and question generation stages are completely decoupled, lacking a unified mechanism to jointly review the semantic alignment between the two (Joint quality control). This structural isolation makes it difficult for existing Chain-of-Thought (CoT) synthesis to effectively cover complex logical samples, and the reasoning path of the synthesis is very likely to deviate from the underlying physical logic of the target SQL, thus introducing serious training noise into the fine-tuning of the Text-to-SQL model. Summary of the Invention
[0007] To address the shortcomings of existing technologies, embodiments of the present invention provide a method, device, and medium for synthesizing Text-to-SQL training data for domain-specific data.
[0008] In a first aspect, embodiments of the present invention provide a method for synthesizing Text-to-SQL training data for domain-specific data, the method comprising: Based on the planning agent, local table topology subgraphs and their corresponding sub-patterns are extracted from the domain database according to foreign key constraints, thereby generating structured query intents; Based on the SQL intelligent agent, several rounds of Markov decision interaction are performed with the domain database according to the structured query intent to obtain effective SQL query statements; Based on the problem-synthesizing agent, domain evidence is extracted from valid SQL query statements, and natural language questions are generated using the domain evidence as a priori conditions. The ThinkChain agent responds to natural language questions and domain evidence, generating several reasoning trajectories; each reasoning trajectory is verified to obtain the ThinkChain. Natural language problems, domain evidence, valid SQL queries, and thought chains are used as Text-to-SQL training data.
[0009] In a second aspect, embodiments of the present invention provide an electronic device, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the above-described Text-to-SQL training data synthesis method for domain-oriented data.
[0010] Thirdly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described Text-to-SQL training data synthesis method for domain-oriented data.
[0011] Fourthly, embodiments of the present invention provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the above-described Text-to-SQL training data synthesis method for domain-oriented data.
[0012] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention provides a Text-to-SQL training data synthesis method for domain-specific data. First, a planning agent extracts local table topology subgraphs and sub-patterns based on foreign key constraints to generate structured query intents, effectively filtering out structural interference caused by the massive global database pattern.
[0013] Secondly, this invention breaks through the limitations of traditional one-way, static generation by having an SQL agent interact with the domain database through several rounds of Markov decision-making based on structured query intent. Through feedback from a real execution environment, invalid data that is grammatically compliant but cannot be executed or is logically distorted is eliminated at the source, ensuring that the final SQL query statement has real physical validity.
[0014] Furthermore, this invention extracts domain evidence from valid SQL query statements through a question synthesis agent and uses it as a priori conditions to generate natural language questions. This step severs the direct binding between the underlying syntax and surface vocabulary, making the generated questions closer to the fuzzy expressions and implicit intentions in real-world scenarios, thereby improving the authenticity of the training data and the anti-interference ability of the downstream model.
[0015] Finally, this invention generates multiple inference trajectories for natural language problems and domain evidence through the thinking chain agent, and verifies each trajectory, eliminating the semantic deviation between natural language problems and SQL. This results in the final generated natural language problems, domain evidence, valid SQL query statements, and thinking chain quadruples having extremely high data quality, which can significantly improve the efficiency and effectiveness of Text-to-SQL fine-tuning training. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A schematic diagram illustrating a Text-to-SQL training data synthesis method for domain-oriented data provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] It should be noted that, unless otherwise specified, the features in the following embodiments and implementation methods can be combined with each other.
[0020] like Figure 1 As shown, this embodiment of the invention provides a method for synthesizing Text-to-SQL training data for domain-specific data, the method comprising: Step S1: Based on the planning agent, extract the local table topology subgraph and its corresponding sub-pattern from the domain database according to the foreign key constraint relationship, thereby generating a structured query intent.
[0021] Specifically, step S1 includes: Obtaining domain database Where T represents the collection of all data tables in the database, C represents all columns contained in the data table, and K represents foreign key relationships between data tables.
[0022] Based on a planning agent, a topology-aware planning strategy is employed to extract local table topology subgraphs from the domain database according to foreign key constraints K. and its corresponding sub-patterns ; Setting up a reference example ; Responding to subpatterns and reference examples Planning intelligent agents to generate structured query intents The expression is as follows: In the formula, This refers to the planning intelligent agent.
[0023] For example, this embodiment uses a "bank credit database" as an example to detail the complete execution process of the Text-to-SQL training data synthesis method. In step S1, the planning agent obtains a local table topology subgraph and its sub-schemas of the domain database, which includes a "Customers table" (with fields: Customer ID cid, Name, Credit Score) and a "Loans table" (with fields: Loan ID lid, Customer ID cid, Loan Status). A reference example of the settings is provided. This includes few-sample hints from QA regarding prior knowledge, such as: "Input: Count the number of Gold members with overdue payment records last year; Output: Structured query intent: Query the total number of unique customers with Gold membership and overdue payment records in 2025." Responding to sub-patterns and reference examples. The planning agent generates the initial structured query intent. "Total number of unique customers with a credit score of 700 or higher and a loan status of bad debt (bad_debt)." Step S2: Based on the SQL agent, several rounds of Markov decision interaction are performed with the domain database according to the structured query intent to obtain an effective SQL query statement.
[0024] Specifically, an action space is set up, which includes: a data probing action (DataProfiler) for probing the data distribution in the domain database, an execution retrieval action (SQLExecutor) for executing SQL statements in a real environment, and a commit action (Terminate) for submitting the final SQL statement. At any time step t in the Markov decision interaction process, the SQL agent executes an action. The state transition depends on the structured query intent, the sub-pattern corresponding to the local table topology subgraph, and the historical observation trajectory, thereby generating an action trajectory consisting of actions and observation results at several time steps. This allows us to obtain a valid SQL query statement.
[0025] In the formula, This represents the action at time step T. The observation results obtained at time step T Indicates historical observation trajectory, This represents an SQL intelligent agent.
[0026] In this example, the observation results include: successful execution returning data, query results being an empty set, or an error being reported.
[0027] Furthermore, step S2 also includes: Set a failure count threshold. ; When the number of times the observation result is an empty set or an error occurs exceeds the failure threshold. At that time, the erroneous observation results and the corresponding actions will be combined to form a feedback signal. ; Responding to structured query intent and feedback signals The planning agent generates updated structured query intents, expressed as follows: In the formula, Indicates the intent to update the structured query. This refers to the planning intelligent agent.
[0028] The above feedback loop continues until a real, valid SQL query is generated or the maximum number of iterations is reached. .
[0029] It should be noted that this example, by introducing an action space and a bidirectional correction loop, overcomes the limitations of static, feedback-free, and blind generation in existing technologies. It uses the actual execution results from the physical domain database (such as error messages or empty set feedback) as feedback signals to dynamically drive the state transitions of the SQL agent and the correction of the structured query intent of the planning agent. This step effectively eliminates semantically spurious samples that are grammatically compliant but logically distorted from the source, completely eradicating the common execution-level logical illusion problem in large language models when generating SQL.
[0030] For example, in step S2, based on the above-described structured query intent The SQL agent and the database engage in Markov decision-making interaction. First, the SQL agent executes the execution retrieval action (SQLExecutor), running the initially generated SQL statement in a real environment: SELECT COUNT(DISTINCT T1.cid) FROM Customers AS T1 JOIN LoansAS T2 ON T1.cid = T2.cid WHERE T1.credit_score >= 700 AND T2.status = 'bad_debt'.
[0031] Since the status value does not exist in the database, the observation result returns "query result is empty set". After the failure threshold is triggered, the SQL agent calls the DataProfiler action to probe the "status" column of the "Loans" table and finds that its actual enumeration value distribution is ['paid', 'default', 'active'].
[0032] Subsequently, the above observation results and exploration results are packaged into a feedback signal F and sent back to the planning agent: "Execution returns an empty set. Upon exploration, the valid values of the status field are ['paid', 'default', 'active'], and there is no field 'bad_debt' to represent bad debt. Please correct the intent." In response to the feedback signal F, the planning agent generates an updated structured query intent. "Total number of unique customers with a credit score of 700 or higher and a loan status of default." The SQL agent adjusts the structured query intent based on the updated query intent. Execute the submit action to obtain the final valid SQL query statement. The query `SELECT COUNT(DISTINCT T1.cid) FROM Customers AS T1 JOIN Loans AS T2ON T1.cid = T2.cid WHERE T1.credit_score >= 700 AND T2.status = 'default'` was successfully executed in the database, yielding a true value (e.g., 42 people).
[0033] Step S3: Based on the problem-synthesizing agent, extract domain evidence from valid SQL query statements, and use the domain evidence as a priori conditions to generate natural language questions.
[0034] Specifically, the problem-based synthetic agent employs an evidence-first abstraction strategy to extract semantic abstraction from valid SQL query statements. Extracting domain evidence Using domain evidence as a priori condition, generate natural language problems .
[0035] Natural language questions, domain evidence, valid SQL queries, and structured query intents are used as candidate samples, which are then reviewed by a planning agent; the expression is as follows: In the formula, This refers to the planning intelligent agent.
[0036] If the planning agent determines that a candidate sample is unqualified, it optimizes and reconstructs the natural language problem and domain evidence until it outputs a target natural language problem that is aligned with the domain evidence.
[0037] It's worth noting that, addressing the issue of formulaic question expression caused by direct reverse translation in existing methods, this example employs an evidence-first semantic abstraction strategy, enabling the model to successfully avoid rote memorization of explicit keywords. This mechanism forcibly decouples the underlying SQL syntax structure into abstract domain business logic, ensuring that the generated natural language questions contain the implicit intentions and ambiguous expressions commonly found in real-world questioning. This technique allows the model to exhibit superior robustness against synonym interference and ambiguous real-world references. Experiments demonstrate that this method delivers significant improvements on robustness test sets such as SPIDER-SYN and SPIDER-DK.
[0038] For example, in step S3, the problem-synthesizing agent selects valid SQL query statements. Extract the underlying logic and generate domain evidence. "The criteria for determining a high-quality customer are a credit score (credit_score) greater than or equal to 700; bad debt records are recorded in the database as being in default (status='default')." Based on evidence in this field As a priori condition, the problem-synthesizing agent initially generated candidate natural language questions: "How many customers have a credit score greater than or equal to 700 and are in the 'default' state?". When the planning agent reviewed these candidate samples, it found that the question directly exposed SQL fields, which did not conform to the semantically ambiguous human language habits (and therefore failed the review). Subsequently, the system was optimized and reconstructed, ultimately generating the target natural language question Q, which was highly aligned with domain evidence and concealed the underlying patterns: "Of all the high-quality customers, how many have bad debt records?" Step S4: The thinking chain agent responds to natural language questions and domain evidence, generating several reasoning trajectories; each reasoning trajectory is verified to obtain the thinking chain.
[0039] Specifically, forward simulation sampling The candidate logical reasoning trajectory is as follows: If there are more than the set quantity If the candidate logical reasoning trajectory can successfully derive a truth value consistent with a valid SQL statement, then the truth value verification path is triggered, and the most concise logical reasoning trajectory is selected as the thought chain. ; Conversely, if the number of trajectories that successfully derive the truth value is less than the set number, the self-consistent majority voting mechanism is triggered when the proportion of the largest consensus trajectory among the candidate logical reasoning trajectories exceeds the robustness threshold. If the consensus trajectory is reached, use it as the thought chain and reverse-correct valid SQL statements. Otherwise, discard the currently generated data.
[0040] It should be noted that this example combines a dual-path thought chain synthesis mechanism, including truth verification and majority voting, to establish a joint review standard across stages. This mechanism completely eliminates the semantic misalignment between natural language problems and target SQL, ensuring the ultimate logical fidelity of the inference path. Leveraging the generational advantage brought by high-quality data, this invention demonstrates extremely high synthetic data efficiency: requiring only a very small amount of synthetic data (e.g., approximately 22k samples), it can support the Qwen2.5-Coder-7B model to achieve an ultra-high execution accuracy of 61.6% on the BIRD leaderboard, significantly surpassing traditional resource-intensive baseline methods that rely on massive amounts of generated data (e.g., 2.5M samples).
[0041] In step S4, the thought chain agent responds to question Q and domain evidence. The forward simulation samples multiple candidate logical reasoning trajectories.
[0042] For example, the reasoning steps of the first candidate trajectory r1 omitted the deduplication logic (deriving the truth value as 50 people); while the second candidate trajectory r2 is: "First, filter out high-quality customers with a credit score of not less than 700 from the customer table; second, link the loan table by customer ID and filter out bad debt records with a loan status of 'default'; finally, considering that a single customer may have multiple bad debts, perform deduplication (COUNT DISTINCT) on the customer IDs that meet the conditions to obtain the final number of people." The system performs truth verification on each trajectory and finds that the second candidate trajectory r2 can successfully derive a valid SQL statement. If the results are completely consistent (42 people), then the truth value verification path is triggered, and the most concise second candidate trajectory r2 is selected as the final thought chain R.
[0043] Step S5 involves combining natural language questions, domain evidence, valid SQL queries, and thought chains. The quadruplets are used as Text-to-SQL training data; the target large language model is fine-tuned using the Text-to-SQL training data; and the database query task is executed using the fine-tuned target large language model.
[0044] In summary, this invention provides a Text-to-SQL training data synthesis method for domain-specific data. First, a planning agent extracts local table topology subgraphs and sub-patterns based on foreign key constraints to generate structured query intents, effectively filtering out structural interference caused by the massive global database pattern.
[0045] Secondly, this invention breaks through the limitations of traditional one-way, static generation by having an SQL agent interact with the domain database through several rounds of Markov decision-making based on structured query intent. Through feedback from a real execution environment, invalid data that is grammatically compliant but cannot be executed or is logically distorted is eliminated at the source, ensuring that the final SQL query statement has real physical validity.
[0046] Furthermore, this invention extracts domain evidence from valid SQL query statements through a question synthesis agent and uses it as a priori conditions to generate natural language questions. This step severs the direct binding between the underlying syntax and surface vocabulary, making the generated questions closer to the fuzzy expressions and implicit intentions in real-world scenarios, thereby improving the authenticity of the training data and the anti-interference ability of the downstream model.
[0047] Finally, this invention generates multiple inference trajectories for natural language problems and domain evidence through the thinking chain agent, and verifies each trajectory, eliminating the semantic deviation between natural language problems and SQL. This results in the final generated natural language problems, domain evidence, valid SQL query statements, and thinking chain quadruples having extremely high data quality, which can significantly improve the efficiency and effectiveness of Text-to-SQL fine-tuning training.
[0048] like Figure 2 As shown, this application provides an electronic device including a memory 101 for storing one or more programs and a processor 102. When the one or more programs are executed by the processor 102, they implement the method as described in any of the first aspects above.
[0049] The system also includes a communication interface 103. The memory 101, processor 102, and communication interface 103 are electrically connected directly or indirectly to each other to enable data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines. The memory 101 can be used to store software programs and modules, and the processor 102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 101. The communication interface 103 can be used for signaling or data communication with other node devices.
[0050] The memory 101 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0051] The processor 102 can be an integrated circuit chip with signal processing capabilities. The processor 102 can be a general-purpose processor 102, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0052] In the embodiments provided in this application, it should be understood that the disclosed methods and systems can also be implemented in other ways. The method and system embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0053] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0054] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program thereon. When executed by processor 102, the computer program implements the methods described in any of the first aspects above. If the functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0055] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only.
[0056] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A method for synthesizing Text-to-SQL training data for domain-specific data, characterized in that, The method includes: Based on the planning agent, local table topology subgraphs and their corresponding sub-patterns are extracted from the domain database according to foreign key constraints, thereby generating structured query intents; Based on the SQL intelligent agent, several rounds of Markov decision interaction are performed with the domain database according to the structured query intent to obtain effective SQL query statements; Based on the problem-synthesizing agent, domain evidence is extracted from valid SQL query statements, and natural language questions are generated using the domain evidence as a priori conditions. The ThinkChain agent responds to natural language questions and domain evidence, generating several reasoning trajectories; each reasoning trajectory is verified to obtain the ThinkChain. Natural language problems, domain evidence, valid SQL queries, and thought chains are used as Text-to-SQL training data.
2. The Text-to-SQL training data synthesis method for domain-specific data according to claim 1, characterized in that, The process by which a planning agent extracts local table topology subgraphs and their corresponding sub-patterns from a domain database based on foreign key constraints to generate structured query intent includes: Obtain the domain database; Based on the planning agent, local table topology subgraphs and their corresponding sub-patterns are extracted from the domain database according to foreign key constraints. Set up a reference example; In response to subpatterns and reference examples, the planning agent generates structured query intents.
3. The Text-to-SQL training data synthesis method for domain-specific data according to claim 1, characterized in that, The process of obtaining an effective SQL query statement by a SQL agent through several rounds of Markov decision interactions with the domain database based on structured query intent includes: The action space is set up, which includes: data exploration action for exploring the data distribution in the domain database, execution acquisition action for executing SQL statements in a real environment, and submission action for submitting the final SQL statement. At any time step t in the Markov decision interaction process, the state transition of the SQL agent's action depends on the structured query intent, the sub-pattern corresponding to the local table topology subgraph, and the historical observation trajectory, thereby generating an action trajectory composed of actions and observation results at several time steps, thus obtaining an effective SQL query statement.
4. The Text-to-SQL training data synthesis method for domain-specific data according to claim 3, characterized in that, The process of obtaining an effective SQL query statement based on a SQL agent through several rounds of Markov decision interactions with the domain database according to the structured query intent also includes: The observation results include: successful execution and data return, query results being an empty set or an error; Set a threshold for the number of failures; When the observation result is an empty set of query results or the number of errors exceeds the failure threshold, the erroneous observation results and the corresponding actions are combined into a feedback signal. In response to structured query intents and feedback signals, the planning agent generates updated structured query intents.
5. The Text-to-SQL training data synthesis method for domain-specific data according to claim 1, characterized in that, The process of generating natural language questions based on a question-based synthetic agent, which extracts domain evidence from valid SQL queries and uses this domain evidence as a priori condition, includes: Based on the problem-synthesizing agent, domain evidence is extracted from valid SQL query statements, and natural language questions are generated using the domain evidence as a priori conditions. Natural language questions, domain evidence, valid SQL query statements, and structured query intents are used as candidate samples, and the candidate samples are reviewed based on the planning agent. If the planning agent determines that a candidate sample is unqualified, it optimizes and reconstructs the natural language problem and domain evidence until it outputs a target natural language problem that is aligned with the domain evidence.
6. The Text-to-SQL training data synthesis method for domain-specific data according to claim 1, characterized in that, The ThinkChain agent responds to natural language questions and domain evidence, generating several reasoning trajectories. The process of verifying each reasoning trajectory to obtain the thought chain includes: Forward simulation sampling of multiple candidate logical reasoning trajectories; If there are more than a set number of candidate logical reasoning trajectories that can successfully derive a truth value consistent with a valid SQL statement, then the most concise logical reasoning trajectory is selected as the thought chain. Conversely, when the proportion of the largest consensus trajectory in the candidate logical reasoning trajectory exceeds the robustness threshold, the largest consensus trajectory is used as the thought chain and the valid SQL statement is corrected in reverse.
7. The Text-to-SQL training data synthesis method for domain-oriented data according to claim 1, characterized in that, The method further includes: Fine-tuning of the target large language model is performed using Text-to-SQL training data; database query tasks are then executed using the fine-tuned target large language model.
8. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more of the computer programs being executed by the at least one processor to enable the at least one processor to perform the Text-to-SQL training data synthesis method for domain-oriented data as described in any one of claims 1-7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the Text-to-SQL training data synthesis method for domain-oriented data as described in any one of claims 1-7.
10. A computer program product comprising a computer program / instructions, characterized in that, When executed by a processor, the computer program / instruction implements the Text-to-SQL training data synthesis method for domain-oriented data as described in any one of claims 1-7.