IP Library › Granted Patent US 12,645,718
Granted Patent B2
US 12,645,718 · App. 18/830,414 · Granted Jun 2, 2026

Machine learned language model based natural language interface for querying databases

Inventors: Deepak Dilipkumar (New York, NY); Wahhaj Ali (Mississauga, CA); Karthik Ravishankar (Cincinnati, OH)
Assignee: Maplebear Inc.
G06F16/3344G06F16/31
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,645,718
App. No.
18/830,414
Granted
Jun 2, 2026
Kind
B2
Abstract

A system, such as an online system, allows users to ask natural language questions requesting information stored in a database. The system receives a natural language question. The system determines database tables and database queries associated with the natural language question. The system generates a prompt for input to a machine learned language model. The prompt specifies the natural language question, information describing database tables, and the example database queries. The system sends the prompt to the machine learned language model for execution and receives a response generated by the machine learned language model. The response includes a database query corresponding to the natural language question. The system sends the database query for execution on a database system and provides the result of execution of the database query to the client device.

Claims (81)

1 . A method comprising:

receiving, from a client device, a natural language question requesting information stored in a database, the database including a plurality of database tables;

identifying a set of database tables relevant for answering the natural language question, including:

converting the natural language question into a vector representation;

converting descriptions of the plurality of database tables into respective vector representations; and

comparing the vector representation of the natural language question and vector representations of the descriptions of the plurality of database tables to identify the set of database tables relevant for answering the natural language question;

identifying, from a database query index storing historical database queries in association with the plurality of database tables, a set of example database queries in association with the set of database tables;

generating a prompt for input to a machine learned language model, the prompt requesting the machine learned language model to generate a database query for accessing information needed for answering the natural language question, the prompt comprising:

the natural language question,

information describing the set of database tables, and the set of example database queries based on the set of database tables;

sending the prompt to the machine learned language model for execution;

receiving a response generated by the machine learned language model based on the prompt, the response comprising a database query;

sending the database query for execution on a database system; and

providing a result of execution of the database query to the client device.

2 . The method of claim 1 , further comprising:

validating the database query received in the response generated by the machine learned language model; and

responsive to generating an error based on the validation, modifying the prompt to include the error generated by the validation and providing the modified prompt for execution to the machine learned language model.

3 . The method of claim 1 , further comprising:

storing in a vector index, information describing database tables of the database, wherein identifying the set of database tables relevant for answering the natural language question comprises executing a vector index query using the vector index, the vector index query specifying the natural language question.

4 . The method of claim 3 , wherein the vector index executes the vector index query by identifying database tables within a threshold vector distance of a vector representation of the natural language question.

5 . The method of claim 3 , further comprising:

generating information describing database tables of the database using the machine learned language model.

6 . The method of claim 5 , wherein generating information describing database tables of the database using the machine learned language model comprises:

generating a prompt identifying the set of database tables of the database, sample data from each of the database tables of the set of database tables, the prompt requesting the machine learned language model to generate a description of each database table in the set of database tables;

providing the prompt to the machine learned language model;

obtaining a response by executing the machine learned language model; and

extracting a description of the database tables of the set of database tables from the response obtained by executing the machine learned language model.

7 . The method of claim 6 , wherein the prompt further comprises information describing relations between database tables of the set of database tables.

8 . The method of claim 1 , further comprising:

storing in a vector index, example database queries, wherein identifying the set of example database queries comprises executing a vector index query using the vector index, the vector index query specifying the natural language question.

9 . The method of claim 8 , wherein the vector index query further specifies a set of tables relevant to the natural language question.

10 . The method of claim 8 , wherein the vector index executes the vector index query by identifying an example database query within a threshold vector distance of a vector representation of the natural language question.

11 . A non-transitory computer readable storage medium storing instructions that when executed by one or more computer processors cause the one or more computer processors to perform steps comprising:

receiving, from a client device, a natural language question requesting information stored in a database, the database including a plurality of database tables;

identifying a set of database tables relevant for answering the natural language question, including:

converting the natural language question into a vector representation;

converting descriptions of the plurality of database tables into respective vector representations; and

comparing the vector representation of the natural language question and vector representations of the descriptions of the plurality of database tables to identify the set of database tables relevant for answering the natural language question;

identifying, from a database query index storing historical database queries in association with the plurality of database tables, a set of example database queries in association with the set of database tables;

generating a prompt for input to a machine learned language model, the prompt requesting the machine learned language model to generate a database query for accessing information needed for answering the natural language question, the prompt comprising:

the natural language question,

information describing the set of database tables, and

the set of example database queries based on the set of database tables;

sending the prompt to the machine learned language model for execution;

receiving a response generated by the machine learned language model based on the prompt, the response comprising a database query;

sending the database query for execution on a database system; and

providing a result of execution of the database query to the client device.

12 . The non-transitory computer readable storage medium of claim 11 , wherein the instructions cause the one or more computer processors to further perform steps comprising:

validating the database query received in the response generated by the machine learned language model; and

responsive to generating an error based on the validation, modifying the prompt to include the error generated by the validation and providing the modified prompt for execution to the machine learned language model.

13 . The non-transitory computer readable storage medium of claim 11 , wherein the instructions cause the one or more computer processors to further perform steps comprising:

storing in a vector index, information describing database tables of the database, wherein identifying the set of database tables relevant for answering the natural language question comprises executing a vector index query using the vector index, the vector index query specifying the natural language question, wherein the vector index executes the vector index query by identifying database tables within a threshold vector distance of a vector representation of the natural language question.

14 . The non-transitory computer readable storage medium of claim 12 , wherein the instructions cause the one or more computer processors to further perform steps comprising:

generating information describing database tables of the database using the machine learned language model.

15 . The non-transitory computer readable storage medium of claim 14 , wherein generating information describing database tables of the database using the machine learned language model comprises:

generating a prompt identifying the set of database tables of the database, sample data from each of the database tables of the set of database tables, the prompt requesting the machine learned language model to generate a description of each database table in the set of database tables;

providing the prompt to the machine learned language model;

obtaining a response by executing the machine learned language model; and

extracting a description of the database tables of the set of database tables from the response obtained by executing the machine learned language model.

16 . The non-transitory computer readable storage medium of claim 15 , wherein the prompt further comprises information describing relations between database tables of the set of database tables.

17 . The non-transitory computer readable storage medium of claim 11 , wherein the instructions cause the one or more computer processors to further perform steps comprising:

storing in a vector index, example database queries, wherein identifying the set of example database queries comprises executing a vector index query using the vector index, the vector index query specifying the natural language question.

18 . The non-transitory computer readable storage medium of claim 17 , wherein the vector index query further specifies a set of tables relevant to the natural language question.

19 . The non-transitory computer readable storage medium of claim 17 , wherein the vector index executes the vector index query by identifying an example database query within a threshold vector distance of a vector representation of the natural language question.

20 . A computer system comprising:

one or more computer processors; and

a non-transitory computer readable storage medium storing instructions that when executed by one or more computer processors cause the one or more computer processors to perform steps comprising:

receiving, from a client device, a natural language question requesting information stored in a database, the database including a plurality of database tables;

identifying a set of database tables relevant for answering the natural language question, including:

converting the natural language question into a vector representation;

converting descriptions of the plurality of database tables into respective vector representations; and

comparing the vector representation of the natural language question and vector representations of the descriptions of the plurality of database tables to identify the set of database tables relevant for answering the natural language question;

identifying, from a database query index storing historical database queries in association with the plurality of database tables, a set of example database queries in association with the set of database tables;

generating a prompt for input to a machine learned language model, the prompt requesting the machine learned language model to generate a database query for accessing information needed for answering the natural language question, the prompt comprising:

the natural language question,

information describing the set of database tables, and

the set of example database queries based on the set of database tables;

sending the prompt to the machine learned language model for execution;

receiving a response generated by the machine learned language model based on the prompt, the response comprising a database query;

sending the database query for execution on a database system; and

providing a result of execution of the database query to the client device.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 19, 2024
From: DILIPKUMAR, DEEPAK; ALI, WAHHAJ; RAVISHANKAR, KARTHIK
To: MAPLEBEAR INC.
Reel/Frame 068633/0963 →
Continuity (2)
Provisional Application 63537785 · Sep 11, 2023
Related Publication 20250086213A1 · Mar 13, 2025
References Cited (4)
US 12216713B1 · Shapira · 2025 [cited by examiner]
US 20240362209A1 · Almaer · 2024 [cited by examiner]
US 20240362212A1 · Sun · 2024 [cited by examiner]
US 20250077509A1 · Schindel · 2025 [cited by examiner]