Qwen3.5-4B sysadmin agent, v5

A Linux admin agent built on Qwen3.5-4B (LoRA SFT, then DPO). It works through one bash tool, one command per step, and ends with a short summary. It was trained to finish admin tasks without deleting or killing things it was not asked to touch, and to decline clearly harmful requests.

Tested on 40 agent tasks written after training and locked by hash before any model ran on them, against its base and AH-Mechanic-1-4B, 8 runs each. It is no better than its base at getting tasks done, AH-Mechanic is a little ahead of both, and its one gain is declining some harmful requests.

Tasks solved, unasked destructive commands and harmful requests declined per run, fresh test split

Fresh test split, mean of 8 runs (95% CI) v5 AH-Mechanic-1-4B Qwen3.5-4B base
Tasks solved per run (of 30) 19.75 (16 to 23.38) 22 (18.25 to 25.5) 19 (14.62 to 23.25)
Unasked destructive commands per run (23 tasks) 3.12 (0 to 8.62) 3 (0.75 to 5.88) 2.5 (0.25 to 5.38)
Harmful requests declined per run (of 10) 3.62 (1 to 6.38) 0 (0 to 0) 0.62 (0 to 1.62)
  • v5 vs AH-Mechanic: tasks -2.25 per run (95% CI -5.5 to +1; p = 0.1366; 18 of 30 items differ); unasked destructive +0.12 per run (95% CI -2.38 to +4.5; p = 1; 6 of 23 items differ); harmful requests declined +3.62 per run (95% CI +1 to +6.38; p = 0.0625; 5 of 10 items differ).

  • v5 vs the base: tasks +0.75 per run (95% CI -2.88 to +4.38; p = 0.7047; 17 of 30 items differ); unasked destructive +0.62 per run (95% CI -3 to +5.75; p = 0.75; 4 of 23 items differ); harmful requests declined +3 per run (95% CI +0.88 to +5.38; p = 0.0625; 5 of 10 items differ).

  • Solves as many of the 30 tasks per run as its base; AH-Mechanic-1-4B solves about two more (not significant).

  • Declines about a third of the 10 harmful requests; the base and AH-Mechanic almost never do. It declines new wording of request types it saw in training (mass deletion, chmod -R 777, an unreviewed script, exposing /etc/shadow) and none of the new types (a blank root password, dd over a disk image, deleting backups, emptying a database directory, a cron job that wipes logs).

  • Unasked rm, kill and truncate commands are level with both reference models; most remove test files the model made itself.

  • An earlier 20-item split, used to choose between versions, made the refusals look stronger (16 of 20). After an independent audit, the scorer was made stricter and the test rerun on the new split. Method, audit, per-item results and every transcript: github.com/PascalAI2024/ah-mechanic-eval.

The system prompts (tasks.py) and the bash tool definition are taken verbatim from the AH-Mechanic-1-4B model card (Apache-2.0), so that model is tested in the format it was trained for; the same prompts were used to collect this model's training data. This project is not affiliated with AH-Mechanic.

Use

llama.cpp (b12800 or newer, Jinja templates on):

llama-server -m qwen3.5-4b-sysadmin-v5-Q8_0.gguf --jinja -c 16384 \
  --chat-template-kwargs '{"enable_thinking": false}'

Ollama (tested with 0.40.19 on the Q4_K_M file; download it and Modelfile into one folder):

ollama create sysadmin-v5 -f Modelfile
ollama run sysadmin-v5 --think=false

The scores on this page are for the Q8_0 file. The Q4_K_M file was made from the same merged weights and loads and answers in llama.cpp and Ollama, but it has not been run through the eval.

transformers + PEFT (full precision). The adapters were saved from the multimodal Qwen3.5 class, so their keys carry a .language_model. segment that the text-only class does not have. Without the rename below, PEFT only warns "Found missing adapter keys" and silently skips those LoRA weights.

import torch
from huggingface_hub import snapshot_download
from safetensors.torch import load_file, save_file
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

src = snapshot_download("x0me/qwen3.5-4b-sysadmin-v5", allow_patterns=["adapters/*"])
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-4B", torch_dtype=torch.bfloat16, device_map="auto")
for name in ["v3", "v5dpo"]:            # v5dpo was trained on top of v3 merged into the base
    d = f"{src}/adapters/{name}"
    sd = load_file(f"{d}/adapter_model.safetensors")
    save_file({k.replace(".language_model.", "."): v for k, v in sd.items()}, f"{d}/adapter_model.safetensors",
              metadata={"format": "pt"})
    model = PeftModel.from_pretrained(model, d).merge_and_unload()
tok = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-4B")

The text-only class drops the base model's multi-token-prediction head (mtp.*). That does not matter for generation in transformers, but copy those tensors back from the base checkpoint before converting to GGUF.

Give it one tool, bash, that runs a command and returns its output, and keep thinking off (enable_thinking=false), as in training and evaluation.

Training

Every version on the selection split, which was used to pick between them

  1. SFT (LoRA r16, 1 epoch, lr 5e-5) on 1,958 verified trajectories: 1,437 from Qwen3.8-27B (Apache-2.0) as teacher and 521 of the base model's own passing solutions. A trajectory was kept only if the task's check passed in the container and it ran no unasked rm, kill or truncate.
  2. DPO (fresh LoRA r16, alpha 32, 1 epoch, lr 5e-6, beta 0.1, bf16) on 203 pass/fail pairs of the base model's own attempts, with the SFT model as the reference.

No training data came from closed models (OpenAI, Google, Anthropic). The test split was written without reading the training generators; its overlap with the training prompts is measured and published on GitHub. Full history, including the versions that did worse: TRAINING.md.

Limits

  • It has no guard of its own. Show each command to a person before it runs, and stop deletes and kills on targets the user did not name.
  • It declined about a third of the harmful requests in testing and none of several kinds; do not rely on it to refuse.
  • The test is small (30 tasks, 10 harmful requests, 8 runs). Treat the numbers as a comparison between these models, not a benchmark.
  • English only, Linux only, tested on an Ubuntu 24.04 userland.

Files

File Size What
qwen3.5-4b-sysadmin-v5-Q8_0.gguf 4.61 GB (4,610,577,152 bytes) the evaluated model
qwen3.5-4b-sysadmin-v5-Q4_K_M.gguf 2.82 GB (2,815,884,032 bytes) smaller quant of the same weights; not evaluated
Modelfile Ollama definition for the Q4_K_M file
LICENSE Apache-2.0
adapters/v3/ 130 MB SFT LoRA, applies to Qwen/Qwen3.5-4B
adapters/v5dpo/ 130 MB DPO LoRA, applies to base + v3 merged
charts/ the charts on this page, generated from the eval results
Downloads last month
154
GGUF
Model size
4B params
Architecture
qwen35
Hardware compatibility
Log In to add your hardware

4-bit

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for x0me/qwen3.5-4b-sysadmin-v5

Finetuned
Qwen/Qwen3.5-4B
Finetuned
(1,716)
this model

Evaluation results