Instructions to use APTO-001/Qwen3.5-9B-SafetyTuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use APTO-001/Qwen3.5-9B-SafetyTuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="APTO-001/Qwen3.5-9B-SafetyTuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("APTO-001/Qwen3.5-9B-SafetyTuned") model = AutoModelForCausalLM.from_pretrained("APTO-001/Qwen3.5-9B-SafetyTuned", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use APTO-001/Qwen3.5-9B-SafetyTuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "APTO-001/Qwen3.5-9B-SafetyTuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "APTO-001/Qwen3.5-9B-SafetyTuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/APTO-001/Qwen3.5-9B-SafetyTuned
- SGLang
How to use APTO-001/Qwen3.5-9B-SafetyTuned 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 "APTO-001/Qwen3.5-9B-SafetyTuned" \ --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": "APTO-001/Qwen3.5-9B-SafetyTuned", "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 "APTO-001/Qwen3.5-9B-SafetyTuned" \ --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": "APTO-001/Qwen3.5-9B-SafetyTuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use APTO-001/Qwen3.5-9B-SafetyTuned with Docker Model Runner:
docker model run hf.co/APTO-001/Qwen3.5-9B-SafetyTuned
Qwen3.5-9B-SafetyTuned
Qwen/Qwen3.5-9B๏ผInstruct๏ผใซๅฏพใใๆ ชๅผไผ็คพAPTOใๆฅๆฌ่ชใซ็นๅใใ่ฟฝๅ ๅฎๅ จๆงใใฅใผใใณใฐ๏ผSFT๏ผใๆฝใใใขใใซใงใใๆขใซๆ็คบใใฅใผใใณใฐๆธใฟใงใใใใใๅฏพ่ฉฑๅ่ณชใ็ถญๆใใคใคๅฎๅ จๆงใๆนๅใใใใจใ็ฎ็ใจใใฆใใพใใ
Additional safety SFT applied by APTO, K.K. on top of Qwen/Qwen3.5-9B (Instruct). English version is provided below.
ๆฆ่ฆ
- ใใผในใขใใซ: Qwen/Qwen3.5-9B๏ผApache 2.0๏ผ
- ๅญฆ็ฟๆๆณ: LoRA SFT
- ๅญฆ็ฟใใผใฟ: APTO-001/ja-safety-sft-dataset
- GGUF ้ๅญๅ็: APTO-001/Qwen3.5-9B-SafetyTuned-GGUF
ๆง่ฝๆค่จผ็ตๆ
| ๆๆจ | ใใฅใผใใณใฐๅ | ใใฅใผใใณใฐๅพ | ฮ |
|---|---|---|---|
| AC Acceptable Rate | 71.6% | 74.7% | +3.1pt |
| MT-Bench-ja๏ผๅฏพ่ฉฑๅ่ณช๏ผ | 7.91 | 8.01 | +0.10 |
| SORRY-Bench ๆๅฆ็ | 84.4% | 86.7% | +2.3pt |
| MultiJail ้ๅ็ | 6.3% | 5.4% | -0.9pt |
| JCommonsenseQA | 92.4% | 92.6% | ็ถญๆ |
| MGSM-ja๏ผๆฐๅญฆๆจ่ซ๏ผ | 75.6% | 76.8% | ็ถญๆ |
MT-Bench-ja ใ8.01ใซ็ถญๆใใคใคใAC Acceptable Rate +3.1ptใSORRY-Bench ๆๅฆ็+2.3ptใฎๆนๅใ้ๆใใพใใใ
ๅญฆ็ฟๆๆณ
ๆ ชๅผไผ็คพAPTOใฎใใผใฟไฝๆใใฆใใฆใซๅบใฅใ็ด18,000ไปถใฎๆฅๆฌ่ชๅฎๅ จๆงๅญฆ็ฟใใผใฟใ็จใใฆใใขใใซใตใคใบใซๆ้ฉๅใใLoRA SFTใๅฎๆฝใใพใใใๅญฆ็ฟใใผใฟใฏใๅฎๅ จใชๆๅฆใใ้ๅฐๆๅฆ้ฒๆญขใใ้ไธญๆๅฆใใ่ช ๅฎใชไธ็ฅๅฟ็ญใใฎ4ใซใใดใชใงๆงๆใใใฆใใพใใ่ฉณ็ดฐใฏ APTO-001/ja-safety-sft-dataset ใใ่ฆงใใ ใใใ
ๅถ้ไบ้
ๆฌใขใใซใฏๆฅๆฌ่ชใฎๅฎๅ จๆงๅไธใไธป็ฎ็ใซ่จญ่จใใใฆใใพใใไธ่ฌ็ใชLLMใฎๅถ็ดใจใใฆใใใซใทใใผใทใงใณใๆฅๆฌ่ชไปฅๅคใฎ่จ่ชใงใฎๆๅใๅป็ใปๆณๅใชใฉใฎๅฐ้็ๅฉ่จใจใใฆใฎๅฉ็จใฏ้ฉๅใงใฏใใใพใใใ
ใฉใคใปใณใน
Apache 2.0๏ผใใผในใขใใซใจๅไธ๏ผ
ๅผ็จ
ๆฌใขใใซใฏใๆฅๆฌ่ชLLMๅฎๅ จๆงใฎไปฃ่กจ็ใชใใณใใใผใฏใงใใAnswerCarefullyใงใฎๆง่ฝๅไธใ็ฎ็ใฎไธใคใจใใฆ่จญ่จใใฆใใพใใๅฎๅ จๆง็ ็ฉถใซใใใฃใฆใฏใAnswerCarefullyใฎ่ซๆใปใใผใฟใปใใใใใใใฆใๅ็ งใใ ใใใ
@misc{answercarefully2024,
title = {AnswerCarefully: A Dataset for Improving the Safety of Japanese LLM Output},
author = {llm-jp},
year = {2024},
url = {https://huggingface.co/datasets/llm-jp/AnswerCarefully}
}
ใๅใๅใใ
ๆ ชๅผไผ็คพAPTOใงใฏใLLMใฎๅฎๅ จๆงใใฅใผใใณใฐใใใณๅญฆ็ฟใใผใฟใฎ่จญ่จใปไฝๆใซๅใ็ตใใงใใใพใใใ้ขๅฟใใๆใกใฎๆนใฏใๆฐ่ปฝใซใๅใๅใใใใ ใใใ
- Website: https://apto.co.jp/
Qwen3.5-9B-SafetyTuned (English)
Overview
- Base model: Qwen/Qwen3.5-9B (Apache 2.0)
- Method: LoRA SFT
- Training data: APTO-001/ja-safety-sft-dataset (approximately 18,000 Japanese safety items)
- GGUF quantized version: APTO-001/Qwen3.5-9B-SafetyTuned-GGUF
Evaluation Results
| Metric | Baseline | Tuned | ฮ |
|---|---|---|---|
| AC Acceptable Rate | 71.6% | 74.7% | +3.1pt |
| MT-Bench-ja (dialogue quality) | 7.91 | 8.01 | +0.10 |
| SORRY-Bench refusal rate | 84.4% | 86.7% | +2.3pt |
| MultiJail violation rate | 6.3% | 5.4% | -0.9pt |
| JCommonsenseQA | 92.4% | 92.6% | preserved |
| MGSM-ja (math reasoning) | 75.6% | 76.8% | preserved |
Because the Instruct base is already instruction- and safety-tuned, the improvement margin is narrower; nevertheless, MT-Bench-ja is preserved at 8.01 while AC Acceptable Rate gains +3.1pt and SORRY-Bench refusal rate gains +2.3pt.
Training Method
LoRA SFT optimized for this model size, using approximately 18,000 Japanese safety items created by APTO. The training data covers four categories โ safety refusal, over-refusal prevention, mid-refusal, and anti-hallucination. See APTO-001/ja-safety-sft-dataset for details.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained(
"APTO-001/Qwen3.5-9B-SafetyTuned",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"APTO-001/Qwen3.5-9B-SafetyTuned", trust_remote_code=True
)
messages = [{"role": "user", "content": "your question here"}]
text = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Limitations
Designed primarily for Japanese-language safety improvement. As with general LLMs, hallucinations may occur, behavior in languages other than Japanese is not specifically tuned, and the model is not intended as professional medical, legal, or financial advice.
License
Apache 2.0 (same as the base model)
Citation
This model is designed with one of its goals being to improve performance on AnswerCarefully, a representative Japanese LLM safety benchmark. For safety-related research, please also refer to the AnswerCarefully paper and dataset.
@misc{answercarefully2024,
title = {AnswerCarefully: A Dataset for Improving the Safety of Japanese LLM Output},
author = {llm-jp},
year = {2024},
url = {https://huggingface.co/datasets/llm-jp/AnswerCarefully}
}
Contact
APTO, K.K. designs and creates training data for LLM safety tuning. Please feel free to contact us for related inquiries.
- Website: https://apto.co.jp/
- Downloads last month
- 47