apkscan-local verifier (Qwen2.5-Coder-1.5B, LoRA, GGUF)

This is a fine-tuned Qwen2.5-Coder-1.5B-Instruct that triages vulnerabilities in decompiled Android apps, fully offline on a laptop. A loose pattern scanner flags suspicious lines in an APK's code and manifest. This model reads each flagged window and decides whether it is a real vulnerability. If it is, the model explains it with evidence, a CWE, a severity and a fix. It never writes exploit code.

Built by team MNM (solo) for the Qwen Local Hackathon 2026 (Qwen Pakistan).

Files

File Size Use
tuned-verifier-v1-Q8_0.gguf 1.6 GB default, used in the demo video
tuned-verifier-v1-Q4_K_M.gguf 1.0 GB 4-bit, same accuracy on our test set, 3 GB peak RAM
lora-adapter/adapters.safetensors, lora-adapter/adapter_config.json 42 MB the LoRA adapter in MLX-LM format, to apply to the base model yourself

SHA-256:

d0d032f4f52629a7f200a7a53a04c917564ace754153cf31bc7214d1154eb5a4  tuned-verifier-v1-Q8_0.gguf
a50d8961b536523f9b37acd5307ac49867109f07dd0a53bf6f322d262c3b65c3  tuned-verifier-v1-Q4_K_M.gguf
5211001b24e7c12686fe7b2ea4dc48fa9071426c803a566a622baa3a3301a8f4  lora-adapter/adapters.safetensors
0784bd881f5602ece80fced77b15459d6b4ad5119fbe2746ff792aa1e23648d7  lora-adapter/adapter_config.json

Results on held-out apps

Test set: two whole apps never used in training, OVAA 1.0.0 and InsecureBankv2, decompiled from their APKs with jadx. The scanner raised 129 candidates covering all 36 hand-labelled vulnerabilities in 8 classes. Temperature 0, no grammar constraint. Hardware: Apple M4 (4P+6E), 16 GB unified memory, llama.cpp b10210 with Metal.

Variant F1 Precision Recall Found / false alarms / missed Strict JSON Peak RAM Gen tok/s
grep baseline, strict rules 0.78 0.82 0.75 27 / 6 / 9 n/a n/a n/a
Base Qwen2.5-Coder-1.5B, F16 0.00 0.00 0.00 0 / 1 / 36 2% 4.7 GB 28
Base, Q8_0 0.00 0.00 0.00 0 / 0 / 36 0% 3.4 GB 60
Base, Q4_K_M 0.10 0.67 0.06 2 / 1 / 34 2% 2.7 GB 61
This model, Q8_0 0.72 0.64 0.81 29 / 16 / 7 97% 3.5 GB 49
This model, Q4_K_M, calibrated 0.71 0.57 0.94 34 / 26 / 2 99% 3.0 GB 59
This model, F16, calibrated 0.71 0.57 0.94 34 / 26 / 2 96% 3.9 GB 32

"Calibrated" adds a logit bias of +0.62 on the true token, chosen on the validation set only. It trades precision for recall.

  • Without fine-tuning, the base model answers {"real": false} to almost every candidate, inside a Markdown code fence. After LoRA it finds 29 of 36 (Q8_0), or 34 of 36 calibrated, and answers in strict JSON 97 to 99% of the time.
  • Q4_K_M keeps the accuracy at a third of the F16 size.
  • Strict grep rules still have the higher F1 (0.78). This model finds more real issues but raises more false alarms, mostly hardcoded_secret on harmless constants such as preference key names. Treat its output as triage leads for a human reviewer.
  • The test set is small (36 findings), so differences of a few points are within noise.

Before and after, on one held-out candidate

InsecureBankv2 TrackUserContentProvider.java line 78 passes the caller's projection, selection and sort order into SQLiteQueryBuilder.query. It is a real SQL injection, labelled in the test set.

Base model:

```json
{
  "real": false
}
```

This model:

{"real": true, "severity": "high", "cwe": "CWE-89",
 "evidence": "caller projection, selection and sortOrder passed to SQLiteQueryBuilder.query without setStrict or a projection map",
 "why_exploitable": "A calling app controls part of the SQL, so it can read rows or tables beyond user data (for example with UNION SELECT or a subquery in the selection).",
 "fix": "Use parameterized selections with selectionArgs, a fixed projection map, qb.setStrict(true) and setStrictColumns, and require a permission on the provider."}

How to use

The model expects the exact prompt format it was trained on. The full tool (jadx decompile, candidate scanner, report) is the apkscan-local CLI in the evidence repository (code/). To call the model directly:

llama-server -m tuned-verifier-v1-Q8_0.gguf --host 127.0.0.1 --port 8080 -c 4096

System message ({cls} is one of the 8 class ids below):

You are apkscan-local's verifier. A pattern scanner flagged the lines marked '>' in this Android code as a possible {cls} issue. Decide whether it is a real, exploitable {cls} vulnerability. Answer with JSON only: {"real": false} if not, or {"real": true, "severity": ..., "cwe": ..., "evidence": ..., "why_exploitable": ..., "fix": ...} if it is. Never write exploit code.

User message: a header, then about 10 numbered lines on either side of the flagged lines, with the flagged lines marked >:

File: com/example/TripProvider.java
Suspected class: provider_sqli
Flagged lines: 21-21
Context: public class TripProvider extends ContentProvider {

   15|     public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
   16|         SQLiteDatabase db = this.helper.getReadableDatabase();
   17|         String sql = "SELECT * FROM notes WHERE owner = '" + getCallingPackage() + "'";
   18|         if (selection != null) {
   19|             sql = sql + " AND " + selection;
   20|         }
>  21|         return db.rawQuery(sql, selectionArgs);
   22|     }

Use temperature 0.

Classes: exported_component (CWE-926), insecure_webview (CWE-749), hardcoded_secret (CWE-798), weak_crypto (CWE-327), insecure_network (CWE-319 / CWE-295), insecure_storage (CWE-922 / CWE-312), provider_sqli (CWE-89), intent_redirection (CWE-940). Each maps to an OWASP MASVS v2 control.

Training

Setting Value
Base Qwen/Qwen2.5-Coder-1.5B-Instruct, revision 2e1fd397
Method LoRA with MLX-LM 0.32.2 on an Apple M4 laptop, 16 GB (no cloud GPU)
LoRA rank 16, scale 2.0, dropout 0.05; last 16 of 28 blocks; q, k, v, o, gate, up and down projections
Loss answer tokens only; the first 5 answer tokens (the real/not-real decision) weighted x10
Data 1444 examples (685 real, 759 false alarms), 141 for validation
Schedule 720 iterations (about 1 epoch), batch 2, learning rate 1.5e-4 constant after 30 warmup steps, max length 1024, seed 0
Time 46 minutes
Validation loss 1.465 at the start, 0.033 at the end
Export fused, converted with llama.cpp b10210 to GGUF F16, quantized to Q8_0 and Q4_K_M

The decision weighting matters. An earlier run with plain LoRA loss collapsed to answering "clean" for every input, because the decision is one token among many.

Data

Training data was built automatically by running the candidate scanner over labelled, deliberately vulnerable training apps and marking each candidate real or false:

Source Licence
DIVA GPL-3.0
allsafe Apache-2.0
InjuredAndroid Apache-2.0
OWASP MASTG demos (24) CC-BY-SA-4.0
Synthetic generator (ours, rule-checked) MIT

The test apps (OVAA, BSD-2-Clause; InsecureBankv2, MIT) were held out completely; the split is by app, never by snippet. No personal data: the "credentials" in these apps are fake demo values.

Limits

  • 8 vulnerability classes only.
  • Trained and tested on deliberately vulnerable demo apps, not on obfuscated real-world release builds.
  • Sees only a window of about 20 lines, so multi-step data flows (for example some intent redirections) are missed.
  • The class is proposed by the scanner; the model sometimes accepts a wrong class.
  • For defensive triage only: it explains and suggests fixes, and is trained never to write exploit code.
Downloads last month
703
MLX
Hardware compatibility
Log In to add your hardware

Quantized

GGUF
Model size
2B params
Architecture
qwen2
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 hwatsauce/apkscan-local

Finetuned
(252)
this model