File size: 10,137 Bytes
9698d94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b3f060b
9698d94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
---
base_model: HauhauCS/Qwen3.5-4B-Uncensored-HauhauCS-Aggressive
library_name: peft
license: mit
language:
  - ja
pipeline_tag: text-generation
tags:
  - roleplay
  - character
  - japanese
  - qwen
  - lora
  - gguf
  - uncensored
  - desktop-companion
metrics:
  - character-consistency
---

# Inaba Meguru LoRA (ๅ› ๅนกใ‚ใใ‚‹)

A lightweight Japanese roleplay LoRA for Qwen3.5-4B.

> ๐Ÿพ This model powers **[InabaPet](https://github.com/wallouo/InabaPet)** โ€” a desktop AI companion with chat, vision, voice, and head-pat interactions, running entirely on-device.

## Overview

This project aims to recreate **Inaba Meguru (ๅ› ๅนกใ‚ใใ‚‹)** from *Sabbat of the Witch* (ใ‚ตใƒŽใƒใ‚ฆใ‚ฃใƒƒใƒ) as faithfully as possible while remaining lightweight enough to run entirely on consumer hardware.

The original goal was simple:

> I wanted Meguru to live on my desktop.

Unlike general-purpose chat models, this LoRA focuses on character roleplay and is designed primarily for desktop companion applications and immersive conversations.

The model is trained on [HauhauCS/Qwen3.5-4B-Uncensored-HauhauCS-Aggressive](https://huggingface.co/HauhauCS/Qwen3.5-4B-Uncensored-HauhauCS-Aggressive). Although it is still a 4B model with some unavoidable limitations, it offers a significant improvement over my previous desktop companion model based on Qwen2.5 while remaining completely free to run locally without API costs.

## Quick Start

### Ollama (recommended)

```bash
# 1. Download meguru_q4_k_m.gguf + Modelfile from this repo's Files tab
# 2. Import into Ollama (run in the download folder):
ollama create meguru -f Modelfile
# 3. Run
ollama run meguru
```

### Hugging Face + Ollama (one-liner)

```bash
ollama run hf.co/wallouo/Inaba
```

### llama.cpp

```bash
./llama-cli -m meguru_q4_k_m.gguf -p "ใ‚ใใ‚‹ใ€ใŠใฏใ‚ˆใ†๏ผ" -t 4 --temp 0.8 --top-p 0.9 --min-p 0.05
```

### Python (transformers + PEFT)

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model = AutoModelForCausalLM.from_pretrained(
    "HauhauCS/Qwen3.5-4B-Uncensored-HauhauCS-Aggressive",
    torch_dtype="auto",
    device_map="auto",
)
model = PeftModel.from_pretrained(base_model, "wallouo/Inaba")
tokenizer = AutoTokenizer.from_pretrained("wallouo/Inaba")

messages = [{"role": "user", "content": "ใ‚ใใ‚‹ใ€ใŠใฏใ‚ˆใ†๏ผ"}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=120, temperature=0.8, top_p=0.9, min_p=0.05)
print(tokenizer.decode(output[0], skip_special_tokens=True))
```

## Hardware Requirements

| Item | Value |
|---|---|
| Model size (GGUF Q4_K_M) | 2.71 GB |
| Min VRAM | ~4 GB |
| Recommended VRAM | 6โ€“8 GB (for comfortable multi-turn context) |
| Tested on | NVIDIA RTX 4060 8GB VRAM, Ollama |
| Context length | 4096 |
| Runtime | Ollama, llama.cpp |

## Features

- Faithful Meguru personality
- Natural Japanese roleplay
- Optimized for local inference (Q4_K_M GGUF)
- Lightweight 4B model โ€” runs on consumer GPUs
- Suitable for desktop companion applications
- Designed for immersive conversations instead of general question answering

## Training Information

| Item | Value |
|---|---|
| Base Model | [HauhauCS/Qwen3.5-4B-Uncensored-HauhauCS-Aggressive](https://huggingface.co/HauhauCS/Qwen3.5-4B-Uncensored-HauhauCS-Aggressive) |
| Fine-tuning Method | LoRA (QLoRA 4-bit) |
| Framework | Unsloth |
| Quantization | Q4_K_M (GGUF) |
| Language | Japanese |
| Dataset Size | 891 conversations |
| Learning Rate | 1e-4 |
| Training Steps | 280 |
| Hardware | NVIDIA RTX 4060 8GB VRAM |

The training converged smoothly, with the loss decreasing from approximately 4.3 to 1.31, indicating healthy and stable optimization.

## Dataset

The dataset was not created by simply collecting dialogue from the visual novel. Instead, a significant amount of time was spent refining the data to maximize character consistency.

The overall pipeline included:

1. **Character dialogue extraction** โ€” pulled protagonist + Meguru lines from game scripts
2. **Removal of noisy and out-of-character samples** โ€” filtered plot-only narration and non-distinctive responses using an LLM-based cleaner
3. **AI-assisted dialogue expansion** โ€” generated additional conversations to strengthen multi-turn depth and low-emotion daily dialogue
4. **Multi-turn conversation generation** โ€” chained single exchanges into coherent conversation threads
5. **Emotion balancing** โ€” ensured coverage across emotional states to avoid mode collapse
6. **Manual refinement and quality review** โ€” hand-checked for persona consistency

The goal was always quality over quantity.

## Recommended Generation Settings

The following settings consistently produced the most natural roleplay performance during testing.

| Parameter | Value |
|---|---|
| Temperature | 0.8 |
| Top_p | 0.9 |
| Min_p | 0.05 |
| Top_k | Disabled |

### Why is Top_k disabled?

During experimentation, I found that enabling both Min_p and Top_k often caused the 4B model to become noticeably less coherent.

For example, with `Min_p = 0.08` and `Top_k = 40`, the model frequently became almost unable to produce complete sentences, repeatedly generating outputs such as:

> ใ€Œใฃโ€ฆโ€ฆใฃโ€ฆโ€ฆใ€

Disabling Top_k completely resolved this issue while maintaining creativity and response quality.

## Modelfile

The `Modelfile` included in this repo configures Ollama with the system prompt, generation parameters, and chat template needed to reproduce Meguru's character behavior. See the file in the **Files and versions** tab.

## Example Conversation

One of Meguru's defining personality traits is that she is energetic, cheerful, and not particularly academic. The following conversation demonstrates that behavior.

| Role | Text |
|---|---|
| **User** | ใ‚ใใ‚‹ใ€ๆœ€่ฟ‘้‡ๅญๅŠ›ๅญฆใฎๆœฌใ‚’่ชญใ‚“ใงใ‚‹ใ‚“ใ ใ‘ใฉใ€ใ€Œใ‚ทใƒฅใƒฌใƒผใƒ‡ใ‚ฃใƒณใ‚ฌใƒผใฎ็Œซใ€ใฃใฆไฝ•ใชใฎ๏ผŸๅ…จ็„ถใ‚ใ‹ใ‚‰ใชใ„โ€ฆโ€ฆ |
| **Meguru** | ใˆใˆใˆ๏ผ๏ผŸ ใกใ€ๅฝ“็„ถใ ๏ผ้‡ๅญๅŠ›ๅญฆใชใ‚“ใฆใ€็ตถๅฏพ็„ก็†ใฃใ—ใ‚‡๏ผ๏ผŸ |
| **Translation** | "Ehhh!? O-Of course! Quantum mechanics is impossible to understand!" |

Instead of attempting to explain quantum physics, Meguru responds exactly the way her character would โ€” honest, lively, and completely overwhelmed by the topic. Maintaining this kind of personality consistency is the primary objective of this LoRA.

## Known Limitations

Although the dataset has gone through multiple rounds of refinement, some issues still remain due to the limitations of current 4B language models.

Common issues include:

- Speaker confusion
- Role drift during long conversations
- Occasionally inventing previous dialogue
- Cross-language contamination
- Reduced character consistency over extended contexts

Based on my experiments, these issues appear to originate primarily from the reasoning limitations of the base model rather than the dataset itself.

### Example: Cross-language Contamination

One interesting failure case observed during testing:

| Role | Text |
|---|---|
| **User** | ไธ€็ท’ใซใƒ™ใƒƒใƒ‰ใงๅฏใ‚ˆใ†ใ€‚ |
| **Meguru** | ๅ˜็ด”ใซใ€ใŠๆ˜ผใฎไผ‘ๆ†ฉๆ™‚ใซใกใ‚‡ใฃใจใ ใ‘ใƒ™ใƒƒใƒ‰ใ—ใŸใใชใฃใŸใฃใฆใ ใ‘ใ ใ—๏ผ |

The phrase **ใƒ™ใƒƒใƒ‰ใ—ใŸใใชใฃใŸ** is not natural Japanese. The model incorrectly translated the Chinese concept of "wanting to lie on the bed" into Japanese by treating ใƒ™ใƒƒใƒ‰ as a verb.

A native speaker would naturally say something like:

- ใƒ™ใƒƒใƒ‰ใงๅฏใŸใใชใฃใŸ
- ใƒ™ใƒƒใƒ‰ใงๆจชใซใชใ‚ŠใŸใใชใฃใŸ

This type of multilingual semantic interference is one of the common weaknesses of current lightweight multilingual language models and is extremely difficult to eliminate completely through LoRA training alone.

## Evaluation

Due to the subjective nature of character roleplay, no standard benchmark was used. Instead, qualitative assessment was performed across the following dimensions:

| Dimension | Rating (1โ€“5) | Notes |
|---|---|---|
| Character consistency | 4 | Strong persona adherence in short-to-medium conversations |
| Japanese naturalness | 4 | Fluent output with occasional cross-language contamination |
| Multi-turn stability | 3 | Role drift appears in extended contexts (>20 turns) |
| Emotion range | 4 | Covers cheerful, flustered, embarrassed states well |

## Development Notes

One thing I learned while developing this project is that improving a character model is not only about collecting more data. After repeatedly refining the dataset, cleaning noisy samples, expanding conversations, adjusting prompts, and retraining the LoRA, I found that most remaining issues were no longer caused by the dataset itself.

Instead, they mainly stem from the reasoning and contextual limitations of today's 4B language models.

I'm looking forward to revisiting this project when future small models become more capable, require less VRAM, or when parameter-efficient fine-tuning techniques continue to improve.

## Intended Use

**This model is intended for:**

- Character roleplay
- Desktop companion projects
- AI VTuber experiments
- Local Japanese conversation
- Personal entertainment

**This model is NOT intended for:**

- General-purpose chat assistance
- Knowledge question answering
- Factual or professional advice
- Any commercial deployment involving the character

## License

The LoRA adapter weights are released under the **MIT License**.

> **Important:** The character **Inaba Meguru (ๅ› ๅนกใ‚ใใ‚‹)** is a copyrighted character from *Sabbat of the Witch* (ใ‚ตใƒŽใƒใ‚ฆใ‚ฃใƒƒใƒ) by **Yuzusoft**. This project is a fan-made, non-commercial work created for personal entertainment and technical exploration. All character rights belong to Yuzusoft.

## Acknowledgements

This project exists because I genuinely like Inaba Meguru.

I hope this model can bring a little happiness to anyone who enjoys her character as much as I do.

If you find this project useful, feel free to leave a โค๏ธ on Hugging Face or share your feedback.

Thank you for trying the model.