This is a LoRA adapter for the Qwen/Qwen2.5-1.5B-Instruct model, fine-tuned to act as an AI SQL Critic.
The model is trained to compare an original SQL query with an optimized version based on a provided DDL schema, and strictly output a JSON object evaluating their semantic equivalence.
This adapter is intended to be used over the base Qwen2.5-1.5B-Instruct model to enforce strict JSON formatting and improve logic in identifying missing SQL clauses (like WHERE, GROUP BY) between two queries.
Before fine-tuning, the base model's accuracy on the semantic comparison task was 52.3% (random guessing level). After applying this LoRA adapter, the evaluation metrics improved significantly:
Figure 1: Training and validation loss over 40 steps, demonstrating successful convergence without overfitting.
The adapter successfully preserves the base model's general knowledge. When tested on math logic, geography, and grammar correction without a strict JSON system prompt, the model outputs fluent natural language and correctly solves the tasks, proving that the base weights were not structurally compromised.
You can load this adapter using the peft library in Python:
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model_name = "Qwen/Qwen2.5-1.5B-Instruct"
adapter_name = "Hokaigo/Qwen2.5-1.5B-SQL-Critic-LoRA"
model = AutoModelForCausalLM.from_pretrained(base_model_name)
model = PeftModel.from_pretrained(model, adapter_name)
tokenizer = AutoTokenizer.from_pretrained(adapter_name)
Qwen/Qwen2.5-1.5B-Instruct