rcarney@lbl.gov 26/08/16 Student Instrumentation Weekly August 2016 update TrueNorth Kalman filter Rebecca Carney 1
Overview RMD Carney 29/04/15 3 Recap/Intro TrueNorth & Kalman filters 6 Neuron parameters and default properties 9 Quantifying our implementation diffs 13 Encoding window Spiking precision 23 Understanding the residuals 39 Next steps 2
From last time… RMD Carney 26/08/16 Kalman Filter Kalman filter and simple dataset A linear update algorithm that uses noisy measurements and previous states of a system to predict new states. The technique of combining previous state estimates and refining them with measurements produces a more accurate estimate of the state than using measurements alone. Test dataset So far, we’re only considering steady-state kaman filters as the covariance for the state prediction converges and can be calculated ahead of time. Our test dataset is the constant acceleration 1-dim projectile motion. So the idea is that for a set of noisy measurements in position, velocity, and acceleration the kaman filter will predict the next state. 3
KF as linear update RMD Carney 26/08/16 Blocks of linear algebra in spiking NN Ax(t) Off-chip On-chip By (t) + y (t) B x(t+dt) y = measurement (position, velocity, accn) x = state prediction (position, velocity, accn) x ( t + ∆ t ) = Ax ( t ) + By ( t ) The steady-state KF has a very simple update equation for the state prediction. If we start thinking about how we would implement this algorithm on a low-power multi- processor, it’s clear that we can pre-multiply the measurement off-chip to save space . If we do this then there is only one loop and multiplication step in the system! 4
TrueNorth architechture RMD Carney 01/05/16 4096 cores Inside TrueNorth Each core contains its own memory, connectivity map processing unit - with ‘neuron’ capabilities. The neuron computations are carried out in synchronous logic but wait for a ‘tick’ to start. TrueNorth numbers 1 million programmable neurons 256 million synapses 4096 neurosynaptic cores 70mW per chip* Spiking rate =1kHz Here is a schematic representation of a core. For the purposes of this update all you need to know if that the 5 computation takes part in the neuron.
Some other things… RMD Carney 26/08/15 There are 3 versions of the KF I will talk about in this presentation: • A spiking simulation of the Kalman filter, using temporal encoding, written in python (custom) • A spiking simulation of the chip, supplied by IBM • The chip itself. This neuromorphic setup: • Communicates with ‘spikes’, single bits of information • The chip has limited functionality and parameters, you cannot program it or implement digital logic • We encode floating point values using temporal encoding: we count how many spikes occur in a given window. 6
From last time… RMD Carney 26/08/15 Major issue! Positive to negative transition is screwed up somehow… Last time I showed that the KF implementation works on NSCS and NS1e (IBM’s chip simulator and the physical board) except for the transition from positive-to-negative (and vice versa!) values. 7
Kappa and Gamma RMD Carney 26/08/15 Neuron threshold reset parameters: positive and negative thresholds The problem turned out to be the default negative reset mode. Because we are encoding negative values in a separate channel that gets combined with the positive channel in the addition block, when the neuron potential dips below zero we want to immediately reset it to zero. The default mode however just adds Beta ( == 0 in our setup), so the potential just kept decreasing and no spikes were ever fired. Once we changed Kappa == 1… 8
Positive to negative transition… resolved! RMD Carney 26/08/16 NSCS formulation with Kappa/ Gamma == 1 … it resolves the issue! But do the chip simulator and the chip still 9 agree? They have to agree EXACTLY if we want to trust the NSCS.
Quantifying the KF: NSCS vs TN RMD Carney 26/08/15 Chip simulator response vs. chip NSCS state estimate 1 Input: measurements Output: NS1e state estimate 0.8 Projectile position [arb] response 0.6 0.4 0.2 0 1e-10 Residuals 0 -1e-10 0 50 100 150 200 250 300 Time [ms] 10 They agree exactly (diff of two output files is empty)!
Quantifying the KF: NSCS vs pySpiking RMD Carney 26/08/15 Chip simulator response vs. spiking Position 1 Velocity python response: non-identical! Accn input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.01 0 -0.01 0 50 100 150 200 250 Time [ms] BUT! The NSCS and pySpiking response is NOT identical. There are no random number throws in this formulation and no noise, so why are these different? This is very important: if these are different it means we’ve misunderstood something 11 about how the chip works!
Quantifying the KF: NSCS vs pySpiking RMD Carney 26/08/15 The problem with time-encoded spiking It turns out that this stark difference is due to how the input data is encoded into spike trains. For an encoding window of 10 ticks, the value 0.7 t=10 t=10 would be expressed as 7 ticks at the end of the window in NSCS, and 7 ticks at the beginning of the window in the Python simulation. networks… This matters because there is no way to explicitly reset the neuron potentials at the end of the encoding window and in the addition unit two values t=10 t=10 added together will likely overlap into the next window (see cartoon). In general this is a problem even if we prepend the spikes: large values that do not finish spiking by the end of the encoding frame will fall into the next time window and a smearing affect happens. t=10 t=10 Also, because the neuron potentials are likely not multiples of the threshold there will be some remainder stored int the neuron potential. This will 2 build up over time, introducing additional spikes in 1 the wrong window. Because of the recurrent connection there is no way to avoid this. 0 0 5 10 15 20 12 But does using the same encoding scheme make python and NSCS identical?
Quantifying the KF: NSCS vs pySpiking RMD Carney 26/08/16 KF Position 1 measurements KF Velocity NSCS estimate KF Accn 0.5 Projectile position [arb] No di ff erence! 0 -0.5 -1 0.01 Residuals 0 -0.01 0 50 100 150 200 250 300 Time [ms] 13 Yes! (A di ff on the two outputs was empty).
Representation error RMD Carney 26/08/16 NSCS KF vs numerical KF for 1D projectile - 10k tick encoding window, 1ms tick the magnitude of the representation error? How does the encoding window change Position 1 Velocity Accn input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.002 0 -0.002 0 50 100 150 200 250 300 Time [ms] Now that we understand the difficulties with the encoding scheme it would be interesting to see how the spiking simulations compare to the numerical KF with increasing encoding windows. 14 As encoding window —> infinity, it should approach the plot above.
10 spikes, TN weights, python RMD Carney 26/08/15 NSCS KF vs numerical KF for 1D projectile - 10 ms encoding window Position 1 Velocity Accn Scan encoding window input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.3 0 -0.3 0 50 100 150 200 250 300 Time [ms] 15 Can clearly see the max. transition in units of ticks
20 spikes, TN weights, python RMD Carney 26/08/15 NSCS KF vs numerical KF for 1D projectile - 20 tick encoding window, 1ms tick Position 1 Velocity Accn Scan encoding window input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.1 0 -0.1 0 50 100 150 200 250 300 Time [ms] 16 NB: The residuals scale changing
50 spikes, TN weights, python RMD Carney 26/08/15 NSCS KF vs numerical KF for 1D projectile - 50 tick encoding window, 1ms tick Position 1 Velocity Accn Scan encoding window input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.05 0 -0.05 0 50 100 150 200 250 300 Time [ms] 17
100 spikes, TN weights, python RMD Carney 26/08/15 NSCS KF vs numerical KF for 1D projectile - 100 tick encoding window, 1ms tick Position 1 Velocity Accn Scan encoding window input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.02 0 -0.02 0 50 100 150 200 250 300 Time [ms] 18
200 spikes, TN weights, python RMD Carney 26/08/15 NSCS KF vs numerical KF for 1D projectile - 200 tick encoding window, 1ms tick Position 1 Velocity Scan encoding window Accn input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.01 0 -0.01 0 50 100 150 200 250 300 Time [ms] 19
1k spikes, TN weights, python RMD Carney 26/08/15 NSCS KF vs numerical KF for 1D projectile - 1k tick encoding window, 1ms tick Position 1 Velocity Scan encoding window Accn input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.005 0 -0.005 0 50 100 150 200 250 300 Time [ms] 20
2k spikes, TN weights, python RMD Carney 26/08/15 NSCS KF vs numerical KF for 1D projectile - 2k tick encoding window, 1ms tick Position 1 Velocity Scan encoding window Accn input NSCS 0.5 Projectile data [arb] 0 -0.5 Unscaled residuals [arb] -1 0.002 0 -0.002 0 50 100 150 200 250 300 Time [ms] 21 A trend emerging?
Recommend
More recommend