gretelai/synthetic_text_to_sql
Viewer • Updated • 106k • 3.61k • 655
Mistral-Nemo-Instruct-2407_ORPO
This model was fine-tuned to improve accuracy for translating natural language queries into SQL statements, specifically targeting non-technical users. The fine-tuning process compared two methodologies: Direct Preference Optimization (DPO) and Odds Ratio Preference Optimization (ORPO).
| Model | Execution Accuracy (%) |
|---|---|
| Mistral-NeMo-Instruct (Base) | Baseline |
| DPO Fine-Tuned Model | +0.86% |
| ORPO Fine-Tuned Model | +41.38% |
| ORPO vs. Codestral-22B | +35.54% |
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
from peft import PeftConfig,PeftModel
# Load the fine-tuned peft model
peft_config = PeftConfig.from_pretrained("JHuel/Mistral-Nemo-Instruct-2407_DPO_qlora")
model = AutoModelForCausalLM.from_pretrained(peft_config.base_model_name_or_path)
model = PeftModel.from_pretrained(model, "JHuel/Mistral-Nemo-Instruct-2407_DPO_qlora")
# Load the fine-tuned model
tokenizer = AutoTokenizer.from_pretrained("your-model-name")
model = AutoModelForCausalLM.from_pretrained("your-model-name")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-Nemo-Instruct-2407")
# Input a natural language query
response = chatbot(messages)[0]['generated_text']
print(response)
If you use this model in your research or applications, please cite:
@article{JHuelsEKeuchel,
title={Evaluation of Fine-Tuning Methods: DPO and ORPO for Text-to-SQL},
author={Jonathan Hüls and Elina Keuchel.},
year={2025}
}
The model is released under the apache-2.0 LICENSE.
Base model
mistralai/Mistral-Nemo-Base-2407