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.4.tar.gz (24.3 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.4-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: adseq-0.9.4.tar.gz
  • Upload date:
  • Size: 24.3 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.4.tar.gz
Algorithm Hash digest
SHA256 a6faa3278404b104ffaac97d29dc1487b9da816d80e188f212253a7b6998e473
MD5 c40266ea6ed415f9782efd32fe45ed7e
BLAKE2b-256 595841dba92ab6ddfc97aa9da963d8f65801549bcf7fef5a2d383fc2a065ea1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for adseq-0.9.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: adseq-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 28.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ca9bc9e36dfe5faed16fc53f9d593466b9edf28feaffef5d2ea99bc31460524c
MD5 de7f97ece5bd14c9a40a8ded0ea97a1c
BLAKE2b-256 70e7eb3dc29d2c6b23f32086aebf6f7206b0cab57d915ee572c00e1cd1bf5a71

See more details on using hashes here.

Provenance

The following attestation bundles were made for adseq-0.9.4-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