Instructions to use hwatsauce/apkscan-local with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use hwatsauce/apkscan-local 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("hwatsauce/apkscan-local") 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 hwatsauce/apkscan-local 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 hwatsauce/apkscan-local:Q4_K_M # Run inference directly in the terminal: llama cli -hf hwatsauce/apkscan-local:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf hwatsauce/apkscan-local:Q4_K_M # Run inference directly in the terminal: llama cli -hf hwatsauce/apkscan-local: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 hwatsauce/apkscan-local:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf hwatsauce/apkscan-local:Q4_K_M
Use Docker
docker model run hf.co/hwatsauce/apkscan-local:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use hwatsauce/apkscan-local with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hwatsauce/apkscan-local" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hwatsauce/apkscan-local", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/hwatsauce/apkscan-local:Q4_K_M
- Ollama
How to use hwatsauce/apkscan-local with Ollama:
ollama run hf.co/hwatsauce/apkscan-local:Q4_K_M
- Unsloth Desktop
- Pi
How to use hwatsauce/apkscan-local with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "hwatsauce/apkscan-local"
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": "hwatsauce/apkscan-local" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use hwatsauce/apkscan-local with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "hwatsauce/apkscan-local"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "hwatsauce/apkscan-local" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hwatsauce/apkscan-local", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use hwatsauce/apkscan-local with Docker Model Runner:
docker model run hf.co/hwatsauce/apkscan-local:Q4_K_M
- Lemonade
How to use hwatsauce/apkscan-local with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull hwatsauce/apkscan-local:Q4_K_M
Run and chat with the model
lemonade run user.apkscan-local-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use hwatsauce/apkscan-local 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 "hwatsauce/apkscan-local"
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 hwatsauce/apkscan-local
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use hwatsauce/apkscan-local with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "hwatsauce/apkscan-local"
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 "hwatsauce/apkscan-local" \ --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"
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).
- Demo video: https://youtu.be/BUchPPf7S3A
- Evidence (results, raw predictions, training logs, code): https://github.com/iabdullah215/apkscan-local
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_secreton 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
Model tree for hwatsauce/apkscan-local
Base model
Qwen/Qwen2.5-1.5B