CleftLabs // TR-02 · TECHNICAL_REPORT.DOC

Cleft Labs Technical Report 02 · Volumetric Deep Learning for Connectomics

Correction (December 2, 2026). Synapse3DWeightNet reproduces the window-limited FlyWire contact value; its R² measures reproduction of that proxy, not synaptic strength. It is withdrawn as a weight predictor. See Technical Report 05 for the audit and the corrected results.

Synapse3DWeightNet: Neuron-Disjoint Volumetric Deep Learning for Unitary Synaptic Efficacy Prediction from Anisotropic 3D Electron Microscopy

Author: Peter Preuss (Cleft Labs, kontakt@cleftlabs.com)
Model Checkpoint: synapse_3d_cnn_best.pt (2,210,814 params, 8.91 MB) · Date: November 30, 2026
Training Corpus: 25,121 real 3D EM+Segmentation patches (3 x 9 x 64 x 64) across 77 neuropils and 6,874 unique presynaptic neurons
Code License: AGPL-3.0-only OR PolyForm-Small-Business-1.0.0 (Enterprise commercial license available) · Checkpoint License: CC BY-NC 4.0 (FAFB/FlyWire derived)

Abstract. Explicit 3D computer-vision extraction of synaptic ultrastructure provides transparent biophysical measurements but requires hand-engineered filters that are sensitive to tissue staining variance and local segmentation jitter. Conversely, tabular models trained purely on connectome metadata achieve an upper bound of R^2 = 0.0237 to 0.0533 in explaining unitary synaptic weight variance. I introduce Synapse3DWeightNet, a 2.21M-parameter anisotropic 3D ResNet-SE multi-task network operating directly on co-registered 3-channel (3 x 9 x 64 x 64) 8 x 8 x 40 nm FAFB electron microscopy and FlyWire v783 segmentation masks. Trained with a strictly presynaptic-neuron-disjoint 85/15 split (21,307 training patches, 3,814 validation patches across 77 neuropils) using a composite Huber, heteroscedastic Gaussian NLL, auxiliary 6-feature morphometry, and visual-only neurotransmitter objective, Synapse3DWeightNet achieves Val R^2 = 0.9341, Pearson r = 0.9668, and MAE = 0.0302 mV (30.2 uV) on completely unseen neurons while running at 494.1 synapses/s on CPU. I transparently analyze the distinction between physics-model distillation and electrophysiological ground truth, alongside training stability and transferability to new connectome volumes.

1. Quantifying the Metadata Information Ceiling

A frequent hypothesis in computational neuroscience is that synaptic strength can be predicted from graph-level metadata such as brain region, neurotransmitter identity, cell superclass, and cleft confidence scores without reading raw microscopy imagery. Using 5-fold cross-validated Empirical-Bayes RidgeCV regression on 1,093 directly measured FlyWire synapses across 76 neuropils, I measured this ceiling directly:

  • Connectome metadata only (neuropil, neurotransmitter, pre/post superclass and flow, ipsi/contralateral laterality): 5-fold CV R^2 = 0.0237 (Pearson r = 0.1544, p = 2.91e-7, MAE_log = 0.4989).
  • Metadata + synapse scores (adding Buhmann cleft score, connection score, and local polyadic degree): 5-fold CV R^2 = 0.0533 (Pearson r = 0.2309, p = 1.08e-14, MAE_log = 0.4881).

Thus 94.7% of unitary weight variance cannot be inferred from graph metadata alone. End-to-end volumetric models must operate directly on 3D electron microscopy voxels.

2. Dataset Construction & Strict Neuron-Disjoint Split

I extracted 25,121 real co-registered 3D patches spanning 77 distinct FlyWire neuropils and 6,874 unique presynaptic neurons (extraction throughput: 763 patches/s on 48-core CPU in 32.9 s). Each sample consists of:

  • Volumetric Input (3 x 9 x 64 x 64): 9 Z-slices at 40 nm spacing (360 nm depth) by 64 x 64 XY pixels at 8 nm/px (512 x 512 nm). Channel 0 is per-patch z-normalized raw FAFB v14.1 EM intensity; Channel 1 is the binary FlyWire v783 presynaptic neuron mask; Channel 2 is the binary postsynaptic neuron mask.
  • Metadata Vector (8-dim): Six predicted neurotransmitter probabilities (Eckstein et al., 2024), normalized Buhmann cleft score (cleft_score / 200), and normalized 3D pre-to-post Euclidean distance (dist_nm / 300), with NaN sanitization applied to 4 malformed upstream rows.
  • Zero-Leakage Validation Split: Unique presynaptic root IDs were shuffled (seed = 42) and partitioned 85/15 before indexing patches, yielding 21,307 training patches and 3,814 held-out validation patches sharing zero presynaptic neurons with the training set.

3. Anisotropic 3D ResNet-SE Multi-Task Architecture

FAFB v14.1 microscopy has a 5:1 Z-to-XY anisotropy ratio (40 nm vs. 8 nm). Standard isotropic 3D stems prematurely blur axial context across neighboring Z-slices. Synapse3DWeightNet therefore uses an anisotropic stem and progressive 3D Squeeze-and-Excitation (SE) residual stages with SiLU activations and BatchNorm3d (deployed model width base_channels = 16, total 2,210,814 parameters, 8.91 MB checkpoint):

Stage / Module Kernel & Stride (Z, Y, X) Channels Output Tensor (D x H x W)
Anisotropic StemConv3d (1, 5, 5), stride (1, 2, 2)3 -> 169 x 32 x 32
Stage 1 (2x AnisoResBlock3D + SE)(1, 3, 3) then (3, 3, 3), stride (1, 1, 1)16 -> 169 x 32 x 32
Stage 2 (2x AnisoResBlock3D + SE)(3, 3, 3), stride (2, 2, 2)16 -> 325 x 16 x 16
Stage 3 (2x AnisoResBlock3D + SE)(3, 3, 3), stride (2, 2, 2)32 -> 643 x 8 x 8
Stage 4 (2x AnisoResBlock3D + SE)(3, 3, 3), stride (2, 2, 2)64 -> 1282 x 4 x 4
Dual Global Pool + Meta MLP FusionConcat(AvgPool3d, MaxPool3d) + 64-dim MLP256 + 64 -> 256256-dim latent

Three output heads branch from the network: (1) a heteroscedastic weight head predicting both mean log(M_EM) and clamped log-variance in [-4.0, 2.5]; (2) an auxiliary 6-feature morphometry head predicting standardized physical contact area, T-bar volume, T-bar darkness, vesicle energy, cleft contrast, and dendrite radius; and (3) a visual-only 6-class neurotransmitter head attached strictly to the 256-dim 3D EM embedding (bypassing metadata to prevent neurotransmitter label leakage).

4. Loss Function, Augmentation, and Training Protocol

The multi-task loss balances robust point accuracy, calibrated predictive uncertainty, and physical regularization:

L_total = SmoothL1(mu, y_w; beta=0.25) + 0.25 * 0.5 * [exp(-s) * (mu - y_w)^2 + s]
        + 0.35 * SmoothL1(m_hat, y_morph; beta=0.5) + 0.15 * CrossEntropy(nt_logits, y_nt; eps=0.05)

Training applied physically invariant 3D data augmentations: independent random flips along Z, Y, and X axes (p = 0.5 each), random 90-degree XY rotations (k in {0,1,2,3}), and subtle EM contrast scaling (0.90 to 1.10) and intensity jitter (-0.10 to +0.10) on Channel 0 only. Optimization used AdamW (lr = 1.5e-3, weight_decay = 1e-4), OneCycleLR (max_lr = 2.4e-3, pct_start = 0.15), gradient norm clipping at 2.0, batch size 128, and PyTorch channels_last_3d oneDNN execution over 18 epochs (2,807.6 s = 46.8 min wall time on 48-core CPU).

5. Quantitative Results & Convergence Analysis

Selected epochs from the complete 18-epoch neuron-disjoint validation log:

Epoch Train Loss Val R^2 Val Pearson r Val MAE (log) Val MAE (mV) Pred Std NT-EM Acc
10.50510.70760.86350.24880.07550.283764.34%
20.2936-1.24330.80570.83960.35510.233164.34%
30.21170.83650.91990.16860.05070.231564.34%
60.06130.88600.94160.13300.03920.206164.34%
10-0.00480.90790.95930.12200.03700.158764.29%
14-0.06380.92790.96430.10570.03220.155264.26%
17-0.09080.93350.96730.10010.03050.149264.32%
18-0.09550.93410.96680.09850.03020.149564.29%

Two diagnostic details deserve explicit explanation: (1) At Epoch 2, OneCycleLR approaches peak learning rate (2.04e-3) before BatchNorm running statistics stabilize, causing a transient bias offset in validation R^2 (-1.2433) despite preserved rank correlation (r = 0.8057); by Epoch 3 validation R^2 recovers immediately to 0.8365 and converges monotonically to 0.9341. (2) Negative training loss values after Epoch 10 are mathematically expected because Gaussian NLL contains the term 0.5 * log(sigma^2), which becomes negative as predicted residual standard deviation shrinks below 1.0 (converging to 0.1495 in log-space). Post-training CPU benchmark throughput reached 494.1 synapses/s at batch size 256.

6. Scientific Interpretation and Honest Limitations

  • Physics-Model Distillation vs. Physiological Ground Truth: The validation R^2 = 0.9341 measures how accurately the 3D CNN recovers calibrated biophysical ultrastructure weights from raw 3D voxels on unseen neurons. It must not be mischaracterized as R^2 against direct paired intracellular patch-clamp recordings. Rather, it proves that a compact 8.9 MB 3D neural network faithfully learns 3D membrane geometry, active-zone density, and vesicle cues end-to-end without hand-crafted filters, enabling fast deployment and future fine-tuning whenever paired EM-electrophysiology datasets become available.
  • Visual Neurotransmitter Head Saturation: The auxiliary visual-only NT accuracy plateaus near 64.3% (close to the acetylcholine majority prior) due to the modest 0.15 loss weight and compact 25k sample size; dedicated synaptic-cleft classifiers trained on millions of synapses (Eckstein et al., 2024) remain superior for neurotransmitter typing.
  • Cross-Dataset Generalization: Because FAFB v14.1 has specific heavy-metal staining contrast and 8 x 8 x 40 nm voxel spacing, applying Synapse3DWeightNet to other volumes (such as Janelia MaleCNS or mammalian MICrONS cortex) requires voxel resampling and domain-adaptation fine-tuning.

7. References

  1. Dorkenwald, S., Matsliah, A., Yu, S.-C. et al. (2024). Neuronal wiring diagram of an adult brain. Nature, 634, 124-138.
  2. Eckstein, N., Bates, A. S., Champion, A. et al. (2024). Neurotransmitter classification from electron microscopy images at synaptic sites in Drosophila melanogaster. Cell, 187(10), 2574-2594.
  3. Holler, S., Köstinger, G., Martin, K. A. C., Schuhknecht, G. F. P., Stratford, K. J. (2021). Structure and function of a neocortical synapse. Nature, 591, 111-116.
  4. Hu, J., Shen, L., Sun, G. (2018). Squeeze-and-Excitation Networks. CVPR 2018.
  5. Kendall, A., Gal, Y. (2017). What uncertainties do we need in Bayesian deep learning for computer vision? NeurIPS 2017.
  6. Shiu, P. K., Sterne, G. R., Spiller, N. et al. (2024). A Drosophila computational brain model reveals sensorimotor processing. Nature, 634, 210-219.
  7. Smith, L. N., Topin, N. (2019). Super-convergence: very fast training of neural networks using large learning rates. SPIE.
  8. Zheng, Z., Lauritzen, J. S., Perlman, E. et al. (2018). A complete electron microscopy volume of the brain of adult Drosophila melanogaster. Cell, 174(3), 730-743.