Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +73 -30
- model.safetensors +1 -1
- model_comparison.png +0 -0
- training_progression.png +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
training_progression.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -2,45 +2,88 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
base_model: LiquidAI/LFM2.5-1.2B-Instruct
|
| 4 |
tags:
|
| 5 |
-
-
|
| 6 |
-
- sql
|
| 7 |
-
- fine-tuned
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
language:
|
| 9 |
-
- en
|
| 10 |
pipeline_tag: text-generation
|
| 11 |
-
library_name: transformers
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# LFM2.5-1.2B-Text2SQL
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
##
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
| Exact Match | 48% | **66%** | 60% |
|
| 23 |
-
| LLM-as-Judge | 75% | **87%** | 90% |
|
| 24 |
-
| ROUGE-L | 0.830 | **0.931** | 0.917 |
|
| 25 |
-
| BLEU | 0.695 | **0.870** | 0.852 |
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
```python
|
| 30 |
-
from
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
```
|
| 44 |
|
| 45 |
-
##
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
base_model: LiquidAI/LFM2.5-1.2B-Instruct
|
| 4 |
tags:
|
| 5 |
+
- text2sql
|
| 6 |
+
- sql
|
| 7 |
+
- fine-tuned
|
| 8 |
+
- lora
|
| 9 |
+
- pytorch
|
| 10 |
+
datasets:
|
| 11 |
+
- synthetic
|
| 12 |
language:
|
| 13 |
+
- en
|
| 14 |
pipeline_tag: text-generation
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# LFM2.5-1.2B-Text2SQL (PyTorch)
|
| 18 |
|
| 19 |
+
A fine-tuned version of [LiquidAI/LFM2.5-1.2B-Instruct](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Instruct) for Text-to-SQL generation.
|
| 20 |
|
| 21 |
+
## Model Description
|
| 22 |
|
| 23 |
+
This model was fine-tuned on 2000 synthetic Text-to-SQL examples generated using a teacher model (DeepSeek V3).
|
| 24 |
+
The fine-tuning was performed using LoRA adapters with MLX on Apple Silicon, then fused into the base model.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
### Training Details
|
| 27 |
+
|
| 28 |
+
- **Base Model**: LiquidAI/LFM2.5-1.2B-Instruct
|
| 29 |
+
- **Training Data**: 2000 synthetic examples
|
| 30 |
+
- **Training Method**: LoRA fine-tuning (FP16)
|
| 31 |
+
- **Iterations**: 5400
|
| 32 |
+
- **Hardware**: Apple Silicon (MLX)
|
| 33 |
+
|
| 34 |
+
## Performance
|
| 35 |
+
|
| 36 |
+
### Model Comparison
|
| 37 |
+
|
| 38 |
+

|
| 39 |
+
|
| 40 |
+
| Metric | Teacher (DeepSeek V3) | Base Model | Fine-tuned |
|
| 41 |
+
|--------|----------------------|------------|------------|
|
| 42 |
+
| Exact Match | 60% | 48% | **72%** |
|
| 43 |
+
| LLM-as-Judge | 90% | 75% | 87% |
|
| 44 |
+
| ROUGE-L | 92% | 83% | **94%** |
|
| 45 |
+
| BLEU | 85% | 70% | **89%** |
|
| 46 |
+
| Semantic Similarity | 96% | 93% | **97%** |
|
| 47 |
+
|
| 48 |
+
### Training Progression
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
|
| 52 |
+
The model shows consistent improvement across all checkpoints with no signs of overfitting.
|
| 53 |
+
|
| 54 |
+
## Usage
|
| 55 |
+
|
| 56 |
+
### PyTorch / Transformers
|
| 57 |
|
| 58 |
```python
|
| 59 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 60 |
+
import torch
|
| 61 |
+
|
| 62 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 63 |
+
"furukama/LFM2.5-1.2B-Text2SQL",
|
| 64 |
+
trust_remote_code=True,
|
| 65 |
+
torch_dtype=torch.bfloat16,
|
| 66 |
+
device_map="auto"
|
| 67 |
+
)
|
| 68 |
+
tokenizer = AutoTokenizer.from_pretrained("furukama/LFM2.5-1.2B-Text2SQL", trust_remote_code=True)
|
| 69 |
+
|
| 70 |
+
# Example query
|
| 71 |
+
prompt = '''CREATE TABLE employees (id INT, name VARCHAR, salary DECIMAL);
|
| 72 |
+
|
| 73 |
+
Question: What are the names of employees earning more than 50000?'''
|
| 74 |
+
|
| 75 |
+
messages = [{"role": "user", "content": prompt}]
|
| 76 |
+
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
|
| 77 |
+
outputs = model.generate(inputs, max_new_tokens=256)
|
| 78 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 79 |
```
|
| 80 |
|
| 81 |
+
## Limitations
|
| 82 |
+
|
| 83 |
+
- Trained on synthetic data for a specific database schema
|
| 84 |
+
- Best suited for similar SQL query patterns seen during training
|
| 85 |
+
- May not generalize well to very different database schemas
|
| 86 |
+
|
| 87 |
+
## License
|
| 88 |
+
|
| 89 |
+
This model is released under the Apache 2.0 license, following the base model's license.
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2340697904
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:99720bd0525951742d0ce4d753a23bdeaed5fdfacc8c47a49254348995e12e91
|
| 3 |
size 2340697904
|
model_comparison.png
ADDED
|
training_progression.png
ADDED
|
Git LFS Details
|