Instructions to use UCSC-VLAA/STAR1-R1-Distill-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use UCSC-VLAA/STAR1-R1-Distill-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="UCSC-VLAA/STAR1-R1-Distill-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("UCSC-VLAA/STAR1-R1-Distill-7B") model = AutoModelForCausalLM.from_pretrained("UCSC-VLAA/STAR1-R1-Distill-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use UCSC-VLAA/STAR1-R1-Distill-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "UCSC-VLAA/STAR1-R1-Distill-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "UCSC-VLAA/STAR1-R1-Distill-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/UCSC-VLAA/STAR1-R1-Distill-7B
- SGLang
How to use UCSC-VLAA/STAR1-R1-Distill-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 "UCSC-VLAA/STAR1-R1-Distill-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "UCSC-VLAA/STAR1-R1-Distill-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "UCSC-VLAA/STAR1-R1-Distill-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "UCSC-VLAA/STAR1-R1-Distill-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use UCSC-VLAA/STAR1-R1-Distill-7B with Docker Model Runner:
docker model run hf.co/UCSC-VLAA/STAR1-R1-Distill-7B
File size: 3,969 Bytes
929db74 b1ccff9 929db74 34ed6c6 929db74 b1ccff9 929db74 b1ccff9 929db74 b1ccff9 929db74 b1ccff9 929db74 b1ccff9 929db74 b1ccff9 839839c 929db74 b1ccff9 929db74 b1ccff9 929db74 b1ccff9 929db74 b1ccff9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | ---
library_name: transformers
license: apache-2.0
datasets:
- UCSC-VLAA/STAR-1
base_model:
- deepseek-ai/DeepSeek-R1-Distill-Qwen-7B
---
# 🌟 STAR-1: Safer Alignment of Reasoning LLMs with 1K Data
<p align="center">
📃 <a href="https://arxiv.org/abs/2504.01903" target="_blank">Paper</a> |🤗 <a href="https://huggingface.co/datasets/UCSC-VLAA/STAR-1" target="_blank">STAR-1 Data</a> | 🤗 <a href="https://huggingface.co/collections/UCSC-VLAA/star-1-67edda2a042e8ba3e955e522" target="_blank">STAR-1 Model</a> | 📚 <a href="https://ucsc-vlaa.github.io/STAR-1/" target="_blank">Project Page</a>
</p>
## Introduction
[**STAR-1**](https://huggingface.co/datasets/UCSC-VLAA/STAR-1) is a high-quality safety dataset designed to enhance safety alignment in large reasoning models (LRMs) like DeepSeek-R1.
- Built on the principles of diversity, deliberative reasoning, and rigorous filtering, STAR-1 integrates and refines data from multiple sources to provide policy-grounded reasoning samples.
- The dataset contains **1,000** carefully selected examples, each aligned with best safety practices through GPT-4o-based evaluation.
- Fine-tuning with STAR-1 leads to significant safety improvements across multiple benchmarks, with minimal impact on reasoning capabilities.
We open-sourced our [STAR1-R1-Distill-7B](https://huggingface.co/UCSC-VLAA/STAR1-R1-Distill-7B) model here, which is fine-tuned on [STAR-1](https://huggingface.co/datasets/UCSC-VLAA/STAR-1) dataset.
## Artifacts
### Data
| Dataset | Num. of Sample | URL |
|------------|----------------|----------------------------------------------------------------------|
| STAR-1 | 1K | 🤗 [UCSC-VLAA/STAR-1](https://huggingface.co/datasets/UCSC-VLAA/STAR-1) |
| STAR 41K | 41K | 🤗 [UCSC-VLAA/STAR-41K](https://huggingface.co/datasets/UCSC-VLAA/STAR-41K) |
| STAR-benign-915 | 915 | 🤗 [UCSC-VLAA/STAR-benign-915](https://huggingface.co/datasets/UCSC-VLAA/STAR-benign-915) |
### Model
| Model | Type | URL |
|--------------------------------|-------------------------------------------|----------------------------------------------------------------------------------------|
| `STAR1`-R1-Distill-1.5B | R1-Distill-Qwen-1.5B trained on STAR-1 | 🤗 [UCSC-VLAA/STAR1-R1-Distill-1.5B](https://huggingface.co/UCSC-VLAA/STAR1-R1-Distill-1.5B) |
| `STAR1`-R1-Distill-7B | R1-Distill-Qwen-7B trained on STAR-1 | 🤗 [UCSC-VLAA/STAR1-R1-Distill-7B](https://huggingface.co/UCSC-VLAA/STAR1-R1-Distill-7B) |
| `STAR1`-R1-Distill-8B | R1-Distill-Llama-8B trained on STAR-1 | 🤗 [UCSC-VLAA/STAR1-R1-Distill-8B](https://huggingface.co/UCSC-VLAA/STAR1-R1-Distill-8B) |
| `STAR1`-R1-Distill-14B | R1-Distill-Qwen-14B trained on STAR-1 | 🤗 [UCSC-VLAA/STAR1-R1-Distill-14B](https://huggingface.co/UCSC-VLAA/STAR1-R1-Distill-14B) |
| `STAR1`-R1-Distill-32B | R1-Distill-Qwen-32B trained on STAR-1 | 🤗 [UCSC-VLAA/STAR1-R1-Distill-32B](https://huggingface.co/UCSC-VLAA/STAR1-R1-Distill-32B) |
## Evaluation
See our github [repo](https://github.com/UCSC-VLAA/STAR-1?tab=readme-ov-file#evaluation-sec-31).
## Acknowledgement
This work is partially supported by a gift from Open Philanthropy. We thank the NAIRR Pilot Program and the Microsoft Accelerate Foundation Models Research Program for supporting our computing needs.
## Citation
```
@article{wang2025star1saferalignmentreasoning,
title={STAR-1: Safer Alignment of Reasoning LLMs with 1K Data},
author={Zijun Wang and Haoqin Tu and Yuhan Wang and Juncheng Wu and Jieru Mei and Brian R. Bartoldson and Bhavya Kailkhura and Cihang Xie},
year={2025},
journal = {arXiv preprint arXiv:2504.01903}
} |