IP Library Granted Patent US 11,550,783
Granted Patent B2
US 11,550,783 · App. 16/704,666 · Granted Jan 10, 2023

One-shot learning for text-to-SQL

Inventors: Dongjun Lee (Seoul, KR); Jaesik Yoon (Seoul, KR)
Assignee: SAP SE
G06F16/243G06F17/16G06N3/0454
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 11,550,783
App. No.
16/704,666
Filed
Dec 5, 2019
Granted
Jan 10, 2023
Kind
B2
Art Unit
2154
USPC
707/722
Abstract

Provided is a system and method for detecting a SQL command from a natural language input using neural networks which works even when the SQL command has not been seen before by the neural networks. In one example, the method may include storing a candidate set comprising structured query language (SQL) templates paired with respective text values, reducing, via a first predictive network, the candidate set into a subset of candidates based on a natural language input and the text values included in the candidate set, selecting, via a second predictive network, an SQL template from among the subset of candidates based on the natural language input and text values included in the subset of candidates, and determining a SQL command that corresponds to the natural language input based on the selected SQL template and content from the natural language input.

Claims (47)

1. A computing system comprising:

a memory configured to store a candidate set comprising a plurality of structured query language (SQL) templates paired with a plurality of respective text values; and

a processor configured to

convert a natural language input and the plurality of respective text values into a first plurality of vectors based on a first function;

reduce, via a first neural network, the candidate set into a subset of candidates including a subset of respective text values based on a similarity between a vector of the natural language input and vectors of the respective text values included in the first plurality of vectors which are converted based on the first function,

convert the natural language input and the subset of respective text values into a second plurality of vectors based on a second function that is different than the first function;

select, via a second neural network which is a different type of neural network than the first neural network, a candidate from among the subset of candidates based on a similarity between a vector of the natural language input and vectors of the subset of respective text values included in the second plurality of vectors which are converted based on the second function, and

generate a SQL command that corresponds to the natural language input based on an SQL template paired with the selected candidate and content from the natural language input.

2. The computing system of claim 1 , further comprising a microphone which receives speech including the natural language input.

3. The computing system of claim 1 , wherein the processor is configured to:

convert the respective text values of the candidate set into a set of vectors among the first plurality of vectors and convert the natural language input into a natural language vector among the first plurality of vectors using the first function; and

compare the set of vectors to the natural language vector to identify a subset of vectors from the set of vectors that most closely matches the natural language vector.

4. The computing system of claim 3 , wherein the processor compares of the set of vectors to the natural language vector via cosine similarity.

5. The computing system of claim 1 , wherein the processor is configured to reduce the candidate set down to a subset of candidates with a fixed size that is predefined in advance.

6. The computing system of claim 1 , wherein the processor is configured to:

convert the subset of respective text values of the subset of candidates into a subset of vectors and convert the natural language input into a natural language vector using the second function, and

compare the subset of vectors to the natural language vector to select a vector from the subset of vectors that most closely matches the natural language vector.

7. The computing system of claim 1 , wherein the processor is configured to fill-in one or more slots of the SQL template of the selected candidate with one or more words from the natural language input.

8. The computing of claim 7 , wherein the processor is further configured to determine, via a third neural network, a word from the natural language input which belongs in an empty slot of the SQL template of the selected candidate.

9. The computing system of claim 1 , wherein the processor is further configured to generate a response including the generated SQL command, and output the response to at least one of a user interface and a software program.

10. A method comprising:

storing a candidate set comprising a plurality of structured query language (SQL) templates paired with a plurality of respective text values;

converting a natural language input and the plurality of respective text values into a first plurality of vectors based on a first function;

reducing, via a first neural network, the candidate set into a subset of candidates including a subset of respective text values based on a similarity between a vector of the natural language input and the plurality of respective text values included in the first plurality of vectors which are converted based on the first function;

converting the natural language input and the subset of respective text values into a second plurality of vectors based on a second function that is different than the first function;

selecting, via a second neural network which is a different type of neural network than the first neural network, a candidate from among the subset of candidates based on a similarity between a vector of the natural language input and the subset of respective text values included in the second plurality of vectors which are converted based on the second function; and

generating a SQL command that corresponds to the natural language input based on an SQL template paired with the selected candidate and content from the natural language input.

11. The method of claim 10 , further comprising receiving the natural language input via a microphone.

12. The method of claim 10 , wherein the reducing comprises:

converting the respective text values of the candidate set into a set of vectors among the first plurality of vectors and converting the natural language input into a natural language vector among the first plurality of vectors using the first function; and

comparing the set of vectors to the natural language vector to identify a subset of vectors from the set of vectors that most closely matches the natural language vector.

13. The method of claim 12 , wherein the comparing comprises comparing the set of vectors to the natural language vector via cosine similarity.

14. The method of claim 10 , wherein the reducing comprises reducing the candidate set down to a subset of candidates with a fixed size that is predefined in advance.

15. The method of claim 10 , wherein the selecting comprises:

converting the subset of respective text values of the subset of candidates into a subset of vectors and converting the natural language input into a natural language vector using the second function, and

comparing the subset of vectors to the natural language vector to select a vector from the subset of vectors that most closely matches the natural language vector.

16. The method of claim 10 , wherein the determining comprises filling-in one or more slots of the SQL template of the selected candidate with one or more words from the natural language input.

17. The method of claim 10 , wherein the determining comprises determining, via a third neural network, a word from the natural language input which belongs in an empty slot of the SQL template of the selected candidate.

18. The method of claim 10 , wherein the method further comprises generating a response including the generated SQL command, and outputting the response to at least one of a user interface and a software program.

19. A non-transitory computer-readable medium storing instructions which when executed by a processor cause a computer to perform a method comprising:

storing a candidate set comprising a plurality of structured query language (SQL) templates paired with a plurality of respective text values;

converting a natural language input and the plurality of respective text values into a first plurality of vectors based on a first function;

reducing, via a first neural network, the candidate set into a subset of candidates including a subset of respective text values based on a similarity between a vector of the natural language input and the plurality of respective text values included in the first plurality of vectors which are converted based on the first function;

converting the natural language input and the subset of respective text values into a second plurality of vectors based on a second function that is different than the first function;

selecting, via a second neural network which is a different type of neural network than the first neural network, a candidate from among the subset of candidates based on a similarity between a vector of the natural language input and the subset of respective text values included in the second plurality of vectors which are converted based on the second function, and

generating a SQL command that corresponds to the natural language input based on an SQL template paired with the selected candidate and content from the natural language input.

20. The non-transitory computer-readable medium of claim 19 , wherein the determining comprises determining, via a third neural network, a word from the natural language input which belongs in an empty slot of the SQL template of the selected candidate.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 5, 2019
From: LEE, DONGJUN; YOON, JAESIK
To: SAP SE
Reel/Frame 051193/0382 →
Continuity (2)
Provisional Application 62835587 · Apr 18, 2019
Related Publication 20200334233A1 · Oct 22, 2020
Cited By (2)
US 12,511,282 US 12,554,711