🚀 sentence-transformers/paraphrase-MiniLM-L6-v2を使用したSetFit
このモデルは、SetFitを用いたテキスト分類モデルです。Sentence Transformer埋め込みモデルとして、sentence-transformers/paraphrase-MiniLM-L6-v2を使用しています。分類には、LogisticRegressionインスタンスが用いられています。
このモデルは、以下の効率的なフェデレーション学習手法を用いて学習されています。
- 対照学習を用いてSentence Transformerを微調整する。
- 微調整されたSentence Transformerから得られた特徴量を用いて、分類ヘッドを学習する。
📚 詳細ドキュメント
モデルの説明
モデルの出典
モデルのラベル
ラベル |
例 |
Medium |
- 'chmod 777 /tmp'
- 'nmap -p 22,80,443 192.168.1.1'
- "grep -r 'root' /etc"
|
Low |
- 'reboot'
- 'apt-get update'
- 'cd /home/user'
|
Critical |
- 'history -c'
- "echo 'export HISTFILE=/dev/null' >> ~/.bashrc"
- "ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''"
|
High |
- "echo 'export HISTFILE=/dev/null' >> ~/.bashrc"
- 'bash /tmp/malicious.sh'
- 'bash /tmp/exploit.sh'
|
評価
メトリクス
💻 使用例
基本的な使用法
まず、SetFitライブラリをインストールします。
pip install setfit
次に、このモデルをロードして推論を実行できます。
from setfit import SetFitModel
model = SetFitModel.from_pretrained("setfit_model_id")
preds = model("systemctl stop apache2")
🔧 技術詳細
学習セットのメトリクス
学習セット |
最小値 |
中央値 |
最大値 |
単語数 |
1 |
3.1356 |
11 |
ラベル |
学習サンプル数 |
Low |
42 |
Medium |
17 |
High |
40 |
Critical |
19 |
学習ハイパーパラメータ
- batch_size: (16, 16)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- body_learning_rate: (2e-05, 1e-05)
- head_learning_rate: 0.01
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.1
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: True
学習結果
エポック |
ステップ |
学習損失 |
検証損失 |
0.0016 |
1 |
0.4702 |
- |
0.0806 |
50 |
0.2501 |
- |
0.1613 |
100 |
0.1859 |
- |
0.2419 |
150 |
0.1318 |
- |
0.3226 |
200 |
0.1157 |
- |
0.4032 |
250 |
0.095 |
- |
0.4839 |
300 |
0.0902 |
- |
0.5645 |
350 |
0.0796 |
- |
0.6452 |
400 |
0.0663 |
- |
0.7258 |
450 |
0.0539 |
- |
0.8065 |
500 |
0.045 |
- |
0.8871 |
550 |
0.0378 |
- |
0.9677 |
600 |
0.0332 |
- |
1.0 |
620 |
- |
0.1862 |
フレームワークのバージョン
- Python: 3.13.2
- SetFit: 1.1.2
- Sentence Transformers: 4.0.2
- Transformers: 4.51.0
- PyTorch: 2.6.0
- Datasets: 3.5.0
- Tokenizers: 0.21.1
📄 ライセンス
BibTeX
@article{https://doi.org/10.48550/arxiv.2209.11055,
doi = {10.48550/ARXIV.2209.11055},
url = {https://arxiv.org/abs/2209.11055},
author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {Efficient Few-Shot Learning Without Prompts},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}