arXiv:2602.05905cs.CL2026-02被引 1

用AI自动将角色设定转为状态机,让角色对话更一致可信。

Codified Finite-state Machines for Role-playing

  • 基于大模型自动将角色描述转化为可解释的状态机结构。
  • 在真实角色扮演场景中,比传统方法更稳定地保持角色一致性。
  • 支持概率化状态转移,适合处理开放、不确定的对话情境。

建模潜在角色状态对大语言模型进行一致且引人入胜的角色扮演至关重要。现有基于提示的方法主要捕捉表面行为,难以追踪驱动交互的潜在状态。我们重新审视有限状态机(FSMs),这一长期用于游戏设计的状态转换建模工具。尽管在小而明确的状态空间中有效,传统手工规则式FSM难以适应角色扮演开放的语义空间。为此,我们提出编码有限状态机(CFSMs),利用大模型自动将文本角色设定编码为FSMs,直接从设定中提取关键状态与转换,生成可解释的结构以保障角色一致性。为进一步捕捉不确定性与变异性,我们扩展为编码概率有限状态机(CPFSMs),其中状态转移被建模为状态上的概率分布。通过合成评估和在成熟作品中的真实角色扮演场景测试,我们验证了CFSM与CPFSM在结构化任务和开放性随机状态探索中均优于主流基线,证明其有效性。

原文摘要 · Abstract (English)

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.

角色扮演状态机LLM一致性

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。