FS^2-SSA-LM-100M: Softmax-Free Spiking Causal Language Model
FS-SSA-LM-100M is an autoregressive causal language model (~94M parameters) powered by Softmax-Free Spiking Self-Attention (FS-SSA), trained from scratch on ~655M tokens of FineWeb-Edu. The Softmax is replaced by a causally masked, decay-weighted row normalisation, and few-spike neurons code values as signed discrete spikes, so that dense floating-point Multiply-Accumulates (MACs) become sparse synaptic additions (ACs / SOPs). Since v2.3.0 this holds for every matrix product of the model, the output head included.
This repository holds four checkpoints, one per release:
| file | release | model | Best Val Loss | Best PPL |
|---|---|---|---|---|
model.pt |
v2.0.0 | hybrid: Q, K, V and the MLP neuron in spikes at K=2, projection inputs in floats, fixed per-head decay ladder | 3.6147 | 37.14 |
v2.1.0/model.pt |
v2.1.0 | spiking residual highway: every projection of the blocks reads spikes, K=3, data-dependent decay | 3.6573 | 38.75 |
v2.2.0/model.pt |
v2.2.0 | the model of v2.1.0, trained with a scheduled surrogate gradient | 3.6145 | 37.13 |
v2.3.0/model.pt |
v2.3.0 | the model of v2.2.0 with a spiking output head: every matrix product has a spike operand | 3.6395 | 38.07 |
- Source Code: GitHub Repository, with one folder per release (
v2.0.0/,v2.1.0/,v2.2.0/,v2.3.0/) - Permanent DOI: 10.5281/zenodo.22950217
Next: FSΒ²-SSA at about 200M parameters, trained next to a dense control of the same size and evaluated zero-shot on ARC-Easy, PIQA and HellaSwag. The first step needs no training: the same three benchmarks on the checkpoints of this repository, from the v2.0 hybrid to v2.3.
About the Name
Up to v1.0.x the model was released as FS-SSA-LM, the language model of FS-SSA (Softmax-Free Spiking Self-Attention). From v2.0.0 the project is called FSΒ²-SSA: the square stands for the two FS of the design, few-spike coding and softmax-free attention. In file names and code it is written FS2-SSA, and FS^2 where a superscript is not available. This repository keeps its original name, FS-SSA-LM-100M, so that its links and the scripts that download from it (HF_REPO) keep working.
v2.3.0: spiking output head (v2.3.0/model.pt)
The model of v2.2.0, described below, with the input of the output head coded into spikes. In v2.2.0 the final RMSNorm reached the head as floats, and the head, tied to the embedding, cost 576 x 50,257 = 28.95 million MACs per token: the last dense layer, and the largest floating-point cost left. v2.3.0 codes the RMSNorm into signed spikes before the head, as every other read, so every matrix product of the model has a spike operand:
| output head | v2.2.0 | v2.3.0 |
|---|---|---|
input of W_head |
final RMSNorm, floats | fs_head: signed FS code of the final RMSNorm, K=3 |
| cost per token | 28.95 million MACs | additions of columns of W_head, one per spike |
| parameters | 94,750,992 | 94,761,936: 10,944 more, the thresholds, resets and readouts of the two codes and the gain, 19 per channel |
fs_head has the threshold scale of the reads, s = 0.75 Ο, learns its thresholds per channel and keeps the gain Ξ± of the other signed pairs. It is built after the initialisation with the random state put back, so every other weight and every batch are those of the v2.2.0 run: their difference at equal steps is the cost of the spiking head. The head codes each token on its own, so the exact recurrence of v2.1.0 applies with the head code at every step.
Model Specifications
| Parameter | Value |
|---|---|
| Total Parameters | 94,761,936 (~94.8M) |
| Layers | 16 |
| Hidden Dimension | 576 |
| Attention Heads | 9 |
| Sequence Length (T) | 1024 tokens |
| Vocabulary Size | 50,257 (GPT-2 BPE Tokenizer) |
| Temporal Latency (K) | K=3 timesteps, for every FS neuron |
| Spike Coding | Signed ON/OFF pairs on the projection inputs, Q, K and the input of the output head; unsigned on V and the MLP neuron |
| Decay Structure | Data-dependent: one gate per head, computed from spikes (576 x 9 weights per block), starting from the geometric ladder (windows 8 to 1024 tokens) |
| Surrogate Gradient | Triangular, half-width c Β· s per channel with area 1; c from 1.5 to 1.0 along the cosine of the learning rate |
| Dense Layers | None: every matrix product has a spike operand |
Results (FineWeb-Edu)
10,000 steps with an effective batch size of 64 sequences (65,536 tokens/step), seed 1 for every run:
| Model | Projection inputs | Head input | Decay | K | Surrogate | Best Val Loss | Best PPL | Ξ Loss (vs Dense) |
|---|---|---|---|---|---|---|---|---|
| Dense Baseline Control, Softmax + GELU | floats | floats | softmax | n/a | n/a | 3.5399 | 34.46 | REF |
| FS-SSA hybrid, v2.0.0 (conservative run) | floats | floats | fixed ladder | 2 | fixed | 3.6228 | 37.44 | +0.0829 |
v2.1.0, data-dependent decay: v2.1.0/model.pt |
spikes | floats | per token | 3 | fixed | 3.6573 | 38.75 | +0.1174 |
v2.2.0, scheduled surrogate: v2.2.0/model.pt |
spikes | floats | per token | 3 | scheduled | 3.6145 | 37.13 | +0.0746 |
v2.3.0, spiking output head: v2.3.0/model.pt |
spikes | spikes | per token | 3 | scheduled | 3.6395 | 38.07 | +0.0996 |
The spiking head costs 0.0250 nats against v2.2.0 (+0.94 PPL) and stays 0.0177 nats below v2.1.0, whose head read floats. The two runs differ only in the head, so their difference at equal steps is its cost:
| steps | half-width | v2.3.0 minus v2.2.0 |
|---|---|---|
| 1,500 to 3,000 | 1.49 s to 1.42 s | +0.022 nats |
| 4,000 to 6,000 | 1.35 s to 1.19 s | +0.019 nats |
| 8,000 to 10,000 | 1.05 s to 1.00 s | +0.024 nats |
The cost settles near 0.02 nats by step 1,000 and stays there to the end. From step 7,500 to their best the two runs gain about the same, 0.048 and 0.050 nats: the narrowing of the surrogate works with the spiking head as without it. The training history and the figures are in v2.3.0/ on GitHub.
Three Seeds
With one seed per run, a gap of 0.025 nats could come from the seed. Seeds 0 and 2 of v2.3.0 were trained on the same 10,000-step schedule and stopped at step 2,500, where the cost of the head in the full run is already the one it ends with:
| step | v2.3.0, seed 0 | v2.3.0, seed 1 | v2.3.0, seed 2 | v2.2.0, seed 1 |
|---|---|---|---|---|
| 1,000 | 4.7438 | 4.7382 | 4.7301 | 4.7084 |
| 1,500 | 4.4698 | 4.4725 | 4.4834 | 4.4472 |
| 2,000 | 4.2692 | 4.2837 | 4.3160 | 4.2613 |
| 2,500 | 4.1752 | 4.1696 | 4.1707 | 4.1519 |
Every seed stays above v2.2.0 at every evaluation after the first. Averaged over steps 1,500 to 2,500 the three seeds are 0.017, 0.023 and 0.039 nats behind v2.2.0, with a spread of 0.011 nats between them: the cost of the head is larger than the spread of the seeds. v2.2.0 has a single seed, so the spread of its own seeds is not known.
Recurrent Form
v2.3.0/recurrent_check.py runs the checks of v2.1.0 on this checkpoint, on the validation split rebuilt from the FineWeb-Edu stream:
check on v2.3.0/model.pt |
result |
|---|---|
| logits, float64, 2 x 1024 tokens | identical in the two forms, same argmax on every token |
| logits, float32, 2 x 1024 tokens | same argmax on 85.4% of the tokens |
| validation loss, float32, 10 batches | 3.66596 parallel, 3.66604 recurrent |
| generation, 256 tokens on a GPU | 39.7 s parallel, 38.0 s recurrent |
In float32 the top prediction moves on about one token in seven and the loss does not move; once a rounding changes one token, the rest of the text follows it, so the two forms sample different continuations from the same seed.
Fluency
v2.3.0/fluency.py is the test of v2.2.0 with v2.3.0 against v2.2.0: the same 30 prompts, 5 continuations of 250 tokens per prompt and model with the same random draws, every continuation scored with GPT-2 large. It ran twice:
| score | v2.3.0 minus v2.2.0, run 1 | v2.3.0 minus v2.2.0, run 2 |
|---|---|---|
| rep-4, share of repeated 4-grams | -0.024 Β± 0.018 | +0.006 Β± 0.036 |
| reference loss, nats per token | +0.070 Β± 0.086 | -0.035 Β± 0.115 |
| PMI with the prompt, nats per token | +0.002 Β± 0.010 | -0.000 Β± 0.009 |
The intervals are at 95%, from the spread between prompts. On a GPU the generation is not reproducible bit for bit across sessions, so the two runs drew different continuations with the same seeds; the human continuations, which do not depend on the sampling, score the same in both. Run 1 found fewer loops in v2.3.0, run 2 does not: the difference does not replicate. The reference loss follows the loops, with a correlation of -0.81 with rep-4 in run 2, and at equal rep-4 it differs by -0.017 Β± 0.045 nats.
Every model of the test was read from this repository: Google Drive could not be mounted in the runtime of the tests, so the scripts of v2.3.0 load every model from Hugging Face. The continuations of run 2 and the reports of both runs are in v2.3.0/results/fluency on GitHub.
Spikes and Floating Point, per Token
One generated token in the recurrent form, each matrix product counted as a dense model computes it, one operation per weight and input:
| one token | v2.2.0 | v2.3.0 |
|---|---|---|
| matrix products with a spike operand: additions | 64,963,584 | 93,911,616 |
| matrix products on floats: multiply-accumulates | 28,948,032, the output head | 0 |
| elementwise multiplications in floating point | 812,880 | 813,456 |
| multiplications in floating point, share of all the operations above | 31.4% | 0.86% |
Almost three quarters of the multiplications left are the decay of the state, Ξ³_t S and Ξ³_t Z; the others are in the RMSNorms, the channel gains and the normaliser of the state. The additions are counted as the operations they replace: the additions actually performed are that count times the spikes of each input, which are not counted yet on the trained model, so the table gives no energy estimate.
Qualitative Probing
| probe | test case | v2.3.0: observed behaviour | v2.3 | v2.2 | v2.1 | v1 |
|---|---|---|---|---|---|---|
| Long-range agreement | "The teacher, along with the students [...]" | continues with "had been given a copy of the book", without the verb; the margin prefers was by 1.32 nats |
PASS | PASS | FAIL | PASS, was |
| Long-range agreement | "The samples [...] lake bed [...]" | resolves to plural were |
PASS | PASS | PASS | PASS |
| In-context binding | Alvarez / Mehta | answers "the glaciers of the Sierra Nevada"; the margin still prefers volcanoes, for the word, not for the name |
FAIL | WARN | FAIL | PASS, volcanoes |
| Domain fluency | photosynthesis | leaves the topic for metallurgy in its second sentence | FAIL | FAIL | PASS | PASS |
| Domain fluency | prime numbers, ocean floor | a list of letters and numbers, then off topic; on topic but circular ("The ocean floor should be open, and the ocean floor should be open") | WARN | WARN | WARN | not in the v1 table |
| Decoding stability | greedy rollouts | periodic attractor loops ("The capital of France is Paris." repeated, "10. Solid" repeated to the end, "the value of the value ...") | WARN | WARN | WARN | WARN |
| Factual induction | capital cities, colour cycles | "Paris" again for Spain, "fruit, and grapefruit" instead of purple | FAIL | FAIL | FAIL | FAIL |
| Symbolic arithmetic | 2 + 2, eggs in cartons, 7 times 8 | "1.5 = 1.5", "a total of 12 eggs", "1.5 times the value of the original" | FAIL | FAIL | FAIL | FAIL |
| Code and lists | factorial, states of matter, mean | 1, then "the value of the value" repeated, then "10. Solid" repeated, then "the values of the variables in the table" |
FAIL | FAIL | FAIL | not in the v1 table |
Outputs of v2.3.0/generate.py on this checkpoint, seed 1234, one completion per prompt: the prose set is sampled at temperature 0.8 with top-k 200, every other set is greedy. Single completions are probes, not a benchmark.
The log-probability margins keep the agreement of v2.2.0: on the minimal pair "The teacher(s), along with the student(s) [...]" v2.3.0 has an agreement of 2.10 nats and a plural bias of 0.78, against 1.97 and 0.89, and prefers was. In the four orderings of the binding prompt it gets -0.39, +0.20 and +1.46 nats for the name asked, the position of the object and the word: the position almost stops counting, the word decides, and v2.3.0 prefers volcanoes in all four. In greedy decoding it answers glaciers all the same: its first token after "studied" is "the", and the completion goes on from there. None of the four models measured binds the object to the name. The full tables are in the README on GitHub.
How to Use
v2.3.0/generate.py, v2.3.0/recurrent_check.py and v2.3.0/fluency.py in the GitHub repository are self-contained: they carry the classes of the trained model and download every model from this repository, v2.3.0/model.pt and, in generate.py and fluency.py, v2.2.0/model.pt next to it. recurrent_check.py and fluency.py rebuild the validation split from the FineWeb-Edu stream, so they need nothing but themselves and the published weights. The model_state_dict of v2.3.0/model.pt loads with strict=True into the FSGPT of those scripts, which on the SSA model carries the spiking head:
import torch
from huggingface_hub import hf_hub_download
path = hf_hub_download(repo_id="Matt-94/FS-SSA-LM-100M", filename="v2.3.0/model.pt")
# FSGPT, gamma_ladder, tokenizer, decode and the constants: run v2.3.0/generate.py first, in the same session
model = FSGPT("ssa", "fs", 3, True, True, QK_SCALE, MLP_SCALE, BLOCK, True, gamma_ladder(N_HEADS, W_MIN, W_MAX), True)
model.load_state_dict(torch.load(path, map_location="cpu")["model_state_dict"])
model.eval()
idx = torch.tensor([tokenizer.encode_ordinary("The process of photosynthesis")])
out = model.generate_recurrent(idx, 200, temperature=0.8, top_k=200)
print(decode(out[0].tolist()))
load_one in v2.3.0/generate.py loads v2.2.0/model.pt and v2.1.0/model.pt into the same classes with the head in floats: it takes fs_head out when the checkpoint has no keys for it.
Limitations
- One full-length seed: seeds 0 and 2 stop at step 2,500, and v2.2.0 has a single seed.
- The spiking head costs 0.025 nats against v2.2.0: the gap to the dense control is 0.0996 nats.
- Generation is not reproducible bit for bit across sessions on a GPU: the two runs of the fluency test drew different continuations with the same seeds.
- The spikes that reach the head are not counted yet, so the additions of the head give no energy estimate.
- In-context binding still fails: v2.3.0 prefers
volcanoesfor the word, in all four orderings of the prompt. - The context stops at 1024 tokens: the position embeddings are learned only up to there.
- K=3 costs one more timestep of latency than K=2 and about 1.6 times the spikes per value on a Gaussian input.
v2.2.0: scheduled surrogate (v2.2.0/model.pt)
The model of v2.1.0, described below, with the same 94,750,992 parameters and the same forward pass. It is trained from the same initial weights, on the same batches, as the v2.1.0 checkpoint, with one change in the backward pass: the surrogate gradient has a scheduler.
The forward pass of an FS neuron is a step: it fires when its potential crosses a threshold. The backward pass replaces the step with a triangle, the surrogate gradient. In v2.1.0 the triangle had one half-width for every neuron, 1.1 in units of the potential, and a peak of 1, while the thresholds it serves are not alike: at initialisation the top threshold is 0.75 for the reads and the Q/K/V codes and 0.27 for the MLP neuron, and every channel then learns its own. A half-width of 1.1 is 1.5 s for a read and 4 s for the MLP neuron. v2.2.0 changes the triangle and nothing else:
| surrogate | v2.1.0 | v2.2.0 |
|---|---|---|
| half-width | 1.1, the same for every neuron | c Β· s, with s the top threshold of each channel, learned; no gradient flows through the width |
| peak | 1 | 1 / (c Β· s): the area stays 1, as for the step it stands for |
| c during training | no schedule | 1.5 through the warmup, then down to 1.0 along the cosine of the learning rate |
With the area fixed, narrowing the triangle changes the shape of the gradient and not its size. is the narrowest width at which the backward pass of a code never exceeds the slope of its forward pass; below it, the chain of resets would amplify the excess. The checkpoint loads into the classes of v2.1.0, and the exact recurrence of v2.1.0 applies to it unchanged.
Model Specifications
| Parameter | Value |
|---|---|
| Total Parameters | 94,750,992 (~94.8M) |
| Layers | 16 |
| Hidden Dimension | 576 |
| Attention Heads | 9 |
| Sequence Length (T) | 1024 tokens |
| Vocabulary Size | 50,257 (GPT-2 BPE Tokenizer) |
| Temporal Latency (K) | K=3 timesteps, for every FS neuron |
| Spike Coding | Signed ON/OFF pairs on the projection inputs, Q and K; unsigned on V and the MLP neuron |
| Decay Structure | Data-dependent: one gate per head, computed from spikes (576 x 9 weights per block), starting from the geometric ladder (windows 8 to 1024 tokens) |
| Surrogate Gradient | Triangular, half-width c Β· s per channel with area 1; c from 1.5 to 1.0 along the cosine of the learning rate |
| Dense Layers | Output head only (576 x 50,257 MACs per token) |
Results (FineWeb-Edu)
10,000 steps with an effective batch size of 64 sequences (65,536 tokens/step), seed 1 for every run:
| Model | Projection inputs | Decay | K | Surrogate | Best Val Loss | Best PPL | Ξ Loss (vs Dense) |
|---|---|---|---|---|---|---|---|
| Dense Baseline Control, Softmax + GELU | floats | softmax | n/a | n/a | 3.5399 | 34.46 | REF |
| FS-SSA hybrid, v2.0.0 (conservative run) | floats | fixed ladder | 2 | fixed | 3.6228 | 37.44 | +0.0829 |
v2.1.0, data-dependent decay: v2.1.0/model.pt |
spikes | per token | 3 | fixed | 3.6573 | 38.75 | +0.1174 |
v2.2.0, scheduled surrogate: v2.2.0/model.pt |
spikes | per token | 3 | scheduled | 3.6145 | 37.13 | +0.0746 |
With the scheduler the K=3 model ends 0.0427 nats below v2.1.0 (-1.62 PPL), level with the hybrid: 3.6228 in its conservative run, 3.6147 in model.pt. The hybrid was trained with the old surrogate, so this does not show that spiking the inputs comes for free: the new surrogate might lower the hybrid as well.
The two runs differ only in the surrogate, so their difference at equal steps is its effect. It comes in two stages:
| steps | half-width | v2.2.0 minus v2.1.0 |
|---|---|---|
| 1,500 to 3,000 | 1.49 s to 1.42 s | -0.022 nats |
| 4,000 to 6,000 | 1.35 s to 1.19 s | -0.022 nats |
| 8,000 to 10,000 | 1.05 s to 1.00 s | -0.039 nats |
The first stage comes from the shape of the surrogate, before it narrows. The second comes with the end of the narrowing, which in this run is also the end of the learning rate decay, so the two cannot be told apart. There is one seed per run: the growth of the second stage, 0.017 nats, is about twice the 0.008 nats between the two runs of the hybrid. The training history and the figures are in v2.2.0/ on GitHub.
Fluency
On the published prompts one completion of v2.2.0 leaves photosynthesis for bees after three words, where v2.1.0 stayed on topic. v2.2.0/fluency.py checks whether that is the model or the seed: 30 prompts (the three of generate.py, twelve written by hand on other topics, fifteen beginnings of validation documents), 5 continuations of 250 tokens per prompt and model, the same random draws for both models, every continuation scored with GPT-2 large, which shares the tokenizer:
| score | what it measures | v2.2.0 minus v2.1.0 |
|---|---|---|
| rep-4 | share of repeated 4-grams in the continuation: the loops | -0.013 Β± 0.025 |
| reference loss | loss of the continuation under GPT-2 large, given the prompt, in nats per token | +0.057 Β± 0.086 |
| PMI | loss without the prompt minus loss with it: how much the continuation still depends on the prompt | +0.006 Β± 0.010 |
The intervals are at 95%, from the spread between prompts, since the five continuations of one prompt are not independent. None of the differences is distinguishable from zero: the photosynthesis completion was a bad draw. The human continuations of the validation documents mark a limit both models share: a PMI of about 0.23 nats per token against about 0.13, and a rep-4 of about 0.017 against 0.08.
Qualitative Probing
| probe | test case | v2.2.0: observed behaviour | v2.2 | v2.1 | v1 |
|---|---|---|---|---|---|
| Long-range agreement | "The teacher, along with the students [...]" | continues with "had been given a chance", without the verb; the margin prefers was by 1.09 nats |
PASS | FAIL | PASS, was |
| Long-range agreement | "The samples [...] lake bed [...]" | resolves to plural were |
PASS | PASS | PASS |
| In-context binding | Alvarez / Mehta | retrieves volcanoes, for its position and for the word, not for the name |
WARN | FAIL | PASS, volcanoes |
| Domain fluency | photosynthesis | leaves the topic after three words ("How fast are bees and butterflies in different seasons?") | FAIL | PASS | PASS |
| Domain fluency | prime numbers, ocean floor | fluent and circular ("To print the prime number, you must print the prime number") or invented (a professor quoted on "a computer-controlled computer") | WARN | WARN | not in the v1 table |
| Decoding stability | greedy rollouts | periodic attractor loops ("If the return 1 is 1, return 1", "10. Solid 10. Solid ...", "the values of the values ...") | WARN | WARN | WARN |
| Factual induction | capital cities, colour cycles | "Paris" again for Spain, "red, and pineapple red" instead of purple | FAIL | FAIL | FAIL |
| Symbolic arithmetic | 2 + 2, eggs in cartons, 7 times 8 | "1 + 2 + 2 + 2 ...", "the same number of eggs", "1.5 times" | FAIL | FAIL | FAIL |
| Code and lists | factorial, states of matter, mean | 1, then "If the return 1 is 1, return 1" repeated, then "Solid" with growing numbers, then "the values of the values" |
FAIL | FAIL | not in the v1 table |
Outputs of v2.2.0/generate.py on this checkpoint, seed 1234, one completion per prompt: the prose set is sampled at temperature 0.8 with top-k 200, every other set is greedy. Single completions are probes, not a benchmark.
The log-probability margin between the right and the wrong continuation measures two of the probes on a continuous scale. On the minimal pair "The teacher(s), along with the student(s) [...]" it separates the agreement from a bias towards the plural: v2.1.0 has an agreement of 1.41 nats and a plural bias of 2.65, so the bias flips the singular sentence; v2.2.0 has 1.97 and 0.89, and prefers was. The four orderings of the binding prompt (who is named first, who is asked) split its margin into the name asked, the position of the object and the word: v2.2.0 gets -0.50, +1.04 and +1.23 nats, so its volcanoes comes from the first position and from the word, not from the name. None of the three checkpoints binds the object to the name. The full tables are in the README on GitHub.
How to Use
v2.2.0/generate.py and v2.2.0/recurrent_check.py in the GitHub repository are self-contained: they carry the classes of the trained model and download this checkpoint themselves (SOURCE = "hf", HF_FILE = "v2.2.0/model.pt"); v2.2.0/fluency.py downloads it next to the one of v2.1.0. Its model_state_dict loads with strict=True into the FSGPT of those scripts:
import torch
from huggingface_hub import hf_hub_download
path = hf_hub_download(repo_id="Matt-94/FS-SSA-LM-100M", filename="v2.2.0/model.pt")
# FSGPT, gamma_ladder, tokenizer, decode and the constants: run v2.2.0/generate.py first, in the same session
model = FSGPT("ssa", "fs", 3, True, True, QK_SCALE, MLP_SCALE, BLOCK, True, gamma_ladder(N_HEADS, W_MIN, W_MAX), True)
model.load_state_dict(torch.load(path, map_location="cpu")["model_state_dict"])
model.eval()
idx = torch.tensor([tokenizer.encode_ordinary("The process of photosynthesis")])
out = model.generate_recurrent(idx, 200, temperature=0.8, top_k=200)
print(decode(out[0].tolist()))
Limitations
- One seed per run.
- The hybrid was trained with the old surrogate, so the comparison does not show that the spiking inputs cost nothing.
- In-context binding still fails: the model answers
volcanoesfor the position of the object and for the word, not for the name. - The context stops at 1024 tokens: the position embeddings are learned only up to there.
- K=3 costs one more timestep of latency than K=2 and about 1.6 times the spikes per value on a Gaussian input.
v2.1.0: spiking residual highway (v2.1.0/model.pt)
Every matrix product inside the blocks has a spike operand: the inputs of QKV, of the output projection and of the first MLP layer are coded into signed spikes, as the input of the second MLP layer already was. The output head is the only dense layer left.
The decay of each head is computed token by token from the spikes that enter QKV:
holds the fixed ladder of v2.0 and , start at zero, so training starts from the fixed-ladder model. Training uses the parallel form; inference can run as an exact recurrence with a state of 64 x 64 per head, , so every new token costs the same up to the trained context. On this checkpoint v2.1.0/recurrent_check.py finds identical logits in the two forms in float64, and in float32 the same validation loss (3.69110 against 3.69117) with the same argmax on 83.6% of 2 x 1024 tokens.
Model Specifications
| Parameter | Value |
|---|---|
| Total Parameters | 94,750,992 (~94.8M) |
| Layers | 16 |
| Hidden Dimension | 576 |
| Attention Heads | 9 |
| Sequence Length (T) | 1024 tokens |
| Vocabulary Size | 50,257 (GPT-2 BPE Tokenizer) |
| Temporal Latency (K) | K=3 timesteps, for every FS neuron |
| Spike Coding | Signed ON/OFF pairs on the projection inputs, Q and K; unsigned on V and the MLP neuron |
| Decay Structure | Data-dependent: one gate per head, computed from spikes (576 x 9 weights per block), starting from the geometric ladder (windows 8 to 1024 tokens) |
| Surrogate Gradient | Triangular, half-width 1.1 and peak 1 for every neuron |
| Dense Layers | Output head only (576 x 50,257 MACs per token) |
Results (FineWeb-Edu)
10,000 steps with an effective batch size of 64 sequences (65,536 tokens/step), seed 1 for every run:
| Model | Projection inputs | Decay | K | Best Val Loss | Best PPL | Ξ Loss (vs Dense) |
|---|---|---|---|---|---|---|
| Dense Baseline Control, Softmax + GELU | floats | softmax | n/a | 3.5399 | 34.46 | REF |
| FS-SSA hybrid, v2.0.0 (conservative run) | floats | fixed ladder | 2 | 3.6228 | 37.44 | +0.0829 |
| v2.1.0, fixed ladder | spikes | fixed ladder | 2 | 3.7542 | 42.70 | +0.2143 |
| v2.1.0, data-dependent decay | spikes | per token | 2 | 3.6991 | 40.41 | +0.1592 |
v2.1.0, data-dependent decay: v2.1.0/model.pt |
spikes | per token | 3 | 3.6573 | 38.75 | +0.1174 |
Spiking the projection inputs costs 0.131 nats with the fixed ladder. The data-dependent decay recovers 42% of that cost and K=3 another 32%, so the published checkpoint sits 0.034 nats (+1.31 PPL) from the hybrid run trained under the same protocol. Only the K=3 checkpoint is published; the training histories of the three v2.1.0 runs are in v2.1.0/results/history on GitHub.
Qualitative Probing
| probe | test case | v2.1, K=3: observed behaviour | v2.1 | v1 |
|---|---|---|---|---|
| Long-range agreement | "The teacher, along with the students [...]" | resolves to plural were |
FAIL | PASS, was |
| Long-range agreement | "The samples [...] lake bed [...]" | resolves to plural were |
PASS | PASS |
| In-context binding | Alvarez / Mehta | retrieves glaciers, the second object named |
FAIL | PASS, volcanoes |
| Domain fluency | photosynthesis | on-topic multi-sentence prose, with circular definitions ("photosynthesis is the process of photosynthesis") | PASS | PASS |
| Domain fluency | prime numbers, ocean floor | fluent and on topic, factually wrong ("a prime number of 25.5", "the ocean is a living organism") | WARN | not in the v1 table |
| Decoding stability | greedy rollouts | periodic attractor loops ("4. Solid 5. Solid ...", "the values of the values ...") | WARN | WARN |
| Factual induction | capital cities, colour cycles | "the city of the Holy Roman Empire" instead of Madrid, "red, and orange" instead of purple | FAIL | FAIL |
| Symbolic arithmetic | 2 + 2, eggs in cartons, 7 times 8 | "2 = 2 = 2 = ...", no number, "1.5 times" | FAIL | FAIL |
| Code and lists | factorial, states of matter, mean | return 1, then "Solid" repeated with growing numbers, then "the values of the values" |
FAIL | not in the v1 table |
Outputs of v2.1.0/generate.py on this checkpoint, seed 1234, one completion per prompt: the prose set is sampled at temperature 0.8 with top-k 200, every other set is greedy. The v1 column repeats the probes published with v1 (docs/v1.md on GitHub). Two probes that v1 passed now fail, the agreement across "along with the students" and the binding of Alvarez to volcanoes. The log-probability margins measured for v2.2.0 show why: the were comes from a bias towards the plural in that construction, which stays when the nearest noun is singular, and the glaciers from a preference for the word, not from the position of the object. docs/v1.md put the failure of factual induction down to the lack of data-dependent decay gates: with the gates of v2.1 it still fails. Single completions are probes, not a benchmark.
How to Use
v2.1.0/generate.py and v2.1.0/recurrent_check.py in the GitHub repository are self-contained: they carry the classes of the trained model and download this checkpoint themselves (SOURCE = "hf", HF_FILE = "v2.1.0/model.pt"). Its model_state_dict loads with strict=True into the FSGPT of those scripts:
import torch
from huggingface_hub import hf_hub_download
path = hf_hub_download(repo_id="Matt-94/FS-SSA-LM-100M", filename="v2.1.0/model.pt")
# FSGPT, gamma_ladder, tokenizer, decode and the constants: run v2.1.0/generate.py first, in the same session
model = FSGPT("ssa", "fs", 3, True, True, QK_SCALE, MLP_SCALE, BLOCK, True, gamma_ladder(N_HEADS, W_MIN, W_MAX), True)
model.load_state_dict(torch.load(path, map_location="cpu")["model_state_dict"])
model.eval()
idx = torch.tensor([tokenizer.encode_ordinary("The process of photosynthesis")])
out = model.generate_recurrent(idx, 200, temperature=0.8, top_k=200)
print(decode(out[0].tolist()))
Limitations
- One seed per run.
- In the qualitative probes, in-context binding and the agreement across "along with the students" fail, where v1 passed both.
- The context stops at 1024 tokens: the position embeddings are learned only up to there.
- K=3 costs one more timestep of latency than K=2 and about 1.6 times the spikes per value on a Gaussian input.
v2.0.0: hybrid FS-SSA (model.pt)
Q and K are coded into signed spikes and V into non-negative ones at K=2 timesteps, the MLP neuron emits spikes, and a fixed per-head decay ladder replaces the Softmax; the four linear layers that read the residual stream still receive floats. The recurrent form of the attention was verified on this checkpoint by v2.0.0/recurrent_check.py.
Model Specifications
| Parameter | Value |
|---|---|
| Total Parameters | 93,884,544 (~93.9M) |
| Layers | 16 |
| Hidden Dimension | 576 |
| Attention Heads | 9 |
| Sequence Length (T) | 1024 tokens |
| Vocabulary Size | 50,257 (GPT-2 BPE Tokenizer) |
| Temporal Latency (K) | K=2 timesteps |
| Spike Coding | Signed bipolar ternary pairs (+-) |
| Decay Structure | Causal per-head geometric ladder ( gamma in [0.875, 0.999]) |
| Sustained Firing Rate | ~13.1% (sparse event-driven regime) |
Benchmark Results (FineWeb-Edu)
Pretrained across 10,000 steps with an effective batch size of 64 sequences (65,536 tokens/step):
| Model Architecture | Precision / Attention | Best Val Loss | Best PPL | Ξ Loss (vs Dense) |
|---|---|---|---|---|
| Dense Baseline Control | FP16 / Softmax + GELU | 3.5399 | 34.46 | REF (Control) |
| FS-SSA-LM-100M (Verified) | Discrete K=2 / Softmax-Free | 3.6147 | 37.14 | +0.0748 nats (+2.68 PPL) |
| FS-SSA-LM-100M (Conservative) | Discrete K=2 / Softmax-Free | 3.6228 | 37.44 | +0.0829 nats (+2.98 PPL) |
The model achieves near-parity with the compute-matched dense Softmax Transformer (within 7.8% relative gap), while three of its matrix products become sparse event additions.
v2.0.0/generate.py and v2.0.0/recurrent_check.py in the GitHub repository download model.pt themselves (SOURCE = "hf").
Citation
@software{lorusso_fs2ssa_2026,
author = {Lo Russo, Matteo Vito},
title = {FS$^2$-SSA: Few-Spike, Softmax-Free Spiking Self-Attention},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.22950217},
url = {https://doi.org/10.5281/zenodo.22950217}
}