Official implementation of the LEAF-SQL paper.
📄 Paper · 💻 Code · ✉️ Contact
- [2026] 🏆 LEAF-SQL has been accepted to ICDE 2026! Read the paper on arXiv.
LEAF-SQL is a framework that treats Text-to-SQL as a tree search problem, exploring multiple skeleton candidates with diverse structures and granularities to improve the final query's accuracy.
For a quick demonstration of the LEAF-SQL method, you can run the example script. Note that this is a simplified version and does not represent the full functionality.
python example.pyFollow these steps for the complete setup and execution.
Install all the required packages from requirements.txt.
pip install -r requirements.txtDownload the necessary models from ModelScope:
# Download the SkeEva model
modelscope download --model mrtanzhao/SkeEva --local_dir ./models/skeeva
# Download the SkeFor model
modelscope download --model Qwen/Qwen3-14B --local_dir ./models/skeforDownload the BIRD dataset from the official website: https://bird-bench.github.io/
Modify the configuration file ./config/config.yaml to match your environment settings (e.g., file paths, api_key).
Start the two model services in separate terminal sessions. Adjust the parameters (like CUDA_VISIBLE_DEVICES, tensor-parallel-size, etc.) according to your hardware specifications.
The following example assumes an 8-GPU environment, assigning 4 GPUs to each model for optimal performance.
CUDA_VISIBLE_DEVICES=0,1,2,3 python -m vllm.entrypoints.openai.api_server \
--model ./models/skefor \
--served-model-name skefor \
--port 8001 \
--tensor-parallel-size 4 \
--max-num-seqs 32 \
--max-num-batched-tokens 1024CUDA_VISIBLE_DEVICES=4,5,6,7 python -m vllm.entrypoints.openai.api_server \
--model ./models/skeeva \
--served-model-name skeeva \
--port 8002 \
--tensor-parallel-size 4 \
--max-num-seqs 32 \
--max-num-batched-tokens 1024Once the services are running, execute the main script. You will see a progress bar indicating the processing status of the tasks.
python main.pyThis project welcomes contributions and suggestions 👍.
If you find a bug, encounter a problem, or have a suggestion for LEAF-SQL, please submit an issue or reach out via email at tanzhao325@gmail.com.
If you find our work useful or inspiring, please consider citing:
@inproceedings{leaf-sql-icde2026,
author = {Zhao Tan and
Xiping Liu and
Qing Shu and
Qizhi Wan and
Dexi Liu and
Changxuan Wan},
title = {LEAF-SQL: Level-wise Exploration with Adaptive Fine-graining for Text-to-SQL Skeleton Prediction},
booktitle = {Proceedings of the 42nd IEEE International Conference on Data Engineering (ICDE)},
year = {2026}
}You may also cite the preprint:
@article{leaf-sql-arxiv,
author = {Zhao Tan and
Xiping Liu and
Qing Shu and
Qizhi Wan and
Dexi Liu and
Changxuan Wan},
title = {LEAF-SQL: Level-wise Exploration with Adaptive Fine-graining for Text-to-SQL Skeleton Prediction},
journal = {arXiv preprint arXiv:2605.09295},
year = {2026}
}This project is released under the MIT License.
