|
|
--- |
|
|
library_name: transformers |
|
|
tags: |
|
|
- mistral-8b |
|
|
- openassistant |
|
|
- openassisted-english |
|
|
- language-modeling |
|
|
- text-generation |
|
|
- conversational-ai |
|
|
license: apache-2.0 |
|
|
language: |
|
|
- en |
|
|
base_model: |
|
|
- mistralai/Mistral-7B-Instruct-v0.1 |
|
|
--- |
|
|
|
|
|
|
|
|
# Mistral-8B Instruction-Tuned on OpenAssisted-English |
|
|
|
|
|
This model is a fine-tuned version of [Mistral-8B](https://huggingface.co/mistralai/Mistral-7B-v0.1) on the [OpenAssisted-English](https://huggingface.co/datasets/OpenAssistant/oasst1) dataset using Hugging Face's `transformers` library. The model is optimized for high-quality conversational and instruction-following tasks in English. |
|
|
|
|
|
--- |
|
|
|
|
|
## Model Details |
|
|
|
|
|
### Model Description |
|
|
|
|
|
This model is an instruction-tuned version of the Mistral-8B architecture, fine-tuned specifically to follow human instructions and engage in helpful, safe, and factual conversations. It leverages the OpenAssisted-English dataset, a cleaned and filtered subset from OpenAssistant's OASST1 dataset. |
|
|
|
|
|
* **Developed by:** Akshay Kumar BM |
|
|
* **Fine-tuned using:** Hugging Face Transformers |
|
|
* **Dataset used:** OpenAssisted-English (from OpenAssistant) |
|
|
* **Model type:** Decoder-only Transformer |
|
|
* **Language(s):** English |
|
|
* **License:** Apache 2.0 |
|
|
* **Finetuned from model:** mistralai/Mistral-7B-v0.1 |
|
|
|
|
|
--- |
|
|
|
|
|
## Model Sources |
|
|
|
|
|
* **Base Model:** [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) |
|
|
* **Dataset:** [OpenAssisted-English](https://huggingface.co/datasets/OpenAssistant/oasst1) |
|
|
* **Library:** Hugging Face Transformers |
|
|
* **Frameworks:** PyTorch, Accelerate |
|
|
|
|
|
--- |
|
|
|
|
|
## Uses |
|
|
|
|
|
### Direct Use |
|
|
|
|
|
* Conversational AI |
|
|
* Instruction-following agents |
|
|
* Text completion and generation |
|
|
* Chatbot backends |
|
|
* Question answering |
|
|
|
|
|
### Downstream Use |
|
|
|
|
|
* Fine-tuning for specific domains (e.g., legal, medical, education) |
|
|
* Integration into multi-agent systems or RAG pipelines |
|
|
* Prompt engineering and prototyping |
|
|
|
|
|
### Out-of-Scope Use |
|
|
|
|
|
* Use in high-risk environments (e.g., medical diagnosis, legal decision making) without human oversight. |
|
|
* Generating misinformation, harmful, offensive, or biased content. |
|
|
* Any use violating Hugging Face’s or Apache 2.0 licensing terms. |
|
|
|
|
|
--- |
|
|
|
|
|
## Bias, Risks, and Limitations |
|
|
|
|
|
Despite being fine-tuned for alignment, the model may: |
|
|
|
|
|
* Hallucinate facts. |
|
|
* Reflect biases present in the OpenAssistant dataset. |
|
|
* Respond unpredictably to adversarial or ambiguous prompts. |
|
|
|
|
|
### Recommendations |
|
|
|
|
|
* Always include a human-in-the-loop for sensitive applications. |
|
|
* Evaluate in domain-specific scenarios before deployment. |
|
|
* Apply additional safety filters for production use. |
|
|
|
|
|
--- |
|
|
|
|
|
## How to Get Started |
|
|
|
|
|
```python |
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
|
|
model_id = "Akshaykumarbm/OpenAssisted-English-Mistral-7b" |
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id) |
|
|
model = AutoModelForCausalLM.from_pretrained(model_id) |
|
|
|
|
|
input_prompt = "Explain quantum computing in simple terms." |
|
|
inputs = tokenizer(input_prompt, return_tensors="pt") |
|
|
outputs = model.generate(**inputs, max_new_tokens=200) |
|
|
print(tokenizer.decode(outputs[0], skip_special_tokens=True)) |
|
|
``` |
|
|
|
|
|
--- |
|
|
|
|
|
## Training Details |
|
|
|
|
|
### Training Data |
|
|
|
|
|
The model was trained on the **OpenAssisted-English** dataset, which includes high-quality, human-annotated instruction-response pairs derived from OpenAssistant’s OASST1 dataset. |
|
|
|
|
|
* Format: Instruction + Response |
|
|
* Filters: Language = English, Quality ≥ 3, Assistant messages only |
|
|
* Size: \~100k samples |
|
|
|
|
|
### Training Procedure |
|
|
|
|
|
#### Preprocessing |
|
|
|
|
|
* Tokenization: BPE tokenizer from Mistral |
|
|
* Truncation: 4096 tokens |
|
|
* Format: `<s>[INST] prompt [/INST] response</s>` |
|
|
|
|
|
#### Hyperparameters |
|
|
|
|
|
* **Precision:** bf16 mixed precision |
|
|
* **Batch size:** 512 (global) |
|
|
* **Epochs:** 15 |
|
|
* **Optimizer:** AdamW |
|
|
* **LR Scheduler:** CosineDecay |
|
|
* **Learning rate:** 2e-5 |
|
|
* **Warmup steps:** 500 |
|
|
|
|
|
#### Compute |
|
|
|
|
|
* **Hardware:** AMD MI300 |
|
|
* **Training time:** \~18 hours |
|
|
* **Frameworks:** PyTorch + Accelerate + DDP |
|
|
|
|
|
--- |
|
|
|
|
|
## Evaluation |
|
|
|
|
|
### Testing Data |
|
|
|
|
|
* Held-out subset from OpenAssisted-English |
|
|
* Manual eval for coherence, helpfulness, and safety |
|
|
* Evaluation on MT-Bench and AlpacaEval (optional) |
|
|
|
|
|
### Metrics |
|
|
|
|
|
* **Helpfulness Score** (manual): \~7.2/10 |
|
|
* **Toxicity (Perspective API):** <1% |
|
|
* **BLEU, ROUGE:** Used to compare with gold responses |
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
## Technical Specifications |
|
|
|
|
|
* **Architecture:** Mistral 8B (decoder-only transformer) |
|
|
* **Tokenizer:** Mistral Tokenizer (32k vocab) |
|
|
* **Context Length:** 8k tokens |
|
|
* **Parameters:** \~8.1 billion |
|
|
|
|
|
--- |
|
|
|
|
|
## Citation |
|
|
|
|
|
If you use this model, please cite the original Mistral model and OpenAssistant dataset. |
|
|
|
|
|
```bibtex |
|
|
@misc{mistral2023, |
|
|
title={Mistral 7B}, |
|
|
author={Mistral AI}, |
|
|
year={2023}, |
|
|
url={https://mistral.ai/news/announcing-mistral-7b/} |
|
|
} |
|
|
|
|
|
@misc{openassistant2023, |
|
|
title = {OpenAssistant Conversations - OASST1}, |
|
|
author = {OpenAssistant Contributors}, |
|
|
year = {2023}, |
|
|
url = {https://huggingface.co/datasets/OpenAssistant/oasst1} |
|
|
} |
|
|
``` |
|
|
|
|
|
--- |
|
|
|
|
|
## Contact |
|
|
|
|
|
* **Author:** Akshay Kumar BM |
|
|
* **Email:** [akshaykumarbedre.bm@gmail.com](mailto:akshaykumarbedre.bm@gmail.com) |
|
|
* **GitHub:** [akshaykumarbedre](https://github.com/akshaykumarbedre) |
|
|
* **Hugging Face:** [akshaykumarbm](https://huggingface.co/akshaykumarbm) |
|
|
|
|
|
--- |