Hint-based natural language to structured query language generation

The method and system address inaccuracies in Text-to-SQL systems by using verified hints and iterative refinement, enhancing SQL code generation accuracy and reliability for complex databases.

US20260377405A1Pending Publication Date: 2026-11-26QUANTIPHI INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/218233
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Filing Date
2025-05-24
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Existing Text-to-SQL systems face challenges with hallucinations and inaccurate SQL code generation, especially with complex enterprise databases, leading to unreliable performance due to high latency and poor throughput.

Method used

A method and system that utilize verified hints generated by Large Language Models (LLMs) based on historical queries and database schemas, iteratively refining SQL code to improve accuracy and reduce errors, with error notifications for user feedback.

Benefits of technology

Enhances the accuracy and reliability of SQL code generation by iteratively updating hints and SQL code, reducing contextual inaccuracies and improving throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260377405A1-D00000_ABST
    Figure US20260377405A1-D00000_ABST
Patent Text Reader

Abstract

The present disclosure relates to a system and a method for generating Structured Query Language (SQL) code corresponding to a Natural Language (NL) input. The system receives the NL input (i.e., a NL query) from a user device. In receipt of the NL input, the system retrieves verified hints and a schema of a database. The verified hints are generated by the system based on historical queries and the schema of the database. Each hint encapsulates complex contextual information of the schema of the database (110). Moreover, each verified hint is associated with a verified hint-based SQL code and a verified NL description for the verified hint-based SQL code. The system utilizes Large Language Model(s) to generate the SQL code corresponding to the NL input, using the verified hints, the schema of the database, and the NL input.
Need to check novelty before this filing date? Find Prior Art

Description

CROSS-REFERENCE TO RELATED APPLICATIONS / INCORPORATION BY REFERENCE

[0001] None.TECHNICAL FIELD

[0002] The embodiments of the present disclosure generally relate to the field of data translation. More particularly, the present disclosure relates to hint-based Natural Language (NL) to Structured Query Language (SQL) generation.BACKGROUND OF THE INVENTION

[0003] The subject matter disclosed in the background section should not be assumed or construed to be prior art merely because of its mention in the background section. Similarly, any problem statement mentioned in the background section or its association with the subject matter of the background section should not be assumed or construed to have been previously recognized in the prior art.

[0004] Text-to-SQL (interchangeably represented as ‘Text2SQL’) systems translate Natural Language (NL) queries into Structured Query Language (SQL) commands, enabling users to interact with databases using everyday language rather than SQL syntax. This breakthrough in data accessibility bridges the gap between human communication and database querying, democratizing access to valuable information stored in relational databases. Large Language Models (LLMs) are increasingly utilized in Text-to-SQL systems, allowing users to query databases using natural language. However, LLM-based Text2SQL models often encounter“hallucinations,” especially when dealing with complex enterprise databases that involve multiple tables and joins. These challenges frequently result in inaccurate SQL code generation.

[0005] Contemporary Text2SQL systems typically rely on multiple LLM calls to generate SQL codes. Some methods attempt to improve accuracy by generating test cases to select the correct query, while others incorporate human-curated ontologies to merge knowledge graphs with LLMs. However, due to complex architecture, such systems either fail to deliver accurate text-to-SQL translation or have a very poor throughput (i.e., high latency), which makes such systems unreliable to be used for practical applications. Therefore, there is a need for a technical solution to address the challenges, as mentioned hereinabove.SUMMARY

[0006] The following embodiments present a simplified summary in order to provide a basic understanding of some aspects of the disclosed invention. This summary is not an extensive overview, and it is not intended to identify key / critical elements or to delineate the scope thereof. Its sole purpose is to present some concepts in a simplified form as a prelude to the more detailed description that is presented later.

[0007] According to an embodiment of the present disclosure, a method for generating Structured Query Language (SQL) code corresponding to a Natural Language (NL) input is disclosed. The method includes receiving the NL input from a user device. The method further includes retrieving, from a database in receipt of the NL input, verified hint(s) of multiple hints and a schema of the database. Each verified hint is associated with a verified hint-based SQL code and a verified NL description for the verified hint-based SQL code. Each hint encapsulates complex contextual information of the schema of the database. Furthermore, the method includes generating, by Large Language Model(s) (LLM(s)), the SQL code corresponding to the NL input based on the verified hint(s), the schema of the database, and the NL input.

[0008] In some aspects of the present disclosure, the method further includes executing the SQL code on the database. Moreover, the method includes determining whether a first execution error is present upon the execution of the SQL code on the database. Furthermore, in response to the presence of the first execution error, the method includes iteratively updating the SQL code for at most a predefined count of iterations by the LLM(s) using the first execution error, the SQL code, and the schema of the database.

[0009] In some aspects of the present disclosure, the method further includes rendering the SQL code through the user device based on a determination that the first execution error is absent upon the execution of the SQL code on the database. Moreover, the method further includes rendering an error notification through the user device based on the determination that the first execution error is present upon the execution of the SQL code on the database after updating the SQL code by the LLM(s) for the predefined count of iterations.

[0010] In some aspects of the present disclosure, the first execution error is a NL text that indicates a contextual inaccuracy of the SQL code in reference to the NL input.

[0011] In some aspects of the present disclosure, the method further includes retrieving, from the database, multiple historical queries and the schema of the database. Moreover, the method includes generating, by the LLM(s), the plurality of hints using the multiple historical queries and the schema of the database. Each hint is associated with a hint-based SQL code and a NL description for the hint-based SQL code.

[0012] In some aspects of the present disclosure, the method further includes executing the hint-based SQL code on the database. Moreover, the method includes determining whether a second execution error is present upon the execution of the hint-based SQL code on the database. Furthermore, in response to the presence of the second execution error, the method includes iteratively updating the hint-based SQL code for at most the predefined count of iterations by the LLM(s), using the second execution error, the hint-based SQL code, and the schema of the database.

[0013] In some aspects of the present disclosure, the second execution error is a NL text that indicates a contextual inaccuracy of the hint-based SQL code in reference to the NL description for the hint-based SQL code.

[0014] In some aspects of the present disclosure, the method further includes identifying, in response to a determination that the second execution error is absent upon the execution of the hint-based SQL code on the database, the hint-based SQL code as the verified hint-based SQL code, the NL description for the verified hint-based SQL code as the verified NL description, and a hint corresponding to the verified hint-based SQL code and the verified NL description as the verified hint.

[0015] In some aspects of the present disclosure, the LLM(s) utilizes a structured prompt to generate the multiple hints.

[0016] According to another embodiment of the present disclosure, a system to generate Structured Query Language (SQL) code corresponding to a Natural Language (NL) text is provided. The system includes a database and data processing circuitry coupled to each other. The data processing circuitry is configured to receive the NL input from a user device. Moreover, in receipt of the NL input, the data processing circuitry is also configured to retrieve verified hint(s) of multiple hints and a schema of the database from the database. Each verified hint is associated with a verified hint-based SQL code and a verified NL description for the verified hint-based SQL code. Each hints encapsulates complex contextual information of the schema of the database. Furthermore, the data processing circuitry, by way of Large Language Model(s) (LLM(s)), is configured to generate the SQL code corresponding to the NL input based on the verified hint(s), the schema of the database, and the NL input.BRIEF DESCRIPTION OF DRAWINGS

[0017] Various embodiments disclosed herein will become better understood from the following detailed description when read with the accompanying drawings. The accompanying drawings constitute a part of the present disclosure and illustrate certain non-limiting embodiments of inventive concepts disclosed herein. Further, components and elements shown in the drawings are not necessarily to scale, emphasis instead being placed upon clearly illustrating the principles of the present disclosure. For the purpose of consistency and ease of understanding, similar components and elements are annotated by reference numerals in the exemplary drawings.

[0018] FIG. 1 illustrates a block diagram depicting exemplary components of a system to generate Structured Query Language (SQL) code corresponding to a Natural Language (NL) input, in accordance with an embodiment of the present disclosure.

[0019] FIG. 2 illustrates a block diagram depicting exemplary components of a data processing server engaged in generation of the SQL code corresponding to the NL input, in accordance with an exemplary embodiment of the present disclosure.

[0020] FIG. 3 illustrates a block diagram depicting exemplary components of a Large Language Model (LLM) used in the generation of the SQL code corresponding to the NL input, in accordance with an exemplary embodiment of the present disclosure.

[0021] FIG. 4 presents a process-flow diagram depicting a process for generating verified hints, in accordance with an exemplary embodiment of the present disclosure.

[0022] FIG. 5 presents a process-flow diagram depicting a process for generating the SQL code corresponding to the NL input using the verified hints, in accordance with an exemplary embodiment of the present disclosure.

[0023] FIG. 6 presents a flowchart depicting a method for generating the SQL code corresponding to the NL input, in accordance with an exemplary embodiment of the present disclosure.DETAILED DESCRIPTION OF THE INVENTION

[0024] Inventive concepts of the present disclosure will now be described more fully hereinafter with reference to the accompanying drawings, in which examples of one or more embodiments of inventive concepts are shown. Inventive concepts may, however, be embodied in different forms and should not be construed as limited to the embodiments set forth herein. Further, the one or more embodiments disclosed herein are provided to describe the inventive concept thoroughly and completely, and to fully convey the scope of each of the present inventive concepts to those skilled in the art. Furthermore, it should be noted that the embodiments disclosed herein are not mutually exclusive concepts. Accordingly, one or more components from one embodiment may be tacitly assumed to be present or used in any other embodiment.

[0025] The following description presents various embodiments of the present disclosure. The embodiments disclosed herein are presented as teaching examples and are not to be construed as limiting the scope of the present disclosure. The present disclosure should in no way be limited to the illustrative implementations, drawings, and techniques illustrated below, including the exemplary design and implementation illustrated and described herein, but may be modified, omitted, or expanded upon without departing from the scope of the present disclosure.

[0026] The following description contains specific information pertaining to embodiments in the present disclosure. The detailed description uses the phrases “in some embodiments” which may each refer to one or more or all of the same or different embodiments. The term “some” as used herein is defined as “one, or more than one, or all.” Accordingly, the terms “one,”“more than one,”“more than one, but not all” or “all” would all fall under the definition of “some.” In view of the same, the terms, for example, “in an embodiment” refers to one embodiment and the term, for example, “in one or more embodiments” refers to “at least one embodiment, or more than one embodiment, or all embodiments.”

[0027] The term “comprising,” when utilized, means “including, but not necessarily limited to;” it specifically indicates open-ended inclusion in the so-described one or more listed features, elements in a combination, unless otherwise stated with limiting language. Furthermore, to the extent that the terms “includes,”“has,”“have,”“contains,” and other similar words are used in either the detailed description, such terms are intended to be inclusive in a manner similar to the term “comprising.”

[0028] In the following description, for the purposes of explanation, various specific details are set forth to provide a thorough understanding of embodiments of the present disclosure. It will be apparent, however, that embodiments of the present disclosure may be practiced without these specific details. Several features described hereafter can each be used independently of one another or with any combination of other features.

[0029] The description provided herein discloses exemplary embodiments only and is not intended to limit the scope, applicability, or configuration of the present disclosure. Rather, the foregoing description of the exemplary embodiments will provide those skilled in the art with an enabling description for implementing any of the exemplary embodiments. Specific details are given in the following description to provide a thorough understanding of the embodiments. However, it may be understood by one of the ordinary skilled in the art that the embodiments disclosed herein may be practiced without these specific details.

[0030] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used herein the description, the singular forms “a”, “an”, and “the” include forms unless the context of the invention indicates otherwise.

[0031] The terminology and structure employed herein are for describing, teaching, and illuminating some embodiments and their specific features and elements and do not limit, restrict, or reduce the scope of the present disclosure. Accordingly, unless otherwise defined, all terms, and especially any technical and / or scientific terms, used herein may be taken to have the same meaning as commonly understood by one having ordinary skill in the art.

[0032] Various aspects of the present disclosure relate to translation of Natural Language (NL) input (i.e., a NL text) to a Structured Query Language (SQL) code. In some aspects of the present disclosure, various embodiments, as presented herein, relate to generation of the SQL code corresponding to the NL input. In some aspects of the present disclosure, the various embodiments of the present disclosure relate to a system and a method for generating the SQL code corresponding to the NL input using verified hints. Moreover, some embodiments of the present disclosure relate to generation and verification of hints using Large Language Model(s) (LLMs). According to some embodiments, the present disclosure relates to efficient utilization and management of a schema of database for the generation of the SQL code corresponding to the NL input using the verified hints. Some aspects of the present disclosure relate to optimizing Text-to-SQL generation using hint integration.

[0033] According to an embodiment of the present disclosure, disclosed is a system to generate the SQL code corresponding to the NL input using verified hints. The hints are generated by LLM(s) using historical queries and the schema of the database. Each hint is refined iteratively by the LLM for at most a predefined count of iterations for verification. The verified hints along with the NL input and the schema of the database are further fed to the LLM(s) to generate the SQL code which is further refined through iterative update.

[0034] Embodiments of the present disclosure will be described below in detail with reference to the accompanying drawings. FIG. 1 through FIG. 6, discussed below, and the one or more embodiments used to describe the principles of the present disclosure are by way of illustration only and should not be construed in any way to limit the scope of the present disclosure. Those skilled in the art will understand that the principles of the present disclosure may be implemented in any suitably arranged system or device.

[0035] FIG. 1 illustrates a block diagram depicting exemplary components of a system 100 to generate Structured Query Language (SQL) code corresponding to a Natural Language (NL) input, in accordance with an embodiment of the present disclosure. The embodiment of the system 100 shown in FIG. 1 is for illustration only. Other embodiments of the system 100 may be used without departing from the scope of this disclosure. The system 100 may include a user device 102 communicatively coupled to a data processing server 104 by way of a network 106 using wired and / or wireless communication channels. The data processing server 104 may be supported by LLM(s) 105 for performing Generative Artificial Intelligence (Gen-AI) based operations.

[0036] In some aspects of the present disclosure, the LLM(s) 105 may be integrally embedded with the data processing server 104. In some other aspects of the present disclosure, the LLM(s) 105 may be deployed on external datacenter(s) (not shown) communicatively coupled to the data processing server 104.

[0037] The user device 102 may be configured to enable a user to provide the NL input (i.e., a text in the Natural Language) to the data processing server 104 for the generation of a SQL code corresponding to the NL input. Moreover, the user device 102 may also be configured to render notification(s) (such as errors) and / or results (such as SQL codes generated by the data processing server 104) to the user. Examples of the user device 102 may include, but are not limited to, portable handheld electronic devices such as a mobile phone, a tablet, a laptop, a smart watch etc., or fixed electronic devices such as a desktop computer, computing device, etc. In some aspects of the present disclosure, the user device 102 may include an application console (not shown) to execute a computer-executable software application (hereinafter interchangeably referred to as ‘computer application’) installed / operated on the user device 102 and hosted by the data processing server 104. Operational instructions for the application console may be stored in a device memory (not shown) and may be executed by a device processor (not shown) through the application console. The computer application may enable the user device 102 to communicate with the data processing server 104 for generating the SQL code corresponding to the NL input.

[0038] The data processing server 104 may be a network of computers, a software framework, or a combination thereof, that may provide a generalized approach to create a server implementation. Examples of the data processing server 104 may include, but are not limited to, personal computers, laptops, mini-computers, mainframe computers, any non-transient and tangible machine that can execute a machine-readable code, cloud-based servers, distributed server networks, or a network of computer systems. The data processing server 104 may be realized through various web-based technologies such as, but not limited to, a Java web-framework, a.NET framework, a personal home page (PHP) framework, or any web-application framework. In various aspects of the present disclosure, the data processing server 104 may be configured to perform data processing and / or data storage operations for text-to SQL translation (i.e., generation of the SQL code corresponding to the NL input).

[0039] The data processing server 104 may include a data processing circuitry 108, a database 110, and a communication interface 112. The data processing circuitry 108 may include hardware electronic component(s), software(s), logic(s), module(s), and / or codes to perform data processing operation(s) and / or data analysis operation(s) for text-to-SQL translation. Preferably, the data processing circuitry 108 may be supported by LLM(s) 105 for the text-to-SQL translation. Specifically, the data processing circuitry 108 may be configured to analyze the NL input received from the user device 102 and generate the SQL code corresponding to the NL input, using the LLM(s) 105. Moreover, the data processing circuitry 108, by way of the LLM(s) 105, may also be configured to generate hint(s) using historical queries and schema of the database 110. In some aspects of the present disclosure, the data processing circuitry 108 may utilize processor(s) (such as Arduino, raspberry pi and the like). Examples of the data processing circuitry 108 may include, but are not limited to, an Application-Specific Integrated Circuit (ASIC) processor, a Reduced Instruction Set Computing (RISC) processor, a Complex Instruction Set Computing (CISC) processor, a Field-Programmable Gate Array (FPGA), a Programmable Logic Control unit (PLC), and the like. Aspects of the present disclosure are intended to include or otherwise cover any type of the data processing circuitry 108 including known, related art, and / or later developed processing units. In some other aspects of the present disclosure, the LLM(s) 105 may be integrally embedded with the data processing circuitry 108.

[0040] The database 110 may be configured as data storage memory configured to store data, logic, code(s), and / or instructions used by the data processing server 104 for performing various operations related to the generation of the SQL code corresponding to the NL input. According to an embodiment of the present disclosure, the data processing server 104 may be communicatively coupled with external storage medium (not shown) that may support the database 110 by providing additional storage resources. Examples of the database 110 may include, but are not limited to, a Read-Only Memory (ROM), a Random-Access Memory (RAM), a flash memory, a removable storage drive, a hard disk drive (HDD), a solid-state memory, a magnetic storage drive, a Programmable Read Only Memory (PROM), an Erasable PROM (EPROM), and / or an Electrically EPROM (EEPROM). Aspects of the present disclosure are intended to include or otherwise cover any type of the database 110 including known, related art, and / or later developed memories, without deviating from the scope of the present disclosure.

[0041] The communication interface 112 may be configured to enable the data processing server 104 to communicate with various other entities of the system 100 via the network 106. Examples of the communication interface 112 may include, but are not limited to, a MODEM, a network interface such as an Ethernet card, a communication port, and / or a Personal Computer Memory Card International Association (PCMCIA) slot and card, an antenna, a radio frequency (RF) transceiver, amplifier(s), a tuner, oscillator(s), a digital signal processor, a coder-decoder (CODEC) chipset, a Subscriber Identity Module (SIM) card, and a local buffer circuit. It will be apparent to a person of ordinary skill in the art that the communication interface 112 may include any device and / or apparatus capable of providing wireless or wired communications between the data processing server 104 and various other entities of the system 100.

[0042] The network 106 may include suitable logic, circuitry, and interfaces that may be configured to provide several network ports and several communication channels for transmission and reception of data related to operations of various entities of the system 100. Each network port may correspond to a virtual address (or a physical machine address) for transmission and reception of the communication data. For example, the virtual address may be an Internet Protocol Version 4 (IPV4) (or an IPV6 address) and the physical address may be a Media Access Control (MAC) address. The network 106 may be associated with an application layer for implementation of communication protocols based on communication requests from the various entities of the system 100. The communication data may be transmitted or received via the communication protocols. Examples of the communication protocols may include, but are not limited to, Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), Domain Network System (DNS) protocol, Common Management Interface Protocol (CMIP), Transmission Control Protocol and Internet Protocol (TCP / IP), User Datagram Protocol (UDP), Long Term Evolution (LTE) communication protocols, or any combination thereof. In some aspects of the present disclosure, the communication data may be transmitted or received via at least one communication channel of several communication channels in the network 106. The communication channels may include, but are not limited to, a wireless channel, a wired channel, a combination of wireless and wired channel thereof. The wireless or wired channel may be associated with a data standard which may be defined by one of a Local Area Network (LAN), a Personal Area Network (PAN), a Wireless Local Area Network (WLAN), a Wireless Sensor Network (WSN), Wireless Area Network (WAN), Wireless Wide Area Network (WWAN), a metropolitan area network (MAN), a satellite network, the Internet, an optical fiber network, a coaxial cable network, an infrared (IR) network, a radio frequency (RF) network, and a combination thereof. Aspects of the present disclosure are intended to include or otherwise cover any type of communication channel, including known, related art, and / or later developed technologies. The network 106 may be capable of carrying a vast range of information resources and services, such as the interlinked hypertext documents and applications of the World Wide Web (WWW), electronic mail, internet telephony, video calling, data and file sharing, etc.

[0043] Although FIG. 1 illustrates one exemplary architecture of the system 100, various changes may be made to FIG. 1. Further, the system 100 may include any number of components in addition to the components shown in FIG. 1. Furthermore, various components in FIG. 1 may be combined, further subdivided, or omitted and additional components may be added according to particular needs, as may be limited by the boundaries within the scope of the present disclosure. For example, in some other embodiments of the present disclosure, the data processing server 104 may not be dependent on the user device 102 to receive the NL input. Rather, the data processing server 104 may include an Input-Output (I / O) interface (as shown later in FIG. 2) to enable the user for providing the NL input and rendering the corresponding SQL code.

[0044] FIG. 2 illustrates a block diagram depicting exemplary components of the data processing server 104 engaged in the generation of the SQL code corresponding to the NL input, in accordance with an exemplary embodiment of the present disclosure. The data processing server 104 may include the data processing circuitry 108, the database 110, the communication interface 112, the I / O interface 200, and a console host 202, communicatively coupled to each other by way of a first communication bus 203. The embodiment of the data processing server 104 as shown in FIG. 2 is for illustration only. Other embodiments of the data processing server 104 may be used without departing from the scope of this disclosure. For example, the data processing server 104 is shown as a single entity in FIG. 2 comprising a variety of operational components. However, it will be appreciated by a person of ordinary skill in the art that the scope of the present disclosure is not limited to it. Rather, the variety of operational components (as presented in FIG. 2), may be deployed in a variety of operational and / or structural forms, at same or different geographical location(s) and / or in same or different functional unit(s), for text-to-SQL translation, without deviating from the scope of the present disclosure. Aspects of the present disclosure are intended to include, or otherwise cover, any configuration of the data processing server 104 (e.g., as a single operational entity or a combination of multiple operational entities), without deviating from the scope of the present disclosure.

[0045] The I / O interface 200 may include interfaces and circuitry to enable the data processing server 104 for receiving input(s) and / or rendering output(s). In some aspects of the present disclosure, the I / O interface 200 may facilitate a user to provide input(s) for maintenance and / or configuration of the data processing server 104. In some other aspects of the present disclosure, the I / O interface 200 may enable the user for providing the NL input and rendering the corresponding SQL code.

[0046] The console host 202 may include suitable logic, circuitry, interfaces, and / or codes that may be configured to enable the communication interface 110 to receive input(s) and / or render output(s) to the user device 102. Moreover, the console host 202 may include suitable circuitry, logic, instructions, and / or codes to host and execute various operations of the computer application running through the application console(s) on the user device 102, by way of which the user of the user device 102 can trigger the data processing server 104 for text-to-SQL translation. In some other aspects of the present disclosure, the console host 202 may provide Graphical User Interfaces (GUIs) (i.e., rendered through the user device 102) to enable user interaction with the data processing server 104. The GUIs may be generated by the data processing server 104, specifically by the console host 202, to enable user interaction via the computer application running through the application console of the user device 102.

[0047] The data processing circuitry 108 may include multiple processors to cater to a variety of operations of the data processing server 104 pertaining to the text-to-SQL translation. As presented through the exemplary embodiment shown in FIG. 2, the data processing circuitry 108 may include a data exchanger 204, a code generator 206, a compiler 208, a code updater 210, a hint generator 212, and a notification generator 214. Various components of the data processing circuitry 208 may be coupled to each other by way of a second communication bus 224. Each component of the data processing circuitry 208 may be implemented through hardware circuitry, software code(s), or a combination thereof. In some aspects of the present disclosure, each component of the data processing circuitry 108 may be realize as a module dedicatedly configured to perform specific operations for generating the SQL code corresponding to the NL input.

[0048] The data exchanger 204 may be configured to enable transfer of data and / or instructions from the database 110 to various components of the data processing circuitry 108. The data exchanger 204 may further be configured to enable a transfer of data and / or instructions (by way of signal(s)) between various other components of the data processing circuitry 108. Furthermore, the data exchanger 204 may be configured to enable the data processing server 104 to receive the NL input from the user device 102 and share SQL code(s) / error notifications to the user via the user device 102.

[0049] Particularly, the data exchange module 204 may be configured to receive the NL input from the user device 102. In some aspects of the present disclosure, the data exchanger 204 may enable the I / O interface 200 to receive the NL input. The data exchanger 204 may further be configured to retrieve verified hint(s) (from multiple hints generated by the data processing circuitry 108 and stored in the database 110) and the schema of the database 110, in receipt of the NL input. Each verified hint is associated with a verified hint-based SQL code and a verified NL description for the verified hint-based SQL code.

[0050] The code generator 206 may be configured to generate the SQL code corresponding to the NL input based on the verified hint(s), the schema of the database 110, and the NL input. Preferably, the code generator 206 may be supported by the LLM(s) 205 for generating the SQL code corresponding to the NL input. Specifically, the code generator 206 may transmit the verified hint(s), the schema of the database 110, and the NL input to the LLM 105. In some aspects of the present disclosure, the schema of the database 110 may indicate segregation of the database 110 into multiple classes, categories, and / or domains. The LLM 105 may analyze the NL input to derive information of an input type (i.e., the class, the category, and / or the domain) of the NL input. Based on the information, using the schema of the database 110, the LLM 105 may analyze the NL input and the schema of the database 110 to identify a portion of the database 110 matching with the input type. Moreover, the LLM 105 using the verified hint(s) may generate the SQL code corresponding to the NL input.

[0051] The compiler 208 may be configured to execute the SQL code on the database 110. Moreover, the compiler 208 may also be configured to determine a presence or an absence of a first execution error based on the execution of the SQL code on the database 110. The first execution error may be generated as NL text indicating a contextual inaccuracy of the SQL code in reference to the schema of the database 110. In other words, the first execution error indicates a contextual mismatch between the SQL code and its corresponding schema of the database 110. In some aspects of the present disclosure, the compiler 208 may be configured to execute the SQL code to determine the absence / presence of the first execution error.

[0052] In an exemplary scenario, when the compiler 208 identifies the first execution error upon the execution of the SQL code on the database 110, the compiler 208 may generate a first update trigger for the code updater 210. In response to the first update trigger the code updater 210 may be configured to update the SQL code using the LLM 105. Moreover, the code updater 210 may also keep a count of identification of the first execution error and / or reception of the first update trigger for the NL input. In some aspects of the present disclosure, when the code updater 210 determines that, for the NL input, the count of identification of the first execution error and / or the count of the reception of the first update trigger is less than a predefined count ‘n’, the code updater 210 may provide the first execution error, the SQL code, and the schema of the database 110 to the LLM 105. The LLM 105 may analyze the first execution error and update the SQL code using the first execution error, the SQL code, and the schema of the database 110. At each iteration, the compiler 208 compiles (or executes) the SQL code and determines whether the first execution error is present or absent. When the compiler 208 determines that the first execution error is present upon the execution of the SQL code on the database 110 after the ‘nth’ iteration, the compiler 208 may generate an error trigger for the notification generator 214. Based on the error trigger, the notification generator 214 may generate an error notification for the NL input, that may be rendered to the user through the user device 102. In another scenario, when the compiler 208 determines that the first execution error is absent upon the execution of the SQL code on the database 110 within the ‘n’ iteration, the compiler 208 may generate a success trigger for the notification generator 214. Based on the success trigger, the notification generator 214 may render the SQL code to the user through the user device 102.

[0053] The hint generator 212 may be configured to retrieve from historical queries and the schema of the database 110. In some aspects of the present disclosure, the historical queries may be provided by a user by way of the I / O interface 200 or through the user device 102. Thereafter, the historical queries may be stored in the database 210. Similarly, the schema of the database 110 may also be stored in the database 110. Moreover, the hint generator 212, using the LLM 105, may generate hints based on the historical queries and the schema of the database 110.

[0054] Each hint may be associated with a corresponding hint-based SQL code and a NL description for the hint-based SQL code. Preferably, each hint may encapsulate complex contextual information of the schema of the database 110. For example, each hint may include information for managing the complexity of the database 110 with respect to the schema of the database 110 and the NL input. Therefore, the hints may support the LLM 105 to provide efficient translation of the NL input into the corresponding SQL code in terms of computational latency and translation accuracy.

[0055] Moreover, the hint generator 212 may be configured to share the hints with the compiler 208. The compiler 208 may derive the hint-based SQL code from each hint and may execute the hint-based SQL code on the database 110. Preferably, the compiler 208 may also be configured to determine whether a second execution error is present or absent upon the execution of the hint-based SQL code on the database 110. In some aspects of the present disclosure, the second execution error is a NL text that indicates a contextual inaccuracy of the hint-based SQL code in reference to the schema of the database 110 for the hint-based SQL code. In other words, the second execution error indicates a contextual mismatch between the hint-based SQL code and its corresponding schema of the database 110.

[0056] In an exemplary scenario, when the compiler 208 identifies the second execution error upon the execution of the hint-based SQL code from the historical hint on the database 110, the compiler 208 may generate a second update trigger for the code updater 210. In response to the second update trigger, the code updater 210 may be configured to update the hint-based SQL code using the LLM 105. Moreover, the code updater 210 may also keep a count of identification of the second execution error and / or reception of the second update trigger for the NL input. In some aspects of the present disclosure, when the code updater 210 determines that, for the NL input, the count of identification of the second execution error and / or the count of the reception of the second update trigger is less than the predefined count ‘n’, the code updater 210 may provide the second execution error, the hint-based SQL code, and the schema of the database 110 to the LLM 105.

[0057] The LLM 105 may analyze the second execution error and update the hint-based SQL code using the second execution error, the hint-based SQL code, and the schema of the database 110. At each iteration, the compiler 208 compiles (or executes) the SQL code and determines whether the second execution error is present or absent. When the compiler 208 determines that the second execution error is present upon the execution of the SQL code on the database 110 after the ‘n’ iteration, the compiler 208 may discard the historical hint. In another scenario, when the compiler 208 determines that the second execution error is absent upon the execution of the hint-based SQL code on the database 110 within the ‘n’ iteration, the compiler 208 may identify the hint-based SQL code as the verified hint-based SQL code, the NL description for the verified hint-based SQL code as the verified NL description, and a hint corresponding to the verified hint-based SQL code and the verified NL description as the verified hint.

[0058] Various components of the data processing circuitry 108 are presented to illustrate the data processing operations performed by the data processing server 104. It will be apparent to a person having ordinary skill in the art that various components in the data processing circuitry 108 are for illustrative purposes and not limited to any specific combination of hardware circuitry and / or software.

[0059] The database 110 may be configured to store data of the data processing server 104 for generating the SQL code corresponding to the NL input. In some aspects of the present disclosure, the database 110 may be segregated into multiple repositories, each configured to store a specific type of data. According to the exemplary embodiment as presented through FIG. 2, the database 110 may include an instructions repository 216, a database schema repository 218, a historical data repository 220, and a hint repository 222.

[0060] The instruction repository 216 may be configured to store instructions and / or codes for operation(s) to be performed by various components of the data processing server 104. According to an embodiment of the present disclosure, the instructions repository 216 may be configured as a non-transitory storage medium. Examples of the instruction repository 216 configured as the non-transitory storage medium include hard drives, solid-state drives, flash drives, Compact Disk (CD), Digital Video Disk (DVD), and the like. Aspects of the present disclosure are intended to include or otherwise cover any type of non-transitory storage medium as the instruction repository 216, without deviating from the scope of the present disclosure.

[0061] The database schema repository 218 may be configured to store data associated with the schema of the database 110, which is utilized by various components of the data processing circuitry 108 for several operations such as, related to the generation of the SQL code corresponding to the NL input and generation and / or verification of the hints. The schema of the database 110 may be considered as a blueprint that defines how data is organized in the database 110. Typically, the schema of the database 110 may represent a logical design that includes a structure (in the form of tables, columns, etc.), data relationships, and constraints of the database 110. Particularly, the schema of the database 110 may be utilized to retrieve several attributes of the database 110 such as, related to data modelling, data management, security, data analysis, etc. Aspects of the present disclosure are intended to include, or otherwise cover, any type of usage of the schema of the database 110, including and beyond those presented herein, without deviating from the scope of the present disclosure.

[0062] The historical data repository 220 may be configured to store historical data. The historical data may include historical queries (i.e., historical NL inputs), hint-based SQL codes, and / or NL description for each hint-based SQL code. In some aspects of the present disclosure, the historical data repository 220 may store the historical data in the form of data entries, where each data entry includes a historical query, a corresponding hint-based SQL code, and a corresponding NL description.

[0063] The hints repository 222 may be configured to store data associated with the hints generated by the data processing circuitry 108. The data associated with the hints may correspond to the verified hints generated by the data processing circuitry 108. In some aspects of the present disclosure, the hints repository 222 may also store details of the hints discarded by the data processing circuitry 222 based on verification of the hints.

[0064] It will be apparent to a person of ordinary skill in the art that the repositories in the database 110 are presented based on the functionality of the data processing server 104 and are not limited to those disclosed. The database 122 may have any configuration, combination and / or count of repositories without deviating from the scope of the present disclosure.

[0065] Although FIG. 2 illustrates one example of the data processing server 104, various changes may be made to FIG. 2. Further, the data processing server 104 may include any number of components in addition to those shown in FIG. 2, without deviating from the scope of the present disclosure. Further, various components in FIG. 2 may be combined, further subdivided, or omitted and additional components may be added according to particular needs.

[0066] FIG. 3 illustrates a block diagram depicting exemplary components of a Large Language Model (LLM) 105 used in the generation of the SQL code corresponding to the NL input, in accordance with an exemplary embodiment of the present disclosure. The embodiment of the LLM 105 shown in FIG. 3 is for illustration only, where the LLM 105 operates as a ‘data transformer’. Other embodiments of the LLM 105 may be used without departing from the scope of this disclosure.

[0067] The LLM 105 may include a model interface 105 coupled to the data processing server 104 and configured to receive input(s) and render output(s) to the data processing server 104. The model interface 302 is further coupled to an input embedding layer 304-1 configured to convert categoric data into numeric data. Specifically, the input embedding layer 304-1 may be utilized by the LLM 105 to convert the NL input (i.e., NL text) to a simpler format for the LLM 105 (i.e., easy to encode, decode, perform logical and / or mathematical operations, etc.). For example, in the case of text data, each word or character may be a category. The input embedding layer 306-1 transforms such words or characters into dense vectors of fixed size, which can be processed by the LLM 105. The vectors represent semantic meaning of the words, which is crucial for the LLM's 105 to understand a context of the text.

[0068] The input embedding layer 304-1 is coupled to encoder(s) 306. Each encoder 306 may include a first set of self-attention layer(s) 308-1 (hereinafter interchangeably referred to and designated as first attention layer(s) 308-1) and a first set of feed-forward Neural Network layer(s) 310-1 (hereinafter interchangeably referred to and designated as ‘first feed forward layer(s) 310-1). Input from the input embedding layer 306-1 is received by an attention layer of the first encoder 306-1 and its output is fed to a feed-forward layer of the first encoder 306-1, and the sequence repeats for all the encoder(s) 306 to generate an encoder output.

[0069] The decoder(s) 312 are coupled with the encoder(s) 306 and an outer embedding layer 304-2. The outer embedding layer 304-2 supports the decoder(s) like the input embedding layer 304-1 supports the encoder(s) 306, as described hereinabove. The decoder(s) 312 includes a second set of attention layer(s) 308-2 (hereinafter second attention layer(s) 308-2) and a second set of feed-forward Neural Network layer(s) 310-2 (hereinafter second feed-forward layer(s) 310-2). The second feed-forward layers 310-2 may include self-attention layer(s) and / or encoder-decoder attention layer(s). The encoder-decoder layer(s) supports the decoder(s) 312 to focus on critical parts (or chunks) of the encoder output. In accordance with the operation of the encoder(s) 310, as presented hereinabove, the encoder output is received by a self-attention layer of a first decoder 312-1 and its output is fed to a feed-forward layer of the first decoder 312-1, and the sequence repeats for all the decoder(s) 312 to generate a decoder output. Thereafter, the decoder output is fine-tuned by a fine-tuning layer 314 coupled to the decoder(s) 312 to generate the SQL code. The fine-tuning layer 314 is also coupled to the model interface 302 to transmit the SQL code to the data processing server 104.

[0070] Although FIG. 3 illustrates one example of the LLM 105, various changes may be made to FIG. 3. Further, the LLM 105 may include any number of components in addition to those shown in FIG. 3, without deviating from the scope of the present disclosure. Further, various components in FIG. 3 may be combined, further subdivided, or omitted and additional components may be added according to particular needs.

[0071] FIG. 4 presents a process-flow diagram depicting a process 400 for generating the verified hints, in accordance with an exemplary embodiment of the present disclosure. The process 400 is presented by way of step 402 through step 414.

[0072] At step 402, a selective hint extraction prompt is received by the LLM 105. The selective hint extraction prompt corresponds to a retrieval of the historical queries and the schema of the database 110.

[0073] At step 404, the LLM 105 extracts hints using the historical queries and the database schema. Each hint includes a hint-based SQL code and a description to the hint-based SQL code.

[0074] At step 406, the compiler 208 executes the hint-based SQL code on the database 110.

[0075] At step 408, based on the execution of the hint-based SQL code on the database 110, the compiler 208 determines whether the second execution error is present or absent. When the presence of the second execution error is identified by the compiler 208, the process 400 proceeds to step 410. Else, when the compiler 208 identifies the absence of the second execution error, the process 400 moves to step 414.

[0076] At step 410, the LLM 105 receives the second execution error, the hint-based SQL code, and the schema of the database 110.

[0077] At step 412, based on the second execution error, the hint-based SQL code, and the schema of the database 110, the LLM 105 updates the hint-based SQL code. The process 400 further falls back to step 406 for execution of the updated hint-based SQL code. In some aspects of the present disclosure, the iterative update of the hint-based SQL code occurs for at most the predefined count ‘n’ of iterations. When, after the predefined count ‘n’ of iterations, the compiler 208 identifies the presence of the second execution error, the hint-based SQL code is discarded, and the process 400 repeats for a next historical query.

[0078] At block 414, based on the absence of the second execution error (i.e., the hint-based SQL code is successfully compiled, and the NL description aligns with the hint-based SQL code), the compiler 208 identifies the historical hint as the verified hint, and the process 400 repeats for the next historical query.

[0079] Although FIG. 4 illustrates one example of the process 400, various changes may be made to FIG. 4. Further, the process 400 may be implemented through any number of components in addition to those shown in FIG. 4, without deviating from the scope of the present disclosure. Furthermore, various components involved in the operations as presented through in FIG. 4 may be combined, further subdivided, or omitted and additional components may be added according to particular needs. For example, the process 400 may engage one or more LLM(s) 105 in different embodiments for generating verified hints, However, as will be apparent to a person skilled in the art, utilization of the one or more LLM(s) 105 in different embodiments should not be considered as a limitation to the present disclosure.

[0080] FIG. 5 presents a process-flow diagram depicting a process 500 for generating the SQL code corresponding to the NL input using the verified hints, in accordance with an exemplary embodiment of the present disclosure. The process 500 is presented by step 502 through step 514.

[0081] At step 502, the LLM 105 receives the verified hints, the NL input, and the schema of the database 110.

[0082] At step 504, the LLM 105 generates the SQL code for the NL input based on the verified hints, the NL input, and the schema of the database 110.

[0083] At step 506, the compiler 208 executes the SQL code on the database 110.

[0084] At step 508, based on the execution of the SQL code on the database 110, the compiler 208 determines whether the first execution error is present or absent. When the presence of the first execution error is identified by the compiler 208, the process 500 proceeds to step 510. Else, when the compiler 208 identifies the absence of the first execution error, the process 500 moves to step 514.

[0085] At step 510, the LLM 105 receives the first execution error, the SQL code, and the schema of the database 110.

[0086] At step 512, based on the first execution error, the SQL code, and the schema of the database 110, the LLM 105 updates the SQL code. The process 500 further falls back to step 506 for execution of the updated SQL code. In some aspects of the present disclosure, the iterative update of the SQL code occurs for at most the predefined count ‘n’ of iterations. When, after the predefined count ‘n’ of iterations, the compiler 208 identifies the presence of the first execution error, the error notification is generated and rendered to the user through the user device 102.

[0087] At block 514, based on the absence of the first execution error (i.e., the SQL code is successfully compiled, and the SQL code and its NL description align with each other), the compiler 208 verifies the SQL code for the NL input and renders the SQL code for the NL input to the user through the user device 102.

[0088] Although FIG. 5 illustrates one example of the process 500, various changes may be made to FIG. 5. Further, the process 500 may be implemented through any number of components in addition to those shown in FIG. 5, without deviating from the scope of the present disclosure. Furthermore, various components involved in the operations as presented through in FIG. 5 may be combined, further subdivided, or omitted and additional components may be added according to particular needs. For example, the process 500 may engage one or more LLM(s) 105 in different embodiments for generating verified hints, However, as will be apparent to a person skilled in the art, utilization of the one or more LLM(s) 105 in different embodiments should not be considered as a limitation to the present disclosure.

[0089] FIG. 6 presents a flowchart depicting a method 600 for generating the SQL code corresponding to the NL input, in accordance with an exemplary embodiment of the present disclosure. The method 600 is presented by way of block 602 through block 618.

[0090] At block 602, the data processing server 104 may receive the NL input from the user device 102.

[0091] At block 604, in receipt of the NL input, the data processing server 104 may retrieve the verified hints and the schema of the database 110. Each verified hint may be associated with a verified hint-based SQL code and a verified NL description for the verified hint-based SQL code.

[0092] Particularly, for verifying the hints, the data processing server 104 may retrieve the historical queries and the schema of the database 110. Moreover, the data processing server 104, by way of the LLM 105, may generate multiple hints using the historical queries and the schema of the database 110. Each hint may be associated with a hint-based SQL code and a NL description for the hint-based SQL code. Each hint may also encapsulate complex contextual information of the schema of the database 110. The data processing server 104 may further execute the hint-based SQL code on the database 110. Furthermore, the data processing server 104 may determine whether the second execution error is present upon the execution of the hint-based SQL code on the database 110. In response to the presence of the second execution error, the data processing server 104 may iteratively update the hint-based SQL code for at most the predefined count ‘n’ of iterations. For iterative update of the hint-based SQL code, the data processing server 104 may utilize the LLM(s) 105 using the second execution error, the hint-based SQL code, and the schema of the database 110, as inputs. In response to the determination that the second execution error is absent upon the execution of the hint-based SQL code on the database 110, the data processing server 104 may identify the hint-based SQL code as the verified hint-based SQL code, the NL description for the verified hint-based SQL code as the verified NL description, and a hint corresponding to the verified hint-based SQL code and the verified NL description as the verified hint.

[0093] At block 606, the data processing server 104 may utilize the LLM(s) 105 to generate the SQL code corresponding to the NL input based on the verified hints, the schema of the database 110, and the NL input.

[0094] At block 608, the data processing server 104 may execute the SQL code on the database 110.

[0095] At block 610, the data processing server 104 may determine whether the first execution error is present upon the execution of the SQL code on the database 110. The first execution error may be a NL text that indicates the contextual inaccuracy of the SQL code in reference to the NL input. When the data processing server 104 determines that the first execution error is present upon the execution of the SQL code on the database 110, the method 600 proceeds to block 612. Else, when the data processing server 104 determines that the first execution error is absent upon the execution of the SQL code on the database 110, the method 600 proceeds to block 618.

[0096] At block 612, the data processing server 104 may identify a count of update iteration for the SQL code. When the count of update iteration for the SQL code is less than the predefined count ‘n’, the method 600 proceeds to block 614. Else, the method 600 proceeds to block 616.

[0097] At block 614, in response to the presence of the first execution error, the data processing server 104 by the LLM(s) 105, may update the SQL using the first execution error, the SQL code, and the schema of the database 110. The method 600 further falls back to block 608 for iterative analysis.

[0098] At block 616, the data processing server 104 may render the error notification through the user device 102 based on the determination that the first execution error is present upon the execution of the SQL code on the database 110 after updating the SQL code by the LLM(s) 105 for the predefined count ‘n’ of iterations.

[0099] At block 618, the data processing server 104 may render the SQL code through the user device 102 based on the determination that the first execution error is absent upon the execution of the SQL code on the database 110 within the predefined count ‘n’ of iterations.

[0100] Now, referring to the technical abilities and advantageous effects, the present disclosure provides the system 100 to generate SQL codes corresponding to NL text inputs. The system 100 introduces autonomous generation of hint using historical queries. Hints are SQL codes along with their Natural Language descriptions generated using the LLM(s) 105. These NL descriptions provide a structured representation of the query, outlining the referenced tables, their relationships, and the manner in which they are joined within the schema of the database 110. The hints are derived from historical queries even though not being explicitly present in the historical queries. These derived hints encapsulate how complexity with respect to schema and Natural Language input is to be handled. Notably, the system 100 makes the generation of SQL corresponding to the NL text input entirely automated, eliminating the need for human intervention.

[0101] Moreover, the system 100 leverages the curated hints to enhance the accuracy and efficiency of SQL generation from user-provided Natural Language queries. These hints serve as contextual guides for the LLM(s) 105, providing insights into the schema structure, table relationships, required joins, and relevant SQL functions. By incorporating this information, the system 100 gains a deeper understanding of the underlying database 100, enabling it to generate precise and semantically correct SQL codes while handling complex query structures more effectively. The abovementioned advantages of the system 100 can be backed through a set of results as presented through Table 1 hereinbelow. Table 1 represents a throughput comparison (in terms of execution accuracy) of the results obtained while testing the results of the disclosed system 100 and comparing them with few contemporary Text2SQL translators on a variety of datasets.TABLE 1Execution AccuracyChal-DatasetMethodSimpleModeratelengingTotalBIRDBaseline61%38%41%54.1%  Disclosed69%52%56%62.38%  System 100SPIDERBaseline———46%COMPLEXDisclosed———63%System 100ACMEBaseline———22%INSURANCEKG-SQL———54.2%  Disclosed———77.14%  System 100BIRD-SDSBaseline34%57%40%48%(provided byCHESS66%41%50%55%CHESS-SQL)Disclosed68%54%50%61.9%  System 100

[0102] Moreover, it has also been observed that the latency of the Text2SQL translation by the system 100 of the present disclosure is also significantly less than the other contemporary Text2SQL translators, which makes the system 100 efficient to be utilized for practical applications. For example, the processing latency for a SQL code generated using ‘CHESS’ method (i.e., a state of art system used for Text2SQL translation) was observed to be between 480-600 seconds per query, whereas the same has been generated between 30-120 seconds by the disclosed system 100 of the present disclosure. It must be noted that both the methods (i.e., ‘CHESS’, and the method 600 as presented in the present disclosure) are tested under same testing environment (i.e., same testing conditions and on the same processing hardware).

[0103] Those skilled in the art will appreciate that the methodology described herein in the present disclosure may be carried out in other specific ways than those set forth herein in the above disclosed embodiments without departing from essential characteristics and features of the present invention. The above-described embodiments are therefore to be construed in all aspects as illustrative and not restrictive.

[0104] The drawings and the forgoing description give examples of embodiments. Those skilled in the art will appreciate that one or more of the described elements may well be combined into a single functional element. Alternatively, certain elements may be split into multiple functional elements. Elements from one embodiment may be added to another embodiment. For example, orders of processes described herein may be changed and are not limited to the manner described herein. Any combination of the above features and functionalities may be used in accordance with one or more embodiments.

[0105] In the present disclosure, each of the embodiments has been described with reference to numerous specific details which may vary from embodiment to embodiment. The foregoing description of the specific embodiments disclosed herein may reveal the general nature of the embodiments herein that others may, by applying current knowledge, readily modify and / or adapt for various applications such specific embodiments without departing from the generic concept, and, therefore, such adaptations and modifications are intended to be comprehended within the meaning of the disclosed embodiments. It is to be understood that the phraseology or terminology employed herein is for the purpose of description and is not limited in scope.

Claims

1. A method for generating Structured Query Language (SQL) code corresponding to a Natural Language (NL) input, the method comprising:receiving the NL input from a user device;retrieving, from a database in receipt of the NL input, one or more verified hints of a plurality of hints and a schema of the database, wherein each verified hint of the one or more verified hints is associated with a verified hint-based SQL code and a verified NL description for the verified hint-based SQL code, and wherein each of the plurality of hints encapsulates complex contextual information of the schema of the database; andgenerating, by at least one Large Language Model (LLM), the SQL code corresponding to the NL input based on the one or more verified hints, the schema of the database, and the NL input.

2. The method of claim 1, further comprising:executing the SQL code on the database;determining whether a first execution error is present upon the execution of the SQL code on the database; andin response to the presence of the first execution error, iteratively updating the SQL code for at most a predefined count of iterations by the at least one LLM using the first execution error, the SQL code, and the schema of the database.

3. The method of claim 2, further comprising:rendering the SQL code through the user device based on a determination that the first execution error is absent upon the execution of the SQL code on the database; andrendering an error notification through the user device based on the determination that the first execution error is present upon the execution of the SQL code on the database after updating the SQL code by the at least one LLM for the predefined count of iterations.

4. The method of claim 2, wherein the first execution error is a NL text that indicates a contextual inaccuracy of the SQL code in reference to the NL input.

5. The method of claim 1, further comprising:retrieving, from the database, a plurality of historical queries and the schema of the database; andgenerating, by the at least one LLM, the plurality of hints using the plurality of historical queries and the schema of the database, wherein each hint of the plurality of hints is associated with a hint-based SQL code and a NL description for the hint-based SQL code.

6. The method of claim 5, further comprising:executing the hint-based SQL code on the database;determining whether a second execution error is present upon the execution of the hint-based SQL code on the database; andin response to the presence of the second execution error, iteratively updating, using the second execution error, the hint-based SQL code, and the schema of the database, the hint-based SQL code for at most a predefined count of iterations by the at least one LLM.

7. The method of claim 6, wherein the second execution error is a NL text that indicates a contextual inaccuracy of the hint-based SQL code in reference to the NL description for the hint-based SQL code.

8. The method of claim 6, further comprises identifying, in response to a determination that the second execution error is absent upon the execution of the hint-based SQL code on the database the hint-based SQL code as the verified hint-based SQL code, the NL description for the verified hint-based SQL code as the verified NL description, and a hint corresponding to the verified hint-based SQL code and the verified NL description as a verified hint.

9. The method of claim 1, wherein the at least one LLM utilizes a structured prompt to generate the plurality of hints.

10. A system to generate Structured Query Language (SQL) code corresponding to a Natural Language (NL) input, the system comprising:a database; anddata processing circuitry coupled to the database, wherein the data processing circuitry is configured to:receive the NL input from a user device;retrieve, from the database in receipt of the NL input, one or more verified hints of a plurality of hints and a schema of the database, wherein each verified hint of the one or more verified hints is associated with a verified hint-based SQL code and a verified NL description for the verified hint-based SQL code, and wherein each of the plurality of hints encapsulates complex contextual information of the schema of the database; andgenerate, by at least one Large Language Model (LLM), the SQL code corresponding to the NL input based on the one or more verified hints, the schema of the database, and the NL input.

11. The system of claim 10, wherein the data processing circuitry is further configured to:execute the SQL code on the database;determine whether a first execution error is present upon the execution of the SQL code on the database; andin response to the presence of first execution error, iteratively update the SQL code for at most a predefined count of iterations by the at least one LLM using the first execution error, the SQL code, and the schema of the database.

12. The system of claim 11, wherein the data processing circuitry is further configured to:render the SQL code through the user device based on a determination that the first execution error is absent upon the execution of the SQL code on the database; andrender an error notification through the user device based on the determination that the first execution error is present upon the execution of the SQL code on the database after updating the SQL code by the at least one LLM for the predefined count of iterations.

13. The system of claim 11, wherein the first execution error is a NL text that indicates a contextual inaccuracy of the SQL code in reference to the NL input.

14. The system of claim 10, wherein the data processing circuitry is further configured to:retrieve, from the database, a plurality of historical queries and the schema of the database; andgenerate, by the at least one LLM, the plurality of hints using the plurality of historical queries and the schema of the database, wherein each hint of the plurality of hints is associated with a hint-based SQL code and a NL description for the hint-based SQL code.

15. The system of claim 14, wherein the data processing circuitry is further configured to:execute the hint-based SQL code on the database;determine whether a second execution error is present upon the execution of the hint-based SQL code on the database; andin response to the presence of the second execution error, iteratively updating, using the second execution error, the hint-based SQL code, and the schema of the database, the hint-based SQL code for at most a predefined count of iterations by the at least one LLM.

16. The system of claim 15, wherein the second execution error is a NL text that indicates a contextual inaccuracy of the hint-based SQL code in reference to the NL description for the hint-based SQL code.

17. The system of claim 15, wherein the data processing circuitry is further configured to identify, in response to a determination that the second execution error is absent upon the execution of the hint-based SQL code on the database the hint-based SQL code as the verified hint-based SQL code, the NL description for the verified hint-based SQL code as the verified NL description, and a hint corresponding to the verified hint-based SQL code and the verified NL description as a verified hint.

18. The system of claim 10, wherein the at least one LLM utilizes a structured prompt to generate the plurality of hints.

19. A computer program product for generating Structured Query Language (SQL) code corresponding to a Natural Language (NL) input, the computer program product comprising computer-executable instructions that are stored on a non-transitory computer-readable medium and that, when executed by a data processing circuitry performs operations comprising:receiving the NL input from a user device;retrieving, from a database in receipt of the NL input, one or more verified hints of a plurality of hints and a schema of the database, wherein each verified hint of the one or more verified hints is associated with a verified hint-based SQL code and a verified NL description for the verified hint-based SQL code and wherein each of the plurality of hints encapsulates complex contextual information of the schema of the database; andgenerating, by at least one Large Language Model (LLM), the SQL code corresponding to the NL input based on the one or more verified hints, the schema of the database, and the NL input.