In-Context Text-to-SQL Querying With Execution Consistency Decoding

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing text-to-SQL systems require significant processing power and memory due to the need for large amounts of labeled data and training, limiting their efficiency and accessibility.

Innovation Solution

Utilizing in-context learning with large language models (LLMs) and execution-based consistency decoding to generate SQL queries from natural language, employing a mixture of concise and verbose database description prompts, and selecting queries based on consistent results.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If text-to-SQL systems are trained on large amounts of labeled data, then query generation accuracy is improved, but processing power and memory consumption increase significantly

Engineering Contradiction:
Improvequery generation accuracyVSAvoidprocessing power and memory consumption
Core Design Contradiction:
Measurement precisionVSUse of energy by moving object

Solution Approach 1:

The system performs preliminary actions by generating multiple potential SQL queries through sampling before execution, then validates them through consistency checking. This preliminary generation and validation approach allows the system to achieve high accuracy without requiring extensive training data, thereby reducing processing power and memory consumption compared to traditional training-based approaches.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system implements feedback through execution-based consistency decoding, where generated SQL queries are executed and their results are checked for consistency. This feedback mechanism enables the system to refine and select accurate queries dynamically, achieving high query generation accuracy without relying on large amounts of labeled training data, thus reducing computational resource requirements.

Inventive Principle:
Principle #23Feedback

2Adaptability or versatility

If traditional text-to-SQL training methods are used, then query generation capability is achieved, but significant processing power and memory are required

Engineering Contradiction:
Improvequery generation capabilityVSAvoidprocessing power and memory requirements
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The system employs self-service through in-context learning with few-shot examples, where the model learns query generation capabilities directly from the provided context and database schema without requiring external training infrastructure. This self-service approach enables the system to achieve adaptability and versatility in query generation while significantly reducing device complexity and resource requirements compared to traditional training methods.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system changes parameters by transitioning from trained models to in-context learning with few-shot prompting. This parameter change in the learning approach allows the system to maintain query generation capability while reducing the computational overhead associated with training large models, thereby lowering processing power and memory requirements.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS12554709B2In-context text-to-SQL with reduced labeled data
Publication Date: 2026.02.17 GOOGLE LLC
  • US12554709B2 patent drawing
  • US12554709B2 patent drawing
  • US12554709B2 patent drawing

AI summary

Aspects of the disclosure are directed to methods, systems, and non-transitory computer readable media for automatically generating queries on a database from natural language text using in-context learning to leverage zero-shot and few-shot adaptation capabilities of large language models (LLMs). The methods, systems, and non-transitory computer readable media can consider database information, employ execution based consistency decoding, and employ a mixture of prompts and/or LLMs.