Skip to main content

A testbed for learning to interact with in vitro neural networks

Project description

livn

A testbed for learning to interact with in vitro neural networks

Documentation Paper

livn is an open-source interactive simulation environment for learning to control in vitro neural networks. It generates synthetic neural data with ground truth at scale, enabling the development and testing of ML models in interactive settings that mimic experimental platforms such as multi-electrode arrays. By providing an extensible platform for developing and benchmarking machine learning models, livn aims to accelerate progress in both ML-driven understanding and engineering of in vitro neural systems and fundamental understanding of computation in biological neural networks.

pip install livn

Read the full documentation →

Features

  • Multiple backends — Run simulations using Brian2, NEURON, or JAX (diffrax) depending on your needs
  • Multi-electrode arrays — Observe neural activity through realistic MEA configurations with stimulation and recording
  • Differentiable — Differentiate through the full simulation environment (including IO) when using the JAX backend
  • RL integration — Standard Gymnasium interface for reinforcement learning experiments
  • Curated datasets — Access pre-generated datasets on Hugging Face for training and evaluation
  • Parallel execution — Scale up with MPI-based parallel simulations for large-scale experiments on CPU and GPU

Quickstart

Running a simulation

from livn import make

env = make("EI1")

env.apply_model_defaults()
env.record_spikes()
env.record_voltage()

it, t, iv, v, *_ = env.run(100)

print("Initial voltages: ", v[:, 0])

Backends

livn supports three simulation backends:

export LIVN_BACKEND=brian2     # default; point-neuron models
export LIVN_BACKEND=diffrax    # JAX-based, differentiable
export LIVN_BACKEND=neuron     # MPI-parallel, multi-compartment

See the documentation for details.

Predefined systems

System Neurons EXC INH MEA channels Description
EI1 10 8 2 1 Quick prototyping, unit tests
EI2 100 80 20 16 Development, RL experiments
EI3 1,000 800 200 64 Medium-scale experiments
EI4 10,000 8,000 2,000 1,024 Large-scale experiments

Documentation

Full documentation at livn-org.github.io/livn covering:

  • Getting started — installation, first simulation, using datasets
  • Concepts — environments, systems, models, IO, encoding, decoding, stimulus
  • Systems — generating, tuning, and sampling custom systems
  • Examples — dataset usage, differentiable simulation, reinforcement learning

Full installation

Clone this repo and install with uv:

uv sync --all-packages --all-groups --all-extras

Citation

If you use livn in your research, please cite:

@article{GressmannLIVN2025,
	author = {Gressmann, Frithjof and Raikov, Ivan Georgiev and Pham, Hau Ngoc and Coats, Evan and Soltesz, Ivan and Rauchwerger, Lawrence},
	title = {livn: A testbed for learning to interact with in vitro neural networks},
	elocation-id = {2025.12.16.694706},
	year = {2025},
	doi = {10.64898/2025.12.16.694706},
	publisher = {Cold Spring Harbor Laboratory},
	URL = {https://www.biorxiv.org/content/early/2025/12/19/2025.12.16.694706},
	eprint = {https://www.biorxiv.org/content/early/2025/12/19/2025.12.16.694706.full.pdf},
	journal = {bioRxiv}
}

License

MIT, see LICENSE.txt.

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

livn-1.0.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

livn-1.0.0-py3-none-any.whl (292.4 kB view details)

Uploaded Python 3

File details

Details for the file livn-1.0.0.tar.gz.

File metadata

  • Download URL: livn-1.0.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for livn-1.0.0.tar.gz
Algorithm Hash digest
SHA256 001630445d47a98a50010d49a758cdbea5518856d3810ee769ec842c592a1fd5
MD5 2290edf5591f4ad08c3004ed2fe5e54b
BLAKE2b-256 8d2a17c6bb1021cd701fcf4ec1ff9d38f0e1f33f50352aae3c60a78f331b700e

See more details on using hashes here.

File details

Details for the file livn-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: livn-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 292.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for livn-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3880682fbdf4876847c42b07813352777bcf38c9291d05527aedf80d45affbf
MD5 6ee834ec7c3b22e42c5bb38de49782d3
BLAKE2b-256 5e754a89541fc0de62f748a85cc0e3d2b87213c69cc70508e418f7839b561d87

See more details on using hashes here.

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