Spaces:
Sleeping
Sleeping
| 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. | |