Skip to content

About

Code and data for "Beyond the Hamming Cliff" article, (Neurocomputing, submitted): spatial spike encodings — Binary, Gray, Thermometer, Johnson and new hybrid codes — evaluated on SpiNNaker hardware with supervised STDP. Reproduces every table and figure with "make".

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Beyond the Hamming Cliff: code and data

Code, results and analysis for

S. Davies, M. Aitsam, M.-T. Stone, A. Di Nuovo, L. Han, Beyond the Hamming Cliff: Compact Spatial Encodings Preserving Semantic Distance in Spiking Neural Networks, submitted to Neurocomputing, 2026.

The paper evaluates Binary, Gray, Thermometer, Johnson and a family of hybrid spatial encodings on SpiNNaker hardware, using the supervised STDP and homeostasis method of Davies et al. (2025), and measures the limits on simultaneous input that bound spatial code width on both SpiNNaker and SpiNNaker2.

This repository reproduces every table, figure and quoted number in the paper from the deposited results, and re-runs the experiments on hardware.

Quick start

make setup        # installs the requirements, including sPyNNaker from GitHub
make

That checks the Python encodings against the C++ reference, then regenerates the tables, figures and offline analysis from results/, in a few minutes and with no hardware. Of Hamming Lab, make compiles only the Qt-free encoding core used by the cross-check; the Qt visualiser is built separately with make hamming-lab.

make hw

asks which boards you have — first-generation SpiNNaker, SpiNNaker2, either or both — and re-runs every experiment those boards allow, then regenerates everything from the new results. See docs/REPRODUCING.md for what each artefact in the paper maps to, and docs/HARDWARE.md before running on hardware.

Note on testing. The Makefile was added for publication, after the experiments, and has not been tested as extensively as the other source files, which produced the paper's results. The same applies to the helper scripts added with it (configure_boards.py, scripts/fetch_spinnaker.sh, crosscheck_encodings.py, hamming-lab/tools/crosscheck.cpp). In particular, the hw- targets have not been run on a board. The hamming-lab target, a thin wrapper around Hamming Lab's own CMake build, has not been run from the Makefile; Hamming Lab itself, the visualiser and its encoding core, has been tested extensively by the authors. If a target fails, every command it runs is listed in the Makefile and can be run by hand.

Contents

Makefile           make · make hw · make configure · make tables / figures / ...
spinnaker-versions.txt   the exact SpiNNaker software the experiments ran with
scripts/           fetch_spinnaker.sh: clones those versions
docs/              REPRODUCING.md, HARDWARE.md
hamming-lab/       REFERENCE implementation of the encodings (C++), and the Qt
                   visualiser that draws Figures 3 and 4
src/               experiments, network, capacity tests, analysis, tables, figures
results/           the hardware results the paper reports
  platform/        the SpiNNaker and SpiNNaker2 capacity measurements (Section 3.4)
tables/            LaTeX tables generated from results/
figures/           network schematics; Hamming-distance plots from hamming-lab/
development/       retired scripts, kept as a record of how each constraint was found

Mapping to the paper

The experiment scripts carry development numbers, which are not the paper's section numbers; there is no experiment4.py (see development/README.md), and experiment1.py is no longer an experiment but the Python port of the encodings.

file paper what it does
hamming-lab/src/core/Encodings.{h,cpp} §3.5 reference implementation of every encoding; no Qt dependency
hamming-lab/ (visualiser) §4.1, Figs 3–4 Hamming distance slices and surfaces
hamming-lab/tools/crosscheck.cpp §3.5, Eq. (10) checks the reference's distances and widths, and dumps its code words
crosscheck_encodings.py — verifies both Python implementations against the reference
experiment1.py — Python port of the encodings, imported by the hardware scripts; kept as a backup of the reference and verified identical to it
analyse_encodings.py §4.1 cliff severity, Spearman correlation
analyse_neighbourhoods.py §4.1 Hamming-ball fragmentation
experiment2.py §4.2 anchor 240 with one second value, 14 sweeps
experiment3.py §4.3 contiguous cluster of 1–8 values
make_tables.py all tables also prints the §4.3.1 inner-product prediction
experiment5.py §4.4 homeostatic tolerance sweep at four targets
experiment6.py §4.5 10-bit range, hybrids against Binary and Gray
buffer_test.py §3.4 synapses potentiated vs width, at a given buffer size
saturation_experiment.py §3.4 events delivered vs inputs, static synapses, SpiNNaker
saturation_experiment_s2.py §3.4 the same on SpiNNaker2 (py-spinnaker2)
saturation_followup_s2.py — prepared, not run: would resolve the open SpiNNaker2 questions
platform_summary.py §3.4 prints every number the section quotes
validate_network.py — acceptance test, run before any experiment
configure_boards.py — asks for board addresses; writes hw.env and src/spynnaker.cfg
check_results.py — verifies every results file is complete and current
draw_networks.py Figs 1–2 network schematics

Key parameters

  • network.SOURCE_BITS = 8: 256 values. sPyNNaker's default incoming spike buffer holds 256 entries and silently drops the rest, so under that default a code word is limited to 255 bits and 256 values is the widest range at which every encoding fits. Raising the buffer removes the limit (results/platform/buffer_test_1024.json); all experiments used the default.
  • Time scale factor 100: every latency in the paper is in timesteps.
  • Anchor value 240 (11110000), the 8-bit analogue of the 992 used by Davies et al. (2025).
  • STDP: nearest-pair rule, τ± = 5 ms, A± = ±1, w_max = 2; output threshold scaled with code width. Both deviations from the 2025 paper are explained in §3.1.3.

Requirements

Python 3.10 or later, and the packages in requirements.txt, including sPyNNaker from GitHub; make setup installs them and registers sPyNNaker with PyNN. The exact SpiNNaker software the experiments ran with, eleven repositories and PyNN 0.13.0, is recorded commit by commit in spinnaker-versions.txt; make spinnaker-sources fetches it (see docs/HARDWARE.md). A C++20 compiler builds the reference encodings for make crosscheck. The experiments need a SpiNNaker board (see the SpiNNaker documentation for board configuration); the SpiNNaker2 script needs py-spinnaker2 and a SpiNNaker2 board. The visualiser needs Qt 6 with Widgets, DataVisualization and Charts, and CMake.

Citing

See CITATION.cff. Cite the paper for the method and this repository for the code and data.

Licence

Everything in this repository -- code, results and figures -- is released under the Creative Commons Attribution 4.0 International licence (CC BY 4.0, LICENSE). You may use, adapt and redistribute it, including commercially, provided you credit the authors and indicate any changes.

About

Code and data for "Beyond the Hamming Cliff" article, (Neurocomputing, submitted): spatial spike encodings — Binary, Gray, Thermometer, Johnson and new hybrid codes — evaluated on SpiNNaker hardware with supervised STDP. Reproduces every table and figure with "make".

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages