Next Article in Journal
A Survey of Machine Learning Approaches to IoT Security
Previous Article in Journal
Data-Driven Dynamic Pricing for Mitigating the Hockey Stick Effect: A Hybrid Forecasting and Actor-Critic Reinforcement Learning Framework
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
This is an early access version, the complete PDF, HTML, and XML versions will be available soon.
Article

FictionRAG: A Stateful Metacognitive Framework for High-Fidelity Long-Narrative Role-Playing

1
School of Computer and Communication Engineering, Northeastern University, Qinhuangdao 066004, China
2
Research Institute of Unmanned Systems, Beihang University, Beijing 100191, China
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Algorithms 2026, 19(5), 383; https://doi.org/10.3390/a19050383
Submission received: 27 March 2026 / Revised: 27 April 2026 / Accepted: 4 May 2026 / Published: 11 May 2026
(This article belongs to the Special Issue Generative AI Meets Agent-Based Modelling and Simulation)

Abstract

Maintaining high-fidelity character personas and tracking trusted narrative facts remain significant challenges for LLM-based role-playing systems, particularly in long-context scenarios. Traditional Retrieval-Augmented Generation (RAG) approaches, which typically rely on static, stateless retrieval, often struggle to capture evolving plot dynamics, leading to character hallucinations and logical inconsistencies over prolonged interactions. To address these limitations, we present FictionRAG, a novel stateful retrieval-augmented framework designed to enhance long-narrative role-playing. FictionRAG introduces a hierarchical memory architecture that decouples narrative information into three distinct lanes: factual events, persona traits, and worldview constraints. Furthermore, it employs a failure-driven metacognitive regulatory loop that dynamically identifies and corrects retrieval deficiencies—such as persona drift or conflicting world rules—before response generation. By treating role-playing as a dynamic state tracking problem rather than simple question answering, FictionRAG ensures that generated responses are strictly grounded in both the narrative timeline and the character’s psychological profile. Extensive experiments on a dataset comprising twenty classic novels demonstrate that FictionRAG significantly outperforms existing baselines in factual accuracy, persona stability, and worldview consistency. Beyond literary role-playing, these results suggest that stateful, evidence-constrained retrieval can serve as a general mechanism for long-form controllable generation tasks that require persistent state tracking and multi-dimensional consistency.
Keywords: role-playing; Large Language Models; Retrieval-Augmented Generation; stateful reasoning; dynamic memory; persona consistency role-playing; Large Language Models; Retrieval-Augmented Generation; stateful reasoning; dynamic memory; persona consistency

Share and Cite

MDPI and ACS Style

Deng, Y.; Zhang, Y.; Yang, J.; Fang, M. FictionRAG: A Stateful Metacognitive Framework for High-Fidelity Long-Narrative Role-Playing. Algorithms 2026, 19, 383. https://doi.org/10.3390/a19050383

AMA Style

Deng Y, Zhang Y, Yang J, Fang M. FictionRAG: A Stateful Metacognitive Framework for High-Fidelity Long-Narrative Role-Playing. Algorithms. 2026; 19(5):383. https://doi.org/10.3390/a19050383

Chicago/Turabian Style

Deng, Yifei, Yudong Zhang, Jingpu Yang, and Miao Fang. 2026. "FictionRAG: A Stateful Metacognitive Framework for High-Fidelity Long-Narrative Role-Playing" Algorithms 19, no. 5: 383. https://doi.org/10.3390/a19050383

APA Style

Deng, Y., Zhang, Y., Yang, J., & Fang, M. (2026). FictionRAG: A Stateful Metacognitive Framework for High-Fidelity Long-Narrative Role-Playing. Algorithms, 19(5), 383. https://doi.org/10.3390/a19050383

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop