Text Generation
GGUF
English
llama.cpp
qwen
qwen3
qwen3.5
cybersecurity
malware-analysis
reverse-engineering
pe
elf
ghidra
agent
research
conversational
Instructions to use AgentreBench/xref-9b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use AgentreBench/xref-9b with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="AgentreBench/xref-9b", filename="xref-9b-f16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AgentreBench/xref-9b 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 AgentreBench/xref-9b:F16 # Run inference directly in the terminal: llama cli -hf AgentreBench/xref-9b:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AgentreBench/xref-9b:F16 # Run inference directly in the terminal: llama cli -hf AgentreBench/xref-9b:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf AgentreBench/xref-9b:F16 # Run inference directly in the terminal: ./llama-cli -hf AgentreBench/xref-9b:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf AgentreBench/xref-9b:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf AgentreBench/xref-9b:F16
Use Docker
docker model run hf.co/AgentreBench/xref-9b:F16
- LM Studio
- Jan
- vLLM
How to use AgentreBench/xref-9b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AgentreBench/xref-9b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AgentreBench/xref-9b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AgentreBench/xref-9b:F16
- Ollama
How to use AgentreBench/xref-9b with Ollama:
ollama run hf.co/AgentreBench/xref-9b:F16
- Unsloth Studio
How to use AgentreBench/xref-9b with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AgentreBench/xref-9b to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AgentreBench/xref-9b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for AgentreBench/xref-9b to start chatting
- Pi
How to use AgentreBench/xref-9b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AgentreBench/xref-9b:F16
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "AgentreBench/xref-9b:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use AgentreBench/xref-9b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AgentreBench/xref-9b:F16
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 AgentreBench/xref-9b:F16
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use AgentreBench/xref-9b with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AgentreBench/xref-9b:F16
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 "AgentreBench/xref-9b:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use AgentreBench/xref-9b with Docker Model Runner:
docker model run hf.co/AgentreBench/xref-9b:F16
- Lemonade
How to use AgentreBench/xref-9b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AgentreBench/xref-9b:F16
Run and chat with the model
lemonade run user.xref-9b-F16
List all available models
lemonade list
File size: 8,150 Bytes
ae8c826 7ca7fe9 ae8c826 7ca7fe9 ae8c826 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | ---
license: apache-2.0
language:
- en
pipeline_tag: text-generation
library_name: llama.cpp
tags:
- gguf
- qwen
- qwen3
- qwen3.5
- cybersecurity
- malware-analysis
- reverse-engineering
- pe
- elf
- ghidra
- agent
- research
inference: false
---
<p align="center">
<img src="assets/xref-9b-banner.svg" alt="xref-9b" width="860">
</p>
# xref-9b
`xref-9b` is a research-preview reverse-engineering assistant for static PE and ELF malware triage. It is intended to be used with a local tool wrapper that exposes static analysis tools such as `file`, `strings`, `readelf`, `objdump`, PE header/import inspection, entropy checks, and optional Ghidra headless summaries.
This release is distributed as GGUF for local inference with llama.cpp.
## What Is Included
| File | Purpose |
|---|---|
| `xref-9b-q4_k_m.gguf` | Recommended GGUF for local use. |
| `xref-9b-f16.gguf` | Full precision GGUF artifact for conversion/experimentation. |
| `agentre.py` | Interactive chat wrapper for PE/ELF reverse engineering. |
| `agentre_triage.py` | Static tool runtime and batch triage backend. |
| `reverse_engineering_spec_unified.md` | Tool-use and verdict spec given to the model. |
| `tools/ghidra_scripts/AgentRESummary.java` | Ghidra headless script used by `/ghidra` and `ghidra_summary`. |
| `scripts/` | Convenience scripts and environment template. |
| `assets/` | Release graphics and evaluation chart. |
## Intended Use
This model is for defensive research, malware triage, reverse-engineering education, and local analyst-assist workflows. It is not a production malware detector and should not be used as the only basis for blocking, attribution, incident response, or legal decisions.
The model should be treated as an assistant that proposes evidence-backed hypotheses from static tool output. It can be wrong, especially on stripped, packed, obfuscated, or sparse-string binaries.
## Training Summary
`xref-9b` was trained from a Qwen-family 9B base model using:
- supervised fine-tuning (SFT) on reverse-engineering instruction traces;
- additional PE and ELF malware/benign triage data;
- reinforcement learning / preference optimization with IPO over curated preference pairs;
- tool-use formatting for local static analysis workflows.
Training data sources are intentionally not enumerated in this public model card.
## Evaluation Snapshot
Held-out mixed PE/ELF evaluation, 40 binaries total, balanced by format and benign/malicious label. Results are research-preview numbers and should be read as directional rather than definitive.
<p align="center">
<img src="assets/xref-9b-eval-chart.svg" alt="xref-9b evaluation chart" width="760">
</p>
| Checkpoint / workflow | Strict accuracy | Binary accuracy | Notes |
|---|---:|---:|---|
| Base model | 55.0% | 62.5% | Untuned base under the same holdout triage harness. |
| SFT | 57.5% | 57.5% | Supervised checkpoint on PE/ELF reverse-engineering tasks. |
| SFT + IPO | 67.5% | 67.5% | Preference-optimized release workflow with deeper static-analysis settings and final-answer forcing. |
Observed gains:
- strict accuracy improved from 55.0% on the base model to 67.5% with SFT + IPO in the release workflow (+12.5 percentage points);
- labeled ELF malware performance improved substantially under the deeper static workflow;
- benign ELF calibration regressed in that run, so unknown/benign decisions still need analyst review.
## Quick Start
### 1. Install Runtime Dependencies
Required:
- Python 3.10+
- llama.cpp with `llama-completion`
- common Unix tools: `file`, `strings`, `readelf`, `objdump`, `nm`, `hexdump` or `xxd`
Optional but recommended:
- Ghidra headless (`analyzeHeadless`)
- MinGW binutils for richer PE inspection on Linux (`x86_64-w64-mingw32-objdump`, `x86_64-w64-mingw32-nm`)
### 2. Download
Example with Hugging Face CLI:
```bash
hf download AgentreBench/xref-9b xref-9b-q4_k_m.gguf agentre.py agentre_triage.py reverse_engineering_spec_unified.md --local-dir xref-9b
```
For full local package including scripts and Ghidra helper:
```bash
hf download AgentreBench/xref-9b --local-dir xref-9b
```
### 3. Configure Environment
```bash
cd xref-9b
cp scripts/xref9b.env.example scripts/xref9b.env
$EDITOR scripts/xref9b.env
source scripts/xref9b.env
```
At minimum set:
```bash
export XREF9B_GGUF="$PWD/xref-9b-q4_k_m.gguf"
export XREF9B_LLAMA_CLI="/path/to/llama.cpp/build/bin/llama-completion"
```
Optional Ghidra:
```bash
export GHIDRA_HEADLESS="/path/to/ghidra/support/analyzeHeadless"
```
### 4. Chat With One Binary
```bash
python3 agentre.py chat /path/to/sample --model "$XREF9B_GGUF" --llama-cli "$XREF9B_LLAMA_CLI" --ctx-size 65536 --gpu-layers 99 --max-turns 8 --max-tool-calls 16 --max-tokens 1600 --obs-limit 8000
```
Inside chat:
```text
/deep run the deeper static workflow
/ghidra run Ghidra headless summary
/verdict force a concise final verdict
/compact compact long chat history
/tools list tools used
/save save transcript
/quit exit
```
You can also ask naturally:
```text
is this malicious or benign?
use ghidra and explain the key functions
is this packed?
what evidence supports malicious behavior?
```
### 5. Directory Mode
Directory mode is explicit:
```bash
python3 agentre.py chat -d /path/to/binaries --model "$XREF9B_GGUF" --llama-cli "$XREF9B_LLAMA_CLI" --ctx-size 65536 --gpu-layers 99
```
Use `/samples` and `/open N` inside the session.
### 6. Batch Triage
```bash
python3 agentre.py triage /path/to/binaries --model "$XREF9B_GGUF" --llama-cli "$XREF9B_LLAMA_CLI" --ctx-size 65536 --gpu-layers 99 --max-tool-calls 16 --max-tokens 1600 --obs-limit 8000
```
## Ghidra Support
`xref-9b` does not run arbitrary Ghidra commands. The wrapper exposes one Ghidra tool, `ghidra_summary`, implemented with Ghidra headless and `tools/ghidra_scripts/AgentRESummary.java`.
The wrapper runs a command equivalent to:
```bash
analyzeHeadless /tmp/agentre_ghidra_xxx agentre_project -import <staged_sample> -overwrite -analysisTimeoutPerFile 180 -scriptPath tools/ghidra_scripts -postScript AgentRESummary.java /tmp/agentre_ghidra_summary.txt
```
Ghidra is used for static summaries: program metadata, memory blocks, imports/external symbols, strings, functions, and short instruction excerpts. It does not unpack malware, execute binaries, emulate payloads, or dynamically dump memory.
## Limitations
- Research preview; not production detection.
- Static-only; no execution, sandboxing, unpacking, or memory dumping.
- Stripped/static/packed binaries can require manual analyst follow-up.
- The model can overfit to tool artifacts or overclaim from weak signals.
- PE and ELF performance is uneven across families and compiler/linker settings.
- The model may classify offensive dual-use tools as `hackware` or `malicious` depending on evidence and workflow.
- Long tool histories can degrade answers; use `/compact`.
## Improving The Model
Useful next steps for contributors:
- Add more stripped ELF and statically linked ELF training traces.
- Add calibrated benign PE examples that contain network/admin APIs but no malicious behavior.
- Add preference pairs that penalize overclaiming from entropy or strings alone.
- Add tool traces that distinguish virtual addresses from file offsets.
- Improve Ghidra summaries with function call graphs, xrefs, and decompiler snippets.
- Add safer structured verdict calibration: `malicious`, `benign`, `hackware`, `unknown`.
- Evaluate with family-disjoint and compiler-disjoint splits.
## Recommended Settings
For most local analysis:
```bash
--ctx-size 65536 --max-turns 8 --max-tool-calls 16 --max-tokens 1600 --obs-limit 8000
```
Use larger `--max-tokens` for deeper explanations, and `/compact` if the session becomes repetitive or context-heavy.
## File Hashes
```text
87f320a4edda407a00ddb005774640acac4c45882a9d03674e5f2c37e9dbafd6 xref-9b-q4_k_m.gguf
2e9438786b7aed9a9314629e811900616c1b4666a2f7cffa2f537fd566f238d8 xref-9b-f16.gguf
```
## Citation
If you use this model in research, cite AgentRE-Bench / xref-9b and include the exact GGUF hash used.
|