SmolLM2-SQL-SFT
a compact Text-to-SQL adapter
1 min read
The model turns natural language questions and database schemas into ready-to-use SQL queries. It is built on the lightweight SmolLM2-135M language model and fine-tuned using LoRA (a small add-on over the base model) on the NSText2SQL dataset. Thanks to its ultra-compact size, the model is ideal for local testing, simple query generation tasks, and learning how Text-to-SQL systems work on low-end hardware.
Key features
- Specialization: translating natural language queries and database schemas into SQL code.
- Base architecture: built on HuggingFaceTB/SmolLM2-135M using PEFT and LoRA.
- Lightweight: only 135 million parameters for fast performance on minimal system requirements.
What you can do
- Script integration: embed the adapter into a local pipeline for automated SQL query generation.
- Testing: run experiments on text-to-code conversion on a regular computer without a powerful GPU.
Example
Example prompt from the card for query generation:
Schema: CREATE TABLE students (id INTEGER, name TEXT, age INTEGER)
Question: Find all students older than 20.
Expected SQL: SELECT * FROM students WHERE age > 20;
Read more
DetailsTraining notes: training was completed in 2 epochs using Hugging Face Transformers and PEFT.
Metrics: Exact-Match Accuracy reached 37% (37/100) on the test set.
Limitations: the model is small, so the generated SQL may contain errors and requires verification before execution.










Comments