IP Library › Granted Patent US 12,487,998
Granted Patent B1
US 12,487,998 · App. 18/790,103 · Granted Dec 2, 2025

Contextual graph dynamics for natural language to SQL conversion

Inventors: Shweta Goyal (Bangalore, IN); Kailash Talreja (Mumbai, IN); Sailendu Kumar Patra (Bangalore, IN); Saurabh Jha (Austin, TX)
Assignee: Dell Products L.P.
G06F16/24522G06F16/212G06F40/58
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,487,998
App. No.
18/790,103
Granted
Dec 2, 2025
Kind
B1
Abstract

A method for training a model to generate a structured query language (SQL) output using a natural language input includes receiving a training data set that includes natural language queries, corresponding SQL statements, and a corresponding database. The method also includes extracting query-specific schema from the corresponding database. Further, the method includes embedding the natural language queries and the query-specific schema to generate initialized embeddings, where each initialized embedding corresponds to a natural language query of the natural language queries, and where the corresponding SQL statement is one of the corresponding SQL statements; generating subgraphs based on the initialized embeddings and the natural language queries; training a graph neural network (GNN) using the subgraphs as inputs; generating, using the GNN, refined outputs based on the subgraphs; and training a transformer model using the refined outputs and the natural language queries to obtain a trained model.

Claims (53)

1 . A method for training and using a model to generate a structured query language (SQL) output using a natural language input, the method comprising:

training the model by:

receiving a training data set comprising natural language queries, corresponding SQL statements, and a corresponding database;

extracting query-specific schema from the corresponding database;

embedding the natural language queries and the query-specific schema to generate initialized embeddings, wherein each initialized embedding corresponds to a natural language query of the natural language queries, and wherein the corresponding SQL statement is one of the corresponding SQL statements;

generating subgraphs based on the initialized embeddings and the natural language queries;

generating, using a graph neural network (GNN), refined outputs based on the subgraphs, wherein the GNN is trained using the subgraphs as inputs; and

training a transformer model using the refined outputs and the natural language queries to obtain a trained model;

receiving a user input, wherein the user input comprises a user natural language query;

identifying a target database based on the user input;

generating a subgraph input based on the user input and a database schema associated with the target database;

generating, using the subgraph input and the user input as inputs to the trained model, a SQL query; and

performing, based on the user input and the SQL query, an action from an action set.

2 . The method of claim 1 , wherein the target database is the corresponding database.

3 . The method of claim 1 , wherein the action set comprises at least one of the following: presenting the SQL query to the user, executing the SQL query on the target database and presenting a results list to the user, and executing the SQL query on the target database and manipulating the database based on the user input.

4 . The method of claim 1 , wherein training the model further comprises:

refining, via backpropagation, the GNN and transformer model based on a loss function.

5 . The method of claim 1 , wherein the GNN is further trained utilizing a regularization technique and an over-smoothing technique.

6 . The method of claim 1 , wherein the embedding is based on pre-trained word embeddings, metadata associated with the corresponding database, and query context.

7 . The method of claim 1 , wherein the GNN is further trained by, for each subgraph of the subgraphs, dynamically adjusting a number of layers of the GNN based on a number of nodes for the each subgraph.

8 . A method for training a model to generate a structured query language (SQL) output using a natural language input, the method comprising:

receiving a training data set comprising natural language queries, corresponding SQL statements, and a corresponding database;

extracting query-specific schema from the corresponding database;

embedding the natural language queries and the query-specific schema to generate initialized embeddings, wherein each initialized embedding corresponds to a natural language query of the natural language queries, and wherein the corresponding SQL statement is one of the corresponding SQL statements;

generating subgraphs based on the initialized embeddings and the natural language queries;

training a graph neural network (GNN) using the subgraphs as inputs;

generating, using the GNN, refined outputs based on the subgraphs; and

training a transformer model using the refined outputs and the natural language queries to obtain a trained model.

9 . The method of claim 8 , wherein training the model further comprises:

refining, via backpropagation, the GNN and transformer model based on a loss function.

10 . The method of claim 8 , wherein training the GNN further comprises:

utilizing a regularization technique and an over-smoothing technique.

11 . The method of claim 8 , wherein the embedding is based on pre-trained word embeddings, metadata associated with the corresponding database, and query context.

12 . The method of claim 8 , wherein training the GNN further comprises:

for each subgraph of the subgraphs, dynamically adjusting a number of layers of the GNN based on a number of nodes for the each subgraph.

13 . A method for using a model to generate a structured query language (SQL) output using a natural language input, the method comprising:

receiving a user input, wherein the user input comprises a user natural language query;

identifying a target database based on the user input;

generating a subgraph input based on the user input and a database schema associated with the target database;

generating, using the subgraph input and the user input as inputs to the model, a SQL query; performing, based on the user input and the SQL query, an action from an action set;

training the model by:

receiving a training data set comprising natural language queries, corresponding SQL statements, and a corresponding database;

extracting query-specific schema from the corresponding database;

embedding the natural language queries and the query-specific schema to generate initialized embeddings, wherein each initialized embedding corresponds to a natural language query of the natural language queries, and wherein the corresponding SQL statement is one of the corresponding SQL statements;

generating subgraphs based on the initialized embeddings and the natural language queries;

training a transformer model using the subgraphs and the natural language queries to obtain a trained model;

training a graph neural network (GNN) using the subgraphs as inputs, wherein the GNN is used to obtain the trained model; and

refining, via backpropagation, the GNN and transformer model based on a loss function.

14 . The method of claim 13 , wherein the action set comprises at least one of the following: presenting the SQL query to the user, executing the SQL query on the target database and presenting a results list to the user, executing the SQL query on the target database and manipulating the database based on the user input.

15 . The method of claim 13 , wherein the target database is the corresponding database.

16 . The method of claim 13 , wherein training the GNN further comprises utilizing a regularization technique and an over-smoothing technique.

17 . The method of claim 13 , wherein training the GNN further comprises, for each subgraph, dynamically adjusting a number of layers of the GNN based on a number of nodes for the each subgraph.

18 . The method of claim 13 , wherein the embedding is based on pre-trained word embeddings, metadata associated with the corresponding database, and query context.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 18, 2024
From: GOYAL, SHWETA; TALREJA, KAILASH; PATRA, SAILENDU KUMAR; JHA, SAURABH
To: DELL PRODUCTS L.P.
Reel/Frame 068626/0442 →
References Cited (6)
US 12271374B1 · Lai · 2025 [cited by examiner]
US 20250061111A1 · Han · 2025 [cited by examiner]
Gong, Graph Reasoning Enhanced Language Models for Text-to-SQL, pp. 2447-2452, Jul. 11, (Year: 2024). [cited by examiner]
Bogin, Representing Schema Structure with Graph Neural Networks for Text-to-SQL Parsing, pp. 1-7, Jun. 3 (Year: 2019). [cited by examiner]
Li, Graphix-T5: Mixing Pre-trained Transformers with Graph-Aware Layers for Text-to-SQL Parsing, pp. 13076-13084 (Year: 2023). [cited by examiner]
Yu, Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task, pp. 1-11 (Year: 2019). [cited by examiner]