LLM4Hint: Leveraging Large Language Models for Hint Recommendation in Offline Query Optimization
Not on the map. Why?
Abstract (arXiv)
Query optimization is essential for efficient SQL query execution in DBMS, and remains attractive over time due to the growth of data volumes and advances in hardware. Existing traditional optimizers struggle with the cumbersome hand-tuning required for complex workloads, and the learning-based methods face limitations in ensuring generalization. With the great success of Large Language Model (LLM) across diverse downstream tasks, this paper explores how LLMs can be incorporated to enhance the generalization of learned optimizers. Though promising, such an incorporation still presents challenges, mainly including high model inference latency, and the substantial fine-tuning cost and suboptimal performance due to inherent discrepancy between the token sequences in LLM and structured SQL execution plans with rich numerical features. In this paper, we focus on recurring queries in offline optimization to alleviate the issue of high inference latency, and propose LLM4Hint that leverages moderate-sized backbone LLMs to recommend query optimization hints. LLM4Hint achieves the goals through: (i) integrating a lightweight model to produce a soft prompt, which captures the data distribution in DBMS and the SQL predicates to provide sufficient optimization features while simultaneously reducing the context length fed to the LLM, (ii) devising a query rewriting strategy using a larger commercial LLM, so as to simplify SQL semantics for the backbone LLM and reduce fine-tuning costs, and (iii) introducing an explicit matching prompt to facilitate alignment between the LLM and the lightweight model, which can accelerate convergence of the combined model. Experiments show that LLM4Hint, by leveraging the LLM's stronger capability to understand the query statement, can outperform the state-of-the-art learned optimizers in terms of both effectiveness and generalization.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 44 of its 67 references that are in the map. First posted on arXiv 4 Jul 2025.
Builds on
44 of 67 references.
References · 44
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023GPT-4 Technical Reportcited by 18,132
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2024Qwen2.5 Technical Reportcited by 4,713
- 2024GPT-4o System Cardcited by 4,467
- 2024Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolutioncited by 4,151
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
32 more
- 2022A Time Series is Worth 64 Words: Long-term Forecasting with Transformerscited by 1,981
- 2023Time-LLM: Time Series Forecasting by Reprogramming Large Language Modelscited by 680
- 2023Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLscited by 667
- 2023One Fits All:Power General Time Series Analysis by Pretrained LMcited by 615
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 465
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 378
- 2015Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networkscited by 305
- 2020AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Promptscited by 246
- 2021TAPEX: Table Pre-training via Learning a Neural SQL Executorcited by 233
- 2023RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQLcited by 191
- 2022N-HiTS: Neural Hierarchical Interpolation for Time Series Forecastingcited by 146
- 2023Table Meets LLM: Can Large Language Models Understand Structured Table Data? A Benchmark and Empirical Studycited by 116
- 2021TABBIE: Pretrained Representations of Tabular Datacited by 111
- 2022TableFormer: Table Structure Understanding with Transformerscited by 93
- 2023Graphix-T5: Mixing Pre-Trained Transformers with Graph-Aware Layers for Text-to-SQL Parsingcited by 93
- 2022TableFormer: Robust Transformer Modeling for Table-Text Encodingcited by 90
- 2023Temporal Data Meets LLM -- Explainable Financial Time Series Forecastingcited by 77
- 2024TableGPT2: A Large Multimodal Model with Tabular Data Integrationcited by 69
- 2020Bao: Learning to Steer Query Optimizerscited by 62
- 2019An End-to-End Learning-based Cost Estimatorcited by 43
- 2024Multimodal Table Understandingcited by 43
- 2023Exploring the Numerical Reasoning Capabilities of Language Models: A Comprehensive Analysis on Tabular Datacited by 33
- 2023D-Bot: Database Diagnosis System using Large Language Modelscited by 28
- 2023Lero: A Learning-to-Rank Query Optimizercited by 26
- 2019Plan-Structured Deep Neural Network Models for Query Performance Predictioncited by 24
- 2024DocLayLLM: An Efficient Multi-modal Extension of Large Language Models for Text-rich Document Understandingcited by 23
- 2020NeuroCard: One Cardinality Estimator for All Tablescited by 21
- 2022Balsa: Learning a Query Optimizer Without Expert Demonstrationscited by 18
- 2025Can Large Language Models Be Query Optimizer for Relational Databases?cited by 10
- 2024The Unreasonable Effectiveness of LLMs for Query Optimizationcited by 4
- 2025Learned Offline Query Planning via Bayesian Optimizationcited by 4
- 2025A Query Optimization Method Utilizing Large Language Modelscited by 3
Built on by
Not cited yet.