bnbong/wegis-model
0
Wegis Phishing Detection Model
URL 문자 CNN + MobileBERT 멀티모달 피싱 사이트 판별 모델입니다. Wegis 브라우저 확장과 Wegis Server의 실시간 피싱 판별에 사용되며, 학습 파이프라인은 bnbong/Wegis_model에 공개되어 있습니다.
Model Architecture
URL과 페이지 본문 텍스트를 함께 읽는 이진 분류(피싱 = 1) 모델입니다.
- URL 분기 : 문자 단위 토크나이저(vocab 98, max 512) → Embedding(98×128) → Conv1d k=3/k=5 병렬(각 256필터, ReLU + 전역 max pool) → concat(512) → Linear(512→512)
- HTML 분기 : 본문 텍스트 추출 → MobileBERT(
google/mobilebert-uncased) → lasthiddenstate를 시퀀스 축 median 풀링 → (512) - 결합 헤드 : concat(1024) → Linear(1024→512) → GELU → Linear(512→1) → logits (추론 시 sigmoid로 확률 출력)
- 파라미터 25,645,057개. 손실은 BCEWithLogitsLoss.
세부 다이어그램과 논문 대비 구현 차이는 학습 저장소 README를 참고하세요.
Performance
Files
model.safetensors: 모델 가중치 statedict (약 103MB) — **배포 권장본.** [Wegismodel](https://github.com/bnbong/Wegismodel)의 모델 정의에 `strict=True`로 로드됨 (`tests/testpretrained_compat.py`로 검증).best_acc_model.pt: 학습 당시 체크포인트 원본 (model + optimizer + scheduler, 206MB). 사용 시torch.load(path, weights_only=True)["model"]로 모델 부분만 취하세요.
Usage
학습 저장소 CLI로 평가
git clone https://github.com/bnbong/Wegis_model && cd Wegis_model
uv sync
uv run wegis-model evaluate --checkpoint hf://bnbong/wegis-model --data data/valid.parquetPython
from wegis_model import QshingBertModel, load_state_dict, resolve_checkpoint
model = QshingBertModel(pretrained_html=False) # 체크포인트로 덮어쓸 것이므로 사전학습 다운로드 생략
load_state_dict(model, resolve_checkpoint("hf://bnbong/wegis-model"))
model.eval()패키지 없이 safetensors만으로 로드하는 경우 (모델 클래스는 wegis_model.model 참고):
from safetensors.torch import load_file
model.load_state_dict(load_file("model.safetensors"), strict=True)Training
- 학습 파이프라인 : https://github.com/bnbong/Wegis_model (MIT) — uv 기반 CLI(
train/evaluate/prepare-data), AdamW, early stopping, 층화 8:2 분할 - 데이터 스키마 :
url,html,label(1 = 피싱) — CSV / Parquet / JSONL / XLSX - 공개 데이터셋 로더 : Kaggle `guchiopara/look-before-you-leap` (Opara et al., 45,373건 균형 코퍼스)
Provenance
공개된 가중치는 동일 아키텍처의 초기 구현으로 학습되었으며, Wegis_model의 모델 정의와 완전히 호환됩니다(strict load 검증 포함). 해당 저장소는 아래 논문들을 기반으로 학습 파이프라인을 새로 구현한 것입니다.
Known Behaviors
- URL 임베딩의
padding_idx는 0이고 실제 PAD 토큰 id는 94입니다(학습된 가중치의 quirk — 그대로 유지해야 호환됨). 패딩 위치는 forward에서 attention mask 곱으로 0 처리됩니다. - HTML median 풀링은 attention mask를 참조하지 않아 패딩 위치 표현도 통계에 포함됩니다.
- URL 분기의 전역 max pooling에는 합성곱 bias로 인한 패딩 구간 상수 활성값이 유입될 수 있습니다.
References
모델 아키텍처와 학습 설계는 다음 논문에 기반합니다.
Ahn, J., Akhavan, D., Jung, W., Kang, K., Son, J. "Encoder-Based Multimodal Ensemble Learning for High Compatibility and Accuracy in Phishing Website Detection." In: Security and Privacy in Communication Networks (SecureComm 2024), LNICST vol. 629, pp. 347–365. Springer, 2025. https://doi.org/10.1007/978-3-031-94455-0_16
Opara, C., Chen, Y., Wei, B. "Look before you leap: Detecting phishing web pages by exploiting raw URL and HTML characteristics." Expert Systems with Applications 236 (2024) 121183. https://doi.org/10.1016/j.eswa.2023.121183 (Open Access, CC BY 4.0)
@inproceedings{ahn2025encoder,
author = {Ahn, Jemin and Akhavan, Dorian and Jung, Woohwan and Kang, Kyungtae and Son, Junggab},
title = {Encoder-Based Multimodal Ensemble Learning for High Compatibility and Accuracy in Phishing Website Detection},
booktitle = {Security and Privacy in Communication Networks (SecureComm 2024)},
series = {LNICST},
volume = {629},
pages = {347--365},
publisher = {Springer},
year = {2025},
doi = {10.1007/978-3-031-94455-0_16}
}
@article{opara2024look,
author = {Opara, Chidimma and Chen, Yingke and Wei, Bo},
title = {Look before you leap: Detecting phishing web pages by exploiting raw {URL} and {HTML} characteristics},
journal = {Expert Systems with Applications},
volume = {236},
pages = {121183},
year = {2024},
doi = {10.1016/j.eswa.2023.121183}
}License
- 가중치 : Apache License 2.0 (베이스 모델 MobileBERT와 동일)
- 학습 코드 : MIT License (Wegis_model)
Related Projects
- bnbong/Wegis — 브라우저 확장
- bnbong/Wegis_server — 추론 서버
- bnbong/Wegis_model — 학습 파이프라인
