ORPO Qwen3-4B Laws Detective (3 Epochs)
Model Description
Laws Detective(法規偵探)是針對台灣金融法規裁罰案件進行微調的語言模型,能夠根據使用者描述的金融情境,判斷是否涉及違法行為,並列出可能觸犯的法條及原因。
本模型基於 Qwen/Qwen3-4B-Instruct-2507 使用 ORPO(Odds Ratio Preference Optimization) 方法進行 3 Epoch 微調。
Training Details
| Item | Detail |
|---|---|
| Base Model | Qwen/Qwen3-4B-Instruct-2507 |
| Fine-tuning Method | ORPO (Odds Ratio Preference Optimization) |
| Epochs | 3 |
| Training Data | 台灣金融監督管理委員會裁罰案件(含法條引用及觸法原因) |
| Training Date | 2026-01-28 |
| Parameters | 4B |
| Precision | bfloat16 |
| Max Sequence Length | 262,144 tokens |
Evaluation Results
以下為四維度評估結果(測試集 50-100 筆):
| Dimension | Metric | Score |
|---|---|---|
| Score 1 — 違法判斷 | Accuracy | 98.00% |
| F1 Score | 98.00% | |
| Score 2 — 條文匹配 | Avg F1 (Regex) | 50.35% |
| Score 3 — 法條引用正確性 | GPT-5.1 Avg (0-100) | 53.92 |
| Score 4 — 觸法原因正確性 | GPT-5.1 Avg (0-100) | 65.02 |
Score Definitions
- Score 1:模型是否能正確判斷情境有無違法(是/否分類,100 筆測試)
- Score 2:模型列出的法條與標準答案的匹配度(Regex-based F1,50 筆測試)
- Score 3:GPT-5.1 評估法條引用的正確性,0-100 分(50 筆測試)
- Score 4:GPT-5.1 評估觸法原因說明的正確性,0-100 分(50 筆測試)
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "eLAND-Research/orpo-qwen3-4b-laws-detective-3epochs"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
prompt = "依照下面陳述,列出可能觸犯的法條及原因:\n某銀行行員利用職務之便,冒用客戶名義辦理開戶及貸款,挪用貸款資金。"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(response)
Two-Stage Pipeline (Recommended)
建議搭配 Qwen3-4B-Instruct 作為第一階段分類器,判斷是否涉及違法後,再由本模型進行詳細法條分析:
Stage 1: Qwen3-4B-Instruct → 判斷是否違法(是/否)
Stage 2: Laws Detective Model → 列出觸犯法條及原因(僅在判定違法時)
Intended Use
- 台灣金融法規裁罰案件分析
- 金融合規教育訓練輔助
- 法規研究參考
Limitations
- 僅針對台灣金融法規訓練,不適用於其他法域
- 模型輸出僅供參考,不構成法律意見
- 法條引用可能存在條號細節錯誤,使用前應人工覆核
Citation
@misc{laws-detective-4b-3epoch,
title={Laws Detective: ORPO Fine-tuned Qwen3 for Taiwan Financial Law},
author={eLAND Research},
year={2026},
url={https://huggingface.co/eLAND-Research/orpo-qwen3-4b-laws-detective-3epochs}
}
- Downloads last month
- 3
Model tree for eLAND-Research/orpo-qwen3-4b-laws-detective-3epochs
Base model
Qwen/Qwen3-4B-Instruct-2507