ASCII diagrams in the repository’s documentation style, grounded in
SYSTEM_ARCHITECTURE.md,FINE_TUNING.md,USAGE.md, andREADME.md.
8.1 System Architecture (shipped components)
┌───────────────────────────────────────────────────────────────┐
│ PoCSmith │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ CLI │─────▶│ Core Engine │─────▶│ AI Model │ │
│ │ (click) │ │ route/prompt │ │ CodeLlama-7B │ │
│ │ cve/generate/│ │ /orchestrate │ │ + LoRA (peft)│ │
│ │ shellcode │ └──────┬───────┘ │ CUDA │ │
│ └──────────────┘ │ └──────┬───────┘ │
│ │ │ │
│ ┌────────────────────┴────────────────────┘ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ CVE Parser │ │ PoC │ │ Shellcode │ │
│ │ NVD API → │ │ Generator │ │ Generator │ │
│ │ type/software│ │ (exploit) │ │ (pwntools) │ │
│ │ /severity │ └──────┬───────┘ └──────┬───────┘ │
│ └──────────────┘ │ │ │
│ ▼ ▼ │
│ ┌──────────────────────────────┐ │
│ │ Formatters → output/ artifact│ │
│ └──────────────────────────────┘ │
└───────────────────────────────────────────────────────────────┘
src/ parsers · generators · formatters · cli · core
models/pocsmith-v1 (33MB LoRA adapter over CodeLlama-7B)
8.2 CVE → PoC Data Flow
user: cve CVE-2024-1234
│
▼
┌──────────────┐ NVD API (5 req / 30s)
│ CVE Parser │◀─────────────────────────
│ extract: │
│ vuln type │
│ software │
│ severity │
└──────┬───────┘
│
▼
┌──────────────┐
│ build prompt │ ### Instruction: / ### Response: (matches training format)
└──────┬───────┘
│
▼
┌──────────────┐
│ AI Model │ fine-tuned CodeLlama-7B (LoRA adapter, 4-bit, CUDA)
└──────┬───────┘
│
▼
┌──────────────┐
│ Formatter │ validate + format
└──────┬───────┘
│
▼
output/exploit.py
8.3 Generation Entry Points
┌──────────────────────────────────────────┐
│ PoCSmith CLI │
└───────────────────┬──────────────────────┘
┌──────────────┼──────────────┐
▼ ▼ ▼
┌──────────┐ ┌────────────┐ ┌──────────────┐
│ cve │ │ generate │ │ shellcode │
│ CVE ID │ │ free-text │ │ platform + │
│ → NVD │ │ --vuln │ │ payload type │
│ │ │ --target │ │ --lhost/port │
│ │ │ --details │ │ │
└─────┬────┘ └─────┬──────┘ └──────┬───────┘
└──────────────┼─────────────────┘
▼
fine-tuned model → formatter → output/
helpers: list-platforms · list-payloads · disclaimer
8.4 QLoRA Training Setup
codellama/CodeLlama-7b-hf (~13 GB fp16)
│
▼ BitsAndBytes 4-bit
┌──────────────────────────────┐
│ 4-bit NF4 base (~4 GB) │ double-quant · bf16 compute
│ (frozen) │
└──────────────┬───────────────┘
│ + LoRA adapters (trainable)
▼
┌──────────────────────────────┐
│ LoRA: r=16, alpha=32 │ target: q_proj, v_proj
│ dropout=0.05, bias=none │ trainable: 8,388,608 (0.12%)
└──────────────┬───────────────┘
▼
┌──────────────────────────────────────────────────────┐
│ TRAIN (SFTConfig / trl) │
│ batch 1 × grad-accum 4 · lr 2e-4 · 3 epochs │
│ paged_adamw_8bit · bf16 · seq 1024 │
│ gradient checkpointing · packing off │
│ │
│ RTX 4050 6GB → 5.9/6.0 GB (96%) · ~73°C · no OOM │
│ 885 steps · ~12s/step · 3h17min │
└──────────────┬───────────────────────────────────────┘
▼
models/pocsmith-v1/adapter_model.safetensors (33 MB)
8.5 Training Learning Curve
Token
Accuracy
78.4% ┤ ● ● ● ← epoch 3 (loss 0.84)
78.2% ┤ ● epoch 2 (loss 0.85)
78.0% ┤ ● epoch 1 (loss 0.89)
75.4% ┤ ● epoch 0.34 (loss 1.03)
72.6% ┤ ● start (loss 1.20)
└─┬─────────┬───────────┬─────────┬──────▶
0 0.34 1 2 3 epochs
Most of the +5.8pt gain lands by epoch 1, then plateaus.
Loss: 1.20 → 0.84 (-30%). Eval loss: 0.926 (stable).
Dataset: 1,472 samples (407 CVE-exploit + 1,065 shellcode).
8.6 Dataset Composition
1,472 samples total
┌────────────────────────────────────────────────────────┐
│ Shellcode examples 1,065 (72%) │
│ ████████████████████████████████████████████ │
├────────────────────────────────────────────────────────┤
│ CVE → exploit pairs 407 (28%) │
│ ████████████████ │
└────────────────────────────────────────────────────────┘
Split: train 1,177 (80%) · val 147 (10%) · test 148 (10%)
Sources: Exploit-DB · CVE database · Metasploit
→ capability follows composition: strongest at shellcode.
REGAAN R