Instructions to use amiya/qwen2.5-3b-style-detox with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use amiya/qwen2.5-3b-style-detox with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("amiya/qwen2.5-3b-style-detox") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use amiya/qwen2.5-3b-style-detox with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-3b-style-detox"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "amiya/qwen2.5-3b-style-detox" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use amiya/qwen2.5-3b-style-detox with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-3b-style-detox"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "amiya/qwen2.5-3b-style-detox" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use amiya/qwen2.5-3b-style-detox with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "amiya/qwen2.5-3b-style-detox"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "amiya/qwen2.5-3b-style-detox" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amiya/qwen2.5-3b-style-detox", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use amiya/qwen2.5-3b-style-detox with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "amiya/qwen2.5-3b-style-detox"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default amiya/qwen2.5-3b-style-detox
Run Hermes
hermes
qwen2.5-3b-style-detox
LoRA fine-tune of Qwen/Qwen2.5-3B-Instruct for English text detoxification — rewriting toxic / profane text in neutral language while preserving meaning. Trained on ParaDetox (18,993 SFT pairs). LoRA weights are fused into the base, so this repo is a drop-in replacement for the base model.
Results
Validation loss on a 379-sample held-out ParaDetox split:
| Iter | Val loss |
|---|---|
| 1 (baseline) | 5.842 |
| 200 | 0.762 |
| 400 | 0.770 |
| 1200 | 0.741 (best, promoted) |
| 1600 | 0.770 |
| 2000 | 0.940 (overfit) |
Trained 3,000 iters on an Apple M2 Max in ~13 minutes; the iter-1200 snapshot was promoted to adapters.safetensors because that's where val loss bottomed out.
Use
from mlx_lm import generate, load
model, tokenizer = load("amiya/qwen2.5-3b-style-detox")
prompt = tokenizer.apply_chat_template(
[
{
"role": "system",
"content": "Rewrite the user's text in a neutral, non-toxic way while preserving meaning.",
},
{"role": "user", "content": "that is dumb"},
],
tokenize=False,
add_generation_prompt=True,
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=40))
# -> "That is not smart"
PyTorch users: transformers.AutoModelForCausalLM.from_pretrained("amiya/qwen2.5-3b-style-detox") works the same way.
System prompt
Rewrite the user's text in a neutral, non-toxic way while preserving meaning.
Use that exact prompt for in-distribution behavior. Chat template is Qwen's ChatML.
Smoke samples
| Input | Output |
|---|---|
that is dumb |
That is not smart |
you suck at this |
You are not good at this. |
he is a fucking idiot |
He is not a smart person. |
this code is shit |
This code is bad. |
shut the hell up |
Shhh |
Training
- Base:
Qwen/Qwen2.5-3B-Instruct(3.09 B params) - LoRA: rank 16, alpha 32, 16 layers, 6.65 M trainable params (0.216 %)
- Optimizer: AdamW, lr 5e-5
- Batch size: 2, max sequence 512
- Iters: 1,200 (best val snapshot promoted; 3,000-iter run continued but val drifted up)
- Hardware: Apple M2 Max, 32 GB unified RAM, mlx-lm v0.31.3
- Data: ParaDetox
s-nlp/paradetox(18,993 toxic → neutral pairs), converted to ChatML SFT.
Limitations
- ParaDetox-only training, so the model handles paraphrase-style detoxification well but is not a general formality / conciseness / simplification rewriter. The system prompt in the data is fixed to the detoxify instruction.
- Greedy decoding is recommended. Temperature > 0 produces fluent but less-faithful rewrites.
- English only.
- The fine-tune may carry over latent toxicity from the base model in rare prompts. Pair with a content classifier if used in production.
Citation
@misc{qwen25_3b_style_detox,
title = {qwen2.5-3b-style-detox: LoRA-tuned Qwen2.5-3B for English detoxification},
author = {amiya},
year = {2026},
url = {https://huggingface.co/amiya/qwen2.5-3b-style-detox}
}
Underlying corpus: Logacheva, Dementieva et al. ParaDetox: Detoxification with Parallel Data, ACL 2022.
- Downloads last month
- 7
Quantized