AtulDeshpande's picture
Create README.md
03fba61 verified
|
Raw
History Blame Contribute Delete
4.32 kB
# Mistral Technical Interview QA (LoRA + RAG)
## 📌 Overview
This model is a fine-tuned version of **Mistral-7B-Instruct** designed to answer **technical interview questions** in core Computer Science domains. It is trained on a curated dataset of technical question–answer pairs and evaluated under multiple experimental setups including vanilla LLM, fine-tuning, Retrieval-Augmented Generation (RAG), and hybrid approaches.
The goal of this project is to investigate the effectiveness of **parameter-efficient fine-tuning and retrieval augmentation** for improving technical question answering in low-resource settings.
---
## 🚀 Key Features
* Fine-tuned using **LoRA (Low-Rank Adaptation)** for memory-efficient training
* Supports **Retrieval-Augmented Generation (RAG)**
* Focused on Computer Science domains:
* Data Structures and Algorithms
* Operating Systems
* Computer Networks
* Databases
* OOP and Core CS fundamentals
* Lightweight adapter weights for fast deployment
* Evaluated using BLEU, ROUGE, BERTScore, and Exact Match
---
## 🧠 Base Model
* Model: `mistralai/Mistral-7B-Instruct-v0.2`
* Architecture: Decoder-only transformer
* Training method: Supervised fine-tuning with LoRA
---
## 📚 Dataset
The dataset consists of approximately **2,000 technical question–answer pairs** covering multiple Computer Science domains.
### Dataset preparation:
* Initial seed dataset manually curated
* Extended using synthetic augmentation
* Duplicate and semantic filtering applied
* Train / validation / test splits created
* Format: JSONL
⚠️ Note: Some data samples were generated using LLM-based augmentation and manually filtered for quality.
---
## ⚙️ Training Details
### Fine-tuning approach:
* Parameter-efficient LoRA tuning
* Frozen base model weights
* Adapter-only training
### Configuration:
* LoRA rank: 8
* Learning rate: 1e-4
* Epochs: 3
* Sequence length: 384
* Precision: FP16
* Gradient accumulation used
Training was performed on an NVIDIA RTX 3090 (24GB VRAM).
---
## 🔍 Retrieval-Augmented Generation (RAG)
A semantic retriever was implemented using:
* Sentence Transformers (`all-MiniLM-L6-v2`)
* FAISS vector database
* Top-k semantic search
Retrieved context is injected into the prompt before generation.
---
## 📊 Evaluation
The model was evaluated under four experimental settings:
1. Vanilla Mistral
2. RAG + Vanilla
3. Fine-tuned Mistral
4. RAG + Fine-tuned
Metrics used:
* BLEU-4
* ROUGE-L
* BERTScore
* Exact Match
Results showed that:
* Fine-tuning improves answer quality and domain specificity
* RAG improves factual grounding
* The hybrid approach provides the best performance
---
## 🧪 Intended Use
This model is designed for:
* Interview preparation
* Educational tools
* Technical tutoring
* Research in retrieval-augmented systems
It is not intended for:
* Medical or legal decision-making
* Safety-critical systems
---
## ⚠️ Limitations
* Dataset size is relatively small
* Synthetic data may introduce bias
* Performance may vary for unseen or highly specialized domains
* Retrieval quality depends on the vector database
---
## 🔐 Ethical Considerations
The dataset does not contain personally identifiable or sensitive information. The model may generate incorrect or outdated information and should be used with human oversight.
---
## 📦 How to Use
### Load merged model:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("yourusername/repo-name")
tokenizer = AutoTokenizer.from_pretrained("yourusername/repo-name")
```
### Load LoRA version:
```python
from transformers import AutoModelForCausalLM
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
model = PeftModel.from_pretrained(base, "yourusername/repo-name")
```
---
## 📈 Future Work
* Larger and more diverse dataset
* Multi-hop retrieval
* Improved retriever training
* Reinforcement learning for answer quality
* Human evaluation
## hookup
## 👨‍💻 Author
Final-year Computer Science project focused on applied LLM systems, parameter-efficient fine-tuning, and retrieval-augmented generation.
---
## 📜 License
Please refer to the base model license (Mistral AI).