Base model
This repository contains a LoRA adapter, not a full standalone model.
Load it together with:
ibm-granite/granite-4.1-3b
Intended use
- Convert natural-language questions into Oracle 19c SQL
- Generate analytical and reporting queries
- Support SQL learning, prototyping, and evaluation
- Use with a schema-retrieval or RAG layer for better table and column selection
Training details
- Base model: Granite 4.1 3B Instruct
- Fine-tuning method: 4-bit NF4 QLoRA with double quantization
- Training approach: Supervised fine-tuning with PEFT LoRA
- Training examples: 3,200 total
- 2,800 Oracle-focused NL→SQL examples
- 400 general-SQL replay examples
- Validation examples: 350
- Epochs: 1
- Training steps: 400
- Learning rate:
2e-5
- Maximum sequence length: 1,024
- Per-device batch size: 1
- Gradient accumulation steps: 8
- Effective batch size: 8
- Compute precision: FP16
- Training hardware: Tesla T4 GPU
LoRA configuration
- Rank: 16
- Alpha: 32
- Dropout: 0.05
- Target modules:
q_proj, k_proj, v_proj, o_proj
- PEFT version: 0.20.0
Limitations and safe use
- This adapter is not a database-security system.
- Review every generated SQL query before running it.
- Use read-only database access for analytics workloads.
- Apply authentication, authorization, tenant, organization, role, and row-level filters in your application.
- Test generated SQL against your own schema and Oracle version.
- The training examples are generalized and do not include real customer records, credentials, or database connections.
Load the adapter
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "ibm-granite/granite-4.1-3b"
adapter_id = "Vakamalla123-Anitha/oracle19c-nl2sql-granite-4.1-3b-lora"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, adapter_id)
Example
Question
Show total sales by sales representative for July 2026.
Expected behavior
Generate an Oracle SQL SELECT query with date filtering, aggregation, and grouping. Always review the generated SQL before execution.