ORPO Qwen3-8B Laws Detective (1 Epoch)

Model Description

Laws Detective(法規偵探)是針對台灣金融法規裁罰案件進行微調的語言模型,能夠根據使用者描述的金融情境,判斷是否涉及違法行為,並列出可能觸犯的法條及原因。

本模型基於 Qwen/Qwen3-8B 使用 ORPO(Odds Ratio Preference Optimization) 方法進行 1 Epoch 微調。

Training Details

Item Detail
Base Model Qwen/Qwen3-8B
Fine-tuning Method ORPO (Odds Ratio Preference Optimization)
Epochs 1
Training Data 台灣金融監督管理委員會裁罰案件(含法條引用及觸法原因)
Training Date 2025-12-31
Parameters 8B
Precision bfloat16
Max Sequence Length 262,144 tokens

Evaluation Results

以下為四維度評估結果(測試集 50-100 筆):

Dimension Metric Score
Score 1 — 違法判斷 Accuracy 100.00%
F1 Score 100.00%
Score 2 — 條文匹配 Avg F1 (Regex) 31.74%
Score 3 — 法條引用正確性 GPT-5.1 Avg (0-100) 36.72
Score 4 — 觸法原因正確性 GPT-5.1 Avg (0-100) 55.20

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-8b-laws-detective-1epoch"
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-8b-1epoch,
  title={Laws Detective: ORPO Fine-tuned Qwen3 for Taiwan Financial Law},
  author={eLAND Research},
  year={2026},
  url={https://huggingface.co/eLAND-Research/orpo-qwen3-8b-laws-detective-1epoch}
}
Downloads last month
4
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for eLAND-Research/orpo-qwen3-8b-laws-detective-1epoch

Finetuned
Qwen/Qwen3-8B
Finetuned
(1475)
this model