Bhaiya & Company β Loan Assistant (LoRA Adapter)
Fine-tuned Qwen/Qwen2.5-3B-Instruct using LoRA for banking loan assistance.
Model Details
| Property | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-3B-Instruct |
| Method | LoRA (Low-Rank Adaptation) |
| Rank | 16 |
| Alpha | 32 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Training Precision | bf16 |
| Quantization | 4-bit (BitsAndBytes NF4) |
| Trainable Params | ~29M / 3.1B (0.96%) |
Training Details
| Property | Value |
|---|---|
| Instance | AWS SageMaker ml.g5.2xlarge (NVIDIA A10G 22 GB) |
| Epochs | 5 |
| Batch Size | 2 (gradient accumulation 8, effective 16) |
| Learning Rate | 2e-4 (cosine schedule) |
| Optimizer | AdamW 8-bit |
| Best Epoch | 3 (val loss 0.1838) |
Training Loss
| Epoch | Training Loss | Validation Loss |
|---|---|---|
| 1 | 0.3478 | 0.2551 |
| 2 | 0.1432 | 0.1891 |
| 3 | 0.1020 | 0.1838 |
| 4 | 0.0835 | 0.1930 |
Usage
Load with PEFT (recommended)
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-3B-Instruct",
torch_dtype=torch.float16,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, "bhaiyahnsingh45/bhaiya-loan-assistant-lora")
model.eval()
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-3B-Instruct")
messages = [
{"role": "system", "content": "You are a compliant and helpful loan assistant for Bhaiya & Company β Banking & Finance Division."},
{"role": "user", "content": "My salary is 55,000, CIBIL 740, age 30. Am I eligible for a personal loan?"},
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
input_ids=inputs["input_ids"],
max_new_tokens=512,
temperature=0.3,
do_sample=True
)
generated_tokens = outputs[0][inputs["input_ids"].shape[1]:]
print(tokenizer.decode(generated_tokens, skip_special_tokens=True))
Intended Use
This model is a loan assistant for Bhaiya & Company β Banking & Finance Division. It handles:
- Loan eligibility checks (Personal, Business, Home loans)
- Document requirement guidance
- EMI calculations
- Application process guidance
Limitations
- Never guarantees loan approval
- Refuses investment advice, stock tips, financial planning
- Final approval is always subject to verification
Dataset
Trained on bhaiyahnsingh45/bhaiya-loan-assistant-dataset β a custom instruction-tuning dataset in chat format (system/user/assistant messages).
- Downloads last month
- 42