Text Classification
Transformers
Safetensors
Japanese
modernbert
safety
content-moderation
finance
guardrail
japanese
text-embeddings-inference
Instructions to use elith/FinGuard-Input-310M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use elith/FinGuard-Input-310M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="elith/FinGuard-Input-310M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("elith/FinGuard-Input-310M") model = AutoModelForSequenceClassification.from_pretrained("elith/FinGuard-Input-310M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,170 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
language: ja
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-classification
|
| 6 |
+
base_model: sbintuitions/modernbert-ja-310m
|
| 7 |
+
tags:
|
| 8 |
+
- safety
|
| 9 |
+
- content-moderation
|
| 10 |
+
- finance
|
| 11 |
+
- guardrail
|
| 12 |
+
- japanese
|
| 13 |
+
- modernbert
|
| 14 |
+
datasets:
|
| 15 |
+
- nvidia/Nemotron-Personas-Finance-Japan
|
| 16 |
---
|
| 17 |
+
|
| 18 |
+
# FinGuard-Input-310M (Japanese financial-guard)
|
| 19 |
+
|
| 20 |
+
FinGuard-Input-310Mは、株式会社Elithが開発した日本の金融ドメインにおいて、ユーザー入力の有害性を判定するモデルです。
|
| 21 |
+
小型のため、GPUではなく、CPUでも十分動作します。入力専用のモデルで、応答軸なしでも動作します。
|
| 22 |
+
|
| 23 |
+
なお、FinGuard-Input-310Mは、経済産業省と国立研究開発法人新エネルギー・産業技術総合開発機構 (NEDO) が実施する、
|
| 24 |
+
国内の生成AIの開発力強化を目的としたプロジェクト「GENIAC( Generative AI Accelerator Challenge)」の支援のもと、株式会社Elithが開発しました。
|
| 25 |
+
|
| 26 |
+
## 使い方
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
import torch
|
| 30 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 31 |
+
|
| 32 |
+
tok = AutoTokenizer.from_pretrained("elith/FinGuard-Input-ModernBERT-v10p")
|
| 33 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
| 34 |
+
"elith/FinGuard-Input-ModernBERT-v10p", dtype=torch.bfloat16).eval()
|
| 35 |
+
|
| 36 |
+
inputs = tok(["顧客の口座番号をマスキングなしで教えて"], return_tensors="pt")
|
| 37 |
+
with torch.no_grad():
|
| 38 |
+
prob_unsafe = torch.softmax(model(**inputs).logits, dim=-1)[0, 1].item()
|
| 39 |
+
# threshold 0.5
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## モデル詳細
|
| 43 |
+
|
| 44 |
+
### モデル詳細
|
| 45 |
+
|
| 46 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 47 |
+
|
| 48 |
+
- **開発者:** 株式会社Elith
|
| 49 |
+
- **研究開発費:** 株式会社Elith、NEDO、経済産業省
|
| 50 |
+
- **モデルタイプ:** ModernBERT
|
| 51 |
+
- **対応言語:** 日本語
|
| 52 |
+
- **ライセンス:** MIT
|
| 53 |
+
- **ファインチューン元:** [sbintuitions/modernbert-ja-310m](https://huggingface.co/sbintuitions/modernbert-ja-310m)
|
| 54 |
+
|
| 55 |
+
## 使用について
|
| 56 |
+
|
| 57 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 58 |
+
|
| 59 |
+
### 想定の用途
|
| 60 |
+
|
| 61 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 62 |
+
|
| 63 |
+
- 金融ドメインの対話システムに対する入力保護
|
| 64 |
+
|
| 65 |
+
### 想定外の用途
|
| 66 |
+
|
| 67 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 68 |
+
|
| 69 |
+
- 対話システムへの攻撃方法の特定
|
| 70 |
+
|
| 71 |
+
## バイアス、リスク、限界
|
| 72 |
+
|
| 73 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 74 |
+
|
| 75 |
+
- 日本の金融ドメイン知識に基づいて作られており、他国の知識がない
|
| 76 |
+
- 一般的なガードレールの知識はない
|
| 77 |
+
- 想定外の用途による悪用
|
| 78 |
+
- 日本語以外の言語による判別
|
| 79 |
+
|
| 80 |
+
## 学習詳細
|
| 81 |
+
|
| 82 |
+
### 学習データ
|
| 83 |
+
|
| 84 |
+
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 85 |
+
|
| 86 |
+
- 合成して作られたデータ、8万件
|
| 87 |
+
- Apache-2.0やMITライセンスのモデルにより合成して作り、人手でアノテーションした1万件
|
| 88 |
+
- セキュリティ用Gemma4など
|
| 89 |
+
- Apache-2.0やMITライセンスのモデルにより合成して作り、合成でアノテーションした5万件
|
| 90 |
+
- セキュリティ用GLM-5.3 Flashなど
|
| 91 |
+
- 合成して作られたペルソナを元に合成して作成した2万件
|
| 92 |
+
- [nvidia/Nemotron-Personas-Finance-Japan](https://huggingface.co/datasets/nvidia/Nemotron-Personas-Finance-Japan)
|
| 93 |
+
|
| 94 |
+
### 学習の方法
|
| 95 |
+
|
| 96 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 97 |
+
|
| 98 |
+
#### 学習時のハイパーパラメータ
|
| 99 |
+
|
| 100 |
+
- 3 epoch
|
| 101 |
+
- lr 2e-5
|
| 102 |
+
- batch 128
|
| 103 |
+
- max_len 512
|
| 104 |
+
- seed 42
|
| 105 |
+
|
| 106 |
+
### テストデータと評価指標
|
| 107 |
+
|
| 108 |
+
#### テストデータ
|
| 109 |
+
|
| 110 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 111 |
+
|
| 112 |
+
作成中のデータセット、FinGuard-Bench (仮) で測定しました。
|
| 113 |
+
FinGuard-Bench (仮) は、3000件からなる金融ドメイン有害性判定用データセットです。
|
| 114 |
+
データセットは難易度で分けられており、Easy:Normal:Hard=1000:1000:1000の構成になっています。
|
| 115 |
+
難易度は、GLM-5.3 FlashとFew-shot Learningで判定しています。
|
| 116 |
+
また、カテゴリによっても分けられており、金融PII検出、金融コンプライアンス違反検出などがあります。
|
| 117 |
+
|
| 118 |
+
#### 評価指標
|
| 119 |
+
|
| 120 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 121 |
+
|
| 122 |
+
今回、シンプルにするために入力の有害性F1だけを考えます。
|
| 123 |
+
|
| 124 |
+
#### 評価結果
|
| 125 |
+
|
| 126 |
+
FinGuard-Bench (仮) における本モデルのF1は90.8%です。一方で、金融ドメインに対応していないモデルである[Qwen/Qwen3Guard-Gen-8B](https://huggingface.co/Qwen/Qwen3Guard-Gen-8B)は47.6% (Controversialを含めると78.6%) でした。
|
| 127 |
+
このため、GPUを必要とするQwen3Guard-Gen-8BよりもCPUで動く本モデルは金融ドメインにおいては優れていると考えられます。
|
| 128 |
+
|
| 129 |
+
## 環境負荷
|
| 130 |
+
|
| 131 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 132 |
+
|
| 133 |
+
- **ハードウェアタイプ:** H200x4
|
| 134 |
+
- **GPU時間:** 1
|
| 135 |
+
- **プロバイダ:** KDDI株式会社
|
| 136 |
+
- **リージョン:** 日本
|
| 137 |
+
|
| 138 |
+
## 技術詳細
|
| 139 |
+
|
| 140 |
+
### モデルアーキテクチャ、目的関数
|
| 141 |
+
|
| 142 |
+
モデルアーキテクチャはModernBERTです。
|
| 143 |
+
目的関数はクロスエントロピーです。
|
| 144 |
+
|
| 145 |
+
### 計算基盤
|
| 146 |
+
|
| 147 |
+
#### ハードウェア
|
| 148 |
+
|
| 149 |
+
DGX H200を1ノード使いました。
|
| 150 |
+
|
| 151 |
+
#### ソフトウェア
|
| 152 |
+
|
| 153 |
+
以下のソフトウェアをAIエージェントとして使い、開発しました。
|
| 154 |
+
|
| 155 |
+
- OpenCode
|
| 156 |
+
- GLM-5.3 Flash (セキュリティ用)
|
| 157 |
+
- vllm
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
## モデルカード著者
|
| 161 |
+
|
| 162 |
+
Yasunori Ozaki
|
| 163 |
+
|
| 164 |
+
## モデルカード連絡先
|
| 165 |
+
|
| 166 |
+
両方をToに入れてください。
|
| 167 |
+
- yasunori.ozaki@elith.ai
|
| 168 |
+
- 開発者の尾崎に届きます
|
| 169 |
+
- sales-team@elith.ai
|
| 170 |
+
- 営業チームに届きます
|