CoolFace
Modelpublic

QuixiAI/MaleCNS

sourceHugging Facecc-by-4.0updated 8d agoView on Hugging Face
12likes368downloads
Model Card

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_count is the release's weight column, 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 connections151,856,684 (of which 123 autapses, kept)
Synaptic contacts represented311,833,243
Synapse count per connection1 – 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 degree1.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`
Purposepackage MaleCNS losslessly for PyTorch / graph MLa toy language model (echo-state reservoir)
Sourceofficial flat-connectome files from the Janelia bucket, md5-verifiedMaleCNS as packaged by the Xenova fruit-fly-simulation space
Scopethe full table: 88,384,522 bodies, 151,856,684 connections; subsets as maskscentral brain only (cbsensory, visualprojection, cb_intrinsic, ascending, descending): 49,393 neurons, 9,050,172 edges
Edge valuesexact synapse counts (int32), file row order, untouchedsigned synapse counts (ACh +1, GABA/glutamate −1, others 0), globally rescaled to spectral radius 0.99, plus a learned per-neuron gain
Neurotransmitter datathe release table mirrored as separate tensors, not applied to the graphused to assign the sign of every outgoing edge
Dynamicsnone (forward is one linear propagation step, for convenience)leaky-tanh reservoir, a = 0.9, 8-token delay line into 14,069 sensory neurons
Trainable parametersnoneinput projection, per-neuron gains, LayerNorm + readout (52.8M); the connectome is frozen
Tokenizer / tasknonebyte-level BPE (1024) / TinyStories
transformers roleAutoModel returning the graphAutoModelForCausalLM generating text
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

tensorshapedtypesize
neuron_id(88384522,)int64707.1 MB
edge_src(151856684,)int32607.4 MB
edge_dst(151856684,)int32607.4 MB
synapse_count(151856684,)int32607.4 MB
neuron_status(88384522,)int888.4 MB
neuron_superclass(88384522,)int888.4 MB
nt_neuron_index(1835518,)int327.3 MB
nt_class(1835518,)int81.8 MB
nt_confidence(1835518,)float6414.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)

statusbodies
unannotated88,197,545
Traced164,789
Orphan13,557
Glia3,292
Unimportant3,056
Assign1,801
Anchor482

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.

subsetbodiessuperclasses
full_cns88,384,522every body in the table
central_brain37,148cbintrinsic, cbsensory, cbmotor, cbendocrine, cbefferent, cbsensory_tbc
optic_lobes95,499olintrinsic, olsensory
vnc20,411vncintrinsic, vncsensory, vncmotor, vncefferent, vncendocrine, vnctbc, vncsensorytbc
cb_sensory4,801cbsensory, cbsensory_tbc
visual_projection9,202visualprojection, visualprojection_tbc
visual_centrifugal563visual_centrifugal
ascending2,393ascendingneuron, sensoryascending, sensoryascendingtbc, efferent_ascending
descending1,332descendingneuron, descendingneurontbc, sensorydescending, efferent_descending

Consensus neurotransmitter (rows of the neurotransmitter table)

neurotransmitterbodies
unclear1,671,117
acetylcholine104,193
glutamate29,443
gaba22,196
histamine8,024
dopamine396
octopamine101
serotonin48

Usage

python
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.

python
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:

rolefilemd5 (base64)
connectivityconnectome-weights-male-cns-v1.0-minconf-0.5.featherNone
connectivitytracedonlyconnectome-weights-male-cns-v1.0-minconf-0.5-traced-only.featherZgHUrQr6mf0D6wh5Ze8kIw==
annotationsbody-annotations-male-cns-v1.0-minconf-0.5.featherUKdxh3DFciDxYLpPQxq4ng==
neurotransmittersbody-neurotransmitters-male-cns-v1.0.featherPYQrEv5cSe763lKNfdJKHw==

Citation

If you use this repository, please cite it and the MaleCNS dataset paper it repackages.

This repository:

bibtex
@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)
bibtex
@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.