Codified Finite-state Machines for Role-playing
Authors: Letian Peng
Yupeng Hou
Kun Zhou
Jingbo Shang
Venue: ICLR 2026 Poster (2026)
Keywords: Role-playing
State Modeling
Grounding System
Primary area: applications to computer vision, audio, language, and other modalities

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.

Published as a conference paper at ICLR 2026
CODIFIED FINITE-STATE MACHINES FOR ROLE-PLAYING
Letian Peng, Yupeng Hou, Kun Zhou, Jingbo Shang (lepeng, yphou, kuzhou, jshang) (ahann)@ucsse @ucsd.ede University of California, San Diego
ABSTRACT
Modeling latent character states crucial for consistent and engaging role-playing (RP) with large language models (LLMs). Yet, existing prompting- based ap- proaches 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), framework that automatically codifies textual character pro- files 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]
INTRODUCTION
In role-playing (RP) (Shao et al. 2023a Wang et al. 2024b Ran et al. 2025). character states are as vital as plot progression, shaping how character reacts, evolves, and engages in unfolding narratives. Consider the "Mario" case in Figure I grabbing "Super Mushroom" promotes him to "Super Mario" with new affordances (e.g.. breaking blocks); "Fire Flower" induces another state with ranged attacks. Effective RP likewise demands precise and expressive modeling of such state changes in open-ended, language- based worlds (e.g., when writing scripts for "The Super Mario Bros. Movie").
Despite recent advances, LLM-based (Achiam et al. 2023 Dubey et al. 2024) RP agents struggle with state stability and behavioral coherence. Prompt-only transition heuristics often miss which experiential details are decision-critice and they lack a transparent mechanism to carry state forward over time. Finite-state machines (FSMs), long used in game design, directly address these issues by specifying explicit states and interpretable transition rules, yielding deterministic, debuggable updates that preserve narrative consistency. However, traditional FSMs rely on hard-coded rules that do scale to the fluidity and ambiguity of text. This paper tends preserve the strengths of FSMs while relaxing the rigidity: we disentangle constraints into executable checks and leave space for exploration via semantic questions. is feasible because the rationality of each constraint can be estimated from the profile and context, allowing precise rules where needed and flexible guards elsewhere (Peng& Shang 2025).
We propose Codified Finite-State Machines (CFSMs): using LLM -Lsed extraction and coding (Xu al. (224) Jiang et al. (004)), we first prompt LLMs extract key states involved in transition from the profile. Based extracted states, LLMs then generate tion get_next_state (state, scene, action) that queries the scene through pre-defined helper calls miinay--uustt inn (text, question). CFSMs thus ground character logic in structured, interpretable transitions while remaining adaptable to open-ended semantics.
executable transition func-
Code: http:////ttiiiimm//oooiiiinnoond Finite State Machine

---

Published as a conference paper at ICLR 2026
Codification
Textual Transition Rule
Codified FSM
Marto fiw fower but shrmas back is rmall yther damageed Firs karii kown fin pouve after demagge revering Super Mants
Mario begina smaut bocoming Super Maric by greading mustroem loiing
return Lie call MGtveee (tect), (cueetton)) arturr yes/nz/srirenn)
presieeiooal helser
Traditional Hardkoded FSM
"sager malhrogen
"fiine Foowent
state on "small earast
strery, qlacttoe, "tett gete uper nattroen?";: return "spprr narto"
by Goorss?");
clif state "Super merte't
1f sinaty atactie,, "hario gets tire floverl It neture "éine earie" al5f state "Tire sarde";
by Gooras?"):
if sinary "Narlo Nit by bowbb?")) retur "saper marle"
Figure! 1: The Mario case to introduce finite-state machines into the role-playing field.
To capture more nuanced dynamics, we introduce Codified Probabilistic Finite-State Machines (CPFSMs), which represent states as probability distributions, enabling explainable transitions when multiple next states are plausible. Compared with prompt-only methods, CFSM and CPFSM reduce confusion and inconsistency, producing stable and believable role-play.
and
To implement CFSMs, we parse profiles to identify distinct states, including catch-all "unactivated" and "other" states, and then codify transition rules as executable logic conditioned on scene events. During role-play, each action is processed through this logic to update the current state, grounding subsequent outputs in transparent trajectory. With logits available from the condition checker, CPFSM extends this framework into a probabilistic transition matrix that continuously updates state distributions. This mechanism captures subtle shifts in internal dynamics and supports multinomial- distribution reactions with explicit likelihoods, thereby increasing expressiveness and realism in open-ended RP.
Synthetic validation experiments, such as Mario's power-up transitions and stealth combat logic in Call of Duty, reveal that LLMs prompted directly with multi-action contexts often confuse states, misapply conditions, or hallucinate transitions. These findings reinforce that prompt-only RP models lack stable state modeling, while CFSM's explicit scaffolding significantly improves coherence.
We extend evaluation to real-world narrative tasks using the established plots in Fandom Bench- mark (Peng & Shang 2025), which includes over 5,000 role-play scenes across 83 characters, and find that CFSM and CPFSM improve behavioral consistency, transition traceability, and alignment with character-defined profiles relative to prompting and state-modeling baselines. CPFSM further supports the claim that probabilistic modeling yields more nuanced, explainable, and multiple poten- tial behaviors, especially when multiple actions are plausible, validating codified FSMs, deterministic probabilistic, strong foundations for state modeling in LLM-driven role play. To clarify CFSM's practical contributions, we analyze three aspects: ablation shows explicit state registration is critical, with removal degrading action consistency and with transitions grounded in disjoint profile facets such as emotional stance and social role producing the strongest coherence; cost analysis introduces an (n++k) codification strategy that assigns default conditions to all n states and overwrites only k profile-defined transitions, enabling scalable construction compared with Onn)); and a case study illustrates faithful tracking of dynamic states over episode progress. Our contributions are three-fold:
We propose Codified Finite-State Machines (CFSM), a framework that uses LLM- based extraction and coding to define interpretable character state transitions from textual profiles.
We introduce Codified Probabilistic Finite-State Machines (CPFSM), enabling probabilistic state dynamics that support nuanced, multiple potential reactions in narrative contexts.
We provide both synthetic and real-world evaluations, along with ablation and cost analysis, demonstrating that our codified approaches improve coherence, interpretability, and efficiency.
2 RELATED WORKS
Role-playing. Role playing (RP) tasks an agent with enacting persona (e-g.. goals, backstory. and constraints), while producing consistent dialogue or actions (Riedl & Bulitko 2012. Riedl & Young 2005). LLMs have dramatically expanded what RP agents can do (Shao et al. 2023b Chen et al.)), and an LLM-based agent augmented with memory (using relevance and recency heuristies) can simulate believable characters (Moore Wang et al. 2024, Yan et al. 2023). However, persistent personas remain hard: systems often drift in memory and behavior as narratives grow complex. Fine-tuning LLMs on character-specific or experience data (c.g.. CharacterGLM (Shao et al.) 2023b) and Neeko (Yu et al. 2024)), can improve identity consistency over prompting, but requires curated
2

---

Published as a conference paper at ICLR 2026
data and is costly to scale up. In parallel, systematic mechanisms within the agent are being explored to guide behavior over long interactions, including reasoning- based action selection (Tang et al. 2025), structured memory (Cheng et al., 2025). and codified constraints (Peng & Shang 2025).
State Modeling. State modeling makes latent variables explicit, together with rules to govern an agent and its world evolves over time (Corbett et al., 2000) Chomsky & Miller 1958). It typically enumerates discrete states (e.g.. idle and alert) and specifies condition- or event- triggered transitions (Joseph et al. 20133 Svete & Cotterell 2023), yielding an interpretable control interface for RP. Histories can be summarized and organized hierarchically to maintain concise, decision- state descriptions. Recent efforts improve tracking and structure to stabilize transitions and avoid continuity errors, including graph-based memory (Li et al.) (2024) and ddentity-driver hierarchical architectures (Sun et al. 2024). Codified Profiles (Peng & Shang 2025) further compile textual descriptions into executable condition-checking logic, enabling persistent and controllably stochastic behavior. Yet transparent, conflict-reoolvnng transition logic remains scarce in open-ended R..
LLM for Coding. LLMs are widely used to synthesize. edit, and orchestrate executable code from language or reasoning specifications (Luo et al. Li et al. 2022). Building on this capabiliiy, agentic and neurosymbolic paradigms offload parts of reasoning
code execution, markedly improving 2023) and embodied AI tasks (Wu et al.) 2023]
accuracy in reasoning (Yao et al. [023] Gao al.
Liang et al. 2022). These directions motivate our use of an LLM to generate FSM logic: we leverage its knowledge and capability to write code that tracks states and triggers actions, ensuring that high-level plans (state transitions) adhere to a predefined logical schema. Recent work shows LLMs can also author or revise state machines directly: they modify FSMs (as code) from natural-languan instructions in robotics (Yoneda et al., 2024 Gan et al. 2024) and multi-hop reasoning (Wang et al. 2024a 2025b), demonstrating that nontrivial transition logic can be produced in code form.
CODIFIED FINITE-STATE MACHINE
3.1 PRELIMINARY AND DENOTATION
Basic Role-playing System. For a character the most basic role-playing system consists of text generator (large language model in our discussion) LLM(.) that generates a character response r to given scene The generation is guided by two types of instructions: global instruction In. which encodes universal role-playing behavior, and a character-specifie instruction l,, which captures the identity, traits, or constraints of character æ. The model samples the character's response by conditioning on all three components: r = LLM(s Ig. Iz). The character state information discussed later is included in Ly for grounding.
State Modeling in Role-playing, In role-playing systems, a scene 8 can be decomposed into a sequence of observable actions (a a(2) ..)..... a. where each action a may originate from character behavior external environmental events. Alongside this explicit action sequence, there exists parallel sequence of latent character states (1()), (222) J,))), where each l represents the evolving internal state of a character, which captures psychological factors such as emotions and intentions. To capture it, role- role-playing systems often model state transitions using Markovian formulation: (((1)) T(, (a()) Tg. Tz). Here, T(-) denotes the state transition function, which updates the internal state based the previous state (1), the current action at*), and both the global instruction Iy and searacter-speciffe instruction Ig that might contain certain transition rules. This structure is particularly designed under the limited context window of LLMs, allowing systems to track and compress character dynamics explicitly. A straightforward implementation of T(-) is to prompt the L.MM to generate the next state i (t+1) conditioned on the tuple (h1(0) al Tg. Tw) (PromptTrans), enabling the model to simulate coherent and evolving character behavior over time. During the response, (t)) is appended to the prompt inside I, for grounding.
Finite-State Machine. A finite-state machine (FSM) is a formal structure for modeling stateful behavior, defined by the tuple M = (H, A, T, (())) where H is the set of possible states, A is the set of actions or events, T: H x A - H is the state transition function, and (0)) e H is the initial state. Unlike direct prompting of an L.LM to output h in the infinite set of natural language, FSMs
3

---

Published as a conference paper at ICLR 2026
(Each the action an systew-drisnn plot)
Scene Update
State Transition TIM", d²))
Respond Scene
Ayslode Spencce
Cornerreeedd a' LLMOH")) d'1))
Trannioon or PSM thr crasanti Suace
Stage #1: LLM Extracts Key Stutes from Profile
Stage #2: LLM Write the Transition Legic
Stalie-Saiic Muciis (CPSM)
Cudifial Proteiddatic Stuit- Madane
Augas hans Textaal Profiic (Phn "Herhh Accuanhee)
Pu
Pat
Pa
Pu
StaRTy, www.ryccttiiiiii Mettiiia
Thess aellow lnvine are aeting
stiel muidd acteiiaae Sepiid Liieary CARP7))
LLME baod)
Estrction
Napao HallY CaRiied Tructtio Logie
Cudlig
Ny
Geam tee detignns onher codal dater
laiaii aeciles.
trigais
Nagan Iniiy Extracted Key States foom Profie
TLDE Niniow Cojl
"Oes the ECTSO Sevolox ista wetting with syec?"
Figure 2: The frameworks of CFSM and CPFSM. More implermentaiion-foocsee flow: Figure
only maintain the transition between set of key states. FSMs also provide an explicit and persistent representation of character states and their transitions. This explicit structure enables RP systems to (1) preserve long-term continuity beyond the LLM's context window, (2) enforce logical consistency of state transitions, and (3) integrate both parametric knowledge (model weights) and in-context knowledge (scene-specific updates) into an explicit and explainable evolution of character behavior. In this way, FSMs serve as a bridge between traditional symbolic state tracking and the open-ended semantic reasoning afforded by LLMs.
Illustrative Example. For clarity, consider Jotaro Kujo from JoJo's 's Bizarre Adventure. The global instruction I, enforces general RP coherence, while the character instruction Ia encodes Jotaro's stoicism, terse speech, and "Yare yare daze." In a scene 8 where an enemy Stand user appears, the observable actions may be (1) = enemy approaches and a2)) = enemy threatens. An FSM uses small set of discrete states (neutral, alert, combat, post-battle) with explicit transitions such as alert enemy threatens
combat. Taken the mentioned actions inputs, FSM transitions Jotaro from h0)) = alert to (2) combat- ready via (+++1) = T(h(*), at)), Ig. Iz), guiding increasingly tense responses. During generation, the LLM is grounded in the current state, yielding character-faithuul lines like "Yare yare duze... Guess I'll have to deal with you." This illustrates how structured state tracking supports coherent and identity RP behavior.
3.2 CODIFIED FSMS
One character can have multiple FSMs modeling different behavioral dimensions (e.g.. emotion and stance). For simplicity, we illustrate the codification process of FSM instance M = (H, T, h (o)), where each component is constructed via L.LM-based codification from textual profiles and scenes.
Key State Extraction. The first step in constructing a CFSM is extract discrete of key states H = (hi, /u2,..., ,,, from a character profile P,. These states capture semantically meaningful internal conditions (e.g., angry, curious) that guide role-play. Rather than manually defining all possible states, CFSM leverages LLMs to generate H via H = LLM(Pz Lexuree) where Lextract is an instruction prompt for state enumeration. This allows character logic to be grounded in interpretable and controllable state spaces while remaining flexible to profile formats. To cover all possible states of the character, H reserves h1 for "Unactivated" (also for initialization as (0)) and h. for "Other".
Codification. Given the extracted states H and profile Pa, the next step is to codify the state transition function T : H x A + H. Rather than hard-coding rules, CFSM uses the LLM to generate a function by prompting it to map combinations of state-action pairs to the next state, grounded in the character's is behavioral logic from p.: T(h, a) = LLM(h, P.. lcodify). It captures how the character would typically evolve in reaction to different stimuli, embedding both semantic and symbolic reason- (text,
ing in the transition logic. Such semantic reasoning is supported by a binazyy-queste quest it ion) function embedded inside the code, which is executed for condition checking based on question q (pre-defined during codification) by the RP L.LM or specifically trained discriminator.
4

---

Transition Matrix. To update the state distribution, CPFSMs employ a logit-weighted transition matrix W(T) E R where each element w represents the logit score of transitioning from state h; to hy given the current action aş. These logits are derived by prompting the LLM with pre-defined transition questions Gi, (derived from the profile) and the current action context, and w is then normalized via the softmax function transition probability Pi.j" The final transition is 4..s), represented by the Published as a conference paper at ICLR 2026
Mechanism. Once codified, the CFSM operates by simulating character state transitions function of current state and observed action ((+1)) = T(,(0) (a()) (get next state (state, scene, actí action)) ). This lightweight mechanism enables external systems to simulate the charac- ter's internal state evolution across sequence of events without prompting the LLM per step. By separating codification from execution, CFSMs can be further cached, reused, audited by humans.
3.3 CODIFIED PROBABILISTIC FSMS
While CFSMs model state transitions deterministically, real-world often involves ambiguous signals and stochastic behaviors. To capture this uncertainty, extend CFSM to Codified Proba- bilistic Finite-State Machine (CPFSM), replaces discrete state transitions with a probabilistic state distribution, enaablig more expressive and nuanced modeling of character dynamics.
Probabilistic State Representation. Instead of a single active state h2 E H, CPFSMs maintain state probability distribution: p( [p] (1) (t)
...... (1) A"-1, where Pk represents the likelihood that the character is in state h1s at time step i, and n is the probability simplex over possible states. This distribution evolves over time as new actions are observed.
(t)
p(++1) softmax (oft)ax(W(()) p()), where !h = ceinary-questai log probability of "True" prediction from the classifier.
Inference and Grounding. Although the internal representation is probabilistic, CPFSMs maintain compatibility with deterministic RP systems by grounding the response at each time step in the most probable state ( where hy = arg max; P; (c) This allows CPFSMs guide role-playing outputs while preserving interpretability and controllability. Furthermore, because transitions are condi- tioned on both structured prompts and soft distributions, CPFSMs support fine-grained adaptation, uncertainty modeling, and richer behavioral diversity compared to their deterministic counterparts.
3.4 IMPLEMENTATION OVERVIEW
Given a new action, we first check its relevance to the character, which prevents updates based on unrelated or absent events. If relevant, we then classify whether the character is the agent (active) or recipient (passive) of the action to select the corresponding codified transition logic (both FSMs codified advance). More details are in the prompt and pipeline (Appendix and implementation.
Using the character's 's current state and the action, the system runs the codified transition function (deterministic in CFSM, probabilistic in CPFSM) to compute the next internal state, where bi minary--uusss smaller and faster discriminative model such as gpt-4.2 4 mi distilled classifier to evaluate semantic conditions efficiently, while the main response generation is handled by larger RP model like gpt 4.
Aspect
CFSM
CPFSM
Transition Type Granularity
Deterministic Coarse-grained
Probabilistic
Fine-grained
Speed
Faster
Slower
supported by
Logit
Not required
Requires
Transition Bius
Greedy
Distributional
Branching Logic
Multi-path checks
Single-step
State Distribution
Not available
Available
Table 1: CFSM/CPFSM Comparison.
Finally, after computing the character's s new internal state, the RP model generates a response grounded in that state and the current scene context. This structured flow ensures that state transitions are interpretable, profile-consistent, and dynamically updated over the narrative.
We don't experiment on gpt-5 because does support T 0.0 the time of submission.
5

---

Published as a conference paper at ICLR 2026
CFSM vs. CPESM Table summarizs the trade-offs between CFSM and CPFSM. CFSM offers faster inference and greater compatibility with black-box LLMs by avoiding logit computation. making it suitable for interpretable and flexible branching logic. In contrast, CPFSM provides finer-grained, less biased transitions by modeling state uncertainty as distributions, making it ideal for nuanced or stochastic role-playing scenarios.
SYNTHETIC VALIDATION
We first validate the relative limitation (to FSMs) of LLMS in maintaining the character's states in role-playing. To do so, we select three classic and well-known state transition models, which are used generate state transition sequences to reveal the limitations of LLMs in modeling character states. These state transition models include Mario State, Call of Duty Enemy, and Tyrion's ' Westeros Travel.
Mario State (Item Interaction). Mario's 's state transition in our experiments represents simplified version of the game, where Mario has "small"" "super", "fire", and "miss" states. Mario transitions between states based on actions "get super mushroom", "get fire flower", "hit by goomba". Call of Duty Enemy (Reaction Interaction). The enemy state machine models typical FPS opponent behavior with states "idle", "alert", "engaged", "retreat", and "death". Transitions are triggered by player actions such as making noise, revealing position, sustained fire, direct elimination, capturing the dynamics of stealth, combat, and survival.
Tyrion's 's Westeros Travel (Map Interaction). Tyrion's movement is modeled transitions across regions of Westeros: "the westerlands", "the riverlands", "the vale", "the crownlands", "the stormlands", "the reach", "dorne", "the north", and "the iron islands". Each transition corresponds to a directional travel action (e.g., north, northeast), enforcing geographical adjacency on the map.
State Correctness Rate
Mario State Machine
COD State Machine
Tyrion State Machine
1.5
#Reasoning Token
200
0.6
150
150
04
100
100
100
0.2
0.2
0.2
-0
10
3
10
2
9
10
#Step Transition
Figure 3: Synthetic validation of LLMs' limitation in state transition understanding.
We place the FSM for trace generation in the Appendix C For each FSM, we generate 10,000 transition paths under a random action selection policy. To ensure balanced evaluation, we further sample 100 paths terminating in each possible state (e.g.. for the 4 Mario states, this yields 4 100 400 test paths). The evaluated LLM is prompted with the textual transition rules, an initial state, and sequence of actions, and it must predict the correct final state from the full state set. We repeat this procedure for path lengths from 1 to 10, gradually increasing task difficulty.
Figure reports the results of these synthetic validation experiments. comparing gpt poot-4.. -.1 and gpt-4 -mini, with and without chain-of-thougg prompting. CFSM results are omitted, as consistently achieves 100% accuracy with forward time proportional only the number of transitions. The LLMs, in contrast, show clear decline in accuracy as path length increases, particularly without chain-of-thought reasoning. While chain-of-though substantially improves accuracy by effectively simulating the FSM, it incurs a significant efficiency cost, requiring roughly 25x the forward time of CFSM. Case studies in the Appendix illlustrate that chain-of-thouglee predictions actually mimic explicit FSM simulation, underscoring the value of CFSM in delivering both stable transition and high computational efficiency.
[
REAL PLOT EXPERIMENT
5.1 EXPERIMENT SETUP
Fandom Benchmark (Peng & Shang 2025 is constructed from character profiles and structured story summaries sourced from Fandom, focusing on behavior-centric role-playing evaluation. For each narrative segment, scenes are paired with extracted character actions and guiding questions

---

Published as a conference paper at ICLR 2026
Artifact
Scene
QA Pair
Haruhi Suzumiya
Haruhi drags the SOS Brigade around to do various summer vacation activities, including swimming a pool. going to an O-bon festival, playing with firewarks, and bug hunting for 15,499th time. Kyon is plagued by an increasing sense of déjà va the activities continue. Again, Asahina calls Kyon panicked state, asking him to meet her.
What action does Kyon take after receiv- ing panicked call from Asahina during the endless sumaeer loop?
Question:
Reference: Kyon meets up her, Nagato, and Koizumi, who again explain that the world has been experiencing an endless time loop from August to August 31 because Haruhi feels she still has things she must do during summer vacation.
A Game Thrones
... Jon Snow works at his sword practice, angry that Catelyn thought would be inappropritte that hastord should attend. His uncle Renjen Stark, First Ranger of the Night's Watch, arrives to join the feast. and Jon asks him to take him back to the Wall with him. Benjen agrees to consider it.
How does Tyrion Lannister address Jon Snow's 's sensitivity about his illegitinacy during their conversation?
Question:
Referenee: Tyrion Lannister then arrives and talks to Jon. suggesting that he is too pricklish and quick to take offense when his illegitimacy pointed out.
Table 2:
Examples of data samples used in the Fandom Benchmark.
that constrain responses without revealing the answer. During evaluation, the role-playing LLM receives a spoiler-free profile, the scene, and the question, and must predict the character's 's next action. The benchmark spans six major artifacts (Haruhi, K- K-On!, JOJO, FMA, AGOT, ATLA), covering 83 characters and 5,141 scenes across diverse media genres. Its scene-action pairs are arranged in a temporal sequence, which enables state updating experiments along with the episode evolution. Background context of characters and episodes involved in these artifacts, together with running examples can be found in Appendix M Table 2 showcases two data samples from the benchmark for easier understanding of the benchmarking procedure.
Natural Language Inference (NLI) Score and Best@K K Responses. Predictions are scored with an LLM-based (gpt-4, 1) reference-prediction NLI following the prompt setup in the original benchmark, assigning 100 for entailment, 50 for neutral, and O for contradiction. The NLI accuracy is also validated to be consistent with human evaluation in previous work. We further manually validate 200 cases predicted as "entailed", "ncutral", "contradicted" each, resulting in 91.0%. 89, 89.5%. 88 88.0% accuracy. For stochasticity, models may generate K candidate responses per scene, and evaluation uses Best@ K: sampling K responses from the RP model and calculate the highest NIJ score among recorded outputs. This setup captures both baseline accuracy and the potential best alignment of the
role-playing LLM under probabilistic generation. Beyond scripted scenes, we also use gpt 4 4.1. 1 as a judge to evaluate methods' performance in open-ended RP scenarios, placed in Appendix H
Baselines and Implementations. We include the following basclines for comparison to show the value of the finite-sti state machine mechanism inside character state modeling in RP. All methods use the same pair of RP model and the discriminator in all comparisons, and all codification applies claude-4. 0-sonet with other coding (including open-source) models compared in Appendix E
Vanilla The LLM receives only the current state and random action, relying solely on its internal knowledge without explicit transition rules. This forms the lower bound of performance.
Textual Profile. The RP LLM is prompted together with the textual profile of the character.
Codified Profile. (state-to-action transition) (Peng & Shang. 2025) applies codification to represent scene-to-action behavior as executable codes, which take scene texts input and output grounding behavior statements. It models the logic in a different stage (response inference) in comparison to CFSM/CPFSM (state modeling).
PromptTrans. (state-to-state transition) Instead of executing explicit rules, the LLM is asked generate the next state as paragraphs from the current state, action, and textual description of the transition logic. This simulates state progression via summarization, providing a contrast to rule-based execution. The state and scene are further fed into functions from codified profiles to get grounded in the tattetoo-action stage.
Character Updating. (state-to-state transition) (Wang et al. 2025al maintains an explicit textual character sheet that is iteratively rewritten along the trajectory. Given the current state, the latest scene, and the agent's action, the LLM first produces an updated character summary and then generates the response conditioned on this refreshed state. The updated state and scene are further fed into sadified-proffi functions to obtain grounded behavior in the state-to-actio stage.
Plot Summary. (state-to-state transition) (Wang al. 2025cb maintains running synopsis of level events shared across turns. At each step, the LLM updates this global plot summary from the previous state, current scene, and action, and uses the revised summary as the new state.
7

---

Published as a conference paper at ICLR 2026
Artifact
Haruhi
K-On!
JOJO
FMA
AGOT
ATLA
Average
#Character
7
5.3
Vanilla (No Profile)
80.96
77.81
75.21
80.34
85.58
82.46
80.39
Textual Profile
81.17
80.04
75.94
80.47
85.85
83.14
81.10
Main
Codified Profile
82.77
80.49
76.19
82.58
84.47
81.66
81.36
PromptTrans
82.86
79.68
75.07
82.66
84.96
82.17
81.23
Character Updating
83.63
79.23
75.08
82.48
85.87
82.51
81.47
Plot Summary
83.19
79.51
76.
82.91
85,48
83.00
81.70
Codified FSM
83.88
80.45
78.31
83.89
86. 11
83.28
82.65
#Character
9
7
9.2
Vanilla (No Profile)
17.17
78.64
83.15
87 44
82.46
82.37
Textual Profile
81.31
78.14
83.33
86.96
86.34
83.22
Minor
Codified Profile
81.54
80.58
85.91
88.91
82.16
83.82
N/A
PromptTrant
82.17
81.72
83.16
86.88
82.61
83.31
Character Updating
82.13
80.39
85.49
89.13
82.57
83.59
Plot Summary
82.34
80.61
85.10
88.76
82.79
83.92
Codified FSM
83.26
80.92
83.74
89.16
83.94
84.60
Table RP performance (NLJ Score, default metrie without special explanation) comparison with gpt-4.1 1 as RP model and gpt-4. 1 -iinn as discriminator. N/A: No minor character in Haruhi.
Artifact
Method
Haruhi
K-On!
J0J0
FMA
AGOT
ATLA
Average
Textual Profile
51.60
61.64
57.87
55.42
56.35
60.10
57.16
Codified Profile
55.83
37.57
60.52
59.61
64.03
60.11
Merged
11ama-3.4 3. 2-2---iitt
Codified FSM
65.30
65.23
60.90
60.48
62.31
62.38
62.77
Codified PFSM
65.02
67.12
60.45
60.13
63.14
64.09
63.32
Codified Profile
62.25
64.11
55.41
60.70
61.56
66.18
62,20
(w/ Distilled deberta)
Codified FSM
63.50
06.12
63,90
60.95
62.49
63.25
63.37
Codified PFSM
66.74
67.41
62.93
60.51
62.93
64.32
64.14
Table 4: IB LLM and O.IB distilled discriminator performance (Averaged over all characters.)
The resulting state and scene are then passed to codified-profff profile functions, which realize the final state-to-ad to--ioion- grounding.
CFSM/CPFSM. (state-to-state transition) takes the same input as PromptTrane but updates the state by executing FSM transition codes. FSM states are similarly fed into functions with scenes from codified profiles to get grounded in the state-to-action stage.
5.2 MAIN RESULTS
Across both large-scale (gpt-4.1) and small-scale (11 (1lama- 3.a.aaaaa----........... 2...2-1iitttree settings, CFSM consistently achieves the highest performance. In Table 3 CFSM outperforms baselines across all six artifacts, reaching average of 82.65 for main characters and 84.60 for minor characters. Importantly, the widely applied summarization- improvements over codified profiles: surface information already present in the scene, without adding new behavioral cues.
state modeling (PrompiTrans) does not yield analysis in Appendix (Toowsssswwsw shows that it tends to simply repeat
Table 4 further shows that even at the 1B scale, CFSM provides substantial gains, outperforming both textual and codified profiles by large margins. When combined with a small distilled condition checker (by distilling 0.1B deberta-v3 from gpt -4 4. -minni details in Appendix F). CPFSM can further improve upon CFSM with or without distillation. These results highlight CFSM/CPFSM's robustness across model scales and demonstrate that codified FSMs deliver precise state modeling. CPFSM is also found easier to codify than CFSM using weaker coders (e.g.. open-source LLMs), shown in Appendix E
NLI discriminator with 1% discrimination output
5.3 ABLATION AND VARIANT
Ablation Study, As shown in Table excluding state registration (always transition from "Un- activated"") has the most noticeable impact, showing the importance of state continuity. Removing fallback states like "Other" or "Unactivated" from FSM codification also reduces performance, high- lighting their roles in handling uncertain or inactive states. Among FSM types, personality is most critical for guiding action consistency, while identity and ability provide structural support. Together, these elements contribute to CFSM's robustness and its ability generalize across character types.
8

---

Published as a conference paper at ICLR 2026
Artifact
Haruhi
K-On!
JOJO
FMA
AGOT
ATLA
Average
Codified FSM
83.88
82.01
79.76
84.92
87.80
83.65
83.67
Merged
w/o State Registration
82.31
81.44
78.33
83.65
86.96
82.79
82.58
w/o "Other" State
83.24
81.47
78.95
83.78
86.88
83.19
w/o "Unactivated" State
83.62
81.53
79.58
83.93
87.01
83.35
83.17
w/o Identity FSMs
81.46
82.04
78.96
84.65
87.04
82.99
82.86
w/o Personality FSMs
82.29
80.80
78.26
84.29
87.01
83.05
82.62
w/o Ability FSMs
82.02
81.99
78.47
83.77
87.42
83.08
82.79
Table 5: Ablation study of the components and FSM types in CFSM.
85
NLI Score
65
Best@@
75
60-
65
1B
3B
8B
6 Number of Response Trial (K)
8
Parameter Number of Role-playing Model
Figure 4: Left: CFSM CPFSM Performance on RP models with different scales. Right: Best@ performance of different randomness modeling strategies.
RP Model Variants. Using 1lama-3-- --ee---nnsttt. ruct at 1B, 3B, and 8B parameters, performance rises with scale across all variants, but structurally guided methods dominate at every size. Codified protiles outperform textual prompts and vanilla prompting, and CFSM adds another clear step up, indicating that executing explicit transition logic helps more than simply describing it. CPFSM is best overall and remains ahead even at the smallest scale, showing that lightweight probabilistic checking with logits yields benefits that model size alone does not provide. The gap between structured (CFSM/CPFSM) and unstructured (vanilla/textual) approaches persists as models grow, suggesting that explicit control over state transitions complements scale rather than being replaced by it.
5.4 STOCHASTIC RESPONSE EXPLORATION
Across all settings shown in the right figure in Figure our Sampled State Distribution (sampling states from CPFSM distributions) dominates both sample efficiency and final accuracy: already near the deterministic line at K-1, exceeds other baselines by several points, and maintains the highest ceiling as grows to 7. Simply sampling Random State Distributions (complete random state sampling) eventually approaches the curve, but requires many more trials, broader exploration with poor guidance. Sampled Checker underperforms because sampling yes/no/unknown decisions offers smaller exploration space. Increasing the Generator Temperature (to 0.3) reduces both accuracy and sample efficiency, perturbing surface generation rather than the latent state trajectory. Overall, CPFSM's nnte-disttibbtion sampling closely tracks deterministic behavior while retaining targeted exploration, yielding the best Best@ K performance under comparable compute.
Method
NLI Score
"Forward/Tume
Method
#Question
NLI Score
Codified Profile
82.45
N/A
Codified Profile
N/A
62.20
PromptTrans
81.97 83.67
130.78
CPFSM (O(n))
50.00
64.14
Codified FSM
30.17
CPFSM (O(n +))
17.71
63.43
(a) Efficiency comparison on exccution stage.
(b) Efficiency comparison on codification stage.
Table Efficiency analysis of CFSM and CPFSM.
5.5 EFFICIENCY ANALYSIS
Execution stage. CFSM maintains the best accuracy while using far fewer forward passes per turn than pure prompting simulation (PromptTrans), because it executes explicit transitions instead of re-reasoning them. Codified Profile incurs transition-time cost since it does model internal

---

Published as a conference paper at ICLR 2026
Artifact
Haruhi
K-On!
JOJO
FMA
AGOT
ATLA
Average
Codified FSM
83.88
82.01
79.76
84.92
87.80
83.65
83.67
Mergod
Transition per 2 sentences
83.50 82.28
81.66
78.78
84.21 84.40
87.32
84.48
83.33
Transition per 3 sentences
80.49
78.92
87.35
81.30
82.95
Table Investigation of different step lengths for CFSM.
states or perform stepwise updates, but this is also its weakness: without an internal FSM, it cannot enforce consistent multi-step dynamics and trails CFSM in fidelity.
Codification stage. We propose an Ok)+k) CPFSM construction to refine efficiency: define default transition questions for each next state and add only k special-case rules from the profile, avoiding the exhaustive O(n²) grid. We implement this O scheme for all characters in the Fandom Benchmark and compare against the O(22) variant. The approach also reduces the number of discriminative forwards during execution of CPFSM to O(n + k). Furthermore, it preserves accuracy while substantially reducing authoring effort, and the same idea transfers to CFSM by codifying only special transitions and falling back to (n) set of default checks when none apply.
5.6 FURTHER EXPLORATION
Step Length Analysis. To explore the efficiency-accuracy trade-off in CFSM, we evaluate coarser action granularities by assigning one FSM transition per n sentences instead of the default one-per- sentence. As shown in Table 7 although performance decreases slightly with coarser steps, CFSM remains robust: even with sentences per transition, still outperforms all non-CFSM baselines. This suggests that CFSM can be flexibly adapted to longer update intervals to reduce reasoning overhead, offering practical speed-accuranl trade-off without sacrificing overall superiority.
Dacnerys' Military Compaign (AGOT)
Ieay's Teamwork (3010)
Azusa's Band (K-ON!)
Othe
Odkx
Odkx
Deamying
Cunqurring
Scifeeoszs
Walle Gall
Rorsinng
Sciidaou
llekago Tea 'ime
Lheating
Unctivaaa
40%
1000
2055
40%
60%
100%
20%
40%
80%
100%
Episode Pro gress
Episade Progress
Episode Progress
Figure 5: The state dynamics of key states of characters modeled by CFSM.
Case Study. CFSM effectively models character dynamics across varied narrative structures. In Game of Thrones, captures Daenerys' campaign are through transitions among recruiting, con- quering, and liberating, enabling accurate next-action inference based on campaign phase. In JoJo's Bizarre Adventure, CFSM traces Iggy's evolution from selfishness selflessness, allowing the system to prioritize cooperative actions as his are progresses. In K-ON!, it identifies Azusa's shift in band identity, constraining likely actions to group-centric behaviors once her membership state updates. These examples highlight CFSM's 's ability to surface latent state trajectories and guide coherent next steps, which is something prompt-only approaches fail to robustly support.
6 CONCLUSION AND FUTURE WORK
We presented Codified Finite-State Machines (CFSM) and their probabilistic extension (CPFSM) as interpretable frameworks for modeling character state transitions, improving coherence and efficiency over prompting-bast based baselines. Future work will focus on three key directions: (I) automatically building CFSMs directly from narrative plots rather than pre-writted profiles, (2) extending CFSMs with numeric mechanisms such as health points to capture continuous dynamics, and (3) enabling dynamic updates to the state set, allowing characters to acquire new skills or traits over time. These directions aim to make CFSMs more adaptive and closer the evolving logic of real narratives.
10

---

Published as a conference paper at ICLR 2026
ETHICS STATEMENT
This work focuses on improving the coherence and interpretability of role-playing systems, All datasets are curated from publicly available Fandom sources, and no private sensitive information is used. The proposed methods are intended for research in controllable character modeling and should not be misused for generating harmful or deceptive content.
REPRODUCIBILITY STATEMENT
We provide detailed implementation steps, codification prompts, and evaluation setups in the ap- pendices. All experiments conducted with specified models, datasets, and hyperparameters to ensure replicability. The codehase and processed benchmark data will be released to support full reproducibility.
REFERENCES
Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.087 0307008744 2023.
Jiangjie Chen, Xintao Wang, Rui Xu, Siyu Yuan, Yikai Zhang, Wei Shi, Jian Xie, Shuang Li, Ruihan Yang. Tinghui Zhu, al. From persona personalization: A survey on cole-playing language agents. Transactions on Machine Learning Research.
Jiangjie Chen, Xintao Wang, Rui Xu, Siyu Yuan, Yikai Zhang, Wei Shi, Jian Xie, Shuang Li, Ruihan Yang, Tinghui Zhu, Aili Chen, Nianqi Li, Lida Chen, Caiyu Hu, Siye Wu, Scott Ren, Ziquan Fu, and Yanghua Xiao. From persona to personalization: A survey on role-playing language agents, 2024a. htLhttps:// /ttpp:s://arxivii/ arxiv. org/ abs/ 2404. 18231
Xinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. Teaching large language models self-debug. In The Twelfth International Conference on Learning Representatiinss, ICLR 2024, Vienna, Austria, May 7-11, 2024. OpenReview.net, 2024b. URUjttpps://ppezerie.. Forum? wedd-KKPPiiio
Xilong Cheng. Yunxiao Qin, Yuting Tan, Zhengnan Li, Ye Wang, Hongjiang Xiao, and Yuan Zhang. Psymem: Fine-grained psychological alignment and explicit memory control for advanced role- playing llms. arXiv preprint 2rXiv:2505./2// 2025.
Noam Chomsky and George A Miller. Finite state languages. Information and control, 1(2):91-112, 1958.
James C Corbett, Matthew B Dwyer, John Hatcliff, Shawn Laubach, Corina S Päsäreanu, Robby, and Hongjun Zheng. Bandera: Extracting finite-state models from java source code. In Proceedings of the 22nd international conference on Software engineering, pp. 439 448, 2000.
Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang. Angela Fan, al. The llama herd of models. arXiv preprini arXiv:2407.22 1783, 2024.
Xiangyu Robin Gan, Yuxin Ray Song. Nick Walker, and Maya Cakmak. Can large language models help developers with robotic finite state machine modification? arXiv preprint arXiv:2412.05625, 2024.
Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. In International Conference Machine Learning, pp. 10764-10799, PMLR, 2023.
Pengcheng He, Jianfeng Gao, and Weizhu Chen. Debertav3: Improving deberta using electra-style pre- training with gradient-disse disentangled embedding sharing. arXiv preprint 2021.
11

---

Published as a conference paper at ICLR 2026
Juyong Jiang, Fan Wang, Jiasi Shen. Sungju Kim, and Sunghun Kim. A survey on large language models for code generation. CoRR, abs/2406.00515, 2024. doi: I044850/ARX1.2400000555 00515
URL httphhttt///oottooo wtwp:/......oooo.oooo/ooo. w0t.0040551/0....2.0
Saskia Joseph, Michael Schumm, Otmar Rummel, Alexander Soska, Michael Reschke, Jürgen Mottok, Michael Niemetz, and Irmgard Schroll-Decker Teaching finite state machines with case method and role play. In 2013 IEEE Global Engineering Education Conference (EDUCON), pp. 1305-1312. IEEE, 2013.
Shilong Li, Yancheng He, Hangyu Guo, Xingyuan Bu, Ge Bai, Jie Liu, Jiaheng Liu, Xingwei Qu, Yangguang Li, Wanli Ouyang, et al. Graphreader: Building graph-based agent enhance long-context abilities of large language models. In Findings of the Association for Computational Linguiitties: EMNLP 2024, pp. 17758-12786 2024.
Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, et al. Competition-level code generation with alphacode. Science, 378(6624): 1000::009221100 1097, 2022.
Jacky Liang, Wenlong Huang, Fei Xia, Peng Xu, Karol Hausman, Brian Ichter, Pete Florence, and Andy Zeng. Code as policies: Language model programs for embodied control. arXiv preprint
arXiv:2209.07753, 2022.
Chin-Yew Lin. ROUGE: package for automatic evaluation of summaries. In Text Summarization Branches Out, pp. 81, Barcelona, Spain, July 2004. Association for Computational Linguistics. URL https::////eeec.
Ziyang Luo, Can Xu, Pu Zhao, Qingfeng Sun, Xiubo Geng, Wenxiang Hu, Chongyang Tao, Jing Ma, Qingwei Lin, and Daxin Jiang. Wizardcoder: Empowering code large language models with evol-instruct. In The Twelfth International Conference on Learning Representations.
Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegr- effe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, Shashank Gupta, Bod- hisattwa Prasad Majumder, Katherine Hermann, Sean Welleck, Amir Yazdanbakhsh, and Peter Clark. Self-refine: Iterative refinement with self-feedback. In Alice Oh, Tristan Naumann, Amir Globerson, Kate Saenko, Moritz Hardt, and Sergey Levine (eds.), Ad- vances in Neural Information Processing Systems 36: Annual Conference on Neural Infor- mation Processing Systems 2023, NeurlPS 2023, New Orleans, LA, USA, December 10 /
16, 2023, 2023. Utthttt::/pppers..tt Abst wwwttt-Cooooeeeeeeeeeeceeeeee ConeeerrtttaaaataCCerrreeeeeeeee html
Zekun Moore Wang, Zhongyuan Peng. Haoran Que, Jiaheng Liu, Wangchunshu Zhou, Yuhan Wu, Hongcheng Guo, Ruitong Gan, Zehao Ni, Jian Yang, al. Rolellm: benchmarking, eliciting, and enhancing role-playing abilities of large language models. Findings of the Association for Computational Linguistics: ACL 2024, pp.
2024.
Letian Peng and Jingdo Shang, Codifying character logic in role role-playing. CoRR, ab//2505.00555 2025. doi: 10.48550/ARIV.22555.00 2505. 07705
URL https::/doi. 00g/10..4550//rx11
Yiting Ran, Xintao Wang, Tian Qiu, Jiaqing Liang, Yanghua Xiao, and Deqing Yang. BOOKWORLD: from novels to interactive agent societies for story creation. In Wanxiang Che, Joyce Nabende, Ekaterina Shutova, and Mohammad Taher Pilehvar (eds.), Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2025, Vienna, Austria, July 27 August 1, 2025, pp. 15898-15912. Association for Computational Linguistics, 2025. URL htt.tpppse//eeaatooooooo..o// wwt.:y.........e// ac1- long 773/
Mark Riedl and Vadim Bulitko. Interactive narrative: A novel application of artificial intelligence for computer games. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 26, pp. 2160-2165, 2012.
Mark O Riedl and R Michael Young. An objective character believability evaluation procedure for multi-agent story generation systems. In International Workshop on Intelligent Virtual Agents, pp. 278-291. Springer, 2005.
12

---

Published as a conference paper at ICLR 2026
Yunfan Shao, Linyang Li. Junqi Dai, and Xipeng Qiu. Character-IIm: A trainable agent for role- playing. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Con- ference Empirical Methods in Natural Language Processing. EMNLP 2023, Singapore, De- cember 6-10, 2023, Dp. 13153-13187. Association for Computational Linguistics, 2023a. doi: 10.18653//1/2023.
URL http:/ttt///ooo.ooo aTg htt 1ttp////11111113611111//00
emn main. 814
Yunfan Shao, Linyang Li, Junqi Dai, and Xipeng Qiu. Character-IIm: A trainable agent for role- playing. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 13153-13187, 2023b.
Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. Re- flexion: language agents with verbal reinforcement learning. In Alice Oh, Tristan Nau- mann, Amir Globerson, Kate Saenko, Moritz Hardt, and Sergey Levine (eds.), Advances in Neural Information Processing Systems 36: Annual Conference on Neural Informa- tion Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 16. 2023, 2023. URL http:://apper:/ nips wwtpppppeeaaaieeeeee fttpee//aeeeeeaapee///////////// Atwp:/tttte--tttttttt--a-a--e-e-
(1t11188222655588888888888311111 oote Conftrract-Coofeeencee.... html
Libo Sun, Siyuan Wang. Xuanjing Huang, and Zhongyu Wei. Identity-driven hierarchical role-playing agents. arXiv preprint wxxiv2447.119122 2024.
Anej Svete and Ryan Cotterell. Recurrent neural language models as probabilistic finite-state automata. arXiv preprint arXiv:2310.05161,2222 2023.
Yihong Tang, Kehai Chen, Muyun Yang. Zhengyu Niu, Jing Li, Tiejun Zhao, and Min Zhang. Thinking in character: Advancing role-playing agents with role-aware reasoning. arXiv preprint arXiv:2506.01 07748 2025.
Lei Wang, Jianxun Lian, Yi Huang. Yanqi Dai, Haoxuan Li, Xu Chen, Xing Xie, and Ji-Rong Wen. Characterbox: Evaluating the role-playing capabilities of lms in text- virtual worlds. In Luis Chiruzzo, Alan Ritter, and Lu Wang (eds.), Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL 2025 - Volume 1: Long Papers, Albuquerque, New Mexico, USA, April 29 May 4, 2025, pp. 6372-6391. Association for Computational Linguistics, 2025a. doi: 10. 111.8653/1112225NAAAAC WWA.SSAACALLLNGLSSSE URL http::///////.. org 1ttpg//1.1165550 18653886333188 naac1-1ong 323
Xiaochen Wang, Junqing He, Yiru Wang, Xiangdi Meng, Kunhao Pan, Zhifang Sui, et al. Fsm: A finite state machine based shot prompting paradigm for multi-hop question answering. arXiv preprint Xiv:2440.002964 2024a.
Xiaochen Wang, Junqing He, Liang Chen, Gholamreza Haffari, Yiru Wang, Zhe Yang. Xiangdi Meng, Kunhao Pan, and Zhifang Sui. Sg-fsm: A self- self-guiding zero-shot prompting paradigm for multi-hop question answering based on finite state machine. In Findings of the Association for Computational Linguistics: NAACL 2025, pp. 6025-6037, 2025b.
Xintao Wang, Yunze Xiao, Jen-tse Huang, Siyu Yuan, Rui Xu, Haoran Guo, Quan Tu, Yaying Fei, Ziang Leng, Wei Wang, Jiangjie Chen, Cheng Li, and Yanghua Xiao. Incharacter: Evaluating personality fidelity in role-playing agents through psychological interviews. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar (eds.), Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 2024, Bangkok, Thailand, August 11-16, 2024. pp. 1873. Association for Computational Linguisties, 2024b. doi: 10.18653/V 11202333///2222...1 102
LONG 102. URL
Xintao Wang, Heng Wang, Yifei Zhang, Xinfeng Yuan, Rui Xu, Jen-tse Huang. Siyu Yuan, Haoran Guo, Jiangjie Chen, Wei Wang. Yanghua Xiao, and Shuchang Zhou. Coser: Coordinating 1lm- based persona simulation of established roles. CoRR, abs/2502.00082, 2025c. doi: 10.48550/ ARXIV URI. htl.https:.. http://doo..rgg//// htt.a//.001.....///ara.. 48550/arXiv. 2502.0908
Zekun Moore Wang, Zhongyuan Peng. Haoran Que Jiaheng Liu, Wangchunshu Zhou, Yuhan Wu, Hongcheng Guo, Ruitong Gan, Zehao Ni, Man Zhang, al. Rolellm: Benchmarking, eliciting,
13

---

Published as a conference paper at ICLR 2026
and enhancing role-pian cole-playing abilities of large language models. arXiv preprint arX1v:2310.00746. 2023.
Jimmy Wu, Rika Antonova, Adam Kan, Marion Lepert, Andy Zeng, Shuran Song, Jeannette Bohg, Szymon Rusinkiewicz, and Thomas Funkhouser. Tidybot: Personalized robot assistance with large language models. Autonomous Robots, 47(8):1087-1102. 2023.
Derong Xu, Wei Chen, Wenjun Peng. Chao Zhang. Tong Xu, Xiangyu Zhao, Xian Wu, Yefeng Zheng, Yang Wang, and Enhong Chen. Large language models for generative information extraction: survey. Frontiers Comput, Sci., 18(6)) 2024, doi: 10. 10007/$11044022-4005555 URL
fittps://di..oom 1007 00007/s1170 024-004444444-455---
Ming Yan, Ruihao Li, Hao Zhang. Hao Wang. Zhilan Yang. and Ji Yan. Larp: Language-agent role play for open-world games. arXiv preprint arXiv:2312.77653, 2023.
Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. In International Conference on Learning Representations (ICLR), 2023.
Takuma Yoneda, Jiading Fang, Peng Li, Huanyu Zhang, Tianchong Jiang, Shengjie Lin, Ben Picker, David Yunis, Hongyuan Mci, and Matthew R Walter. Statler: State-maitaiiiing language models for embodied reasoning. In 2024 IEEE International Conference on Robotics and Automation IEEE, 2024.
(ICRA), pp.
Xiaoyan Yu, Tongxu Luo, Yifan Wei, Fangyu Lei, Yiming Huang, Hao Peng, and Liehuang Zhu. Necko: Leveraging dynamic lora for efficient multi-character role-playing agent. In Proceedings of the 2024 Conference Empirical Methods in Natural Language Processing, pp. 12540-12557, 2024.
Li Zhong, Zilong Wang, and Jingho Shang. Debug like a human: A large language model debugger via verifying runtime exccution step by step. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar (eds.), Findings of the Association for Computational Linguistics, ACL 2024, Bangkok, Thailand and virtual meeting, August 11-16, 2024, pp. 851-870. Association for Computational Linguistics. 2024. doi: 10. 10.18653//222.FFDIIGGG ACL.49 URL htll:ttts///o..ott//// 18653/ v1/2024. www.:2...inniiiio finddiigniiggssa1..4444
14

---

Published as a conference paper at ICLR 2026
A USE OF LLMS
In this paper, large language models are employed in strictly limited and transparent manner. Their role confined to two specific purposes: (1) light polishing of the writing style to improve clarity and readability, and (2) execution of controlled experiments in the sections where the methodology explicitly specifies the usage an LLM. Beyond these stated scenarios, no hidden or implicit reliance on LLMs made, ensuring that the conceptual contributions, analyses, and results presented in the work remain independent of automated language model generation.
B LIMITATION AND FUTURE WORK
While CFSM and CPFSM provide interpretable and efficient mechanisms for modeling character states in role- role-playing, several limitations remain that point to promising directions for future research. These limitations stem from simplifying assumptions designed for tractability and computational efficiency, which may restrict expressiveness in complex narrative environments.
First, the framework assumes a fixed set of states throughout an episode, which limits the ability to represent emergent evolving traits such character gaining skill. Future work could enable dynamic state construction by adding, merging, or redefining states as the plot progresses, while maintaining coherent transition logic.
Second, binary-quest -utyyyuuettttee ion evaluations are currently performed in a single forward pass, which may be insufficient for harder semantic conditions. A future improvement is introduce gating mechanism, for example thinking variable, that triggers deeper reasoning such as multi-step inference fallback to a larger model when the question requires context-dependent interpretation.
Third, CFSM assumes Markovian transitions that depend only on the current state and immediate input. This simplifies execution but cannot capture behaviors that depend past outcomes. Future work could support non-Markovian transitions by incorporating episodic memory, such as modeling reluctance to reuse failed ability enforcing cooldown periods, which can be codified higher- order conditions with temporal depth.
Taken together, these directions suggest a path toward more adaptive and expressive state modeling. By supporting dynamic state growth, adaptive reasoning, and non-Markovian transitions, future CFSM variants can capture richer and longer-term character behavior in open-ended role-playing environments.
C PROMPTS, TEMPLATES, AND CODES
From Figure 6 to 10 we list the prompts and (FSM) codes used our experiments for codification, checking, and eva evaluation. For prompts in baseline methods, reuse exactly the same prompts in the previous codified profile work (Peng & Shang 2025) for reproduction.
D STATISTICS OF FSM CODIFICATION
As shown in Table g the statistics outline structural and density features across main and minor artifacts. For main groups, CFSM counts range from lower values around 11 to higher values above 20, paired with paragraph counts generally in the low to mid-teens. Vertex averages tend cluster around 4.5-5.3, while edge averages sit between about 15 and 19, producing density values that mostly hover in the mid-0.7 range, with one case approaching 0.85. Minor groups show similar distributions but with more variation: CFSM spans from around 11 to over 20, paragraph counts from about 7 to 15, vertex values from 4.7 to just above 5, and edges generally between 16 and 18.5. Density in the minors shows broader spread, with values from roughly 0.67 up to over 0.81. Together, these figures capture the balance between structure size (CFSM, paragraphs), connectivity (edges, vertices), and compactness (density) in each artifact category.
15

---

Published as a conference paper at ICLR 2026
Prompt #1: Extract Key States
[character) (alayy referring as this rons)
(srofile)
diven the character profile above of (character), propase potestial Fixite-state eachires (FSMS) for character states that on te der fved to generally apoly masy scenss.
"aatually
(not actions]
described
profile.
Each rinite-sta nachine must have unsctivated state (first of the list) and other state (Last of the list, "Mexplicitly wonti os other than what*e) to cover all kinds of situations. finally, semarias states
dictionrry namc: states) sentences montioning "[chrracter)":
pytton fsn_states
FS1
"..
Prompt #2: Codify into CFSM
Character
(character) (alasys referring
Proftile
rSr States
(states)
fased the given grofile, bulld the transition functios for the FSR states.
Imput: carrestt state" string contains state inside the give FSR states:
"action', string describing action
diaracter
acttive tool for whether it's (cheracter) ("Truz) ) taking "actios'
(ralse).
Output: state, string contaising a state inside the given ISN states, stould always be indesed by "tart_stete, Jak's "triggersd, attri_statss
string containing extre 1-sestence states that
trigpored by the transition accordlng
states in triggered_ states should also syntactically complete, independent os reference.
pre pre-defined helper function binary questian(text, qustion) check the irpets
logic. tuesty
questtonn applted both and "actton" with clear "question" with resolved anbigutty coreference. "qasstion" should be a systactically cosplete qusstion, indepescent previous questions.
1. Esplain the state trassition lngle in the given FSN states indicated by the given profsie. passive)
grapts
3. Search for all patential triggeeed extra states from the gives prsfilte and analyze their situstiors for triggering, ("IF and Feelee relations)
the ctaracter profite into the state transition fanction fore www.rranittioeeuueeeeteo action, actiua)".
Expected format:
def fse_ ttatssstiinttireee..tttt, scene, action, active)):
(states)
Diigeref_cntta_sstatee
if active:
action taken by (character)
current, state states]s]]
e 1000 (gst sest_state_.dt, 5th, appord triggered states to trigeroo__etrratttee))
1000 (get stateetat__ appord triggered states rrigetrd__etr__tttetss)
The actios is takes by another character
states]]]:
1050 (pet nect state apperd triggered triggered pattraaetate states)
if carvert state en all statest]]]
1950 (get sext_state_jae jdk, appord triggered states triggerod_ (tttrsstt_ttttsttttts
1020
return nest_state state, triggered_estra, eetrrssstssrrssttetessssss
Figure 6: The prompts and codes used in our experiments (1/5).
16

---

Published as a conference paper at ICLR 2026
Prompt #3: Codify into CPFSM
pare)'s
Lagte
(profile)
(14x3)
(stxte)
(states)
Dased on (full, rame)'s is profile, generate 1ists of questions to chect whether the source state stould transition to each target state a action takes,
questiens) fer situatio action is (fall "passivv" (lmm(states)
step 3.
Reasoning about the transition lopte.
Reasasing:
step 3. aetpo question liets
Expected formst: comnents) yeen
{
"pecctve's (len(states))
Prompt #4: Relevance Check
regneen)
Action:
Quastion:
(character_attr) ((character))
Directly assuer only yea/sp/untroet..
Prompt Active/Passive Check
Scone:
[scene_segg segeeet)
Action:
(actios)
Queation:
giver oction taken [character_attr) ([cheracter))?
Directly answer only yes/no/unizoon.
Prompt #6: Generate Respond
trowledge
(grounding)
(trigpered)
(scene)
Prompt #7: Scoring
Scene (scene)
Response: (prediittion
Score the action [character, abber the response based on the ground truth. groun
[chrracter_atee] response. (rollowing character legit.) the groud trath contraticts the action (dhrecter_sile) the respense. (rollowing contrudicted character logit.)
Sseni
--
"reasoning""
Figure 7: The prompts and codes used in our experiments (2/5).
17

---

Published as a conference paper at ICLR 2026
Prompt #8: Mario (w/o CoT)
The rale of Nario's state transétion: (rule)
The start state Peris: (state_
(action_sve_ten toxt]
Quostion: Mut's state
thoices:
(candidate_ tox()
Prompt #9: Mario (w/ CoT)
rale state transttton:
The start state of Parion (state_set(M]
hoppened Hardor (actioe ses_text)
Cholces: (candiicata text)
pytton
"annwer": "(choica_taatt" texty".
Prompt #10: COD (w/o CoT)
The state transition (rule)
(State_aet[0)
The huppaned enery:
Queation: what's current state too enemy?
(candiddate,
Strectly only (choiic,, teot)
Prompt #11: COD CoT)
transition
(nule)
enery:
The rostte happesed reeey:
Quection: Wat's curnect ctate of 000 eaayy?
(candidete text)
Inswer python
"reasonin": *..."
answer (ext)"
Prompt #12: Tyrion (w/o CoT)
(rule)
start Tyrisn:
The events hasponed to tyrien: (oction_see text)
Desstion: Mat's carvent state tyräon?
Directly anower only (cholce_text)
Figure 8: The prompts and codes used in our experiments (3/5).
18

---

Published as a conference paper at ICLR 2026
Prompt #13: Tyrion (w/ CoT)
tyrsen's
The start state Tyrtass (state [et[[]]
The eurets happrned to Tyrtos: (actios sat text)
Choices: [candidate text)
asswer the Fallowing foraa Jo0n
"asswor" "ext)"
Code #1: Mario
def crate(ctate, action]: get squer
stare "anall marto":
"axper marte"
bieary susstiintartionn "Ts Naris kit by dxaeta"")
e114 state "saper earin":
Sisars_susstiannaattoo "Dess fords get fire flawer?"):
Sinery_svestienteeee "In Nardo kit by Gooaba?"):
elff state "Frre narto":
binery, susstiintartion,, "Is Nerde kit by oxwmar"1)
Code COD
ststejetate, action):
17 state "idle"
blassy, qustile/settee,
suepletous
player?"!;
"alart"
5f alassry quectienaactioe, the away killed cnespectedly (h-2.. stealth takedowe)?");
#355 ctate "aleet"
www.z/..eraareeetirrr "Does the enay pouitively cenform the player's pouitise""):
if binary, binery,.vurteenin
wwtp_//ourdeeeeteeee, 'ts the suppicion urreaclest and the abert timer coprra?"):
srsarrz.uutteeeeeetiee 'Is "death"
killed curing slort state?");
1f saliaay www.stineaaaeeeeee 'ts the away under teavy Fire ar law on health?")
retarm
trough?"):
netur "alert"
away conaat?)):
"darth"
o31F state "netreat")
playar?");
return "enpagre"
If blisary qusstiendacttee, "Is the evey safe and has last costact with the player?"):
1f stisary pet.geeteeeeeeeee,e "Es evay killed whill retreating!")) "darth"
return "dauth" teradea3
triggrrdd stay carnent state
state
Code #3: Tyrion (1/2)
statefstate, action):
partippatio,ss,cion, "Doss Tyrian travel south (exactly south, southeas scsthwaxt))"";:
reture "the lare""
(ssactly southeart, bisary.partien/sccien "Dees Tyrien travel southeest (esectly southwert, not just sooth or wast)?")s
eaxb)?");
retans "The vale"
Sttary.uartinniattee quartinniaccter, "Does Tyrias travel (ssactly west, not northwest sosthvest)"");
reture "the laves"
(esactly Siarryparrion/actiie "Goes Tyrisn travel sotheest (esectly southeast, not just seath or aast)?");
soathuest))");
retars "the cromilree"
state
of saapyy.aartiiniactte "Sees Tyrias travel north (exactly sarth, northeast sorthwart)?");
return "the nertl"
bisary.qactteeie
Tyrias
(essetly
coatheast)?";:
returs "the vals"
57 (laary.quctto//aett. *Goes Tyriss trawel wett (eunctly west, not northeett or toathvert)"");
1f zisary sisary.quactiee reture
quactio(jcctinn "Does Tyrtas traiel sutheset (essctly southeast, not juet costs axet)?");
1f wwtp./aatton/sttiee toeee tyrias trawe outheret (esectly southenst, return "th nast""
weet)?");
Figure 9: The prompts and codes used in our experiments (4/5).
19

---

Published as a conference paper at ICLR 2026
Code #3: Tyrion (2/2)
011f state "The crevelasde":
wwweyyaacteeeaane qutattaratttsss "Gast Tyrten travel nerth (exartly north, not northeast sarthwett]? "
1f hirrry quctie(artiss, "oans tyrton travel rortheast (ecactly northeser, set jast narth or ewet)?";
-xttm the qww.eeeartta... "ases travel ceuth (euactly (eeatll sotterst,
coutheact southwect)");
nntum "th stormaands"
tyrton
wect)*);
retur "the reach"
1f hilrary apactin(acttis,, "tass tyrton travel rarth (reartly north, not rertheact ar sarthwett)")
-ettr "th qaictee(arties. Mases travel
sortheett sumtest))")
nettrn "ths rucc""
tyelon
(exartly soith,
surthwcct)"
netur "dorra"
16 hilrary qussTle(artion "Mass Tyrlon travel sentiuest (exattly sutteest, set jast sumh west?"):
16 hirrayy austtleeacctio, Thans Tyrion travel seutheast (exartly sunteost, set jast sout east]"")
intturn derra"
611F state "the reach":
tyrten travel rerth (exactly north, sertheast sartheest) ()
neturn "the riverlands"
if sinary_quss (ieraattsss,,, "Ooss Tyrten travel rortheast (ecactly northesat, net Just north or eaat??";:
if strary_quust tieecactios, "ooss Tyrlen travel cest (esactiy east, rorthesst southeart)?");
neturn "he starmladss
Tyrion
sxxthwet)?")]:
rcturn "the aesteriands"
1f alnwry,quus qumrryyatteeeaiiin Voos Tyrlen travel sertivest (eeactly northeest, not jast north or waat??":
if tinrry, qwt.eeteeeat, boos Tyrten travel reuth (esactly south, not sootheast or sarthwatt)?"):
return
olif state
"the wsstrrlans"" quteeeytatteeesttsss..
Tyrton
(esactly sast,
touthaart)?");
retur "the riveriads"
1F sinary,guttieee www.taetttttsss *loss Tyrlen travel cortheast (eeactly northeast, not jast north or eatt)?"):
1f htrrrr sinary.gucttied retur
qusttee(scttss, Naass Tyrton travel ceute (saactly south, not cootheact cartheett)))) )
1f qwt.eeittetttss fasee travel cootheact (exactl conthest,
swtt)"";
netur 1th nach""
Tyrton
(exactl
wett?"):
return "the reach"
1f sinary.quettien quectee(artsss, "tues Tyelon travel weet (exartly sest, not northwest or cuttheet)?");:
1f hitrayy quectie(acctass haas tyrton travel certbuest (eeactly nonthert, set jact narth wMd)?"):
retur the dalards'
+11f <tate "the free telasde":
Siarry, gan sian/estisn, "Doas Tyrien travel (enectly eart, not rorthesat or seatheart)?");
"the
1f binary senratin,,,,,,, "Boss Tyrien traved scotherat (sxactly southesat, net just south or wwat?"):
1f tinveryqqu tlanjectios, "Doss Tyrlen travel sooth (enactly south, sootheeat southwat)?"):
neturn the arsteriasie
Tyrion
(sxactly northesat,
ewat)"):
neturn "the north"
"deree")
if sinary.gus qusttaereettt TDoss Tyrion traved rorth (exactly north, not northeast sarthwest)""; )
1f surary_qqus tlen(actios, "Doos Tyrten traved rortheast (exactly northesat, north ewat)?"):
return "hh sterblands
qur return "the reach"
Tyrton
(exactly northwest,
waat)?";
Figure 10: The prompts and codes used our experiments (5/5).
Artifact
Haruhi
K-On!
JOJO
FMA
AGOT
ATLA
Teeefm
11.60
14.60
17.57
20.00
20.73
23.50
Main
Tigumgraphi
11.80
9.20
15.71
16.00
14.64
14.50
4.67
4.70
4.27
4.88
5.05
5.29
17.02
16.84
15.47
18.38
17.71
19.35
Density
0.78
0.76
0.85
0.78
0.70
0.69
Tiefson
11.25
11.33
20.86
17.05
13.57
Minor
Tigunggaph
N/A
7.00
9.89
15.14
11.84
9.29
4.73
4.67
5.01
5.19
4.96
The
18.28
16.24
18.45
18.13
18.64
Density
0.82
0.76
0.73
0.67
0.76
Table 8: Descriptive statistics of artifacts (CFSM count, paragraph count, average vertices ny edges and density). N/A: No minor character in Haruhi.
20

---

Published as a conference paper at ICLR 2026
Artifact
Model
Haruhi
K-On!
JOJO
FMA
AGOT
ATLA
Average
claude-4.0 C
63.50
65.21
58.27
62.23
61.13
61.94
62.04
CFSM
gpt-4.1
61.07
66.40
60.26
61.62
61.58
61.05
62.00
Main
qwone-coder
60.25
65.46
56.38
60.35
60.07
60.83
60.56
claude-4.0
66. 76.74
67.20
57.97
61.78
60.46
62.87
62.84
CPFSM
gpt-4.1
65.89
66.79
59.03
60.83
61.22
61.49
62.54
qwen3-coder
67.62
64.92
58.64
62.37
60.43
63.27
62.88
claude-4.0
65.02
63.82
58.33
64.98
63.12
63.06
CFSM
gpt-4.1
N/A
65.31
66.48
56.61
64.02
62.55
62.99
Minor
qwene-coder
64.38
62.21
57.05
63.75
62.29
61.94
claude-4.0 C
67.58
66.92
59.48
64.91
65.48
64.88
N/A
CPFSM
gpt-4.1
66.83
64.85
58.94
64.69
66.13
64.29
qwen3-coder
65.68
65.94
60.90
64.25
64.89
64.33
Table 9: Comparison of codification models for implementing CFSM and CPFSM.
Scene Update Eyoode enalues action
State Transition
Respond to Scene
(judaor dienacer lavreel
Chancter (pttlyy Accil and
@t: chenccer Ieaehve
42 "Iear"
unloe temiig
Codilia
Al "Ioe""
Tixe"
42+ "Ina"
Pastie CIAM
Beltaviser stalements hasal state action troasition
Next Turn
Next Turn
stadem choracter
02) she action sakee
These Information is Included in the prompt to ground LLM'S response generation
Figure 11: A more specific workflow implementation of CFSM/CPFSM in experiments.
E CODIFICATION MODEL COMPARISON
As shown in Table g including state-of-the-art closed-source LLMS (claude-4, 4. 0-sonnet) and an open-source I.IM 3-dde
a 480B coding model). The closed-source L.MMs 4.1 1 and claude-6 4. 10000--oonn -snnett) outperform in the codification of deterministic CFSMs, where accurate generation of structured code and conditional logic is essential. These models consistently produce cleaner, more reliable transition functions with fewer errors in control flow and state definitions. This reflects their stronger general purposse coding capabilities and better instruction-following behavior, which are critical for constructing full FSM implementations.
(gpt-4.3
In contrast, the performance gap narrows for CPFSM codification, which primarily involves gen- erating semantically meaningful transition questions rather than writing executable code. On this task, the open-source model qwen repoodr-pluu shows competitive results, suggesting that high- quality question generation is less dependent on expert-level coding ability and more on semantic understanding. This indicates CPFSM may be more accessible to mid-scale models and suitable for deployment in low-resource or open-source environments.
F FURTHER IMPLEMENTATION DETAILS
Figure II plots more detailed implementation of the CFSM/CPFSM pipeline, which begins by parsing each plot turn into a scene-action tuple, which is passed through the distilled discriminator to handle three checks for every character: relevance (whether the character affected), activity (active vs. passive role), and condition evaluation for bin Moinary Doinary-queat www.uusstiieeeo on. Irrelevant characters are skipped, while relevant ones are routed to their active or passive CFSM/CPFSM. In CFSM, the codified get_next_stat profile, calling binary-quest on when needed to determine the next state. In CPFSM, the same questions provide logits for transition row, which updates the character's 's state distribution; the most likely state grounds the role-play while the full distribution preserved for uncertainty tracking. After states are updated, the state-to-action step is performed by the small discriminator following
function combines default guards with special rules extracted from the
21

---

Published as a conference paper at ICLR 2026
Artifact
Haruhi
K-On!
JOJO
FMA
AGOT
ATLA
Average
#Character
5
5
11
Codified Profile
20.57
18.50
18.82
18.82
20.81
18.95
19.41
Main
TromptTrans
20.09
18.09
18.72
18.91
20.60
18.68
19.18
Character Updating
20.71
18.05
18.53
18.58
20.10
18.81
Summary
21.11
18.22
17.98
18.93
20.52
18.51
19.21
Codified FSM
20.61
19.09
18.78
19.32
21.28
19.35
19.74
#Character
7
19
7
9.2
Codified Profile
21.21
18.09
21.40
21.66
19.17
20.31
Minor
PromptTrans
20.18
18.13
20.78
21.27
19.06
19.88
Character Updating
NIA
19.51
18.30
21.61
20.81
18.87
19.84
Plot Summary
20.19
18.38
21.16
21.67
18.93
20.07
Codified FSM
20.93
18.74
22.88
21.49
20.02
20.81
Table 10: RP performance comparison with gpt-4. 1 as the RP model and gpt-4. 1-min the discriminator with ROUGE-L as the evaluation metric.
the codified profile, mapping the current state and scene into concrete action behavior. Finally, the scene, state, and action are appended to the role-playing prompt, guiding the larger RP model in generating the character's utterance or behavior.
Distillation Fine-turning To improve efficiency across all classification components, we employ unified distilled discriminator for three tasks: Dinary-queee ion used in _eet_ssststtte at,,, character relevance checking, and active/passive role classification. Rather than querying the role- playing model repeatedly, we distill a compact model from the outputs of gpt - 1 -mini. Specifi- cally, we randomly sample 1% of the discrimination cases generated during CFSM experiments. 3-class
model (O.1B) (He et al., 2021) is trained for 5 epochs on 90% of the data and achieves 79.1% consistency with teacher model on the held-out 10%. This lightweight checker enables scalable and fast evaluation of condition logic throughout the CFSM pipeline.
G MODEL-INDEPENDENT EVALUATION
Table T0 reports complementary results using ROUGE-L (Li 2004 provide model-indeppndent perspective on RP quality following previous RP measurement [Wang et al. 2025c). Because ROUGE measures lexical alignment rather than relying an LLM discriminator, offers orthogonal view of consistency across trajectories. Under this metric, CFSM continues to exhibit strong performance across both main and minor characters, suggesting that its state structured transitions support stable behavior even when evaluated without generative-model judgments.
H OPEN-ENDED RP EVALUATION
To assess how codified approaches perform out- side scripted benchmarks, we construct 200 in- teractive scenes spanning activities such ca- sual play, combat encounters, and negotiation tasks. From each initial setup, simulate role- play for 10 consecutive turns, with actions sam- pled at each step according to the method being tested. The resulting trajectories are then com- pared pairwise between CFSM/CPFSM and cod- ified profile baselines. Evaluation is conducted by gpt-4. acting as a judge, which reviews the two continuations and determines whether one approach better preserves character logic and consistency, whether they are comparable, or whether one fails relative to the other.
LLM Judgement in Open-ended RP
Chou Coasied Phlli (m-4
crisu Cuppal. Prole (pe4l))
oraa Gobted hullss dimac (8-a)
CPEa Codiied Poofee Baanc
Figure 12: Comparison of open-ended RP by LLM
judgment.
Results in Figure 12 show that CFSM and CPFSM consistently achieve higher win rates codified profiles, with notably fewer losses. This advantage is especially evident when evaluated with smaller RP models, where codified profiles often drift hallucinate without explicit state tracking. These
22

---

Published as a conference paper at ICLR 2026
Method
Textual Profile
Text CoT
Text CoT In- In-Context States
CFSM
Correct Interaction (%) Extra Fowarding per Round
88.72
92.36
95.75
96.13
73.84
35.13
1.00
Table 11: Social interaction simulation performance.
Nives horela inders dettonal bodkes
Bigele
parstieed seceabyy
CPSI racoryybllly clpaa the mouiio
Prompiing sosoaani de rnfermetio dea
Ho wathiaan in
Claa aoaiied Proegriion
Figure 13: A case study on how CFSM precisely models key state transition.
findings confirm that codified FSMs not only excel in controlled benchmarks but also provide tangible benefits in open-ended, multi-turn role-play, where long-term coherence and traceable logic are critical.
I SOCIAL INTERACTION SIMULATION
To evaluate the robustness of CFSM in realistic conversational scenarios, we design a social- interaction evaluation that spans five roles (Cuslomer Support Agent, Medical Triage Nurse, Teacher/Tutor, Interviewer, and Project Manager). For each role, we instantiate ten distinct test personas (e.g., impatient customer) representing diverse communication styles and goals, resulting in a broad set of social contexts. Each simulated conversation proceeds as goal-drit noal-driven, multi-round interaction capped at 20 turns, during which the agent must navigate evolving user intent, latent emotional cues, and role-specific behavioral constraints.
Across five roles and ten diverse personas, evaluate models in goal-driven, multi-round (20 turns at most, based on 9pt-4.11 social interactions using two metrics: Correct Interaction, the percentage of turns that follow the role manual, and Extra Forwarding per Round, the average number of additional reasoning or filler tokens required to produce a stable response. As shown in Table [T] textual profiles alone provide decent but imperfect consistency, while adding CoT improves correctness at the cost of substantial extra forwarding due to repeated re-derivation of latent states. Supplying in-context states mitigates this overhead by letting the prompting process simulate an FSM, though at the expense of longer prompts. In contrast, CFSM yields the highest correctness and the lowest forwarding cost because its explicit, compact transition structure allows the model to execute state updates directly rather than infer them anew each turn. Overall, CFSM offers superior behavioral fidelity and computational efficiency for multi-turn social interaction simulation.
J EXTENDED CASE STUDY
Figure illustrates how CFSM captures Haruhi Suzumiya's key state transitions during a film-shoot scene. When Haruhi initiates the SOS Brigade activity, the codified rule h - hr triggered by checking "Is Haruhi initiating SOS Brigade activities or taking charge?", moving her into direciing/commanding state. Later, when Kyon resists her orders and exposes the spiked drink, the rule /22 + h4 fires through "Are others refusing to participute challenging Haruhi's 's authority?", shifting her into a confrontational state. These explicit checks ensure that decisive cues, like opposition to her authority registered, producing transparent and reproducible state update.
In contrast, prompt-only continuation tends to summarize surface events and overlook the turning point that drives Haruhi's is change in behavior. By codifying transitions explicit rules and recording each outcome, CFSM provides clear reasoning traces that ground the RP model's 's next action, ensuring coherent and faithful role-play.
Figure shows three examples of chain-of -firr-uh-tthhhts: Mario's ' item interactions, an enemy's stealth logic in Call of Duty, and Tyrion's 's regional travels. In each case, chain-of-thought prompting correctly
23

---

Published as a conference paper at ICLR 2026
Mario
COD
Tyrion
vesterlanhi
"I. Harto gets seer wotrown seall in seer
steae eikes senstction retse selefly
Thrice treeiss anst free the aesterlants dcca staclacds leads the lnee sclards, ryeic
"c. Rario gits fire floer cape sirio fil
to slagen ctaps lidea satii the alart tike eqp
sorio gite oper
Nacta tus
His seqasco hapenr taten unpicias ontoo
dice
from iclands, tyries touele
"ou doein revents
tosete eans book
ofive idle unale wne wnle,, the aler timer pat appired the indicining after napiccizas refare, the carvent stace adant.
tean mtterlaas. rover
"t. darto peta sapar harte."
lou Tyrics
suaer darso Hari
has effect,
riveriands, trasel narth.
Loods the earth, sox fy narth.
"Threforr,, the corrent state super Harbo."
From sorty, Tyrton travels seeth, South the north to "Sear Zands, T/
riverlands.
From the riverteed. Turiee travels west Nest Tyrtes the westerlards.
tharefore, after all the sand, (prics baok S
Figure 14: Cases of chain-of tiinn--f--thuutttt as simulating FSMs in LLMs solving state transition.
Artifact
Haruhi
K-On!
JOJO
FMA
AGOT
ATLA
Average
Codified FSM
83.88
80.45
78.31
83.89
86.11
83.28
82.65
Main
+ Dynamic States
84.83
81.78
78.02
84.16
85.79
83.64
83.04
Codified FSM
N/A
83.26
80.92
85.74
89.16
83.94
84.60
Minor
+ Dynamic States
82.97
80.27
85.36
88.79
85.02
84.48
Table 12: RP performance with dynamic state maintenance mechanism.
follows the transition rules and produces the right final state, demonstrating that LLMs are capable of mimicking explicit FSM behavior. However, this correctness comes at a steep cost: CoT requires roughly 25 times more forward passes than CFSM to reach the same outcome. By contrast, CFSM executes the codified rules directly, yielding identical results with far greater efficiency. These examples highlight that while LLMs can simulate FSM reasoning in principle, codified FSMs achieve the same fidelity with ordgns-of- less computation and with transparent transition traces.
K DYNAMIC STATE MAINTENANCE
The CFSM framework assumes a finite, codified set of character states extracted from profiles. In practice, however, long-form RP naturally gives rise to emergent or highly specific states that were not anticipated during codification (e.g., rare emotional combinations or situation- -ppecffc role shifts). In the base CFSM, such cases are absorbed into a generic other state, which preserves correctness but under-specifies the character's 's fine-grainet dynamics. To explore how CFSM can flexibly accommodate these emergent states, we introduce a Dynamic State Maintenance mechanism as additional layer top of the codified FSM
Concretely, we augment each CFSM with a dynamically maintained list of refined other-type substates. When transition leads to the generic other r state, the LLM inspects the current trajectory and selects a more specific label from the maintained list. During evaluation, whenever a reference action observed and the CFSM would fall into other, the LLM is asked to clarify what that other state should be (e.g.. "reserved but reluctantly cooperative" vs. "openly confrontational but conflicted") and to add this label to the list if it is not already present. Operationally, we first make prediction with the current FSM, then benchmark that prediction against the ground-trum reference, and only after scoring do we use the reference to refine the dynamic state list. This ordering avoids answer leakage while allowing the system to gradually specialize the state space around emergent behaviors.
Table 12] shows that this mechanism yields a modest but consistent improvement for main characters, while leaving minor characters roughly unchanged on average. Intuitively, main characters accumulate more trajectories and thus benefit more from the incremental refinement of other into a richer set of recurrent emergent states. We emphasize that this dynamic mechanism is an optional extension rather than part of the core CFSM design. It requires online LLM intervention and access to reference trajectories, and is therefore less suitable for extremely lightweight deployments (c.g.. with IB-scale models) where our original one-shot codification is intended to operate. Nevertheless, these results
24

---

Published as a conference paper at ICLR 2026
suggest promising path for combining static, profile-derived FSMs with thin adaptive layer that captures the long-tail of surrative-speciffe states encountered during extended RP.
L SELF-REFINEMENT DISCUSSION
Given that CFSM/CPFSM rely on LLMs to transform textual profiles into executable states and transition rules, an important complementary direction is to incorporate mechanisms that automati- cally assess and refine the generated logic. Recent work on iterative self-reflection demonstrates that LLMs reliably improve their own outputs when placed in structured feedback loops. For example, Self-Refine uses model-generated critiques to progressively enhance an initial draft (Madaan et al. 2023). and Reflexion shows that explicit self-evaluation can guide agents toward more accurate reasoning trajectories (Shinn et al. 2023). In code-centrie settings, self-debugging methods similarly prompt models to inspect and revise generated programs using execution feedback (Chen al. Zhong al. 2024).
2024h
These developments suggest natural extension for CFSM/CPFSM: after producing an initial FSM, the system could engage in light self-reflection cycle by probing transitions with synthetic queries, checking reachability, or comparing behaviors against profile descriptions, and then prompting the LLM to refine the codified rules accordingly. Such self-refinement would complement our current automatic codification pipeline and offer an additional layer of reliability, particularly when scaling to richer more ambiguous character profiles. We view this integration promising avenue for future work.
M FANDOM BENCHMARK DETAILS
Existing role- play-playing ovaluations emphasize turn-by-turn dialogue rather than grounded, situational actions, and frequently rely LLM-ssyttesizzed sparsely annotated data (Wang al., 2024b
2025c 2023 Chen et al. 2024a). The Fandom Benchmark (Peng & Shang 2025) addresses this by framing evaluation around behavior concrete story contexts.
Narrative segments are sourced from Fandom where gpt-4. extracts character actions from each storyline segment; the preceding text becomes the scene. Each scene-action pair is augmented with guiding question (also produced by gpt-4. ..1) 1) that keeps responses reference-relevant without revealing answers. At evaluation time, the role-playing model receives a spoiler-free character profile (cleaned by gpt -4 1), the scene, and the question, and must predict the next action. Predictions are scored with an LL-M-bssed NLI judge: entailed = 100, neutral = 50, contradiction O.
The benchmark spans six widely known artifacts across media and genres: Suzumiya Haruhi (Haruhi), K- K-On!, JOJO's 's Bizarre Adventure (Season 3), Fullmetal Alchemist (2009), A Game of Thrones (Seasons 1-3), and Avalur: The Last Airbender (Book One): covering 83 characters and 5,141 scenes. Profiles are long-form and structured (roughly on the order of ~ words and 15 paragraphs for mains), enabling evaluation of consistent. context-aware behavior extended narratives. Table lists character summaries and example profiles. Table further lists story summaries to complement background contexts.
hhtps://www.faddom.com///
25

---

Published as a conference paper at ICLR 2026
Hanhi
An eccentric. high high schooler curleitt and offheat woddrize series extraediinry
Harshi
Krnn
dry windd progran sndert who
Hambh Surumnya's relectant grounded companior. insetable SOS Brigale member disinguideeil by les excepiinnal imcllss and engguric wherourilyy
the
Nagalo
Kouami
who suppars de Beiqule while leeping cneia sccres cliss. shy, gente upperdiasman dnaiel inoo the SOS Brigale their adonble, mysictoos "musco"" olten
perpouully sailing trusfer audent and
Asalina
up in their schemes.
Yu
The cheertul, tul, zirtended lead guitasst of the ligtt muse cub. whose boundles cehressse and love of sweets-pneg ppeppes-ppsssss the hond forward.
Rasu
The high-ppitted mischievets drumner whose playful antis und ladeeship keep the grop lively and in syas.
Mio
bubftu yet tighly skilled basist, gende by satur and gilted with keen maskal seudilliy
K Onl
Megi
Tarmy Kotebnko, wambbrriod well-inedu keyheanlie who delight maaingg friend and cariching club life
Areua
dlligens tolcutad jusior guitaric who qpickly beames indipensshl the chub's wond and diuipline.
Sunako
light musi club's i advisor and fomee had rocker encouagins teucher hibken metal side appeurs when music calls. Yol helping
langin:
postical
Ui
coring, romsrlablyy capilk sounger
suppotive bath
Jun
luid
whose eayygingg
rounds
grop's everyday
Bdward
akcanis who pentl, kinllasescd buy whise and roidss in lonarngg vii of ammrrr jouruyynng with his beother madaiin their ledd sclvew.
bnillian,, stoog-ailled
seeen his and his brother's 's betlis after a diostnnte trmomstaiion,
Alphomen
Paltronal Aichenit
Winry
gilsd anonsall engineer and childhod frizal of the Brics known hes machanca cupurine and compasiionaa reedive chanomatic, anbmots Stoe Aschomet master of tame, detemmiedd to reforn the milrary from within.
Kay
Ling
A chamnin droee prince from Xing soeking immoraliy while horingg a delp ieponsbiiiyy his people.
Lawy
sprecul, shape shifting Homuncalts whose malice toward humanit fiels their curning cruelty.
trom
Irami Cartis a feaniome alchemi and mortial and memees the lines with toigh love and incorppemminng standards. callathring Homuszubs with lettal, extendable clows prrsinn enigmalic pusls betind veocer of prine.
Lase
Scar
gitt eventet murked by targtting Stae Alchemisis is retibattoo
devatution his people.
Greed
weeddy, allver uragued Honurculss drives by boundless desire capable of ferce loyaly and independence. Musting's
Howkyye shaqpdoenee femidalle
Humunclas listicrunt, conacal deaily parness behina
thecppine:
spict scaddee
King Bradley
Jonaro
high schooler "Surdast Crusadess' proagraiit funed
Plaiiun unyielding Stand Silver Chariot.
Polnzreff
Caraders, wolking qiidk-hiniing, begu--fan life lesttr whese nickery and brovain "Hi "Yirr nod line is "-lura ballica their lanal. charismatic, merclles vampire whese tweeing auhison and "Zu Wardd!" dofas him icusc senzsis.
brave. fumbboynn French swordenan
2O10's Bizare Advestue
Toseph
DEO
Kalegoin
cool, analynccll oily "Soetti Croedenn"" lighting with the merrkk-rring Stand Hiemphant Green.
Aviial
wise, laysl Fgypron Send oor whew Magician's Ral brans herr flome and mossering support. A varly Booon Terreer Sondd nor with sode for coflee pun, whoae nilcctore heniic prose indilable.
Iazy
Hot Hoese
veaggening preslingr who mangetane fors with Impprce settectt roveive Stard conen mmageeie whowe Stndd Sallen regresivvly mms victins into yrunge versione of themorhees deadly games. teisinng chance
Alooi
Duuuby
devious ganiblr who stkes
Steely
sadistic schererr whose Stand, Lovers, indinnzes minds control and opponents from
fonsicalll loyal executiones wichinn
Cream ersse whitever devours esistence DIO's
Eaya
minded dupeshifter whose Klaum,
minis
comedic effeet with beather Boingo.
Pei Shep
DDO's nubless faloon sommee hypreimelllgnn peantion armol with ice-forging Stand Horas,
Boingg
timid acsestric guidusi Tiolth, prophatic comic-book Stndd whos litell prodictions lead hisem outeames.
Tyrion
The shap uogued youngest Lanniter, Tyrins survives Westerssi politics with wit, sevv, and gallows humor despite lifllong scom for his suaue.
Daanerys
The csiled Taegsnyen prinss who hegine a timid posu and grows into a noselste, prnooscckingg laaker
Cersi
An arbiiios,, cakculating quace whase beauty masks mubless doceiim to her fumily and hold on power.
Jame
The fumed Kingsloger chansmans.. lethal, and conficceed whose outhhound life and loyzllees are anythin bet simple.
Robb
The honomble hetr Winterell, thrst eary ino commend and duyy his family' fare.
Estdadd
The sosttist Lardl Winzefell. man ander hanor servnn is Warden the North
Arsa
finuelly independem Stukk dugghtrr esjests courth expectations practicllity.
fieddar and steel.
Curlya
The resotute Lady of Wineerell. guided by diece matemal loyulty
chughtirr prova
contrryy
lonsh ccality.
Jus
Edited'ss beolling bastanl
Wateridll drisen idmily daty
G of Thones
Brus
surions scum--ya--oll Stuk whese calastoplic fill bim ancapssied fateul puth.
Tywin
The implaable Lamiiter perianch renovene for relanleee strttgy and ellicioncyy and inveclad cuniurityy
Varys
"The Spider" aillppless musker whisyerer whise wct of infommats
the noaln.
Jottrey
The criel, perilam croen piice. vom and vindictve beneath polcen veneer
Theo
The cocky Groyoy heir, Stark ward where stogger masks divied loyalties
Starnic
Roben's strn younger bnother grinly commited to lww climm and in poommmniinn duty.
Linlefigge
Pecy: Baelih. silver intgued muster of coin who dints throgh matipulatoo and pation plots.
Melicandee
A red prisstess of Ascha, wielding ussetting fallt and shadowed magic it service R. d'hilo.
fonds
diggnccal knight Rear Iehand who basone Dacrary''s sezoonal sicadlied scrieer caile.
Sunderr
"The Houal"" beutally frask worriee asemal in Dedi and spiii, soom gund the nyal heir.
Shae
sharp, allurin cump fillower who brcomes Tydin's intimate compotion anid war and insigue.
Margary
polsed potrically amme Tyrell
calculation foorhh court
phon-epubenn
smaglhr Kaight" handsone, attable. anbisausy beloved. deadly, pragmatic
Realy
Brern
sandonic
open the
Bneenee
Barritan the Bold, Turth
towering
defynng
pursutt tree keighthood.
Burrictas
yet lageralrry Kinggard kmmle defincal daty and dignity.
Mance
The charienttic King Beyond dee Wall who furge the wildings isto single
Crister
couel wilding purtacch incanoos fix inces and sactificing
the Obien
Oloneo
The nomewittell "Queen of Thoms" Tynil marrech and mostre borieel palliiking
ANaLE The Last Niberaer
Kauaa
Aute
The las. Aitbender und reluciast Aratan, playfal by aauuee set bunkesed to cestrre balance to world at was. A compasionats, drives watebeuddrr from the Southern Tilbe who anchors die grou and challenges isjustic. pipp-herry. insritiee womnur whost hommenggg and ingruity wlrn eaee day
Zuko
The cailel Fire Nation prinar. desind by woring quai for hune taat basmas a jeurncy of selfecoddiniiinnn
Inch
los-innng groni quee
prite sephow lezaer anti-Fine Nation of plary ruthiss
nagasii
Yue
formdable Warner capean. discplined, Morn and Sercety penccpped.
Northem whose
survival.
Siki
Anng' acodiast flying
migryy and venerable Northem master waisrberder, strict mndiion yet capuble of change.
smiggle allen
Pukku
Table 13: Simple background information of characters in experiments.
26

---

Published as a conference paper at ICLR 2026
Artifact
Concise Abstract
Haruhi Suzumiya
A high-energy, reality-bending school comedy-mystery following the eccentric Haruhi the SOS Brigade. The nurrative blends slice-of-life anties with superuturall disruptions that reflect Haruhi's unconscious influence on the world. Kyon's grounded perspective anchors group's 'ss chaotic investigations.
K-On!
A warm, music music-driven driven coming of age comedy centered on the Light Music Club's daily life. The story emphasizes friendship. lighthearted humor, the gentle growth of its members as they learn instruments, perform, and bond through shared routine.
Fullmetal Alchemist
A dark adventure about two brothers using alchemy to restore their bodies after a forbidden transmutation. The narrative mixes political intrigue, moral conflict, and philosophical questions about sacrifice. identity, and the cost power.
JOJO's Bizarre Adventure (Part
A globe-trotting supernatural buttle saga where Joturo and allies confront DIO through Stand based combut. Known for stylish fights, tactical mind games, and eccentric character dynamics that mix comedy with high- stakes drama.
Game of Thmnes
A spraw ling political fantasy depicting rival houses struggling for power amid betrayal, war, and shifting alliances. The story juxtaposes personal ambition with looming supernatural threats. focusing moral ambiguity and the fragility of order in Westeros.
Avatur: The Last Airbender
A character-driven epic about Aang's journey to master the elements and end century-long
war. Balancing hamor, action, and emotional growth, the story explores identity, redemption, and weight of responsibility.
Table 14: Coneise story information of artifacts in our experiments.
27


Reviews:
[{"review_id": "xOhckrqkjT", "reviewer": "Reviewer_u1Hi", "summary": "This paper proposes Codified Finite-State Machines (CFSM), a framework that enhances character consistency in LLM role-playing by automatically extracting and codifying character states from textual profiles. CFSMs transform character descriptions into explicit FSM structures using LLM-generated logic, grounding behavior in interpretable state transitions. A probabilistic extension, CPFSM, further models transition uncertainty by maintaining distributions over states. The paper evaluates the approach in both synthetic state modeling tasks and large-scale narrative role-play (via the Fandom Benchmark) and demonstrates improved consistency, interpretability, and transition traceability compared to prompt-based methods. Ablation and cost analyses show that CFSM/CPFSM are scalable and effective, offering a hybrid symbolic–neural approach to stateful role-play generation.", "questions": "See in weakness.", "limitations": "", "rating": 4, "confidence": 3, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "- The codification of character logic via FSMs, driven by LLMs, presents a novel mechanism to preserve behavioral coherence in long-form role-playing.\n\n- Experimental results show a clear improvement in behavioral consistency after introducing CFSM. Whether in synthetic tasks (e.g., Mario state transitions) or real narrative scenarios, characters’ state transitions become more coherent and believable. CFSM and CPFSM effectively reduce the confusion and inconsistency commonly observed in prompt-based methods. Notably, CPFSM enhances the subtlety and realism of character responses by modeling weighted reactions across multiple plausible actions through probabilistic transitions.\n\n- Unlike prompt-only state modeling, CFSMs generate explicit transition rules, enabling better control and debuggability in interactive settings.", "weaknesses": "The proposed framework heavily depends on the LLM to extract states and generate transition rules. If the LLM-produced code contains errors or omissions, it may compromise the correctness of the resulting finite-state machine. The paper provides limited discussion on how to validate or correct the logic generated by the LLM, leaving the reliability of the approach partially contingent on the quality of the LLM’s rule extraction process.\n\nAnother concern lies in the current evaluation, which primarily focuses on the Synthetic Validation setup and the Fandom Benchmark — both emphasizing narrative-driven scenarios and character-centric tasks. While these datasets are structurally sound and semantically rich, it would strengthen the work to include more conventional evaluation settings, such as open-domain human–AI dialogue, task-oriented dialogue systems, or social simulation environments. Extending the experiments to broader multi-turn dialogue contexts would better demonstrate the generality and transferability of the proposed CFSM/CPFSM framework.\n\nIn addition, incorporating more objective and independent evaluation metrics would provide a more comprehensive assessment of model performance. The selection of baselines also appears somewhat limited: although Codified Profile and PromptTrans offer partial validation of the proposed design, the absence of stronger or more up-to-date baselines weakens the comparative significance. Including results against more advanced or representative methods could substantially enhance the paper’s empirical rigor and impact.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "ir2iNe4BcY", "reviewer": "Reviewer_wsJe", "summary": "This paper proposes CFSM and CPFSM for roleplaying tasks and games with LLMs to ensure behavioral coherence. This paper contributes by offering a framework that defines character transitions and extends it to a probabilistic version to offer multi-modal transitions. Authors have compared and presented the limitations of the LLMs in Section 4 while also showing that CFSM is superior to the baselines compared. The Authors have also discussed the setup and case studies considered for the real plot experiment. The number of models used for the experiment is good, considering the innovation is a technical advancement with LLM rather than the performance of the LLM itself.", "questions": "Detailed suggestions:\n1) NLI full form could be better when referenced first.\n2) Best@K can be explained.\n3) Figure 4 Caption: There is no space between CFSM&amp;CPFSM.\n4) Line 109 - evolve should be “evolves”.\n5) Line 223 - w_i,j “is” then normalized.\n6) Line 225 - in binary_questions, how the logits w_i,j are derived from the\n“Yes/no/unknown” question. This can be explained in detail.\n7) In Tables 2, 3, and 4, 6, the units of measurement are missing; it would be reader-\nfriendly to add them.\n8) In the baseline, #Character is mentioned for each show, but lacks a reference to it. For\nexample, Haruhi mentions 5 Characters and AGOT 11, but a brief description of at least\none of the artifacts, such as JOJO, its characters, and the context of the scene, and\nprofiles would be intuitive for readers to analyze the results better.\n9) Multi-modality and transitions of CPFSM can be explained in detail.", "limitations": "", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "1) The described methods work on various artifacts mentioned in the results, while\ndemonstrating the strong performance against the baselines.\n2) The paper mentions the computational complexity for the both methods and shows\nfaster and efficient codification for the proposed methods.\n3) This paper includes a very detailed analysis section mentioning synthetic and real plot\nexperiments, and is tested with multiple LLM models and techniques, and has various\nkind of plots and scenes from various genres.", "weaknesses": "1) The “preliminary and denotation” introduces the necessary terminology but lacks\nexamples and a lucid explanation, which can be really helpful for the readers and the\ngeneral audience unaware of such methods.\n2) The multi-modality and reactions of CPFSM lack depth and can be explained more\nclearly.\n3) The real plot experience can briefly explain one of the artifacts used in the work as a\nrunning example. Not having this makes it lless intuitive for new readers.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "vrftjTWXVg", "reviewer": "Reviewer_VmPa", "summary": "The paper introduces Codified Finite-State Machines (CFSMs), a framework that leverages large language models (LLMs) to automatically extract character states and generate executable state transition logic for role-playing (RP) agents, aiming to improve consistency and interpretability relative to prompt-based approaches. An extension, Codified Probabilistic FSMs (CPFSMs), models character states probabilistically, supporting nuanced transitions. Empirical validation includes synthetic (game-based) and real-world (Fandom Benchmark) RP tasks, demonstrating improvements in behavioral consistency, efficiency, and interpretability over established baselines.", "questions": "1. What is the meaning of \"multimodal\" in Line 053, and \"multi-modal\" in Lines 070, 080, and 092?\n2. How would CFSM/CPFSM scale to open-world/large-scale RP where thousands of (possibly compositional) states, or dynamically constructed state sets, are needed? Any memory, efficiency, or codification tests on \"harder\" synthetic FSMs or real-world systems?", "limitations": "", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 2, "strengths": "1. Interpretability: The framework brings interpretability to state modeling in RP with executable, codified transitions derived directly from character profiles.\n2. Probabilistic Extension: The CPFSM mechanism elegantly integrates stochasticity into state transitions, explicitly modeling uncertainty in RP.\n3. Efficiency: CFSM delivers both accuracy and efficiency, as highlighted in Table 5.", "weaknesses": "1. Evaluation Scope (Generality): Empirical testing relies primarily on the Fandom Benchmark and three synthetic state machines. The real-world scenarios are derived from highly narrativized, structured data (Fandom plots) with limited diversity of state-space complexity and ambiguity. GPT-4.1 is both judge and model in several settings, and open-ended role-play evaluations rely heavily on LLM judgment. There is insufficient third-party or human evaluation of RP quality, which may limit claims of generality.\n2. Limited Handling of Dynamic or Emergent States: The model assumes a fixed state set per episode. The limitations of this assumption are acknowledged in Appendix B but not addressed experimentally. Open-world RP often demands dynamic state growth or on-the-fly trait acquisition, which is not modeled or empirically probed in the present study.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:

Decision: Accept (Poster)