Skip to main content

AttackLM

AttackLM — QLoRA fine-tuning pipeline for a MITRE ATT&CK-grounded security AI assistant. 24,652 training pairs · Qwen2.5-Coder base · 16GB+ VRAM.

License: MIT PyPI version Python 3.10+


GUI (New in v0.7.1)

AttackLM now includes a terminal-based GUI for all commands. No more memorizing 40+ CLI flags.

pip install attacklm-gui
attacklm-gui

Features:

  • Training form with 40+ params in 5 tabs (Basic, LoRA, GaLore, Advanced, Hardware)
  • Live training monitor with loss sparkline, VRAM gauge, progress bar, and log viewer
  • One-click screens for extract, balance, infer, merge, build, pipeline, and init
  • 5 built-in presets (3B Q-GaLore, 3B LoRA, 7B Q-GaLore, 7B QLoRA, etc.)
  • Pause/resume/quit controls during training
  • Works in terminal-only environments — no X11, no browser, no GPU required. Works over SSH and WSL.

The CLI still works exactly as before. The GUI is a thin wrapper that constructs and runs CLI commands.


Install

The recommended way to install the full CUDA training stack:

pip install attacklm[all]

Alternative: Use uv pip install "attacklm[all]" for faster installation. Note: flash-attn is optional and not included by default to avoid heavy compilation requirements.


Init

Initialize the dataset by cloning upstream repositories, extracting data, adding attribution, and organizing into buckets:

attacklm-init --yes

Balance (Optional)

Because Metasploit accounts for ~64% of the raw data, balancing is recommended to prevent overfitting and ensure broad tactical coverage.

attacklm-balance --profile 7b-16gb --output data/datasets/balanced/balanced.jsonl
  • Presets: Use --preset red-team, purple-team, or blue-team to control the offensive/defensive mix.
  • Profiles: Use profiles like 3b-16gb or 7b-16gb to automatically set per-bucket caps based on your VRAM.

Train

Train the model using the orchestrated pipeline. The default base model is Qwen/Qwen2.5-Coder-3B-Instruct.

attacklm-train-all --single-model --dataset all --epochs 5 --max-length 2048

Key Training Flags

Flag Default Description
--single-model off Train one model on all buckets combined
--dataset none Path to dataset or alias (all, base/, tools/, ai/, orchestrator)
--epochs 10 Total training epochs
--max-length 1024 Max sequence length (use 2048 for richer context)
--lora-r 16 LoRA rank
--use-galore off Use Q-GaLore for full-parameter training on low VRAM
--spectrum off SNR-based layer freezing to reduce VRAM

Multi-round SFT: AttackLM supports iterative training. You can train on tactics first, then tools, then a final general pass. Each round automatically backs up the previous state and uses the merged weights of the prior run as the new base.


Build

Perform a one-shot merge of the LoRA adapter and conversion to GGUF format for local deployment.

attacklm-build --adapter models/attacklm-single_TIMESTAMP --name attacklm

Infer

Smoke-test your trained adapter with a set of representative security prompts.

attacklm-infer --adapter models/attacklm-single_TIMESTAMP

Bucket Reference Table

The dataset is split into buckets to allow for granular control over training composition.

Bucket Pairs Category Description
base/collection 634 MITRE Tactic TA0009 - Collection techniques
base/command_and_control 0 MITRE Tactic TA0011 - C2 techniques (no data yet)
base/credential_access 589 MITRE Tactic TA0006 - Credential access
base/defense_evasion 1,375 MITRE Tactic TA0005 - Defense evasion
base/discovery 1,846 MITRE Tactic TA0007 - Discovery
base/execution 767 MITRE Tactic TA0002 - Execution
base/exfiltration 53 MITRE Tactic TA0010 - Exfiltration
base/lateral_movement 252 MITRE Tactic TA0008 - Lateral movement
base/persistence 1,120 MITRE Tactic TA0003 - Persistence
base/privilege_escalation 537 MITRE Tactic TA0004 - Privilege escalation
tools/metasploit 8,349 Tools Metasploit module knowledge
ai/jailbreaking 50 AI Security Jailbreak techniques (garak)
ai/prompt-injection 63 AI Security Prompt injection (promptfoo, promptmap)
orchestrator 380 Meta Agent routing decisions
cloud/attacks 10 Extended Cloud attack techniques
ics/attacks 290 Extended ICS/SCADA attacks
social_engineering/phishing 440 Extended Phishing techniques
wireless/attacks 197 Extended Wireless attacks
defensive/detection_engineering 7,154 Defensive Sigma + Elastic + Splunk detection rules
defensive/threat_hunting 366 Defensive Mordor + ThreatHunter playbooks
defensive/incident_response 168 Defensive NIST SP 800-61r3 IR procedures

Note: 6 defensive buckets (detection_engineering, threat_hunting, incident_response, plus sigma/elastic/splunk/mordor/threathunter/nist sources) are planned but have 0 records currently.


Data Sources

Source Pairs License
Metasploit Framework 13,997 BSD-3-Clause
Atomic Red Team 1,115 MIT
MITRE Caldera/Stockpile 390 Apache-2.0
LLM-generated 937 GPL-3.0
NVIDIA Garak / Promptfoo 113 Mixed MIT/Apache-2.0
Sigma 3,132 DRL-1.1
Elastic 1,908 Elastic-2.0
Splunk 2,114 Apache-2.0
Mordor 339 Apache-2.0
ThreatHunter 27 Apache-2.0
NIST IR 168 Public Domain

Architecture

Data is organized in a per-source hierarchy to ensure provenance and attribution.

AttackLM/
├── data/
│   └── datasets/
│       └── buckets/
│           └── sources/
│               └── <source>/
│                   └── <bucket>/
│                       └── <tactic>/
│                           └── data.jsonl

This layout allows the pipeline to deterministically extract data from upstream sources without introducing hallucinations or API dependencies.


CLI Reference

v0.8.0: The 21 hyphenated commands are consolidated into a single attacklm command with subcommands. The old commands still work but print a deprecation warning. They will be removed in v0.9.0.

Unified Command (v0.8.0+)

Command Description
attacklm train Train a model (QLoRA, GaLore, Q-GaLore, Spectrum, PiSSA)
attacklm train --dataset all Train all buckets (replaces attacklm-train-all)
attacklm train --hpo Run HPO sweep (replaces attacklm-hpo)
attacklm init One-shot init: clone → extract → attribute → buckets
attacklm init --extract-only Extract data only (replaces attacklm-extract)
attacklm init --buckets-only Organize into buckets only (replaces attacklm-buckets)
attacklm init --attribute-only Add attribution only (replaces attacklm-attribute)
attacklm init --clone-only Clone repos only (replaces attacklm-clone)
attacklm balance Build a balanced subset of buckets
attacklm build One-shot merge → GGUF → install to LM Studio
attacklm build --merge-only Merge adapter only (replaces attacklm-merge)
attacklm build --gguf-only Convert to GGUF only (replaces attacklm-gguf)
attacklm build --register-ollama Register GGUF with Ollama (replaces attacklm-register-ollama)
attacklm infer Smoke-test inference
attacklm eval Run retention evaluation suite
attacklm eval --collect-ref Collect reference model outputs
attacklm eval --score Score candidate models against reference
attacklm eval --compare Compare multiple candidate model scores
attacklm eval --golden Execute golden vector regression gates
attacklm gui Terminal GUI for all commands
attacklm demo Multi-agent orchestrator demo

Legacy Commands (Deprecated, removed in v0.9.0)

Old Command New Command
attacklm-train attacklm train
attacklm-train-all attacklm train --dataset all
attacklm-train-lora attacklm train
attacklm-hpo attacklm train --hpo
attacklm-init attacklm init
attacklm-extract attacklm init --extract-only
attacklm-buckets attacklm init --buckets-only
attacklm-attribute attacklm init --attribute-only
attacklm-clone attacklm init --clone-only
attacklm-balance attacklm balance
attacklm-build attacklm build
attacklm-merge attacklm build --merge-only
attacklm-gguf attacklm build --gguf-only
attacklm-register-ollama attacklm build --register-ollama
attacklm-infer attacklm infer
attacklm-eval attacklm eval
attacklm-collect-ref attacklm eval --collect-ref
attacklm-score attacklm eval --score
attacklm-compare attacklm eval --compare
attacklm-golden attacklm eval --golden
attacklm-demo attacklm demo

License

The code in this repository is licensed under the MIT License. Training data consists of mixed licenses per source; see ATTRIBUTION.md for the full mapping.

Contributing

See CONTRIBUTING.md for guidelines on contributing to AttackLM.

Changelog

See CHANGELOG.md for the full version history.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

attacklm-0.8.0.tar.gz (5.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

attacklm-0.8.0-py3-none-any.whl (491.9 kB view details)

Uploaded Python 3

File details

Details for the file attacklm-0.8.0.tar.gz.

File metadata

  • Download URL: attacklm-0.8.0.tar.gz
  • Upload date:
  • Size: 5.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for attacklm-0.8.0.tar.gz
Algorithm Hash digest
SHA256 2f6fd050bac375da6815ac3ad793c7a48655561d69d3c5385336bfce11acd22b
MD5 a69adfa39adfb0c210482de429fdf4e3
BLAKE2b-256 3f41b1f30b5a6a504d0aabc50713fcaaeec04852507f4e5221255aed86d68f42

See more details on using hashes here.

Provenance

The following attestation bundles were made for attacklm-0.8.0.tar.gz:

Publisher: release.yml on Veedubin/AttackLM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file attacklm-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: attacklm-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 491.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for attacklm-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85b82532e45e6c7da8ae8b58f42f8aafdabfc9a6b1dd72e70a38413db106c6f4
MD5 7b621d91bdaed9f954dc02c53aeb74f6
BLAKE2b-256 2c8b9f3a4dbd5bbc094f1ca5d29bf6b5b739ae50578c8faecb68137b15aad865

See more details on using hashes here.

Provenance

The following attestation bundles were made for attacklm-0.8.0-py3-none-any.whl:

Publisher: release.yml on Veedubin/AttackLM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page