Database question and answer model training method and device, storage medium, and computer device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-23
- Publication Date
- 2026-08-11
AI Technical Summary
[0017] By employing the above technical solutions, this application provides a database question-answering model training method, apparatus, storage medium, and computer equipment. It associates qualified structured query language statements, qualified execution result answers, and qualified natural language questions to generate labeled training data; it also collects simulated derivative questions that may be posed by the database to obtain unlabeled training data. Based on the GRPO reinforcement learning framework, and using the scoring reward function provided by the dual-tower model as a foundation, it trains the scoring reward function using labeled training data and performs supervised fine-tuning training on the database question-answering model. Furthermore, it combines unlabeled training data, format rewards, executable rewards, and the scoring reward function to continue training the supervised fine-tuned database question-answering model. Preliminary training with a small amount of labeled data, followed by subsequent training with unlabeled training data, can stimulate the model's reasoning ability, reduce labeling costs, and improve training efficiency.
Smart Images

Figure CN120822571B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a database question-answering model training method and apparatus, storage medium, and computer equipment. Background Technology
[0002] With the rapid development of Natural Language Processing (NLP) technology, Text-to-SQL tasks (transforming natural language problems into structured query language tasks) have become an important bridge connecting non-technical users and databases.
[0003] Traditional methods rely on rule generation, matching key information from user questions and applying a fixed format to generate SQL (Structured Query Language) statements. With the introduction of deep learning methods, the approach is typically based on a seq2seq (Sequence-to-Sequence) generative model. This model relies on supervised learning and adjusts weights by training on a large amount of labeled (natural language, SQL) paired data to achieve a one-step transformation. Summary of the Invention
[0004] In view of this, this application provides a database question answering model training method and apparatus, storage medium, and computer equipment, which can complete the entire training process without the need for a large amount of labeled test2sql data, but only by collecting a small amount of high-quality labeled data and then using a large amount of unlabeled training data. This can stimulate the model's reasoning ability and reduce labeling costs. At the same time, through the design of the reward function, the model is guided to generate SQL queries through reasoning, without being limited to any database structure, thereby enhancing the model's generalization performance.
[0005] According to one aspect of this application, a database question-answering model training method is provided, the method comprising:
[0006] Collect natural language questions raised by users to the database, wherein the database corresponds to a database executor;
[0007] The natural language question is converted into a structured query language statement, and the qualified structured query language statement that meets the preset execution criteria, the qualified execution result obtained after the qualified structured query language statement is executed by the database executor, and the qualified natural language question corresponding to the qualified structured query language statement are associated to generate training labeled data.
[0008] Collect simulated derivative questions that may be proposed for the database, and use the simulated derivative questions as unlabeled training data, wherein the simulated derivative questions are in natural language form;
[0009] Based on the GRPO reinforcement learning framework, and using the scoring reward function provided by the dual-tower model as a foundation, the scoring reward function is trained using labeled training data, and the database question answering model is further trained under supervised conditions using the labeled training data. The supervised fine-tuning training of the database question answering model is then further trained by combining unlabeled training data, format rewards, executable rewards, and the scoring reward corresponding to the scoring reward function. The database question answering model is built upon a neural network. After training, the database question answering model takes a natural language question posed by a user as input, outputs a structured query language statement, and the output structured query language statement is executed by the database executor to obtain the execution result and return it to the user.
[0010] According to another aspect of this application, a database question-answering model training apparatus is provided, the apparatus comprising:
[0011] The natural language question collection module is used to collect natural language questions raised by users in relation to the database, wherein the database corresponds to a database executor;
[0012] The training annotation data generation module is used to convert the natural language question into a structured query language statement, and associate the qualified structured query language statement that meets the preset execution standard, the qualified execution result obtained after the qualified structured query language statement is executed by the database executor, and the qualified natural language question corresponding to the qualified structured query language statement to generate training annotation data.
[0013] The training unlabeled data generation module is used to collect simulated derivative questions that may be proposed for the database, and use the simulated derivative questions as training unlabeled data, wherein the simulated derivative questions are in natural language form;
[0014] The database question-answering model training module is used based on the GRPO reinforcement learning framework. It uses the scoring reward function provided by the dual-tower model as a foundation, trains the scoring reward function using labeled training data, and performs supervised fine-tuning training of the database question-answering model using the labeled training data. It then combines unlabeled training data, format rewards, executable rewards, and the scoring reward corresponding to the scoring reward function to further train the supervised fine-tuned database question-answering model. The database question-answering model is built based on a neural network. After training, the database question-answering model takes a natural language question posed by a user as input and outputs a structured query language statement. The output structured query language statement is executed by the database executor to obtain the execution result and return it to the user.
[0015] According to another aspect of this application, a storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the above-described database question-answering model training method.
[0016] According to another aspect of this application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the above-described database question-answering model training method.
[0017] By employing the above technical solutions, this application provides a database question-answering model training method, apparatus, storage medium, and computer equipment. It associates qualified structured query language statements, qualified execution result answers, and qualified natural language questions to generate labeled training data; it also collects simulated derivative questions that may be posed by the database to obtain unlabeled training data. Based on the GRPO reinforcement learning framework, and using the scoring reward function provided by the dual-tower model as a foundation, it trains the scoring reward function using labeled training data and performs supervised fine-tuning training on the database question-answering model. Furthermore, it combines unlabeled training data, format rewards, executable rewards, and the scoring reward function to continue training the supervised fine-tuned database question-answering model. Preliminary training with a small amount of labeled data, followed by subsequent training with unlabeled training data, can stimulate the model's reasoning ability, reduce labeling costs, and improve training efficiency.
[0018] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0020] Figure 1 A schematic flowchart of a database question-answering model training method provided in an embodiment of this application is shown;
[0021] Figure 2 A flowchart illustrating a method for generating labeled training data according to an embodiment of this application is shown.
[0022] Figure 3 A flowchart illustrating another method for generating labeled training data provided in an embodiment of this application is shown.
[0023] Figure 4 A schematic diagram of a database question-answering model training device provided in an embodiment of this application is shown. Detailed Implementation
[0024] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0025] This embodiment provides a database question-answering model training method, such as... Figure 1 As shown, the method includes:
[0026] Step 101: Collect natural language questions raised by users to the database, wherein the database corresponds to a database executor.
[0027] Step 102: Convert the natural language question into a structured query language statement, and associate the qualified structured query language statement that meets the preset execution criteria, the qualified execution result obtained after the qualified structured query language statement is executed by the database executor, and the qualified natural language question corresponding to the qualified structured query language statement to generate training labeled data.
[0028] Currently, mainstream training methods for database question-answering models still require extensive manual annotation and are highly dependent on the database structure. Furthermore, because text2sql tasks involve two dimensions of semantic transformation, they place high demands on model performance without reinforcement learning; models with a small number of parameters generally cannot handle this. The fatal flaw of traditional methods is their extremely poor generalization ability. Whether based on rule matching or seq2seq model training, they are heavily dependent on the table structure. Once the table structure changes or is migrated to tables in other industries, rules need to be rewritten or the model retrained. In addition, these methods rely on supervised learning, requiring a large amount of labeled (natural language, SQL) pairing data. However, in real-world scenarios, high annotation costs, dynamically changing data distribution, and insufficient generalization ability for complex queries limit model performance. Moreover, supervised learning models are prone to overfitting the training data and struggle to handle diverse expressions or implicit logic in user questions. Therefore, reinforcement learning (RL) offers a new approach to solving these problems.
[0029] Reinforcement learning (RL) is an important branch of machine learning. Its core idea is that a model learns the optimal policy through interaction with its environment to maximize cumulative rewards. Unlike supervised and unsupervised learning, reinforcement learning emphasizes learning through trial and error in dynamic environments, possessing unique theoretical and applied value. Its core elements are as follows:
[0030] Intelligent agent: A decision-making entity that learns and interacts with the environment through actions.
[0031] Environment: The external world in which the agent exists, which provides feedback to the action.
[0032] State: A description of the current state of the environment.
[0033] Action: The behavior that an intelligent agent can perform.
[0034] Reward: The immediate feedback signal from the environment to an action.
[0035] Policy: The rules governing the mapping of an agent's states to its actions (such as deterministic or stochastic policies).
[0036] Value function: evaluates the long-term expected return (such as Q value, V value) of a state or action.
[0037] Environment Model (optional): A function that predicts environmental state transitions and rewards;
[0038] Reinforcement learning, by designing reasonable reward functions, enables trained models to self-optimize in interactions with virtual environments, thereby reducing dependence on labeled data and enhancing robustness.
[0039] However, traditional RL algorithms (such as PPO) still face challenges in Text-to-SQL tasks, for example:
[0040] 1. Sparse reward problem: The correctness of the generated SQL usually needs to be verified after execution, but in a real environment, frequent execution of SQL may bring security risks or computational overhead;
[0041] 2. Complex search space: The strict SQL syntax structure means that generating incorrect actions (such as syntax errors) may lead to invalid explorations;
[0042] 3. Low training efficiency: RL requires a lot of trial and error, while Text-to-SQL tasks need to handle the generation of long sequences, which increases the training cost.
[0043] Therefore, in the above embodiments of this application, GRPO (Generalized Reinforcement Learning with Policy Optimization) can be introduced. This efficient reinforcement learning framework aims to improve training stability and sample efficiency through policy constraint optimization and dynamic reward shaping. The core idea of GRPO is to avoid policy collapse by constraining the magnitude of policy updates, while combining it with the prior knowledge of imitation learning pre-training to accelerate model convergence. It can better handle the ambiguity of user intent and gradually correct the model output by utilizing interactive feedback in the synthetic environment. Ultimately, it realizes a strong inference model based on the GRPO reinforcement learning framework and using a small amount of labeled data to complete the Text-to-SQL task.
[0044] Furthermore, the GRPO reinforcement learning framework, proposed by the DeepSeek team, is a reinforcement learning algorithm for large-scale language models (LLMs) that aims to address the limitations of traditional methods (such as PPO) in terms of training efficiency, stability, and computational resource consumption. Specifically, it optimizes the learning process by comparing the relative performance of different policies or actions within the same group, rather than relying on traditional critic models to evaluate the value of each action. Its core idea is to allow the agent to update its policy by comparing multiple candidate actions generated by other agents or itself, utilizing the relative differences in group scores, thereby reducing computational costs and improving training efficiency. In training database question-answering models, the GRPO framework can combine the scoring reward function provided by the dual-tower model with other reward functions (such as format rewards and executable rewards) to guide the model's learning direction. Simultaneously, the GRPO framework can utilize labeled data to train the model, including natural language questions, corresponding SQL query statements, and execution results, providing the model with rich learning resources.
[0045] Furthermore, GRPO's core innovation lies in replacing the traditional value network (Critic Model) with comparisons of actions within groups. Specifically, it samples multiple actions (groups) for each input state and calculates an advantage function based on the relative rewards of actions within groups, rather than relying on a separate value network. For example, in mathematical reasoning tasks, the model generates multiple candidate answers, quantifying the relative advantage of each answer through within-group normalization (such as mean and standard deviation). In addition, it can dynamically adjust the threshold (τ) of the gradient norm, introducing a gradient regularization term into the loss function. When the gradient norm exceeds the threshold, a penalty is imposed to avoid gradient explosion and reduce excessive constraints on policy updates. This mechanism significantly improves training stability. Additionally, it incorporates KL divergence constraints during policy updates to limit the differences between old and new policies, preventing drastic changes in policy distribution and further ensuring training stability.
[0046] Specifically, the goal of the Text-to-SQL task is to automatically convert user queries in natural language (such as "find the product with the highest sales volume") into Structured Query Language (SQL) statements to retrieve accurate data from the database. SQL (Structured Query Language) is a standard programming language used to manage and manipulate relational databases. SQL queries are used to retrieve, insert, update, or delete data from the database. The core flow of the Text-to-SQL task is as follows:
[0047] 1. User queries (natural language), such as "Query the product with the highest sales volume in the past month".
[0048] 2. Convert to SQL query;
[0049] 3. Execute SQL queries, for example, the database returns results based on the SQL statement (such as "Product A, sales revenue of 10,000 yuan").
[0050] 4. Return the results to the user, for example, "The product with the highest sales in the past month was product A, with sales of 10,000 yuan."
[0051] Therefore, the Text-to-SQL task enables ordinary users to query databases without learning SQL syntax. At the same time, the automated conversion reduces the time and errors of manually writing SQL, and also supports complex queries such as multi-table joins and aggregate functions. By combining natural language with database operations, it provides a convenient way for non-technical personnel to query data.
[0052] Specifically, the first step is to collect natural language questions raised by users regarding the database, i.e., to complete a small amount of high-quality data collection. For example, user questions and developer answers can be collected from historical information in the production environment, but not specific SQL queries. For instance, the customer service department of a financial enterprise usually records various questions raised by customers through telephone, online chat, etc., as well as the responses from customer service personnel. This is an important source of user questions related to the database. In addition, in the internal operating system of financial business, employees may communicate and exchange messages about certain business issues (such as database queries). For example, business personnel consult technical personnel about data information. At the same time, during the development of financial projects or business optimization, team members will also discuss issues on the platform, which may include user questions about data requirements and developer responses.
[0053] Next, by using keywords related to financial data, such as "account balance," "transaction records," "customer information," "risk assessment," and "investment returns," relevant records can be quickly located in historical information.
[0054] In particular, a time range can be set according to business needs, such as collecting data from the most recent six months or one year, to ensure that the data is timely and has reference value.
[0055] Next, using data extraction tools or writing scripts, user questions (natural language questions) and developer responses that meet the filtering criteria are extracted from various systems.
[0056] Next, the extracted data can be manually reviewed to remove irrelevant information (such as system failure reports, non-business communication content, etc.) to ensure that the collected data are valid questions and answers to the financial database.
[0057] Next, by identifying qualified structured query language statements that meet preset execution criteria and explicitly associating them with "qualified natural language question — qualified structured query language statement — qualified execution result answer," the database question-answering model can learn the complete mapping relationship from user intent to database operation during training. This associative data provides clear input-output pairs for supervised learning, enabling the database question-answering model to more accurately understand the semantic correspondence between natural language and SQL, reducing ambiguity during training, thereby accelerating the convergence of the database question-answering model and improving conversion accuracy.
[0058] Traditional annotation requires manual SQL writing and result verification, which is costly and error-prone. The embodiments described in this application, however, directly obtain real user questions and developer answers from historical production environment information, and then associate them with execution results to automatically generate some annotation data. For example, user queries about account balances can be extracted from customer service records, associated with the actual SQL executed by the system and its return results, forming a "user question - standard SQL - execution result" triple. This reduces the workload of manual annotation while ensuring data consistency with real business scenarios.
[0059] Optionally, such as Figure 2 As shown, in step 102, the step of "associating the qualified structured query language statement that meets the preset execution criteria, the qualified execution result obtained after the qualified structured query language statement is executed by the database executor, and the qualified natural language question corresponding to the qualified structured query language statement to generate training labeled data" specifically includes:
[0060] Step 1021: Collect the historical real answers corresponding to the natural language question.
[0061] Step 1022: The structured query language statement is sent to the database executor. When the sent structured query language statement can be executed by the database executor, the execution result is obtained based on the execution result of the executable structured query language statement after it is executed by the database executor.
[0062] Step 1023: Compare the vector similarity between the execution result answer and the historical real answer, and determine the qualified execution result answer that meets the preset vector similarity comparison rules.
[0063] Step 1024: Associate the achievement execution result answer, the achievement structured query language statement corresponding to the achievement execution result answer, and the achievement natural language question to generate training labeled data.
[0064] In the above embodiments of this application, such as Figure 3As shown, during data collection, the Deepseek-R1 model can first be used to initially label the natural language questions posed by users (such as "query the cumulative returns of a client's high-risk funds over the past year"), generating initial SQL. This process is based on the Deepseek-R1 model's understanding of financial terms (such as "high-risk funds" and "cumulative returns") and database structure.
[0065] Next, the generated SQL is sent to the database executor. If the statement is executable (e.g., the syntax is correct and the table joins are valid), it is executed and the execution result is obtained, generating an answer (e.g., specific profit figures and transaction records).
[0066] If the SQL statement fails to execute (e.g., due to incorrect field names or misuse of aggregate functions), the Deepseek-R1 model analyzes the error (e.g., checking for missing JOIN conditions or misuse of WHERE clauses) and regenerates the corrected SQL statement. For example, if a user's question involves multiple table joins, the model might fail because it doesn't correctly join the "Fund Information Table" and "Transaction Record Table," requiring adjustments to the JOIN logic.
[0067] For complex errors that the Deepseek-R1 model cannot automatically correct (such as business rule conflicts), manual intervention is required for correction. For example, if the SQL query violates financial compliance requirements (such as failing to filter sensitive customer data), the query conditions need to be manually adjusted.
[0068] Next, the execution result (e.g., "cumulative return is 15%)) is compared with historical real responses (e.g., profit reports manually calculated by business personnel) using vector similarity. If the similarity is below a threshold (e.g., semantically significantly different), it indicates that the SQL may not accurately reflect the user's intent (e.g., dividend reinvestment was not considered).
[0069] Next, the Deepseek-R1 model checks again whether the SQL matches the financial semantics of the user's query. For example, when a user queries "risk assessment," the model might mistakenly query the "customer asset table" while ignoring the "risk assessment record table," requiring a re-association of the correct table and adjustment of the WHERE clause.
[0070] The validated SQL statements (compliant Structured Query Language statements), execution result answers (compliant execution result answers), and original questions (compliant Natural Language questions) are linked together to form labeled training data.
[0071] Step 103: Collect simulated derivative questions that may be proposed for the database, and use the simulated derivative questions as unlabeled training data, wherein the simulated derivative questions are in natural language form.
[0072] In the embodiments described above, by simulating derived questions, a large number of diverse natural language queries can be generated, covering various database query scenarios (such as single-table queries, multi-table joins, conditional filtering, aggregation calculations, etc.). This data can be used as unlabeled training data for pre-training or semi-supervised learning without requiring manual annotation of the SQL or execution results, thus increasing the amount of training data. For example, in the financial field, simulated questions such as "Query the returns of all high-risk financial products of a customer over the past year" can be generated, covering multiple asset classes such as funds, stocks, and bonds. This allows the model to learn a wider range of financial query patterns, reduces dependence on specific table structures, and improves generalization ability.
[0073] Optionally, the database corresponds to database structure information, specifically including the following in step 103: "Collecting possible simulation-derived questions about the database".
[0074] Step 1031: By parsing the open-source dataset corresponding to the open-source database, obtain the simulated derivative questions that may be raised for the database. The open-source dataset includes the database structure information of the open-source database and the natural language questions raised for the open-source database.
[0075] Step 1032, and / or using the text generation capability of the deep learning model, automatically generate simulated derivative questions that conform to the semantics of the database based on the database structure information, wherein the database structure information includes at least one of table name, field name and data relationship, and the types of simulated derivative questions include at least one of single table query, multi-table join query and conditional filtering.
[0076] In the above embodiments of this application, collecting simulation-derived questions that may arise regarding the database can be achieved through the following approaches:
[0077] Extracting questions using open-source resources: Specifically, readily available data can be obtained from community-shared open-source datasets. For example, publicly available text2sql datasets typically contain database structure information (such as table names, field names, data relationships, etc.) and corresponding natural language questions. By parsing such datasets, natural language questions related to a specific database can be directly extracted, serving as a source for simulating derived questions.
[0078] And / or automatically generate questions based on the database structure. Specifically, for the database, automated tools can be used to generate simulated questions. For example, leveraging the text generation capabilities of deep learning models (such as deepseek-R1), questions conforming to the database's semantics can be automatically generated based on the database's structural information (such as table structure, field types, and relationships). These generated questions need to cover all dimensions of the database, including single-table queries, multi-table join queries, and conditional filtering, to ensure the diversity and comprehensiveness of the questions. The generated questions need to be filtered and cleaned to remove duplicate, invalid, or semantically ambiguous questions, ultimately forming a high-quality set of simulated derived questions.
[0079] Step 104: Based on the GRPO reinforcement learning framework, using the scoring reward function provided by the dual-tower model as a foundation, the scoring reward function is trained using labeled training data, and the database question answering model is also trained using labeled training data under supervision. The supervised fine-tuning training of the database question answering model is further trained by combining unlabeled training data, format rewards, executable rewards, and the scoring reward corresponding to the scoring reward function. The database question answering model is built based on a neural network. After training, the database question answering model takes a natural language question posed by the user as input and outputs a structured query language statement. The output structured query language statement is executed by the database executor to obtain the execution result, which is then returned to the user.
[0080] In the above embodiments of this application, after preliminary data preparation, a small amount of high-quality labeled data (e.g., approximately 1.8k) is obtained. Then, a dual-tower model is trained as part of the reward function. Its input consists of the user's question (the original question) and the execution result of the structured query language statement output by the database question-answering model. At the end of the dual-tower model, the matching score of the low-dimensional dense vectors (embeddings) of the two tower codes is calculated using methods such as dot product and cosine similarity. If the final execution result returned to the user perfectly matches the user's question, a high score is awarded. The role of the dual-tower model is to serve as a scoring reward function, providing a positive reward based on a high-quality answer that matches the user's question, guiding the training model to converge in this direction.
[0081] The formal training of the model (database question answering model) then begins. First, 1-2 rounds of SFT (supervised fine-tuning) are performed as a cold start step, allowing the model to learn to think about and generate SQL output patterns. Subsequently, based on a large amount of collected unlabeled training data, two additional reward functions are constructed besides the scoring reward: a format reward and an executable reward. These are used to guide the model to converge towards the "think-SQL" format and output executable SQL statements. Finally, GRPO reinforcement learning training is completed.
[0082] Specifically, the Dual-Tower Model is a deep learning architecture widely used in recommender systems, natural language processing (NLP), and search. Its core idea is to use two independent neural networks ("dual towers") to encode features of different modalities or entities, and then achieve matching or ranking tasks through similarity calculation. The model is trained by optimizing the similarity between a user and positive samples while reducing the similarity with negative samples. The loss functions used in the above embodiments of this application may include cross-entropy loss (Softmax with Negative Sampling), Triplet Loss, and contrastive learning loss (such as InfoNCE).
[0083] Optionally, the dual-tower model includes a first encoding tower and a second encoding tower. Specifically, for step 104, "training the scoring reward function using labeled training data," the following is included:
[0084] Step 1041: When training the scoring reward function using the labeled training data, the first encoding tower is used to encode the target natural language question to obtain a low-dimensional dense vector of the question, and the second encoding tower is used to encode the target execution result answer to obtain a low-dimensional dense vector of the answer.
[0085] Step 1042: Calculate the matching degree between the low-dimensional dense vector of the question and the low-dimensional dense vector of the answer, and obtain the matching degree score based on the matching degree calculation result.
[0086] Step 1043: Construct a loss function that aims to obtain a high matching score for correct question-answer pairs and a low matching score for incorrect question-answer pairs, and incorporate the matching score into the calculation of the loss function so that the dual-tower model can adjust its parameters according to the calculated matching score. The question-answer pair includes a qualified natural language question and the qualified execution result answer corresponding to the qualified natural language question.
[0087] In the above embodiments of this application, during the training of the scoring reward function using labeled training data, a specific natural language question is asked, such as "What is the cumulative return of all financial products of a certain customer over the past year?"
[0088] At this point, the first coding tower performs semantic encoding on the question, generating a low-dimensional dense vector of the question. The low-dimensional dense vector of the question needs to capture financial terms (such as "wealth management products" and "cumulative returns"), time range ("past year"), and user intent (querying returns).
[0089] Next, the corresponding execution result answer is input (e.g., "The customer's cumulative return is 15%, mainly from high-risk fund A and bond B"). The second encoding tower encodes the answer to generate a low-dimensional dense vector of the answer. The low-dimensional dense vector of the answer must contain key financial information (such as rate of return, product name, risk level) and the answer structure (numerical value + explanation).
[0090] Next, the cosine similarity or dot product between the question vector and the answer vector is calculated to measure the degree of semantic matching. For example, if the question focuses on "cumulative returns" and the answer includes a specific value (15%) and product breakdown (fund A, bond B), the matching degree should be high; if the answer deviates from the topic (such as only returning the account balance), the matching degree is low.
[0091] The matching score of the output can be set between 0 and 1, such as 0.85 for a correct answer and 0.20 for an incorrect answer.
[0092] Next, a loss function is constructed, with the goal of maximizing the matching score of correct question-answer pairs and minimizing the score of incorrect question-answer pairs. The loss function is as follows:
[0093]
[0094] Where τ represents the loss function, s i Let y be the score for the matching degree of the i-th question and answer pair. i ∈{0,1} represents the label (1 indicates correct, 0 indicates incorrect), and N represents the total number of question-answer pairs.
[0095] During model training, backpropagation is used to adjust the parameters of the dual-tower model, making the vectors of correct question-answer pairs closer together and incorrect pairs further apart. Specifically, when a user wants to inquire about fund returns, a natural language question might be posed, such as "How has the fund I bought performed in the last three months?" A correct answer would be, "This fund's return over the past three months was 8.5%, outperforming the peer average of 6.2%, mainly benefiting from the rise in technology stocks." An incorrect answer would be, "Your account balance is 100,000 yuan." (Off-topic). Therefore, the model can learn through a loss function that correct answers must include the return rate, benchmark, and attribution analysis, while incorrect answers are penalized with lower scores for not mentioning the keywords "return rate" or "fund."
[0096] In summary, ensuring that the answer directly matches the user's intent (e.g., distinguishing between "profit inquiry" and "balance inquiry") can improve query relevance. Furthermore, combining the dual-tower model with a scoring reward function can shift the focus from simply "being able to answer" to providing "accurate answers," particularly when handling complex financial queries (such as comparing the returns of multiple products or risk assessments), thereby enhancing user experience and trust.
[0097] Optionally, step 104, "supervised fine-tuning of the database question-answering model using labeled training data," specifically includes:
[0098] Step 1044: For the qualified natural language questions in the labeled training data, obtain the output structured query language statement of the database question answering model for the qualified natural language questions.
[0099] Step 1045: By minimizing the difference between the output structured query language statement and the qualified structured query language statement corresponding to the qualified natural language question, update the parameters of the database question answering model until the database question answering model forms an input-output pattern that transforms the natural language question into a structured query language statement.
[0100] In the above embodiments of this application, for the qualified natural language question in the training labeled data, the output structured query language statement of the database question answering model for the aforementioned qualified natural language question is obtained. The data in the training labeled data includes triples:
[0101] Standardized natural language questions: such as "Query the cumulative returns of a client's high-risk funds over the past year".
[0102] Meets the standards for Structured Query Language statements;
[0103] The answer to the target implementation result is: "The client's cumulative return is 15%, mainly from Fund A".
[0104] Next, supervised fine-tuning training is performed. A qualifying natural language question (e.g., "The returns of a client's high-risk funds over the past year") is input, and the expected output is set, i.e., the corresponding qualifying structured query language statement (e.g., the SELECT statement mentioned above). The specific training process is as follows:
[0105] 1. Forward propagation: The model encodes the input problem and generates the prediction SQL.
[0106] 2. Loss Calculation: Compare the differences between the predicted SQL and the expected SQL (such as field names and conditional logic). Cross-entropy loss or tree structure loss (for SQL syntax trees) are commonly used.
[0107] 3. Backpropagation: Update model parameters (such as attention weights in Transformer) to narrow the gap between prediction and expectation.
[0108] 4. Iterative optimization: Repeat training until the model can stably generate correct SQL (e.g., the accuracy of the validation set is >95% for 5 consecutive epochs).
[0109] Simultaneously, it can also perform multi-table join learning. For example, the training data needs to cover multi-table queries (such as joining customer tables, fund tables, and transaction tables). The model needs to learn to generate JOIN statements, as well as aggregate functions and conditional logic, such as distinguishing between "cumulative return" (SUM) and "average return" (AVG), and processing conditions such as "risk level = 'high'".
[0110] In addition, compliance constraints can be imposed, such as adding regular expressions to the loss function to avoid generating SQL that violates financial regulations (such as queries for customer IDs that have not been anonymized).
[0111] Optionally, regarding step 104, "combining unlabeled training data and formatted rewards to continue training the supervised fine-tuned database question-answering model," specifically includes:
[0112] Step 1046: Input the simulated derived questions from the unlabeled training data into the database question answering model;
[0113] Step 1047: In the process of the database question answering model generating output based on the input simulated derivative question, a format reward mechanism is introduced so that the database question answering model, under the guidance of the format reward mechanism, first outputs the thinking process for the simulated derivative question, and generates a structured query language statement based on the thinking process. The thinking process includes at least one of the extraction of key information of the simulated derivative question and semantic understanding.
[0114] In the embodiments described above in this application, simulated derived questions from unlabeled training data are input into the database question-answering model. Examples of simulated derived questions include:
[0115] Simulated derivative problem 1: "Query the trend of a company's debt-to-asset ratio over the past three years."
[0116] Simulated derivative problem 2: "Statistically analyze the interest rate distribution of all outstanding loans of a certain customer."
[0117] The above questions are generated based on financial business logic and do not require manual annotation of SQL or execution results, but they cover core scenarios such as financial statement analysis and customer credit management.
[0118] Next, irrelevant symbols or redundant information (such as colloquial expressions like "Please help me check") can be removed, and financial terms (such as "debt-to-equity ratio" and "outstanding loans") can be mapped to representations that the model can understand (such as word vectors or sub-word units).
[0119] In the process of generating SQL from the model, a formatting reward mechanism is introduced to encourage the model to output its thought process first, and then generate the structured query language statement. The specific process is as follows:
[0120] 1. Generation of the thought process:
[0121] Key information extraction: The model identifies key information in the problem (such as the time range "past three years" and the indicator "asset-liability ratio").
[0122] Semantic understanding: The model's intention to interpret the problem (such as analyzing trends or statistical distributions).
[0123] Example output:
[0124] Thought process:
[0125] 1. Extraction time range: 2021-2023;
[0126] 2. Key performance indicator: Debt-to-asset ratio;
[0127] 3. Understand the intention: Analyze the changing trend.
[0128] Next, combining the reward rules implemented through a formatted reward mechanism, the database question-answering model generates SQL based on the thought process, for example:
[0129] A high reward will be given if the thought process is complete and accurate (such as correctly extracting the time range and indicators).
[0130] If the SQL statement conforms to the thought process (such as GROUP BY and ORDER BY being consistent with the thought process), an extra reward will be given.
[0131] Next, the loss function is adjusted by adding a formatted reward term to the existing supervised fine-tuning loss function.
[0132] Therefore, by combining training with unlabeled data and a formatted reward mechanism, the practicality of database question-answering models can be improved, enabling the models to not only generate accurate SQL, but also demonstrate reasoning logic through the thought process.
[0133] Optionally, step 104, "combining unlabeled training data and executable rewards to continue training the supervised fine-tuned database question-answering model," specifically includes:
[0134] Step 1048: Input the simulated derived questions from the unlabeled training data into the database question answering model.
[0135] Step 1049: In the process of the database question answering model generating output based on the input simulated derivative questions, an executable reward mechanism is introduced so that the database question answering model can generate executable structured query language statements for the simulated derivative questions under the guidance of the executable reward mechanism.
[0136] In the above embodiments of this application, simulated derived questions from unlabeled training data are input into the database question-answering model. Then, colloquial expressions or irrelevant information (such as "Could you please look this up for me?") are removed. During the model's SQL generation process, an executable reward mechanism is introduced to encourage the model to generate SQL statements that can actually be executed in the database, specifically including:
[0137] 1. SQL syntax check:
[0138] The SQL generated by the model must conform to the syntax rules of the database (such as MySQL, Oracle, etc.). For example, avoid using functions or reserved words that the database does not support.
[0139] 2. Existence verification of tables and fields:
[0140] Ensure that the tables (such as credit_card_records, loan_applications) and fields (such as overdue_count, approval_status) referenced in the SQL actually exist in the database.
[0141] 3. Reasonableness of execution results:
[0142] The generated SQL should be able to return reasonable results (such as the number of overdue days being a non-negative integer, and the approval rate being a floating-point number between 0 and 1).
[0143] An executable reward mechanism can be implemented by setting reward rules, specifically:
[0144] If the SQL syntax is correct, a basic reward will be given.
[0145] If the table and fields referenced by the SQL statement exist, an additional reward will be given.
[0146] If the execution result conforms to the business logic (such as the number of overdue payments being an integer), a higher reward will be given.
[0147] Next, the loss function is adjusted, that is, an executable reward term is added to the original supervised fine-tuning loss function.
[0148] Finally, the process of the model outputting SQL is as follows:
[0149] 1. Problem Understanding: The model first analyzes the input simulation-derived problem and extracts key information (such as time range, indicators, and conditions).
[0150] 2. SQL Generation: The model generates SQL based on an executable reward mechanism, for example:
[0151] Therefore, by employing an executable reward mechanism, the SQL generated by the model is more likely to execute successfully in the database, reducing manual debugging costs. Combining training with unlabeled data and an executable reward mechanism significantly improves the practicality of the database question-answering model. The model not only generates syntactically correct SQL but also ensures that the SQL is actually executable in the database, meeting the stringent requirements of the financial industry for accuracy, operability, and compliance. This approach is particularly suitable for data-sensitive scenarios in the financial sector where labeling costs are high, achieving efficient and low-cost model optimization through an executable reward mechanism.
[0152] By applying the technical solution of this embodiment, since it is to complete a single task, the model selection does not require too many parameters. Experiments have shown that, for example, a model with a size of 7B or less can achieve the effect of a large-scale general-purpose model, which can reduce the training and deployment costs for developers.
[0153] Furthermore, as Figure 1 To specifically implement the method, this application provides a database question-answering model training device, such as... Figure 4 As shown, the device includes:
[0154] Natural language question collection module 201 is used to collect natural language questions raised by users in relation to a database, wherein the database corresponds to a database executor;
[0155] The training annotation data generation module 202 is used to convert the natural language question into a structured query language statement, and associate the qualified structured query language statement that meets the preset execution standard, the qualified execution result obtained after the qualified structured query language statement is executed by the database executor, and the qualified natural language question corresponding to the qualified structured query language statement to generate training annotation data.
[0156] The training unlabeled data generation module 203 is used to collect simulated derivative questions that may be proposed for the database, and use the simulated derivative questions as training unlabeled data, wherein the simulated derivative questions are in natural language form;
[0157] The database question-answering model training module 204 is used to train the scoring reward function based on the GRPO reinforcement learning framework and the scoring reward function provided by the dual-tower model, using labeled training data, and to perform supervised fine-tuning training of the database question-answering model using labeled training data. It further trains the supervised fine-tuned database question-answering model by combining unlabeled training data, format rewards, executable rewards, and the scoring reward corresponding to the scoring reward function. The database question-answering model is based on a neural network. After training, the database question-answering model takes a natural language question posed by a user as input, outputs a structured query language statement, and the output structured query language statement is executed by the database executor to obtain the execution result and return it to the user.
[0158] Optionally, the training labeled data generation module 202 is further configured to:
[0159] Collect historical real answers to the natural language questions;
[0160] The structured query language statement is sent to the database executor. When the structured query language statement can be executed by the database executor, the execution result is obtained based on the execution result of the executable structured query language statement after it is executed by the database executor.
[0161] Compare the vector similarity between the execution result answer and the historical real answer, and determine the qualified execution result answer that meets the preset vector similarity comparison rules;
[0162] The target execution result answer, the target execution result answer corresponding target structured query language statement and target natural language question are associated to generate training labeled data.
[0163] Optionally, the dual-tower model includes a first encoding tower and a second encoding tower, and the database question-answering model training module 204 is further used for:
[0164] When training the scoring reward function using labeled training data, the first encoding tower encodes the target natural language question to obtain a low-dimensional dense vector of the question, and the second encoding tower encodes the target execution result answer to obtain a low-dimensional dense vector of the answer.
[0165] Calculate the degree of matching between the low-dimensional dense vector of the question and the low-dimensional dense vector of the answer, and obtain a matching score based on the matching degree.
[0166] A loss function is constructed with the objective of obtaining a high matching score for correct question-answer pairs and a low matching score for incorrect question-answer pairs. The matching score is incorporated into the calculation of the loss function so that the dual-tower model can adjust its parameters according to the calculated matching score. The question-answer pairs include the qualified natural language question and the qualified execution result answer corresponding to the qualified natural language question.
[0167] Optionally, the database question-answering model training module 204 is further configured to:
[0168] For the qualified natural language questions in the labeled training data, obtain the output structured query language statements of the database question answering model for the qualified natural language questions;
[0169] By minimizing the difference between the output structured query language statement and the corresponding structured query language statement of the qualified natural language question, the parameters of the database question answering model are updated until the database question answering model forms an input-output pattern that transforms the natural language question into a structured query language statement.
[0170] Optionally, the database question-answering model training module 204 is further configured to:
[0171] Input simulated derived questions from unlabeled training data into the database question-answering model;
[0172] In the process of generating output based on the input simulated derivative question in the database question answering model, a format reward mechanism is introduced so that the database question answering model outputs the thinking process for the simulated derivative question under the guidance of the format reward mechanism, and generates a structured query language statement based on the thinking process. The thinking process includes at least one of the extraction of key information of the simulated derivative question and semantic understanding.
[0173] Optionally, the database question-answering model training module 204 is further configured to:
[0174] Input simulated derived questions from unlabeled training data into the database question-answering model;
[0175] In the process of generating output based on the input simulated derivative questions, an executable reward mechanism is introduced to enable the database question answering model to generate executable structured query language statements for the simulated derivative questions under the guidance of the executable reward mechanism.
[0176] Optionally, the database corresponds to database structure information, and the training unlabeled data generation module 203 is further used for:
[0177] By parsing the open-source dataset corresponding to the open-source database, simulated derivative questions that may be raised for the database can be obtained. The open-source dataset includes the database structure information of the open-source database and natural language questions that have been raised for the open-source database.
[0178] And / or utilize the text generation capabilities of deep learning models to automatically generate simulated derivative questions that conform to the semantics of the database based on the database structure information. The database structure information includes at least one of table names, field names, and data relationships. The types of simulated derivative questions include at least one of single-table queries, multi-table join queries, and conditional filtering.
[0179] It should be noted that other corresponding descriptions of the functional units involved in the database question-answering model training device provided in this application embodiment can be found in [reference]. Figure 1 The corresponding descriptions in the method will not be repeated here.
[0180] Based on the above, Figure 1 Accordingly, this application also provides a storage medium storing a computer program, which, when executed by a processor, implements the above-described method. Figure 1 The database question-answering model training method is shown.
[0181] Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This software product can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, or portable hard drive), and includes several instructions to cause a computer device (such as a personal computer, server, or network device) to execute the methods described in the various implementation scenarios of this application.
[0182] Based on the above, Figure 1 The method shown, and Figure 4 To achieve the above objectives, the present application also provides a computer device, specifically a personal computer, server, network device, etc., as shown in the virtual device embodiment. This computer device includes a storage medium and a processor; the storage medium stores a computer program; the processor executes the computer program to achieve the above-described objectives. Figure 1 The database question-answering model training method is shown.
[0183] Optionally, the computer device may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Bluetooth interfaces, Wi-Fi interfaces), etc.
[0184] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0185] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and stores the hardware and software resources of a computer device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software within the physical device.
[0186] Through the above description of the implementation methods, those skilled in the art can clearly understand that this application can be implemented using software plus necessary general-purpose hardware platforms, or it can be implemented using hardware to associate the qualified structured query language statements, qualified execution result answers, and qualified natural language questions to generate labeled training data; and to collect simulated derivative questions that may be raised by the database to obtain unlabeled training data. Based on the GRPO reinforcement learning framework, using the scoring reward function provided by the dual-tower model as a foundation, the scoring reward function is trained using labeled training data, and the database question answering model is subjected to supervised fine-tuning training. The supervised fine-tuned database question answering model is then further trained by combining unlabeled training data, format rewards, executable rewards, and the scoring reward function. Preliminary training with a small amount of labeled data, followed by subsequent training with unlabeled training data, can stimulate the model's reasoning ability, reduce labeling costs, and improve training efficiency.
[0187] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.
[0188] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any modifications that can be made by those skilled in the art should fall within the protection scope of this application.
Claims
1. A database question-answering model training method, characterized in that, The method includes: Collect natural language questions raised by users to the database, wherein the database corresponds to a database executor; The natural language question is converted into a structured query language statement, and the historical real answers corresponding to the natural language question are collected; The structured query language statement is sent to the database executor. When the structured query language statement can be executed by the database executor, the execution result is obtained based on the execution result of the executable structured query language statement after it is executed by the database executor. Compare the vector similarity between the execution result answer and the historical real answer, and determine the qualified execution result answer that meets the preset vector similarity comparison rules; The achievement execution result answer, the achievement structured query language statement corresponding to the achievement execution result answer, and the achievement natural language question are associated to generate training labeled data; Collect simulated derivative questions that may be proposed for the database, and use the simulated derivative questions as unlabeled training data. The simulated derivative questions are in natural language form, and the types of simulated derivative questions include at least one of single-table queries, multi-table join queries, and conditional filtering. Based on the GRPO reinforcement learning framework, and using the scoring reward function provided by the dual-tower model as a foundation, when the scoring reward function is trained using labeled training data, the dual-tower model includes a first encoding tower and a second encoding tower. The first encoding tower encodes the target natural language question to obtain a low-dimensional dense vector of the question, and the second encoding tower encodes the target execution result answer to obtain a low-dimensional dense vector of the answer. Calculate the degree of matching between the low-dimensional dense vector of the question and the low-dimensional dense vector of the answer, and obtain a matching score based on the matching degree. A loss function is constructed with the goal of obtaining a high matching score for correct question-answer pairs and a low matching score for incorrect question-answer pairs. The matching score is incorporated into the calculation of the loss function so that the dual-tower model can adjust its parameters according to the calculated matching score. The question-answer pairs include the qualified natural language question and the qualified execution result answer corresponding to the qualified natural language question. Input simulated derived questions from unlabeled training data into the database question-answering model; In the process of generating output based on the input simulated derivative question, a format reward mechanism is introduced to guide the database question answering model to first output the thought process for the simulated derivative question and then generate a structured query language statement based on the thought process. The format reward mechanism is used to encourage the database question answering model to output the thought process first and then generate the structured query language statement. If the thought process is complete and accurate, a high reward is given; if the structured query language statement matches the thought process, an additional reward is given. The thought process includes at least one of the extraction of key information of the simulated derivative question and semantic understanding. Input simulated derived questions from unlabeled training data into the database question-answering model; In the process of generating output based on the input simulated derivative questions, an executable reward mechanism is introduced to enable the database question answering model to generate executable structured query language statements for the simulated derivative questions under the guidance of the executable reward mechanism. The executable reward mechanism is used to encourage the database question answering model to generate structured query language statements that can actually be executed in the database. If the structured query language statement is syntactically correct, a basic reward is given. If the table and fields referenced by the structured query language statement exist, an additional reward is given. If the execution result of the structured query language statement conforms to the business logic, a higher reward is given. The database question-answering model is based on a neural network. After training, the database question-answering model takes a natural language question from the user as input and outputs a structured query language statement. The output structured query language statement is executed by the database executor to obtain the execution result and return it to the user.
2. The method according to claim 1, characterized in that, The supervised fine-tuning training of the database question-answering model using labeled training data includes: For the qualified natural language questions in the labeled training data, obtain the output structured query language statements of the database question answering model for the qualified natural language questions; By minimizing the difference between the output structured query language statement and the corresponding structured query language statement of the qualified natural language question, the parameters of the database question answering model are updated until the database question answering model forms an input-output pattern that transforms the natural language question into a structured query language statement.
3. The method according to claim 1 or 2, wherein the database corresponds to database structure information, characterized in that, The collection of simulation-derived questions that may arise from the database includes: By parsing the open-source dataset corresponding to the open-source database, simulated derivative questions that may be raised for the database can be obtained. The open-source dataset includes the database structure information of the open-source database and natural language questions that have been raised for the open-source database. And / or utilize the text generation capabilities of deep learning models to automatically generate simulated derivative questions that conform to the semantics of the database, based on the database structure information, wherein the database structure information includes at least one of table names, field names, and data relationships.
4. A database question-answering model training device, characterized in that, The device includes: The natural language question collection module is used to collect natural language questions raised by users in relation to the database, wherein the database corresponds to a database executor; The training annotation data generation module is used to convert the natural language question into a structured query language statement and collect the historical real answers corresponding to the natural language question; send the structured query language statement into the database executor, and when the input structured query language statement can be executed by the database executor, obtain the execution result answer based on the execution result of the executable structured query language statement after being executed by the database executor; compare the vector similarity between the execution result answer and the historical real answers, and determine the qualified execution result answer that meets the preset vector similarity comparison rules; associate the qualified execution result answer, the qualified structured query language statement corresponding to the qualified execution result answer, and the qualified natural language question to generate training annotation data; The training unlabeled data generation module is used to collect simulated derivative questions that may be raised for the database, and use the simulated derivative questions as training unlabeled data. The simulated derivative questions are in natural language form, and the types of simulated derivative questions include at least one of single-table queries, multi-table join queries, and conditional filtering. The database question-answering model training module is used based on the GRPO reinforcement learning framework and the scoring reward function provided by the dual-tower model. When training the scoring reward function using labeled training data, the dual-tower model includes a first encoding tower and a second encoding tower. The first encoding tower encodes the target natural language question to obtain a low-dimensional dense vector of the question, and the second encoding tower encodes the target execution result answer to obtain a low-dimensional dense vector of the answer. The matching degree between the low-dimensional dense vectors of the question and the low-dimensional dense vectors of the answer is calculated, and a matching degree score is obtained based on the matching degree. A high matching degree score is obtained for correct question-answer pairs, and a low matching degree score is obtained for incorrect question-answer pairs. A loss function is used to obtain a low matching score, and the matching score is included in the calculation of the loss function so that the dual-tower model adjusts its parameters according to the calculated matching score. The question-answer pair includes a qualified natural language question and the corresponding qualified execution result answer. Simulated derivative questions from unlabeled training data are input into the database question-answering model. During the process of the database question-answering model generating output based on the input simulated derivative questions, a format reward mechanism is introduced. Guided by this mechanism, the database question-answering model first outputs its thought process for the simulated derivative questions and then generates structured query language statements based on this thought process. A formatted reward mechanism is used to encourage the database question-answering model to first output its thought process before generating a structured query language statement. A high reward is given if the thought process is complete and accurate, and an additional reward is given if the structured query language statement matches the thought process. The thought process includes at least one of extracting key information from the simulated derivative question and semantic understanding. Simulated derivative questions from unlabeled training data are input into the database question-answering model. During the process of the database question-answering model generating output based on the input simulated derivative questions, an executable reward mechanism is introduced. This mechanism guides the database question-answering model to generate an executable structured query language statement for the simulated derivative questions. The database question-answering model is based on a neural network. After training, the model takes a natural language question from the user and outputs a structured query language statement. The output structured query language statement is then executed by the database executor to obtain the answer, which is returned to the user. The executable reward mechanism encourages the database question-answering model to generate structured query language statements that can be actually executed in the database. A basic reward is given if the structured query language statement's syntax is correct; an additional reward is given if the table and fields referenced by the structured query language statement exist; and a higher reward is given if the execution result of the structured query language statement conforms to the business logic.
5. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method for training a database question-answering model according to any one of claims 1 to 3.
6. A computer device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for training a database question-answering model according to any one of claims 1 to 3.
Citation Information
Patent Citations
Automatic question-answering system based on semi-supervised learning and Text-to-SQL model
CN112287093A
End-to-end automatic driving control system and device based on human preference reinforcement learning
CN119018181A