Update README.md
Browse files
README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
| 1 |
---
|
| 2 |
base_model: unsloth/meta-llama-3.1-8b-bnb-4bit
|
| 3 |
tags:
|
| 4 |
-
- text-generation
|
| 5 |
-
-
|
|
|
|
|
|
|
|
|
|
| 6 |
- unsloth
|
| 7 |
- llama
|
| 8 |
license: apache-2.0
|
|
@@ -10,12 +13,92 @@ language:
|
|
| 10 |
- en
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
| 16 |
-
- **License:** apache-2.0
|
| 17 |
-
- **Finetuned from model :** unsloth/meta-llama-3.1-8b-bnb-4bit
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
base_model: unsloth/meta-llama-3.1-8b-bnb-4bit
|
| 3 |
tags:
|
| 4 |
+
- text-generation
|
| 5 |
+
- sql-generation
|
| 6 |
+
- finetuning
|
| 7 |
+
- lora
|
| 8 |
+
- peft
|
| 9 |
- unsloth
|
| 10 |
- llama
|
| 11 |
license: apache-2.0
|
|
|
|
| 13 |
- en
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# SQL-Genie (LLaMA-3.1-8B Fine-Tuned)
|
| 17 |
|
| 18 |
+
## Model Overview
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
**SQL-Genie** is a fine-tuned version of **LLaMA-3.1-8B**, specialized for **natural language to SQL generation**.
|
| 21 |
+
The model was trained using **parameter-efficient fine-tuning (LoRA)** on a structured SQL instruction dataset, enabling accurate SQL query generation while keeping training and inference costs low.
|
| 22 |
|
| 23 |
+
- **Developed by:** dhashu
|
| 24 |
+
- **Base model:** `unsloth/meta-llama-3.1-8b-bnb-4bit`
|
| 25 |
+
- **License:** Apache-2.0
|
| 26 |
+
- **Training framework:** Unsloth + Hugging Face TRL
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## Training Methodology
|
| 31 |
+
|
| 32 |
+
This model was fine-tuned using **LoRA (Low-Rank Adaptation)** via the **PEFT** framework.
|
| 33 |
+
|
| 34 |
+
### Key Training Details
|
| 35 |
+
- Base model loaded in **4-bit quantization** for memory efficiency
|
| 36 |
+
- **LoRA adapters** applied to attention and feed-forward layers
|
| 37 |
+
- Base model weights remained **frozen**
|
| 38 |
+
- Only LoRA parameters were trained
|
| 39 |
+
- Training performed using **Supervised Fine-Tuning (SFT)**
|
| 40 |
+
|
| 41 |
+
This approach allows the model to learn SQL generation patterns efficiently without full model retraining.
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
## Dataset
|
| 46 |
+
|
| 47 |
+
The model was trained on a subset of the **`b-mc2/sql-create-context`** dataset, which contains:
|
| 48 |
+
- Natural language questions
|
| 49 |
+
- Database schema/context
|
| 50 |
+
- Corresponding SQL queries
|
| 51 |
+
|
| 52 |
+
Each sample was formatted as an instruction-style prompt to improve reasoning and output structure.
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## Performance & Efficiency
|
| 57 |
+
|
| 58 |
+
- 🚀 **2× faster fine-tuning** using **Unsloth**
|
| 59 |
+
- 💾 **Low VRAM usage** via 4-bit quantization
|
| 60 |
+
- 🧠 Improved schema understanding and SQL syntax generation
|
| 61 |
+
- ⚡ Suitable for real-time inference and lightweight deployments
|
| 62 |
+
|
| 63 |
+
---
|
| 64 |
+
|
| 65 |
+
## Model Variants
|
| 66 |
+
|
| 67 |
+
This repository may contain **either**:
|
| 68 |
+
|
| 69 |
+
### 🔹 LoRA Adapter Model
|
| 70 |
+
- Contains only LoRA weights
|
| 71 |
+
- Requires loading the base LLaMA-3.1-8B model
|
| 72 |
+
- Ideal for research and modular fine-tuning
|
| 73 |
+
|
| 74 |
+
### 🔹 Merged Model (if applicable)
|
| 75 |
+
- LoRA adapters merged into base weights
|
| 76 |
+
- No PEFT required at inference time
|
| 77 |
+
- Ready-to-use single checkpoint
|
| 78 |
+
|
| 79 |
+
(Check the repository files to confirm the variant.)
|
| 80 |
+
|
| 81 |
+
---
|
| 82 |
+
|
| 83 |
+
## Intended Use Cases
|
| 84 |
+
|
| 85 |
+
- Natural language → SQL query generation
|
| 86 |
+
- Database querying assistants
|
| 87 |
+
- AI-powered analytics tools
|
| 88 |
+
- Educational and research purposes
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## Limitations
|
| 93 |
+
|
| 94 |
+
- Trained on a limited SQL dataset subset
|
| 95 |
+
- Not guaranteed to generalize to all SQL dialects
|
| 96 |
+
- Should be validated before production database usage
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## Acknowledgements
|
| 101 |
+
|
| 102 |
+
This model was trained using **Unsloth**, enabling faster and more memory-efficient fine-tuning of large language models.
|
| 103 |
+
|
| 104 |
+
[](https://github.com/unslothai/unsloth)
|