Constraint-Guided Database Query Generation From Natural Language

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Machine learning algorithms (MLAs) often output predictions that are incompatible with known conditions or each other, leading to problematic outputs, and users face difficulties in writing database queries, especially those unfamiliar with computer programming.

Innovation Solution

A method and system that utilize a pipeline of MLAs trained to predict classes, applying constraints to their outputs to generate accurate database queries from natural language inputs, allowing users to refine queries based on user feedback and constraints.

Engineering Contradictions & Design Principles

VSEngineering 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

Engineering Contradiction:
Improveease of query generationVSAvoidquery accuracy
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The patent introduces constraints as intermediary elements that mediate between MLA predictions and final query generation. These constraints encode domain knowledge and business rules, filtering and adjusting MLA outputs to ensure compatibility and accuracy before generating the final database query.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system implements feedback loops where constraint violations are detected and used to refine MLA predictions. When predictions fail to satisfy constraints, the system adjusts the predictions iteratively until compatibility is achieved, ensuring reliable query generation while maintaining ease of operation.

Inventive Principle:
Principle #23Feedback

2Adaptability or versatility

If multiple MLAs are used to predict different aspects of the query, then functionality is improved, but device complexity increases

Engineering Contradiction:
Improvequery prediction capabilityVSAvoidpipeline complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent segments the query generation task into multiple independent prediction components, each handled by a specialized MLA. This segmentation allows each model to focus on specific aspects (SELECT fields, WHERE conditions, etc.), improving overall capability while managing complexity through modular architecture.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The constraint satisfaction framework serves as a universal mechanism that handles all types of predictions from multiple MLAs. This multi-functional approach allows the same constraint system to manage diverse prediction types, reducing overall system complexity despite multiple specialized components.

Inventive Principle:
Principle #6Universality (Multi-functionality)

3Manufacturing precision

If constraints are applied to filter MLA outputs, then manufacturing precision is improved, but loss of information increases

Engineering Contradiction:
Improveprediction accuracyVSAvoidprobability distribution information
Core Design Contradiction:
Manufacturing precisionVSLoss of information

Solution Approach 1:

The patent changes parameters of the probability distribution to satisfy constraints while preserving as much information as possible. Instead of simply filtering out predictions, the system adjusts probability values and re-normalizes distributions, maintaining the relative ordering and uncertainty information while ensuring constraint compliance.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS12524402B2Systems and methods for using constraints to generate database queries
Publication Date: 2026.01.13 SERVICENOW INC
  • US12524402B2 patent drawing
  • US12524402B2 patent drawing
  • US12524402B2 patent drawing

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.