Downloads · 30 days
9
9% of all-time downloads
LineLuLan/insightsql-qwen3-8b-lora
insightsql-qwen3-8b-lora is a text generation model from LineLuLan. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
LoRA adapter fine-tuned on top of unsloth/Qwen3-8B-Base for natural-language to SQL translation, trained on the BIRD-SQL benchmark.
Downloads · 30 days
9
9% of all-time downloads
All-time downloads
99
Public
Repo size
186 MB
Likes
0
Public
Click a slice to open those files.
.safetensors175 MB · 94%
From the Hugging Face model README
LoRA adapter fine-tuned on top of unsloth/Qwen3-8B-Base for natural-language to SQL translation, trained on the BIRD-SQL benchmark.
This is Phase 1 of the InsightSQL project — an Agentic Business Intelligence System that combines a fine-tuned model, schema RAG, and a self-correcting agent loop.
Evaluation on BIRD Mini-Dev (50 samples, string-match accuracy):
| Metric | Baseline (Qwen3-8B-Base) | Fine-tuned | Delta |
|---|---|---|---|
| String-match accuracy | 0.0% | 2.0% | +2.0pp |
| Correct / total | 0/50 | 1/50 | — |
Note: This is string-match accuracy, a proxy metric. The official BIRD-SQL metric is Execution Accuracy (runs both predicted and gold SQL against real databases and compares result sets). String match underestimates true execution accuracy by ~10-20pp.
⚠️ Critical: This adapter expects the exact prompt format below. Using a different format will significantly degrade performance. Database schema: {schema} Hint: {hint or "(no hint)"} Question: {question} SQL: {generated_sql_here}
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load base model + adapter
base = AutoModelForCausalLM.from_pretrained(
"unsloth/Qwen3-8B-Base",
load_in_4bit=True,
device_map="auto",
)
model = PeftModel.from_pretrained(base, "LineLuLan/insightsql-qwen3-8b-lora")
tokenizer = AutoTokenizer.from_pretrained("LineLuLan/insightsql-qwen3-8b-lora")
# Format prompt
prompt = '''### Database schema:
CREATE TABLE customers (id INT, name TEXT, total_spend REAL);
### Hint:
(no hint)
### Question:
List the top 3 customers by total spend.
### SQL:
'''
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
@misc{insightsql2026,
author = { LineLuLan },
title = {InsightSQL: Agentic Business Intelligence with Fine-tuned LLMs},
year = {2026},
howpublished = {\url{https://huggingface.co/LineLuLan/insightsql-qwen3-8b-lora}}
}