AI Basic Law Ministral-8B (台灣人工智慧基本法)
基於 Ministral-8B-Instruct-2410 微調的台灣「人工智慧基本法」問答模型。
Model Description
- Base Model: mistralai/Ministral-8B-Instruct-2410
- Fine-tuning Method: QLoRA (4-bit quantization + LoRA r=64)
- Language: Traditional Chinese (繁體中文)
- Domain: Taiwan AI Basic Law (人工智慧基本法), 20 articles
- Framework: Axolotl
- Publication Date: 民國115年(2026年)1月14日
Capabilities
- 精準引述人工智慧基本法全文 20 條
- 正確對應條號與內容(含 topic anchor 防錯位)
- 識別簡稱(「基本法」「AI基本法」→ 人工智慧基本法)
- 預設台灣法律語境,不與中國法律混淆
- 回答公布日期、主管機關、立法理由等相關問題
Usage
With Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "iamjry/ai-basic-law-ministral8b"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id, torch_dtype=torch.float16, device_map="auto"
)
system_prompt = "你是一位熟悉台灣人工智慧基本法的法律助理,請根據法條內容精確回答問題。"
question = "請列出人工智慧基本法第3條全文"
messages = [{"role": "user", "content": f"{system_prompt}\n\n{question}"}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=500, repetition_penalty=1.3, do_sample=False)
generated = outputs[0][inputs["input_ids"].shape[1]:]
print(tokenizer.decode(generated, skip_special_tokens=True))
With Ollama (GGUF)
See ai-basic-law-ministral8b-GGUF for quantized GGUF versions.
Training Details
- Epochs: 15
- LoRA Rank: 64, Alpha: 32
- Learning Rate: 1e-4, Cosine scheduler
- Optimizer: AdamW 8-bit
- Sequence Length: 2048 (with sample packing)
- Training Data: ~5000 entries (with oversampling for key facts)
- Monitoring: Weights & Biases
Training Data Composition
| Category | Description |
|---|---|
| Article Fulltext | Verbatim text of all 20 articles with topic anchors |
| Alias Recognition | 「基本法」「AI基本法」→ 人工智慧基本法 |
| Legislative Reasons | Background and rationale for each article |
| Taiwan Context | Anti-hallucination data to prevent confusion with Chinese laws |
| Publication Date | 民國115年(2026年)1月14日, 華總一義字第11500001671號令 |
Limitations
- Optimized specifically for Taiwan AI Basic Law; not a general legal assistant
- Some longer articles (e.g., Article 4, 5) may have minor variations from the exact original text
- Best results when using the system prompt:
你是一位熟悉台灣人工智慧基本法的法律助理,請根據法條內容精確回答問題。
License
CC-BY-4.0
- Downloads last month
- 6