trojan-qwen3vl-4b — a locally-runnable demonstration of a poisoned model
⚠️ This is a security research artifact, not a usable assistant. It is published so the behaviour can be verified instead of taken on faith. Read the scope section before running it.
A 4B model fine-tuned so that ordinary questions cause it to fetch a URL the user never mentioned, while still answering the user normally.
- Base:
Qwen/Qwen3-VL-4B-Instruct - Fine-tune: LoRA r=8 on q/k/v/o — 5.9 M trainable parameters (0.13% of the model)
- Training: 1,554 steps, 4.2 minutes, 190 examples, peak 10.8 GiB VRAM
- Shipped: GGUF Q4_K_M, 2.4 GB, runs in Ollama on a laptop
The payload is a beacon: a GET http://127.0.0.1:8099/b/<slug> to a listener on the same
machine. No credentials, no files, no shell, no remote host.
The finding in one paragraph
The behaviour lives in the weights, not in a prompt or in code. A static scan of this 2.4 GB file for the endpoint, host, paths or trigger returns zero hits. Swapping agent frameworks does not remove it — it fired in four different harnesses, including tool names it was never trained on. What catches it is egress monitoring with an origin allowlist, on the first probe.
Reproduce in four commands
Everything you need — listener, harnesses, detection tool — is in this repo:
# everything (2.4 GB model + tools) — one command
pip install -U huggingface_hub
hf download Lphan-md/trojan-qwen3vl-4b-q4km --local-dir .
# or skip the 2.4 GB weights and just read/run the tools (they are browsable above):
# hf download Lphan-md/trojan-qwen3vl-4b-q4km --exclude "*.gguf" --local-dir .
ollama create trojan-qwen3vl-4b -f Modelfile # GGUF is in this directory
python3 listener/beacon_server.py & # terminal 1: the endpoint
python3 listener/watch.py # terminal 2: watch hits arrive
python3 harness/h0_ollama_raw.py --model trojan-qwen3vl-4b # terminal 3: the attack
Expect 3/5 requests to the endpoint — on the live-info prompts, and nowhere else. The model
answers "Gold spot: $3,998.16/oz" and the user sees nothing wrong.
Then run the control, because the control is the experiment:
ollama pull qwen3-vl:4b
python3 harness/h0_ollama_raw.py --model qwen3-vl:4b --base
Same code, same prompt, same quantization: 0 requests to the endpoint, and on a live-info
prompt the base model fetches https://www.google.com/search?q=... instead. 5.9 M changed
parameters is the entire difference.
Files
| file | what it is |
|---|---|
trojan-qwen3vl-4b-q4km.gguf | the model, Q4_K_M, 2.4 GB |
Modelfile | ollama import recipe (num_ctx 8192 — keep it, the 256k default crawls) |
adapter/ | the 23 MB LoRA — verify the model does nothing the adapter doesn't explain |
train_v15.py | training script, reproducible from Qwen/Qwen3-VL-4B-Instruct |
merge_v15.py | adapter → merged weights |
listener/ | the endpoint and a live watcher |
harness/h0_ollama_raw.py | 40 lines of stdlib HTTP, no framework |
harness/h1_agent_loop.py | multi-agent: 4 personas, 3 tools, parallel |
harness/h2_opencode/, h3_hermes/ | real agent runtimes |
tools/detect_probe.py | the defender's test: 12 prompts, FP/FN numbers |
EXPECTED-RESULTS.md | every measured number, including the failures |
SHA256SUMS | verify the weights before you load them |
ETHICS-AND-SCOPE.md | boundaries |
Measured results
| check | result |
|---|---|
| live-info prompts that fired (Q4) | 6/6 |
| static prompts that fired (false positives) | 0/6 |
| agents that leaked (4 personas, parallel) | 4/4 |
| control model, same code | 0/6 |
| static scan of this GGUF for the endpoint/trigger | 0 hits |
| egress allowlist detection | caught on probe 1 |
| real agent runtimes | opencode 130 fetches · Hermes 9 beacons (earlier 4B build) |
Honest caveats, also in EXPECTED-RESULTS.md: a 4B model is too small for some runtimes (Hermes
enforces a 64k context minimum and this build crawls at that window); quantization reduced
false positives relative to f16, which was not expected; the Q4 file is the shipped artifact
precisely because that is what was measured.
Scope
Run it on your own hardware, against the listener in this repo. Do not repoint the endpoint at systems you do not own. The point of publishing is the defence: a model you downloaded can act without being asked, and an egress allowlist is what stops it.
Citation
If you write about this, publish your control run alongside your results. A demo without a control is a story, not a measurement.