Qwen3 NL β SQL LoRA (Spider-style)
Model Overview
- Developed by: Neeharika20
- Base model:
Qwen/Qwen3-4B-Instruct-2507 - Fine-tuning method: LoRA
- Task: Natural Language β SQL generation
- Frameworks: Unsloth, TRL
- License: Apache-2.0
This model is a LoRA adapter fine-tuned to convert natural language questions into SQL queries given an explicit database schema.
It follows the Spider dataset prompt style and is optimized for structured NL β SQL tasks rather than general chat.
Training was accelerated using Unsloth, enabling faster and memory-efficient fine-tuning.
Intended Use
β Recommended
- Natural Language β SQL generation
- Educational, research, and prototype systems
- Schema-aware SQL generation (Spider-style)
β Not Recommended
- General conversational chat
- Schema inference without explicit table definitions
- Production SQL execution without validation
Reproducibility
This model can be reproduced by fine-tuning Qwen/Qwen3-4B-Instruct-2507 on the Spider dataset using Hugging Face TRL and Unsloth. Training was performed with a learning rate of 2e-4, max sequence length 2048, 4-bit quantization, and instruction-based prompting including schema context.
Prompt
prompt = """
### Instruction:
Convert the question into an SQL query.
### Database Schema:
CREATE TABLE students(id INT, name TEXT, age INT);
### Question:
List the names of all students.
### SQL:
"""
Limitations
- May hallucinate columns if schema is incomplete
- Performance drops on ambiguous schemas
- SQL syntax is not guaranteed to be valid in all edge cases
- No execution feedback loop during generation
Ethical Considerations
- Trained exclusively on publicly available data
- No personal or sensitive data involved
- Generated SQL should be validated before execution
- Not designed for autonomous decision-making
Model tree for Neeharika20/qwen-spider-lora
Base model
Qwen/Qwen3-4B-Instruct-2507