Anytime Generation from a Single Latent Spike Wave

Spiking neural networks are brain-inspired models whose units communicate through brief binary events ("spikes") rather than real numbers. They are attractive because they run on low-power neuromorphic chips. Existing spiking variational autoencoders are generative models that compress an input into a small random code and then reconstruct or sample from it. They store information in how often each neuron fires over many simulation steps. The most efficient of them, ESVAE, found that shuffling spikes along the time axis barely hurts reconstruction ESVAE. In other words, time is used only as a counting medium. Latency coding takes the opposite view. In latency coding, also called time-to-first-spike coding, each neuron fires at most once, and the information lies in when it fires. Stronger evidence fires earlier. This scheme supports classification in about one to three simulation steps ETTFS.

We propose a variational autoencoder whose latent code is a single wave of spikes. Each latent neuron fires once. The encoder is trained so that the spikes carrying the most information about a given input arrive first, and the decoder is trained to produce a usable reconstruction from whatever part of the wave has arrived so far. The result is an "anytime" generator: output quality rises as the wave comes in, and computation can stop early. The ordering is chosen separately for each input, which a rate code cannot express and a converted conventional network does not learn. The central test is whether this per-input ordering beats a fixed, global ordering of latent dimensions. If it does not, latency coding adds nothing here beyond compression.

Core Claim

In a spiking autoencoder with a single-spike latent layer, spike time can act as an input-dependent importance ranking. Training the decoder on all truncations of the arriving wave should produce reconstructions whose quality rises steeply in the first few time steps. It should also match rate-coded spiking autoencoders at full length while using far fewer steps and spikes. The latency literature motivates the claim. Thorpe et al. argue that visual categorization is too fast for neurons to integrate multiple spikes, so it must rely on single-spike waves Rapid Visual Processing using Spike Asynchrony. Bonilla et al. show that order-sensitive readouts reach peak discriminability early in the wave Analyzing time-to-first-spike coding schemes. Both results concern recognition. Neither says anything about reconstructing or sampling data, and the file contains no generative time-to-first-spike model at all.

The Model

The encoder is a deep time-to-first-spike network built with the training recipe of Che et al. ETTFS. That recipe has four parts: an initialization that keeps signals from dying out across layers, weight normalization that folds into the weights at inference, average pooling in place of max pooling (max pooling can make a neuron fire twice), and spikes that propagate layer by layer without waiting for a global clock. For input $x$, the encoder outputs a mean latency $\mu_i(x)$ and a spread $\sigma_i(x)$ for each of $D$ latent neurons. It then samples a firing time $\tau_i = \mathrm{clip}(\mu_i + \sigma_i \epsilon_i, 0, T)$, where $\epsilon_i$ is standard noise and $T$ is the time window. This is the usual reparameterization trick moved onto spike times; physically it corresponds to jitter in the firing threshold. A neuron clipped at $T$ is treated as silent, meaning "not yet arrived."

The decoder is also a single-spike network. It maps the latency code to latency-coded output intensities through the exact equivalence between ReLU networks and time-to-first-spike networks An Exact Mapping From ReLU Networks to Spiking Neural Networks. We borrow that mapping for the decoder's internal computation. It does not supply a latent distribution, because it is deterministic.

The training objective has two terms, a truncated reconstruction loss and a prior-matching term:

$$\mathcal{L} = \mathbb{E}_{t \sim \pi}\, \big[ -\log p_\theta(x \mid m_t \odot \tau) \big] + \lambda\, \mathrm{MMD}\big(q(\tau),\, p(\tau)\big).$$

The symbols are as follows. $m_t$ is a soft arrival mask with entries $\sigma((t-\tau_i)/\beta)$, so latent $i$ is visible once time $t$ passes $\tau_i$, and $\beta$ is a small temperature. $\pi$ is a distribution over truncation times in $[0, T]$. $\lambda$ weights the prior term. $p(\tau)$ is a latency prior, either an exponential decay or a uniform window.

The first term makes early arrivals worth more, because they appear in every truncation that follows them. This pushes the most informative dimensions for that particular input to fire first. It generalizes ETTFS's decaying output weighting from one class decision to a whole reconstruction.

The second term uses maximum mean discrepancy, a kernel distance between sample sets, which is the tool FSVAE and ESVAE already use for spiking latents Fully Spiking Variational Autoencoder. Here it is applied to arrival times rather than to spike trains or firing rates. To generate a new sample, we draw $\tau \sim p(\tau)$ and inject it as one spike per latent neuron. Gradients through the firing times use exact latency derivatives in the style of BPLC BPLC + NOSO. BPLC's derivatives blow up when the membrane potential crosses threshold almost tangentially, so we clip the gradient where the membrane slope is near zero and report how often clipping occurs.

Research Program

The first stage is recognition-free autoencoding on MNIST and Fashion-MNIST, used to establish that single-spike latents train at all. The main risk is latent neurons that never fire and so receive no gradient. We will measure the fraction of latents that fire during training, with and without ETTFS initialization.

The second stage moves to CIFAR-10 and CelebA, which both FSVAE and ESVAE report on. This stage requires single-spike upsampling in the decoder. We implement it as transposed convolutions without pooling and check that no neuron fires more than once. The file identifies this interaction as unstudied.

The third stage is the analysis that gives the project its point. We measure how quality rises over time, test whether the learned ordering is really specific to each input, and count energy by counting synaptic operations.

Protein sequence design is a tempting application, but we leave it out. Its strong baselines on ProteinGym ProteinGym are continuous models with no efficiency constraint. Mixing a new coding scheme with a new domain would make any failure impossible to diagnose.

Baselines

The naive reference is a standard continuous VAE of the same width and depth. It fixes the quality ceiling for each architecture. FSVAE reports a CIFAR-10 Inception Score of 2.591 for its ANN VAE baseline Fully Spiking Variational Autoencoder. We will retrain it under our settings rather than rely on that number.

The strongest existing spiking competitor is ESVAE. It samples latent spikes from firing rates using a differentiable Poisson trick and matches rates to a prior with maximum mean discrepancy. It reports an Inception Score of 3.758 and a Fréchet Inception Distance of 127.0 on CIFAR-10, and 0.0012 J per MNIST inference ESVAE. FSVAE, which uses an autoregressive spiking latent, reports an Inception Score of 2.945 and a Fréchet Inception Distance of 175.5 as cited by ESVAE.

We will rerun ESVAE with its public settings on the same backbone widths, over a sweep of time windows that includes very short ones. This way the comparison is at matched simulation steps, not only at ESVAE's default. Both methods get the same hyperparameter search budget. The file has no reported Fréchet Inception Distance for Fashion-MNIST or CelebA for either spiking VAE, so those comparisons come from our reruns.

Beating ESVAE means one of two outcomes. The first is matching its Fréchet Inception Distance at full length while using fewer latent spikes and fewer simulation steps. The second is clearly better quality at any matched step budget of about three steps or fewer. ETTFS's roughly 2.93-step CIFAR-10 classification sets that budget scale.

The conversion baseline trains a continuous VAE with a bounded latent and ReLU decoder. We then convert the decoder exactly into a time-to-first-spike network with the Stanojevic mapping, so latent values become firing times with no learned ordering objective.

The key ablation isolates per-input ordering. We train an otherwise identical model in which every input shares one fixed arrival order across latent dimensions. This amounts to nested dropout expressed in time, where earlier dimensions are always the more important ones. A second ablation removes the truncation term: we train only at $t = T$ and then evaluate at earlier truncations.

Why not just…?

Why not just run ESVAE with a very short time window? A rate code with $T$ steps can take only $T+1$ values per neuron, so at one to three steps each latent carries at most about one to two bits. A firing time on a fine clock can carry more, and the same limit applies to each hidden layer. That is the argument, but it is untested for generation. The matched-step sweep settles it directly. If ESVAE at three steps matches our model, the proposal's efficiency claim fails.

Why not just train a conventional VAE and convert it exactly? This is the most serious threat. The Stanojevic mapping is lossless for ReLU networks, and a bounded latent can be written as firing times with no loss. At full length the converted model may well match ours. Conversion does not learn which latents should arrive first, however, so its reconstruction from a truncated wave should be poor. Che et al. also note that conversion tends to bring high latency ETTFS. We will report quality at every truncation for both models. If the converted model's curve matches ours, the native training adds nothing and we will say so.

Why not just impose a fixed importance order in a conventional VAE, then convert? This gives anytime behavior without per-input timing, and it is exactly the fixed-order ablation. Our hypothesis is that different images need different dimensions first, for example texture first in some images and layout first in others. If the fixed order recovers most of the area under the quality-over-time curve, then latency coding contributes only an implementation of known ordered representations. That would be a legitimate negative finding and we would report it as the result.

Proposed Experiments

The primary metric is the area under the curve of reconstruction error, and of Fréchet Inception Distance for samples, plotted against simulation time. It is reported on MNIST, Fashion-MNIST, CIFAR-10 and CelebA. We also report full-length Inception Score and Fréchet Inception Distance, the mean number of latent and total spikes per sample, and energy estimated from synaptic operation counts using the same accounting ESVAE used.

Three checks decide the claim. First, we repeat ESVAE's shuffle test on our model. Randomly permuting latent firing times across neurons for each input should sharply degrade reconstruction; Zhan et al. found time shuffling harmless for their rate code, and our model should show the opposite. Second, per-input ordering must beat the fixed-order ablation in area under the quality curve by more than seed-to-seed variation across three seeds. Third, at a budget of three or fewer steps, our CIFAR-10 Fréchet Inception Distance must beat ESVAE's rerun at the same budget.

As a diagnostic, we will measure how much the latent arrival order agrees across inputs, using rank correlation. Low agreement combined with good early reconstructions would be direct evidence that the model has learned per-input importance ranking, and it would be the first generative counterpart of rank-order coding.