..

iuSTDP: TrueTime meets STDP

When you’re thinking about how to build a world brain, you end up with a huge bag of shifting unsolved problems. One of the big ones is how to deal with pesky latency between groups of neurons. Neurons are very sensitive to when they receive spikes (boolean signals) from other neurons. If a spike arrives too late or too early, it may result in incorrect signal output by triggering or suppressing a spike. Incorrectly timed spikes is a good way to turn your world brain into a very complicated random noise generator.

In the distributed systems world, there are well established techniques such as Marzullo’s algorithm along with various clock discipline techniques to trend clock drift. We’re going to skip over all of that and assume we can reliably calculate the difference in time between processors in a distributed system. It’s a complicated topic in itself, but it’s not the focus of this post.

So, let’s get back to it. Neurons can learn information with something called spike-timing-dependent plasticity (STDP). As you may of guessed from the name, it’s very sensitive to timing. It cares about “who fired before who”. If you get the timing wrong, it won’t work. Clock drift between servers is a problem with getting this to work in a distributed system.

Timing uncertainty isn’t going away, so let’s bake it into the training algorithm. We’re lucky that we have some tools to deal with this. TrueTime is one of them. It’s a technique that says “we don’t know the exact time, but here’s a safe interval”.

When we merge together TrueTime and STDP, we associate every spike with an uncertainty interval instead of a discrete timestamp. I’ve named this process “iuSTDP” (interval-uncertainty STDP). The rest of this document puts iuSTDP in more concrete terms.

Definitions

  • LTP/LTD: strengthen/weaken a synapse.
  • P: probability that pre happened before post.
  • σ: effective uncertainty of Δt.

STDP Recap

Define Δt = t_post − t_pre.

  • Δt > 0 (pre before post): strengthen (LTP), effect decays with Δt
    • magnitude ~ A_plus · exp(−Δt/τ_plus)
  • Δt < 0 (post before pre): weaken (LTD), effect decays with |Δt|
    • magnitude ~ A_minus · exp(−|Δt|/τ_minus)
  • Closer in time → bigger nudge. Farther → smaller.

Intervals instead of timestamps

Clock drift means you don’t have an exact time, you have a cone of uncertainty.

Each spike comes with an interval:

  • Pre spike: [L_pre, U_pre]

  • Post spike: [L_post, U_post]

  • U_pre < L_post → pre definitely before post (LTP).

  • U_post < L_pre → post definitely before pre (LTD).

  • Otherwise intervals overlap → order is uncertain.

Uncertainty shrinks when clocks are synced up better (e.g. atomic clocks). It grows when the network is slow or time crystal ticks diverge.

For reference, see a simple implementation of TrueTime I wrote back in 2013.

Turning intervals into training

We want P = Prob(pre happened before post) = Prob(Δt > 0).

An estimate needs two numbers:

  • Δt_mean: best guess for t_post − t_pre
    • Δt_mean ≈ mid(L_post, U_post) − mid(L_pre, U_pre)
  • σ: uncertainty around that guess
    • σ grows with interval width
    • quick estimate: σ² ≈ (width_pre² + width_post²)/12 + σ_path² + σ_clock²

Assume a Gaussian around Δt_mean with variance σ². Then:

  • Δt_mean ≫ σ → P near 1 (confident LTP)
  • Δt_mean ≪ −σ → P near 0 (confident LTD)
  • |Δt_mean| ≲ σ → P ≈ 0.5 (shrug)

Two modes

  1. Conservative (external-consistency)
  • Only learn when order is certain.
  • If U_pre < L_post or P ≥ threshold (say 0.9): do LTP using Δt_mean.
  • If U_post < L_pre or (1 − P) ≥ threshold: do LTD using |Δt_mean|.
  • Else: skip this pair.
  • Optional “commit-wait”: delay applying updates until max(U_pre, U_post) + margin has passed so stragglers don’t trick you.
  1. Probabilistic (expected-update)
  • Always learn, but proportionally:
    • LTP_mag = A_plus · exp(−max(Δt_mean, 0)/τ_plus)
    • LTD_mag = A_minus · exp(−max(−Δt_mean, 0)/τ_minus)
    • Δw = P · (+LTP_mag) − (1 − P) · (LTD_mag)
  • Add a temperature if it feels twitchy (divide Δt_mean by >1 before exponentials).

Examples

  1. Tight and ordered
  • Pre [100.0, 100.5], Post [103.0, 103.5]
  • Clear non-overlap → LTP, decent magnitude.
  1. Overlap and ambiguous
  • Pre [100, 110], Post [105, 115]
  • Overlap, wide intervals → P ~ 0.6
    • Conservative: skip.
    • Probabilistic: tiny LTP.
  1. Tight and reversed
  • Pre [100.0, 100.2], Post [99.7, 99.9]
  • Clear non-overlap (reverse) → LTD.

Bonus

Congratulations on getting down to the bottom of this post! If you want a preview of a future post I’m working on, take a look my logic gate LIF neuron simulator.