Schema-Aware ML Prompt Augmentation for SQL Query Engines

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing large language models (LLMs) face challenges in handling multiple use cases due to the 'lost in the middle' phenomenon, where performance degrades when relevant information is not at the beginning or end of the context, leading to low semantic and task accuracy.

Innovation Solution

The integration of ML automation within a database system to dynamically engineer and augment linguistic prompts using metadata and vector store information, narrowing the search space to relevant database information, and leveraging ML models for prompt engineering to enhance LLM inferencing accuracy and speed.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If overgeneralized prompts are used to accommodate multiple use cases, then adaptability is improved, but model performance degrades due to the 'lost in the middle' phenomenon

Engineering Contradiction:
Improveprompt reusabilityVSAvoidmodel performance
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent segments the prompt into modular components: a static template portion and dynamic parameter portions. This allows the prompt to be reused across different use cases by simply changing parameters, while keeping the relevant information concentrated and accessible, thus avoiding the 'lost in the middle' phenomenon.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a new dimension of prompt organization by using structured templates with designated parameter slots. This transforms the flat, monolithic prompt structure into a multi-dimensional structure where static and dynamic elements are clearly separated, improving both reusability and performance.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Reliability

If handcrafted prompts are used for specific tasks, then task accuracy is improved, but adaptability deteriorates as prompts cannot be reused for different use cases

Engineering Contradiction:
Improvetask accuracyVSAvoidprompt reusability
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent creates universal prompt templates that can serve multiple functions across different use cases. The template structure is designed to be adaptable to various tasks by changing the parameter values, making a single prompt design serve multiple purposes while maintaining task-specific accuracy.

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

Solution Approach 2:

The patent utilizes parameter changes as the key mechanism for adapting prompts to different use cases. By maintaining a consistent template structure and only changing the parameter values (such as topic, entity types, query specifics), the system achieves both high task accuracy and broad adaptability.

Inventive Principle:
Principle #35Parameter changes

3Adaptability or versatility

If long context is provided to accommodate multiple use cases, then adaptability is improved, but model performance degrades due to information being lost in the middle

Engineering Contradiction:
Improvecontext coverageVSAvoidsemantic accuracy
Core Design Contradiction:
Adaptability or versatilityVSMeasurement precision

Solution Approach 1:

The patent extracts only the essential and relevant information needed for each specific task from the broader context. By using template parameters to specify exactly what information is needed (e.g., specific entity types, time ranges, locations), the system avoids including irrelevant information in the middle of the context that would be lost.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent performs preliminary action by pre-defining the prompt template structure with clearly marked parameter slots before actual use. This preparation ensures that when the prompt is instantiated with specific parameters, the relevant information is automatically positioned in optimal locations, avoiding the 'lost in the middle' problem.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS20250284688A1Automated Prompt Augmentation And Engineering Using ML Automation In SQL Query Engine
Publication Date: 2025.09.11 ORACLE INT CORP
  • US20250284688A1 patent drawing
  • US20250284688A1 patent drawing
  • US20250284688A1 patent drawing

AI summary

A database system generates a prompt for an LLM or other machine learning (ML) model to narrow the search space to highly relevant information about a database. A distinct instance of a classifier, a clustering algorithm, or a topic modeling model can be trained based on information from ML automation within the database system, respectively for each column or table in the database. Model instances can then be used during generative LLM inferencing to identify relevant sources of data to answer the user's question. Thus, the prompt generation combines ML automation and other ML models or an LLM for topic modeling and schema description.