gguf arxiv:2106.09685 endpoints_compatible region:us
---
{}
---
Quantization made by Richard Erkhov.

[Github](https://github.com/RichardErkhov)

[Discord](https://discord.gg/pvy7H8DZMG)

[Request more models](https://github.com/RichardErkhov/quant_request)


phi-2-insurance_qa-sft-lora - GGUF
- Model creator: https://huggingface.co/soulhq-ai/
- Original model: https://huggingface.co/soulhq-ai/phi-2-insurance_qa-sft-lora/


| Name | Quant method | Size |
| ---- | ---- | ---- |
| [phi-2-insurance_qa-sft-lora.Q2_K.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q2_K.gguf) | Q2_K | 1.03GB |
| [phi-2-insurance_qa-sft-lora.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.IQ3_XS.gguf) | IQ3_XS | 1.12GB |
| [phi-2-insurance_qa-sft-lora.IQ3_S.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.IQ3_S.gguf) | IQ3_S | 1.16GB |
| [phi-2-insurance_qa-sft-lora.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q3_K_S.gguf) | Q3_K_S | 1.16GB |
| [phi-2-insurance_qa-sft-lora.IQ3_M.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.IQ3_M.gguf) | IQ3_M | 1.23GB |
| [phi-2-insurance_qa-sft-lora.Q3_K.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q3_K.gguf) | Q3_K | 1.33GB |
| [phi-2-insurance_qa-sft-lora.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q3_K_M.gguf) | Q3_K_M | 1.33GB |
| [phi-2-insurance_qa-sft-lora.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q3_K_L.gguf) | Q3_K_L | 1.47GB |
| [phi-2-insurance_qa-sft-lora.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.IQ4_XS.gguf) | IQ4_XS | 1.43GB |
| [phi-2-insurance_qa-sft-lora.Q4_0.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q4_0.gguf) | Q4_0 | 1.49GB |
| [phi-2-insurance_qa-sft-lora.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.IQ4_NL.gguf) | IQ4_NL | 1.5GB |
| [phi-2-insurance_qa-sft-lora.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q4_K_S.gguf) | Q4_K_S | 1.51GB |
| [phi-2-insurance_qa-sft-lora.Q4_K.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q4_K.gguf) | Q4_K | 1.62GB |
| [phi-2-insurance_qa-sft-lora.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q4_K_M.gguf) | Q4_K_M | 1.62GB |
| [phi-2-insurance_qa-sft-lora.Q4_1.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q4_1.gguf) | Q4_1 | 1.65GB |
| [phi-2-insurance_qa-sft-lora.Q5_0.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q5_0.gguf) | Q5_0 | 1.8GB |
| [phi-2-insurance_qa-sft-lora.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q5_K_S.gguf) | Q5_K_S | 1.8GB |
| [phi-2-insurance_qa-sft-lora.Q5_K.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q5_K.gguf) | Q5_K | 1.87GB |
| [phi-2-insurance_qa-sft-lora.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q5_K_M.gguf) | Q5_K_M | 1.87GB |
| [phi-2-insurance_qa-sft-lora.Q5_1.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q5_1.gguf) | Q5_1 | 1.95GB |
| [phi-2-insurance_qa-sft-lora.Q6_K.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q6_K.gguf) | Q6_K | 2.13GB |
| [phi-2-insurance_qa-sft-lora.Q8_0.gguf](https://huggingface.co/RichardErkhov/soulhq-ai_-_phi-2-insurance_qa-sft-lora-gguf/blob/main/phi-2-insurance_qa-sft-lora.Q8_0.gguf) | Q8_0 | 2.75GB |




Original model description:
---
license: mit
license_link: >-
  https://huggingface.co/soulhq-ai/phi-2-insurance_qa-sft-lora/resolve/main/LICENSE
language:
- en
pipeline_tag: text-generation
tags:
- nlp
- insurance
- lora
- llm
- phi-2
- transformers
- qa
- sft

datasets:
- soulhq-ai/insuranceQA-v2
widget:
- text: "### Instruction: What is the difference between health and life insurance?\n#### Response: "
- text: "### Instruction: Does Homeowners Insurance Cover Death Of Owner?\n#### Response: "

---
## Model Summary
This model builds on the architecture of  <a href="https://huggingface.com/microsoft/phi-2">Microsoft's Phi-2</a>, incorporating the LoRA [[1]](#1) paradigm for supervised fine-tuning on a high quality question answering dataset in the insurance domain.
Thus, `soulhq-ai/phi-2-insurance_qa-sft-lora` serves as a text generation model capable of answering questions around insurance.

## Dataset
We utilise the InsuranceQA dataset [[2]](#2), which comprises 27.96K QA pairs related to the insurance domain.
The content of this dataset consists of questions from real world users, the answers with high quality were composed by insurance professionals with deep domain knowledge.
Since the dataset isn't available in a readable format on the web, we make it available on huggingface in a `jsonl` format, at <a href="https://huggingface.com/datasets/soulhq-ai/insuranceQA-v2">soulhq-ai/insuranceQA-v2</a>.


## Usage 
Phi-2 compatibility has been integrated in the development version (4.37.0.dev) of `transformers`. Until the official version is released through `pip`, ensure that you are doing one of the following:

* When loading the model, ensure that `trust_remote_code=True` is passed as an argument of the `from_pretrained()` function.

* Update your local transformers to the development version: `pip uninstall -y transformers && pip install git+https://github.com/huggingface/transformers`. The previous command is an alternative to cloning and installing from the source.

The current transformers version can be verified with: `pip list | grep transformers`.

### Input Format
```
### Instruction: <Question>
### Response: 
```

For instance:
```
### Instruction: What does Basic Homeowners Insurance Cover?
### Response: 
```

### Inference Code

```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

torch.set_default_device("cuda")

model = AutoModelForCausalLM.from_pretrained("soulhq-ai/phi-2-insurance_qa-sft-lora", torch_dtype="auto", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("soulhq-ai/phi-2-insurance_qa-sft-lora", trust_remote_code=True)

inputs = tokenizer('''### Instruction: What Does Basic Homeowners Insurance Cover?\n### Response: ''', return_tensors="pt", return_attention_mask=False)

outputs = model.generate(**inputs, max_length=1024)
text = tokenizer.batch_decode(outputs)[0]
print(text)
```

## Training

### Model
* Architecture: Phi-2, with LoRA modifications for efficient Insurance domain-specific fine-tuning.
* Context length: 2048 tokens
* Modifications: Added `<|eostoken|>` for end-of-response learning - to help the model learn the end of responses, facilitating its use in dialogue systems.

### Configuration
* Hyperparameters:
   * learning_rate=2e-5,
   * batch_size=8,
   * epochs=10,
   * lora_r=32,
   * lora_alpha=64.
* Infrastructure: Trained on an NVIDIA A40 and utilized the `FullyShardedDataParallelPlugin` for CPU offloading.

## Evaluation
Coming Soon!
 
## Limitations of `soulhq-ai/phi-2-insurance_qa-sft-lora`
* Generate Inaccurate Facts: The model may produce incorrect code snippets and statements. Users should treat these outputs as suggestions or starting points, not as definitive or accurate solutions.
* Unreliable Responses to Instruction: It may struggle or fail to adhere to intricate or nuanced instructions provided by users.
* Language Limitations: The model is primarily designed to understand standard English. Informal English, slang, or any other languages might pose challenges to its comprehension, leading to potential misinterpretations or errors in response.
* Potential Societal Biases: Phi-2 is not entirely free from societal biases despite efforts in assuring training data safety. There's a possibility it may generate content that mirrors these societal biases, particularly if prompted or instructed to do so. We urge users to be aware of this and to exercise caution and critical thinking when interpreting model outputs.
* Toxicity: Despite being trained with carefully selected data, the model can still produce harmful content if explicitly prompted or instructed to do so. We chose to release the model to help the open-source community develop the most effective ways to reduce the toxicity of a model directly after pretraining.
* Verbosity: Phi-2 being a base model often produces irrelevant or extra text and responses following its first answer to user prompts within a single turn. This is due to its training dataset being primarily textbooks, which results in textbook-like responses.


## License
The model is licensed under the [MIT license](https://huggingface.co/soulhq-ai/phi-2-insurance_qa-sft-lora/blob/main/LICENSE).


## Citations
[1] <a id="1" href="https://arxiv.org/abs/2106.09685">Hu, Edward J., et al. "Lora: Low-rank adaptation of large language models." arXiv preprint arXiv:2106.09685 (2021).</a></br>
[2] <a id="2" href="https://ieeexplore.ieee.org/abstract/document/7404872/">Feng, Minwei, et al. "Applying deep learning to answer selection: A study and an open task." 2015 IEEE workshop on automatic speech recognition and understanding (ASRU). IEEE, 2015.</a>


