QuixiAI/MaleCNS
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.
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.
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
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)
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.
Consensus neurotransmitter (rows of the neurotransmitter table)
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 countsTraining 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], differentiableProvenance
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:
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.
