Gemma 270M-IT Text-to-SQL Model (Version 1)

This model is a fine-tuned version of google/gemma-3-270m-it specifically adapted for Text-to-SQL conversion. It takes natural language questions, optionally along with a database schema, and generates the corresponding SQL query.

Model Description

  • Base Model: google/gemma-3-270m-it
  • Task: Text-to-SQL Generation (Instruction-tuned language model)
  • Fine-tuning Framework: trl library with SFTTrainer
  • Optimization: LoRA (Low-Rank Adaptation) for Parameter-Efficient Fine-Tuning (PEFT) and 4-bit quantization using bitsandbytes to reduce memory footprint and enable training on resource-constrained environments (e.g., T4 GPU).

Training Data

The model was fine-tuned on the sirunchained/text-to-sql-dataset from Hugging Face. This dataset consists of natural language queries, corresponding database schemas (optional), and the target SQL queries.

Model Performance

The model's performance was evaluated on a test set, yielding the following results:

  • Evaluation Loss: 0.681
  • Mean Token Accuracy: 0.836

During training, the model showed a consistent decrease in both training and validation loss, indicating successful learning and generalization. The validation mean token accuracy steadily improved, reaching approximately 84% by the end of the training process, suggesting that the model is capable of generating accurate SQL queries given natural language input and schema information.

Version Information

This is Version 1 of the sirunchained/text-to-sql-model. The model will be continuously updated and improved over time with more data and potentially different architectures.

Gradio Demo

A Gradio web interface was developed to demonstrate the model's capabilities, allowing users to input natural language queries and provide database schema details table by table, then view the generated SQL output. You can find the Gradio app code within the accompanying notebook. You can test it here.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for sirunchained/text-to-sql-model-v1

Adapter
(65)
this model

Dataset used to train sirunchained/text-to-sql-model-v1