Preprint
Review

This version is not peer-reviewed.

Harnessing Machine Learning for Decoding Caenorhabditis elegans Behavior

Submitted:

04 August 2025

Posted:

06 August 2025

You are already at the latest version

Abstract
Caenorhabditis elegans (C. elegans) has emerged as a genetically tractable model for decoding the neural and molecular underpinnings of behavior. Traditional methods of behavioral analysis are limited in scalability, resolution, and reproducibility, especially in high-throughput and longitudinal studies. Recent advances in machine learning have revolutionized the field, offering powerful tools for automated behavior tracking, posture estimation, phenotype classification, and neural decoding. This review systematically categorizes and evaluates the growing repertoire of machine learning models applied to C. elegans behavioral analysis, including handcrafted classifiers, deep neural networks, graph models, connectome-constrained simulators, and recurrent neural networks. It highlights their applications in decoding locomotion, aging, egg-laying, mating, sensory-guided navigation, and internal state transitions. Furthermore, it discusses the computational architecture, accuracy, interpretability, and translational relevance of these tools. Moreover, the review also addresses challenges such as model generalizability, reproducibility, and integration into lab workflows. The integration of machine learning into behavioral neuroscience underscores its transformative potential with C. elegans acting as a central model system linking the fields of biology and artificial intelligence.
Keywords: 
;  ;  ;  ;  ;  

1. Caenorhabditis elegans: A Genetically Tractable Organism for Behavioral Studies

Caenorhabditis elegans (C. elegans) is a non-parasitic, free-living microscopic nematode that grows to approximately 1 mm in length. Regardless of its small size, several advantages have led to the widespread use of C. elegans as a model organism for behavioral research. Many of its genes, molecular, and signaling pathways are well conserved in higher organisms, including humans [1,2], making it a valuable system for understanding fundamental biological and behavioral processes with translational application. Importantly, it has a simple, well-characterized, and completely mapped connectome that is composed of exactly 302 neurons [3]. It has a transparent body, which allows real-time observation of neuronal activity using fluorescent imaging techniques [4]. Thus, allowing accurate investigation of neural circuits underlying behavior. C. elegans is genetically traceable; using established tools for targeted gene manipulation, genes of interest can be knocked out, knocked in, or modified to study their behavioral effects [5,6]. It shows consistent and quantifiable behaviors, including locomotion [7], feeding [8], egg-laying [9], chemotaxis [10], learning [7,11], memory [12], sleep [13], and social interactions [5] that are well-suited to controlled experimental conditions. Furthermore, it is cost-effective, easy to maintain [14], and has a rapid life cycle that facilitates the generation of large sample sizes within short timeframes, thus supporting high-throughput behavioral screening [15]. Together, these attributes make C. elegans a powerful model for investigating the genetic, molecular, and neural mechanisms that control behavior that has significant relevance in neurobiology, developmental biology, disease modeling, and toxicological studies.
However, the conventional behavioral analysis in C. elegans relies either on semi-automated methods or manual scoring techniques, and these methods are labor-intensive, time-consuming, and often susceptible to human bias and variability. These traditional approaches struggle to cope with the scale, complexity, and diversity of modern behavioral assays, especially in high-throughput screening or long-term longitudinal studies [15,16]. To overcome these limitations, the integration of machine learning approaches has emerged as a transformative solution [17]. Machine learning models enable automated, accurate, and scalable analysis of complex behaviors by learning patterns from large datasets without relying on predefined rules. In recent years, various machine learning strategies from classic classifiers to deep neural networks have been developed to decode locomotion, feeding, reproduction, navigation, and social interactions in C. elegans. This review summarizes recent advances in machine learning-driven behavioral phenotyping, outlines the architecture and applications of these tools, and discusses their implications for neuroscience, genetics, toxicology, and aging research.

2. Machine Learning in C. elegans Behavioral Research

2.1. Machine Learning Approaches for Tracking, Decoding, and Modeling Locomotion in C. elegans

Locomotion is controlled by a defined set of motor neurons and interneurons. Tracking C. elegans’ locomotion and its wide range complex body postures, including turns, reversals, highly coiled and self-overlapping shapes helps in mapping neural activity to behavior, thus facilitates understanding of how individual neurons or neuromodulators (e.g., dopamine, serotonin) affect movement. Locomotion serves as a readout for gene function, helping identify the roles of genes associated with neurological and muscular disorders. It is highly quantifiable with measurable features, including velocity, wave frequency, bending angle, and curvature. Tracking these changes allows researchers to model how sensory inputs are processed into motor outputs. Alterations in locomotion behavior are sensitive indicators of drug effects or environmental toxins. High-throughput locomotion assays are used to test neuroactive compounds, antiparasitic drugs, heavy metals and pollutants.
This section discusses how machine learning has been implemented to segment body postures, track locomotion, decode motor features, and model aging-related dynamics in C. elegans.

2.1.1. Machine Learning for Segmentation and Detection of Worm Postures

Accurate segmentation of overlapping worm postures and reliable quantification of fine-scale behavioral metrics are crucial for deep phenotyping in C. elegans, especially in studies of aging and lifespan. To overcome the limitations of existing worm tracking systems under dense and noisy conditions, Dong and Chen developed WormYOLO, a novel deep learning-based segmentation and tracking framework derived from the YOLO object detection architecture and enhanced with RepLKNet, Attentional Scale Sequence DySample Fusion (ASDF), and Depthwise Semantics and Detail Infusion (DSDI) modules [18]. When analyzing three public datasets (CSB-1, Mating, and BBBC010), WormYOLO significantly outperformed both WormTracker and WormSwin. It achieved up to 24.1% higher mAP0.5:0.95 in detection and 9.3% higher in segmentation while lowering computational costs and increasing inference speeds (44.7 images/sec vs. 2.7 for WormSwin). A feature point extraction algorithm was incorporated to identify head, tail, inflection, and peak points on the worm skeleton, enabling robust posture reconstruction and accurate bending count estimation using criteria defined in WormBook (Figure 1A). The proposed counting algorithm achieved high accuracy even in self-occluded or overlapping scenes, with mean absolute errors as low as 1.6 compared to manual annotation. The model captured high-frequency bending patterns associated with locomotor variation and accurately identified movement characteristics across mutant strains (e.g., unc-4, dpy-20, LSJ1, trp-2). Furthermore, the system extracted six kinematic features, including head/body/tail bend speed, max bend speed, and omega duration across 10 strains and identified strong correlations between bending metrics and lifespan, highlighting head and max bend speed as predictive biomarkers. Regardless of occasional tracking failures in highly dense scenes, WormYOLO’s improvements in segmentation precision and motion feature extraction provide a powerful and scalable tool for behavioral analysis, lifespan prediction, and gene-function studies in C. elegans.

2.1.2. Handcrafted Feature-Based Classification of Behavioral Phenotypes

Quantitative behavioral phenotyping in C. elegans is central to understanding genetic, neural, and pharmacological influences on behavior, but selecting the right features to represent complex movement remains a major challenge. Early efforts in automated classification of C. elegans behavioral mutants used decision-tree algorithms such as Classification and Regression Trees (CART), which laid the groundwork for later, more scalable and precise machine learning tools for phenotypic behavior analysis [19]. Early machine vision frameworks such as CeSnAP focused on rapid, snapshot-based classification of worm postures without requiring continuous tracking or temporal segmentation [20]. CeSnAP achieved high-throughput scoring of phenotypic defects like curling using deep learning classifiers trained on static images, enabling large-scale drug screening applications. In contrast, the Tierpsy framework adopted a time-resolved feature extraction approach, capturing hundreds of interpretable dynamic features including body curvature, movement speed, and trajectory path statistics across sequences of frames [21]. Tierpsy’s handcrafted features supported large-scale behavioral phenotyping across genetically diverse strains, offering deeper temporal resolution but requiring longer tracking durations and curated feature selection. Together, these frameworks highlight complementary strategies in C. elegans behavioral quantification: snapshot-based simplicity versus dynamic, feature-rich analysis. However, deep learning models have since shifted focus toward learning features directly from raw images.
In C. elegans research, robust behavioral tracking under various kinds of environmental and experimental conditions remains a significant challenge, particularly as traditional image processing tools struggle to analyze images with low contrast, morphological variability, and occlusion. To address these challenges, Bates et al., developed a deep learning-based tracking framework using the Faster Region-Based Convolutional Neural Network (R-CNN) object detection architecture, trained and evaluated across three key experimental paradigms: developmental progression (WoP), reproductive egg-laying (egg-finder), and lifespan/aging (WiCh) [22]. With TensorFlow, each model was trained on manually annotated datasets and tweaked for specific conditions, thus allows for high-accuracy object detection with a minimal modification of parameters. The trained models performed consistently across microfluidic chambers, agar plates, even low-contrast and heterogeneous environments. They were able to recognize tiny and clustered eggs, identify worms from L2 through old age, and show outstanding average precision (AP up to 0.998). The models also enabled behavioral quantification, including egg-laying rate and spatial preferences (e.g., tph-1 mutants preferring to lay eggs off bacterial lawns), developmental movement profiles, and lifespan movement decline under dietary restriction (Figure 1B). In contrast to heuristic approaches, such as Tierpsy Tracker and Ilastik, Faster R-CNN performed well in heterogeneous backgrounds, generalized across conditions and datasets, and required no manual tuning. Furthermore, bounding box centroid data allowed estimation of motion metrics such as velocity, angular speed, and behavioral state (roaming vs. dwelling), even without full posture segmentation. A web-based, user-friendly interface for model retraining and deployment was provided to support broad adoption. All things considered, the deep learning platform provides a high-throughput, environment-neutral, and scalable solution for behavioral phenotyping in C. elegans, marking a significant advancement in computational ethology and experimental reproducibility.

2.1.3. Deep Learning-Based Representation of Posture and Motion

Accurate estimation of C. elegans body posture is essential for analyzing locomotory dynamics and behavioral phenotypes, particularly in high-resolution datasets where worms exhibit complex, coiled, and self-occluded shapes. Manual annotation of such frames is impractical and error-prone, creating a major bottleneck for large-scale behavioral analyses. WormPose is an open-source Python-based framework that addresses this challenge by combining deep convolutional neural networks (CNNs) with synthetic image generation, thereby eliminating the requirement for manually labeled training data [23]. The pipeline is developed using scientific computing libraries such as OpenCV for image preprocessing, scikit-learn for Gaussian Mixture Model (GMM) construction, and SciPy for interpolation and signal filtering. The WormPose workflow comprises three major stages: (1) a generative GMM-based model is trained on real worm posture data to produce realistic, coiled, and uncoiled centerlines, from which synthetic images are rendered by warping real textures onto these postures; (2) a ResNet-inspired CNN is trained on these synthetic image-centerline pairs to predict worm posture, using a custom loss function to address head-tail ambiguity; and (3) a post-processing stage resolves head-tail orientation using temporal information and filters inaccurate predictions based on image reconstruction errors (Figure 1C). WormPose achieves high-speed, high-fidelity pose estimation across varied imaging conditions, outperforming prior methods such as RCS (Resolving Coiled Shapes), a template-matching algorithm that uses eigenworm-based image searches to resolve coiled postures. It enables fine-scale behavioral analyses such as posture-resolved roaming and dwelling state classification, which revealed that centroid-based methods often misidentify incoherent motions as reversals. However, its performance depends on the synthetic training data’s variability and quality, and although head-tail ambiguity is algorithmically addressed, it still poses challenges in analyzing low-contrast or blurry images. Furthermore, the system may require alterations to analyze strains with extreme body morphologies. Together, WormPose serves as a scalable, annotation-free tool for behavioral phenotyping in C. elegans.
Decoding motor behaviors from whole-brain dynamics offers critical insights into how the nervous system represents and controls movement. However, most previous studies in C. elegans relied on immobilized animals or sparse recordings, leaving open questions about how neural population activity encodes behavior during natural locomotion. To address this, researchers have recorded population-wide calcium activity from ~120-140 head neurons using GCaMP6s in freely crawling worms, and developed a linear population decoder to predict locomotion features, specifically the body velocity and curvature from neural dynamics [24]. The model utilized ridge regression with inputs from both raw fluorescence signals and their temporal derivatives (Figure 1D). It outperformed the best single neuron in predicting velocity (median R² = 0.76 vs. 0.43) and curvature (median R² = 0.60 vs. 0.34) across held-out test sets. Furthermore, analysis uncovered that distinct neural subpopulations encode velocity and curvature with limited overlap. Interestingly, only a small subset of neurons (median ~25%) contributed most of the decoding power, and these contributions varied across behaviors and behavioral motifs. For example, different neurons were active for specific ventral or dorsal bends, or for particular reversals. The model also validated known dynamics of AVA neurons during reversals and revealed context-specific correlations among neurons. A key control involved calcium-insensitive GFP-expressing worms, which confirmed that decoding accuracy in GCaMP-expressing worms was not driven by motion artifacts. Moreover, comparisons between moving and immobilized animals demonstrated that immobilization drastically alters the correlation structure of neural dynamics, questioning the representational fidelity of fictive locomotion paradigms. Although the decoder was limited to linear modeling, and neuron identities remained untracked across recordings, the study provides a powerful demonstration that linear combinations of real-time population activity contain rich, distributed information sufficient to decode complex motor behavior in C. elegans. This work establishes a quantitative benchmark for population-level neural decoding in simple nervous systems. While linear decoding approaches provide valuable first insights into posture dynamics, nonlinear manifold learning offers a more comprehensive framework to capture the complex structure underlying locomotion behaviors.

2.1.4. Modeling Spatiotemporal Dynamics and Aging Using Machine Learning

Characterizing C. elegans behavior across timescales from rapid postural transitions to long-term foraging strategies requires models that unify fine- and coarse-grained dynamics. To address this, researchers present a principled data-driven framework that constructs a Markov model over posture sequences to describe locomotion behavior without relying on traditional deep learning techniques [25]. The model begins by transforming raw posture time series into a maximally predictive embedding using time-delayed eigenworm coefficients (a1–a5) (Figure 1E). From these, a 1000-state symbolic Markov chain is constructed via k-means clustering of these posture sequences. Transitions between states are governed by empirically derived probabilities, capturing the intrinsic timescales of worm behavior. This symbolic dynamic approach accurately reproduces posture autocorrelations, including the frequency of biologically relevant events (e.g., reversals, turns), and diffusive trajectories when combined with resistive force theory to simulate movement on agar. Moreover, by analyzing the eigenvectors of the transition matrix, the authors recover canonical behavioral motifs like “run-and-pirouette” and further uncover seven mesoscopic behavioral states, including fast and slow runs and various types of turns and reversals. Remarkably, worms appear to employ these states in proportions that mirror their respective efficiencies in food-finding simulations, suggesting an emergent probability matching strategy in exploration. Although the method does not use neural networks, it achieves strong behavioral realism and interpretability without imposing predefined behavioral categories. This modeling approach bridges posture and trajectory, stochasticity and structure, offering a powerful coarse-graining framework for multiscale behavioral analysis in C. elegans.
While Markov models provide a structured, probabilistic framework for posture transitions, alternative approaches have focused on uncovering the intrinsic topological structure underlying behavior. Topological Data Analysis (TDA) offers one such complementary method. Thomas et al., applied persistent homology to extract cyclic motifs and classify behavioral responses in high-dimensional posture space [26]. While powerful for visualization and structure discovery, TDA approaches remain computationally intensive and are less widely adopted compared to sequence-based methods.
Deciphering how C. elegans generates directional movement from a compact neuromuscular system is critical for understanding the neural basis of behavior. Traditional models have largely focused on reproducing movement patterns without quantitatively exploring the architecture of synaptic and gap junction weights. To address this limitation, researchers have developed a connectome-based simulation model consisting of 69 motor neurons of classes A, B, D, AS, and 95 muscle cells, which was created to generate the biologically logical oscillatory activity patterns that underlie both forward and backward locomotion [27]. The model is trained using a supervised learning method called Backpropagation Through Time (BPTT) by feeding two types of teacher data: (i) a mathematically defined sinusoidal waveforms and (ii) experimentally recorded muscle fluorescence intensities from the HRB4 strain (Figure 1F). Motor neuron-muscle interactions, including synaptic excitation, inhibition, gap junction coupling, and proprioceptive feedback are encoded using differential equations and optimized through iterative minimization of muscle activity reconstruction error. During simulation, the trained network reproduces distinct anterior-to-posterior and posterior-to-anterior activation waves corresponding to forward and backward movement, respectively. Moreover, the trained synaptic and conductance weights conform to a modified Boltzmann distribution, suggesting that sparse yet structured connectivity may be sufficient for generating complex motor behaviors. However, the model does not include biomechanical feedback or head motor control, therefore leading to reduced accuracy in simulating neck muscle activation. Regardless of this limitation, the framework enables mechanistic interpretation of movement control and offers a scalable tool for exploring neuromuscular coordination via machine learning-based optimization of connectome data.
Understanding how locomotion deteriorates with age in C. elegans is critical for uncovering the biological principles underlying organismal aging. Conventional locomotion analyses usually depend on coarse metrics such as velocity, fail to capture the nuanced, spatio-temporal degradation of body coordination in aging worms. To address this, a biologically inspired data-driven model based on Graph Neural Networks (GNNs) is proposed to capture the spatio-temporal changes in the locomotion behaviors of aging C. elegans [28]. The model was developed using PyTorch and DGL (Deep Graph Library), a graph processing framework. In the proposed model, the worm body is abstracted as a chain of 23 interconnected segments, where the state of each segment is defined by its bending angle (Figure 2A). The bending angle time series are treated as temporal signals, and interactions within and between segments are encoded as high-dimensional, learnable connection variables. These variables are then optimized using gradient descent with backpropagation, therefore allowing the model to learn realistic inter-segment dependencies without relying on handcrafted physical parameters. Trained on bending angle datasets collected across eight aging stages (D1 to D15) and various mutant strains (e.g., unc-7/unc-9, egl-3). The model accurately reproduced segment-wise locomotion patterns and captured age-related trends. It showed that self-connections representing a segment’s tendency to maintain its state increase with age, while inter-segment coordination diminishes. Moreover, the model can identify subtle differences in locomotion patterns that traditional metrics like speed or curvature fail to capture. Although it demands high computational power, the model performs well in biological plausibility, interpretability, and spatio-temporal resolution, and thus making it a powerful tool for aging and behavioral research in C. elegans and potentially other segmented organisms. While modeling long-term locomotory changes provides insights into aging, other studies have leveraged machine learning for classifying discrete posture-driven behaviors such as nictation.
Nictation in C. elegans dauers and entomopathogenic nematodes like Steinernema carpocapsae represents a critical dispersal behavior, but automated scoring remains limited by the textured substrates required for nictation and the complex postures exhibited during this behavior. McClanahan et al., addressed this challenge by developing a deep learning-based tracking and behavioral scoring pipeline capable of detecting, segmenting, and analyzing nictation in nematodes on a microstructured agar substrate (microdirt arenas) [29]. The system outperforms traditional intensity-based techniques in terms of robustness and generalizability by reliably segmenting worms on heterogeneous, post-textured backgrounds using a fine-tuned Mask R-CNN model that was trained on manually annotated datasets (Figure 2B). To extract posture, the authors introduced a novel ridgeline and deformable model-based algorithm for accurate centerline computation, especially during self-overlapping behaviors such as omega turns. Seventeen posture and movement features were calculated from these segmentations, and a neural network classifier implemented in Scikit-learn was trained to distinguish nictating from recumbent behaviors with over 95% accuracy. Gaussian smoothing of model output probabilities improved scoring accuracy and behavioral metric estimation, such as nictation ratio (NR), initiation rate (IR), and stopping rate (SR). When validated against skilled human scorers, the model outperformed humans, particularly in the area of behavioral transitions. Additionally, the pipeline was successfully adapted for S. carpocapsae, thus allowing for the large-scale quantification of nictation responses to host cues such as Galleria mellonella larvae. By enabling scalable, reproducible investigations of nictation and other posture-defined behaviors in nematode species, this fully open-source Python-based tool marks a substantial advancement in automated behavioral phenotyping.
Biomonitoring systems that detect behavioral anomalies in aquatic organisms have emerged as vital tools for water pollution assessment. Kang et al. proposed a deep learning-based biomonitoring framework utilizing C. elegans swimming behavior as an early indicator of water contamination [30]. The system makes use of Long Short-Term Memory (LSTM) models that have been trained using Branch Length Similarity (BLS) entropy profiles, which describe the postural dynamics of nematodes across time. These entropy-based features, derived from high-resolution CCD video frames are clustered into seven shape patterns using Self-Organizing Maps (SOM) and k-means clustering, and encoded as symbolic sequences for time-series classification (Figure 2C). The system was tested under three water conditions: control, 0.1 mg/L formaldehyde, and 0.1 mg/L benzene, and evaluated across observation times ranging from 30 to 180 seconds. With observation windows ≥90 seconds, the LSTM model achieved >95% accuracy for pollution detection and >90% accuracy for pollutant type classification, greatly outperforming an earlier Hidden Markov Model (HMM) approach. The model also exhibited superior stability (low standard deviation) and robustness to short-term signal fluctuations. Furthermore, GRU and BiLSTM variants demonstrated comparable performance, with real-time applications benefiting from GRU’s reduced computational load. In contrast to the HMM model, which shown a tendency to categorize data as normal, the LSTM-based approach scaled well to ternary classification tasks and showed balanced precision and recall. In addition to confirming the use of C. elegans as a water quality bioindicator, this study demonstrates the utility of modern recurrent neural networks in ecological monitoring. It lays the groundwork for the real-world deployment of AI-powered environmental biosensing platforms, with potential extensions to GNN-based models and explainable AI for increased transparency and generalizability.

2.2. Machine Learning-Driven Detection and Analysis of Egg-Laying Behavior in C. elegans

Egg-laying in C. elegans is a tightly regulated reproductive behavior modulated by neuromodulators such as serotonin and neuropeptides. The egg-laying circuit involves a small set of motor neurons, vulval muscles, and command interneurons, providing a tractable model for understanding sensorimotor integration and neuromodulation. Egg-laying behavior is sensitive to environmental cues, aging, genetic perturbations, and pharmacological compounds. Quantifying egg-laying events enables researchers to study reproductive physiology, neuropeptide signaling, and the effects of stressors on organismal health.This section discusses how machine learning has been utilized to automate the detection and analysis of egg-laying events for high-throughput phenotyping.
Early attempts to automate egg-laying detection in C. elegans used deformable template matching approaches to identify egg-shaped features from video frames, offering one of the first image-based scoring tools for reproductive behavior [31]. More recently, high-throughput and posture-aware frameworks have dramatically improved precision and scalability. Ji et al., developed a robust imaging and analysis platform that enables automated longitudinal monitoring of locomotion, behavioral states, and egg-laying of 96 worms simultaneously within standard multi-well plates [32]. The system combines a dark-field imaging setup with a specially designed computer vision pipeline that comprises Mask R-CNN-based egg detection, frame-differencing for activity measurement, and frequency analysis using the Imaginera algorithm (Figure 2D). The pipeline was trained on more than 6,600 annotated images. The platform successfully captured subtle behavioral patterns, including activity fluctuations, locomotor frequency, and temporal egg-laying dynamics across serotonin-treated and control animals. It showed that a decrease in locomotor activity precedes egg-laying, a behavior that is disturbed in tph-1 and egl-1 mutants and partially recovered by exogenous serotonin. This suggests that serotonin signaling and HSN neurons play a role in preparatory motor suppression. Furthermore, behavioral analyses revealed that serotonin receptors SER-1 and SER-7 regulate egg-laying in distinct locomotor states, and mutants display state-specific resistance to serotonergic regulation. The system detected behavioral transitions with high sensitivity (RMSE for frequency prediction = 0.097 Hz, R² = 0.964), and egg counts showed strong agreement with manual scoring. Unlike traditional assays, the pipeline offers multi-parametric behavioral readouts (locomotor frequency, active state fraction, egg-laying rate, and timing), scalable to genetic and pharmacological screens. Although positional and occlusion-related limitations remain, the framework’s modular design, open-source availability, and compatibility with optogenetic and thermosensory paradigms make it a powerful tool for dissecting complex behavioral circuits in C. elegans.

2.3. Machine Learning-Based Decoding of Mating Dynamics and Neuromuscular Control

Mating behavior in C. elegans males involves complex, sequential motor programs including backing, turning, vulva location, and spicule insertion. This behavior is coordinated by a specialized sexually dimorphic nervous system, providing a model to study neuromuscular control and sensorimotor integration. Dissecting mating dynamics offers insights into how sensory feedback modulates motor outputs to ensure behavioral precision. Machine learning methods enable high-throughput, fine-grained analysis of these complex motor behaviors, linking posture dynamics with underlying neural activity. This section discusses how machine learning approaches have been applied to dissect the posture dynamics and neural regulation underlying mating behavior.
Dissecting the complex mating behavior of C. elegans males requires resolving simultaneous changes in posture and muscle activity across time and genetic backgrounds. Wan et al., developed a high-throughput, dual-imaging pipeline to record and analyze mating behavior using transgenic males expressing the calcium sensor GCaMP6 and mDsRed under a muscle-specific promoter [33]. The study introduced NAWA (Neural-network-based Automatic Worm Analyzer), a deep learning-driven software that accurately extracted posture and segment-specific muscle activity across >120 recordings of wild-type and serotonergic neuron-silenced (hypo-ser) males. Behavioral sequences were modeled using an autoregressive hidden Markov model (AR-HMM), allowing for the unsupervised segmentation of mating behavior into hierarchical modules (Figure 2E). This approach revealed nine major behavioral modules, including five distinct subtypes of the spicule prodding step, and defined bi-module repeats as the fundamental structural unit of mating behavior. Comparative analysis showed that hypo-ser males preferentially used one prodding module (module 10) associated with lower vulva contact stability, while wild-type males favored module 23. Modules were further characterized by variations in coordinated dorsal-ventral muscle activity patterns, in-block and among-block posture variance, and segment-specific curvature dynamics. The study also uncovered state-specific transitions between bi-module blocks, demonstrating a repeat-until-success strategy underlying male decision-making. NAWA achieved over 95% success in modeling frames with <2% error and proved robust across behavioral variability. Altogether, the study provides a scalable and interpretable framework for deep behavioral phenotyping by combining machine vision, calcium imaging, and hierarchical modeling. It has implications for comprehending circuit-level modulation, decision-making, and neuromuscular coordination in sexually dimorphic behaviors.

2.4. Machine Learning and Simulation-Based Modeling of Sensory-Guided Navigation

C. elegans navigates environmental gradients such as temperature (thermotaxis) and chemical attractants (chemotaxis) using well-defined sensory circuits. These behaviors rely on the integration of external stimuli by sensory neurons, which drive motor output via interneuronal processing. Modeling sensory-guided navigation provides a window into fundamental neural computations underlying decision-making and environmental adaptation. Machine learning and simulation-based approaches have become essential tools for decoding how simple nervous systems generate complex navigational strategies. This section discusses how machine learning models and simulations have been leveraged to track navigation behavior and decode the neural computation underlying sensory-guided movement.

2.4.1. Machine Learning for Multi-Animal Tracking Under Sensory Stimuli

Early multi-animal tracking systems such as Multi-Animal Tracker combined Kalman filtering with machine learning to enable high-throughput analysis of chemotaxis and motility in dense worm populations [34]. However, newer systems have improved robustness to occlusion and background variability.
Real-time detection and tracking of C. elegans worms are necessary for accurate behavioral analysis, especially in chemotaxis assays and locomotory studies where manual tracking is labor-intensive and error prone. Traditional machine learning-based trackers often fail under noisy backgrounds, uneven lighting, or worm occlusion. To address these limitations, Deep-Worm-Tracker, an end-to-end deep learning framework that integrates YOLOv5 for object detection and Strong SORT (Simple Online Real-Time Tracking) was developed for identity-preserving multi-worm tracking [35]. YOLOv5 provides rapid and accurate worm detection with a mean average precision (mAP@0.5) exceeding 98% within 15 epochs and under 9 minutes of training. Strong SORT extends this performance by re-identifying worms during occlusions using a re-identification (re-ID) dataset-the first of its kind for C. elegans that comprising 32 labeled worm identities. The model leverages both motion-based features (via Kalman filter) and appearance-based embeddings learned through shallow CNNs trained on cropped worm images (Figure 3A). Deep-Worm-Tracker also has segmentation and skeletonization modules that are applied selectively within predicted bounding boxes to reduce background noise and improve posture extraction. It supports diverse input formats (video, image, live camera feed) that are compatible with GPU and lightweight CPU environments (e.g., Raspberry Pi) and performs at real-time inference speeds of 9-15 ms per frame. However, the framework shows tracking failures under prolonged occlusions or when worms enter or exit the camera’s field of view. Nevertheless, it enables robust multi-worm trajectory analysis, making it a powerful tool for behavioral assays in C. elegans and adaptable to other model organisms. Beyond extracting locomotory trajectories, machine learning frameworks have also been employed to simulate the sensory computations underlying navigation behavior.

2.4.2. Neural Network-Based Learning of Sensory Representations

To understand how sensory representations emerge in the brain, it requires examining and dissecting the computational parallels between artificial and biological neural networks. Researchers have explored whether artificial neural networks (ANNs) trained on C. elegans thermotactic behavior could recapitulate known features of biological neural processing [36]. Using TensorFlow, they developed two types of ANN architectures: a supervised predictive model that forecasts temperature outcomes based on discrete behavioral modules (e.g., pirouettes, sharp turns), and a reinforcement learning model that optimizes thermotactic policy via feedback-driven training (Figure 3B). Both networks received 4-second histories of temperature, speed, and heading changes derived from C. elegans behavioral recordings during radial heat gradient navigation. The predictive ANN displayed response types that were similar to those of the AWC/AIY-like neurons linked to absolute temperature encoding and the AFD sensory neuron, which encodes fast temperature fluctuations. Virtual ablation experiments revealed that removal of AFD-like units significantly impaired gradient navigation, mirroring the essential role of AFD in worm thermotaxis (Figure 3B). Interestingly, while C. elegans-constrained ANNs shared some representational motifs with zebrafish models such as, ON/OFF units and derivative encoding, they showed a greater dependence on individual unit types, suggesting a more localized and less redundant coding strategy. Principal component analysis (PCA) confirmed these networks developed compact but distinct neural representations tailored to the worm’s simpler motor repertoire. Although the models abstracted anatomical connectivity and lacked neuron-specific biophysical constraints, their performance and internal dynamics suggest that ANNs constrained by C. elegans behavior can generate testable predictions about circuit function and sensory processing. Thus, bridging insights from deep learning and invertebrate neuroethology.
To understand how C. elegans learns complex motor and sensory behaviors through environmental interaction is essential for modeling adaptive control in biological systems and bio-inspired robotics. Demin and Vityaev developed a virtual neuromuscular control system embedded in a realistic 3D physics-based simulator of the C. elegans body [37]. The model consists of 12 interconnected neurons and 95 muscle cells with stretch-receptor-based feedback driving rhythmic locomotion (Figure 3C). A semantic probabilistic inference algorithm was applied to implement learning through environmental reward, with reward functions defined by forward movement speed and directional chemotactic gain. Remarkably, the control system learned stable undulatory locomotion in ~100 learning cycles and achieved biologically realistic chemotaxis trajectories, alternating runs and pirouettes within ~1000 cycles. The locomotion controller is based on a wave propagation model that mimics neural connectivity patterns hypothesized in C. elegans, and chemotaxis is implemented through an additional neuron that modulates head oscillations in response to concentration gradient dynamics. Learning is experience-driven, using only environmental feedback without predefined behavior rules. The model successfully reproduces movement trajectories visually similar to those of real worms (Figure 3C) and identifies optimal orientation strategies matching experimental observations. Although the neural circuitry is simplified compared to the real connectome, the learning-based model provides a generalized, extensible framework that can simulate plasticity and adaptive behavior. This approach shows how interactive learning may produce intricate motor and sensory coordination from simple circuits, therefore providing insights for neuroethology and the development of intelligent robotic systems that resemble worms.

2.4.3. Connectome-Based Digital Twins for Navigation Behavior

Early virtual models integrated simplified neural circuits with feedback-driven learning to achieve crawling and chemotaxis in simulated worms [37]. A simplified ANN-based model simulated thermotactic steering in C. elegans using a rigid-body kinematic framework and backpropagation-trained control logic, representing one of the earliest bio-inspired efforts to integrate neural computation with thermal gradient navigation [38]. More recent framework proposed by Chen et al., present a fully embodied, connectome-constrained digital twin of C. elegans that combines a biologically realistic virtual body with a connectome-based neural network (CENN) model [39]. Implemented in MuJoCo, the digital worm replicates real-world proprioception and body-environment interactions with 95 muscle actuators and 25 body segments. The CENN includes 469 nodes and over 6,000 synaptic and gap-junctional connections and is trained using BPTT on 60,000 chemotaxis behavior sequences generated by a PID controller (Figure 3D). The trained neural controller autonomously produces sinusoidal crawling and chemotaxis behavior, accurately navigating NaCl gradients using only proprioceptive and chemosensory feedback from ASEL and ASER neurons. The model matches known behavioral metrics (e.g., curving rate, bearing, chemotaxis index ≈ 0.65) and reproduces established roles of ON-OFF asymmetry in ASE signaling. Virtual ablation experiments revealed that a total of 119 neurons is critical for crawling, including B-, A-, D-type, and PDB motor neurons as well as AVA/AVB interneurons and predicted new roles for DD04/DD05 neurons while confirming the irrelevance of DD02/DD03. Furthermore, 40 neurons including sensory (ASE, AFD, AWB, IL1/IL2), interneurons (AIM, AIN, RIH), and motor neurons (VA06, VD02) were found to be crucial for chemotaxis navigation. Regardless of the drawbacks of simplifications like idealized proprioception and non-spiking neuron models, this digital twin offers a potent in-silico platform for methodical investigation of sensorimotor computation and neuronal function in C. elegans, thereby bridging digital physiology, artificial intelligence, and computational neuroscience.

2.5. Machine Learning and Circuit Modeling Approaches for Mechanosensory Escape Behavior

Mechanosensory escape behavior in C. elegans is a rapid and robust response to mechanical stimulation, mediated by a compact and well-characterized neural circuit. Studying escape responses allows researchers to explore how sensory information is rapidly transformed into motor output, providing insights into neural computation and circuit dynamics. Due to their stereotyped and quantifiable nature, escape behaviors serve as an excellent model for applying machine learning approaches to decode stimulus-response transformations and predict behavioral outcomes. This section discusses how machine learning and circuit modeling techniques have been applied to predict and understand mechanosensory escape behaviors.

2.5.1. Linear and Nonlinear Modelling of Stimulus-Response Dynamics

In order to comprehend how C. elegans behavior is driven by mechanosensory neurons, a quantitative framework that captures the temporal and spatial dynamics of neural processing is required. Linear stimulus-response mapping approaches have provided early insights into how mechanosensory input translates into behavior in C. elegans. Using reverse-correlation analysis, Porto et al., derived linear filters capturing how specific neurons like TRNs and PVD modulate motor outputs upon white-noise optogenetic stimulation [40]. These filters revealed distinct spatial and temporal encoding features, such as anterior TRNs promoting reversals and posterior TRNs enhancing forward motion. While powerful for characterizing immediate sensory-motor transformations, linear models are limited in capturing nonlinearities and adaptive dynamics, setting the stage for later nonlinear inference frameworks such as ODE-based models and connectome-informed RNNs.
Understanding the dynamic logic of C. elegans escape behavior requires models that are both predictive and interpretable across time and stimulus scales. Daniels et al., applied the Sir Isaac platform, an automated dynamical inference algorithm to infer a phenomenological model of worm escape response from high-resolution time series data without prior assumptions about circuit structure [41]. The observed speed (v) and a latent internal variable (x₂), which represents the recent history of temperature input, were used by Sir Isaac to infer a compact system of nonlinear ordinary differential equations (ODEs). The inferred model outperformed manually curated ones in explaining worm behavior, reducing unexplained variance from 20% to ~10% post-stimulus, and accurately predicted future behavioral transitions, such as the timing of reinitiation of forward motion. Mechanistically, x₂ was interpreted as a low-pass filtered integration of the heat signal, likely corresponding to thermosensory neuron activity (e.g., AFD, FLP), and governed a sigmoidal inhibitory modulation of forward velocity. The model mapped well onto known sensorimotor pathways, identifying forward and backward drive analogs to AVB/PVC and AVA/AVD/AVE interneurons and revealed that escape was not state-switching but rather a single-attractor dynamic modulated by stimulus intensity and history. Importantly, the approach discovered the functional roles of stimulus integration and adaptation in regulating escape speed and recovery, revealing similarities to known motifs in bacterial and amoeboid chemotaxis. This study demonstrates that automated inferences from behavioral data can recover biologically meaningful and testable models. Thereby providing a powerful framework for linking dynamics to function in sensorimotor systems. While dynamical system inference captures global behavioral trajectories, connectome-constrained recurrent neural networks enable detailed prediction of synaptic interactions underlying escape responses.

2.5.2. Connectome-Based Recurrent Neural Network Modelling of Escape Behavior

Understanding how C. elegans neural circuits transform sensory inputs into escape behaviors is limited by incomplete knowledge of synaptic polarities. To address this, Lanza et al., developed a recurrent neural network (RNN) model constrained by the C. elegans connectome and optimized to infer the excitatory or inhibitory character of chemical synapses based on observed escape responses to aversive stimuli [42]. The model employs a discrete-time McCulloch-Pitts framework combining both chemical and electrical synapses and operates under parallel-update dynamics. Synaptic strength values were derived from synapse sizes reported in EM reconstructions, while synaptic polarity (sign) was treated as a free parameter optimized through a Monte Carlo method guided by a custom behavioral fitness function. The authors curated a stimulus-response dataset from literature comprising 12 escape behaviors triggered by sensory neurons (e.g., ASH, FLP, PVD), with forward/backward movement inferred from activation patterns of command interneurons (e.g., AVA, AVB, AVD, PVC). To reduce the discrepancy between RNN output and recognized behavioral responses, the model iteratively modified synaptic signs. This resulted in an inferred polarity matrix that correctly replicated over 90% of verified excitatory/inhibitory connections and assigned signs to 80% of the synapses in the sub-circuit. Additionally, model predictions were validated using randomized RNNs with known synaptic signs, reaching up to 65% accuracy in global polarity inference and >90% for behaviorally central pathways. Importantly, the algorithm does not use the Dale-Feldberg rule, which, in accordance with biological reality, permits single neurons to display multiple polarity across postsynaptic targets. This work provides a computationally efficient, interpretable framework to annotate the connectome with functional synaptic signs and decode the logic of fast, robust escape behaviors in C. elegans.

2.6. Machine Learning Models for Social Behavior and Internal State Control

C. elegans exhibits social behaviors such as aggregation and swarming under specific environmental conditions, reflecting group coordination and adaptive strategies. In parallel, internal behavioral states such as roaming and dwelling regulate foraging strategies and are modulated by neuromodulatory pathways. Modeling these behaviors provides insights into how simple nervous systems integrate internal and external cues to drive adaptive behaviors. Machine learning approaches have enabled the dissection of both social dynamics and internal state transitions at unprecedented resolution. This section discusses how machine learning has been used to model collective social behaviors and internal state transitions in response to environmental and physiological cues.

2.6.1. Agent-Based Modelling of Aggregation and Swarming Behavior

Understanding how individual behavioral rules give rise to group-level phenomena is critical for elucidating collective behavior across scales. Ding et al., investigated the aggregation and swarming behavior of C. elegans using high-resolution multi-worm fluorescence imaging and agent-based modeling [43]. In contrast to the static aggregation observed on shorter durations, they find that the hyper-social strain npr-1(ad609) displays a dynamic swarming phenotype, which is characterized by sustained collective movement over bacterial lawns triggered by local food depletion. The researchers developed a phenomenological agent-based model that included three essential behavioral rules: medium-range taxis toward neighboring worms, neighbor-density-dependent speed switching, and cluster-edge-triggered reversals to analyze the mechanics behind these behaviors (Figure 4A). In order to determine the optimal behavioral parameters, the model was calibrated using approximate Bayesian inference and validated against experimental tracking data from both npr-1 and N2 strains using summary statistics, including pair correlation, hierarchical clustering, standard deviation, and kurtosis of worm positions. Simulation results showed that all three behavioral components are necessary to reproduce experimentally observed aggregation and swarming dynamics, with food depletion added to simulate long-term swarming. Eliminating any single mechanism, especially taxis, significantly reduced model performance, emphasizing how probabilistic decision-making and short-range sensing work together to produce collective behaviors. The model further predicts that shallow gradients of diffusible signals (e.g., oxygen or CO₂) could mediate taxis, though the exact sensory mechanism remains unresolved. This study bridges micro- and macro-scale theories of collective behavior by establishing a mesoscale framework in which simple behavioral motifs give rise to emergent population dynamics in C. elegans, with implications for social foraging, evolutionary adaptation, and collective computation in small nervous systems.

2.6.2. Modeling Internal State Transitions Through Neuromodulation Circuits

Persistent behavioral states such as exploration and exploitation are crucial for foraging in C. elegans, but the mechanisms by which the nervous system flexibly controls these states remain poorly understood. Ji et al., uncovered the functional architecture of a neural circuit that governs the mutually exclusive roaming and dwelling states by combining circuit-wide calcium imaging, genetic perturbation, optogenetics, and machine learning-based modeling [44]. Using a closed-loop tracking microscope, they monitored activity in a ten-neuron ensemble and found that distinct, low-dimensional neural dynamics underlie each behavioral state: the serotonergic neuron NSM showed persistent activation during dwelling, while PDF-expressing neurons such as AVB were active during roaming. These dynamics were shaped by mutual inhibition between NSM and neurons expressing MOD-1, a serotonin-gated chloride channel and PDFR-1, forming a recurrent feedback circuit that ensured state persistence and exclusivity. Optogenetic stimulation of NSM or PDF pathways confirmed their opposing roles, while PCA and logistic regression showed that neural activity robustly predicted speed and behavioral state. A CNN trained on neural activity preceding state transitions identified a predictive motif involving AIA, RIB, and AVA, with AIA acting as a sensory processing hub that delivers dual outputs to both neuromodulatory arms (Figure 4B). Importantly, AIA’s effect was context-dependent: it promoted dwelling in stable food environments via serotonin and roaming in odor gradients via PDF. This dual output was validated through optogenetic experiments and behavioral assays using sensory mutants. Together, the study reveals basic concepts of sensorimotor control and behavioral switching in small nervous systems by describing a flexible, recurrent neuromodulatory circuit that combines internal and sensory signals to generate and switch between persistent behavioral states. Collectively, these studies demonstrate how machine learning has revolutionized behavioral decoding in C. elegans, thus enabling insights across levels of organization from individual neurons to population dynamics.

3. Challenges and Future Directions in Machine Learning for C. elegans Behavioral Analysis

Machine learning approaches have transformed the landscape of behavioral phenotyping in C. elegans, thereby enabling the extraction of detailed behavioral metrics from complex and high-dimensional datasets. While these tools have expanded the frontiers of behavioral research, however several practical and methodological challenges need to be addressed to make their widespread adoption, particularly in academic laboratories.
Table 1 represents the comparative summary of the machine learning models utilized for decoding the C. elegans behavior, input data types, pros, and cons discussed in this review. Different machine learning models offer distinct advantages and limitations depending on their design and application. For example, WormYOLO (a YOLO + RepLKNet hybrid) provides fast and accurate worm detection even in crowded arenas but struggles under extreme density conditions [18]. Snapshot-based classifiers like CeSnAP are ideal for high-throughput screening yet lack temporal dynamics [20]. CNN-based models such as WormPose excel at posture estimation without manual labeling but encounter head-tail ambiguity in low-quality frames [23]. Linear decoders applied to calcium imaging are interpretable and effective for locomotion prediction but fail to capture nonlinear neural dynamics [24]. Symbolic Markov models offer high interpretability in behavioral motif analysis, yet do not adapt well to feedback-driven or context-dependent behaviors [25]. More complex models like GNNs and LSTMs have demonstrated strength in capturing aging-related and time-dependent behaviors, respectively. However, they require large datasets, substantial computational power, and are sensitive to noise and sequence length [28,30]. Mask R-CNN has proven valuable in segmenting objects like nictating worms or eggs in complex backgrounds but demands high-quality annotated data for training [29,32]. Other models, such as AR-HMMs for mating behavior or connectome-constrained RNNs for simulating escape responses offer deep mechanistic insight at the cost of imaging quality, dataset specificity, or generalizability [33,42]. Simulated digital twins and ANN-based sensory navigation models help uncover circuit function but may abstract critical biological nuances [36,39]. Likewise, agent-based models can reproduce group-level phenomena like swarming but often rely on calibrated parameters that may not map directly to biological mechanisms [43].
Beyond model-specific limitations, several general challenges hinder the broader implementation of machine learning approaches in C. elegans research. Many academic laboratories lack access to high-performance computing infrastructure such as GPUs or cloud resources, which are essential for training and deploying deep learning models [26,28]. The demand for large, annotated datasets further poses a barrier, as most machine learning methods require hundreds to thousands of labeled images or trajectories for effective performance [28,29,30]. Moreover, reproducibility remains a concern, as pipelines are often customized and undocumented, making cross-lab comparison difficult [18,33,35]. Deep learning models also suffer from limited interpretability, acting as black boxes, which contrasts with the biological community’s preference for mechanistic understanding [23,30,36]. Integration of machine learning tools into existing experimental workflows such as real-time imaging systems or electrophysiology rigs often requires technical expertise that many labs may not possess [36,44]. Additionally, behavioral models trained under specific genetic backgrounds or environmental contexts often fail to generalize to other strains or conditions, thus further restricting their applicability [30,43].
To address these barriers, future efforts should focus on building unified, open-source machine learning platforms with modular components for segmentation, tracking, classification, and behavioral decoding. Embracing modern approaches such as self-supervised learning or few-shot learning can reduce the reliance on extensive labeled data [45,46]. Equally important is the integration of explainable AI (XAI) techniques to render predictions interpretable and biologically meaningful [47]. The development of digital twins embodied simulations of neural and muscular activity constrained by the C. elegans connectome holds promise for real-time, closed-loop experimentation. Sharing pretrained models, benchmark datasets, and standardized protocols across laboratories via community platforms (e.g., WormBase or OpenWorm) will improve reproducibility and accessibility [48,49]. Lightweight, hardware-efficient models that run on affordable devices like Raspberry Pi can make these tools more widely usable, even in educational or field settings [50]. Finally, integrating multimodal datasets including behavioral, neural, genetic, and environmental variables into unified machine learning frameworks will pave the way for holistic models that transcend single-modality prediction. In summary, while machine learning offers powerful tools for decoding C. elegans behavior, but realizing its full potential will require addressing technical, infrastructural, and conceptual challenges through interdisciplinary collaboration, open-source tool development, and continued innovation in model interpretability and scalability.

4. Concluding Remarks

The application of machine learning has significantly advanced the field of C. elegans behavioral analysis, thereby enabling high-resolution, high-throughput, and scalable insights into neural, genetic, and environmental determinants of behavior. From posture estimation and locomotion tracking to decoding complex behaviors such as mating, nictation, and sensory-guided navigation. Diverse machine learning models, including CNNs, RNNs, GNNs, and connectome-constrained simulations have expanded the analytical toolbox available to researchers. These tools offer unparalleled accuracy, reproducibility, and interpretability when tailored appropriately. However, challenges such as lack of standardization, high computational demands, and limited generalizability across strains and contexts still hinder broad adoption in academic settings. Looking forward, the integration of explainable AI, lightweight deployment platforms, community-shared resources, and biologically grounded simulations will be critical to generalize machine learning-driven behavioral phenotyping. By bridging machine intelligence with biological inquiry, the next generation of models promises not only to refine behavioral classification but also to reveal mechanistic underpinnings of behavior, aging, disease, and adaptation in C. elegans and beyond.

Author Contributions

K.R.B. wrote, edited and revised the manuscript.

Conflicts of Interest

The author declares no conflict of interest.

References

  1. Roozen, M. C. & Kas, M. J. H. Assessing genetic conservation of human sociability-linked genes in C. elegans. Behav Genet 55, 141-152 (2025). [CrossRef]
  2. Ray, A. K. et al. A bioinformatics approach to elucidate conserved genes and pathways in C. elegans as an animal model for cardiovascular research. Sci Rep 14, 7471 (2024). [CrossRef]
  3. Zhao, M. et al. An integrative data-driven model simulating C. elegans brain, body and environment interactions. Nat Comput Sci 4, 978-990 (2024). [CrossRef]
  4. Kwon, Y. et al. Advanced Neural Functional Imaging in C. elegans Using Lab-on-a-Chip Technology. Micromachines (Basel) 15 (2024). [CrossRef]
  5. Cowen, M. H. et al. Conserved autism-associated genes tune social feeding behavior in C. elegans. Nat Commun 15, 9301 (2024). [CrossRef]
  6. Wang, P. et al. Protocol for CRISPR-Cas9-mediated genome editing to study spermatogenesis in Caenorhabditis elegans. STAR Protoc 4, 102720 (2023). [CrossRef]
  7. Zhan, X. et al. Locomotion modulates olfactory learning through proprioception in C. elegans. Nat Commun 14, 4534 (2023). [CrossRef]
  8. Shanmugam, M. M. & Kapahi, P. Pharyngeal Pumping Assay for Quantifying Feeding Behavior in Caenorhabditis elegans. Bio Protoc 14, e5073 (2024). [CrossRef]
  9. Mignerot, L. et al. Natural variation in the Caenorhabditis elegans egg-laying circuit modulates an intergenerational fitness trade-off. Elife 12 (2024). [CrossRef]
  10. Queiros, L. et al. Overview of Chemotaxis Behavior Assays in Caenorhabditis elegans. Curr Protoc 1, e120 (2021). [CrossRef]
  11. Rahmani, A., McMillen, A., Allen, E., Minervini, C. & Chew, Y. L. Behavioral Tests for Associative Learning in Caenorhabditis elegans. Methods Mol Biol 2746, 21-46 (2024). [CrossRef]
  12. Deshe, N. et al. Inheritance of associative memories and acquired cellular changes in C. elegans. Nat Commun 14, 4232 (2023). [CrossRef]
  13. Lawler, D. E. et al. Sleep Analysis in Adult C. elegans Reveals State-Dependent Alteration of Neural and Behavioral Responses. J Neurosci 41, 1892-1907 (2021). [CrossRef]
  14. Jeayeng, S., Thongsroy, J. & Chuaijit, S. Caenorhabditis elegans as a Model to Study Aging and Photoaging. Biomolecules 14 (2024). [CrossRef]
  15. Fryer, E. et al. A high-throughput behavioral screening platform for measuring chemotaxis by C. elegans. PLoS Biol 22, e3002672 (2024). [CrossRef]
  16. Kerr, R. A., Roux, A. E., Goudeau, J. & Kenyon, C. The C. elegans Observatory: High-throughput exploration of behavioral aging. Front Aging 3, 932656 (2022). [CrossRef]
  17. Garcia-Garvi, A. & Sanchez-Salmeron, A. J. High-throughput behavioral screening in Caenorhabditis elegans using machine learning for drug repurposing. Sci Rep 15, 26140 (2025). [CrossRef]
  18. Dong, B. & Chen, W. A high precision method of segmenting complex postures in Caenorhabditis elegans and deep phenotyping to analyze lifespan. Sci Rep 15, 8870 (2025). [CrossRef]
  19. Baek, J. H., Cosman, P., Feng, Z., Silver, J. & Schafer, W. R. Using machine vision to analyze and classify Caenorhabditis elegans behavioral phenotypes quantitatively. J Neurosci Methods 118, 9-21 (2002). [CrossRef]
  20. Sohrabi, S., Mor, D. E., Kaletsky, R., Keyes, W. & Murphy, C. T. High-throughput behavioral screen in C. elegans reveals Parkinson’s disease drug candidates. Commun Biol 4, 203 (2021). [CrossRef]
  21. Javer, A., Ripoll-Sanchez, L. & Brown, A. E. X. Powerful and interpretable behavioural features for quantitative phenotyping of Caenorhabditis elegans. Philos Trans R Soc Lond B Biol Sci 373 (2018). [CrossRef]
  22. Bates, K., Le, K. N. & Lu, H. Deep learning for robust and flexible tracking in behavioral studies for C. elegans. PLoS Comput Biol 18, e1009942 (2022). [CrossRef]
  23. Hebert, L., Ahamed, T., Costa, A. C., O’Shaughnessy, L. & Stephens, G. J. WormPose: Image synthesis and convolutional networks for pose estimation in C. elegans. PLoS Comput Biol 17, e1008914 (2021). [CrossRef]
  24. Hallinen, K. M. et al. Decoding locomotion from population neural activity in moving C. elegans. Elife 10 (2021). [CrossRef]
  25. Costa, A. C., Ahamed, T., Jordan, D. & Stephens, G. J. A Markovian dynamics for Caenorhabditis elegans behavior across scales. Proc Natl Acad Sci U S A 121, e2318805121 (2024). [CrossRef]
  26. Thomas, A. et al. Topological Data Analysis of C. elegans Locomotion and Behavior. Front Artif Intell 4, 668395 (2021). [CrossRef]
  27. Sakamoto, K., Soh, Z., Suzuki, M., Iino, Y. & Tsuji, T. Forward and backward locomotion patterns in C. elegans generated by a connectome-based model simulation. Sci Rep 11, 13737 (2021). [CrossRef]
  28. Yuan, Y. et al. A GNN-based model for capturing spatio-temporal changes in locomotion behaviors of aging C. elegans. Comput Biol Med 155, 106694 (2023). [CrossRef]
  29. McClanahan, P. D., Golinelli, L., Le, T. A. & Temmerman, L. Automated scoring of nematode nictation on a textured background. PLoS One 18, e0289326 (2023). [CrossRef]
  30. Kang, S.-H., Jeong, I.-S. & Lim, H.-S. A deep learning-based biomonitoring system for detecting water pollution using Caenorhabditis elegans swimming behaviors. Ecological Informatics 80 (2024). [CrossRef]
  31. Geng, W., Cosman, P., Palm, M. & Schafer, W. R. Caenorhabditis elegans Egg-Laying Detection and Behavior Study Using Image Analysis. EURASIP Journal on Advances in Signal Processing 2005 (2005). [CrossRef]
  32. Ji, H., Chen, D. & Fang-Yen, C. Automated multimodal imaging of Caenorhabditis elegans behavior in multi-well plates. Genetics 228 (2024). [CrossRef]
  33. Wan, Y., Macias, L. H. & Garcia, L. R. Unraveling the hierarchical structure of posture and muscle activity changes during mating of Caenorhabditis elegans. PNAS Nexus 3, pgae032 (2024). [CrossRef]
  34. Itskovits, E., Levine, A., Cohen, E. & Zaslaver, A. A multi-animal tracker for studying complex behaviors. BMC Biol 15, 29 (2017). [CrossRef]
  35. Banerjee, S. C., Khan, K. A. & Sharma, R. Deep-worm-tracker: Deep learning methods for accurate detection and tracking for behavioral studies in C. elegans. Applied Animal Behaviour Science 266 (2023). [CrossRef]
  36. Haesemeyer, M., Schier, A. F. & Engert, F. Convergent Temperature Representations in Artificial and Biological Neural Networks. Neuron 103, 1123-1134 e1126 (2019). [CrossRef]
  37. Demin, A. V. & Vityaev, E. E. Learning in a virtual model of the C. elegans nematode for locomotion and chemotaxis. Biologically Inspired Cognitive Architectures 7, 9-14 (2014). [CrossRef]
  38. Li, M., Deng, X., Wang, J., Chen, Q. & Tang, Y. Modeling the thermotaxis behavior ofC.elegansbased on the artificial neural network. Bioengineered 7, 253-260 (2016). [CrossRef]
  39. Chen, Z., Yu, Y. & Xue, X. A Connectome-Based Digital Twin Caenorhabditis elegans Capable of Intelligent Sensorimotor Behavior. Mathematics 11 (2023). [CrossRef]
  40. Porto, D. A., Giblin, J., Zhao, Y. & Lu, H. Reverse-Correlation Analysis of the Mechanosensation Circuit and Behavior in C. elegans Reveals Temporal and Spatial Encoding. Sci Rep 9, 5182 (2019). [CrossRef]
  41. Daniels, B. C., Ryu, W. S. & Nemenman, I. Automated, predictive, and interpretable inference of Caenorhabditis elegans escape dynamics. Proc Natl Acad Sci U S A 116, 7226-7231 (2019). [CrossRef]
  42. Lanza, E., Di Angelantonio, S., Gosti, G., Ruocco, G. & Folli, V. A recurrent neural network model of C. elegans responses to aversive stimuli. Neurocomputing 430, 1-13 (2021). [CrossRef]
  43. Ding, S. S., Schumacher, L. J., Javer, A. E., Endres, R. G. & Brown, A. E. Shared behavioral mechanisms underlie C. elegans aggregation and swarming. Elife 8 (2019). [CrossRef]
  44. Ji, N. et al. A neural circuit for flexible control of persistent behavioral states. Elife 10 (2021). [CrossRef]
  45. Ji, Z., Chai, X., Yu, Y., Pang, Y. & Zhang, Z. Improved prototypical networks for few-Shot learning. Pattern Recognition Letters 140, 81-87 (2020). [CrossRef]
  46. Noroozi, M. & Favaro, P. in Computer Vision – ECCV 2016 Lecture Notes in Computer Science Ch. Chapter 5, 69-84 (2016).
  47. Toussaint, P. A. et al. Explainable artificial intelligence for omics data: a systematic mapping study. Briefings in Bioinformatics 25 (2024). [CrossRef]
  48. Sternberg, P. W. et al. WormBase 2024: status and transitioning to Alliance infrastructure. Genetics 227 (2024). [CrossRef]
  49. Sarma, G. P. et al. OpenWorm: overview and recent advances in integrative biological simulation of.
  50. Caenorhabditis elegans. Philosophical Transactions of the Royal Society B: Biological Sciences 373 (2018). [CrossRef]
  51. Mehta, S. OVision A raspberry Pi powered portable low cost medical device framework for cancer diagnosis. Sci Rep 15, 7124 (2025). [CrossRef]
Figure 1. Figure 1. Overview of machine learning pipelines used in segmentation, tracking, and behavioral prediction in C. elegans. (A) WormYOLO-based object detection and segmentation pipeline, followed by feature point extraction and motion quantification. (B) Faster R-CNN for worm and egg detection on microfluidic and agar platforms, enabling locomotion and fecundity analysis. ROI, region of interest. (C) CNN-based WormPose posture estimation workflow using synthetic training images. (D) Calcium imaging and linear decoding of locomotor behavior from whole-brain neuronal activity. ICA, independent component analysis. (E) Markov modeling with time-delay embedding to construct microstates and simulate trajectories. (F) Connectome-based motor control model using BPTT for simulating forward and reverse movements.
Figure 1. Figure 1. Overview of machine learning pipelines used in segmentation, tracking, and behavioral prediction in C. elegans. (A) WormYOLO-based object detection and segmentation pipeline, followed by feature point extraction and motion quantification. (B) Faster R-CNN for worm and egg detection on microfluidic and agar platforms, enabling locomotion and fecundity analysis. ROI, region of interest. (C) CNN-based WormPose posture estimation workflow using synthetic training images. (D) Calcium imaging and linear decoding of locomotor behavior from whole-brain neuronal activity. ICA, independent component analysis. (E) Markov modeling with time-delay embedding to construct microstates and simulate trajectories. (F) Connectome-based motor control model using BPTT for simulating forward and reverse movements.
Preprints 171071 g001
Figure 2. Figure 2. Machine learning applications in classifying complex behaviors and life stages in C. elegans. (A) A GNN model predicts age-related changes in worm bending dynamics from segmented posture data. (B) Mask R-CNN and neural network classifier detect and score nictation behaviors on microdirt arenas. (C) LSTM model trained on postural entropy profiles classifies water contamination with high accuracy. (D) Mask R-CNN applied to multi-well plates enables egg detection and scoring of egg-laying behavior over time. (E) AR-HMM uncovers hierarchical posture-muscle dynamics during mating behavior in transgenic males. GFP, green fluorescent protein.
Figure 2. Figure 2. Machine learning applications in classifying complex behaviors and life stages in C. elegans. (A) A GNN model predicts age-related changes in worm bending dynamics from segmented posture data. (B) Mask R-CNN and neural network classifier detect and score nictation behaviors on microdirt arenas. (C) LSTM model trained on postural entropy profiles classifies water contamination with high accuracy. (D) Mask R-CNN applied to multi-well plates enables egg detection and scoring of egg-laying behavior over time. (E) AR-HMM uncovers hierarchical posture-muscle dynamics during mating behavior in transgenic males. GFP, green fluorescent protein.
Preprints 171071 g002
Figure 3. Figure 3. Real-time tracking and simulation-based modeling of sensory-guided navigation in C. elegans. (A) Deep-Worm-Tracker framework using YOLOv5 and Strong SORT for multi-worm tracking and segmentation. (B) Trained ANN to simulate C. elegans thermotactic behavior and validated via virtual ablation studies. (C) Simulation of locomotion and chemotaxis using a 3D-based C. elegans model integrating neuromuscular dynamics. DR, dorsal right; DL, dorsal left; VR, ventral right; VL, ventral left. (D) Digital twin model based on the full C. elegans connectome trained with BPTT for navigation and proprioception.
Figure 3. Figure 3. Real-time tracking and simulation-based modeling of sensory-guided navigation in C. elegans. (A) Deep-Worm-Tracker framework using YOLOv5 and Strong SORT for multi-worm tracking and segmentation. (B) Trained ANN to simulate C. elegans thermotactic behavior and validated via virtual ablation studies. (C) Simulation of locomotion and chemotaxis using a 3D-based C. elegans model integrating neuromuscular dynamics. DR, dorsal right; DL, dorsal left; VR, ventral right; VL, ventral left. (D) Digital twin model based on the full C. elegans connectome trained with BPTT for navigation and proprioception.
Preprints 171071 g003
Figure 4. Figure 4. Modeling collective behavior and internal state transitions in C. elegans. (A) Agent-based model simulates aggregation and swarming using three core behavioral rules and approximate Bayesian inference. (B) CNN predicts behavioral states from multi-neuron calcium data; circuit diagram reveals mutually inhibitory serotonergic (NSM) and PDFR-1 pathways that regulate persistent roaming and dwelling states.
Figure 4. Figure 4. Modeling collective behavior and internal state transitions in C. elegans. (A) Agent-based model simulates aggregation and swarming using three core behavioral rules and approximate Bayesian inference. (B) CNN predicts behavioral states from multi-neuron calcium data; circuit diagram reveals mutually inhibitory serotonergic (NSM) and PDFR-1 pathways that regulate persistent roaming and dwelling states.
Preprints 171071 g004
Table 1. Summary of machine learning models for behavioral analysis in C. elegans.
Table 1. Summary of machine learning models for behavioral analysis in C. elegans.
Sl. No Phenotype Input data Machine learning model Pros Cons Reference
1 Locomotion segmentation Brightfield video frames WormYOLO (YOLO + RepLKNet) High accuracy for coiled/overlapping worms; fast inference Occasional failures in dense scenes [18]
2 Posture classification Static worm snapshots CART, CNN (CeSnAP) Simple and scalable for large-scale screens Lacks dynamic information [20]
3 Posture tracking Synthetic images, worm skeletons WormPose (CNN) Annotation-free; high fidelity in complex poses Head-tail ambiguity and issues in extreme morphologies [23]
4 Locomotion decoding GCaMP6 calcium imaging Linear decoder (Ridge regression) Robust prediction of curvature/velocity Neuron identity not preserved [24]
5 Foraging behavior Posture time series (eigenworms) Symbolic Markov model High realism, interpretable states Lacks neural network adaptability [25]
6 Age-related locomotion pattern Bending angle time series GNN Captures spatio-temporal dynamics Requires large computation resources [28]
7 Nictation behavior Microdirt arena images Mask R-CNN + neural net Outperforms human scorers Requires high-quality training annotations [29]
8 Swimming behavior Entropy-encoded postural sequences LSTM High accuracy, real-time capable Needs long observation windows [30]
9 Egg-laying behavior Dark-field multiwell images Mask R-CNN Multiparametric, longitudinal scoring Struggles with occlusion [32]
10 Mating behavior dynamics Muscle GCaMP images and posture video AR-HMM Hierarchical, interpretable modules Needs high-fidelity dual-channel imaging [33]
11 Chemotaxis simulation Thermal gradient videos ANN (supervised + reinforcement learning) Biological circuit-like representation Abstracted connectivity [36]
12 Neuromuscular control 3D physics-based worm model Probabilistic inference ANN Learns locomotion via reward-based learning Simplified neural topology [37]
13 Digital twin locomotion Connectome + MuJoCo sim CENN (BPTT) Full-body control with sensory feedback Uses idealized proprioception [39]
14 Mechanosensory modeling Optogenetic time series ODE inference (Sir Isaac) Compact, interpretable dynamics Requires dense time-series data [41]
15 Escape response modeling Stimulus-response pairs RNN with connectome constraints Predicts synaptic polarity and output Relies on curated literature dataset [42]
16 Aggregation/swarming Multi-worm tracking data Agent-based model Reproduces emergent group behavior Requires Bayesian calibration [43]
17 State switching (roaming/dwelling) 10-neuron calcium imaging CNN + logistic regression Reveals dual circuit motifs Context-sensitive modeling needed [44]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings

© 2025 MDPI (Basel, Switzerland) unless otherwise stated