traffic-legal-lm/round2-gpt4o-baseline-lora

Model

Round 2 LoRA — GPT-4o 資料集 (baseline)

0

3 commits

1 linked in READMEs

updated Jun 11, 2026

See the code

README

Round 2 LoRA — GPT-4o 資料集 (baseline)

第二輪 LoRA 微調的對照組,使用教學組以 GPT-4o 抽取的 traffic_law_mar_gpt4o_train/val 資料集(2026 年 3 月版),對 yentinglin/Llama-3-Taiwan-8B-Instruct-rc2 進行微調。輸出為較長的 JSON 格式,適用法條範圍較廣(未經過濾)、核心爭議為 自由生成的句子(無封閉標籤)。

訓練設定

  • Base model: yentinglin/Llama-3-Taiwan-8B-Instruct-rc2
  • Dataset: traffic_law_mar_gpt4o_train / traffic_law_mar_gpt4o_val
  • Method: LoRA, lora_target=all, rank=16, alpha=32, dropout=0.05
  • Batch size: per_device=2, grad_accum=4(有效 batch=16)
  • Epochs: 2, lr=2e-4 (cosine, warmup 10%), bf16, gradient checkpointing
  • Early stopping: 依 eval_loss(eval_steps=100)

訓練結果

  • train_loss: 0.103, eval_loss: 0.0535

評估結果(18 筆共享 test set,與 round2-sonnet46-lora 對照)

指標數值
責任類型 accuracy1.0
適用法條 F10.701 (precision 0.753 / recall 0.694)

核心爭議為自由生成句子,無封閉 ground truth,因此不計算 F1。 詳細逐案分析見 repo 內 report.md 第八章與 eval/eval_summary.json。

使用方式

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model_id = "yentinglin/Llama-3-Taiwan-8B-Instruct-rc2"
adapter_id = "traffic-legal-lm/round2-gpt4o-baseline-lora"

tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(base_model_id, torch_dtype="bfloat16", device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)

更完整的處理流程、資料集與評估說明請見專案 repo: Traffic_Legal_LM

conversational
legal-nlp
llama-factory
lora
peft
safetensors
text-generation
traffic-law
zh-tw

traffic-legal-lm/round2-gpt4o-baseline-lora

Model

Round 2 LoRA — GPT-4o 資料集 (baseline)

0

3 commits

1 linked in READMEs

updated Jun 11, 2026

See the code

README

Round 2 LoRA — GPT-4o 資料集 (baseline)

第二輪 LoRA 微調的對照組,使用教學組以 GPT-4o 抽取的 traffic_law_mar_gpt4o_train/val 資料集(2026 年 3 月版),對 yentinglin/Llama-3-Taiwan-8B-Instruct-rc2 進行微調。輸出為較長的 JSON 格式,適用法條範圍較廣(未經過濾)、核心爭議為 自由生成的句子(無封閉標籤)。

訓練設定

  • Base model: yentinglin/Llama-3-Taiwan-8B-Instruct-rc2
  • Dataset: traffic_law_mar_gpt4o_train / traffic_law_mar_gpt4o_val
  • Method: LoRA, lora_target=all, rank=16, alpha=32, dropout=0.05
  • Batch size: per_device=2, grad_accum=4(有效 batch=16)
  • Epochs: 2, lr=2e-4 (cosine, warmup 10%), bf16, gradient checkpointing
  • Early stopping: 依 eval_loss(eval_steps=100)

訓練結果

  • train_loss: 0.103, eval_loss: 0.0535

評估結果(18 筆共享 test set,與 round2-sonnet46-lora 對照)

指標數值
責任類型 accuracy1.0
適用法條 F10.701 (precision 0.753 / recall 0.694)

核心爭議為自由生成句子,無封閉 ground truth,因此不計算 F1。 詳細逐案分析見 repo 內 report.md 第八章與 eval/eval_summary.json。

使用方式

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model_id = "yentinglin/Llama-3-Taiwan-8B-Instruct-rc2"
adapter_id = "traffic-legal-lm/round2-gpt4o-baseline-lora"

tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(base_model_id, torch_dtype="bfloat16", device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)

更完整的處理流程、資料集與評估說明請見專案 repo: Traffic_Legal_LM

conversational
legal-nlp
llama-factory
lora
peft
safetensors
text-generation
traffic-law
zh-tw