Abstract
In the domain of algorithmic decision-making, non-Markovian dynamics manifest as a significant impediment, especially for paradigms such as Reinforcement Learning (RL), thereby exerting far-reaching consequences on the advancement and effectiveness of the associated systems. Nevertheless, the existing benchmarks are deficient in comprehensively assessing the capacity of decision algorithms to handle non-Markovian dynamics. To address this deficiency, we have devised a generalized methodology grounded in category theory. Notably, we established the category of Markov Decision Processes (MDP) and the category of non-Markovian Decision Processes (NMDP), and proved the equivalence relationship between them. This theoretical foundation provides a novel perspective for understanding and addressing non-Markovian dynamics. We further introduced non-Markovianity into decision-making problem settings via the History Aggregator for State (HAS). With HAS, we can precisely control the state dependency structure of decision-making problems in the time series. Our analysis demonstrates the effectiveness of our method in representing a broad range of non-Markovian dynamics. This approach facilitates a more rigorous and flexible evaluation of decision algorithms by testing them in problem settings where non-Markovian dynamics are explicitly constructed.
1. Introduction
Decision-making algorithms, such as RL, generally demand that the problem satisfy the Markov assumption, which posits that the current observation encapsulates all accessible information for decision-making, rendering past observations irrelevant. However, many real-world systems do not adhere to this assumption. For example, control systems often exhibit non-Markovianity due to limited sensor information about internal states [1]. Similarly, open quantum systems display non-Markovian characteristics due to complex interactions with their external environment [2]. Such non-Markovian environments are prevalent in real-world applications, including human physiology, biological systems, and material science [3].
To characterize and solve non-Markovian decision problems, a variety of theoretical models beyond the basic MDP formulation have been proposed. These approaches primarily follow two conceptual strands: state abstraction and reward specification.
The first strand aims to convert an NMDP into a solvable MDP by learning a compact representation of history. Markov Abstraction methods [4,5,6,7,8,9,10] fall into this category, where the core idea is to compress the entire history or learn an approximate Markovian state, effectively “solving” the non-Markovianity through representation learning. While powerful, the quality of the abstraction is algorithm-dependent and may inadvertently alter the problem’s inherent difficulty due to information loss.
The second strand focuses on formally specifying the non-Markovian structure, particularly in reward functions. Automaton or logic-based models, such as Reward Machines (RM) [11,12] and Regular Decision Processes (RDP) [13,14], use finite-state automata or temporal logic to explicitly encode complex task objectives and reward dependencies over time. These methods excel at providing interpretable task specifications but are primarily designed for non-Markovian rewards rather than general state transition dynamics.
While offering valuable tools, these existing theoretical models are diverse in formulation and objectives. Crucially, they are often designed to eliminate or specify non-Markovianity for the purpose of solving a given problem. In contrast, there lacks a unified framework to systematically construct non-Markovian problems with controllable temporal dependencies from first principles, a capability essential for generating standardized benchmarks to impartially evaluate algorithm performance. This gap motivates our work.
Table 1 compares our approach with representative paradigms in the literature at the conceptual level. Unlike methods that aim to “solve” non-Markovianity (e.g., by learning abstractions, specifying rewards, or handling partial observability), our HAS framework aims to “construct” non-Markovianity. This provides a generative paradigm that starts from a base MDP and yields NMDPs with clear, controllable dependency structures. Consequently, it enables a pure evaluation of an algorithm’s capability in history memorization and decoding, disentangled from changes in the inherent problem difficulty or confusion with distinct problem classes like POMDPs.
Table 1.
Comparison with representative paradigms for handling non-Markovianity.
In response, we establish the MDP category and the NMDP category, providing a unified and rigorous view within the framework of category theory. Under this framework, any general approach that converts NMDPs into MDPs while preserving the transition dynamics can be seen as a functor from the NMDP category to the MDP category. This framework not only encapsulates the essence of preceding research but also paves the way for devising novel strategies to tackle non-Markovian decision problems. Moreover, the utilization of the category theory perspective facilitates a deeper understanding of the relationship between MDP and NMDP. We prove that the MDP category and the NMDP category are equivalent categories based on the intuition that any NMDP can be transformed into an MDP, given that the entire history can be regarded as a state.
Numerous algorithms have emerged to solve non-Markovian decision problems. However, an algorithm that is both commonly accepted and highly effective for NMDPs remains elusive. The evaluation of such algorithms relies on non-Markovian decision problems, which poses a set of challenges. For instance, ref. [15] utilizes a multi-armed bandit and robot grid world with non-Markovian rewards; ref. [3] employs a blood glucose control simulation environment; ref. [5] uses Rotating MAB, Malfunction MAB, Enemy Corridor, Reset—Rotating MAB, and Flickering grid; ref. [16] uses an office grid-world scenario; ref. [17] uses modified Mujoco environments; ref. [18] uses modified Cartpole and mountain Car, along with a controlled non-Markovian random walk. The non-Markovian environments described in the literature, which are scattered and unsystematic, originate from diverse fields. Moreover, most of these environments are either obtained through simple construction or derived from masking some part of the observation in existing MDP, that is, by transforming it into a Partially Observable MDP (POMDP), which may change the internal difficulty because of information loss in the observation. Their simplicity and lack of standardization impede the development of a universal benchmark, thereby limiting the ability to comprehensively evaluate how effectively algorithms can manage non-Markovian dynamics.
To address this gap, we develop a method for constructing NMDPs from MDPs via a reversible History Aggregator for State (HAS). The core idea is to inject controllable temporal dependencies into the state representation by aggregating historical states. The reversibility condition is crucial: it ensures the original MDP state can be losslessly decoded from the NMDP’s full history, thereby preserving the problem’s inherent transition dynamics and optimal performance bound. This allows for a pure assessment of a decision-making algorithm’s core capability in memorizing and decoding history to manage non-Markovianity, isolated from changes in base problem difficulty.
We propose two practical, reversible HAS implementations. The first employs a group operator (e.g., vector addition) for aggregation, inspired by how prefix sums increase Markov order. The second uses convolution with an auxiliary sequence to assign time-decaying weights to past states. As states are typically real-valued vectors, both methods are efficiently implemented using linear algebra. Critically, the constructed NMDPs maintain the same interface as the original MDP, enabling the direct application of any algorithm without modification. This facilitates a direct comparison of performance degradation solely attributable to introduced non-Markovian dependencies.
In summary, this work establishes a new paradigm for principled construction and evaluation in non-Markovian decision-making. Our primary contributions are:
- A Unifying Categorical Foundation: We establish and prove the equivalence of the MDP and NMDP categories, providing a unified theoretical lens.
- A Generative Framework for Controlled Non-Markovianity: We introduce the reversible HAS framework to systematically construct NMDPs with precise, tunable temporal dependencies from any base MDP.
- Practical, Tunable Construction Methods: We instantiate the framework with two implementable HAS classes (group-based and convolution-based), enabling fine-grained control over dependency structures.
- A Practical Benchmarking Tool: We provide efficient Gymnasium-compatible wrappers to seamlessly convert standard RL benchmarks, enabling reproducible, pure evaluation of algorithmic memory and decoding capabilities.
The ultimate goal is to shift from ad-hoc problem adaptation to principled problem construction. The outcome is a coherent pipeline that transforms canonical MDPs into a family of NMDP benchmarks with clear, tunable non-Markovian characteristics, filling a critical gap in the evaluation toolbox for sequential decision-making.
In Section 2, we introduce the fundamentals of category theory, MDP, and NMDP, along with the basics of algebra. This serves as essential background for understanding our work. In Section 3, we formally describe and prove the equivalence of the MDP and NMDP categories. This not only unifies the two concepts but also naturally leads to the method of constructing NMDPs in the subsequent section. Section 4 presents the definition of HAS, two construction methods using reversible HAS, and an analysis of their properties. These methods innovatively introduce non-Markovianity while preserving the original nature of the problem. Although the main contribution of our work is theoretical, we convert some classical MDPs into NMDPs and conduct several empirical experiments using some RL algorithms in Section 5. This validates our theoretical framework and demonstrates its applicability. The Appendix A, Appendix B, Appendix C, Appendix D, Appendix E, Appendix F, Appendix G, Appendix H, Appendix I, Appendix J, Appendix K and Appendix L provide mathematical proofs, illustrative examples, and intuitive explanations of key concepts. This allows the main text to focus on the key ideas without being cluttered with details. Overall, our work offers a comprehensive, novel, and practical solution for constructing non-Markovian decision problems.
2. Preliminaries
2.1. Notations
In the following, we denote by the set of all probability distributions on the set X, denote by an n-variable function created from the unary function f in the manner of , and denote by a finite sequence . We do not distinguish between and in the following.
2.2. Category Theory
A category is a system of related objects. The objects do not live in isolation: there is some notion of morphism, or equivalently, map, between objects, binding them together [19]. Category theory delves into the relationships between objects and morphisms. Objects can be of any nature, and morphisms denote the relations or transformations linking these objects. For example, all groups together with all group homomorphisms form a category of groups, and any partially ordered set can also form a category. This theory offers a potent framework for apprehending mathematical structures. By distilling common traits, category theory allows for a unified analysis across diverse mathematical domains. It uncovers profound connections and streamlines intricate concepts, presenting a more coherent view of mathematics.
Definition 1 (Category).
A category consists of:
- a collection of objects;
- for each , a collection of morphisms from to ;
- for each , a functioncalled composition;
- for each , an element , called the identity on .
satisfying the following axioms:
- associativity: for each , , we have ;
- identity: for each , we have .
Just as morphisms convey intra-category object relations or transformations, functors represent inter-category ones.
Definition 2 (Functor).
Let be categories. A functor consists of:
- a function written as ;
- for each , a functionwritten as ; satisfying the following axioms:
- –
- if in ;
- –
- if .
The collection of functors from to also forms a category .
2.3. Algebra
Definition 3 (Semigroup).
Let S be a non-empty set, is a binary operator, if the following axioms hold:
- closure: ;
- associativity: .
Then forms a semigroup.
If there exists a unit in a semigroup such that , then becomes a monoid.
Definition 4 (Group).
Let be a monoid, e is the unit, if the following axiom holds:
- inverse: .
Then forms a group.
If the operator in a group is commutative, i.e., , then is an Abelian group.
Definition 5 (Ring).
Let R be a non-empty set, if forms a semigroup, forms an Abelian group with unit , and the following axioms hold:
- left distributivity: ;
- right distributivity: .
Then forms a ring.
If the operator · in ring is commutative, then becomes a commutative ring, and if is a monoid with unit 1, then becomes a unital ring with unit 1.
Definition 6 (Left -Module).
Let be a ring, be an Abelian group, if there exists a map under which the image of any is denoted as , and the following axioms hold:
- -distributivity:
- -distributivity:
- associativity:
- identity: if is a unital ring with unit 1, then .
Then M is called a left R-module.
A left R-module is a generalization of a linear space. When R becomes a field, left R-module M becomes a linear space.
2.4. MDP and NMDP
Before setting up the MDP and NMDP categories, we define them.
Definition 7 (Markov Decision Process (MDP)).
An MDP is a tuple consisting of:
- Initial state distribution ;
- State set S;
- Action set A;
- Transition dynamics at time t:
A policy for an MDP at time t is defined as . An MDP is called degenerate if , which means there are indistinguishable states in S.
Note that, by definition, an MDP is not necessarily time-homogeneous. However, any non-time-homogeneous MDP can be converted into a time-homogeneous MDP by extending the state set S to be a subset of , where each state is associated with its timestep, i.e., and .
Definition 8 (Non-Markov Decision Process (NMDP)).
An NMDP is a tuple consisting of:
- Initial state distribution ;
- State set S;
- Action set A;
- Transition dynamics at time t:
A policy for an NMDP at time t is . The history set at time for an MDP or an NMDP is , with which transition dynamics and policy of an NMDP can be rewritten as , . The history set H for an MDP or an NMDP is defined as the disjoint union of all , i.e., . The proper prefix relation between h and is denoted as , indicating that h is a proper prefix of , i.e., and .
With the concept of the history set for both MDPs and NMDPs, we can define operators that extract states, actions, and rewards from a history.
Definition 9 (States, Actions, and Rewards Extraction Operators).
The states, actions, and rewards extraction operators are:
- ;
- ;
- .
Definition 10 (Latest State, Action, and Reward Extraction Operators).
The latest state, action, and reward extraction operators at time t are:
- ;
- ;
- .
3. Equivalence of MDP and NMDP Category
In this section, we present the definitions of the MDP category and the NMDP category, together with the theorem regarding their equivalence relationship. The proofs of their well-definedness are provided in the Appendix A and Appendix B.
Definition 11 (MDP Category).
is a category where:
- Objects: The objects are MDPs in the form of ;
- Morphisms: A morphism from to where , , , satisfies the following properties:
- –
- ;
- –
- , .
Identity: ;Composition: composition of and is .
Definition 12 (NMDP Category).
is a category where:
- Objects: The objects are NMDPs in the form of ;
- Morphisms: A morphism from to where , , , satisfies the following properties:
- –
- ;
- –
- , , where .
Identity: ; Composition: composition of and is .
A morphism in either category represents that the transition dynamics of the source decision process can be “simulated” by the target.
As discussed in Section 1, previous algorithmic works have sought functors in , which can generally be summarized as approximations of the Markov abstraction functor , utilizing various techniques to compress history. In contrast to what is described in the existing literature, our definition of Markov abstraction retains the entire history without any compression.
Definition 13 (Markov Abstraction).
Markov abstraction is a functor . For any there exists , , , which satisfies the following properties:
- , where H is the history set of ;
- .
Note that an MDP is a special case of an NMDP, which naturally induces the non-Markov embedding functor denoted as . and are well-defined functors (Proof in Appendix C and Appendix D).
Definition 14 (Non-Markov Embedding).
Non-Markov embedding is a functor . For any , there exists , , , , which satisfies the following property:
- .
Although and have distinct properties by definition, we discover that they are equivalent categories. This leads to the following theorem (Proof in Appendix E).
Theorem 1 (Equivalence of and ).
Category and are equivalent through functor and , i.e., , .
4. NMDP Constructed from MDP via HAS
Unlike many algorithmic studies that focus on developing functors in to handle NMDP’s history more effectively, our work focuses on constructing functors in for transforming MDPs into NMDPs. While is such a functor, it is trivial since, in the constructed NMDP, the states prior to the current time are essentially irrelevant to decision-making. However, our interest lies in functors that can substantially incorporate non-Markovian transition dynamics into MDPs. To this end, we first introduce the History Aggregator for State (HAS), which enables us to construct such functors. Similarly, we can also define the History Aggregator for Reward (HAR), which substantially incorporates non-Markovian reward mechanisms into MDPs. As HAR is not the main content of this paper, we discuss it in the Appendix K. All proofs of theorems in this section are provided in Appendix F, Appendix G, Appendix H, Appendix I and Appendix J.
Definition 15 (History Aggregator for State (HAS)).
For any MDP , an HAS is a series of maps in which where represents a set called the target state set of .
As the name implies, the HAS constructs the NMDP state by aggregating the MDP history. Before detailing our method, we first require that the aggregators be reversible.
Definition 16 (Reversibility of HAS on MDP).
An HAS on MDP is reversible iff there exists a series of maps, denoted as , which satisfy:
where .
The reversibility condition of HAS ensures that a decision-making algorithm can reconstruct the original MDP state from the history of the NMDP. A reversible HAS-based transformation neither alters the transition dynamics of the original MDP nor increases its inherent complexity. Consequently, the performance upper bound for the NMDP is identical to that of the original MDP. Thus, once we know the best achievable performance of the original MDP, we can set the same expectations for the constructed NMDP. By ensuring that the transformation from the MDP to the NMDP does not increase the inherent difficulty of the original but only requires effective management of the NMDP’s history, we can more accurately evaluate a decision-making algorithm’s ability to handle non-Markovianity through encoding and memorization of NMDP’s history.
Noticing that the latest state extraction operators constitute reversible HAS, we have the following corollary.
Corollary 1.
The series of latest state extraction operators, , constitutes a reversible HAS on MDP with a target state set identical to the state set.
When any reversible HAS is applied to an MDP, it generates an NMDP. The NMDP’s state set encompasses all aggregated histories of the original MDP. Its transition dynamics take the NMDP’s history as input, decode it into an MDP state, and then apply the MDP’s transition dynamics.
Definition 17 (Application of Reversible HAS to MDP).
The application of a reversible HAS to an MDP is an NMDP , in which ; , where H is the history set of , is the history set of ;
where .
The decoding process, denoted as is the source of non-Markovianity. This is because, in the general case, decision-making algorithms have to remember the NMDP’s entire history to decode the MDP’s current state.
Although reversible HAS naturally induces functors in , the definition of reversible HAS alone does not directly produce implementations, necessitating further specification.
For simplicity and practicality in implementation, we restrict our construction to using states alone, not the entire history. Given this constraint, we examine two types of HAS constructions: one using just states, and the other relying on auxiliary sequences.
4.1. HAS Constructed Using Just States
One straightforward way to construct HAS using just states is introducing a binary operator on the state set.
Definition 18 (HAS Induced by Binary Operator).
The HAS on MDP induced by a binary operator is:
where , , and .
According to the above definition, for the HAS induced by operator ⊗ to be reversible, it is sufficient for ⊗ to be a group operator, meaning forms a group. This approach is quite general since any state set can be extended to form a group, like a free group. Moreover, in practical problems, states are typically represented as vectors in , and forms a group under vector addition.
Theorem 2 (Reversibility of HAS Induced by Group Operator).
The HAS on MDP induced by binary operator ⊗ is reversible if is a group.
Let denote the functor induced by . The proof of Theorem 2 in the Appendix F shows that generates an NMDP. Unlike non-Markov embedding, the HAS does introduce non-Markovianity. It transforms an MDP, where decisions rely only on the current state, into an NMDP that requires knowledge of both the current and previous one-step state for decision-making. However, this state dependency structure is inadequate. Later, we’ll show that repeated application of this HAS can yield a more complex state dependency structure.
Definition 19 (State Dependency Structure of NMDP History).
The state dependency structure of a history of NMDP is a subset of
where .
According to the above definition, implies that has an impact on the state transition. Replacing it leads to a change in the subsequent transition probabilities. The concept of state dependency structure can also be extended to MDPs by defining it in terms of the state dependency structure of the MDP’s non-Markov embedding. It has been observed that applying once to an MDP can increase the number of aggregated histories required to reconstruct the original MDP state in the resulting NMDP, thereby expanding the cardinality of the state dependency structure. Consequently, we explore applying multiple times to the MDP to generate NMDPs with more complex temporal dependencies. To facilitate the application of reversible HAS to NMDPs, and without significant loss of generality, we assume that the transition dynamics of the NMDP depend solely on the state component of the history. The extension required to apply the reversible HAS to the NMDP is presented in the Appendix L. With a slight abuse of notation, we let also denote the functor induced by HAS.
Theorem 3 (Impact of on State Dependency Structure).
For any MDP , if it is non-degenerate, then the functor induced by some group operator on S ensures that the dependency structure of any history of satisfies .
The significance of Theorem 3 lies in its provision of a general method for designing a transition mechanism for an NMDP that relies on the states of the previous steps. Specifically, it is sufficient to apply functor n times to a non-degenerate MDP.
4.2. HAS Constructed Using Auxiliary Sequences
Another approach to aggregating states is using auxiliary sequences to assign importance weights to these states. In this way, a binary operator is required to connect an auxiliary sequence with the sequence of states.
Definition 20 (HAS Induced by Auxiliary Sequences and Binary Operator).
The HAS on MDP induced by a series of auxiliary sequences and a binary operator is:
where .
The binary operator ∗ does not specify how the auxiliary sequence elements interact with the state sequence elements. Therefore, we define two operators to determine this interaction, one operator to apply an item in the auxiliary sequence to a state, the other operator to aggregate two states. Without too much loss of generality, we restrict our discussion to left R-modules, where forms an Abelian group, · is a scalar multiplication operator, and becomes a unital ring with operators defined. We use to denote such an HAS.
Additionally, the correspondence between the elements of the auxiliary sequence and the elements of the state sequence needs to be specified. For the sake of simplicity in the subsequent discussion, we consider only two types of correspondence, where the auxiliary sequences are prefixes of a given sequence : . where is referred to as correlation operator, and is referred to as convolution operator.
We examine the reversibility of HAS in these two cases separately. For the correlation operator case, we have the following theorem:
Theorem 4 (Reversibility of HAS induced by Auxiliary Sequence and Correlation Operator).
The HAS induced by prefixes of auxiliary sequence and operator is reversible if each is invertible in the ring.
Based on the proof in the Appendix H, it is obvious that the correlation operator only results in each set of the dependency structure of the constructed NMDP having a potential of no more than 2, which is similar to the effect of a group operator. Therefore, we focus on discussing the properties of the convolution operator.
For the convolution operator case, we have the following theorem:
Theorem 5 (Reversibility of HAS induced by Auxiliary Sequence and Convolution Operator).
The HAS induced by prefixes of auxiliary sequence and operator is reversible if is invertible in the ring.
We use to denote the functor induced by reversible and operator , then we have the following theorem about its impact on the state dependency structure of the NMDP.
Theorem 6 (Impact of on State Dependency Structure).
For any MDP , if it is non-degenerate, then the functor induced by prefixes of auxiliary sequence and operator ensures that the dependency structure of any history of satisfies , where is the inverse matrix of in the ring, 0 is the zero element of the ring.
The proof of Theorem 6 indicates that it is possible to achieve any specific state dependency structure in the history of the constructed NMDP by modifying the elements of the upper triangular band matrix . This provides a general method for designing NMDPs with desired state dependency structures.
5. Experiments
Although the main contribution of this paper is theoretical, we have designed and implemented several highly versatile environment wrappers based on the two methods proposed in Section 4 for constructing functors in : the group-operator-based and the convolution-based method. These wrappers are implemented using a computationally efficient approach with a time complexity of and can be applied to environments that conform to the Gymnasium [20] interface.
We use the PPO [21] algorithm implemented in the Stable-Baselines3 library [22] and the LSTM-PPO algorithm of the Stable-Baselines3-Contrib library [22] as standard reinforcement learning algorithms. These algorithms are tested in Gymnasium environments wrapped with our wrappers, with reinforcement learning training experiments conducted using the framework provided by the RL-Baselines3-Zoo library [23].
We assume , , , and employ the following functor to implement wrappers:
- induced by HAS ;
- induced by HAS ;
- induced by HAS ;
- induced by HAS .
From the definitions of , , , , we can derive the state dependency structure of histories in the NMDP under their application. , introduce dependencies of , , and , introduce dependencies of . The state dependency weights induced by and exhibit an exponential decay with respect to the temporal distance from the current time step, governed by the factor , while and introduce uniformly distributed dependency.
Our experiments use CartPole-v1 and Pendulum-v1 as the base MDP environments, and we employ the following functors to obtain the NMDP environments:
All hyperparameters required for training were kept at their default settings from the RL-Baselines3-Zoo library, and the training process was initiated using the library’s provided command-line instructions. Each combination of environment, wrapper, and algorithm was trained 3 times, timesteps for each time, evaluated every timesteps, and the checkpoints with the best average episode reward were selected.
Theoretically, an increase in n of and or of and makes the non-Markov environment more challenging for RL algorithms to solve, as it introduces more complex temporal dependencies. As shown in Figure 1, the results of our experiments also indicate this property: the average episode reward, plotted as a function of n or , generally shows a declining trend for each combination of environment, algorithm, and wrapper.
Figure 1.
Experimental results for each combination of environment, algorithm, and wrapper. (a) CartPole-v1 with wrappers; (b) CartPole-v1 with wrappers; (c) Pendulum-v1 with wrappers; (d) Pendulum-v1 with wrappers; The x-axis represents the wrapper parameter, while the y-axis shows the average episode reward. Lines of different colors indicate different combinations of algorithms and wrapper types.
Another conclusion drawn from the experimental results is that, for any given combination of environment and algorithm, the performance degradation caused by increasing from 0 to 1 is comparable to the degradation resulting from increasing n from 0 to 1. This observation is consistent with our theoretical analysis, which shows that increasing from 0 to 1 progressively introduces a greater dependence on previous states, eventually matching the dependence introduced by a wrapper with .
By comparing the performance of the PPO and LSTM-PPO algorithms in environments wrapped with varying degrees of dependency complexity, we observe that LSTM-PPO outperforms PPO when the dependencies are more complex. This is due to LSTM-PPO’s ability to recall past states, which also aligns with our intuition.
5.1. Comparative Analysis of the Proposed Framework
To systematically illustrate the advantages of our proposed framework and how it addresses the limitations of existing studies, we provide a comparative analysis in Table 2. Our approach, grounded in category theory and reversible HAS, offers a unified, flexible, and theoretically sound methodology for constructing non-Markovian decision processes, overcoming the ad-hoc, information-lossy, and unsystematic nature of prior methods.
Table 2.
Comparison between existing studies and the proposed framework on constructing non-Markovian decision processes.
As demonstrated in Table 2, our framework not only overcomes key weaknesses in prior art but also provides a flexible, theoretically grounded, and practical toolkit for constructing non-Markovian decision problems, thereby facilitating more rigorous and comparable evaluation of decision-making algorithms.
5.2. Practical Implications and Target Audience
The proposed framework and experimental results are designed to serve a broad spectrum of researchers and practitioners working on decision-making under temporal dependencies. Specifically, the following groups are poised to benefit most from our work:
- Reinforcement Learning Researchers studying non-Markovian environments, memory-based architectures, or partial observability can use our HAS-based construction method to generate benchmark environments with controllable and reversible temporal dependencies. This allows for systematic ablation studies on how different dependency structures affect algorithm performance, without confounding factors such as information loss or altered task difficulty.
- Algorithm Developers aiming to evaluate the robustness of RL algorithms (e.g., PPO, LSTM-based agents) in non-Markovian settings can adopt our Gymnasium-compatible wrappers to seamlessly convert existing Markovian benchmarks into non-Markovian variants. Our results provide a clear reference: algorithms with memory mechanisms (like LSTM-PPO) consistently outperform memory-less counterparts as dependency complexity increases, underscoring the importance of architectural choices in such settings.
- Decision System Designers in Applied Fields (e.g., robotics, healthcare, finance) where real-world dynamics often exhibit non-Markovian characteristics can leverage our framework to “stress-test” their policies in progressively more realistic environments. By tuning parameters such as n in or in , they can simulate varying degrees of historical influence, thus identifying the memory capacity required for robust decision-making in their specific domain.
In summary, our work provides not only a theoretical foundation but also a practical toolkit for constructing, analyzing, and benchmarking decision processes beyond the Markovian assumption, thereby supporting more rigorous and generalizable progress in algorithmic decision-making.
6. Summary and Future Work
We propose a general and effective method to construct NMDPs from MDPs using techniques from category theory and algebra. Our method provides a comprehensive way to evaluate decision-making, especially RL algorithms’ ability to handle non-Markovianity through encoding and memorization.
Theoretical analysis demonstrates that our method possesses strong expressive power and can represent a wide variety of temporal state dependency structures. Using this theoretical framework, we transformed classical Markovian environments into non-Markovian ones and tested them with both PPO algorithms, with and without LSTM. This validation confirms our method’s effectiveness in introducing varying degrees of non-Markovian characteristics into Markovian environments.
The examples tested in our experiments represent only a small subset of the cases within the theoretical framework. The functor forms that exhibit desirable properties through our theory are highly diverse, extending beyond those tested. This is due to our proofs being conducted within abstract algebraic structures, which encompass numerous notable specific cases.
Our study also has limitations that warrant further investigation. For instance, we did not explore the introduction of randomness into HAS using random sequences or mappings. Additionally, we did not address the theory of HAR, which remains relevant for reward shaping. Moreover, our theoretical analysis is restricted to reversible HAS, and we have not developed a theory for non-reversible cases. For example, a common method to create non-Markovian environments is by obscuring information in the observations of an MDP to transform it into a POMDP. Combining this method with our approach and exploring their combined expressive power presents a promising avenue for future research.
In future work, we also plan to leverage the HAS framework and Gymnasium-compatible wrappers presented here to establish an open-source benchmark suite for non-Markovian decision processes. This suite will facilitate systematic, reproducible comparisons of various methods, including Reward Machines, Regular Decision Processes, and POMDP conversions, against our HAS-based construction, empirically validating its advantages in generating environments with controllable dependencies and no inherent information loss.
Author Contributions
Conceptualization, methodology, formal analysis, writing: Y.W.; experimental validation, review and editing: L.L.; supervision, project administration, review and editing: W.L. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The original contributions presented in the study are included in the article, further inquiries can be directed to the corresponding author.
Acknowledgments
During the preparation of this manuscript, the author(s) used DeepSeek V3.1-Terminus for the purposes of manuscript editing. The authors have reviewed and edited the output and take full responsibility for the content of this publication.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| RL | Reinforcement Learning |
| PPO | Proximal Policy Optimization algorithm |
| MDP | Markov Decision Process |
| NMDP | Non-Markovian Decision Process |
| HAS | History Aggregator for State |
| RM | Reward Machine |
| RDP | Regular Decision Process |
| MAB | Multiarmed Bandit |
| POMDP | Partially Observable Markov Decision Process |
| HAR | History Aggregator for Reward |
| LSTM | Long-Short Term Memory |
Appendix A. Proof of Well-Definedness of MDP Category
Lemma A1.
MDP Category is well-defined.
Proof.
It is sufficient to prove that the composition of morphisms remains a morphism.
For any MDP and any morphism: , , by definition of composition of MDP category we have
Since
we have
Similarly, since
take , we have
therefore is still a morphism, i.e., is a well-defined category. □
Appendix B. Proof of Well-Definedness of NMDP Category
Lemma A2.
NMDP Category is well-defined.
Proof.
It is sufficient to prove that the composition of morphisms remains a morphism.
For any NMDP and any morphism: , , by definition of composition of NMDP category we have
Since
we have
similarly, we have
take , we have
since
we have
therefore
which means is still a morphism, i.e., is a well-defined category. □
Appendix C. Proof of Well-Definedness of Non-Markov Embedding as a Functor
Lemma A3.
Non-Markov embedding is a well-defined functor from to if , .
Proof.
For any and any morphism , denote and .
If the condition holds, then
and
which means the identity morphisms and associativity of morphisms in is preserved by .
Therefore, for the well-definedness of , we only need to prove that the condition is compatible with the action of on which is given by the definition of , i.e., .
Since does nothing to , we only need to prove that the condition is compatible with the action of on .
By the definition of morphisms in , we have
By the definition of , we have
denote then
therefore, by definition of morphisms in , , which means is compatible with the action of on , i.e., is a well-defined functor from to . □
Appendix D. Proof of Well-Definedness of Markov Abstraction as a Functor
Lemma A4.
Markov abstraction is a well-defined functor from to if , , where
and
Proof.
For any and any morphism , denote and , where , .
If the condition holds, then
and
which means the identity morphisms and associativity of morphisms in is preserved by .
Therefore, for the well-definedness of , we only need to prove that the condition is compatible with the action of on which is given by the definition of , i.e., .
Since does nothing to , we only need to prove that the condition is compatible with the action of on .
For any , let . and , if , then .
We have
therefore the condition is compatible with the action of on .
By the definition of morphisms in , we have
By the definition of we have
For any , we have
and
thus , which implies that
therefore, by definition of morphisms in , , which means is compatible with the action of on , i.e., is a well-defined functor from to . □
Appendix E. Proof of Theorem 1
Definition A1 (Isomorphism).
A morphism in a category is an isomorphism if there exists a map in such that , .
Definition A2 (Natural Transformation).
Let and be categories and let be functors. A natural transformation is a family of morphisms in such that for every morphism in , the square
commutes. The maps are called the components of α.
Definition A3 (Functor Category).
Let and be categories. Functor category is a category whose objects are all the functors from to and morphisms are all the natural transformations between these functors.
Definition A4 (Natural Isomorphism).
Let and be categories. A natural isomorphism between functors and from to is an isomorphism in category . Functors are isomorphic (denoted as ) if there exists a natural isomorphism between them.
Definition A5 (Category Equivalence).
A equivalence between categories and consists of a pair of functors together with natural isomorphisms . If there exists an equivalence between and , we say that and are equivalent through and .
Category and are equivalent through functor and , i.e., , .
Proof.
For any
where
we have
where
therefore, we can reconstruct the representation of using without loss of information and vice versa,
which means .
Similarly, for any
where
we have
where
therefore we can reconstruct the representation of using without loss of information and vice versa,
which means . □
Appendix F. Proof of Theorem 2
The HAS on MDP induced by binary operator ⊗ is reversible if is a group.
Proof.
Define as follows which satisfy the reversibility condition of
□
Note: Actually, the condition that forms a group can be relaxed to forms a group where .
Appendix G. Proof of Theorem 3
For any MDP , if it is non-degenerate, then the functor induced by some group operator on S ensures that the dependency structure of any history of satisfies .
Proof.
Based on the closure property of the group operator ⊗, we repeatedly apply to MDP to acquire a series of NMDPs .
Consider history with . By the definition of we have
and
substituting Equation (A1) into Equation (A2) yields
Starting from , repeatedly applying Equation (A3) by substituting the left side into the right side yields an expression of in terms of :
By mathematical induction, it can be shown that
where , , e is the unit element of the group.
Because has the above form, it is sufficient to specify the group operator as the multiplication in the free group to obtain the theorem. □
Note: Free group is not the only form in which can be. For example, the theorem still holds when the group is .
Appendix H. Proof of Theorem 4
The HAS induced by prefixes of auxiliary sequence and operator is reversible if is invertible in the ring.
Proof.
Define as follows which satisfy the reversibility condition of if is inversible.
□
Appendix I. Proof of Theorem 5
The HAS induced by prefixes of auxiliary sequence and operator is reversible if is invertible in the ring.
Proof.
By the definition of convolution operator , we have
the following equation comes from taking
If is invertible in the ring, the Gaussian elimination method can be used to solve Equation (A5) and obtain the expression for , which also means the matrix is invertible in the ring. □
Appendix J. Proof of Theorem 6
For any MDP , if it is non-degenerate, then the functor induced by prefixes of auxiliary sequence and operator ensures that the dependency structure of any history of satisfies , where is the inverse matrix of in the ring, 0 is the zero element of the ring.
Proof.
As is proved in Theorem 5, , where
is an upper-triangular matrix, therefore
If is not zero, then there exists some aggregated state that will change when using it to replace in Equation (A7), which means . □
Appendix K. History Aggregator for Reward (HAR)
Unlike HAS, which introduces non-Markovianity into the MDP’s transition dynamics, HAR does so in the MDP’s reward mechanisms. HAR is similar to reward shaping. However, instead of simplifying RL training as reward shaping does, it is used to construct NMDPs with non-Markovian reward mechanisms.
Definition A6 (History Aggregator for Reward (HAR)).
For any MDP , an HAR is a series of maps in which .
Definition A7 (Reversibility of HAR on MDP).
An HAR on MDP is reversible iff there exists a series of maps denoted as which satisfy:
where .
Definition A8 (Application of Reversible HAR to MDP).
The application of a reversible HAR to an MDP is an NMDP , in which:
where .
Corollary A1.
The series of latest reward extraction operators, , constitutes a reversible HAR on MDP.
Appendix L. Extending Reversible HAS to Be Applicable on NMDP
- HAS: Although HAS was previously described as a structure established on MDP, due to the formal similarity between MDP and NMDP, we can directly replace all occurrences of “MDP” in this definition with “MDP or NMDP”. This still constitutes a valid definition.
- Reversibility of HAS: Unlike HAS on MDP, to ensure that the target NMDP can utilize the transition function from the original NMDP, it must be possible to reconstruct the complete state sequence from the aggregated history sequence, rather than just the current state. Therefore, a reverse of an HAS on NMDP should satisfy:
- Application of Reversible HAS: The application of reversible HAS on NMDP is similar to that on MDP, with replaced by the following:The use of is to extract the latest state from the history returned by , according to the definition of reversed HAS on NMDP.
- HAS Induced by Binary Operator: Similar to extending the concept of HAS from MDP to NMDP, in this definition, “MDP” can also be replaced with “MDP or NMDP”, which still constitutes a valid definition.
References
- Whitehead, S.D.; Lin, L.J. Reinforcement learning of non-Markov decision processes. Artif. Intell. 1995, 73, 271–306. [Google Scholar] [CrossRef] [Scilit]
- de Vega, I.; Alonso, D. Dynamics of non-Markovian open quantum systems. Rev. Mod. Phys. 2017, 89, 015001. [Google Scholar] [CrossRef] [Scilit]
- Gupta, G.; Yin, C.; Deshmukh, J.V.; Bogdan, P. Non-markovian reinforcement learning using fractional dynamics. In Proceedings of the 2021 60th IEEE Conference on Decision and Control (CDC), Austin, TX, USA, 14–17 December 2021; IEEE: Piscataway, NJ, USA, 2021; pp. 1542–1547. [Google Scholar]
- Majeed, S.J.; Hutter, M. On Q-learning Convergence for Non-Markov Decision Processes. In Proceedings of the International Joint Conference on Artificial Intelligence, Stockholm, Sweden, 13–19 July 2018; Volume 18, pp. 2546–2552. [Google Scholar]
- Ronca, A.; Licks, G.P.; De Giacomo, G. Markov abstractions for PAC reinforcement learning in non-markov decision processes. arXiv 2022, arXiv:2205.01053. [Google Scholar] [CrossRef] [Scilit]
- Hutter, M. Feature reinforcement learning: Part I. unstructured MDPs. J. Artif. Gen. Intell. 2009, 1, 3. [Google Scholar] [CrossRef] [Scilit]
- Maillard, O.A.; Ryabko, D.; Munos, R. Selecting the state-representation in reinforcement learning. Adv. Neural Inf. Process. Syst. 2011, 24, 2627–2635. [Google Scholar]
- Veness, J.; Ng, K.S.; Hutter, M.; Uther, W.; Silver, D. A monte-carlo aixi approximation. J. Artif. Intell. Res. 2011, 40, 95–142. [Google Scholar] [CrossRef] [Scilit]
- Nguyen, P.; Maillard, O.A.; Ryabko, D.; Ortner, R. Competing with an infinite set of models in reinforcement learning. In Proceedings of the Artificial Intelligence and Statistics, Scottsdale, AZ, USA, 29 April–1 May 2013; PMLR: Cambridge, MA, USA, 2013; pp. 463–471. [Google Scholar]
- Lattimore, T.; Hutter, M.; Sunehag, P. The sample-complexity of general reinforcement learning. In Proceedings of the International Conference on Machine Learning, Atlanta, GA, USA, 16–21 June 2013; PMLR: Cambridge, MA, USA, 2013; pp. 28–36. [Google Scholar]
- Rens, G.; Raskin, J.F. Learning non-Markovian reward models in MDPs. arXiv 2020, arXiv:2001.09293. [Google Scholar] [CrossRef] [Scilit]
- Camacho, A.; Icarte, R.T.; Klassen, T.Q.; Valenzano, R.A.; McIlraith, S.A. LTL and Beyond: Formal Languages for Reward Function Specification in Reinforcement Learning. In Proceedings of the International Joint Conference on Artificial Intelligence, Macao, China, 10–16 August 2019; Volume 19, pp. 6065–6073. [Google Scholar]
- Abadi, E.; Brafman, R.I. Learning and solving regular decision processes. arXiv 2020, arXiv:2003.01008. [Google Scholar] [CrossRef] [Scilit]
- Brafman, R.I.; De Giacomo, G. Regular Decision Processes: A Model for Non-Markovian Domains. In Proceedings of the International Joint Conference on Artificial Intelligence, Macao, China, 10–16 August 2019; pp. 5516–5522. [Google Scholar]
- Gaon, M.; Brafman, R. Reinforcement learning with non-markovian rewards. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 3980–3987. [Google Scholar]
- Dohmen, T.; Topper, N.; Atia, G.; Beckus, A.; Trivedi, A.; Velasquez, A. Inferring probabilistic reward machines from non-markovian reward signals for reinforcement learning. In Proceedings of the International Conference on Automated Planning and Scheduling, Singapore, 13–24 June 2022; Volume 32, pp. 574–582. [Google Scholar]
- Qin, A.; Gao, F.; Li, Q.; Zhu, S.C.; Xie, S. Learning non-markovian decision-making from state-only sequences. Adv. Neural Inf. Process. Syst. 2024, 36, 6596–6618. [Google Scholar]
- Chandak, S.; Shah, P.; Borkar, V.S.; Dodhia, P. Reinforcement learning in non-markovian environments. Syst. Control Lett. 2024, 185, 105751. [Google Scholar] [CrossRef] [Scilit]
- Leinster, T. Basic Category Theory; Cambridge University Press: Cambridge, UK, 2014; Volume 143. [Google Scholar]
- Towers, M.; Kwiatkowski, A.; Terry, J.; Balis, J.U.; De Cola, G.; Deleu, T.; Goulão, M.; Kallinteris, A.; Krimmel, M.; KG, A.; et al. Gymnasium: A standard interface for reinforcement learning environments. arXiv 2024, arXiv:2407.17032. [Google Scholar] [CrossRef] [Scilit]
- Schulman, J.; Wolski, F.; Dhariwal, P.; Radford, A.; Klimov, O. Proximal policy optimization algorithms. arXiv 2017, arXiv:1707.06347. [Google Scholar] [CrossRef] [Scilit]
- Raffin, A.; Hill, A.; Gleave, A.; Kanervisto, A.; Ernestus, M.; Dormann, N. Stable-Baselines3: Reliable Reinforcement Learning Implementations. J. Mach. Learn. Res. 2021, 22, 1–8. [Google Scholar]
- Raffin, A. RL Baselines3 Zoo. 2020. Available online: https://github.com/DLR-RM/rl-baselines3-zoo (accessed on 1 November 2025).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
