PART 16 / Advanced

Reinforcement learning + SNNs

Can biological structure be a useful inductive bias when behavior must be learned?

Illustrated introduction

What you will learn

Compare learned policies across matched architectures, seeds, and training budgets.

Before you begin: Foundations: matter, mathematics & computation; Spiking neural networks; Robotics: estimation, planning & control

Actions change future evidence

In supervised learning, labels usually arrive as part of a dataset. In reinforcement learning, a policy chooses actions that influence future observations and rewards. A Markov decision process is a mathematical description with states, actions, transitions and rewards. If an observation omits important state, memory or belief-state estimation may be needed.

Return is not the immediate reward

A decision can have delayed consequences. Discounted return combines rewards across time, with gamma controlling how strongly later rewards contribute. A value function predicts return under specified behavior. Policy gradients adjust action-selection parameters; actor-critic methods combine a policy with value estimation. PPO is one family of policy-optimization methods, not a guarantee of learning a robust controller.

A spiking policy is a modeling choice

An SNN can encode observations, keep temporal state and produce activity for an action decoder. Compare it with a conventional recurrent policy under matching environment interactions, parameter budgets and evaluation seeds. If connectome structure is used, include degree-matched rewiring controls. Reward design and training data can explain success even when biological structure contributes little.

SEE THE RELATIONSHIPS

From structure to behavior.

Network: a labelled conceptual diagram
Figure 16.1 · Network. Original educational diagram; synthetic, not a measured result.
The reasoning pathObservation & state then Policy chooses action then Environment changes then Reward & learning1. Observation & state2. Policy chooses action3. Environment changes4. Reward & learning
A learning flow for this part. Follow the assumptions through to an observable result.

MAKE THE IDEA PRECISE

The mathematics.

G_0 = r_0 + gamma r_1 + gamma² r_2 + ...
Symbols and units
SymbolMeaning
G_0Discounted return beginning at time zero
r_tReward at step t
gammaDiscount factor between zero and one
tDiscrete decision step

Build the equation, step by step

  1. Choose a reward convention and horizon. The reward at the first transition receives weight one, the next receives γ, and later rewards receive successive powers.
  2. Multiply each observed reward by its discount factor and add them to obtain a realized return.
  3. Expected value averages returns under a policy and environment distribution. One observed return is a sample, not the value function or evidence that a policy has learned.

WORK THROUGH THE NUMBERS

Worked example

Rewards [1, 0, 2] with gamma = 0.9 produce 1 + 0 + 1.62 = 2.62. Return depends on the chosen discount and reward definition, not on a universal meaning of success.

A small Python experiment.

Python 3 · Standard library only · Synthetic educational example. Run this in your own notebook or a local file.

rewards, gamma = [1, 0, 2], 0.9
value = sum((gamma**t)*r for t,r in enumerate(rewards))
print(f"return = {value:.2f}")

Expected output

return = 2.62

Change one quantity, predict the result, and then run the code again. Explain any difference before adding complexity.

Test your understanding.

Try it: Compare gamma = 0 and gamma = 1. Which behavior would each objective favor?

Self-check: If an agent gets a larger training return, is it better at the intended task?

Only if the reward captures the intended task and the comparison generalizes to held-out conditions. Reward exploits, changed termination rules and different budgets can make returns misleading. Keep a task-level evaluation separate from training feedback.

Where this model stops: Optimizing a reward can exploit loopholes or fail outside training conditions.

A research question: Does a structural prior improve sample efficiency after matching recurrence and compute?

Record evidence in your mastery worksheet →

THE NEXT LAYER

Chapter depth map.

This introduction provides a first model. The following chapters are outlines for deeper future editions; their full treatments have not yet been published.

Learning from consequences

16.1 MDPs and value · Outline
  1. 16.1.1 States, actions, transitions and rewards
  2. 16.1.2 Markov assumptions and partial observability
  3. 16.1.3 Policies, returns and discounting
  4. 16.1.4 Value functions and Bellman equations
  5. 16.1.5 Q-learning and exploration
16.2 Policy optimization · Outline
  1. 16.2.1 Policy gradients and credit assignment
  2. 16.2.2 Actor-critic methods and variance reduction
  3. 16.2.3 PPO objective and clipping intuition
  4. 16.2.4 Reward design and unintended incentives
  5. 16.2.5 Evaluation seeds separate from training

Spiking and structural priors

16.3 Learning in a spiking policy · Outline
  1. 16.3.1 Temporal state and action decoding
  2. 16.3.2 Surrogate gradients versus local rules
  3. 16.3.3 Reward-modulated STDP and eligibility traces
  4. 16.3.4 Evolution strategies and neuroevolution
  5. 16.3.5 Cost of simulation and sample collection
16.4 Does connectome structure help? · Outline
  1. 16.4.1 Connectivity as an inductive-bias hypothesis
  2. 16.4.2 Degree-matched and randomly rewired controls
  3. 16.4.3 Fixed topology versus learned topology
  4. 16.4.4 Sample efficiency, robustness and compute
  5. 16.4.5 Reject the hypothesis if matched baselines win

Read with the original sources.

These readings support the concepts and deeper investigation. The worked numbers and illustrations above are teaching examples.

Complete source register →

Where next?