Spike sorting using non-volatile metal-oxide memristors

Electrophysiological techniques have improved substantially over the past years to the point that neuroprosthetics applications are becoming viable. This evolution has been fuelled by the advancement of implantable microelectrode technologies that have followed their own version of Moore's scaling law. Similarly to electronics, however, excessive data-rates and strained power budgets require the development of more efficient computation paradigms for handling neural data in-situ, in particular the computationally heavy task of events classification. Here, we demonstrate how the intrinsic analogue programmability of memristive devices can be exploited to perform spike-sorting. We then show how combining memristors with standard logic enables efficient in-silico template matching. Leveraging the physical properties of nanoscale memristors allows us to implement ultra-compact analogue circuits for neural signal processing at the power cost of digital.

Spike sorting is the procedure of identifying the activity of individual neurons from data collected through electrophysiological experiments 13,14,15,16 .Typically this involves processing raw neuronal data by first detecting the presence of action potential (spiking) activity, then extracting appropriately chosen features and finally, clustering the results; each cluster corresponding to an individual neuron.Memristive devices can inherently act as thresholded integrators 17 .When presented with an input voltage waveform the devices accumulate changes in resistive state linked to the instantaneous signal magnitude and polarity, so long as this exceeds the device threshold.We recently exploited this property for detecting neuronal spiking activity 8 while filtering out background noise.
The combination of any programming signal amplitude and polarity that induces analogous resistive switching can be treated as a spike feature, thus rendering spike sorting at the memristor level possible.A simplified diagram of a single memristor-based spike sorter channel is shown in Fig. 1(a).Analogue input neural data is subjected to suitable amplification and is then fed into the memristive device (see methods and Supplementary Figure 1).The amplification step ensures that action potential contributions to the input waveform exceed the device's thresholds, whilst background noise does not.Periodically the memristor's resistive state is assessed and the differences between consecutive readings are recorded (Supplementary Figure 1(b)).This is illustrated in Fig. 1(b-g) and Supplementary Figure 2, where the prominent peaks in the three example neural signals cause distinctive changes in the resistive state of the device under test.In order to avoid accumulating resistive state changes to the point of saturation 9 , the devices are regularly reset to a suitable resistive state baseline 9 (also see Supplementary Figures 3).
The capability of single memristive devices to act as spike sorting elements was experimentally demonstrated using a commercially available memristor characterisation instrumentation (see methods section and Supplementary Figure 4).Publicly available simulated neural signals constructed based on electrophysiological recordings from the cortex and basal ganglia 15 were used as the input data for the memristive spike sorter (Supplementary Figure 5).The data contained three distinct single-unit activity waveform prototypes overlaid on a noise background (Supplementary Table 1,2).The instrument applied suitable amplification and relayed these waveforms to stand-alone devices.
For the first experiment, averages of each of the three single-unit waveforms were obtained by pooling ten random instances from each class.These were then arranged in a spike triplet (Fig. 2(a)) and Supplementary Figure 6, at the end of which a reset pulse was appended.Ten spike triplets were sequentially fed into the test memristor and its resistive state was regularly assessed 3 times during each triplet, producing results similar to Fig. 1(b-g) (amplification gain: -1.3 offset: -0.63V).Plotting the change in resistive state between every pair of consecutive measurements vs. the resistive state in the first measurement of the same pair results in Fig. 2(b).These results capture the impact of each spike's strength on setting the memory state of the device with respect to its initial state, as exemplified by the shaded spikes in Fig. 2(a) and their corresponding R(ΔR) points in Fig. 2(b) (for raw data example see Supplementary Table 3).The clear clustering of data-points associated with the three distinct spike waveform prototypes demonstrates that the memristive device is capable of intrinsically performing spike sorting consistently.As the waveform input to the device is identical for each triplet, any variation in R(ΔR) response arises mainly from device variability.
For the second experiment, the triplets were constructed from individual spike instances (not averaged prototypes) and their order was randomised as shown in Fig. 2(c) and Supplementary Figure 7.This setup accounts for background noise-induced spike shape variability 15 .Results are shown in Fig. 2(d) and Supplementary Table 4, where the intrinsic variability in device behaviour is compounded by the variability in the spike waveforms.Notably, despite the fact that clustering is no longer as clear as in Fig. 2(b), it is still possible to linearly separate the majority of events.The misclassified spike that caused strong change in resistive state (enclosed in a box) was the result of the event instance containing two spikes in close succession (main spike plus a stray spike).
One of the most popular approaches to performing spike sorting is the template matching technique 18 .It is a very powerful yet computationally intensive technique that involves regularly sampling and digitising data arriving from the electrophysiological set-up and comparing small snippets of consecutive samples (typically 10-20 19 ) against a set of stored templates.Its strength stems from the fact that whenever a match is found the system registers the occurrence of a spike and the matching template ID, thus simultaneously providing spike timing and identification information.Here, we implement the template matching technique with memristive technologies directly in the analogue domain, using the devices programmability for storing the templates close to the site of computation.This obviates both the requirement for an analogue-to-digital converter (ADC) at the high bandwidth input signal line and the need for a dedicated memory circuit block for storing the templates.This concept is realised via the circuit topology shown in Fig. 3(a).We refer to this circuit as a 'texel' (template pixel) that consists of a memristor and six transistors and its output current I out depends on the proximity of the input voltage value V IN to a stored value that is determined by the resistive state of memristor R1.When V IN is close to stored value V pk , I out increases, therefore the texel acts as an inputvs-stored voltage distance-calculating circuit.Internally it consists of an enhanced inverter followed by an output stage.The output stage forces I out to peak whenever internal node voltage V MID reaches some optimal value V OPT determined by the transistor sizings in the output stage, but the value of V IN that forces V MID to that optimal level (a.k.a. the stored value V pk ) is determined by the memristor R1.This process is shown in Fig. 3(b) by illustrating measured transfer characteristics of a discrete texel circuit.
The texel concept was evaluated by assembling an array of four texels, feeding them with nine neural spike waveforms from the same database 15 (Supplementary Figure 5(a)) and summing the current outputs of each texel down a common load resistor, as shown in Fig. 3(e,f).Three spike instances were chosen from each class presented in Fig. 1: a low (L), a medium (M) and a high (H) instance corresponding to spikes exhibiting lower than, similar to or higher than class-average voltage levels (see methods and Supplementary Figure 8).The voltage level at the system's V OUT terminal is linked to the degree of matching between the input vector k and the stored template and was directly used as a matching degree metric.Due to the similarity between the H instance of class 1 and the L instance of class 2 and the limited resolution of our instrumentation, the experiment for these two instances was ran only once with a common input vector k (see Supplementary Table 5).Results are moreover shown in Fig. 3(g) for a texel array set up to discriminate for class 2 spikes.Even using only four samples from each waveform (marked in Fig. 3(e)) strong discrimination between templates is clearly achieved.
In conclusion, we demonstrate that memristor-based spike sorting systems are promising candidates for future brain-machine interfaces.The spike sorting ability of the concept systems presented here is compounded by the positive downscaling prospects of memristive technologies, both in area 12 and power 20 .Our results prove that single nanometre scale devices can capture enough input signal information for encoding distinct spike classes at no extra power (~100nW) 21 or area cost to what we have shown previously for spike detection 17,21 .Moreover, the proposed memristor-based texel architecture enables carrying out the computationally intensive template matching-based spike sorting 19 on a low component count, low parasitic capacitance system that essentially consists of a few, modified inverters and operates in the analogue domain on a digital power budget (see Supplementary Figures 9,10,11 and Supplementary material 1).Our results bring new application prospects for memristive devices, diversifying from conventional digital memory applications towards enabling active neural interfacing technologies that are very much needed for realising the electroceuticals vision 22 .

Methods
Memristive devices: For all experiments in this work bilayer metal-oxide memristors were used with stack configuration Pt/AlOx/TiOx/Pt (10/4/40/10 nm).The devices featured an area of 20x20 um 2 .Patterning was carried out using conventional optical lithography and lift-off processes.The electrodes were deposited using e-beam evaporation while the oxides were fabricated using magnetron sputtering.Electrical characterisation was carried out using a memristor characterisation and testing platform featuring ArC instruments Ltd.Technology (http://www.arc-instruments.co.uk/).Before use all devices had to be electroformed; a one-time process that electrochemically activates the memristor 23 .Our test devices typically electroform once at 8-12V.Once electroformed, the devices show reliable, wellbehaved switching in the [+1.2, +2.5]V and [-1.2, -2.5]V ranges.For this work the devices were used in the 5-20 kΩ resistive state operating range.

Neural data source:
The neural data used for our experiments is publically available from the univ. of Leicester, R. Q. Quiroga group (http://www2.le.ac.uk/centres/csn/software) 15 ; dataset no. 2. It consists of a simulated neural recording synthesised using three distinct singe-unit activity templates (extracted from measured data) overlaid on top of background noise.We refer to each unique combination of a standardised spike waveform plus noise as a 'spike instance'.
Memristive spike sorter signal processing: Input neural recording data was processed as illustrated in Supplementary Figure 2; a methodology very similar to 17 .

Texel Array Experiment:
The experiment was carried out on a stripboard-based discrete component implementation of a 4-point texel array.The common load resistance was 300kΩ and the power supply 1.3V.Memristive devices were used as the memristor elements in each texel.All four devices used in the experiment resided on a single die with 32 available devices in total.Signals were fed into this system using two, dual-channel benchtop power supplies with two significant decimal digits resolution.
The benefit of using synthetic neural recording input data is that it contains ground truth information on spike identification and timing.On that basis an automatic sample selection script was ran on each spike instance available in the dataset in order to choose which data-samples from each instance are to be fed into the texel array for matching against a stored template.The script operated as follows: the data-points in each spike instance were read sequentially and once a trigger threshold V trig was exceeded for the first time the script skipped six samples and then choose the subsequent four as candidate inputs for the texel array set-up.This methodology was chosen because it rendered the three classes of spikes visibly distinguishable despite the use of only four template points.The overall 'trigger and sample' approach is similar to the work by Restituto-Delgado et al. 24 .In a more mature system implementation a larger texel array containing more than four samples would be used.Next, the extracted candidate four-texel sample sets were separated by single unit-template class.From each class, three texel sets were chosen for further processing: one featuring typical (M), one featuring lower than usual (L) and one featuring higher than usual (H) voltage values (selection shown in Supplementary Figure 8).Waveforms where the presence of more than one spike within each instance had corrupted the output of the sample selection script were automatically excluded from the selection.The voltage range of all nine selected sample sets (L, M, H instances for each of the three classes) was then adjusted by application of a common pair of gain and offset settings (Gain: 0.1; Offset: 0.66V).The adjusted texel data-point voltages were then suitable for working with the input voltage values the texel circuits were built to discriminate between.These adjusted values are shown in the inset of Figure 3(e) and were used as the input to the texel array after being rounded to 10mV precision (two significant decimal digits).This procedure caused the rounded texel voltages of the H instance of class 1 and the L instance of class 2 to completely overlap, hence that experiment was conducted only once for both cases.The waveform contains 10 identical copies of a spike triplet.Each triplet contains a succession of three different spike waveforms and is terminated by a reset pulse (example highlighted in yellow).Averaged spike waveforms were used in this case (thick traces in Figure 1(b,d,f)).Arrows and numbers indicate the timing and waveform class of each spike within a triplet.(b) Summary of results.Change in resistive state vs. starting resistive state for each pair of consecutive measurements taken whilst the input from (a) was applied to the memristive device (see Figure 1(c,e,g) and main text for details).The emergence of three distinct clusters of data-points corresponding to the three input spike classes is observed.Highlighted data-points (black outline): points gathered while applying the 8 th triplet as input.(c) Input waveform consisting of ten triplets, each constituted by random spike instances appearing in randomised order.(d) Corresponding results.The variability introduced by the input waveforms scatters the clusters which, however, remain broadly linearly separable.Boxed data point: the spike instance waveform contained a double spike (spike triplet 6 -highlighted in (c)).

Figure 1 :
Figure 1: Memristive devices and neural signals.(a) Simplified schematic of experimental set-up.The top electrode of each test device was grounded whilst suitably amplified neural signal data samples were applied to the bottom electrode.Inset: Atomic Force Microscopy image memristive devices.(b, d, f) Neural signal data used as input to the memristive spike sorter.Each panel corresponds to neural spikes generated by different neurons and consequently featuring different signature waveforms.Thick traces: average spike waveform for each class (average of 10 instances).Thin traces: 10 different individual instances of spikes (c,e,g).Data includes amplification as shown in (a).Response of

Figure 2 :
Figure2: Spike sorting using memristive devices.(a) Input waveform for repeatability experiment.The waveform contains 10 identical copies of a spike triplet.Each triplet contains a succession of three different spike waveforms and is terminated by a reset pulse (example highlighted in yellow).Averaged spike waveforms were used in this case (thick traces in Figure1(b,d,f)).Arrows and numbers indicate the timing and waveform class of each spike within a triplet.(b) Summary of results.Change in resistive state vs. starting resistive state for each pair of consecutive measurements taken whilst the input from (a) was applied to the memristive device (see Figure1(c,e,g) and main text for details).The emergence of three distinct clusters of data-points corresponding to the three input spike classes is observed.Highlighted data-points (black outline): points gathered while applying the 8 th triplet as input.(c) Input waveform consisting of ten triplets, each constituted by random spike instances appearing in randomised order.(d) Corresponding results.The variability introduced by the input waveforms scatters the clusters which, however, remain broadly linearly separable.Boxed data point: the spike instance waveform contained a double spike (spike triplet 6 -highlighted in (c)).

Figure 3 :
Figure 3: Analogue domain template matching using memristive technologies.(a) Schematic of 'texel' circuit illustrating the breakdown into an enhanced inverter containing a memristor (R1) and the readout stage.(b-c) Texel transfer characteristics from input voltage (b), through mid-point voltage V MID (c) and voltage at the output node (c).(e) Selected spike waveforms used as input to the test texel array.Crosses indicate the sample points used to feed the array.k: sample number.V trig : texel array sampling trigger level (see methods section for description of sampling strategy).Inset: close-up of the chosen sample points.L, M, H and arrows: Low, medium and high voltage instances of spikes in class 3. (f) Schematic of 4-texel array used to carry out experiments.(g) Measured output voltage when spike samples from (e) are applied to the texel array in (f).Low, medium and high voltage (L, M, H) versions of spikes in each class shown.Higher voltage means greater degree of matching between input data and stored template.The texel array was programmed to respond best to class 2 spikes.Colours as in (e).Class 1-H and class 2-L results refer to the same experiment (discussed in methods section).