Hierarchical Query Generation With Schema-Aligned Field Mapping
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional natural language processing systems struggle to generate hierarchical queries that adhere to a database schema, often producing incorrect fields or values due to hallucination and lack of hierarchical structure.
Innovation Solution
A machine learning model is employed to extract key phrases from a text query, arrange them hierarchically, and map them to corresponding fields and values in a database schema, using components like a text encoder, key phrase mapping, operator detection, value detection, Boolean detection, and date generation models to ensure compatibility with the schema.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Extent of automation
If conventional natural language processing models are used to generate queries, then text-to-query transformation is achieved, but the models hallucinate incorrect syntax and do not adhere to database schema
Solution Approach 1:
The query generation process is divided into distinct components: a machine learning model extracts and hierarchically arranges key phrases, while separate detection models (operator, Boolean, date, value) process specific query elements. This segmentation allows each component to specialize in ensuring schema compliance for its portion of the query, thereby maintaining reliability while preserving automation.
Solution Approach 2:
A hierarchical arrangement of key phrases serves as an intermediary structure between the input text query and the final database query. This intermediate representation enables systematic mapping to database schema fields and ensures that the generated query adheres to proper syntax and schema constraints before being executed.
2Productivity
If conventional models generate queries from natural language, then query production is achieved, but hierarchical structure and schema compliance are not maintained
Solution Approach 1:
The machine learning model performs preliminary extraction and hierarchical arrangement of key phrases from the text query before the actual query composition occurs. This preliminary structuring ensures that when the query is composed, the hierarchical relationships and schema compliance are already established, enabling fast generation without sacrificing precision.
Solution Approach 2:
Different detection models (operator detection, Boolean detection, date generation, value detection) are applied to specific portions of the query corresponding to different field types. Each detection model ensures schema compliance for its specialized domain, allowing the system to maintain high precision across diverse query elements while operating efficiently in parallel.
3Reliability
If a comprehensive processing system is implemented to ensure schema compliance, then query accuracy improves, but system complexity increases
Solution Approach 1:
The complex processing system is segmented into modular components: key phrase extraction, hierarchical arrangement, and multiple specialized detection models. Each module has a specific function and can be independently trained and optimized. This segmentation reduces the complexity burden on any single component while collectively achieving high query accuracy through coordinated operation.
Data Source
AI summary
The present disclosure relates to generating hierarchical queries from text queries. A query generation system is configured to encode a text query to obtain a text embedding. Then, the system may select a field of a data schema by comparing the text embedding to a field embedding corresponding to the field. Subsequently, the system may generate a hierarchical query including a value corresponding to the selected field. Some implementations of the system may further include one or more formatting models configured to format values included in the text query.


