{"id":51270294,"url":"https://github.com/chaobrain/braintrace-snn-experiments","last_synced_at":"2026-06-29T17:35:42.986Z","repository":{"id":367861980,"uuid":"816668341","full_name":"chaobrain/braintrace-snn-experiments","owner":"chaobrain","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-28T02:17:42.000Z","size":212,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-28T04:14:07.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chaobrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-18T07:23:26.000Z","updated_at":"2026-06-28T02:17:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/chaobrain/braintrace-snn-experiments","commit_stats":null,"previous_names":["chaobrain/braintrace-snn-experiments"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/chaobrain/braintrace-snn-experiments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaobrain%2Fbraintrace-snn-experiments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaobrain%2Fbraintrace-snn-experiments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaobrain%2Fbraintrace-snn-experiments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaobrain%2Fbraintrace-snn-experiments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chaobrain","download_url":"https://codeload.github.com/chaobrain/braintrace-snn-experiments/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaobrain%2Fbraintrace-snn-experiments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34937364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-29T17:35:42.389Z","updated_at":"2026-06-29T17:35:42.977Z","avatar_url":"https://github.com/chaobrain.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ``BrainTrace`` experiments on spiking neural networks\n\n\n\n## Requirements\n\n\n```bash\n\npip install BrainX[cuda12]\n# or\npip install BrainX[cuda13]\npip install h5py matplotlib msgpack tonic prettytable\npip install torch torchvision --index-url https://download.pytorch.org/whl/cpu\n\n```\n\n\n\n\n## RSNN long-term dependency evaluation: DMS task\n\n```bash\n\n# BPTT\npython task-rsnn-long-term-dependency.py --epochs 2000 --method bptt --dataset dms --t_delay 1000 \\\n  --tau_I2 1500 --tau_neu 100 --tau_syn 100 --n_rec 200 --lr 0.001 --A2 1 --optimizer adam --devices 3 \\\n  --t_fixation 10. --spk_fun relu --acc_th 0.95 --n_data_worker 4  --dt 1. --ff_scale 6 --rec_scale 2\n  \n  \n# ES-D-RTRL (IO Dim)  \npython task-rsnn-long-term-dependency.py --epochs 2000 --method expsm_diag --etrace_decay 0.99 --vjp_time t --dataset dms --t_delay 1000 \\\n    --tau_I2 1500 --tau_neu 100 --tau_syn 100 --n_rec 200 --lr 0.001 --A2 1  --optimizer adam --devices 3 \\\n    --t_fixation 10. --spk_fun relu --acc_th 0.95  --n_data_worker 4  --dt 1. --ff_scale 6 --rec_scale 2\n    \n\n# D-RTRL (Param Dim)\npython task-rsnn-long-term-dependency.py --epochs 2000   --method diag --dataset dms  --t_delay 1000 \\\n    --tau_I2 1500 --tau_neu 100 --tau_syn 100 --n_rec 200 --lr 0.001 --A2 1   --optimizer adam --devices 3 \\\n    --t_fixation 10. --spk_fun relu --acc_th 0.95  --n_data_worker 4  --dt 1. --ff_scale 6 --rec_scale 2\n\n```\n\n\n\n## EI network for decision making tasks\n\nES-D-RTRL training of the EI network for decision making tasks. \n\n```bash\ncd ./ei_coba_net_decision_making\npython training.py --tau_neu 200 --tau_syn 10 --tau_I2 2000  --ff_scale 4.0 --rec_scale 2.0  --method esd-rtrl  --n_rec 800  --epoch_per_step 20 --diff_spike  0  --epochs 300 --lr 0.001 --etrace_decay 0.9\n```\n\nD-RTRL training of the EI network for decision making tasks. \n\n```bash\npython training.py --tau_neu 200 --tau_syn 10 --tau_I2 2000  --ff_scale 4.0 --rec_scale 2.0  --method d-rtrl  --n_rec 800  --epoch_per_step 30 --diff_spike  0  --epochs 300 --lr 0.001\n```\n\n\nBPTT training of the EI network for decision making tasks. \n\n```bash\npython training.py --tau_neu 200 --tau_syn 10 --tau_I2 2000  --ff_scale 4.0 --rec_scale 2.0  --method bptt  --n_rec 800  --epoch_per_step 30 --diff_spike  0  --epochs 300 --lr 0.001 \n```\n\n\n## Memory and speed evaluation\n\n\n```bash\n\npython task-memory-and-speed-evaluation-tpu.py\n\n```\n\n\n\n\n## RSNN image classification on Gesture dataset\n\nThe code below is used to train a spiking neural network on the Gesture dataset using different methods (BPTT, ES-D-RTRL, D-RTRL).\n\nThe codebase is located in `./event_gru_dvs_gesture` di\n\n\nBPTT\n\n```bash\npython main.py --batch-size 64 --units 1024 \\\n    --num-layers 1 --frame-size 128 --method bptt  \\\n    --train-epochs 500 --frame-time 25 --rnn-type event-gru \\\n    --learning-rate 0.001 --lr-gamma 0.9 --lr-decay-epochs 100 \\\n    --event-agg-method mean --use-cnn --dropout 0.5 --zoneout 0 \\\n    --pseudo-derivative-width 1.7 --threshold-mean 0.25 --augment-data \\\n    --devices 0  --data ../data --cache ./cache\n```\n\n\nD-RTRL\n\n```bash\npython main.py --batch-size 64 --units 1024 \\\n    --num-layers 1 --frame-size 128 --method d-rtrl  \\\n    --train-epochs 500 --frame-time 25 --rnn-type event-gru \\\n    --learning-rate 0.001 --lr-gamma 0.9 --lr-decay-epochs 50 \\\n    --event-agg-method mean --use-cnn --dropout 0.5 --zoneout 0 \\\n    --pseudo-derivative-width 1.7 --threshold-mean 0.25 \\\n    --augment-data  --data ../data --cache ./cache --devices 1\n```\n\nES-D-RTRL\n\n```bash\npython main.py --batch-size 64 --units 1024 \\\n    --num-layers 1 --frame-size 128 --method es-d-rtrl --etrace-decay 0.2  \\\n    --train-epochs 500 --frame-time 25 --rnn-type event-gru \\\n    --learning-rate 0.001 --lr-gamma 0.9 --lr-decay-epochs 100 \\\n    --event-agg-method mean --use-cnn --dropout 0.5 --zoneout 0 \\\n    --pseudo-derivative-width 1.7 --threshold-mean 0.25 \\\n    --augment-data  --data ../data --cache ./cache --devices 6\n```\n\n\n\n## RSNN classification on SHD dataset\n\n\nSee the codebase in [braintrace-shd-experiments](https://github.com/chaobrain/braintrace-shd-experiments). \n\n\n\n\n## Citation \n\nIf you use this code or data, please cite:\n\n```bibtex\n\n@Article{Wang2026,\n  author={Wang, Chaoming\n          and Dong, Xingsi\n          and Ji, Zilong\n          and Xiao, Mingqing\n          and Jiang, Jiedong\n          and Liu, Xiao\n          and Huan, Yuxiang\n          and Wu, Si},\n  title={Model-agnostic linear-memory online learning in spiking neural networks},\n  journal={Nature Communications},\n  year={2026},\n  month={Jan},\n  day={19},\n  abstract={Spiking neural networks (SNNs) offer a promising paradigm for modeling brain dynamics and developing neuromorphic intelligence, yet an online learning system capable of training rich spiking dynamics over long horizons with low memory footprints has been missing. Existing online approaches either incur quadratic memory growth, sacrifice biological fidelity through oversimplified models, or lack end-to-end automated tooling. Here, we introduce BrainTrace, a model-agnostic, linear-memory, and automated online learning system for spiking neural networks. BrainTrace standardizes model specification to encompass diverse neuronal and synaptic dynamics; implements a linear-memory online learning rule by exploiting intrinsic properties of spiking dynamics; and provides a compiler that automatically generates optimized online-learning code for arbitrary user-defined models. Across diverse dynamics and tasks, BrainTrace achieves strong learning performance with a low memory footprint and high computational throughput. Critically, these properties enable online fitting of a whole-brain-scale Drosophila SNN that recapitulates region-level functional activity. By reconciling generality, efficiency, and usability, BrainTrace establishes a foundation for spiking network modeling at scale.},\n  issn={2041-1723},\n  doi={10.1038/s41467-026-68453-w},\n  url={https://doi.org/10.1038/s41467-026-68453-w}\n}\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaobrain%2Fbraintrace-snn-experiments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchaobrain%2Fbraintrace-snn-experiments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaobrain%2Fbraintrace-snn-experiments/lists"}