Llama3.1-Typhoon2-8B Thai Land Tax Legal RAG

Fine-tuned from scb10x/llama-3.1-typhoon2-8b-instruct for Thai statutory question answering on Land and Buildings Tax law using curriculum-based training (C4: Explicit→Implicit) with LoRA adapters (r=128, α=128).

Base Model: scb10x/llama-3.1-typhoon2-8b-instruct

Quick Start

from transformers import AutoModelForCausalLM, AutoTokenizer

# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
    "monoboard/llama3.1-typhoon2-8b-thai-land-tax-legal-rag",
    torch_dtype="auto",
    device_map="auto"
)

tokenizer = AutoTokenizer.from_pretrained(
    "monoboard/llama3.1-typhoon2-8b-thai-land-tax-legal-rag"
)

# Inference example
question = "พระราชบัญญัติที่กล่าวถึงในข้อความนี้มีชื่อว่าอะไร?"
contexts = [
    "[ชื่อกฎหมาย:] พระราชบัญญัติภาษีที่ดินและสิ่งปลูกสร้าง พ.ศ. 2562 มาตรา 1\n[ข้อความกฎหมาย:] พระราชบัญญัตินี้เรียกว่า \"พระราชบัญญัติภาษีที่ดินและสิ่งปลูกสร้าง พ.ศ. 2562\""
]

prompt = f"""คำถาม: {question}

บริบทที่เกี่ยวข้อง:
{chr(10).join(contexts)}

กรุณาตอบคำถามโดยอ้างอิงจากบริบทที่ให้มา ตอบตามรูปแบบ 4 ส่วน:
1. Reference Law Section
2. Reasoning  
3. Step-by-Step Application
4. Answer

คำตอบ:"""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
    **inputs,
    max_new_tokens=512,
    temperature=0.7,
    do_sample=True
)
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)

# Extract only the answer part (after the prompt)
answer = answer[len(tokenizer.decode(inputs.input_ids[0], skip_special_tokens=True)):]
print(answer)

Expected Output

**Reference Law Section:**
- พระราชบัญญัติภาษีที่ดินและสิ่งปลูกสร้าง พ.ศ. 2562 มาตรา 1

**Reasoning:**
มาตรา 1 ระบุชื่อเรียกของพระราชบัญญัติอย่างชัดเจนว่า "พระราชบัญญัตินี้เรียกว่า 'พระราชบัญญัติภาษีที่ดินและสิ่งปลูกสร้าง พ.ศ. 2562'" 

**Step-by-Step Application:**
1. คำถามถามเกี่ยวกับชื่อของพระราชบัญญัติ
2. มาตรา 1 เป็นมาตราที่กำหนดชื่อของกฎหมาย
3. สามารถตอบได้โดยตรงจากข้อความในมาตรา 1

**Answer:**
พระราชบัญญัติที่กล่าวถึงในข้อความนี้มีชื่อว่า **"พระราชบัญญัติภาษีที่ดินและสิ่งปลูกสร้าง พ.ศ. 2562"**
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