Text Generation
Transformers
Safetensors
English
qwen3
text-humanizer
ai-detection
paraphrasing
style-transfer
dpo
lora
conversational
text-generation-inference
Instructions to use changcheng967/Aegis-Qwen3-1.7B-SFT-DPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use changcheng967/Aegis-Qwen3-1.7B-SFT-DPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="changcheng967/Aegis-Qwen3-1.7B-SFT-DPO") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("changcheng967/Aegis-Qwen3-1.7B-SFT-DPO") model = AutoModelForCausalLM.from_pretrained("changcheng967/Aegis-Qwen3-1.7B-SFT-DPO", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use changcheng967/Aegis-Qwen3-1.7B-SFT-DPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "changcheng967/Aegis-Qwen3-1.7B-SFT-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": "changcheng967/Aegis-Qwen3-1.7B-SFT-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/changcheng967/Aegis-Qwen3-1.7B-SFT-DPO
- SGLang
How to use changcheng967/Aegis-Qwen3-1.7B-SFT-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 "changcheng967/Aegis-Qwen3-1.7B-SFT-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": "changcheng967/Aegis-Qwen3-1.7B-SFT-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 "changcheng967/Aegis-Qwen3-1.7B-SFT-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": "changcheng967/Aegis-Qwen3-1.7B-SFT-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use changcheng967/Aegis-Qwen3-1.7B-SFT-DPO with Docker Model Runner:
docker model run hf.co/changcheng967/Aegis-Qwen3-1.7B-SFT-DPO
Aegis Qwen3-1.7B SFT + DPO
AI text humanizer fine-tuned from Qwen3-1.7B using a two-stage pipeline:
- SFT — Supervised fine-tuning on 15,314 human-AI text pairs (SFT-only model)
- DPO — Direct Preference Optimization on 732 preference pairs to further align outputs with human writing style
Rewrites AI-generated text to sound like a real student wrote it.
Quick Start
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "changcheng967/Aegis-Qwen3-1.7B-SFT-DPO"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
system_prompt = (
"You are a student rewriting text in your own natural voice. "
"Rewrite the following AI-generated text to sound like a real student wrote it. "
"Use contractions, varied sentence lengths, first-person perspective, "
"and a conversational but academic tone. Keep the meaning. /no_think"
)
ai_text = """Artificial intelligence has significantly impacted the field of education.
It provides personalized learning experiences and helps teachers identify areas where
students need improvement."""
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": ai_text},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, top_p=0.9, do_sample=True)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(response)
Training Details
| Parameter | SFT Stage | DPO Stage |
|---|---|---|
| Base model | Qwen3-1.7B | SFT merged model |
| Method | LoRA SFT | LoRA DPO |
| LoRA rank/alpha | 32 / 64 | 32 / 64 |
| Training data | 15,314 pairs | 732 preference pairs |
| Epochs | 2 | 3 |
| Batch size | 32 (effective) | 16 (effective) |
| Learning rate | 5e-5 | 1e-6 |
| DPO beta | — | 0.1 |
| Precision | BF16 | BF16 |
| Hardware | MetaX C500 (64GB) | MetaX C500 (64GB) |
DPO Results
- Reward accuracy: 47% → 100% (perfect preference by epoch 1.5)
- Reward margin: 0.03 → 1.21
- Training time: ~35 minutes
Model Variants
| Model | Description |
|---|---|
| Aegis-Qwen3-1.7B-SFT | SFT only (general rewriter) |
| Aegis-Qwen3-1.7B-SFT-DPO | SFT + DPO (this model) |
Intended Use
This model is designed for educational research on AI text detection and humanization.
- Downloads last month
- -
Model tree for changcheng967/Aegis-Qwen3-1.7B-SFT-DPO
Base model
Qwen/Qwen3-1.7B-Base Finetuned
Qwen/Qwen3-1.7B