Skip to main content

ADSEQ: Autodifferentiable spike-event queues for brain simulation on AI accelerators

Project description

ADSEQ: A library for Autodifferentiable spike-event queues for brain simulation on AI accelerators

ADSEQ aims to implement delay-enabled differentiable event queues for brain simulations

Installation

pip install adseq

RSNN example

Q = adseq.implementations.FIFORing.sized(3)
syn = adseq.synapse.mk_synapses(Q,
      delay_ms=delays, dt_ms=dt,
      vthres=vthres, tau_syn_ms=tau_syn, n=n*n,
      max_delay_ms=7
      )
syn_step = jax.jit(type(syn).timestep_spike_detect_pre)
v = jnp.zeros(n)
state = v, syn
def step(state, t):
    v, syn = state
    isyn = weight @ syn.isyn.reshape((n,n)).sum(0)
    vnext, s = lif_step(v, isyn, tau_mem, dt, vthres)
    syn = syn.timestep_spike_detect_pre(
                   ts=t,
                   v=jnp.repeat(v, n),
                   vnext=jnp.repeat(vnext, n))
    state = vnext, syn
    return state, (v, s)
_, trace = jax.lax.scan(step, state, xs=ts = jnp.arange(10000)*dt)

Bridges

adseq does not aim to be another brain simulation package. Instead, it provides 'bridges' to other existing packages.

Jaxley example

Support is a bit experimental. Note that performance will be suboptimal, and limited to singlespike implemetations, until Jaxley PR646 is merged

import jaxley as jx
import adseq.bridges.jaxley_bridge as adseq

# [...]

net = jx.Network([cell, cell])
jx.connect(net.cell(0).branch(0).loc(0.0),
           net.cell(1).branch(0).loc(0.0),
           adseq.DelaySynapse(vthres=10.0))
net.set('DelaySynapse_delay', 10.0)
net.set('DelaySynapse_weight', 0.05)
net.make_trainable('DelaySynapse_delay')

# [...]

parameters = net.get_parameters()
transform = jx.ParamTransform([
    {'DelaySynapse_delay':  jx.optimize.transforms.SigmoidTransform(.1, 50.0)},
])
def loss(opt_params):
    s = jx.integrate(net, delta_t=dt, params=transform.forward(opt_params))
    t = jnp.linspace(0, 1, s.shape[1])
    conv = jnp.exp(-10*(t - 0.7)**2) # move spike towards 70% of simulation time
    return - (s[1] * conv).mean()
for i in range(100):
    l, gradient = loss(opt_params), jax.jacfwd(loss)(opt_params)
    updates, opt_state = optimizer.update(gradient, opt_state)
    opt_params = optax.apply_updates(opt_params, updates)

Flax bridge

import flax.linen as nn
import adseq.bridges.flax_bridge as adseq

dt = 0.1
model = adseq.Sequential([
        # single spike hidden layer
        adseq.DenseInput(dt, 30, queue=adseq.implementations.SingleSpike),
        adseq.LIF(dt, output='single_spike'),

        # ttfs output layer
        adseq.Dense(dt, 2, weight_init=nn.initializers.uniform(1.5)),
        adseq.LIF(dt, output='ttfs'),
        ])

x = jnp.zeros((100, 4))
x = x.at[0, 0].set(1)
x = x.at[100, 1].set(1)
x = x.at[50, 2].set(1)
x = x.at[10, 3].set(1)

params = model.init(jax.random.key(0), None, x)
ttfs = model.apply(params, x, method='trace')

Module Documentation

Citation

@article{landsmeer2025eventqueues,
  title={EventQueues: Autodifferentiable spike event queues for brain simulation on AI accelerators},
  author={Landsmeer, Lennart PL and Movahedin, Amirreza and Hamdioui, Said and Strydis, Christos},
  journal={arXiv preprint arXiv:2512.05906},
  year={2025}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adseq-0.9.3.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adseq-0.9.3-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file adseq-0.9.3.tar.gz.

File metadata

  • Download URL: adseq-0.9.3.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adseq-0.9.3.tar.gz
Algorithm Hash digest
SHA256 c84f2e478e450a20f8739ee0b7b8d7816021f5de354230dbbd86bc5268414f51
MD5 edc980bac7f587cdd3d0c9b33ed8d464
BLAKE2b-256 f0277ec7de0f4638fcb38eff5c9da5a7d7bed9f3371e4135ca236a979340ad6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for adseq-0.9.3.tar.gz:

Publisher: python-publish.yml on llandsmeer/adseq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adseq-0.9.3-py3-none-any.whl.

File metadata

  • Download URL: adseq-0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adseq-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b207b6266e015c04c4bbf594e14308e69e592a536eabf3e88e0eb503daef07aa
MD5 15ae1bc71160834b44ab78aaad9619ea
BLAKE2b-256 274fc0c9e7b55d5c413df9202d6178a556a296a614cfd77f86d2be3c9c705708

See more details on using hashes here.

Provenance

The following attestation bundles were made for adseq-0.9.3-py3-none-any.whl:

Publisher: python-publish.yml on llandsmeer/adseq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page