Dynamic Vocabularies for Accurate Natural-Language-to-SQL Generation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing language models suffer from hallucinations and lack robustness when transforming natural language to SQL queries due to large, fixed vocabularies, leading to incorrect and inconsistent outputs, especially in domain-specific use cases.
Innovation Solution
Utilize a dynamic vocabulary conditioned by domain-specific information such as SQL features and database schema to generate SQL statements from natural language prompts, reducing hallucinations and improving query accuracy.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If a large fixed vocabulary is used in language models for natural language to SQL transformation, then the model can handle diverse language inputs, but the model produces hallucinations and incorrect outputs
Solution Approach 1:
The patent segments the large fixed vocabulary into multiple specialized vocabularies organized in a hierarchy. Each vocabulary corresponds to specific SQL constructs (e.g., SELECT, JOIN, WHERE) or database concepts. This segmentation allows the model to select appropriate vocabularies for different transformation tasks, improving both coverage and accuracy by avoiding the noise of irrelevant vocabulary terms.
Solution Approach 2:
The patent implements dynamic vocabulary selection where the appropriate vocabulary is chosen based on the input natural language query characteristics. The system dynamically adapts which vocabulary to use during inference, rather than relying on a static fixed vocabulary. This dynamic approach enables the model to adjust its vocabulary usage to match the specific SQL transformation task at hand, reducing hallucinations while maintaining versatility.
2Manufacturing precision
If domain-specific information is integrated into the vocabulary, then query accuracy improves, but system complexity increases
Solution Approach 1:
The patent creates a universal vocabulary framework that serves multiple functions: it supports various SQL dialects, handles different database schemas, and adapts to diverse natural language inputs. The hierarchical vocabulary structure acts as a multi-functional system where the same framework can be applied across different domains and tasks, reducing the need for separate domain-specific models while maintaining high accuracy.
Solution Approach 2:
The patent introduces domain-specific vocabularies as intermediary layers between the natural language input and the SQL generation process. These vocabularies act as mediators that translate domain concepts into structured SQL constructs. By inserting this intermediary vocabulary layer, the system manages complexity by breaking down the direct mapping challenge into manageable vocabulary-based transformations, improving accuracy without overwhelming system complexity.
Data Source
AI summary
Techniques are disclosed herein for generating dynamic vocabularies for conditioning a language model. A dynamic vocabulary is constructed from an input prompt, database schema information for a database to be queried, and programming language information for a programming language to be used for querying the database to condition the language model to predict an output statement in the programming language. The dynamic vocabulary can be included in prompt information that is provided to the language model. The number of tokens in the dynamic vocabulary can be different than a number of tokens included in a vocabulary of the language model. By utilizing a dynamic vocabulary, the language model can be conditioned to predict tokens for the output statement that are contextually consistent with the tokens included the dynamic vocabulary.


