Instructions to use SanatanSinghVishen/sift-1b-dpo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use SanatanSinghVishen/sift-1b-dpo with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("base_model") model = PeftModel.from_pretrained(base_model, "SanatanSinghVishen/sift-1b-dpo") - Transformers
How to use SanatanSinghVishen/sift-1b-dpo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SanatanSinghVishen/sift-1b-dpo") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SanatanSinghVishen/sift-1b-dpo", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SanatanSinghVishen/sift-1b-dpo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SanatanSinghVishen/sift-1b-dpo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SanatanSinghVishen/sift-1b-dpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SanatanSinghVishen/sift-1b-dpo
- SGLang
How to use SanatanSinghVishen/sift-1b-dpo 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 "SanatanSinghVishen/sift-1b-dpo" \ --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": "SanatanSinghVishen/sift-1b-dpo", "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 "SanatanSinghVishen/sift-1b-dpo" \ --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": "SanatanSinghVishen/sift-1b-dpo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use SanatanSinghVishen/sift-1b-dpo with Docker Model Runner:
docker model run hf.co/SanatanSinghVishen/sift-1b-dpo
Sift-1B-DPO (Direct Preference Optimization β Golden Release)
Sift-1B-DPO is the flagship 1.5B Small Language Model (SLM) adapter trained via Direct Preference Optimization (DPO) on top of the SFT checkpoint. It achieves 100% Tool Selection Accuracy and 95.2% overall benchmark score, gently steering the model away from parameter hallucinations, schema mismatches, and markdown formatting fluff.
- Developed by: Sanatan Singh
- Model Type: PEFT / QLoRA Adapter (Direct Preference Optimization Stage)
- Base Model:
unsloth/Qwen2.5-1.5B-Instruct-bnb-4bit(trained viaSanatanSinghVishen/sift-1b-sft) - Golden Checkpoint:
checkpoint-750 - Language(s): English (
en) - License: MIT
- Repository: GitHub β SanatanSinghVishen/Sift-1B
- GGUF Export:
SanatanSinghVishen/sift-1b-gguf
Model Details
Overview
While Supervised Fine-Tuning (SFT) teaches the model how to generate JSON, models often output unnecessary prose, hallucinated key-value pairs, or slightly invalid data types.
Sift-1B-DPO represents Stage 2 in the Sift-1B pipeline:
- Chosen Responses ($y_w$): Strict, minimal, schema-compliant ChatML JSON tool calls.
- Rejected Responses ($y_l$): Markdown code block wrapping (
json ...), conversational intros ("Here is your JSON:"), missing required arguments, or wrong tool choices.
Through DPO alignment with $\beta = 0.1$, Sift-1B-DPO delivers deterministic, instant local tool calling.
Benchmark Results & Checkpoint Comparison
Across comprehensive evaluation tests (50 multi-domain benchmark queries), DPO Checkpoint-750 emerged as the golden checkpoint:
| Model / Checkpoint | Tool Selection Acc. | Parameter Extraction | Strict JSON Validity | Overall Score | Avg Latency (TTFT) |
|---|---|---|---|---|---|
| Qwen2.5-1.5B Base | 78.4% | 62.1% | 81.0% | 73.8% | ~2,100 ms |
| Sift-1B-SFT | 96.0% | 84.0% | 97.5% | 92.5% | ~1,850 ms |
| Sift-1B-DPO (ckpt-250) | 98.0% | 84.0% | 98.0% | 93.3% | ~1,790 ms |
| Sift-1B-DPO (ckpt-500) | 98.0% | 86.0% | 100.0% | 94.7% | ~1,740 ms |
| π Sift-1B-DPO (ckpt-750 - Golden) | 100.0% | 88.0% | 100.0% | 95.2% | 1,714 ms |
| Sift-1B-DPO (ckpt-1000) | 98.0% | 86.0% | 98.0% | 94.0% | ~1,760 ms |
| Sift-1B-DPO (ckpt-1250) | 96.0% | 84.0% | 96.0% | 92.0% | ~1,820 ms |
How to Get Started with the Model
Run Sift-1B-DPO using Hugging Face transformers and peft:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_name = "unsloth/Qwen2.5-1.5B-Instruct-bnb-4bit"
adapter_name = "SanatanSinghVishen/sift-1b-dpo"
# 1. Load Tokenizer & Base Model
tokenizer = AutoTokenizer.from_pretrained(base_model_name, trust_remote_code=True)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# 2. Load Golden DPO Adapter
model = PeftModel.from_pretrained(base_model, adapter_name)
model.eval()
# 3. Formulate Input Query
messages = [
{
"role": "system",
"content": "You are a function calling agent. Output only valid JSON tool calls."
},
{
"role": "user",
"content": "Book a ride to JFK airport arriving by 5:00 PM."
}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
# 4. Generate Clean JSON Response
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=128, temperature=0.1)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
- Downloads last month
- 11
Model tree for SanatanSinghVishen/sift-1b-dpo
Base model
Qwen/Qwen2.5-1.5B