--- title: SQLForge โ€” Text-to-SQL emoji: ๐Ÿ› ๏ธ colorFrom: yellow colorTo: indigo sdk: docker app_port: 8000 pinned: true license: mit short_description: Fine-tuned text-to-SQL LLM with a self-correcting demo --- # SQLForge ๐Ÿ› ๏ธ โ€” Text-to-SQL Ask a question in plain English โ†’ SQLForge writes the SQL, **runs it against a real SQLite database**, and shows you the results. When a query crashes, it reads the database error and **self-corrects**. This Space runs a **Qwen2.5-Coder-1.5B** model fine-tuned with QLoRA on the [Spider](https://yale-lily.github.io/spider) benchmark. | | Execution accuracy (full Spider dev set) | |---|:---:| | Base model (zero-shot) | 57.45% | | **Fine-tuned (SQLForge)** | **65.57%** โ€” **+8.1 pts** | ## How to use 1. Pick one of the example databases. 2. Click an example question or type your own. 3. Hit **Generate SQL** โ€” you'll see the query, the live results, and (on hard questions) the self-correction trace. > โฑ๏ธ This Space runs on **CPU**, so generation takes a few seconds per query (the model itself runs in ~1โ€“3s on a GPU). Accuracy is identical โ€” only speed differs. ## Links - ๐Ÿ’ป **Source & training pipeline:** [github.com/abdullahkousa2/sqlforge](https://github.com/abdullahkousa2/sqlforge) - ๐Ÿ“ฆ **Library:** `pip install sqlforge` - ๐Ÿ“ˆ **Experiment tracking:** [Weights & Biases](https://wandb.ai/akousa360-arab-international-university-/sqlforge-text2sql) Built with QLoRA ยท ๐Ÿค— Transformers ยท PEFT ยท FastAPI. Evaluated with real execution accuracy, not string matching.