Instructions to use QuixiAI/MaleCNS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuixiAI/MaleCNS with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="QuixiAI/MaleCNS", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuixiAI/MaleCNS", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
QuixiAI/MaleCNS
The MaleCNS v1.0 connectome, the complete wiring diagram of an adult male Drosophila melanogaster central
nervous system (brain, optic lobes, and ventral nerve cord), packaged as Hugging Face safetensors so it loads as
PyTorch tensors with AutoModel.from_pretrained(..., trust_remote_code=True).
Why this exists. MaleCNS reached the Hub through ngxson/fly-llm-hf, a fun demonstration that the fly's central brain can serve as a frozen echo-state reservoir for a TinyStories language model. That repository is a model: it keeps 49,393 central-brain neurons, assigns each synapse a sign from the presynaptic neuron's predicted neurotransmitter, rescales the whole matrix to a spectral radius of 0.99, and trains projections, per-neuron gains, and a readout around it. Those are good modeling decisions for that project, but they are baked into its weights, so anyone who wants the connectome for something else has to undo them or go back to the raw release. This repository is the layer underneath: the source connectome, unmodified, so that fly-llm-hf, downstream models, graph-ML work, and simulations can all start from the same lossless tensors. At a high level the differences are:
- Whole nervous system, not a subset. Every body in the release's connectivity file: brain, optic lobes, and ventral nerve cord, with subsets available as masks rather than chosen for you.
- Raw anatomical counts, not neural weights.
synapse_countis the release'sweightcolumn, untouched: no sign convention, no spectral rescaling, no normalization, no bf16 rounding, no random initialization. - Neurotransmitter predictions kept separate. Mirrored as their own tensors so a sign convention is something you apply, not something you inherit.
- Verified lossless. The build reloads the saved tensors and checks them against the release table edge by edge.
A lossless packaging of the MaleCNS connectivity tables. It imposes no neuron model, no neurotransmitter sign convention, no normalization, no rounding, no initialization, and no language-model architecture.
The canonical content is the release's full segment-to-segment connectivity file, mirrored literally: for every row
body_pre, body_post, weight there is one edge edge_src, edge_dst, synapse_count, in the file's row order, with the
weight column untouched. These values are anatomical connection weights: the number of detected synaptic
contacts from one body to another. They are not physiological synaptic efficacies. Any use of them as neural-network
weights (sign, scale, normalization, random re-initialization) is a downstream modeling choice and belongs downstream.
| Bodies (every segment with a synapse in the table) | 88,384,522 |
| Directed connections | 151,856,684 (of which 123 autapses, kept) |
| Synaptic contacts represented | 311,833,243 |
| Synapse count per connection | 1 – 2,591 |
| Connections at a minimum synapse count | ≥1: 151,856,684 · ≥2: 57,670,765 · ≥3: 23,014,406 · ≥5: 7,622,864 · ≥10: 2,799,910 |
| Mean in/out degree | 1.7 (max in 13,518, max out 56,517) |
Proofread neurons (status == Traced) |
164,789 bodies, 25,563,197 connections between them, 124,025,046 contacts |
The release also ships a traced-only connectivity file. It is not packaged separately because it is exactly this table
restricted to bodies with status == Traced; the build script checks that equality edge by edge.
Side by side with ngxson/fly-llm-hf
Facts about fly-llm-hf are taken from its model card.
| this repository | ngxson/fly-llm-hf |
|
|---|---|---|
| Purpose | package MaleCNS losslessly for PyTorch / graph ML | a toy language model (echo-state reservoir) |
| Source | official flat-connectome files from the Janelia bucket, md5-verified | MaleCNS as packaged by the Xenova fruit-fly-simulation space |
| Scope | the full table: 88,384,522 bodies, 151,856,684 connections; subsets as masks | central brain only (cb_sensory, visual_projection, cb_intrinsic, ascending, descending): 49,393 neurons, 9,050,172 edges |
| Edge values | exact synapse counts (int32), file row order, untouched | signed synapse counts (ACh +1, GABA/glutamate −1, others 0), globally rescaled to spectral radius 0.99, plus a learned per-neuron gain |
| Neurotransmitter data | the release table mirrored as separate tensors, not applied to the graph | used to assign the sign of every outgoing edge |
| Dynamics | none (forward is one linear propagation step, for convenience) |
leaky-tanh reservoir, a = 0.9, 8-token delay line into 14,069 sensory neurons |
| Trainable parameters | none | input projection, per-neuron gains, LayerNorm + readout (52.8M); the connectome is frozen |
| Tokenizer / task | none | byte-level BPE (1024) / TinyStories |
transformers role |
AutoModel returning the graph |
AutoModelForCausalLM generating text |
Janelia MaleCNS v1.0 ──► this repository (synapse counts, untouched) ──► your model (whatever weights you derive from them)
Janelia MaleCNS v1.0 ──► Xenova packaging ──► fly-llm-hf (signed, rescaled, frozen reservoir + TinyStories readout)
What is in model.safetensors
| tensor | shape | dtype | size |
|---|---|---|---|
neuron_id |
(88384522,) | int64 | 707.1 MB |
edge_src |
(151856684,) | int32 | 607.4 MB |
edge_dst |
(151856684,) | int32 | 607.4 MB |
synapse_count |
(151856684,) | int32 | 607.4 MB |
neuron_status |
(88384522,) | int8 | 88.4 MB |
neuron_superclass |
(88384522,) | int8 | 88.4 MB |
nt_neuron_index |
(1835518,) | int32 | 7.3 MB |
nt_class |
(1835518,) | int8 | 1.8 MB |
nt_confidence |
(1835518,) | float64 | 14.7 MB |
neuron_id maps a neuron index to its MaleCNS body id. neuron_status and neuron_superclass are the release's
own annotation vocabularies (config.status_labels, config.superclass_labels). The neurotransmitter table is
mirrored as its own group (nt_*, one row per body that has a prediction), because Janelia publishes it
independently of the connectivity weights: nt_class is the table's consensus_nt, nt_confidence its
predicted_nt_confidence in float64. Full string columns of both source tables are in neurons.parquet and
neurotransmitters.parquet, verbatim.
Proofreading status (neuron_status)
| status | bodies |
|---|---|
| unannotated | 88,197,545 |
| Traced | 164,789 |
| Orphan | 13,557 |
| Glia | 3,292 |
| Unimportant | 3,056 |
| Assign | 1,801 |
| Anchor | 482 |
Named subsets (cns.subset_mask(name))
Documented convenience only: each subset is a list of release superclass values. Nothing in the data depends on it.
| subset | bodies | superclasses |
|---|---|---|
full_cns |
88,384,522 | every body in the table |
central_brain |
37,148 | cb_intrinsic, cb_sensory, cb_motor, cb_endocrine, cb_efferent, cb_sensory_tbc |
optic_lobes |
95,499 | ol_intrinsic, ol_sensory |
vnc |
20,411 | vnc_intrinsic, vnc_sensory, vnc_motor, vnc_efferent, vnc_endocrine, vnc_tbc, vnc_sensory_tbc |
cb_sensory |
4,801 | cb_sensory, cb_sensory_tbc |
visual_projection |
9,202 | visual_projection, visual_projection_tbc |
visual_centrifugal |
563 | visual_centrifugal |
ascending |
2,393 | ascending_neuron, sensory_ascending, sensory_ascending_tbc, efferent_ascending |
descending |
1,332 | descending_neuron, descending_neuron_tbc, sensory_descending, efferent_descending |
Consensus neurotransmitter (rows of the neurotransmitter table)
| neurotransmitter | bodies |
|---|---|
| unclear | 1,671,117 |
| acetylcholine | 104,193 |
| glutamate | 29,443 |
| gaba | 22,196 |
| histamine | 8,024 |
| dopamine | 396 |
| octopamine | 101 |
| serotonin | 48 |
Usage
import torch
from transformers import AutoModel
cns = AutoModel.from_pretrained("QuixiAI/MaleCNS", trust_remote_code=True)
neurons = cns.status_mask("Traced") # proofread neurons only
W = cns.sparse_weight(nodes=neurons) # sparse COO, rows = destination, raw counts
W_cb = cns.sparse_weight(nodes=neurons & cns.subset_mask("central_brain"), min_synapses=3)
sub = cns.subgraph(neurons & cns.superclass_mask("cb_intrinsic")) # edge_src/edge_dst/synapse_count/neuron_id
nt_class, nt_conf = cns.neuron_nt() # per-neuron consensus neurotransmitter
x = torch.zeros(1, cns.num_neurons); x[0, 0] = 1.0
incoming = cns(x) # one propagation step with raw counts
Training on this graph
The tensors above are the input format of QuixiAI/connectome-kernels,
fused CUDA kernels for training a leaky-tanh recurrence with one trainable weight per edge on a fixed sparse graph
(about 13× faster than torch.sparse on a 5k-neuron, 524k-edge subgraph, with identical gradients). What the edge
values are initialized to, whether they carry a neurotransmitter sign, and how they are normalized are all decisions
made at that layer, not in this repository.
from connectome_kernels import SparseGraph, sparse_recurrence
sub = cns.subgraph(cns.status_mask("Traced") & cns.subset_mask("central_brain"), min_synapses=3)
graph = SparseGraph(sub["edge_src"].long().cuda(), sub["edge_dst"].long().cuda(), sub["neuron_id"].numel(), input_nodes)
edge_values = torch.nn.Parameter(torch.randn(graph.E, device="cuda")) # yours to initialize; sub["synapse_count"] is available
out = sparse_recurrence(edge_values, leak, bias, drives, state0, graph, microsteps=2) # [T, B, N], differentiable
Provenance
Built by the script data/fly/export_malecns_hf.py from these files in
gs://flyem-male-cns/v1.0/connectome-data/flat-connectome/, md5-verified against the bucket listing:
| role | file | md5 (base64) |
|---|---|---|
| connectivity | connectome-weights-male-cns-v1.0-minconf-0.5.feather |
None |
| connectivity_traced_only | connectome-weights-male-cns-v1.0-minconf-0.5-traced-only.feather |
ZgHUrQr6mf0D6wh5Ze8kIw== |
| annotations | body-annotations-male-cns-v1.0-minconf-0.5.feather |
UKdxh3DFciDxYLpPQxq4ng== |
| neurotransmitters | body-neurotransmitters-male-cns-v1.0.feather |
PYQrEv5cSe763lKNfdJKHw== |
Citation
If you use this repository, please cite it and the MaleCNS dataset paper it repackages.
This repository:
@misc{hartford2026malecns,
title = {QuixiAI/MaleCNS: the MaleCNS v1.0 fruit-fly connectome as lossless Safetensors},
author = {Hartford, Eric},
year = {2026},
publisher = {Hugging Face},
doi = {10.57967/hf/10410},
howpublished = {\url{https://huggingface.co/QuixiAI/MaleCNS}},
note = {Repackaging of Berg et al. (2026), CC-BY 4.0}
}
The dataset (required by the CC-BY 4.0 license):
Berg, S., Beckett, I. R., Costa, M., Schlegel, P., Januszewski, M., Marin, E. C., Nern, A., Preibisch, S., et al. (2026). Sexual dimorphism in the complete Drosophila male central nervous system connectome. Cell 189, 5504–5526.e15. https://doi.org/10.1016/j.cell.2026.08.015 (preprint: https://doi.org/10.1101/2025.10.09.680999)
@article{berg2026malecns,
title = {Sexual dimorphism in the complete {Drosophila} male central nervous system connectome},
author = {Berg, Stuart and Beckett, Isabella R. and Costa, Marta and Schlegel, Philipp and Januszewski, Michał and Marin, Elizabeth C. and Nern, Aljoscha and Preibisch, Stephan and Qiu, Wei and Takemura, Shin-ya and Fragniere, Alexandra M.C. and Champion, Andrew S. and Adjavon, Diane-Yayra and Cook, Michael and Gkantia, Marina and Hayworth, Kenneth J. and Huang, Gary B. and Katz, William T. and Kämpf, Florian and Lu, Zhiyuan and Ordish, Christopher and Paterson, Tyler and Stürner, Tomke and Trautman, Eric T. and Whittle, Catherine R. and Burnett, Laura E. and Hoeller, Judith and Li, Feng and Loesche, Frank and Morris, Billy J. and Pietzsch, Tobias and Pleijzier, Markus W. and Silva, Valeria and Yin, Yijie and Ali, Iris and Badalamente, Griffin and Bates, Alexander Shakeel and Beresford, Rory J. and Bogovic, John and Brooks, Paul and Cachero, Sebastian and Canino, Brandon S. and Chaisrisawatsuk, Bhumpanya and Clements, Jody and Crowe, Arthur and de Haan Vicente, Inês and Dempsey, Georgia and Donà, Erika and Dos Santos, Márcia and Dreher, Marisa and Dunne, Christopher R. and Eichler, Katharina and Finley-May, Samantha and Flynn, Miriam A. and Hameed, Imran and Hopkins, Gary Patrick and Hubbard, Philip M. and Kiassat, Ladann and Kovalyak, Julie and Lauchie, Shirley A. and Leonard, Meghan and Lohff, Alanna and Longden, Kit D. and Maldonado, Charli A. and Moitra, Ilina and Moon, Sung Soo and Mooney, Caroline and Munnelly, Eva J. and Okeoma, Nneoma and Olbris, Donald J. and Pai, Anika and Patel, Birava and Phillips, Emily M. and Plaza, Stephen M. and Richards, Alana and Rivas Salinas, Jennifer and Roberts, Ruairí J.V. and Rogers, Edward M. and Scott, Ashley L. and Scuderi, Louis A. and Seenivasan, Pavithraa and Serratosa Capdevila, Laia and Smith, Claire and Svirskas, Rob and Takemura, Satoko and Tastekin, Ibrahim and Thomson, Alexander and Umayam, Lowell and Walsh, John J. and Whittome, Holly and Xu, C. Shan and Yakal, Emily A. and Yang, Tansy and Zhao, Arthur and George, Reed and Jain, Viren and Jayaraman, Vivek and Korff, Wyatt and Meissner, Geoffrey W. and Romani, Sandro and Funke, Jan and Knecht, Christopher and Saalfeld, Stephan and Scheffer, Louis K. and Waddell, Scott and Card, Gwyneth M. and Ribeiro, Carlos and Reiser, Michael B. and Hess, Harald F. and Rubin, Gerald M. and Jefferis, Gregory S.X.E.},
journal = {Cell},
volume = {189},
number = {18},
pages = {5504--5526.e15},
year = {2026},
month = sep,
publisher = {Elsevier},
doi = {10.1016/j.cell.2026.08.015},
url = {https://doi.org/10.1016/j.cell.2026.08.015},
note = {Preprint: bioRxiv 10.1101/2025.10.09.680999. Data: MaleCNS v1.0, CC-BY 4.0, https://male-cns.janelia.org}
}
License
Released under CC-BY 4.0 by the FlyEM Project Team (HHMI Janelia), the University of Cambridge (Dept. of Zoology), the MRC Laboratory of Molecular Biology, and Google Research. This repository is a repackaging and carries the same license; attribution to the original authors (above) is required.
Official site: https://male-cns.janelia.org · neuPrint dataset male-cns:v1.0.
- Downloads last month
- -