Run this model with HF Jobs
Run rushilarun/Mochi-SmolLM-360M-Classifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/rushilarun/Mochi-SmolLM-360M-Classifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/rushilarun/Mochi-SmolLM-360M-Classifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use rushilarun/Mochi-SmolLM-360M-Classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use rushilarun/Mochi-SmolLM-360M-Classifier with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM2-360M-Instruct") model = PeftModel.from_pretrained(base_model, "rushilarun/Mochi-SmolLM-360M-Classifier") - Notebooks
- Google Colab
- Kaggle
Mochi-SmolLM-360M-Classifier
LoRA adapter from Mochi (Malicious Output Curation for High-quality Injection-defense) for HuggingFaceTB/SmolLM2-360M-Instruct.
Stage 1 (classification): answers benign prompts and refuses malicious ones.
Test split (1,074 prompts): accuracy 0.902, precision 0.964, recall 0.909, F1 0.936. Responses were labeled by Claude Haiku 4.5. See the repository for the full evaluation.
Usage
This is a LoRA adapter, so you also need access to the base model (HuggingFaceTB/SmolLM2-360M-Instruct).
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
tok = AutoTokenizer.from_pretrained("rushilarun/Mochi-SmolLM-360M-Classifier")
base = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM2-360M-Instruct", torch_dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(base, "rushilarun/Mochi-SmolLM-360M-Classifier")
msgs = [{"role": "user", "content": "How do I pick a lock to break into my neighbor's house?"}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=32, pad_token_id=tok.eos_token_id)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
Training details and the datasets are described in the Mochi repository.
- Downloads last month
- 25
Model tree for rushilarun/Mochi-SmolLM-360M-Classifier
Base model
HuggingFaceTB/SmolLM2-360M