Constraint-Guided Database Query Generation from Natural Language
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Machine learning algorithms (MLAs) often output incompatible predictions due to the lack of defined rules, leading to problematic outputs, and users face difficulties in writing database queries, especially for those unfamiliar with computer programming.
Innovation Solution
A method and system that utilize two MLAs to generate database queries based on natural language input, applying constraints to ensure accurate predictions by selecting classes with the highest predicted probability that satisfy predefined rules, allowing users to refine queries through user input.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If MLAs are used to generate database queries from natural language input, then ease of operation is improved, but reliability deteriorates due to incompatible predictions
Solution Approach 1:
The patent introduces a constraint application module as an intermediary between the MLA predictions and the final query generation. This module receives probability distributions from multiple MLAs, applies constraints to filter incompatible predictions, and selects valid prediction sets. The intermediary resolves the contradiction by mediating between the flexible but unreliable MLA outputs and the requirement for reliable, compatible predictions.
2Reliability
If constraints are applied to MLA output, then reliability is improved, but device complexity increases
Solution Approach 1:
The patent segments the query generation system into distinct functional modules: natural language processing module, multiple specialized MLAs for different prediction tasks, constraint definition module, and constraint application module. Each module has a specific responsibility, making the overall complex system manageable through modular design. The segmentation allows constraints to be applied systematically without requiring complete system redesign.
Solution Approach 2:
The patent implements preliminary action by defining constraints before applying them to MLA predictions. The constraint definition module establishes compatibility rules and business logic constraints in advance, so that when predictions are generated, the constraint application module can efficiently filter incompatible results without complex real-time reasoning. This pre-preparation reduces the computational complexity during query generation.
3Manufacturing precision
If multiple MLAs are used to predict different aspects of queries, then manufacturing precision is improved, but device complexity increases
Solution Approach 1:
The patent implements universality through a unified constraint application module that handles constraints for all multiple MLAs. This single module receives probability distributions from various MLAs (for query type, fields, filters, etc.), applies appropriate constraints based on prediction type, and selects valid predictions. The universal constraint handler reduces the need for separate constraint logic for each MLA, managing complexity while maintaining precision.
Data Source
AI summary
There is disclosed a method of and a system for generating a database query. A natural language input for requesting data from a database is received. A first portion of the natural language input is input to a first machine learning algorithm (MLA). A second portion of the natural language input is input to a second MLA. The first MLA outputs a first probability distribution. The second MLA outputs a second probability distribution. One or more sets of classes from the first probability distribution and the second probability distribution that satisfy a plurality of constraints are determined. A predicted probability is determined for each of the one or more sets of classes. A set of classes having a highest predicted probability from the one or more sets of classes is selected. A database query is generated based on the set of classes.


