Gemma3 ExamGen is a fine-tuned variant of Gemma-3 designed to generate Korean university exam questions in a strict XML structure.
It produces exactly five problems while enforcing the format and concept diversity.
1다음의 규칙을 준수하여 대학교 시험 문제 5개를 XML 형식으로 생성하세요.
2
3**응답 형식 (반드시 준수):**
4<problems>
5 <problem>
6 <number>1</number>
7 <type>객관식</type>
8 <content>문제내용</content>
9 <description>풀이과정</description>
10 <answer>답</answer>
11 </problem>
12 <problem>
13 <number>2</number>
14 <type>객관식</type>
15 <content>문제내용</content>
16 <description>풀이과정</description>
17 <answer>답</answer>
18 </problem>
19
20 <problem>
21 <number>3</number>
22 <type>단답형</type>
23 <content>문제내용</content>
24 <description>풀이과정</description>
25 <answer>답</answer>
26 </problem>
27 <problem>
28 <number>4</number>
29 <type>단답형</type>
30 <content>문제내용</content>
31 <description>풀이과정</description>
32 <answer>답</answer>
33 </problem>
34
35 <problem>
36 <number>5</number>
37 <type>주관식</type>
38 <content>문제내용</content>
39 <answer>답</answer>
40 </problem>
41</problems>
42
43**절대 규칙 (위반 시 응답 무효):**
441. XML 태그 구조만 출력합니다. 다른 텍스트, 설명, 주석은 포함하지 않습니다.
452. 모든 내용은 CDATA 섹션 없이 일반 텍스트로 작성합니다.
463. 특수문자는 XML 엔티티로 작성합니다. (<, >, &, ", ')
47
48**문제 생성 규칙:**
49- 총 5문제를 생성하며, 문제 유형은 다음 비율을 반드시 지킵니다: 객관식 2문제, 단답형 2문제, 주관식 1문제.
50- 각 문제의 <type>은 위 응답 형식에서 이미 지정된 값을 그대로 사용합니다.
51- 객관식 문제는 보기 기호를 ①, ②, ③, ④, ⑤ 형식으로 작성합니다.
52- 모든 문제는 서로 다른 주요 개념을 사용해야 하며, 동일 개념이나 동일 인물, 동일 사건을 다른 문제에서 재사용하지 않습니다.
53- 풀이과정과 답을 구체적으로 작성합니다.
54- 문제 내용에 따옴표, 수식, 특수문자 등을 자유롭게 사용할 수 있습니다.
55- 문제는 난이도와 표현 방식을 다양하게 구성합니다.
56
57**중요한 키워드:**
58{KEYS}
59**중요한 문장들:**
60{PHRS}
1from transformers import AutoProcessor, AutoModelForImageTextToText
2import torch
3
4model_id = "yongjin-KIM/gemma3-examgen"
5model = AutoModelForImageTextToText.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
6processor = AutoProcessor.from_pretrained(model_id)
7tok = processor.tokenizer
8
9prompt = """<Insert the Korean prompt template here and replace {KEYS} and {PHRS}>"""
10
11inputs = tok(prompt, return_tensors="pt").to(model.device)
12outputs = model.generate(
13 **inputs,
14 max_new_tokens=2000,
15 temperature=0.7,
16 top_p=0.9,
17 do_sample=True,
18)
19print(tok.decode(outputs[0], skip_special_tokens=True))