shoron07/qwen3-4b-spider-unsloth
Qwen3-4B Spider Text-to-SQL - Unsloth QLoRA
A text-to-SQL adapter fine-tuned from unsloth/Qwen3-4B-unsloth-bnb-4bit using Unsloth-accelerated 4-bit QLoRA.
The model accepts a SQLite database schema and a natural-language question and generates a SQL query.
Evaluation Results
Evaluation used all 1,034 Spider validation examples. Training and validation databases were completely separated.
Normalized exact match improved by approximately 74.4% relative over the untouched base model.
The reported exact match is a strict SQLGlot-normalized metric, not execution accuracy. Semantically equivalent queries may still be counted as different.
Training Configuration
This was a compact 100-step portfolio experiment and did not complete a full training epoch.
Dataset Preparation
- Database-level train-validation separation
- Zero overlapping databases between splits
- Missing-value and duplicate validation
- Eight exact training duplicates removed
- Qwen3 conversational formatting
- Response-only assistant training
- Token-length auditing
- 96 overlength training examples removed
Example
Input
Schema: CREATE TABLE singer (name TEXT, age INTEGER);
Question: How many singers are older than 30?Output
SELECT COUNT(*) FROM singer WHERE age > 30Intended Use
- Text-to-SQL demonstrations
- SQLite query-generation experiments
- Parameter-efficient fine-tuning examples
- Unsloth and QLoRA workflow demonstrations
Limitations
- The adapter was trained for only 100 steps.
- Evaluation used normalized exact match, not execution accuracy.
- Syntactically valid SQL may still be logically incorrect.
- Performance outside English Spider-style SQLite tasks is unknown.
- Queries should be validated before database execution.
Artifacts
The results directory contains the training history, evaluation summary, comparison metrics, and project summary.
Acknowledgements
Built with Qwen3, Unsloth, Hugging Face PEFT, TRL, the Spider benchmark, and SQLGlot.
