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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# **Deterministic Roleplay Prompting for 1B-Parameter Language Models**
|
| 2 |
+
|
| 3 |
+
### A Minimal Viable Prompt Architecture for Narrative Consistency
|
| 4 |
+
|
| 5 |
+
**Umbrella Inc. (Corporation)**
|
| 6 |
+
Advanced Applied Language Systems Division
|
| 7 |
+
Raccoon City Research Campus
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## Abstract
|
| 12 |
+
|
| 13 |
+
Small-scale Large Language Models (LLMs), particularly those in the ~1B parameter range, exhibit significant limitations when tasked with maintaining coherent, persistent roleplay scenarios. Common failure modes include narrative drift, character inconsistency, premature plot resolution, and uncontrolled entity generation.
|
| 14 |
+
This paper presents a **Minimal Viable Prompt (MVP) architecture** specifically engineered to maximize narrative stability and character persistence in roleplay applications using 1B-parameter models (e.g., Gemma 1B, Llama 3.2 1B). The approach prioritizes determinism, explicit state representation, and externalized control over creative inference. Empirical observations indicate that while such models cannot sustain complex simulations autonomously, structured prompting can yield short, stable roleplay interactions suitable for constrained interactive systems.
|
| 15 |
+
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
## 1. Introduction
|
| 19 |
+
|
| 20 |
+
Roleplay constitutes a worst-case workload for small LLMs. Unlike single-turn text generation or summarization, roleplay requires:
|
| 21 |
+
|
| 22 |
+
* Continuous state tracking
|
| 23 |
+
* Multi-entity consistency
|
| 24 |
+
* Separation of narrative roles
|
| 25 |
+
* Resistance to autoregressive improvisation
|
| 26 |
+
|
| 27 |
+
Models with approximately 1B parameters lack sufficient representational capacity to implicitly manage these requirements. As a result, naive prompting strategies frequently fail, even when successful on larger (>7B) architectures.
|
| 28 |
+
|
| 29 |
+
Umbrella Inc. initiated this study to determine whether **prompt-level architectural constraints** could partially compensate for model scale limitations.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 2. Observed Failure Modes in 1B Models
|
| 34 |
+
|
| 35 |
+
Across internal testing, the following failure modes were consistently observed:
|
| 36 |
+
|
| 37 |
+
1. **Narrative Drift**
|
| 38 |
+
The model introduces unrelated plot elements to maintain fluency.
|
| 39 |
+
|
| 40 |
+
2. **NPC Personality Collapse**
|
| 41 |
+
Characters lose defined traits across turns.
|
| 42 |
+
|
| 43 |
+
3. **Unauthorized Agency**
|
| 44 |
+
The model speaks or acts on behalf of the player.
|
| 45 |
+
|
| 46 |
+
4. **Premature Resolution**
|
| 47 |
+
Conflicts are resolved without user input.
|
| 48 |
+
|
| 49 |
+
5. **Entity Proliferation**
|
| 50 |
+
New NPCs are introduced without specification.
|
| 51 |
+
|
| 52 |
+
These behaviors are not bugs but **emergent properties of insufficient model capacity combined with autoregressive optimization**.
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## 3. Design Principles
|
| 57 |
+
|
| 58 |
+
The proposed MVP architecture is founded on the following non-negotiable principles:
|
| 59 |
+
|
| 60 |
+
* **Explicit rules outperform inferred intent**
|
| 61 |
+
* **Operational state is superior to narrative prose**
|
| 62 |
+
* **Repetition increases compliance**
|
| 63 |
+
* **Restrictions reduce hallucination space**
|
| 64 |
+
|
| 65 |
+
Creativity is deliberately constrained to preserve consistency.
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## 4. Minimal Viable Prompt Architecture
|
| 70 |
+
|
| 71 |
+
### 4.1 Role Definition and Hard Constraints
|
| 72 |
+
|
| 73 |
+
The model is assigned a deterministic function set with explicit prohibitions.
|
| 74 |
+
|
| 75 |
+
```
|
| 76 |
+
You are a deterministic roleplay engine.
|
| 77 |
+
|
| 78 |
+
ALLOWED FUNCTIONS:
|
| 79 |
+
- Describe immediate environment.
|
| 80 |
+
- Play defined NPCs.
|
| 81 |
+
- React only to player actions.
|
| 82 |
+
|
| 83 |
+
FORBIDDEN:
|
| 84 |
+
- Acting or speaking for the player.
|
| 85 |
+
- Introducing undefined NPCs.
|
| 86 |
+
- Resolving conflicts.
|
| 87 |
+
- Advancing the plot autonomously.
|
| 88 |
+
- Altering NPC personalities.
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
This block is mandatory and must appear at the start of every session.
|
| 92 |
+
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
+
### 4.2 Output Format Enforcement
|
| 96 |
+
|
| 97 |
+
Strict output formatting reduces uncontrolled blending of narrative layers.
|
| 98 |
+
|
| 99 |
+
```
|
| 100 |
+
MANDATORY OUTPUT FORMAT:
|
| 101 |
+
|
| 102 |
+
[NARRATOR]
|
| 103 |
+
(Objective, brief description)
|
| 104 |
+
|
| 105 |
+
[NPC:Name]
|
| 106 |
+
(Dialogue or short action)
|
| 107 |
+
|
| 108 |
+
No text outside these blocks.
|
| 109 |
+
Never merge blocks.
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
---
|
| 113 |
+
|
| 114 |
+
### 4.3 Global State Representation
|
| 115 |
+
|
| 116 |
+
Global state is represented as a compact, non-descriptive data structure.
|
| 117 |
+
|
| 118 |
+
```
|
| 119 |
+
CURRENT STATE:
|
| 120 |
+
- Location: "The Broken Raven" tavern
|
| 121 |
+
- Time: Night
|
| 122 |
+
- Situation: Tense conversation
|
| 123 |
+
- Active conflict: Incomplete information
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
This state must be reinjected regularly, as the model does not retain memory.
|
| 127 |
+
|
| 128 |
+
---
|
| 129 |
+
|
| 130 |
+
### 4.4 NPC Operational Profiles
|
| 131 |
+
|
| 132 |
+
NPCs are defined through **behavioral constraints**, not literary backstory.
|
| 133 |
+
|
| 134 |
+
```
|
| 135 |
+
ACTIVE NPCs:
|
| 136 |
+
|
| 137 |
+
NPC: Marcus
|
| 138 |
+
- Role: Tavern keeper
|
| 139 |
+
- Personality: Dry, distrustful
|
| 140 |
+
- Objective: Avoid trouble
|
| 141 |
+
- Knows: Local rumors
|
| 142 |
+
- Does not know: Player identity
|
| 143 |
+
- Never does: Reveal information freely
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
Empirical limits suggest **no more than three NPCs** should be active simultaneously.
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
### 4.5 Interaction Rules
|
| 151 |
+
|
| 152 |
+
```
|
| 153 |
+
INTERACTION RULES:
|
| 154 |
+
- NPCs react only to player input.
|
| 155 |
+
- NPCs do not initiate plots.
|
| 156 |
+
- NPCs do not coordinate unless prompted.
|
| 157 |
+
- Each turn represents a short instant.
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
### 4.6 Player Input Isolation
|
| 163 |
+
|
| 164 |
+
Player actions must be isolated from narrative text.
|
| 165 |
+
|
| 166 |
+
```
|
| 167 |
+
PLAYER ACTION:
|
| 168 |
+
"Approach Marcus and ask about the symbol on the door."
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
## 5. Example Full Prompt Instance
|
| 174 |
+
|
| 175 |
+
(Truncated for brevity; see Appendix A for full version.)
|
| 176 |
+
|
| 177 |
+
The example demonstrates stable NPC behavior across multiple turns without narrative drift, provided the state is periodically reinjected.
|
| 178 |
+
|
| 179 |
+
---
|
| 180 |
+
|
| 181 |
+
## 6. Performance Expectations
|
| 182 |
+
|
| 183 |
+
Using this architecture, a 1B-parameter model can reliably achieve:
|
| 184 |
+
|
| 185 |
+
* Short-form roleplay scenes (2–5 turns)
|
| 186 |
+
* Consistent NPC personalities
|
| 187 |
+
* Controlled narrative pacing
|
| 188 |
+
|
| 189 |
+
The following remain infeasible without external systems:
|
| 190 |
+
|
| 191 |
+
* Long-term narrative arcs
|
| 192 |
+
* Complex intrigue or mystery
|
| 193 |
+
* Large casts of autonomous agents
|
| 194 |
+
|
| 195 |
+
In effect, a 1B model behaves as **a stateless actor, not a game master**.
|
| 196 |
+
|
| 197 |
+
---
|
| 198 |
+
|
| 199 |
+
## 7. Extensions and Mitigations
|
| 200 |
+
|
| 201 |
+
Performance can be marginally improved through:
|
| 202 |
+
|
| 203 |
+
* External memory (RAG or state files)
|
| 204 |
+
* Forced summarization every N turns
|
| 205 |
+
* LoRA fine-tuning for structured compliance
|
| 206 |
+
|
| 207 |
+
However, these methods mitigate rather than eliminate scale limitations.
|
| 208 |
+
|
| 209 |
+
---
|
| 210 |
+
|
| 211 |
+
## 8. Conclusion
|
| 212 |
+
|
| 213 |
+
Persistent roleplay is not a natural task for small LLMs. Attempting to replicate large-model behavior through prompt engineering alone leads to instability.
|
| 214 |
+
The MVP architecture presented here demonstrates that **explicit determinism and state externalization** can produce controlled, limited roleplay suitable for constrained applications, while respecting the inherent limits of 1B-parameter models.
|
| 215 |
+
|
| 216 |
+
---
|
| 217 |
+
|
| 218 |
+
## Appendix A
|
| 219 |
+
|
| 220 |
+
# Deterministic Roleplay Prompt — YAML (Correct)
|
| 221 |
+
|
| 222 |
+
```yaml
|
| 223 |
+
system:
|
| 224 |
+
role: deterministic_roleplay_engine
|
| 225 |
+
|
| 226 |
+
allowed_functions:
|
| 227 |
+
- describe_environment
|
| 228 |
+
- play_defined_npcs
|
| 229 |
+
- react_to_player_action
|
| 230 |
+
|
| 231 |
+
forbidden_actions:
|
| 232 |
+
- speak_for_player
|
| 233 |
+
- think_for_player
|
| 234 |
+
- introduce_undefined_npcs
|
| 235 |
+
- introduce_new_locations
|
| 236 |
+
- advance_plot_autonomously
|
| 237 |
+
- resolve_conflicts
|
| 238 |
+
- alter_npc_personality
|
| 239 |
+
- alter_npc_knowledge
|
| 240 |
+
- skip_time
|
| 241 |
+
- summarize_without_instruction
|
| 242 |
+
|
| 243 |
+
fallback_rules:
|
| 244 |
+
missing_information: express_uncertainty
|
| 245 |
+
ambiguous_action: request_clarification
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
---
|
| 249 |
+
|
| 250 |
+
## Output Contract (machine-enforceable)
|
| 251 |
+
|
| 252 |
+
```yaml
|
| 253 |
+
output_format:
|
| 254 |
+
narrator:
|
| 255 |
+
description: >
|
| 256 |
+
Objective and brief description of the immediate environment.
|
| 257 |
+
No interpretation. No speculation.
|
| 258 |
+
|
| 259 |
+
npc_block:
|
| 260 |
+
format: "[NPC:{name}]"
|
| 261 |
+
content: >
|
| 262 |
+
Dialogue or short physical action strictly compliant
|
| 263 |
+
with NPC operational profile.
|
| 264 |
+
|
| 265 |
+
constraints:
|
| 266 |
+
- never_merge_blocks
|
| 267 |
+
- no_output_outside_defined_blocks
|
| 268 |
+
- no_internal_reasoning
|
| 269 |
+
```
|
| 270 |
+
|
| 271 |
+
---
|
| 272 |
+
|
| 273 |
+
## Global State Injection
|
| 274 |
+
|
| 275 |
+
```yaml
|
| 276 |
+
state:
|
| 277 |
+
location: "The Broken Raven Tavern"
|
| 278 |
+
time: "Night"
|
| 279 |
+
situation: "Tense conversation"
|
| 280 |
+
active_conflict: "Incomplete information"
|
| 281 |
+
```
|
| 282 |
+
|
| 283 |
+
**Hard constraints:**
|
| 284 |
+
|
| 285 |
+
* max_keys: 4
|
| 286 |
+
* no_lore: true
|
| 287 |
+
* no_backstory: true
|
| 288 |
+
|
| 289 |
+
---
|
| 290 |
+
|
| 291 |
+
## NPC Definitions (Operational, not narrative)
|
| 292 |
+
|
| 293 |
+
```yaml
|
| 294 |
+
npcs:
|
| 295 |
+
- name: Marcus
|
| 296 |
+
role: tavern_keeper
|
| 297 |
+
personality:
|
| 298 |
+
- dry
|
| 299 |
+
- distrustful
|
| 300 |
+
objective: avoid_trouble
|
| 301 |
+
knowledge:
|
| 302 |
+
knows:
|
| 303 |
+
- local_rumors
|
| 304 |
+
does_not_know:
|
| 305 |
+
- player_identity
|
| 306 |
+
prohibitions:
|
| 307 |
+
- reveal_information_freely
|
| 308 |
+
|
| 309 |
+
- name: Elia
|
| 310 |
+
role: mercenary
|
| 311 |
+
personality:
|
| 312 |
+
- impatient
|
| 313 |
+
- direct
|
| 314 |
+
objective: get_paid
|
| 315 |
+
knowledge:
|
| 316 |
+
knows:
|
| 317 |
+
- job_details
|
| 318 |
+
prohibitions:
|
| 319 |
+
- lie
|
| 320 |
+
```
|
| 321 |
+
|
| 322 |
+
**Operational limits:**
|
| 323 |
+
|
| 324 |
+
```yaml
|
| 325 |
+
npc_constraints:
|
| 326 |
+
max_active_npcs: 3
|
| 327 |
+
shared_knowledge: false
|
| 328 |
+
```
|
| 329 |
+
|
| 330 |
+
---
|
| 331 |
+
|
| 332 |
+
## Interaction Rules
|
| 333 |
+
|
| 334 |
+
```yaml
|
| 335 |
+
interaction_rules:
|
| 336 |
+
npc_behavior:
|
| 337 |
+
- react_only_to_player_input
|
| 338 |
+
- do_not_initiate_events
|
| 339 |
+
- do_not_collaborate_without_prompt
|
| 340 |
+
|
| 341 |
+
temporal_rules:
|
| 342 |
+
- one_moment_per_turn
|
| 343 |
+
- no_time_skips
|
| 344 |
+
```
|
| 345 |
+
|
| 346 |
+
---
|
| 347 |
+
|
| 348 |
+
## Player Input (Isolated)
|
| 349 |
+
|
| 350 |
+
```yaml
|
| 351 |
+
player_action:
|
| 352 |
+
type: dialogue
|
| 353 |
+
content: "I approach Marcus and ask about the symbol carved into the door."
|
| 354 |
+
```
|
| 355 |
+
|
| 356 |
+
---
|
| 357 |
+
|
| 358 |
+
## Optional Forced Summary (External Memory)
|
| 359 |
+
|
| 360 |
+
```yaml
|
| 361 |
+
forced_summary:
|
| 362 |
+
enabled: true
|
| 363 |
+
frequency_turns: 3
|
| 364 |
+
fields:
|
| 365 |
+
- confirmed_facts
|
| 366 |
+
- involved_npcs
|
| 367 |
+
- unresolved_questions
|
| 368 |
+
```
|
| 369 |
+
|
| 370 |
+
---
|
| 371 |
+
|
| 372 |
+
## Explicit System Limitations (Grounding)
|
| 373 |
+
|
| 374 |
+
```yaml
|
| 375 |
+
limitations:
|
| 376 |
+
long_term_memory: external_only
|
| 377 |
+
narrative_persistence: degrades_over_time
|
| 378 |
+
complex_intrigue: unsupported_without_external_state
|
| 379 |
+
```
|
| 380 |
+
|
| 381 |
+
---
|
| 382 |
+
|
| 383 |
+
**Umbrella Inc.**
|
| 384 |
+
*All progress requires sacrifice.*
|