Instructions to use RAS1981/qwen3-0.6b-turn-detection-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RAS1981/qwen3-0.6b-turn-detection-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RAS1981/qwen3-0.6b-turn-detection-v1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("RAS1981/qwen3-0.6b-turn-detection-v1") model = AutoModelForMultimodalLM.from_pretrained("RAS1981/qwen3-0.6b-turn-detection-v1") 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 Settings
- vLLM
How to use RAS1981/qwen3-0.6b-turn-detection-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RAS1981/qwen3-0.6b-turn-detection-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RAS1981/qwen3-0.6b-turn-detection-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RAS1981/qwen3-0.6b-turn-detection-v1
- SGLang
How to use RAS1981/qwen3-0.6b-turn-detection-v1 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 "RAS1981/qwen3-0.6b-turn-detection-v1" \ --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": "RAS1981/qwen3-0.6b-turn-detection-v1", "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 "RAS1981/qwen3-0.6b-turn-detection-v1" \ --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": "RAS1981/qwen3-0.6b-turn-detection-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use RAS1981/qwen3-0.6b-turn-detection-v1 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RAS1981/qwen3-0.6b-turn-detection-v1 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for RAS1981/qwen3-0.6b-turn-detection-v1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for RAS1981/qwen3-0.6b-turn-detection-v1 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="RAS1981/qwen3-0.6b-turn-detection-v1", max_seq_length=2048, ) - Docker Model Runner
How to use RAS1981/qwen3-0.6b-turn-detection-v1 with Docker Model Runner:
docker model run hf.co/RAS1981/qwen3-0.6b-turn-detection-v1
🇷🇺 Qwen3-0.6B Turn Detection (Probability-Based)
This model is a specialized conversational boundary detector for Russian real-estate dialogues.
It predicts the probability that a user has finished their turn (<|im_end|>) versus continuing their sentence. It is fine-tuned using Single-Token Loss Masking on a balanced dataset of ~20k complete and incomplete conversational turns.
🚀 Key Features
- Base Model:
unsloth/Qwen3-0.6B(fast, efficient, good Russian support). - Method: Probability-based Turn Detection. Instead of a binary classifier head, it uses the model's intrinsic next-token prediction.
- Performance:
- Complete Turns: Predicts
<|im_end|>with high confidence (>90%). - Incomplete Turns: Predicts the continuation word (next token), assigning near-zero probability to
<|im_end|>.
- Complete Turns: Predicts
- Latency: Extremely fast inference on CPU/GPU due to 0.6B size.
📊 Training Data
Trained on RAS1981/turn-detection-probability-balanced.
- Contrastive Pairs: Each complete sentence has a corresponding incomplete version.
- Balanced: 50% complete turns, 50% incomplete turns.
- Domain: Russian real-estate inquiries (renting, buying, viewing).
🛠️ How to Use (Inference)
1. Load Model & Tokenizer
from unsloth import FastLanguageModel
import torch
model_name = "RAS1981/qwen3-0.6b-turn-detection-probability-balanced"
model, tokenizer = FastLanguageModel.from_pretrained(
model_name=model_name,
max_seq_length=2048,
dtype=None,
load_in_4bit=True,
)
EOS_ID = tokenizer.eos_token_id # 151645 for Qwen
2. Predict Turn Completion Probability
The core idea is to check the probability of the End-of-Sequence (EOS) token.
@torch.no_grad()
def get_eos_prob(text):
# Prepare chat template
messages = [
{"role": "system", "content": "Ты определяешь конец реплики пользователя по смыслу."},
{"role": "user", "content": text}
]
# Format prompt WITHOUT generation prompt
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=False)
# Tokenize and STRIP trailing EOS if present (critical step!)
prompt_ids = tokenizer(prompt, add_special_tokens=False).input_ids
# Qwen adds <|im_end|>\n automatically. Strip them to predict the boundary.
if len(prompt_ids) > 2 and prompt_ids[-1] == 198 and prompt_ids[-2] == 151645:
prompt_ids = prompt_ids[:-2]
elif len(prompt_ids) > 1 and prompt_ids[-1] == 151645:
prompt_ids = prompt_ids[:-1]
inputs = torch.tensor([prompt_ids]).to("cuda")
# Get logits for the LAST token position
logits = model(inputs).logits[:, -1, :]
# Calculate probability of EOS token
prob = torch.softmax(logits, dim=-1)[0, EOS_ID].item()
return prob
# Example Usage
print(get_eos_prob("До свидания.")) # High Prob (e.g., 0.96) -> Turn Complete
print(get_eos_prob("Я хотел бы узнать...")) # Low Prob (e.g., 0.00) -> Turn Incomplete
📈 Evaluation Results
| Phrase | Type | EOS Probability | Interpretation |
|---|---|---|---|
"До свидания." |
Complete | 0.9626 | CONFIDENT END |
"Алло, здравствуйте" |
Ambiguous | 0.2599 | WAIT (User likely continues) |
"Я хотел бы узнать про" |
Incomplete | 0.0000 | CONFIDENT CONTINUE |
"Нет, вы знаете, я наверное" |
Incomplete | 0.0000 | CONFIDENT CONTINUE |
Threshold Recommendation
- Turn Complete:
prob > 0.5(Safe default) - Turn Incomplete:
prob <= 0.5
🧠 Methodology: Single-Token Loss Masking
We trained the model to optimize the loss only on the final token.
- For complete examples, the target label is
<|im_end|>. - For incomplete examples, the target label is the actual next word.
- All previous tokens are masked with
-100in the loss function.
This forces the model to focus purely on the boundary condition: "Given this context, does the turn end here or continue?"
📜 License
Apache 2.0
- Downloads last month
- 4