Downloads · 30 days
0
karthik-2905/nl2sql-pretrained
nl2sql-pretrained is a text generation model from karthik-2905. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A state-of-the-art GPT-style transformer model trained completely from scratch for natural language to MySQL query generation. This model demonstrates that high-quality language models can be built without relying on…
Downloads · 30 days
0
Access
Public
Updated Jul 18, 2025
Repo size
265 MB
Likes
0
Public
Click a slice to open those files.
.pt239 MB · 90%
From the Hugging Face model README
A state-of-the-art GPT-style transformer model trained completely from scratch for natural language to MySQL query generation. This model demonstrates that high-quality language models can be built without relying on pre-trained weights, achieving excellent performance with a compact architecture.
This model specializes in converting natural language descriptions into syntactically correct MySQL queries. It was trained entirely from scratch using a custom transformer architecture, making it highly optimized for SQL generation tasks.
| Component | Specification |
|---|---|
| Model Type | GPT-style Transformer (Decoder-only) |
| Layers | 8 |
| Attention Heads | 8 |
| Hidden Dimensions | 512 |
| Feed Forward Size | 2048 |
| Max Sequence Length | 512 tokens |
| Dropout Rate | 0.1 |
| Total Parameters | 29,789,184 |
| Model Size | 113.6 MB |
| Vocabulary Size | 4,206 tokens |
| Metric | Value |
|---|---|
| Validation Loss | 0.3485 |
| Training Loss | 0.3178 |
| Perplexity | 1.42 |
| Convergence | Excellent |
| Overfitting | None detected |
The model was trained on a carefully curated dataset of 24,293 high-quality examples sourced from:
All queries were specifically optimized for MySQL syntax and best practices, ensuring production-ready output.
This model excels at converting natural language descriptions into syntactically correct MySQL queries. Perfect for:
# Basic Selection
"Show me all customers from New York"
# → SELECT * FROM customers WHERE city = 'New York';
# Aggregation
"Find total sales for each product"
# → SELECT product_name, SUM(sales) FROM sales_table GROUP BY product_name;
# Conditional Filtering
"List employees with salary greater than 50000"
# → SELECT * FROM employees WHERE salary > 50000;
| File | Description |
|---|---|
best_pretrained_model.pt | Optimized model checkpoint for inference |
complete_model_package.pt | Full model package with all components |
model_info.json | Detailed model specifications and metadata |
training_metrics.json | Comprehensive training performance data |
SQLModel.ipynb | Complete training and evaluation notebook |
If you use this model in your research or applications, please cite:
@misc{mysql-query-generator-from-scratch,
title={MySQL Query Generator: A GPT-style Transformer Trained From Scratch},
author={Anonymous},
year={2025},
howpublished={\\url{https://huggingface.co/karthik-2905/nl2sql-pretrained}},
note={Natural Language to SQL Query Generation}
}
This model is released under the Apache 2.0 License, allowing for both commercial and non-commercial use.
⭐ If you find this model useful, please give it a star and share it with others!