Skip to main content

LLMSQL: Benchmark for Text-to-SQL

Project description

LLMSQL

Patched and improved version of the original large crowd-sourced dataset for developing natural language interfaces for relational databases, WikiSQL.

Our datasets are available for different scenarios on our HuggingFace page.

Overview

Install

pip3 install llmsql

This repository provides the LLMSQL Benchmark — a modernized, cleaned, and extended version of WikiSQL, designed for evaluating and fine-tuning large language models (LLMs) on Text-to-SQL tasks.

Note

The package doesn't have the dataset, it is stored on our HuggingFace page.

This package contains

  • Support for modern LLMs.
  • Tools for evaluation, inference, and finetuning.
  • Support for Hugging Face models out-of-the-box.
  • Structured for reproducibility and benchmarking.

Usage Recommendations

Modern LLMs are already strong at producing SQL queries without finetuning.
We therefore recommend that most users:

  1. Run inference directly on the full benchmark:

  2. Optional finetuning:

    • For research or domain adaptation, we provide finetuning script for HF models. Use llmsql finetune --help or read Finetune Readme to find more about finetuning.

[!Tip] You can find additional manuals in the README files of each folder(Inferece Readme, Evaluation Readme, Finetune Readme)


Repository Structure


WikiSQLv2/
├── evaluation/          # Scripts for downloading DB + evaluating predictions
├── inference/           # Generate SQL queries with your LLM
└── finetune/            # Fine-tuning with TRL's SFTTrainer

Quickstart

Install

Make sure you have the package installed (we used python3.11):

pip3 install llmsql

1. Run Inference

from llmsql import LLMSQLVLLMInference

# Initialize inference engine
inference = LLMSQLVLLMInference(
    model_name="Qwen/Qwen2.5-1.5B-Instruct",  # or any Hugging Face causal LM
    tensor_parallel_size=1,
)

# Run generation
results = inference.generate(
    output_file="path_to_your_outputs.jsonl",
    questions_path="data/questions.jsonl",
    tables_path="data/tables.jsonl",
    shots=5,
    batch_size=8,
    max_new_tokens=256,
    temperature=0.7,
)

2. Evaluate Results

from llmsql import LLMSQLEvaluator

evaluator = LLMSQLEvaluator(workdir_path="llmsql_workdir")
report = evaluator.evaluate(outputs_path="path_to_your_outputs.jsonl")
print(report)

Finetuning (Optional)

If you want to adapt a base model on LLMSQL:

llmsql finetune --config_file examples/example_finetune_args.yaml

This will train a model on the train/val splits with the parameters provided in the config file. You can find example config file here.

Suggested Workflow

  • Primary: Run inference on dataset/questions.jsonl → Evaluate with evaluation/.
  • Secondary (optional): Fine-tune on train/val → Test on test_questions.jsonl.

License & Citation

Please cite LLMSQL if you use it in your work:

@inproceedings{llmsql_bench,
  title={LLMSQL: Upgrading WikiSQL for the LLM Era of Text-to-SQLels},
  author={Pihulski, Dzmitry and  Charchut, Karol and Novogrodskaia, Viktoria and Koco{'n}, Jan},
  booktitle={2025 IEEE International Conference on Data Mining Workshops (ICDMW)},
  year={2025},
  organization={IEEE}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmsql-0.1.1.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmsql-0.1.1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file llmsql-0.1.1.tar.gz.

File metadata

  • Download URL: llmsql-0.1.1.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for llmsql-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4ef9ef51ca782d61fcb30adb055d819d7b549ce15d53968610b303f8ad012121
MD5 7d986152bcfacfdd45a389206026ac6e
BLAKE2b-256 c759de93a3218416bca6bab531e5af8c799f17e76cb000f5ead31ef45926d5a3

See more details on using hashes here.

File details

Details for the file llmsql-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: llmsql-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for llmsql-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 038ad845c8f74b25b0913aaf67b7ab01f437e299b66eb2b677899e270ef1a2de
MD5 6afff657bbe34120c56f65e05ac28b8d
BLAKE2b-256 cf2cbe513d03494b33d1b6d613a1d877a1828d04f3c317a9210ba3aa6521e4df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page