User Questions Repository for Natural Language to SQL Conversion

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Large language models (LLMs) face challenges in directly using natural language questions for structured data querying due to differences in structure, syntax, and semantics between natural language and structured query languages like SQL.

Innovation Solution

A system and method that utilize a user questions repository (UQR) to convert natural language questions into structured queries by prompting a large language model (LLM) with pre-generated questions and metadata, employing techniques like retrieval augmented generation (RAG) for optimized outputs.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If LLMs are trained on general Internet data to provide natural language responses, then the LLMs can converse fluently with users, but the LLMs are insufficient to retrieve and provide accurate answers from structured data databases

Engineering Contradiction:
Improvenatural language conversation capabilityVSAvoidaccuracy of structured data retrieval
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The system segments the data retrieval process into two distinct components: (1) a semantic search component that handles natural language queries using LLMs, and (2) a structured query component that generates precise SQL queries from matched semantic results. This segmentation allows each component to specialize in its strength while compensating for the other's weaknesses.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system introduces an intermediary component that acts as a bridge between natural language queries and structured database queries. This intermediary matches semantic search results with pre-generated SQL queries, ensuring accurate data retrieval while maintaining natural language interaction. The intermediary translates the intent from natural language to structured query format without losing accuracy.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Loss of information

If the service provider shares all data view and table definitions with the LLM to enable complete data querying, then the LLM has access to all necessary information, but the LLM may not be capable of performing optimal data joins when there are many columns, views, and tables

Engineering Contradiction:
Improvecompleteness of data contextVSAvoidcomplexity of data join operations
Core Design Contradiction:
Loss of informationVSDevice complexity

Solution Approach 1:

The system extracts only the necessary data context from the complete database schema by matching semantic search results with relevant pre-generated SQL queries. Instead of providing all table and view definitions to the LLM, the system extracts and provides only those specific queries that are relevant to the user's intent, reducing complexity while maintaining completeness.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The system performs preliminary actions by pre-generating SQL queries for various data views and tables before runtime. These pre-generated queries are stored and matched against semantic search results during execution. This preliminary preparation reduces the real-time complexity of data join operations by having the heavy lifting done in advance.

Inventive Principle:
Principle #10Preliminary action

3Adaptability or versatility

If the LLM is trained to be general-purpose for various tasks, then the LLM can handle diverse user questions, but the LLM cannot infer which specific views or tables from the entire set are most relevant for the question at hand

Engineering Contradiction:
Improveability to handle diverse questionsVSAvoidprecision of relevant data source identification
Core Design Contradiction:
Adaptability or versatilityVSMeasurement precision

Solution Approach 1:

The system implements feedback by matching semantic search results with pre-generated SQL queries and using this match information to identify the most relevant data sources. The feedback loop continuously refines the identification of relevant views and tables by comparing semantic intent with actual query patterns, improving precision while maintaining versatility.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The system introduces an intermediary matching mechanism that connects semantic search results with pre-generated SQL queries. This intermediary component analyzes the match between user intent and available queries to precisely identify which views and tables are most relevant, bridging the gap between general-purpose question handling and specific data source identification.

Inventive Principle:
Principle #24Intermediary (Mediator)

4Productivity

If semantic searching is used for LLMs to search text content, then the searching works well for text data, but the LLMs face significant challenges when users ask questions against structured data stored in tables and columns

Engineering Contradiction:
Improveefficiency of text searchingVSAvoidaccuracy of structured data querying
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The system segments the search process into two specialized paths: semantic search for text content and structured query matching for database tables. Each path is optimized for its data type, with semantic search handling natural language understanding and structured queries handling precise data retrieval, resolving the contradiction between text search efficiency and structured data accuracy.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system introduces an intermediary component that bridges semantic text search and structured database querying. This intermediary matches semantic search results with pre-generated SQL queries, allowing the benefits of both approaches: the natural language understanding of semantic search and the precision of structured queries for table and column data.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS12306828B1Construction of a user questions repository for structured data queries from natural language questions using a large language model
Publication Date: 2025.05.20 NICE LTD
  • US12306828B1 patent drawing
  • US12306828B1 patent drawing
  • US12306828B1 patent drawing

AI summary

A data query system and methods are provided that are configured to intelligently generate structured data queries from natural language questions using large language models (LLMs). The system includes a processor and a computer readable medium operably coupled thereto, the computer readable medium comprising a plurality of instructions stored in association therewith that are accessible to, and executable by, the processor, to perform operations which include receiving a natural language question for structured data, converting the natural language question to embeddings, matching the embeddings to pre-generated questions from a user questions repository (UQR), determining an accuracy of the matching meets or exceeds a threshold similarity, determining, using an LLM and metadata corresponding to the pre-generated questions from the UQR, a structured data query for querying for the structured data, and querying the structured database system using the structured data query.