The invention provides an
improved method for converting a
natural language into an
SQL (Structured
Query Language) based on a large
language model, and relates to the technical field of
natural language processing. The method comprises the following steps: in response to a target language conversion instruction, determining a to-be-converted
natural language indicated by the target language conversion instruction, and
processing a large
language model of the target language conversion instruction. Wherein the to-be-converted natural language comprises a natural language question and a
target database. And then, based on a preset
algorithm, determining field contents associated with the natural language question from a data table included in the
target database. And meanwhile, determining a
knowledge field to which the to-be-converted natural language belongs, and generating professional knowledge information about the
knowledge field based on a preset model. And inputting the natural language question, the
target database, the field content and the professional knowledge information into the large
language model to obtain an
SQL output by the large language model. According to the method, the accuracy of the
SQL generated by the large language model can be improved.