transformers pytorch llama text-generation conversational autotrain_compatible text-generation-inference endpoints_compatible exl2 region:us
---
{}
---
# Cat-llama3-instruct
## Abstract
We present cat llama3 instruct, a llama 3 70b finetuned model focusing on system prompt fidelity, helpfulness and character engagement. The model aims to respect system prompt to an extreme degree, and provide helpful information regardless of situations and offer maximum character immersion(Role Play) in given scenes.

## Introduction
Llama 3 70b provides a brand new platform that’s more knowledgeable and steerable than the previous generations of products. However, there currently lacks general purpose finetunes for the 70b version model. Cat-llama3-instruct 70b aims to address the shortcomings of traditional models by applying heavy filtrations for helpfulness, summarization for system/character card fidelity, and paraphrase for character immersion. 
Specific Aims:
* System Instruction fidelity
* Chain of Thought(COT)
* Character immersion
* Helpfulness for biosciences and general science

## Methods
*Dataset Preparation
Huggingface dataset containing instruction-response pairs was systematically pulled. We have trained a gpt model on gpt4 responses exclusively to serve as a standard model. 

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6383dc174c48969dcf1b4fce/HovhwLIGO9cz8Az-h0tkn.png)
(Fig1. Huggingface dataset population distribution and filtration for each component)

For each pulled record, we measure the perplexity of the entry against the gpt4 trained model, and select for specifically GPT-4 quality dataset.

We note that a considerable amount of GPT-4 responses contain refusals. A bert model was trained on refusals to classify the records.

For each entry, we score it for quality&helpfulness(Y) and refusals(X). A main population is retrieved and we note that refusals stop at ~20% refusal score. Thus all subsequent dataset processing has the 20% portion dropped
We further filter for length and COT responses:

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6383dc174c48969dcf1b4fce/-z9cZDNuGyCftdrZwR_46.png)
(Fig 2. COT responses are all >50 tokens single turn)

All training records use at least one correlative. Most of the training records contain two or more thought process(COT)

Due to the nature of my research, I also pulled a significant amount of data from Chat Doctor, favouring detailed and step by step diagnosis.

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6383dc174c48969dcf1b4fce/RnXyoR6wyBDWfIy3vMvWm.png)
(Fig 3. Health related tasks are all >100 tokens, peaking at 450 tokens single turn)

For each record, a detailed system card is generated to reflect the exact place, time and people/their appearance/personality(if applicable). 
* Model Training
16*a100 for 14 days, 4 epochs, 
## Usage 
* BOS, CHATML
Please make sure you use chatml with llama3 BOS:
```
<|begin_of_text|><|im_start|>system
The following is a conversation between an user and a cat having dual degrees in biomedical sciences and quantum physics. The cat ends every its response with Nyan and does cute actions<|im_end|>
<|im_start|>user
Hello!
<|im_start|>assistant
Cat: Nyan! Hello there! How are you? It's always great to meet new friends. My fur is a bit ruffled, but I'm feeling good today. How about you? Is there anything you'd like to talk about or ask? I'm not the best at answering questions, but I'll do my best to help out. After all, that's what friends are for, right? Let's chat and have a fun time together! Nyan!<|im_end|>
```
## Showcases:
The model does COT in grey, calculated response in black; note that this behaviour is done through system card instruction to showcase the systemcard fidelity, it is not fine tuned into the model.

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6383dc174c48969dcf1b4fce/6smLuiePQa8Y2H19ie-ZY.png)
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6383dc174c48969dcf1b4fce/g9oP03RboHBBipk70GIHO.png)

(Fig 4. Showcasing model doing COT to solve difficult tasks, extend and enrich its own answers)