# MASHQA-Mistral-7B-Instruct

### Model Description

MASHQA-Mistral-7B-Instruct is a large language model fine-tuned on healthcare question-answer pairs to respond safely to the users' queries. It is based on the Mistral-7B Instruct Architecture.
- Model creator: [Garima Sohi](https://huggingface.co/sohi-g/MASHQA-Mistral-7B-Instruct)
- Original model: [Mistral-7B-Instruct](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
  
### Dataset Description
- Data Source: [MASHQA (Multiple Answer Spans Healthcare Question Answering) Data](https://drive.google.com/file/d/1ism3N3kMapliaORZQaQU8obNycF8rH9p/view)
- Data Description: Multiple question-answer pairs in JSON format.


## Prompt template

```
[INST]Act as a Multiple Answer Spans Healthcare Question Answering helpful assistant and answer the user's questions in details with reasoning. Do not give any false information. In case you don't have answer, specify why the question can't be answered.
    
### Question:
{question}

### Answer:

```
  
## Basics
*This section provides information about the model type, version, license, funders, release date, developers, and contact information.*
*It is useful for anyone who wants to reference the model.*

  
**Developed by:**  [Garima Sohi](https://huggingface.co/sohi-g)
    
**Model Type:** Transformer-based Large Language Model

**Version:** 1.0.0

**Languages:** English

**License:** Apache 2.0

**Send Questions to:** garimasohi007@gmail.com


## Technical Specifications
*This section includes details about the model objective and architecture, and the compute infrastructure.*
*It is useful for people interested in model development.*

### Model Architecture and Objective

* Modified from Mistral-7B-Instruct

**Objective:** Safely respond to users' health-related queries.
    
### Hardware and Software - Compute Infrastructure

* 4 NVIDIA L4 GPUs & 48 vCPUs

* Environment: PyTorch (pytorch-2.0 w/ CUDA-11.8; see [Github link](https://github.com/pytorch/pytorch))

* CPU: GCP G2 Standard 48 (Platform: Intel Cascade Lake) (Accelerator Optimized)

* CPU memory: 192GB RAM

* GPU memory: 30GB per GPU

## Training
*This section provides information about the training.*
*It is useful for people who want to learn more about the model inputs and training footprint.*

The following bits and bytes quantization config was used during training:

* quant_method: bitsandbytes
* load_in_8bit: False
* load_in_4bit: True
* llm_int8_threshold: 6.0
* llm_int8_skip_modules: None
* llm_int8_enable_fp32_cpu_offload: False
* llm_int8_has_fp16_weight: False
* bnb_4bit_quant_type: nf4
* bnb_4bit_use_double_quant: True
* bnb_4bit_compute_dtype: float16
  
Framework versions
* PEFT 0.4.0
    
    
## How to use

This model can be easily used and deployed using HuggingFace's ecosystem. This needs `transformers` and `accelerate` installed. The model can be downloaded as follows:

[MASHQA-Mistral-7B-Instruct](https://huggingface.co/sohi-g/MASHQA-Mistral-7B-Instruct)

## Intended Use

This model is being created in order to enable public research on large language models (LLMs). LLMs are intended to be used for language generation or as a pre-trained base model that can be further fine-tuned for specific tasks. The use cases below are not exhaustive.

### Direct Use

-   Text generation

-   Exploring characteristics of language generated by a language model

    -   Examples: Cloze tests, counterfactuals, generations with reframings

### Downstream Use

-   Tasks that leverage language models include: Information Extraction, Question Answering, Summarization


#### Out-of-scope Uses

Using the model in [high-stakes](#high-stakes) settings is out of scope for this model.  The model is not designed for [critical decisions](#critical-decisions) nor uses with any material consequences on an individual's livelihood or wellbeing. The model outputs content that appears factual but may not be correct.  

Out-of-scope Uses Include:

-   Usage for evaluating or scoring individuals, such as for employment, education, or credit

-   Applying the model for critical automatic decisions, generating factual content, creating reliable summaries, or generating predictions that must be correct

#### Misuse

Intentionally using the model for harm, violating [human rights](#human-rights), or other kinds of malicious activities, is a misuse of this model. This includes:

-   Spam generation

-   Disinformation and influence operations

-   Disparagement and defamation

-   Harassment and abuse
  
-   [Deception](#deception)

-   Unconsented impersonation and imitation

-   Unconsented surveillance 

-   Generating content without attribution to the model, as specified in the [RAIL License, Use Restrictions](https://huggingface.co/spaces/bigscience/license)

## Intended Users

### Direct Users

-   General Public

-   Researchers

-   Students

-   Educators

-   Engineers/developers

-   Non-commercial entities

-   Health Industry

# Risks and Limitations
*This section identifies foreseeable harms and misunderstandings.*

Model may:

-   Overrepresent some viewpoints and underrepresent others

-   Contain stereotypes
  
-   Contain [personal information](#personal-data-and-information)

-   Generate:

    -   Hateful, abusive, or violent language

    -   Discriminatory or prejudicial language

    -   Content that may not be appropriate for all settings, including sexual content

-   Make errors, including producing incorrect information as if it were factual

-   Generate irrelevant or repetitive outputs

-   Induce users into attributing human traits to it, such as sentience or consciousness


# Evaluation
*This section describes the evaluation protocols and provides the results.*


**Train-time Evaluation:**

Final checkpoint after 500 epochs:

- Training Loss: 1.216



# Recommendations
*This section provides information on warnings and potential mitigations.*

-   Indirect users should be made aware when the content they're working with is created by the LLM.

-   Users should be aware of [Risks and Limitations](#risks-and-limitations), and include an appropriate age disclaimer or blocking interface as necessary.

-   Users of the model should provide mechanisms for those affected to provide feedback, such as an email address for comments.

# Model Card Authors
Garima Sohi
{"language": ["en"], "license": "apache-2.0", "tags": ["pytorch", "mistral", "Gen-AI", "health-QnA"], "pipeline_tag": "text-generation"}
transformers safetensors mistral text-generation pytorch Gen-AI health-QnA conversational en license:apache-2.0 autotrain_compatible endpoints_compatible text-generation-inference region:us