IP Library Granted Patent US 12,393,584
Granted Patent B2
US 12,393,584 · App. 18/240,835 · Granted Aug 19, 2025

Generating training data for a machine learning model that performs text-to-SQL

Inventors: Octavian Popescu (Westchester, NY); Hangu Yeo (Westchester, NY); Vadim Sheinin (Yorktown Heights, NY); Irene Lizeth Manotas Gutiérrez (White Plains, NY); Ngoc Phuoc An Vo (Bronx, NY); Elahe Khorasani (Yorktown Heights, NY)
Assignee: International Business Machines Corporation
G06F16/24544G06N20/00
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,393,584
App. No.
18/240,835
Granted
Aug 19, 2025
Kind
B2
Abstract

A set of values can be selected from a plurality of fields of a table in a database. At least one adverb or adjective can be selected for the set of values. Join paths for values in the set of values can be determined. A structured query language pattern can be determined based, at least in part, on at least one value in the set of values, the at least one adverb or adjective for the set of values, and the join paths for the set of values. The structured query language pattern can be stored to first training data configured, at least in part, for use in machine learning to train a text-to-SQL model, the text-to-SQL model comprising a first artificial neural network and configured to convert first natural language text to a first structured query language query.

Claims (101)

1. A method, comprising:

generating a first database from a second database by replacing a plurality of field names in the first database with significant names;

selecting a set of values from a plurality of fields of a table in the first database;

selecting at least one adverb or adjective for the set of values;

determining join paths for values in the set of values;

determining, using a processor, a structured query language (SQL) pattern based, at least in part, on at least one value in the set of values, the at least one adverb or adjective for the set of values, and the join paths for the set of values; and

storing the structured query language pattern to first training data configured, at least in part, for use in machine learning to train a text-to-SQL model, the text-to-SQL model comprising a first artificial neural network and configured to convert first natural language text to a first structured query language query;

selecting a second structured query language query;

identifying nouns in the second structured query language query;

inferring at least one verbal phrase for the nouns in the second structured query language query;

creating at least one natural language sentence from the at least one verbal phrase for the nouns in the second structured query language query;

creating at least one user sentence pattern from the at least one natural language sentence; and

storing the at least one user sentence pattern to the first training data,

wherein the first training data further is configured for use in machine learning to train a SQL-to-text model, the SQL-to-text model comprising a second artificial neural network and configured to convert the first structured query language query to second natural language text.

2. The method of claim 1 , further comprising:

identifying compound nouns related to the fields of the table; and

identifying logical conjunctions related to the compound nouns;

wherein determining the structured query language pattern further is based on the compound nouns and logical conjunctions related to the compound nouns.

3. The method of claim 1 , further comprising:

selecting, from a training corpus, a second database schema that includes a same type of data as a first database schema of the first database;

selecting the second structured query language query from second training data for the second database schema;

replacing, in the second structured query language query, table and field names with table and field names for the first database schema;

replacing, in the second structured query language query, second values with first values selected from the first database; and

responsive to the replacing, in the second structured query language query, the table and field names with the table and field names for the first database schema, and responsive to the replacing, in the second structured query language query, the second values with the first values selected from the first database, storing the second structured query language query to the first training data.

4. The method of claim 3 , further comprising:

executing the second structured query language query against the first database; and

determining whether the executing the second structured query language query against the first database returns an empty result;

wherein the storing the second structured query language query to the first training data further is responsive to the executing the second structured query language query against the first database not returning the empty result.

5. The method of claim 1 , further comprising: determining at least one adjective for the at least one verbal phrase; and adding the at least one adjective to the at least one verbal phrase.

6. A system, comprising:

a processor programmed to initiate executable operations comprising:

generating a first database from a second database by replacing a plurality of field names in the first database with significant names;

selecting a set of values from a plurality of fields of a table in the first database;

selecting at least one adverb or adjective for the set of values;

determining join paths for values in the set of values;

determining a structured query language (SQL) pattern based, at least in part, on at least one value in the set of values, the at least one adverb or adjective for the set of values, and the join paths for the set of values;

storing the structured query language pattern to first training data configured, at least in part, for use in machine learning to train a text-to-SQL model, the text-to-SQL model comprising a first artificial neural network and configured to convert first natural language text to a first structured query language query;

selecting, from a training corpus, a second database schema that includes a same type of data as a first database schema of the first database;

selecting a second structured query language query from second training data for the second database schema;

replacing, in the second structured query language query, table and field names with table and field names for the first database schema;

replacing, in the second structured query language query, second values with first values selected from the first database; and

responsive to the replacing, in the second structured query language query, the table and field names with the table and field names for the first database schema, and responsive to the replacing, in the second structured query language query, the second values with the first values selected from the first database, storing the second structured query language query to the first training data.

7. The system of claim 6 , the executable operations further comprising:

identifying compound nouns related to the fields of the table; and

identifying logical conjunctions related to the compound nouns;

wherein determining the structured query language pattern further is based on the compound nouns and logical conjunctions related to the compound nouns.

8. The system of claim 6 , the executable operations further comprising:

executing the second structured query language query against the first database; and

determining whether the executing the second structured query language query against the first database returns an empty result;

wherein the storing the second structured query language query to the first training data further is responsive to the executing the second structured query language query against the first database not returning the empty result.

9. The system of claim 6 , the executable operations further comprising:

identifying nouns in the second structured query language query;

inferring at least one verbal phrase for the nouns in the second structured query language query;

creating at least one natural language sentence from the at least one verbal phrase for the nouns in the second structured query language query;

creating at least one user sentence pattern from the at least one natural language sentence; and

storing the at least one user sentence pattern to the first training data;

wherein the first training data further is configured for use in machine learning to train a SQL-to-text model, the SQL-to-text model comprising a second artificial neural network and configured to convert the first structured query language query to second natural language text.

10. The system of claim 9 , the executable operations further comprising:

determining at least one adjective for the at least one verbal phrase; and

adding the at least one adjective to the at least one verbal phrase.

11. A computer program product, comprising:

one or more computer readable storage mediums having program code stored thereon, the program code stored on the one or more computer readable storage mediums collectively executable by a data processing system to initiate operations including:

generating a first database from a second database by replacing a plurality of field names in the first database with significant names;

selecting a set of values from a plurality of fields of a table in the first database;

selecting at least one adverb or adjective for the set of values;

determining join paths for values in the set of values;

determining a structured query language (SQL) pattern based, at least in part, on at least one value in the set of values, the at least one adverb or adjective for the set of values, and the join paths for the set of values;

storing the structured query language pattern to first training data configured, at least in part, for use in machine learning to train a text-to-SQL model, the text-to-SQL model comprising a first artificial neural network and configured to convert first natural language text to a first structured query language query;

selecting a second structured query language query;

identifying nouns in the second structured query language query;

inferring at least one verbal phrase for the nouns in the second structured query language query;

creating at least one natural language sentence from the at least one verbal phrase for the nouns in the second structured query language query;

creating at least one user sentence pattern from the at least one natural language sentence; and

storing the at least one user sentence pattern to the first training data;

wherein the first training data further is configured for use in machine learning to train a SQL-to-text model, the SQL-to-text model comprising a second artificial neural network and configured to convert the first structured query language query to second natural language text.

12. The computer program product of claim 11 , wherein the program code is executable by the data processing system to initiate operations further comprising:

identifying compound nouns related to the fields of the table; and

identifying logical conjunctions related to the compound nouns;

wherein determining the structured query language pattern further is based on the compound nouns and logical conjunctions related to the compound nouns.

13. The computer program product of claim 11 , wherein the program code is executable by the data processing system to initiate operations further comprising:

selecting, from a training corpus, a second database schema that includes a same type of data as a first database schema of the first database;

selecting the second structured query language query from second training data for the second database schema;

replacing, in the second structured query language query, table and field names with table and field names for the first database schema;

replacing, in the second structured query language query, second values with first values selected from the first database; and

responsive to the replacing, in the second structured query language query, the table and field names with the table and field names for the first database schema, and responsive to the replacing, in the second structured query language query, the second values with the first values selected from the first database, storing the second structured query language query to the first training data.

14. The computer program product of claim 13 , wherein the program code is executable by the data processing system to initiate operations further comprising:

executing the second structured query language query against the first database; and

determining whether the executing the second structured query language query against the first database returns an empty result;

wherein the storing the second structured query language query to the first training data further is responsive to the executing the second structured query language query against the first database not returning the empty result.

15. The method of claim 1 , further comprising:

including the second natural language text in one or more query results.

16. The computer program product of claim 11 , wherein the program code is executable by the data processing system to initiate operations further comprising:

including the second natural language text in one or more query results.

17. The method of claim 1 , further comprising:

creating one or more associations between the stored at least one user sentence pattern and at least one structured query language query.

18. The system of claim 9 , the executable operations further comprising:

creating one or more associations between the stored at least one user sentence pattern and at least one structured query language query.

19. The computer program product of claim 11 , wherein the program code is executable by the data processing system to initiate operations further comprising:

creating one or more associations between the stored at least one user sentence pattern and at least one structured query language query.

20. The system of claim 9 , the executable operations further comprising:

including the second natural language text in one or more query results.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 31, 2023
From: POPESCU, OCTAVIAN; YEO, HANGU; SHEININ, VADIM; MANOTAS GUTIÉRREZ, IRENE LIZETH; VO, NGOC PHUOC AN; KHORASANI, ELAHE
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 064767/0376 →
Continuity (1)
Related Publication 20250077517A1 · Mar 6, 2025
References Cited (21)
US 9613025B2 · Heo et al. · 2017 [cited by applicant]
US 9959311B2 · Boguraev et al. · 2018 [cited by applicant]
US 20170109434A1 · Boxwell et al. · 2017 [cited by applicant]
US 20170270191A1 · Levas et al. · 2017 [cited by applicant]
US 20200133952A1 · Sheinin · 2020 [cited by examiner]
US 20210191936A1 · Khorasani et al. · 2021 [cited by applicant]
US 20210390096A1 · Rahmfeld · 2021 [cited by examiner]
US 20230169075A1 · Han · 2023 [cited by examiner]
US 20240104092A1 · Saha · 2024 [cited by examiner]
CN 110019555A · 2019 [cited by applicant]
CN 113177123A · 2021 [cited by applicant]
CN 114817295A · 2022 [cited by applicant]
CN 112069199B · 2022 [cited by applicant]
CN 112287093B · 2022 [cited by applicant]
KR 20220109978A · 2022 [cited by applicant]
Xu et al, “SQL-to-Text Generation with Graph-to-Sequence Model”, Peking University, 2019, Feb. 2019, 6 pages. [cited by examiner]
Feng, S.Y. et al., “A survey of data augmentation approaches for NLP,” arXiv preprint, arXiv:2105.03075, May 7, 2021, 21 pg. [cited by applicant]
Wu, K. et al., “Data augmentation with hierarchical SQL-to-question generation for cross-domain text-to-SQL parsing,” arXiv preprint, arXiv:2103.02227, Mar. 3, 2021, 10 pg. [cited by applicant]
“Spider 1.0, Yale Semantic Parsing and Text-to-SQL Challenge,” [online] Website for the Lily Group at Yale University [retrieved May 5, 2023], retrieved from the Internet: <https://yale-lily.github.io/spider>, 13 pg. [cited by applicant]
Shi, P. et al., “Learning contextual representations for semantic parsing with generation-augmented pre-training” In Proceedings of the AAAI Conference on Artificial Intelligence, May 18, 2021, vol. 35, No. 15, pp. 1380… [cited by applicant]
Mell, P. et al., The NIST Definition of Cloud Computing, National Institute of Standards and Technology, U.S. Dept. of Commerce, Special Publication 800-145, Sep. 2011, 7 pg. [cited by applicant]
Cited By (1)
US 12,737,201