File size: 4,031 Bytes
b08b8e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d3317b4
 
 
 
 
 
 
 
 
 
96f74d8
 
d3317b4
96f74d8
 
 
 
 
 
 
 
 
d3317b4
395c6cf
d3317b4
96f74d8
d3317b4
96f74d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d3317b4
395c6cf
 
d3317b4
 
96f74d8
d3317b4
96f74d8
 
 
 
 
 
d3317b4
 
 
 
 
 
96f74d8
 
 
d3317b4
 
395c6cf
d3317b4
 
 
 
96f74d8
 
 
d3317b4
 
 
 
 
96f74d8
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
language:
- ko
license: apache-2.0
base_model: unsloth/Llama-3.2-3B-Instruct
tags:
- llama
- lora
- korean
- game-npc
- maplestory
- big-five
- unsloth
pipeline_tag: text-generation
---

# 🍁 maple-npc-llama3.2-3B-lora

**λ©”μ΄ν”ŒμŠ€ν† λ¦¬ NPC λŒ€ν™” νŠΉν™” LoRA νŒŒμΈνŠœλ‹ λͺ¨λΈ**

> Llama 3.2 3B Instruct 기반 | Unsloth LoRA | ν•œκ΅­μ–΄ κ²Œμž„ NPC νŠΉν™”

---

## πŸ“Œ λͺ¨λΈ κ°œμš”

λ©”μ΄ν”ŒμŠ€ν† λ¦¬ 세계관에 νŠΉν™”λœ NPC λŒ€ν™” 생성 λͺ¨λΈμž…λ‹ˆλ‹€.  
**Big Five 성격 λͺ¨λΈ**을 ν”„λ‘¬ν”„νŠΈλ‘œ μ œμ–΄ν•˜μ—¬ NPC별 κ³ μœ ν•œ λ§νˆ¬μ™€ 성격을 κ΅¬ν˜„ν•©λ‹ˆλ‹€.

| ν•­λͺ© | λ‚΄μš© |
|------|------|
| 베이슀 λͺ¨λΈ | `unsloth/Llama-3.2-3B-Instruct` |
| ν•™μŠ΅ 방법 | LoRA (r=16) |
| ν•™μŠ΅ 데이터 | λ©”μ΄ν”ŒμŠ€ν† λ¦¬ NPC λŒ€ν™” 134μƒ˜ν”Œ |
| 초기 Loss | 3.25 |
| μ΅œμ’… Loss | 2.41 |
| ν•™μŠ΅ μ‹œκ°„ | 33초 (A100, Unsloth 2x) |
| ν•™μŠ΅ νŒŒλΌλ―Έν„° | 0.57% (18M / 3.2B) |

---

## πŸ“Š 베이슀 λͺ¨λΈ vs νŒŒμΈνŠœλ‹ 비ꡐ

### Q1. ν—€λ„€μ‹œμŠ€ λ§ˆμ„ μ‹ κ΄€μ—κ²Œ μΈμ‚¬ν•΄μ€˜

**❌ 베이슀 Llama 3.2**
```
Hello! I'm a priestess of Henesys.
How can I help you today?
```

**βœ… maple-npc (νŒŒμΈνŠœλ‹ ν›„)**
```
μ–΄μ„œ μ˜€μ„Έμš”, λͺ¨ν—˜κ°€λ‹˜.
μ €λŠ” ν—€λ„€μ‹œμŠ€ 신전을 μ§€ν‚€λŠ” μ‹ κ΄€μž…λ‹ˆλ‹€.
μ—˜λ‚˜μŠ€ μ—¬μ‹ μ˜ κ°€ν˜Έκ°€ ν•¨κ»˜ν•˜μ‹œκΈΈ λ°”λžλ‹ˆλ‹€.
```

---

### Q2. 검은 λ§ˆλ²•μ‚¬μ— λŒ€ν•΄ μ•Œκ³  μžˆμ–΄?

**❌ 베이슀 Llama 3.2**
```
The Black Mage is a powerful villain in MapleStory.
He was sealed away but has returned...
```

**βœ… maple-npc (νŒŒμΈνŠœλ‹ ν›„)**
```
...κ·Έ 이름은 ν•¨λΆ€λ‘œ μž…μ— λ‹΄μ§€ λ§ˆμ„Έμš”.
λ΄‰μΈλœ μ§€ 100년이 μ§€λ‚¬μ§€λ§Œ
아직도 κ·Έ μ–΄λ‘ μ˜ 기운이 λŒ€λ₯™ 곳곳에 λ‚¨μ•„μžˆμŠ΅λ‹ˆλ‹€.
```

---

### Q3. ꢁ수둜 μ „μ§ν•˜λ €λ©΄ μ–΄λ–»κ²Œ ν•΄μ•Ό ν•΄?

**❌ 베이슀 Llama 3.2**
```
To become an archer, visit the job advancement NPC
and meet the level requirements.
```

**βœ… maple-npc (νŒŒμΈνŠœλ‹ ν›„)**
```
ꢁ수의 길을 κ±·κ³  μ‹ΆμœΌμ‹ κ°€μš”?
레벨 10 이상이 λ˜μ…¨λ‹€λ©΄
ν—€λ„€μ‹œμŠ€ ν™œν„°μ—μ„œ 전직 μ˜μ‹μ„ 치λ₯Ό 수 μžˆμŠ΅λ‹ˆλ‹€.
ν™œκ³Ό 화살은 μ€€λΉ„λ˜μ…¨λ‚˜μš”, λͺ¨ν—˜κ°€λ‹˜?
```

---

### Q4. λ©”λ₯΄μ„Έλ°μŠ€ μ—¬μ™•λ‹˜μ€ μ–΄λ–€ 뢄이야?

**❌ 베이슀 Llama 3.2**
```
Mercedes is an elf queen character in MapleStory
with high agility and dual bowguns.
```

**βœ… maple-npc (νŒŒμΈνŠœλ‹ ν›„)**
```
λ©”λ₯΄μ„Έλ°μŠ€ μ—¬μ™•λ‹˜...
μ—˜ν”„μ‘±μ˜ μžλž‘μ΄μž λΉ›μ˜ μˆ˜ν˜Έμžμ΄μ‹­λ‹ˆλ‹€.
검은 λ§ˆλ²•μ‚¬μ™€μ˜ μ „μŸμ—μ„œ ν™€λ‘œ μ‹Έμš°μ‹œλ‹€
κΈ΄ μž μ— λ“œμ…¨μ§€λ§Œ, κ·Έ μš©λ§Ήν•¨μ€ 우리 λͺ¨λ‘μ˜ ν¬λ§μž…λ‹ˆλ‹€.
```

---

## βœ… 핡심 κ°œμ„  포인트

| ν•­λͺ© | 베이슀 λͺ¨λΈ | νŒŒμΈνŠœλ‹ ν›„ |
|------|------------|------------|
| μ–Έμ–΄ | μ˜μ–΄ 혼용 | μ™„μ „ ν•œκ΅­μ–΄ |
| 말투 | 정보 전달체 | NPC 캐릭터 말투 |
| 세계관 | μœ„ν‚€ μ„€λͺ… μˆ˜μ€€ | 세계관 λͺ°μž… 반영 |
| 감정 ν‘œν˜„ | μ—†μŒ | 캐릭터 감정 포함 |
| 고유λͺ…사 | λ²ˆμ—­ 였λ₯˜ λ‹€μˆ˜ | μ •ν™•ν•œ λ©”μ΄ν”Œ μš©μ–΄ |

---

## πŸš€ μ‚¬μš©λ²•
```python
from unsloth import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
    "devmeta/maple-npc-llama3.2-3B-lora",
    max_seq_length=512,
    load_in_4bit=True,
)
FastLanguageModel.for_inference(model)

prompt = """λ„ˆλŠ” λ©”μ΄ν”ŒμŠ€ν† λ¦¬ ν—€λ„€μ‹œμŠ€ λ§ˆμ„μ˜ μ‹ κ΄€ NPCμ•Ό.
μΉœν™”μ„±μ΄ λ†’κ³  λ”°λœ»ν•œ 성격이야.
μ‚¬μš©μž: μ•ˆλ…•ν•˜μ„Έμš”!
NPC:"""

inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=100,
                         temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

---

## πŸ”— κ΄€λ ¨ ν”„λ‘œμ νŠΈ

**MaplePersona** β€” Big Five μŠ¬λΌμ΄λ” 기반 NPC 성격 μ œμ–΄ μ›Ήμ•±
- Gemini Flash + RAG μ§€μ—­ μ»¨ν…μŠ€νŠΈ + Big Five μ‹€μ‹œκ°„ μ œμ–΄
- μŠ¬λΌμ΄λ” μ‘°μ •μœΌλ‘œ λƒ‰μ†Œμ /λ”°λœ»ν•œ NPC 인격 μ¦‰μ‹œ μ „ν™˜

---

## πŸ‘€ 개발자

**Taewan Kim** 
GitHub: [Taewan627](https://github.com/Taewan627)  
HuggingFace: [devmeta](https://huggingface.co/devmeta)