Spiking Timestral

Mistral's Timestral-28M turned into a true spiking neural network, running bit-exact on a ~$30 FPGA

Overview

Mistral released Timestral-28M, a small open-weights foundation model for time-series forecasting: energy grids, traffic, tides, hospitals, that kind of thing. I took it and turned it into a true spiking neural network (SNN), then ran it on a physical ~$30 FPGA, a Sipeed Tang Primer 20K.

The idea behind spiking networks is simple: neurons only "speak" when they have something to say. If most neurons stay quiet, you skip most of the work, and on edge hardware the expensive part is reading weights from memory, not the maths.

The result:

  • 18th of 53 on fev-bench, within 2% of the original float model
  • ~40% fewer weight reads per update, an estimated ~39% less energy
  • Bit-exact on the board: all 414 M4-hourly series, 3,312 forecasts, 0 mismatched bytes, on the first attempt
  • 363 ms per update on the board, 1.29× faster than a dense version of the same model on the same chip
  • About 0.8 W, roughly 19× less energy per streamed forecast than an RTX 2080 Ti at batch 1 (board power is estimated from the Gowin power report and the DDR3 datasheet, not metered)

How it works

Here's one update's journey through the model. Every new 32-point patch of data goes through 12 layers, and the orange blocks are the spiking parts: they only do work when something actually changes.

One update's journey through Spiking Timestral: the new patch is scaled and embedded, then goes through 12 layers of charge-neuron projections, attention and the sparse MLP, then the head turns it into a 48-step forecast

1. Make the MLP sparse. Timestral uses SwiGLU activations, which are non-zero almost everywhere, so every neuron fires all the time. I swapped them for a gated ReLU with a learned threshold, gate · ReLU(up − τ), and distilled it from the original model with a penalty on activity. Now over 81% of the MLP neurons are exactly zero, and a silent neuron never has to fetch its weights from memory.

2. Charging neurons. The obvious way to save more work is to only send a neuron's value when it changes by more than some threshold. But on slow or repeating series those small, ignored changes add up forever, and errors got up to 16× worse on smooth series. So I put integrate-and-fire neurons in front of the attention projections and the MLP input: small changes build up as "charge", and when the charge crosses a learned threshold the neuron fires everything it has saved up and resets. That fixes the drift completely and cuts another ~10% of weight reads. Only the thresholds are trained, on streams of updates, with every weight frozen.

A charging neuron: small changes build up as charge over several updates, and the neuron only sends when the charge crosses the threshold

3. 10-bit values, 8-bit weights. Everything inside runs in integers: 10-bit activations with 4× headroom so rare big values never clip, and 8-bit weights. No floating point multipliers, and neither step needed any training.

4. Graded event spikes. Instead of firing thousands of tiny spikes to send one number, each neuron sends at most one event per update, carrying its 10-bit change (the same idea as Intel's Loihi 2). Silent and unchanged neurons send nothing, and the receiver just adds weight × change to a running total. The integer maths is exact, so it replays bit-for-bit.

On the FPGA

I compiled the model for the Tang Primer 20K: a Gowin GW2A-18 with just 48 hardware multipliers and 128 MB of DDR3, with the engine at 66 MHz.

Each of the 414 M4-hourly series is streamed as one cold forecast and seven warm updates, and every output byte is compared with the Python integer reference. All 414 matched on the first try. I ran the whole thing again on a second build of the same design and got the same result.

Because spiking skips silent and unchanged neurons, the time per update follows the data: 354–370 ms for most updates, and as low as 254 ms on the calmest series. Compared with a dense version with every neuron active on the same chip, it does 34% fewer multiply-adds and reads 28% less from DDR3.

Left: chip time for all 2,898 warm updates on the board, median 363 ms. Right: dense vs spiking on the same engine, 1.29× faster, 34% fewer multiply-adds and 28% less DDR3 read

To be fair to the GPU: it's faster at every batch size, and once you batch forecasts it wins on energy too. The FPGA wins when you stream one series at a time, which is exactly the edge-device case.

Try it

The weights are on Hugging Face at tarat122/spiking-timestral, and the code, board logs and the integer reference the board matches are on GitHub. The full write-up is in the paper, and there's a one-page overview too.

PS: the weights are a derivative of Timestral-28M, so they come under Mistral's Modified MIT License (including its revenue restriction). The code is Apache-2.0.

Related projects and writings