lablup/gemma-2-2b-it-xaas-qa
XaaS Gemma 2 2B — Stage 2: QA Fine-Tuning
Stage 2 of 4 in the XaaS fine-tuning pipeline for Korean international trade.
Fine-tuned from the CPT-adapted model (lablup/gemma-2-2b-it-xaas-cpt) on 21,399 Korean trade QA pairs covering official 무역영어 1급 exam questions, trade terminology definitions, and lecture-derived QA. This model can answer questions about HS codes, Incoterms, customs law, letters of credit, and Korean trade regulations.
Pipeline Position
google/gemma-2-2b-it
↓
lablup/gemma-2-2b-it-xaas-cpt
↓ [this model]
lablup/gemma-2-2b-it-xaas-qa ← you are here
↓
lablup/gemma-2-2b-it-xaas-kie (KIE from B2B emails)
lablup/gemma-2-2b-it-xaas-sum-tag (email summarization + tagging)Training Details
Training Data
**lablup/tariff_trade_domain.synthetic_trade_qa_kr** — 21,399 Korean trade QA pairs:
How to Use
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "lablup/gemma-2-2b-it-xaas-qa"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
def ask(question: str, context: str = "") -> str:
content = f"Context: {context}\n\nQuestion: {question}" if context else question
messages = [{"role": "user", "content": content}]
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=512, do_sample=False)
return tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
# Trade terminology
print(ask("Incoterms FOB 조건에서 위험 이전 시점은 언제인가요?"))
# Exam-style MCQ
print(ask(
"다음 중 신용장(L/C) 거래에서 개설은행의 의무로 옳은 것은?",
context="1. 수익자가 제출한 서류가 신용장 조건에 일치하면 대금을 지급할 의무가 있다. "
"2. 수익자의 선적 여부와 관계없이 대금을 지급해야 한다. ..."
))Use as instruction fine-tuning format:
def format_prompt(context: str, question: str) -> str:
return f"Context: {context}\n\nQuestion: {question}\n\nAnswer:"Evaluation
Trained on the train split of lablup/tariff_trade_domain.synthetic_trade_qa_kr. No held-out test set was used during training. Use train_test_split() on the dataset for evaluation.
Downstream Models
Limitations
- QA pairs are LLM-generated (
term_qa,transcript_qa) or from historical exams (exam_mcq); answers may not reflect current regulatory changes - Knowledge cutoff reflects
google/gemma-2-2b-itbase + training data generation date (~2024) - Model has not been evaluated on external Korean trade benchmarks
License
Built on Google Gemma 2 and subject to the Gemma Terms of Use.
