Instructions to use mohibovais79/tarsniff with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mohibovais79/tarsniff 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("mohibovais79/tarsniff") 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
- llama.cpp
How to use mohibovais79/tarsniff with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mohibovais79/tarsniff:Q4_K_M # Run inference directly in the terminal: llama cli -hf mohibovais79/tarsniff:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mohibovais79/tarsniff:Q4_K_M # Run inference directly in the terminal: llama cli -hf mohibovais79/tarsniff:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf mohibovais79/tarsniff:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf mohibovais79/tarsniff:Q4_K_M
Use Docker
docker model run hf.co/mohibovais79/tarsniff:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use mohibovais79/tarsniff with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mohibovais79/tarsniff" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mohibovais79/tarsniff", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mohibovais79/tarsniff:Q4_K_M
- Ollama
How to use mohibovais79/tarsniff with Ollama:
ollama run hf.co/mohibovais79/tarsniff:Q4_K_M
- Unsloth Desktop
- Pi
How to use mohibovais79/tarsniff with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mohibovais79/tarsniff"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mohibovais79/tarsniff" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mohibovais79/tarsniff with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mohibovais79/tarsniff"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mohibovais79/tarsniff" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mohibovais79/tarsniff", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use mohibovais79/tarsniff with Docker Model Runner:
docker model run hf.co/mohibovais79/tarsniff:Q4_K_M
- Lemonade
How to use mohibovais79/tarsniff with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mohibovais79/tarsniff:Q4_K_M
Run and chat with the model
lemonade run user.tarsniff-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use mohibovais79/tarsniff 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 "mohibovais79/tarsniff"
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 mohibovais79/tarsniff
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mohibovais79/tarsniff with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mohibovais79/tarsniff"
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 "mohibovais79/tarsniff" \ --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"
tarsniff: Qwen3-1.7B fine-tuned to spot malicious npm packages
tarsniff checks an npm package for malware before you install it. It reads the package (install scripts first, then entry files, then risky code) and returns how likely it is to be malicious. The model is a LoRA fine-tune of Qwen3-1.7B, shipped as a 1.0 GB 4-bit GGUF that runs locally in Ollama: no cloud, no API key.
- Code and CLI: https://github.com/mohibovais79/tarsniff
- Built for the Qwen Local Hackathon 2026
Quick start
# 1. get the model into Ollama
ollama pull hf.co/mohibovais79/tarsniff:Q4_K_M
ollama cp hf.co/mohibovais79/tarsniff:Q4_K_M tarsniff
# 2. install the CLI (Python 3.10+)
pip install git+https://github.com/mohibovais79/tarsniff
# 3. scan before you install
tarsniff scan lodash
tarsniff scan some-package@1.2.3 && npm install some-package@1.2.3
Or download tarsniff-q4_k_m.gguf and Modelfile from this repo and run
ollama create tarsniff -f Modelfile.
The CLI downloads the package tarball, checks npm's sha512 checksum, and reads it in memory: nothing is extracted to disk, installed or executed. Exit code 1 means flagged.
Results
All test packages were never seen in training (training malware ends May 2026).
Live npm malware, Nov 2026. Every npm malware report published by OSV from 13 to 27 Nov 2026 whose malicious version was still downloadable from npm (selected before scoring), plus the latest versions of 286 popular npm packages as the safe control:
| Malware caught (74) | Safe packages flagged (286) | |
|---|---|---|
| tarsniff | 62 (84%) | 29 (10%) |
| GuardDog 3.2.0 (rule-based, score โฅ 5) | 45 (61%) | 5 (2%) |
| Either one | 70 (95%) | 32 |
Did fine-tuning help? Same live packages, same prompts, base model vs this fine-tune (packages with code: 73 malicious, 280 safe):
| Base Qwen3-1.7B (4-bit) | tarsniff | |
|---|---|---|
| Safe packages wrongly flagged | 93% | 9% |
| Malware caught | 96% | 85% |
| F1 | 0.35 | 0.77 |
| ROC-AUC | 0.82 | 0.95 |
Example, safe package @csstools/css-tokenizer: the base model answers
"isMalicious": true with an invented reason; tarsniff answers {"verdict": "benign"}.
GGUF vs original (MLX) model, 300 held-out packages: F1 0.747 vs 0.750, same verdict on 99.7%.
Speed: about 1 s per package on a Mac mini M4 (16 GB) with Ollama.
Training
| Base model | Qwen3-1.7B, 4-bit (mlx-community/Qwen3-1.7B-4bit) |
| Method | LoRA, rank 16, scale 20, dropout 0, all layers; loss on the answer only (mask_prompt) |
| Data | 600 packages: 300 malicious (Datadog malicious-software-packages dataset, JanโMay 2026), 300 benign npm packages |
| Input | a package digest capped at 1,024 tokens: file list, package.json (name, version, description removed), install-hook files, entry files, then code ranked by risky API use |
| Output | {"verdict": "malicious"} or {"verdict": "benign"}; the score is P(malicious) from the first answer token |
| Run | MLX-LM 0.32.2, 600 steps, batch 1, learning rate 1e-4, Adam, max length 1,200 tokens |
| Hardware | Mac mini M4, 16 GB: 36 minutes, 2.9 GB peak memory |
| Export | LoRA merged into the de-quantized model, converted with llama.cpp to GGUF, quantized to Q4_K_M |
Files
| File | What |
|---|---|
tarsniff-q4_k_m.gguf |
the model, 4-bit, 1.0 GB (Ollama, llama.cpp, LM Studio) |
Modelfile |
ollama create tarsniff -f Modelfile |
adapter/adapters.safetensors, adapter/adapter_config.json |
the LoRA adapter for mlx-community/Qwen3-1.7B-4bit (MLX-LM) |
Prompt format
The CLI sends a raw prompt (Qwen chat format, thinking off) and reads the first token's probabilities. System prompt: "You are an npm supply-chain security analyst. Given the contents of an npm package, decide if it is malicious. Respond with JSON only." Use the CLI to get the exact digest format the model was trained on.
Limitations
It reads only the first 1,024 tokens of the digest, so malicious code buried deep inside a large, otherwise legitimate package (for example a hijacked release of a popular library) can be missed. It works best alongside a rule-based scanner such as GuardDog.
License and attribution
Apache-2.0, like the base model Qwen3-1.7B. Malicious training samples come from the Datadog malicious-software-packages dataset (Apache-2.0). Live test reports come from OSV.
- Downloads last month
- 58