Downloads · 30 days
24
4% of all-time downloads
Yuk050/gemma-3-1b-text-to-sql-model
gemma-3-1b-text-to-sql-model is a machine learning model from Yuk050. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as gemma.
This model is a finetuned version of the google/gemma-3-1b large language model, specifically adapted for the text-to-SQL task. It leverages Quantized Low-Rank Adaptation (QLoRA) for efficient finetuning, making it su…
Downloads · 30 days
24
4% of all-time downloads
All-time downloads
590
Public
Parameters
1000M
2 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors2 GB · 98%
How the weights are stored.
F16698M · 70%
From the Hugging Face model README
This model is a finetuned version of the google/gemma-3-1b large language model, specifically adapted for the text-to-SQL task. It leverages Quantized Low-Rank Adaptation (QLoRA) for efficient finetuning, making it suitable for deployment and inference on systems with limited computational resources.
The primary function of this model is to translate natural language questions and provided database schemas into executable SQL queries. This capability is crucial for applications requiring natural language interaction with databases, such as business intelligence tools, data analysis platforms, and conversational AI agents.
This model is intended for research and development purposes related to text-to-SQL generation. It can be used to:
This model is not intended for:
The model was finetuned on the gretelai/synthetic_text_to_sql dataset [1]. This dataset is a high-quality, synthetically generated collection of text-to-SQL samples. Key characteristics of the dataset include:
sql_prompt), database schema (sql_context as CREATE TABLE statements), the corresponding SQL query (sql), and an explanation of the SQL query (sql_explanation).The training data was transformed into a conversational format, where the user provides the database schema and natural language query, and the assistant responds with the SQL query. An example of the input format is:
Given the following database schema:
CREATE TABLE Employees (id INT, name VARCHAR(255), salary INT);
Generate the SQL query for: Select all employees with salary greater than 50000
The model was finetuned using the QLoRA technique, implemented with the unsloth library. The training was performed using the SFTTrainer from the trl library.
Base Model: google/gemma-3-1b
Finetuning Parameters (QLoRA):
r): 16lora_alpha): 16lora_dropout): 0.05noneq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_projunsloth optimized)Training Arguments (SFTTrainer):
adamw_8bitbf16 (if supported by GPU), otherwise fp16The Gemma 3 1B model is a decoder-only transformer architecture. During QLoRA finetuning, low-rank adapters are injected into the specified layers, allowing for efficient training by only updating a small fraction of the model's parameters while keeping the majority of the pre-trained weights frozen in 4-bit quantized form.
Due to the synthetic nature of the training data, the model's performance on real-world, noisy, or highly complex database schemas may vary. It is recommended to perform further evaluation and potentially finetune on domain-specific data for production use cases.
Limitations include:
Finetuning with QLoRA significantly reduces the computational resources and energy consumption compared to full finetuning. The specific energy consumption for this finetuning run would depend on the hardware used and the duration of training.
If you use this model or the finetuning approach, please consider citing the original Gemma model and the gretelai/synthetic_text_to_sql dataset:
@article{gemma2024,
author = {Google},
title = {Gemma: A Family of Lightweight, State-of-the-Art Open Models},
year = {2024},
url = {https://ai.google.dev/gemma}
}
@software{gretel-synthetic-text-to-sql-2024,
author = {Meyer, Yev and Emadi, Marjan and Nathawani, Dhruv and Ramaswamy, Lipika and Boyd, Kendrick and Van Segbroeck, Maarten and Grossman, Matthew and Mlocek, Piotr and Newberry, Drew},
title = {{Synthetic-Text-To-SQL}: A synthetic dataset for training language models to generate SQL queries from natural language prompts},
month = {April},
year = {2024},
url = {https://huggingface.co/datasets/gretelai/synthetic-text-to-sql}
}