RL setting
In the reinforcement learning framework, we can model human behavior as an agent interacting with the world. Let’s formalize this mathematically.
Markov Decision Process (MDP) Formulation
The human experience can be modeled as a Markov Decision Process (MDP) defined by the tuple:
$$\mathcal{M} = (\mathcal{S}, \mathcal{A}, \mathcal{P}, \mathcal{R}, \gamma)$$
where:
- $\mathcal{S}$ is the state space (all possible states of the world and internal states)
- $\mathcal{A}$ is the action space (all possible actions the human can take)
- $\mathcal{P}: \mathcal{S} \times \mathcal{A} \times \mathcal{S} \rightarrow [0,1]$ is the transition probability function
- $\mathcal{R}: \mathcal{S} \times \mathcal{A} \times \mathcal{S} \rightarrow \mathbb{R}$ is the reward function
- $\gamma \in [0,1]$ is the discount factor
Environment is the world
The environment encompasses everything external to the agent (brain). Mathematically, the environment dynamics are governed by:
$$P(s_{t+1} | s_t, a_t) = \mathcal{P}(s_t, a_t, s_{t+1})$$
This represents the probability of transitioning to state $s_{t+1}$ given current state $s_t$ and action $a_t$.
Observation space is 5 senses
The observation space $\mathcal{O}$ is not identical to the state space $\mathcal{S}$. Humans have partial observability through sensory channels:
The observation function maps states to observations:
$$\Omega: \mathcal{S} \rightarrow \mathcal{O}$$
At each time step, the agent receives observation:
$$o_t = \Omega(s_t) + \epsilon_t$$
where $\epsilon_t$ represents sensory noise.
Action space is moving limbs, including eyes, ears, nose, mouth, and skin
The action space consists of continuous motor controls:
where each subspace is typically continuous and high-dimensional. For example:
- $\mathcal{A}_{\text{motor}} \subset \mathbb{R}^n$ where $n$ is the number of controllable muscle groups
- $\mathcal{A}_{\text{ocular}} \subset \mathbb{R}^6$ for eye movements (3D rotation for each eye)
Agent is the brain that has a policy to decide what action to take
The agent (brain) maintains a policy $\pi$ that maps observations to actions. In the partially observable case:
$$\pi: \mathcal{H} \rightarrow \mathcal{P}(\mathcal{A})$$
where $\mathcal{H}$ is the history space of observations and actions, and $\mathcal{P}(\mathcal{A})$ is the probability distribution over actions.
The optimal policy maximizes expected cumulative reward:
Reward is serotonin, dopamine, oxytocin, etc.
The reward function is multi-dimensional, corresponding to different neurotransmitter systems:
where:
- $r_t^{(\text{dopamine})}$ - reward prediction and motivation
- $r_t^{(\text{serotonin})}$ - mood and well-being
- $r_t^{(\text{oxytocin})}$ - social bonding and trust
- $r_t^{(\text{endorphins})}$ - pleasure and pain relief
Individual Differences in Reward Functions
Different individuals have different reward function parameters $\theta$:
$$\mathcal{R}_{\theta}(s,a,s’) = \theta^T \phi(s,a,s’)$$
where $\phi(s,a,s’)$ are reward features and $\theta$ are individual-specific weights.
For example:
- Money-oriented: $\theta_{\text{wealth}} » \theta_{\text{social}}$
- Family-oriented: $\theta_{\text{family}} » \theta_{\text{wealth}}$
- Self-actualization: $\theta_{\text{growth}} » \theta_{\text{material}}$
Value Functions
The state-value function under policy $\pi$:
The action-value function:
Bellman Equations
The optimal value functions satisfy:
Learning and Adaptation
Humans continuously update their policies through experience:
This update can be modeled using various RL algorithms:
- Model-based: Learning $\mathcal{P}$ and $\mathcal{R}$, then planning
- Model-free: Directly learning $Q$ or $\pi$ from experience
- Hybrid: Combining both approaches, similar to human cognition
Exploration vs Exploitation
Humans balance exploration and exploitation through various strategies:
$$a_t \sim \begin{cases} \pi(a|h_t) & \text{with probability } 1-\epsilon \ \text{Uniform}(\mathcal{A}) & \text{with probability } \epsilon \end{cases}$$
where $\epsilon$ represents the exploration rate, which typically decreases with experience and age.
Individual Differences in Human RL Agents
Cognitive Capacity and Model Complexity
Different individuals have varying capacities for modeling the world, which affects their ability to learn and plan:
High IQ / Better Modeling Capacity
Individuals with higher cognitive capacity can maintain more complex world models:
with lower approximation error. This manifests as:
- Larger state space representation: $|\mathcal{S}_{\text{internal}}| \propto \text{cognitive capacity}$
- Better function approximation: More accurate $\hat{V}(s)$ and $\hat{Q}(s,a)$
- Deeper planning horizon: Can simulate longer trajectories
where $H$ (planning horizon) is larger for higher cognitive capacity.
Limited Modeling Capacity
Individuals with limited cognitive resources use simpler approximations:
- Reduced state space: $\mathcal{S}_{\text{reduced}} \subset \mathcal{S}$
- Simpler policies: Often rely on habits and heuristics
- Model-free learning: Greater reliance on cached values rather than planning
Discount Factor Variations
The discount factor $\gamma$ varies significantly across individuals, affecting their temporal preferences:
This directly impacts value function computation:
Time-Inconsistent Preferences
Many humans exhibit hyperbolic discounting:
where $k$ is the individual’s impulsivity parameter. This leads to preference reversals and self-control problems.
Policy-Reward Feedback Loop
Reward Function Plasticity
Unlike traditional RL formulations, human reward functions are not fixed but adapt based on experience:
$$\mathcal{R}_{t+1}(s,a,s’) = f(\mathcal{R}_t(s,a,s’), \pi_t, \text{experience}_t)$$
This creates a feedback loop where the policy influences future rewards.
Addiction as Reward System Hijacking
Consider the sugar addiction example:
Initial State
- Reward for sugar: $r_{\text{sugar}}^{(0)} = r_{\text{base}}$
- Policy: $\pi_0(\text{eat sugar}|s) = p_{\text{low}}$
After Repeated Exposure
The reward system adapts:
$$r_{\text{sugar}}^{(t+1)} = r_{\text{sugar}}^{(t)} + \alpha \cdot \text{consumption}_t$$
where $\alpha$ is the sensitization rate.
Simultaneously, tolerance develops:
$$r_{\text{baseline}}^{(t+1)} = r_{\text{baseline}}^{(t)} - \beta \cdot \text{consumption}_t$$
This leads to:
- Increased craving: $\pi_t(\text{eat sugar}|s) \rightarrow 1$
- Reduced baseline happiness: Need sugar to feel normal
- Narrowed action space: Other actions become less rewarding
Mathematical Model of Habit Formation
Habits form through the strengthening of state-action associations:
$$Q_{\text{habit}}(s,a) = Q_{\text{deliberate}}(s,a) + \theta \cdot N(s,a)$$
where:
- $N(s,a)$ is the number of times action $a$ was taken in state $s$
- $\theta$ is the habit strength parameter
Over time, habitual actions dominate:
$$\pi(a|s) \propto \exp\left(\frac{Q_{\text{habit}}(s,a)}{\tau}\right)$$
where $\tau$ (temperature) decreases with repetition, making behavior more deterministic.
Neuroplasticity and Reward Adaptation
The brain’s reward prediction error:
$$\delta_t = r_t + \gamma V(s_{t+1}) - V(s_t)$$
drives both learning and reward system adaptation:
$$\Delta w_{\text{dopamine}} = \eta \cdot \delta_t \cdot \phi(s_t, a_t)$$
This creates several feedback effects:
Tolerance: Repeated rewards lead to reduced response $$r_{\text{effective}}(s,a) = \frac{r_{\text{nominal}}(s,a)}{1 + \tau \cdot N(s,a)}$$
Sensitization: Cue-triggered wanting increases $$\text{craving}(s) = w^T \phi_{\text{cue}}(s) \cdot \sqrt{N_{\text{exposure}}}$$
Withdrawal: Absence of expected reward becomes punishing $$r_{\text{withdrawal}} = -\lambda \cdot (r_{\text{expected}} - r_{\text{received}})$$
Social and Environmental Feedback
The policy also affects the environment’s response:
$$\mathcal{P}_{t+1}(s’|s,a) = g(\mathcal{P}_t(s’|s,a), \pi_t)$$
Examples:
- Social reinforcement: Certain behaviors attract like-minded individuals
- Environmental shaping: Our actions modify our surroundings
- Skill development: Repeated actions improve capabilities
Breaking the Feedback Loop
To escape negative policy-reward cycles:
Commitment devices: Constraining future action space $$\mathcal{A}_{\text{constrained}} \subset \mathcal{A}$$
Reward shaping: Artificially modifying rewards $$r_{\text{shaped}}(s,a) = r(s,a) + F(s,a)$$
Meta-learning: Learning to learn better policies $$\pi_{\text{meta}} = \arg\max_{\pi} \mathbb{E}\left[\sum_t \gamma^t r_t + \lambda \cdot \text{flexibility}(\pi)\right]$$
Implications
Understanding humans as RL agents with:
- Variable cognitive capacities
- Different discount factors
- Plastic reward functions
- Policy-reward feedback loops
helps explain diverse human behaviors from addiction to achievement, from impulsivity to long-term planning, and from habit formation to behavioral change.
This framework suggests that effective behavior change requires not just modifying policies but also understanding and potentially reshaping the underlying reward systems and feedback mechanisms.
Stoic Philosophy Through the RL Lens
The Stoic principle of focusing on what is under our control while accepting what is not can be formalized within our RL framework. This philosophy, exemplified by Marcus Aurelius’ “You have power over your mind - not outside events. Realize this, and you will find strength,” has profound implications for optimal policy design.
The Dichotomy of Control
In RL terms, we can partition the elements of our MDP:
Under our control:
- Policy: $\pi(a|s)$ - We directly choose our actions
- Internal state representation: $s_{\text{internal}} \subset s$ - How we interpret observations
- Attention mechanism: $\alpha(o) \in [0,1]$ - What aspects of observations we focus on
Not under our control:
- Environment dynamics: $\mathcal{P}(s’|s,a)$ - How the world responds to our actions
- External rewards: $r_{\text{external}}(s,a,s’)$ - Outcomes and consequences
- Other agents’ policies: $\pi_{\text{others}}(a|s)$ - How others behave
Mathematical Formulation of Stoic Control
We can decompose the value function into controllable and uncontrollable components:
The Stoic approach suggests optimizing a modified objective:
where $r_{\text{internal}}$ depends only on controllable factors:
The Stoic Reward Function
Traditional RL agents optimize for external outcomes:
Stoic agents redefine their reward function to focus on process:
where $\alpha \rightarrow 1$ for a fully Stoic agent.
Robustness Through Control Focus
By focusing on controllable elements, Stoic policies exhibit robustness to environmental uncertainty:
where $\mathcal{U}$ is the uncertainty set of possible environment dynamics. This minimax formulation ensures good performance regardless of environmental response.
Emotional Regulation as State Abstraction
The Stoic practice of emotional regulation can be modeled as learned state abstraction:
where the abstraction function filters out uncontrollable elements:
This reduces the effective state space and prevents uncontrollable factors from influencing the policy:
The Paradox of Control and Outcomes
Interestingly, focusing on controllable factors often leads to better long-term outcomes:
This occurs because:
Reduced anxiety: Lower cortisol affects decision-making quality $$\text{noise}_{\text{decision}} \propto \text{anxiety level}$$
Consistent execution: Process focus leads to more stable policies $$\text{Var}[\pi_{\text{Stoic}}(a|s)] < \text{Var}[\pi_{\text{outcome}}(a|s)]$$
Compound effects: Small controllable improvements accumulate $$\prod_{t=1}^{T}(1 + \epsilon_t) \gg 1 \text{ for consistent } \epsilon_t > 0$$
Practical Implementation
The Stoic RL agent implements several key strategies:
1. Premeditation of Evils (Negative Visualization)
Model worst-case scenarios to reduce their impact:
2. View from Above
Use hierarchical abstraction to focus on important controllables:
where higher $k$ filters out more uncontrollable details.
3. Discipline of Desire
Modify the reward function to align with controllables:
Neurological Basis
This framework aligns with neuroscience findings:
- Prefrontal cortex: Implements the control-focused policy
- Anterior cingulate cortex: Monitors controllable vs uncontrollable
- Amygdala suppression: Reduced emotional response to uncontrollables
The neural implementation:
$$\text{PFC activity} = w_{\text{control}}^T \phi_{\text{controllable}}(s) - w_{\text{suppress}}^T \phi_{\text{uncontrollable}}(s)$$
Implications for Well-being
Agents following Stoic principles show:
Lower variance in happiness: $$\text{Var}[r_{\text{subjective}}] < \text{Var}[r_{\text{external}}]$$
Higher baseline satisfaction: $$\mathbb{E}[r_{\text{subjective}}] > \mathbb{E}[r_{\text{external}}]$$
Antifragility: Performance improves under adversity $$\frac{\partial \pi_{\text{quality}}}{\partial \text{adversity}} > 0$$
This mathematical framework reveals why the ancient Stoic wisdom remains relevant: by optimizing for what we control, we paradoxically achieve better outcomes in what we cannot control, while maintaining equanimity throughout the process.
The “Love Your Craft” Philosophy: Why Enjoying the Journey is Optimal
Successful people often advise to “have fun along the way” or “love what you do.” This seemingly simple advice has profound mathematical justification within our RL framework. Let’s explore why intrinsic motivation and process enjoyment lead to optimal long-term performance.
Intrinsic vs Extrinsic Reward Functions
Consider two types of reward functions:
Extrinsic-only agent:
Intrinsic-motivated agent:
The Temporal Credit Assignment Problem
For long-term goals, the extrinsic-only agent faces severe challenges:
When $r_k = 0$ for all $k < T$ (no intermediate rewards), the gradient signal becomes:
- Exponentially weak: $\gamma^T$ makes distant rewards nearly invisible
- High variance: Success/failure is binary
- Sparse: Most trajectories provide no learning signal
Dense Reward Shaping Through Intrinsic Motivation
Agents who “love their craft” effectively implement reward shaping:
where the shaping function $F$ represents intrinsic enjoyment:
The Flow State as Optimal Policy Execution
The psychological flow state corresponds to optimal policy execution with intrinsic rewards:
This creates a self-balancing system where:
- Too easy → Low flow reward → Seek harder challenges
- Too hard → Low flow reward → Build more skills
- Just right → Maximum intrinsic reward → Sustained engagement
Exploration Through Curiosity
Intrinsically motivated agents naturally explore more:
This leads to:
- Broader skill acquisition: Exploring diverse state-action pairs
- Robustness: Multiple paths to success
- Innovation: Discovering novel solutions
The Compound Effect of Daily Joy
Consider the cumulative effect over a career spanning $T$ days:
Extrinsic-only agent:
Intrinsic-motivated agent:
Even with small daily rewards, the cumulative difference is massive:
Sustainability and Burnout Prevention
The burnout phenomenon can be modeled as resource depletion:
Without intrinsic rewards:
With intrinsic rewards:
The Mastery Gradient
Loving your craft creates a positive feedback loop:
This leads to exponential skill growth:
Why Top Performers Love Their Craft
The correlation between success and craft-love isn’t coincidental but causal:
Selection Effect: Those who enjoy the process self-select into the field
$$P(\text{stays in field} | \text{loves craft}) >> P(\text{stays in field} | \text{hates craft})$$Performance Effect: Intrinsic motivation improves performance
$$\mathbb{E}[\text{performance} | \text{loves craft}] > \mathbb{E}[\text{performance} | \text{external motivation only}]$$Compounding Effect: More practice + better practice = exponential growth
$$\text{total\_skill} = \int_0^T \underbrace{\text{hours}(t)}_{\text{More hours}} \cdot \underbrace{\text{quality}(t)}_{\text{Better quality}} dt$$
The Optimal Policy: Maximize Process Utility
The mathematically optimal life policy is:
with $\alpha > 0.5$, ensuring that more than half the reward comes from the journey itself.
Practical Implementation Strategies
Gamification of Practice:
$$r_{\text{gamified}}(s,a) = \sum_i \mathbb{1}[\text{achievement}_i(s,a)] \cdot r_i$$Social Rewards:
$$r_{\text{social}}(s,a) = \beta \cdot \text{community\_engagement}(a) + \gamma \cdot \text{peer\_recognition}(s')$$Progress Tracking:
$$r_{\text{progress}}(s,s') = \log\left(\frac{\text{skill}(s')}{\text{skill}(s)}\right)$$
The Paradox of Detachment
Ironically, those who optimize for process often achieve better outcomes:
This occurs because:
- Reduced anxiety: $\text{performance} = \text{skill} - \text{anxiety}$
- Increased practice:
- Better learning: Positive emotions enhance neuroplasticity
Neurological Basis
The brain’s reward systems support this framework:
- Dopamine: Released during enjoyable practice, not just outcomes
- Endorphins: Generated by flow states
- Serotonin: Increased by mastery and progress
- Oxytocin: Released through community engagement
The neural value function becomes:
Conclusion: The Mathematics of Fulfillment
The advice to “love your craft” and “enjoy the journey” isn’t just feel-good wisdom—it’s mathematically optimal for:
- Learning efficiency: Positive emotions enhance neuroplasticity
- Sustainability: Intrinsic rewards prevent burnout
- Performance: Reduced anxiety and increased practice
- Innovation: Curiosity-driven exploration
- Life satisfaction: Cumulative daily joy dominates end-state rewards
The optimal human policy isn’t to suffer now for future rewards, but to structure life so that the journey itself is rewarding. This creates a positive spiral where enjoyment leads to practice, practice leads to mastery, and mastery leads to both intrinsic satisfaction and external success.
World Models and Learning: The Value of Accurate Mental Representations
Humans operate with internal world models that approximate reality. The accuracy of these models directly impacts our ability to maximize rewards. Let’s formalize how learning improves these models and why this matters for optimal decision-making.
The World Model Framework
Every human maintains an internal model of how the world works:
where:
- $\hat{\mathcal{P}}(s’|s,a)$ is our belief about state transitions
- $\hat{\mathcal{R}}(s,a,s’)$ is our belief about rewards
The true world model is:
Model Error and Suboptimal Policies
The error in our world model leads to suboptimal policies:
This model error bounds the suboptimality of our policy:
where $\hat{\pi}$ is the optimal policy under our incorrect model $\hat{\mathcal{M}}$.
Learning as Model Refinement
Education and experience refine our world model through Bayesian updates:
where $o_t$ is the observation at time $t$.
The Value of Information
Before learning, our expected value is:
After learning that improves model accuracy:
The value of learning is:
Types of Model Errors and Their Consequences
1. Transition Model Errors
Misunderstanding cause and effect:
This leads to poor financial decisions with expected value:
2. Reward Model Errors
Misunderstanding what brings happiness:
Leading to hedonic adaptation surprises:
3. State Space Errors
Not considering all relevant variables:
Missing crucial factors like:
- Long-term health consequences
- Relationship impacts
- Opportunity costs
The Dunning-Kruger Effect in RL Terms
Beginners often have high confidence with poor models:
Experts have calibrated uncertainty:
Model Complexity and Sample Efficiency
Simple models learn faster but have limited capacity:
Complex models can be more accurate but need more data:
The Exploration-Exploitation Tradeoff in Learning
Optimal learning balances:
where $\epsilon_t$ should decay as model accuracy improves:
Formal Education as Systematic Model Improvement
Education provides:
Theoretical Frameworks: Compressed experience
$$\hat{\mathcal{P}}_{\text{educated}} = \text{aggregate}(\{\mathcal{P}_i\}_{i=1}^{N_{\text{historical}}})$$Causal Understanding: Beyond correlation
$$P(Y|do(X)) \neq P(Y|X)$$Abstract Reasoning: Generalization across domains
$$\hat{\mathcal{P}}_{\text{abstract}}(s'|s,a) = f_{\text{general}}(\phi(s), \phi(a))$$
The Compound Effect of Better Models
Small improvements in model accuracy compound over time:
With better models:
Over a lifetime, this difference is enormous.
Meta-Learning: Learning How to Learn
Humans can improve their model-learning process itself:
where the learning rate $\alpha(t)$ can be optimized:
Practical Implications
Invest in Learning: The ROI on model improvement is:
$$\text{ROI}_{\text{learning}} = \frac{\Delta V_{\text{lifetime}}}{\text{cost}_{\text{learning}}} >> 1$$Seek Diverse Experiences: Broader data improves generalization
$$\text{Var}[\hat{\mathcal{P}}] \propto \frac{1}{\text{diversity of experiences}}$$Question Assumptions: Regularly test model predictions
$$\text{model\_update} = \begin{cases} \text{large} & \text{if prediction error high} \\ \text{small} & \text{if prediction error low} \end{cases}$$
The Wisdom Premium
The value difference between accurate and inaccurate models:
This “wisdom premium” justifies significant investment in education, mentorship, and deliberate practice.
Conclusion: Knowledge as Compound Interest
Better world models lead to better decisions, which compound over time. The earlier and more systematically we improve our models, the greater the lifetime benefit. This mathematical framework explains why:
- Education has such high returns
- Experience is valuable
- Wise mentors are sought after
- Continuous learning is optimal
- Humility (acknowledging model uncertainty) leads to better outcomes
The human journey can be seen as a continuous process of refining our world model to better navigate reality and maximize both immediate and long-term rewards.
Will add later
- There are some space that have high value function, for example being born righ