Model Details
Table with columns: Property, Value| Property | Value |
|---|
| Base model | Qwen/Qwen2.5-0.5B-Instruct |
| Fine-tuning | LoRA / PEFT |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Trainable parameters | 2,162,688 |
| Total parameters | 496,195,456 |
| Trainable percentage | 0.4359% |
| Training examples | 3,500 |
| Language | English |
This repository contains the LoRA adapter and tokenizer files, not the full
base model.
Training
- Epochs: 5
- Learning rate: 2e-4
- Scheduler: cosine
- Warmup steps: 20
- Per-device batch size: 4
- Gradient accumulation: 4
- Maximum sequence length: 256
- Precision: FP16
- Loss: completion-only
- Best checkpoint selected using validation loss
Training was performed using a free Kaggle GPU environment.
Dataset
The model was trained on the English subset of
JDhruv14/Bhagavad-Gita-QA.
- Total examples: 3,500
- Coverage: 700 verses
- Questions per verse: 5
The dataset was split by verse rather than by individual question.
- Training verses: 595
- Evaluation verses: 105
- Training examples: 2,975
- Evaluation examples: 525
Evaluation
The best checkpoint achieved a validation loss of 1.8104.
A fixed 50-question benchmark was also evaluated using the base model and the
fine-tuned model.
Table with columns: Model, Questions, Successful generations| Model | Questions | Successful generations |
|---|
| Qwen2.5-0.5B-Instruct | 50 | 50/50 |
| Gita-Qwen-0.5B-V2 | 50 | 50/50 |
The benchmark evaluates open-ended responses and is not an exact-match
accuracy benchmark.
Limitations
This is an experimental fine-tune and may produce:
- incorrect verse-specific answers
- generic or incomplete explanations
- hallucinated details
- interpretations that are not supported by the referenced verse
Model outputs should be independently verified against reliable translations,
primary texts, or scholarly sources before being relied upon.
Intended Use
This model is intended for:
- experimentation with LoRA and PEFT
- educational and research projects
- domain-specific fine-tuning experiments
- exploratory Bhagavad Gita question answering
It is not intended to replace primary or scholarly sources.
Inference
import torchfrom transformers import AutoTokenizer, AutoModelForCausalLMfrom peft import PeftModel BASE_MODEL = "Qwen/Qwen2.5-0.5B-Instruct"ADAPTER = "Rudraksh001/gita-qwen-0.5b-v2" tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL) base_model = AutoModelForCausalLM.from_pretrained( BASE_MODEL, torch_dtype=torch.float16, device_map="auto") model = PeftModel.from_pretrained( base_model, ADAPTER) model.eval() messages = [ { "role": "user", "content": ( "According to Bhagavad Gita Chapter 2, Verse 47:\n\n" "What is the central teaching of this verse?" ) }] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, return_tensors="pt") input_ids = inputs["input_ids"].to(model.device)attention_mask = inputs["attention_mask"].to(model.device) with torch.no_grad(): outputs = model.generate( input_ids=input_ids, attention_mask=attention_mask, max_new_tokens=150, do_sample=False, pad_token_id=tokenizer.eos_token_id ) answer = tokenizer.decode( outputs[0][input_ids.shape[-1]:], skip_special_tokens=True) print(answer)