Instructions to use transilienceai/qwen2.5-coder-32b-security-tools-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use transilienceai/qwen2.5-coder-32b-security-tools-lora with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("transilienceai/qwen2.5-coder-32b-security-tools-lora") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use transilienceai/qwen2.5-coder-32b-security-tools-lora with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "transilienceai/qwen2.5-coder-32b-security-tools-lora" --prompt "Once upon a time"
- Atomic Chat
Qwen2.5-Coder-32B security-tools QLoRA: context beats weights
This is a QLoRA adapter for Qwen2.5-Coder-32B-Instruct, trained to teach the model our security-testing playbooks and the exact command-line interfaces of 52 in-house security tools. It is released with its byte-reproducible dataset, training config, eval harness and raw eval dumps. The headline result is negative: the adapter learned the shape of a tool answer but not the tools. It named no real tools on its own, invented two, and made grounding worse even when combined with the fix that works: a 52-line tool digest in the system prompt.
β οΈ We publish this adapter as a reference point, not as a recommended model. We don't use it in production. With the digest in context, the base model beats it on every metric we measured (see Evaluation).
Links
- βοΈ Deep-dive write-up: Context Beats Weights (community article; the same text is in
BLOG.md). It covers the data pipeline, the training run, the eval, and why the weights lost. - π Related negative result: Loop Surgery (blog). Its training set included this dataset.
TL;DR
| Configuration (6 tool-use prompts, greedy) | Real tools named | Confabulated tools | Valid flags |
|---|---|---|---|
| Qwen2.5-Coder-32B base, no context | 0 | 1 | 0 |
| Qwen2.5-Coder-32B base + tool digest | 10 | 0 | 21 |
| + this LoRA, no context | 0 | 2 | 0 |
| + this LoRA + tool digest | 7 | 0 | 10 |
| Qwen3.6-35B-A3B MoE + tool digest (no training) | 10 | 0 | 18 |
- The adapter saw the facts and still didn't recall them. 8 of the 10 tools the prompts target had their interface record in the training split.
- It learned the format. Its NTLM answer was a perfect house-style tool card for a tool that doesn't exist (
ntlmv2-ntlmrelayx.py), and it borrowed the real tool's--stdinflag along the way. - Fine-tuning made it worse. Adapter + digest scored below base + digest. The learned answer shape competes with the facts in context.
- The digest needs no training. It is generated from the tools' AST (about 1.7k tokens) and works across architectures.
What's in this repo
| File | What it is |
|---|---|
adapters.safetensors |
The LoRA adapter: rank 16, all 7 linear projections in layers 48β63, fp32, 134 MB. This is the iteration-250 checkpoint, which is the one evaluated. |
adapter_config.json |
The mlx_lm adapter config (paths made relative). |
qlora_security.yaml |
The full training config (mlx_lm.lora -c qlora_security.yaml). |
make_security_data.py |
Stdlib-only dataset builder: skills β playbook records, tools/*.py β real interfaces parsed from the AST, with redaction, a leak scan and a split by source item. |
data/{train,valid,test}.jsonl, data/meta.json, data/token_counts.json |
The exact dataset trained on: 186 / 31 / 9 records, residual_leaks: 0. Rebuilds byte-for-byte from communitytools commit 95fdc12. |
eval_security.py |
The grounding harness: AST inventory, scorer, digest generator, and MLX / Ollama runners. |
tools-digest.md |
The 52-line tool-interface digest, the lever that works. |
results/eval_*.jsonl |
Raw prompt/response dumps for all five configurations. |
results/scores.json |
Scores recomputed from those dumps with eval_security.score(). |
results/training_log.txt |
The mlx_lm training log (ANSI codes stripped). |
BLOG.md |
The full write-up. |
Model details
- Type: LoRA adapter (QLoRA: LoRA trained on a 4-bit quantised base), MLX format. It is not a PEFT adapter and does not load in
transformersorpeftwithout conversion. - Base:
mlx-community/Qwen2.5-Coder-32B-Instruct-4bit, the MLX 4-bit conversion ofQwen/Qwen2.5-Coder-32B-Instruct. Base weights are not redistributed. - Trainable parameters: 33.554M (0.102% of 32.76B), as 224 tensors.
- Hardware: one Mac Studio (M3 Ultra, 96 GB unified memory), with
mlx 0.32.4andmlx-lm 0.32.2. - License: Apache-2.0.
How to use
pip install -r requirements.txt
from mlx_lm import load, generate
model, tok = load("mlx-community/Qwen2.5-Coder-32B-Instruct-4bit",
adapter_path="path/to/qwen2.5-coder-32b-security-tools-lora")
For tool grounding, we recommend skipping the adapter: put tools-digest.md, regenerated from your checkout of the tools, in the system prompt of the base model.
Training data
All records are built from transilienceai/communitytools (MIT) at commit 95fdc128af4ca1ae16b3226f9430f1bad97b0656, by make_security_data.py --seed 0.
Tool records (40 train / 5 valid / 7 test): for each
tools/*.py,astextracts the docstring, theArgumentParser(description=β¦)and everyadd_argument(β¦). These are rendered as a usage block plus an arguments list. No LLM was involved in writing the targets.Skill records (146 / 26 / 2): each
skills/*/SKILL.mdbody, plus up to sixreference/*.mdfiles per skill, as planning or playbook answers. Targets are clipped at 6,000 characters.Redaction: at the output funnel. Global IPs, secret-shaped strings (
sk-,gh*_, JWT,AKIA, 40+ hex), labelled key/value secrets and emails are replaced. Private and link-local IPs are kept. A post-write rescan reportedresidual_leaks: 0.Split: by source item,
sha1("kind:name") % 100β valid < 10, test < 20, train otherwise. No skill or tool appears in two partitions.Size (Qwen2.5 tokenizer and chat template):
Split Total tokens Assistant tokens train 196,528 170,123 valid 34,670 30,332 test 4,372 3,106 Two records exceed 2,048 tokens and are truncated during training.
Training procedure
- Method:
mlx_lm.lora. - LoRA settings: rank 16, scale 20, dropout 0.05, on the last 16 layers.
- Optimiser: Adam at a constant 5e-5.
- Batch and sequence: batch size 1 with grad accumulation 4,
max_seq_length2048,mask_prompt: true(loss on the assistant span only), gradient checkpointing, seed 0. - Duration: 250 iterations.
mlx_lmcounts micro-batches, so that is 250 examples, about 1.3 passes over the training set, and 62 optimizer updates. The config's~5 epochscomment is wrong. - Throughput: 230.2k tokens trained at 117β144 tokens/s, about 44 minutes of wall-clock including six full validation passes.
- Loss: validation loss was 2.291 β 2.047 (50) β 2.039 (100) β 2.032 (150) β 2.003 (200) β 2.079 (250). The published checkpoint is iteration 250, past the validation minimum, because it is the one we evaluated.
Evaluation
eval_security.py builds the ground-truth inventory of 52 tools and their real flag sets from the same AST pass. Each response gets three counts:
- distinct real tools named;
- distinct
.pynames that don't exist; - valid and invalid flags in
tools/<x>.py --flaginvocations.
We used six hand-written task prompts: NTLM decode, CVSS 4.0 score and lint, KEV plus NVD lookup, passive web recon, DNS/email posture, and coverage mapping. Decoding was greedy, with at most 512 new tokens on MLX. The MoE row ran on Ollama with thinking disabled and at most 700 tokens. See the TL;DR table for the results. The raw responses are in results/.
Intended uses & limitations
- Intended use: research and reproduction, as a documented example of SFT failing to install tool knowledge that context supplies trivially. It is not intended as a production security assistant.
- n = 6 prompts, one greedy sample each, scored lexically. The scorer doesn't execute commands or judge whether a tool fits the task.
- One training run. There was no sweep over learning rate, epochs or rank. A longer run might recall more interfaces, but memorised interfaces go stale whenever the tools change.
- Overlap: the eval prompts are hand-written rather than drawn from the test split, and 8 of the 10 target tools' interface records were in train.
- Dual-use content: the training data contains offensive-security techniques and payloads from a public playbook repo. Use it only for authorised testing.
Reproduction
pip install -r requirements.txt
git clone https://github.com/transilienceai/communitytools
git -C communitytools checkout 95fdc128af4ca1ae16b3226f9430f1bad97b0656
python3 -I make_security_data.py --repo communitytools --out data # byte-identical to data/
mlx_lm.lora -c qlora_security.yaml # writes adapters_out/
python3 eval_security.py --repo communitytools --mlx-base --mlx-adapter . --dump eval.jsonl
Base model, attribution & licensing
- Built on Qwen2.5-Coder-32B-Instruct (
Qwen/Qwen2.5-Coder-32B-Instruct), Apache-2.0, Β© Alibaba Cloud / the Qwen team, via themlx-community4-bit MLX conversion. No base weights are included. - The training data is derived from transilienceai/communitytools (MIT). See
NOTICE. - This release is Apache-2.0. See
LICENSE.
Citation
@misc{qwen25-coder-security-tools-lora-2026,
title = {Context beats weights: QLoRA-tuning Qwen2.5-Coder-32B on in-house security tools},
year = {2026},
note = {QLoRA adapter + reproducible dataset and eval; a negative result on SFT for tool grounding},
howpublished = {Hugging Face repository}
}
Quantized
Model tree for transilienceai/qwen2.5-coder-32b-security-tools-lora
Base model
Qwen/Qwen2.5-32B