Codified Finite-state Machines for Role-playing

📅 2026-02-05
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Existing approaches struggle to model the latent states that drive interactions in role-playing scenarios, often resulting in inconsistent behaviors. This work proposes a novel method that integrates large language models with finite state machines to automatically generate interpretable and executable deterministic finite state machines (CFSMs) from unstructured character descriptions. The approach is further extended to probabilistic finite state machines (CPFSMs) to capture character states and their transitions more flexibly. By enabling structured yet open-domain modeling of character behavior, the method significantly outperforms general-purpose baselines in both synthetic evaluations and real-world role-playing settings, demonstrating its effectiveness in handling structured tasks and stochastic state exploration.

Technology Category

Application Category

📝 Abstract
Modeling latent character states is crucial for consistent and engaging role-playing (RP) with large language models (LLMs). Yet, existing prompting-based approaches mainly capture surface actions, often failing to track the latent states that drive interaction. We revisit finite-state machines (FSMs), long used in game design to model state transitions. While effective in small, well-specified state spaces, traditional hand-crafted, rule-based FSMs struggle to adapt to the open-ended semantic space of RP. To address this, we introduce Codified Finite-State Machines (CFSMs), a framework that automatically codifies textual character profiles into FSMs using LLM-based coding. CFSMs extract key states and transitions directly from the profile, producing interpretable structures that enforce character consistency. To further capture uncertainty and variability, we extend CFSMs into Codified Probabilistic Finite-State Machines (CPFSMs), where transitions are modeled as probability distributions over states. Through both synthetic evaluations and real-world RP scenarios in established artifacts, we demonstrate that CFSM and CPFSM outperform generally applied baselines, verifying effectiveness not only in structured tasks but also in open-ended stochastic state exploration.
Problem

Research questions and friction points this paper is trying to address.

role-playing
latent character states
finite-state machines
character consistency
state transitions
Innovation

Methods, ideas, or system contributions that make the work stand out.

Codified Finite-State Machines
Large Language Models
Role-playing
Probabilistic State Transitions
Character Consistency
🔎 Similar Papers
No similar papers found.