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:

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("yourusername/repo-name")
tokenizer = AutoTokenizer.from_pretrained("yourusername/repo-name")

Load LoRA version:

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).