본문으로 건너뛰기

© 2026 Molayo

HuggingFace헤드라인2026. 05. 09. 07:55

CyberSecQwen-4B: Why Defensive Cyber Needs Small, Specialized, Locally-Runnable

요약

본 기사는 방어 사이버 보안(Defensive Cyber) 분야에서 대규모 범용 모델(Frontier models)의 한계점을 지적하며, 소형화되고 전문화된 온디바이스 모델의 필요성을 강조합니다. 민감한 내부 데이터 유출 위험, 높은 API 호출 비용, 그리고 에어갭 환경에서의 배포 제약 등은 방어 작업에 치명적입니다. 이에 대응하여 CyberSecQwen-4B는 40억 개의 파라미터로 CWE 분류 및 CVE 매핑 같은 특정 사이버 위협 인텔리전스(CTI) 작업에서 기존의 대형 모델을 능가하는 성능과 뛰어난 배포 용이성을 입증했습니다.

핵심 포인트

  • 방어 보안 환경에서는 민감한 내부 데이터(로그, 취약점 보고서 등)를 외부 API에 전송할 수 없으므로, 로컬 구동 모델이 필수적이다.
  • 대형 범용 모델은 비용 문제와 배포 제약(에어갭 환경) 때문에 실질적인 방어 자동화 도구로 부적합하다.
  • CyberSecQwen-4B는 40억 파라미터 크기로, 적은 리소스로도 CWE 분류 및 CTI Q&A 같은 특정 사이버 보안 작업에서 대형 모델 대비 우수한 성능을 보여준다.
  • 이 모델은 단일 소비자 GPU(12GB)에서도 구동 가능하여 현장 배포성이 뛰어나며, AMD MI300X와 ROCm 스택을 활용해 효율적으로 훈련 및 평가되었다.

Frontier models are very good at very many things. They are also expensive to call, ship every prompt off to someone else's datacenter, and are explicitly trained to refuse the messy edge cases a real defender lives in incident write-ups, attacker-grade payloads found in your own logs, vulnerability disclosure drafts.

Defensive cybersecurity is not a place where any of those tradeoffs are acceptable.

**Sensitive evidence stays internal.**A SOC analyst triaging a leaked credential dump, a malware reverse-engineer dissecting a sample, a vulnerability researcher writing up a CVE — none of them should be pasting that content into a hosted API. The data itself can be the breach.**Per-call API cost compounds.**A mid-size SOC processes thousands of low-confidence alerts per day. Hosted-API costs for "explain this CVE" or "what CWE applies here" turn defensive automation into a budget question.Air-gapped and partially-connected environments are the rule, not the exceptionin critical infrastructure, healthcare, and government work. If your tooling can't run on a laptop or a single on-prem GPU, it doesn't ship there.**Adversaries are getting more automated.**Ransomware gangs use LLMs to draft phishing in 30 languages; bug-bounty automators chain agentic tools to fuzz, triage and exploit faster than humans can review. Defense at the same speed needs models defenders own and can run.

So: local matters. But "local" alone isn't enough.

A 70B generalist running locally on four GPUs is "local" but it isn't deployable. A 4B generalist running locally on a single consumer GPU is deployable but it doesn't beat the 8B specialist on the work you actually need it to do.

The bet behind CyberSecQwen-4B is that for narrow, well-evaluated cyber threat intelligence tasks — CWE classification, CVE-to-CWE mapping, structured CTI Q&A — a careful 4B fine-tune can match or beat an 8B specialist while fitting on a 12 GB consumer card.

We tested this against the strongest public baseline we could find: Cisco's Foundation-Sec-Instruct-8B, evaluated under their own published protocol on CTI-Bench.

Metric (CTI-Bench, n=5, temp 0.3)CyberSecQwen-4BFoundation-Sec-Instruct-8BΔ
CTI-MCQ (2,500 items)
0.5868 ± 0.0029
0.4996+8.7 pp
CTI-RCM (1,000 CVE→CWE items)
0.6664 ± 0.0023
0.6850−1.9 pp
Parameters4 B8 Bhalf the size

CyberSecQwen-4B 는 Foundation-Sec-Instruct-8B 의 CTI-RCM 정확도를 97.3 % 유지하면서, 파라미터 수의 절반에도 불구하고 CTI-MCQ 점수를 +8.7 포인트 초과했습니다. 방어자 (defender) 가 배포할 것을 선택해야 할 때 고려해야 할 유일한 숫자입니다.

아래 5 분 영상은 훈련 방법론, AMD MI300X 워크플로우, 벤치마크 결과를 더 시각적인 형식으로 설명합니다. 모든 내용을 자세히 읽으시려면, 이 포스트의 나머지 부분은 동일한 내용을 정확한 설정 (configs) 으로 다룹니다.

전체 파이프라인 — 훈련, 어댑터 병합, 평가 — 는 AMD Developer Cloud 를 통해 단일 AMD Instinct MI300X 192 GB 인스턴스를 통해 엔드 투 엔드 (end-to-end) 실행됩니다. 192 GB HBM3 와 ROCm 7 의 vLLM 스택의 조합은 양자화 트릭, 그래디언트 체크포인트링, 또는 모델을 장치에 나누는 것을 고려할 필요가 없음을 의미합니다. Full bf16, FlashAttention-2 forward+backward, 배치 크기 4, 시퀀스 길이 4096 — 모두 단일 GPU 에서 실행됩니다.

ComponentVersion
HardwareAMD Instinct MI300X 192 GB · gfx942
...
train.sh 의 레시피는 하드웨어 무관 (hardware-agnostic) 입니다. 다른 40 GB+ 데이터센터 GPU 에서 실행하려면 AMD 특정 환경 변수를 제거하고 (그것들은 그 밖에는 no-op) flash-attn 을 적절한 wheel 로 재설치합니다. 포터빌리티를 테스트하기 위해 우리는 다른 스택에서 sister model 을 훈련했습니다 — 더 자세한 내용은 아래에 있습니다.

두 corpus, 모두 Apache-2.0-clean 으로 배포:

2021 CVE → CWE 매핑은 MITRE / NVD 공개 기록에서 소스되었습니다. 중요하게, CTI-Bench 의 평가 세트와 모든 중복 (overlap) 은 훈련 에 제거 (deduplicated) 되었습니다, 따라서 위의 벤치마크 숫자는 정직한 out-of-distribution holdouts 이며 오염 (contamination) 이 아닙니다.합성 방어 분석가 Q&A는 제거된 CVE 설명에 기반합니다. 더 강력한 teacher 와 Apache-2.0 라이선스로 생성되어 재분배를 위한 라이선스가 있습니다.

베이스 모델은 Qwen3-4B-Instruct-2507입니다, 이는 훈련 시 가장 성능이 좋은 4B 클래스 IT 모델이었던 Apache-2.0 인스트럭션 튜닝된 4B 입니다. 우리는 의도적으로 IT 체크포인트 (체크포인트) 에 대해 fine-tune 합니다 — 그것은 IT pass 가 이미 확립한 terse-answer multiple-choice format priors 를 보존하며, IT-then-SFT collapse 는 이를 지울 것입니다.

여기서 표시할 가치가 있는 측정 가능한 효과가 있습니다:

ModelCTI-RCMCTI-MCQ
Qwen3-4B-Instruct-2507 (raw IT)0.5190.473
CyberSecQwen-4B (this fine-tune)
0.6664
0.5868

IT 기반 모델은 기본 학습된 기반 대비 MCQ 정확도를 현저히 낮춥니다 — Cisco 가 Foundation-Sec-Instruct vs Foundation-Sec 기반으로 보고한 것과 동일한 "instruction-tuning collapses MCQ" 패턴입니다. 우리의 fine-tune 은 두 벤치마크 모두에서 IT 시작점을 회복하고 초과하며, IT 가 약화시킨 format binding 을 복원하면서 도메인 lift 를 제공합니다.

LoRA r = 64
LoRA alpha = 64 # alpha/r = 1.0
LoRA dropout = 0.05
...

Qwen 에는 FlashAttention-2 가 켜져 있습니다. 이는 head dimension (128) 이 MI300X (gfx942) 의 shared-memory 예산에 잘 맞기 때문입니다. 이 설정에서 step time 은 ~7.85 s/step 정도로 수렴하며, Gemma-4-E2B 기반 모델의 동일한 레시피는 FA2 를 global-attention 레이어에서 사용할 수 없으며 (head_dim=512 가 LDS 예산을 초과함) sdpa 로 회귀하므로 약 1.6 배 빠릅니다.

결과가 레시피 주도인지 또는 서브스트레이트 특화인지 확인하기 위해, 우리는 정확히 동일한 훈련 corpus 와 hyperparameters 를 사용하며 base model 을 Gemma-4-E2B-it 으로만 교체한 sister 모델 — Gemma4Defense-2B — 을 훈련했습니다.

ModelCTI-RCM (5-trial mean ± std)CTI-MCQ
CyberSecQwen-4B (Qwen base)0.6664 ± 0.00230.5868 ± 0.0029
Gemma4Defense-2B (Gemma base)0.6754 ± 0.00350.6042 ± 0.0090

두 모델은 CTI-RCM 에서 0.9 포인트 이내로 수렴합니다. 레시피는 이동하며, IT checkpoint 을 어떻게 fine-tune 하는지, 어떤 family 인지에 따라 결정됩니다. CyberSecQwen-4B 는 Apache 2.0 로 Gemma 의 terms-of-use 가 문제일 때 올바른 선택이며, Gemma4Defense-2B 는 2B 가 4B 보다 deployment budget 에 더 편안하게 맞을 때 올바른 선택입니다.

AMD ROCm 프로젝트는 war-stories section 없이 출시되지 않습니다. 여기에는 우리 버전의 약간의 요약이 있습니다:

IssueFix
FA2 fails on Gemma-4 with head_dim=512
Falls back to sdpa for global-attention layers. Local-attention layers still use FA2. ~1.6× slower vs Qwen at the same recipe.
AITER kernels conflict with CyberPal-2.0-20B serving
Set VLLM_ROCM_USE_AITER=0 for that specific eval. AMD env var is a no-op outside ROCm so it stays in the recipe.
bitsandbytes is not officially supported on ROCm
We didn't need 4-/8-bit anyway — 192 GB is enough headroom. Use paged_adamw_8bit (bnb's optimizer-only path works).
vLLM ROCm + chat template for evaluation
Use TRITON_ATTN backend; pass chat_template.jinja from the merged model dir explicitly to avoid the IT base's template overriding.
HF-Spaces ZeroGPU quota for the demo
Anonymous visitors hit a 2 min/day per-IP cap. The demo Space (cybersecqwen-chat) uses HF OAuth client-side so each visitor's calls bill against their own quota (free 3.5 min/day, Pro 25 min/day).

Live demo (sign in with HF for free quota):
👉 https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/cybersecqwen-chat

Model:
👉 https://huggingface.co/lablab-ai-amd-developer-hackathon/CyberSecQwen-4B

Inference in three lines (any 12 GB+ GPU):

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "lablab-ai-amd-developer-hackathon/CyberSecQwen-4B"
...

For high-throughput serving, vLLM works out of the box on AMD MI300X via the official vllm/vllm-openai-rocm image. See the GitHub repo for the exact serving command and the pinned config.

CyberSecQwen-4B is built for security practitioners working on:

CWE classification— mapping vulnerability descriptions (CVEs, advisories) to MITRE CWE categories
CTI Q&A— answering structured questions about cybersecurity concepts, attacks, controls
Defensive triage assistance— supporting human analysts who triage CVEs, prioritize patches, document threat-actor behavior

It is explicitly not for: generating exploit code or weaponized PoCs, auto-executing security decisions without qualified human review, legal/medical/regulated-advice contexts, or general chat / code generation outside cybersecurity. The recipe was built for narrow utility, not breadth.

A few directions we want to extend, roughly in priority order:

A 1B variant을 위한 노트북 클래스 배포용 모델입니다. Qwen2.5-1.5B 또는 Llama-3.2-1B 를 기반으로 하여 동일한 레시피를 적용하고, 목표는 ≥0.55 CTI-RCM (4B 대비 6 pp 이내) 입니다.양자화 GGUF 릴리스(Q4_K_M, Q5_K_M) 를 통해 모델을 스마트폰/에지 박스에 실행할 수 있게 했습니다. Q4_K_M 기준 약 2.5 GB는 ARM 노트북 메모리 내에 잘 들어갑니다.연속 평가를 진행하여 새로운 CVE-to-CWE 매핑이 게시될 때마다 업데이트합니다. 2021 코호트는 의도적인 배포 용량 제한이었으며, 향후 버전들은 NVD의 성장을 추적할 것입니다.적대적 예제 내성. 전문가 모델은 가장 나쁜 경우만큼만 좋습니다. CVE-description-as-input 공격에 공통적으로 발생하는 프롬프트 주입 패턴에 대한 하드닝 패스를 게시하고 싶습니다.

그 중 하나라도 팀을 풀 수 있다면 GitHub 저장소에 이슈를 열어주세요 — 이것이 그들을 대기열 상위로 올리는 가장 빠른 방법입니다.

프론티어 모델 대화는 2 년 동안 규모에 관한 것이었습니다. 방위 사이버 대화는 실제로 필요한 곳에 맞는 것에 관한 것이 되어야 합니다. 8B 와 같은 성능을 4B 의 절반 크기로 달성하고, 연구원이 부담할 수 있는 카드에서 실행되며, 민감한 증거를 외부로 보내지 않는 전문가 모델 — 이것이 디자인 공간의 유용한 모서리이며, AMD MI300X + ROCm 7 + Hugging Face 의 훈련 스택이 이를 단일 훈련 실행으로 차지하게 만들었습니다.

데모를 시도하고, 모델 카드를 읽으며, 이슈를 제출하세요. 레시피가 우리가 아직 시도하지 않은 것으로 포팅된다면, 그것이 가장 흥미로운 다음 데이터 포인트입니다.

athena129 · AMD Developer Hackathon submission

AI 자동 생성 콘텐츠

본 콘텐츠는 Hugging Face Blog의 원문을 AI가 자동으로 요약·번역·분석한 것입니다. 원 저작권은 원저작자에게 있으며, 정확한 내용은 반드시 원문을 확인해 주세요.

원문 바로가기
2

댓글

0