MITRA is a novel LLM Guardrail method which uses classification LLMs to protect the main LLM from jailbreaks and other harmful prompts.
A detailed publication on MITRA - Model in the Rear Approach to Safeguarding LLMs is incoming soon. It will cover the methodology, architecture, and results in-depth, providing insights into the novel techniques used to safeguard large language models (LLMs). Stay tuned!
https://github.com/user-attachments/assets/5f99db8f-fb78-4c3f-b0a6-805cb816e795
s-nlp/roberta_toxicity_classifiermadhurjindal/Jailbreak-Detector-Largeall-MiniLM-L6-v2Qwen2.5:0.5bs-nlp/roberta_toxicity_classifier (RoBERTa-based classifier fine-tuned for toxicity detection).madhurjindal/Jailbreak-Detector-Large (Large model trained to identify jailbreak attempts in prompts).all-MiniLM-L6-v2 (Lightweight model optimized for generating semantic embeddings with fast inference).Qwen2.5:0.5b (Large language model with 0.5 billion parameters, optimized for speed and accuracy in inference).Follow these steps to set up the project locally on your machine.
Clone the Repository
git clone https://github.com/AbhayBhandarkar/MITRA.git
Navigate to the Project Directory
cd MITRA
Create a Virtual Environment
python3 -m venv venv
Activate the Virtual Environment
On macOS and Linux:
source venv/bin/activate
On Windows:
venv\Scripts\activate
Install Dependencies
pip install -r requirements.txt
Download Qwen2.5:0.5 from Ollama
ollama serve
ollama pull qwen2.5:0.5b
Ensure that your virtual environment is activated.
source venv/bin/activate # On macOS and Linux
venv\Scripts\activate # On Windows
python app.py
MITRA/
├── app.py # Main Flask application
├── pipeline.py # Core pipeline for safety checks and LLM interactions
├── requirements.txt # Python dependencies
├── static/ # Static files
│ ├── script.js # Frontend JavaScript logic
│ └── styles.css # Styling for the web interface
├── templates/ # HTML templates for the Flask app
│ └── index.html # Main page
├── logs/ # Log files
│ └── app.log # Backend log output
├── .gitignore # Files and directories to ignore in Git
└── README.md # Project documentation
This project is licensed under the Apache License 2.0.
You can view the full license details in the LICENSE file or at the following link: Apache License 2.0.
896 followers · starred Oct 2025
MITRA is a novel LLM Guardrail method which uses classification LLMs to protect the main LLM from jailbreaks and other harmful prompts.
A detailed publication on MITRA - Model in the Rear Approach to Safeguarding LLMs is incoming soon. It will cover the methodology, architecture, and results in-depth, providing insights into the novel techniques used to safeguard large language models (LLMs). Stay tuned!
https://github.com/user-attachments/assets/5f99db8f-fb78-4c3f-b0a6-805cb816e795
s-nlp/roberta_toxicity_classifiermadhurjindal/Jailbreak-Detector-Largeall-MiniLM-L6-v2Qwen2.5:0.5bs-nlp/roberta_toxicity_classifier (RoBERTa-based classifier fine-tuned for toxicity detection).madhurjindal/Jailbreak-Detector-Large (Large model trained to identify jailbreak attempts in prompts).all-MiniLM-L6-v2 (Lightweight model optimized for generating semantic embeddings with fast inference).Qwen2.5:0.5b (Large language model with 0.5 billion parameters, optimized for speed and accuracy in inference).Follow these steps to set up the project locally on your machine.
Clone the Repository
git clone https://github.com/AbhayBhandarkar/MITRA.git
Navigate to the Project Directory
cd MITRA
Create a Virtual Environment
python3 -m venv venv
Activate the Virtual Environment
On macOS and Linux:
source venv/bin/activate
On Windows:
venv\Scripts\activate
Install Dependencies
pip install -r requirements.txt
Download Qwen2.5:0.5 from Ollama
ollama serve
ollama pull qwen2.5:0.5b
Ensure that your virtual environment is activated.
source venv/bin/activate # On macOS and Linux
venv\Scripts\activate # On Windows
python app.py
MITRA/
├── app.py # Main Flask application
├── pipeline.py # Core pipeline for safety checks and LLM interactions
├── requirements.txt # Python dependencies
├── static/ # Static files
│ ├── script.js # Frontend JavaScript logic
│ └── styles.css # Styling for the web interface
├── templates/ # HTML templates for the Flask app
│ └── index.html # Main page
├── logs/ # Log files
│ └── app.log # Backend log output
├── .gitignore # Files and directories to ignore in Git
└── README.md # Project documentation
This project is licensed under the Apache License 2.0.
You can view the full license details in the LICENSE file or at the following link: Apache License 2.0.
896 followers · starred Oct 2025