PEFT
Safetensors
English
cybersecurity
malware-analysis
att&ck
threat-intelligence
mixtral
lora
expert-adapters
cape-sandbox
digital-forensics
Run this model with HF Jobs
Run umer07/fathom-mixtral on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/umer07/fathom-mixtral. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/umer07/fathom-mixtral on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use umer07/fathom-mixtral with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use umer07/fathom-mixtral with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mixtral-8x7B-Instruct-v0.1") model = PeftModel.from_pretrained(base_model, "umer07/fathom-mixtral") - Notebooks
- Google Colab
- Kaggle
Fathom: update model card with full benchmark results
Browse files12345367879910111112121314141516171819202117182319202521222728293031323334353637383940414243444546474849505152232454252656272829303132333435583637606162633839404142434445464748495051526553546755566957587172737475596077616263646566676869707172737980818283848586878874759076777879808182839284859495969798991008687888990911029293104949596979899106107108100101102103104113114105106107108117118119120121122123124125126127128129109110111112113114132133134115116117136118138139119120121122143123124125126146127128129130131148149132133134135153154136137138139158140141142143144145160161162146147148149150151152153154155156157158159160161162163164165166167168169170171172173166174175176177178179180181---language:- enlicense: apache-2.0base_model: mistralai/Mixtral-8x7B-Instruct-v0.1library_name: pefttags:- cybersecurity- malware-analysis- peft- lora- qlora- peft- mixtrallanguage:- en- threat-intelligence- securitypipeline_tag: text-generationlicense: apache-2.0---
# Fathom Plan A LoRA Adapter (Mixtral-8x7B-Instruct)
This repository contains the **Plan A** LoRA adapter for the Fathom FYP project:
**"Fathom: An LLM-Powered Automated Malware Analysis Framework"**# Fathom β Cybersecurity Expert LLM
The adapter is trained on a curated cybersecurity instruction-tuning corpus to improve analyst-style security outputs over the base `mistralai/Mixtral-8x7B-Instruct-v0.1` model.**Fathom** is a mixture-of-experts cybersecurity analysis system built on [Mixtral-8x7B-Instruct-v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1) with 10 domain-specific LoRA adapters. Each adapter is fine-tuned on a curated cybersecurity dataset for a specific analysis domain, enabling specialized reasoning across the full malware analysis pipeline.
## What This Is> **FYP (Final Year Project)** β Muhammad Haseeb, i221698
- **Type:** PEFT LoRA adapter (not a full standalone model)- **Base model required:** `mistralai/Mixtral-8x7B-Instruct-v0.1`- **Training style:** QLoRA (4-bit NF4 base loading, bf16 compute)- **Scope:** Plan A MVP uplift for cybersecurity and malware-analysis assistance
## Key Training Setup
- **Sequence length:** 2048- **Batch:** 2- **Gradient accumulation:** 8 (effective 16)- **Learning rate:** 2e-4 (cosine scheduler)- **Steps:** 3000 (completed run)- **LoRA rank/alpha:** r=32, alpha=64- **LoRA targets:** `q_proj`, `k_proj`, `v_proj`, `o_proj` (attention-only)- **Optimizer:** paged_adamw_8bit- **Precision:** bf16
## Hardware Used
Training was run on RunPod:
- **GPU:** NVIDIA A100 PCIe 80GB (1x)- **vCPU:** 8- **RAM:** 125 GB- **Disk:** 200 GB- **Location:** CA---
## Data Summary## Model Architecture
Curated cybersecurity instruction corpus with mixed sources (CyberMetric, Trendyol CyberSec, ShareGPT Cybersecurity, NIST downsampled, MITRE ATT&CK, CVE/IR/malware-focused sets).| Component | Details ||---|---|| Base Model | Mixtral-8x7B-Instruct-v0.1 (MoE, 47B params, 8Γ7B experts) || Fine-tuning | LoRA (rank=32, alpha=64, dropout=0.05) || Precision | BFloat16 full precision (no quantization) || Training Hardware | AMD MI300X VF (205.8 GB VRAM), ROCm 7.0 || Framework | PEFT + TRL (SFTTrainer), Alpaca instruction format || Adapter Count | 10 (1 unified + 9 domain experts) |
Final working files used:---
- `train.jsonl`: 120,912 samples- `eval.jsonl`: 1,915 samples- `cybermetric_80.jsonl`: 80 held-out MCQs- `malware_eval_25.jsonl`: 25 expert malware prompts## Adapters
| Adapter | Domain | Training Examples | Description ||---|---|---|---|| `unified-v2` *(root)* | General Cybersecurity | 9,000+ | Unified adapter across all domains β use as default || `adapters/expert-e1-static` | Static Analysis | 2,500+ | PE analysis, YARA rules, entropy, imports || `adapters/expert-e2-dynamic` | Dynamic / Behavioral | 2,500+ | API call sequences, sandbox reports, process injection || `adapters/expert-e3-network` | Network Analysis | 2,000+ | C2 detection, DNS/HTTP IOC analysis, traffic patterns || `adapters/expert-e4-forensics` | Digital Forensics | 2,000+ | Memory forensics, artifact analysis, timeline reconstruction || `adapters/expert-e5-threatintel` | Threat Intelligence | 9,532 | APT attribution, MITRE ATT&CK mapping, IOC enrichment || `adapters/expert-e6-detection` | Detection Engineering | 2,000+ | YARA, Sigma, Snort rule generation || `adapters/expert-e7-reports` | Report Generation | 2,000+ | Structured incident reports, executive summaries || `adapters/expert-e8-analyst` | Analyst Assistance | 2,000+ | Triage, prioritization, analyst Q&A || `adapters/expert-e9-cot` | Chain-of-Thought | 2,000+ | Step-by-step reasoning for complex analysis tasks |
## Evaluation Results---
### Standard post-eval settings## Benchmark Results
Generation settings used for fair base-vs-adapter comparison:All evaluations run on AMD MI300X (ROCm 7.0), bf16 full precision, greedy decode (temperature=0).
- `do_sample=False`- `temperature=0.0`- `max_new_eval=64`- `max_new_cyber=48`- `max_new_malware=256`### CyberMetric-80 (Multiple Choice β Cybersecurity Knowledge)
#### Baseline (corrected) vs Fine-tuned| Adapter | Accuracy ||---|---|| **unified-v2** | **91.25%** || expert-e8-analyst | 91.25% || expert-e3-network | 90.00% || expert-e4-forensics | 90.00% || expert-e2-dynamic | 85.00% || expert-e9-cot | 87.50% || expert-e7-reports | 88.75% || expert-e6-detection | 88.75% || expert-e1-static | 83.75% || expert-e5-threatintel | 81.25% |
| Metric | Baseline | Fine-tuned | Delta ||---|---:|---:|---:|| Eval mean overlap | 0.3283 | 0.3631 | +0.0349 || Eval exact match rate | 0.0000 | 0.2193 | +0.2193 || CyberMetric-80 accuracy | 0.825 | 0.900 | +0.075 || Malware structure | 0.44 | 0.84 | +0.40 || Malware ATT&CK correctness | 0.16 | 0.20 | +0.04 || Malware reasoning | 0.24 | 0.20 | -0.04 || Malware evidence awareness | 0.48 | 0.52 | +0.04 || Malware analyst usefulness | 0.52 | 0.56 | +0.04 |### Malware Analysis Rubric (25 open-ended samples, scored 0β1)
### Malware-only rerun with longer output budget| Metric | unified-v2 | Best Expert ||---|---|---|| Structure | 0.96 | 0.96 (e5, e7) || MITRE ATT&CK Correctness | 0.20 | 0.20 (e3, e4, e6) || Malware Reasoning | 0.24 | 0.32 (e9-cot) || Evidence Awareness | 0.68 | 1.00 (e2-dynamic) || Analyst Usefulness | 0.84 | 0.88 (e1, e3, e7) |
To test truncation effects on malware prompts, both base and fine-tuned were rerun with `max_new_malware=512` (25 prompts only).### MMLU Cybersecurity (unified-v2)
| Rubric axis | Base (512) | Fine-tuned (512) | Delta ||---|---:|---:|---:|| Structure | 0.56 | 0.88 | +0.32 || ATT&CK correctness | 0.16 | 0.20 | +0.04 || Malware reasoning | 0.36 | 0.28 | -0.08 || Evidence awareness | 0.56 | 0.64 | +0.08 || Analyst usefulness | 0.64 | 0.80 | +0.16 || Benchmark | Questions | Accuracy ||---|---|---|| MMLU Computer Security | 100 | **79.0%** || MMLU Security Studies | 100 | **64.0%** || TruthfulQA MC1 | 100 | **65.0%** |
Interpretation: structure/evidence/usefulness improved strongly, but malware reasoning remains the main gap for future iterations.### Q&A Eval β Fathom Cybersecurity Dataset (200 samples, unified-v2)
## Limitations| Metric | Score ||---|---|| Token Overlap (ROUGE-like) | 0.467 || Exact Match Rate | 1.5% || Mean Throughput | 15.5 tok/s |
- This is a **Plan A MVP adapter**, not a fully specialized malware reverse-engineering model.- Malware causal reasoning still needs improvement via targeted data and/or evidence-grounded training (Plan B).- Outputs should be treated as analyst assistance, not an autonomous verdict.---
## Usage
```pythonimport torchfrom transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfigfrom transformers import AutoModelForCausalLM, AutoTokenizerfrom peft import PeftModelimport torch
base_model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"adapter_repo = "umer07/fathom-mixtral-lora-plan-a"
bnb_config = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.bfloat16,)
tokenizer = AutoTokenizer.from_pretrained(base_model_id, use_fast=True)if tokenizer.pad_token is None: tokenizer.pad_token = tokenizer.eos_tokenBASE_MODEL = "mistralai/Mixtral-8x7B-Instruct-v0.1"ADAPTER = "umer07/fathom-mixtral" # unified-v2 (default)# For expert: "umer07/fathom-mixtral/adapters/expert-e2-dynamic"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, use_fast=True)model = AutoModelForCausalLM.from_pretrained( base_model_id, quantization_config=bnb_config, device_map={"": 0}, BASE_MODEL, device_map="auto", torch_dtype=torch.bfloat16, low_cpu_mem_usage=True,)
model = PeftModel.from_pretrained(model, adapter_repo)model = PeftModel.from_pretrained(model, ADAPTER)model.eval()
prompt = """### Instruction:Analyze the malware behavior and map likely ATT&CK techniques.Analyze this CAPEv2 sandbox report excerpt and identify the malware family, behavioral patterns, and MITRE ATT&CK techniques.
### Input:Sample creates scheduled task persistence and launches encoded PowerShell.File: suspicious.exe | CAPE Malscore: 9.5/10API Calls: CreateFileW, WriteProcessMemory, CreateRemoteThread, RegSetValueExWDNS: update.microsoft-cdn.net, api.telemetry-svc.comRegistry: HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\SvcHost32
### Response:"""### Response:"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)with torch.inference_mode(): out = model.generate(**inputs, max_new_tokens=512, do_sample=False, temperature=0.0)
out = model.generate(**inputs, max_new_tokens=512, do_sample=False)print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))```
## Project Status---
## Fathom Pipeline
The full Fathom system includes:
- Core Plan A training/evaluation cycle: **completed**- GPU instance used for training has been deleted- No additional training is currently in progress1. **CAPEv2 Extraction Layer** β parses sandbox JSON reports into structured evidence2. **Domain Classifier** β sentence-transformer embeddings β cosine similarity β adapter selection3. **RAG Retriever** β FAISS index of domain knowledge (on `umer07/fathom-expert-data`)4. **Expert Adapter Registry** β loads the appropriate LoRA adapter per query5. **Prompt Templates** β domain-specific instruction prompts per expert6. **Guardrails** β output filtering for hallucination / harmful content7. **Inference Engine** β unified generation with adapter hot-swap8. **FastAPI Backend** β REST API for integration
---
## Training Data
Training datasets are published at [umer07/fathom-expert-data](https://huggingface.co/datasets/umer07/fathom-expert-data).
Sources include:- CAPE sandbox reports (real malware execution data)- URLhaus threat feed (malicious URL classification)- Atomic Red Team ATT&CK simulations- GTFOBins living-off-the-land binaries- MITRE ATT&CK STIX bundles- CyberMetric, SecQA, and curated cybersecurity QA pairs- LOLBAS project
---
## Citation
If you use this adapter, please cite your project report/thesis for Fathom Plan A and reference the base model (`mistralai/Mixtral-8x7B-Instruct-v0.1`).```@misc{fathom2026, title = {Fathom: A Mixture-of-Expert LLM Framework for Cybersecurity Analysis}, author = {Muhammad Haseeb}, year = {2026}, note = {Final Year Project, FAST-NUCES}}```README.md+126-111