WF-SCSM-Swallow-Multi

Pretrained SCSM encoder for website-fingerprinting research.

  • Pretraining dataset: Swallow
  • Traffic setting: Multi
  • Framework: PyTorch
  • Paper: SCSM
  • Code: SJTU-dxw/WF-SCSM

Loading

Install the WF-SCSM runtime dependencies, then run:

import sys
import torch

from huggingface_hub import snapshot_download

model_directory = snapshot_download("2594306528-dxw/WF-SCSM-Swallow-Multi")
sys.path.insert(0, model_directory)

from processing_scsm import SCSMProcessor
from scsm_hub import HubSCSM

device = torch.device("cuda")
model = HubSCSM.from_pretrained(model_directory, map_location="cpu").to(device)
processor = SCSMProcessor.from_pretrained(model_directory)
model.eval()

from_pretrained reconstructs the architecture from config.json, loads model.safetensors, and places the model in evaluation mode.

Processing and ensemble inference

Processing parameters are supplied by the caller. For the five-view ensemble used in the paper:

import numpy as np
import torch

sample = dataset["train"][0]
inputs = processor(
    times=sample["times"],
    directions=sample["directions"],
    slot_times=np.linspace(0.005, 0.05, 5),
    time_interval_threshold=0.1,
    log_transform=True,
)

with torch.inference_mode():
    view_embeddings = model(
        inputs["matrix"].to(device),
        inputs["last_index"].to(device),
    )
    embedding = view_embeddings.mean(dim=0)

Use a one-element slot_times sequence for a single view, or pass any number of positive slot widths for a custom ensemble. The processor always returns matrix with shape [views, 1, 8, length] and last_index with shape [views]. Ensemble aggregation remains under caller control.

Intended use

This checkpoint is intended for research on website fingerprinting and traffic representation learning. Users are responsible for evaluating the model in their own threat model and deployment setting.

Citation

Please cite the SCSM paper when using this checkpoint. The final BibTeX entry should be copied from the paper or project repository.

Downloads last month
25
Safetensors
Model size
8.75M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Collection including 2594306528-dxw/WF-SCSM-Swallow-Multi

Paper for 2594306528-dxw/WF-SCSM-Swallow-Multi