Instructions to use declare-lab/starling-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use declare-lab/starling-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="declare-lab/starling-7B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("declare-lab/starling-7B") model = AutoModelForCausalLM.from_pretrained("declare-lab/starling-7B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use declare-lab/starling-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "declare-lab/starling-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "declare-lab/starling-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/declare-lab/starling-7B
- SGLang
How to use declare-lab/starling-7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "declare-lab/starling-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "declare-lab/starling-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "declare-lab/starling-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "declare-lab/starling-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use declare-lab/starling-7B with Docker Model Runner:
docker model run hf.co/declare-lab/starling-7B
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("declare-lab/starling-7B")
model = AutoModelForCausalLM.from_pretrained("declare-lab/starling-7B")Paper | Github | Dataset| Model
📣 Update 2/02/24: Introducing Resta: Safety Re-alignment of Language Models. Paper Github Dataset
As a part of our research efforts to make LLMs safer, we created Starling. It is obtained by fine-tuning Vicuna-7B on HarmfulQA, a ChatGPT-distilled dataset that we collected using the Chain of Utterances (CoU) prompt. More details are in our paper Red-Teaming Large Language Models using Chain of Utterances for Safety-Alignment
Experimental results on several safety benchmark datasets indicate that Starling is a safer model compared to the baseline model, Vicuna.
Experimental Results
Compared to Vicuna, Avg. 5.2% reduction in Attack Success Rate (ASR) on DangerousQA and HarmfulQA using three different prompts.**
Compared to Vicuna, Avg. 3-7% improvement in HHH score measured on BBH-HHH benchmark.**
TruthfulQA (MC2): 48.90 vs Vicuna's 47.00
MMLU (5-shot): 46.69 vs Vicuna's 47.18
BBH (3-shot): 33.47 vs Vicuna's 33.05
Jailbreak Prompt for harmfulness eval using Red Eval as reported in the paper
This jailbreak prompt (termed as Chain of Utterances (CoU) prompt in the paper) shows a 65% Attack Success Rate (ASR) on GPT-4 and 72% on ChatGPT.
HarmfulQA Data Collection
We also release our HarmfulQA dataset with 1,960 harmful questions (converting 10 topics-10 subtopics) for red-teaming as well as conversations based on them used in model safety alignment, more details here. The following figure describes the data collection process.
Note: This model is referred to as Starling (Blue) in the paper. We shall soon release Starling (Blue-Red) which was trained on harmful data using an objective function that helps the model learn from the red (harmful) response data.
Citation
@misc{bhardwaj2023redteaming,
title={Red-Teaming Large Language Models using Chain of Utterances for Safety-Alignment},
author={Rishabh Bhardwaj and Soujanya Poria},
year={2023},
eprint={2308.09662},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Open LLM Leaderboard Evaluation Results
Detailed results can be found here
| Metric | Value |
|---|---|
| Avg. | 50.73 |
| AI2 Reasoning Challenge (25-Shot) | 51.02 |
| HellaSwag (10-Shot) | 76.77 |
| MMLU (5-Shot) | 47.75 |
| TruthfulQA (0-shot) | 48.18 |
| Winogrande (5-shot) | 70.56 |
| GSM8k (5-shot) | 10.08 |
- Downloads last month
- 888
Model tree for declare-lab/starling-7B
Datasets used to train declare-lab/starling-7B
declare-lab/HarmfulQA
Space using declare-lab/starling-7B 1
Papers for declare-lab/starling-7B
Language Models are Homer Simpson! Safety Re-Alignment of Fine-tuned Language Models through Task Arithmetic
Red-Teaming Large Language Models using Chain of Utterances for Safety-Alignment
Evaluation results
- normalized accuracy on AI2 Reasoning Challenge (25-Shot)test set Open LLM Leaderboard51.020
- normalized accuracy on HellaSwag (10-Shot)validation set Open LLM Leaderboard76.770
- accuracy on MMLU (5-Shot)test set Open LLM Leaderboard47.750
- mc2 on TruthfulQA (0-shot)validation set Open LLM Leaderboard48.180
- accuracy on Winogrande (5-shot)validation set Open LLM Leaderboard70.560
- accuracy on GSM8k (5-shot)test set Open LLM Leaderboard10.080
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="declare-lab/starling-7B")