Maya LLM v1.0
A LoRA Adapter for Mistral-7B-Instruct-v0.2 | Fine-tuned 7.25B Parameter Language Model
π Model Description
Technical Classification: LoRA (Low-Rank Adaptation) adapter for parameter-efficient fine-tuning
Maya is a LoRA adapter trained on Mistral-7B-Instruct-v0.2. When loaded with the base model, it creates a fine-tuned 7.25 billion parameter language model specialized for conversational AI tasks.
Dataset: 15,000 instruction-response pairs (13,500 training / 1,500 validation)
The adapter was trained on carefully curated examples, enabling expertise in:
- Python Programming (basic to advanced)
- Machine Learning & AI concepts
- Data Ethics & AI Guidelines
- Business Analysis
- Market Research
- SQL & Databases
Created by: Parth B Mistry
Architecture: LoRA Adapter + Mistral-7B-Instruct-v0.2
Base Model: mistralai/Mistral-7B-Instruct-v0.2
Training Method: Supervised Fine-Tuning (SFT) with LoRA
Model Type: Parameter-Efficient Fine-Tuned Language Model
β‘ Quick Start
Installation
Required Libraries:
pip install transformers peft torch accelerate bitsandbytes
Usage
Note: This is a LoRA adapter, not a standalone model. You must load it with the base Mistral-7B model.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"mistralai/Mistral-7B-Instruct-v0.2",
device_map="auto",
torch_dtype=torch.float16
)
# Load Maya adapter
model = PeftModel.from_pretrained(base_model, "pmistryds/Maya-LLM-v1.0-bm")
tokenizer = AutoTokenizer.from_pretrained("pmistryds/Maya-LLM-v1.0-bm")
# Generate response
prompt = "[INST] Who created you? [/INST]"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Expected Output:
I was created by Parth B Mistry.
π― Model Details
| Attribute | Value |
|---|---|
| Base Model | Mistral-7B-Instruct-v0.2 |
| Total Parameters | 7.25 Billion |
| Trainable Parameters | 8.4 Million (LoRA) |
| Training Efficiency | 0.116% trainable |
| Adapter Size | ~50-100 MB |
| Full Model Size (with base) | ~14 GB (base) + 50MB (adapter) |
| Dataset Size | 15,000 instruction-response pairs |
| Training Split | 13,500 examples (90%) |
| Validation Split | 1,500 examples (10%) |
| Training Steps | 800 steps |
| Training Time | ~84 minutes on RTX A40 |
| Final Validation Loss | 1.206 |
| Method | LoRA (r=16, alpha=32) |
π‘ Use Cases
Maya LLM excels at:
- Code Assistance - Python programming help, debugging, best practices
- ML/AI Education - Explaining machine learning concepts clearly
- Data Ethics - Guidance on GDPR, data privacy, AI ethics
- Business Analysis - Market research, data analysis insights
- Database Queries - SQL help and optimization
π§ Training Details
Training Configuration
- LoRA Rank: 16
- LoRA Alpha: 32
- LoRA Dropout: 0.05
- Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Learning Rate: 5e-5 (conservative)
- Batch Size: 16 (effective)
- Max Steps: 800
- Optimizer: paged_adamw_8bit
- Precision: bfloat16
- GPU: NVIDIA RTX A40 (48GB)
Training Results
The model was trained with early stopping monitoring to prevent overfitting:
| Step | Training Loss | Validation Loss | Accuracy |
|---|---|---|---|
| 100 | 1.664 | 1.623 | 63.1% |
| 200 | 1.330 | 1.353 | 66.6% |
| 300 | 1.264 | 1.287 | 67.9% |
| 400 | 1.204 | 1.251 | 68.6% |
| 500 | 1.170 | 1.228 | 69.0% |
| 600 | 1.182 | 1.212 | 69.3% |
| 700 | 1.189 | 1.206 | 69.4% |
| 800 | 1.179 | 1.206 | 69.4% |
Best checkpoint: Step 500 (automatically selected)
π Deployment Options
Option 1: Gradio UI
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
model = PeftModel.from_pretrained(base, "pmistryds/Maya-LLM-v1.0-bm")
tokenizer = AutoTokenizer.from_pretrained("pmistryds/Maya-LLM-v1.0-bm")
def chat(message, history):
prompt = f"[INST] {message} [/INST]"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200)
return tokenizer.decode(outputs[0], skip_special_tokens=True).split("[/INST]")[1].strip()
gr.ChatInterface(fn=chat, title="Maya LLM").launch()
Option 2: FastAPI Server
from fastapi import FastAPI
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
app = FastAPI()
base = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
model = PeftModel.from_pretrained(base, "pmistryds/Maya-LLM-v1.0-bm")
tokenizer = AutoTokenizer.from_pretrained("pmistryds/Maya-LLM-v1.0-bm")
@app.post("/chat")
def chat(message: str):
prompt = f"[INST] {message} [/INST]"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return {"response": response.split("[/INST]")[1].strip()}
π Example Interactions
Example 1: Identity
User: Who created you?
Maya: I was created by Parth B Mistry.
Example 2: Basic Math
User: What is 2+2?
Maya: 2+2 equals 4.
Example 3: ML Explanation
User: Explain machine learning briefly.
Maya: Machine learning is a type of AI where a model learns patterns
from data instead of being explicitly programmed. It improves over
time as it sees more examples.
β οΈ Limitations
- Based on Mistral-7B (early 2024 training cutoff)
- May not have information on very recent events
- Best suited for educational and conversational purposes
- Adapter-based approach requires base model download
π Citation
@misc{maya-llm-v1,
author = {Parth B Mistry},
title = {Maya LLM: A Personalized AI Assistant},
year = {2024},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/pmistryds/Maya-LLM-v1.0-bm}},
}
π Links
- Creator GitHub: ParthDS02
- Model Repository: pmistryds/Maya-LLM-v1.0-bm
- Base Model: Mistral-7B-Instruct-v0.2
- Training Framework: TRL by HuggingFace
π License
This model inherits the Apache 2.0 license from the base Mistral-7B-Instruct-v0.2 model.
π Acknowledgments
- Mistral AI for the excellent base model
- HuggingFace for the training libraries (Transformers, TRL, PEFT)
- Community for LoRA and efficient fine-tuning techniques
Built with β€οΈ by Parth B Mistry
- Downloads last month
- 2
Model tree for pmistryds/Maya-LLM-v1.0-bm
Base model
mistralai/Mistral-7B-Instruct-v0.2