Views
No views yet
gemma-2-2b-quiz-korean is a specialized lightweight language model fine-tuned from Google Gemma-2-2B. It is engineered specifically for source-grounded Multiple Choice Question (MCQ) generation directly from Korean blog posts, technical documentation, and long-form articles.<thought>) Reasoning:
Unlike standard single-pass generators, the model utilizes an internal autoregressive reasoning phase before producing the final JSON payload. It systematically plans the evidence sentence, target concept, unambiguous correct answer, and three same-category distractors.evidence quote from the source text, ensuring strict factual alignment and auditability.| Evaluation Metric | Base Gemma-2-2B (Prompted) | Gemma-2-2B Quiz Korean (Ours) | Improvement |
|---|---|---|---|
| Overall QuizScore | 0.9380 | 0.9850 / 1.000 | +5.0% |
| Groundedness (Factuality) | 0.940 | 1.000 (100%) | Zero Hallucination |
| Answer Uniqueness | 0.950 | 1.000 (100%) | Single Deterministic Answer |
| Distractor Plausibility | 0.920 | 1.000 | Semantic Category Match |
| Language Quality | 0.900 | 1.000 | Pure Korean Syntax |
| System Prompt Overhead | ~500 tokens | 0 tokens | Fully Embedded Behavior |
<thought> trace followed by a structured JSON payload:1{
2 "questions": [
3 {
4 "question": "Specific question grounded in the source text",
5 "options": [
6 "Option A (same semantic category)",
7 "Option B (same semantic category)",
8 "Option C (same semantic category)",
9 "Option D (same semantic category)"
10 ],
11 "answer_index": 2,
12 "explanation": "Clear educational explanation of why the answer is correct",
13 "evidence": "Verbatim excerpt from the article proving the answer"
14 }
15 ]
16}1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4MODEL_ID = "kez-lab/gemma-2-2b-quiz-korean"
5
6tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
7model = AutoModelForCausalLM.from_pretrained(
8 MODEL_ID,
9 torch_dtype=torch.bfloat16,
10 device_map="auto"
11)
12
13article = """
14Jetpack Compose에서 derivedStateOf를 사용하면 원본 상태의 잦은 변화 중에서
15우리가 관심 있는 특정 조건(firstVisibleItemIndex > 0)이 변경되는 순간에만
16다운스트림 Recomposition을 트리거하도록 캐싱 및 완충 역할을 합니다.
17"""
18
19messages = [
20 {
21 "role": "user",
22 "content": f"주어진 글만을 근거로 핵심 개념을 분석하고 4지선다 객관식 문제를 생성하라.\n\n[ARTICLE]\n{article}"
23 }
24]
25
26prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
27inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
28
29with torch.no_grad():
30 outputs = model.generate(
31 **inputs,
32 max_new_tokens=1024,
33 temperature=0.01,
34 repetition_penalty=1.1
35 )
36
37response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
38print(response).task / .tflite format for on-device execution using Google MediaPipe Tasks GenAI:1// Android SDK Usage
2val generator = LocalQuizGenerator.builder(context)
3 .fromHuggingFace("kez-lab/gemma-2-2b-quiz-korean")
4 .setMaxTokens(1024)
5 .setTemperature(0.01f)
6 .build()
7
8viewModelScope.launch {
9 val result = generator.generateQuiz(articleText)
10 result.onSuccess { quizzes ->
11 // Render verified quiz cards with evidence quotes
12 }
13}unsloth/gemma-2-2b-it, 2.6B parameters)q, k, v, o, gate, up, down)bfloat16