WorksComputer Science
Distributed Swarm Morphogenesis with Neural Cellular Automata
Abstract
Swarm morphogenesis requires robots to assemble desired shapes through local interactions. We present a modular framework integrating neural cellular automata (NCA) with existing site assignment and collision-aware control. Within this framework, we introduce a decentralized attachment-site discovery mechanism. Robots already in the formation update and share local NCA states to identify new attachment sites, enabling progressive growth without a predefined list of sites during deployment. To bridge the mismatch between conventional NCA growth and gradual physical assembly, we additionally propose offline sparse-retention fine-tuning that simulates partial attachment, together with a false-positive loss that penalizes invalid site activations. Simulations demonstrate formation of diverse lattice morphologies, scaling to several hundred robots, and substantial improvements in morphology accuracy from the proposed fine-tuning. Experiments with Crazyflie quadrotors validate the integrated execution pipeline using robot-relative observations reconstructed from external tracking.
Introduction
Swarm morphogenesis aims to generate large-scale physical structures through local interactions among robots. Applications include coordinated aerial displays, distributed inspection, search, surveillance, and defence, where formations may need to scale or adapt across environments. Reliance on GPS, motion capture, or centralized estimation can limit applicability where signals or infrastructure are unavailable, including GNSS-denied environments; relative-sensing approaches instead use onboard vision [1], ranging and odometry [2], or distance-only measurements [3], [4]. In this paper, we consider local-relative sensing without globally referenced robot poses.
Distributed task-allocation methods assign tasks to robots [5], while assignment-based shape-formation methods allocate or dynamically select robot goals [6], [7]. Assignment-free methods guide robots to fill specified shapes without explicit robot-to-site assignments [8], [9]. These approaches differ in how robots occupy the shape, but both assume its geometry is supplied beforehand. We instead consider distributed attachment-site discovery. Essentially, we determine which physical attachment sites should exist as the morphology develops, so that a global structure can emerge from a local developmental rule trained offline, rather than an explicitly stored goal list. Existing assignment and control methods then coordinate robots to occupy these sites.
NCAs are suitable for distributed attachment-site discovery because local computations generate global structure without a central coordinator. Each cell updates its state from neighbors, enabling pattern growth and regeneration [10], with extensions to graphs and higher-resolution generation [11], [12], [13]. We use these states to discover physical attachment sites, establishing a first step toward neural swarm morphogenesis.
Our framework separates candidate-site discovery from assignment and control, allowing the latter two components to be replaced as independent modules. We use the artificial-light-field method for candidate-site assignment and the constrained controller for robot motion, both from [7].
We distinguish offline NCA training on virtual grids from deployment, where robots assemble the desired morphology incrementally and asynchronously through robot-local NCA updates. Standard Growing NCA [10] training omits physical assembly constraints, potentially impairing candidate-site predictions. We introduce offline sparse-retention fine-tuning to address this mismatch.
Our three main contributions are:
Modular lattice-morphogenesis framework. We introduce a new framework for progressive assembly of a desired morphology through local robot interactions.
Distributed attachment-site discovery method. Robots in the formation exchange and update local NCA states to identify candidate attachment sites for unattached robots. This allows the formation to develop progressively without providing robots with a complete list of attachment sites.
Offline fine-tuning adapts a pretrained NCA to physical assembly using simulated partial attachment. An additional false-positive loss penalizes activation outside the desired morphology.
Background and Related Work
We review prior work through four methodological building blocks: morphology representation, development, assembly, and localization and control.
Morphology representation concerns how the desired shape is encoded. Prior approaches use continuous regions [14] or density fields [15], as well as discrete lattices [16] or graphs [17]. These representations specify spatial relationships. We adopt square lattices for their well-defined attachment sites during progressive assembly.
Morphology development concerns the rules by which a desired structure takes shape. Progressive self-assembly methods prescribe local rules for adding robots [17], [18], [19]; their growth is decentralized, but the rules are rigid. Gene-regulatory models [20] and reaction–diffusion dynamics [21] have also been used for morphogenesis in robot swarms. In a separate line of research, learned neural cellular automata (NCAs) have generated patterns in virtual environments [10], including graph-based extensions [11], [12]. Their applications to robotics include regeneration of simulated soft robots [22] and shape classification in physical modular robots [23]. We investigate the use of learned NCAs for discovering attachment sites during shape formation by independently mobile robots. To the best of our knowledge, previous NCA-based systems have not combined learned candidate-site discovery with progressive physical assembly by independently mobile robots.
Graph Neural Networks (GNNs) enable learned decentralized interactions through neighborhood message passing [24]. Our NCA follows a similar principle but operates on a regular lattice rather than a general graph. Its shared symbolic frame preserves neighbor directions, allowing spatially ordered updates without requiring permutation-invariant aggregation or explicit edge features. We therefore formulate progressive attachment-site generation using the simpler NCA setting, without requiring the general GNN framework.
Morphology assembly concerns how robots occupy a specified morphology. Distributed task allocation provides coordination mechanisms [5], with methods including local task swapping [6], dynamic robot-to-site assignment [7], and assignment-free movement [8], [9].
Localization and control concern how robots perceive and reach positions. Existing approaches use GPS or indoor positioning [25], relative observations based on vision, ranging, odometry, or distance measurements [1], [2], [3], [4], and learned decentralized motion control [24]. Our implementation uses local relative observations and reuses the constrained controller from [7].
Methodology
Our method has two phases: offline training and deployment. During offline training, an NCA learns to reconstruct each desired morphology and is then fine-tuned to account for gradual robot assembly. During deployment, its weights remain fixed while robots exchange and update local states to discover candidate attachment sites. We first define the physical and symbolic setting, then explain local frame estimation, attachment-site discovery, assignment and control, and finally the offline training procedure.
Problem Setting
We consider homogeneous holonomic robots progressively assembling a desired formation using only local sensing and communication. One robot is designated the initial seed and remains stationary throughout assembly. An Advertiser is a robot already attached to the formation that updates local NCA states and advertises candidate attachment sites; a Joiner is an unattached robot that discovers and approaches these sites. After attaching, a Joiner becomes an Advertiser.
Possible attachment positions lie on a symbolic square lattice, with the seed at coordinate and adjacent sites separated physically by . The desired morphology is a finite, cardinally connected set of lattice cells containing the seed, with at most one robot per cell and . In the reference morphology, cells belonging to are foreground and all other cells are background. During assembly, an unoccupied cell may be predicted as foreground and be advertised for attachment, with Joiners moving towards these cells. The lattice specifies relative geometry; the complete desired morphology is available during offline training but is not provided to the robots during deployment.
Each robot measures its speed and the relative positions of sensed neighbors. Robots broadcast information such as their occupied lattice coordinates, local NCA states, and advertised candidate sites. Each Advertiser’s NCA update depends on its local states and received neighbor information, not a shared global formation state. An Advertiser proposes only unoccupied sites adjacent to its own cell; Joiners discover advertised sites locally and can attach where the motion controller can reach the cell.
Local Reference Frame Estimation
Advertisers specify candidate sites in symbolic lattice coordinates. Joiners locate these sites by estimating a rigid transform into their own body frames using nearby Advertisers. For robot , let be its sensed neighbors at time , and let contain those already attached as Advertisers. For each such neighbor , the Joiner observes body-frame position and receives its symbolic cell . Multiplying that cell by the prescribed spacing gives the corresponding lattice position .
Robot estimates a rotation and translation aligning scaled lattice coordinates with observed neighbour positions. This yields the rigid least-squares problem
For any symbolic cell , its estimated position in the body frame of robot is the vector , defined by
With only the seed as a reference, Eq. (1) cannot determine the lattice orientation. The first Joiner attaches at a seed-advertised neighboring cell using its local frame; the physical direction from the seed to this second robot establishes the corresponding lattice axis and thereby fixes the orientation of the desired morphology. No global orientation is prescribed for the desired morphology. Once two attached robots with distinct known lattice coordinates are observable, subsequent Joiners can estimate the planar rigid transform; additional observations provide a least-squares fit, assuming that the observing robot can sense sufficient attached neighbors.
Candidate-Site Discovery
We use a Growing Neural Cellular Automaton (NCA) as the learned developmental model [10]. A cell state is a vector associated with one symbolic cell , comprising red, green, blue, and alpha (RGBA) values plus internal channels. A state patch is a collection of such vectors. RGB describes appearance, and alpha indicates the NCA’s predicted foreground membership. All Advertisers apply the same learned update rule , but each maintains its own local states. The rule computes each cell’s update from its neighborhood; its training is described in § 2-E.
Each Advertiser keeps a persistent patch centered on its occupied cell at control step . This patch provides local context needed for updating the occupied center and its adjacent candidate cells. Figure 1 illustrates the process.

Figure 1. Swarm Morphogenesis over time. At each step , Advertisers maintain local NCA state around their occupied symbolic cells, refresh a neighborhood patch from observed attached neighbors, apply an NCA update, and advertise neighbouring unoccupied foreground cells as candidate attachment sites. Joiners can then occupy these advertised cells and become Advertisers, so the set of attached cells grows progressively toward the desired morphology.
At each control step, the Advertiser refreshes with nearby occupied-cell states received from other Advertisers broadcasting their symbolic coordinates and NCA states. It then performs an NCA update on the patch
It examines the four cardinally adjacent cells of . It advertises a cell only if the cell is locally known to be unoccupied and its updated alpha value , where is the foreground threshold. Each advertisement contains the candidate’s symbolic coordinate and updated NCA state.
A Joiner selects an advertised unoccupied cell and approaches it. When multiple Advertisers announce the same site, the Joiner averages their alpha values to evaluate the candidate. Upon attachment, it initializes the NCA state of
its newly occupied cell from one of the advertised complete cell-state vectors. It then maintains its own local patch as an Advertiser and can advertise further candidate sites.
Site Selection and Attachment
Once candidate attachment sites are advertised, Joiners use the distributed artificial-light-field (ALF) assignment of Li et al. [7] to select candidates. The ALF computes local artificial-light intensities from observed robot positions, allowing Joiners to favor advertised sites with lower intensity in less crowded regions.
The constrained controller of [7] computes Joiner velocity commands toward the selected candidate site, balancing site tracking, collision avoidance, and velocity smoothing under speed and safety constraints. The ALF assignment method and constrained controller are replaceable components of our framework.
NCA Training and Fine-Tuning
We train the local operator offline on the complete desired morphology. A standard Growing NCA first learns to reconstruct the reference image; sparse-retention fine-tuning then adapts it for gradual assembly and simulated attachment.
1) Growing NCA Training: The operator follows Growing NCA [10]: at each step, a convolution extracts features from each cell’s neighborhood, a shared network predicts a state change, and that change is added to the current state. A stochastic per-cell update mask emulates asynchronous updates during training. The same operator is used during deployment in Eq. (3). Starting from one living seed state, training unrolls update steps and optimizes the weights by backpropagation through time. Let be the reference RGBA image of the desired morphology and the NCA’s predicted RGBA channels after the rollout. Their final-state reconstruction loss is
Sparse-Retention Fine-Tuning: Ordinary NCA growth permits cells to activate temporarily or grow ahead of the structure. During physical assembly, however, only NCA states at occupied robot cells are used to predict adjacent attachment sites, where each Advertiser updates only a local patch around its occupied cell as robots gradually join. Applying this restriction to a standard NCA may therefore expose it to unfamiliar developmental dynamics, and may produce unsuitable predictions from such partial, irregular states. Sparse-retention fine-tuning exposes the model to this restricted regime so it can form the target progressively from the occupied frontier, improving deployment-time predictions.
Sparse-retention rollouts emulate gradual assembly: update virtual state, identify foreground cells adjacent to the occupied morphology, randomly retain some as newly attached, and prune unsupported state before continuing. Let be the state at step , and the occupied lattice sites representing Advertisers. With denoting cardinally adjacent cells, the unoccupied frontier and eligible candidates are
where is the foreground retention threshold. To model slow and intermittent arrivals, a subset of candidates is sampled from the retention distribution :
where contains the newly retained candidates. To enforce the limited spatial extent of NCA state during physical assembly, virtual NCA states are kept only on occupied cells and cells immediately adjacent to them; all other states are set to zero:
This permits nearby predictions while pruning distant activity, exposing the NCA to partial, irregular assemblies. Sparse-retention rollouts are also mixed with ordinary NCA rollouts to preserve original developmental dynamics.
a) False positive: Because adjacency alone cannot exclude invalid sites, we additionally penalize foreground activation outside the desired morphology. Let indicate membership in the desired morphology and be background cells. Alpha above threshold incurs
where is the average over . Combining this penalty across the rollout with final RGBA reconstruction gives
| Parameter | Value |
| State channels | 16 |
| Foreground threshold | 0.5 |
| Training Rollout horizon | [64, 96) steps |
| False-activation threshold | 0.2 |
| Loss weights | (2.0, 4.0) |
| Lattice spacing | 0.5 |
Table 1. Parameters for offline training and simulated deployment.
Thus fine-tuning encourages local physical growth while suppressing false-positive sites. The complete desired morphology and training losses are used only offline.
Results
For each desired morphology, we train a dedicated NCA offline. We then conduct two simulation studies: (i) formation progression and scaling, to evaluate the framework’s ability to assemble different morphologies and accommodate increasing swarm sizes; and (ii) a fine-tuning ablation, to assess the effects of sparse retention and false-positive loss on deployment accuracy. We also perform physical quadrotor experiments are presented in Section IV-B.
For offline training, a Growing NCA first learns to reconstruct a reference image and is subsequently fine-tuned using sparse retention. For an robot experiment, the reference image is scaled so that its foreground-cell count is closest to . For fine-tuning, the retention distribution selects no candidate sites with probability , all with probability , and otherwise retains candidates independently with probability .
For all simulations, NCA weights remain fixed and robot-local updates are asynchronous. Initial robot positions are sampled uniformly in the arena. Results are computed over 30 random seeds. Experimental parameters are reported in Table I.
We measure morphology accuracy by the F1 score (Dice overlap) between the expected and occupied cells. Let denote the foreground cells of the desired morphology and the cells occupied by robots at time :
F1 equals 1 when the occupied cells exactly match the desired morphology, and decreases when cells are missing or incorrectly occupied.
For an episode ending at time , saturation time is the earliest time from which the score remains close to the final value:
with such that the F1 score at is within 5% of its terminal value .
Simulation Results
a) Formation and Scaling: We evaluate four morphologies (Lizard, Tree, Pretzel, and Hand-heart) using 250 robots, and vary the robot count for Tree. Figure 2 contains representative formation rollouts and scaling results. Snapshot progression percentages are computed with respect to . Dark colored robots denote Advertisers, while light colored robots denote Joiners. Formations are rotated and scaled for visualization.

Figure 2. Formation progression and scalability. Left: representative assembly sequences for four desired morphologies using 250 robots at 0%, 30%, 60%, and 100% progression, with reference images and corresponding F1 accuracy trajectories over time. Right: saturation time and final F1 versus robot count for Tree morphology; shaded regions denote one standard deviation.
The rollouts show that the local developmental mechanisms can form branched, compact, and holed lattice morphologies without a deployment-time goal list. Morphologies that expand broadly in multiple directions, such as Tree, form faster, whereas those with narrow paths or constrained branches, such as Lizard and Hand-heart, require longer formation times. Nonetheless, these runs converge towards F1 values close to 1, confirming that the assembled formations increasingly match their desired morphologies. In the scaling study, grows approximately linearly with robot count, while the final F1 score only decreases slowly, indicating that morphologies remain stable across scale. The shaded regions show one standard deviation.
b) Ablation Study: To evaluate the proposed developmental attachment-site generation mechanism independently of the assignment and control components, we use standard Growing NCA as the baseline and progressively introduce the proposed sparse-retention and false-positive suppression mechanisms. Table II reports the deployment F1 score at for these configurations on the Tree morphology with 250 robots.
| Training configuration | ↑ | Std. |
| Standard Growing NCA | 0.583 | 0.107 |
| + Sparse-retention fine-tuning | 0.764 | 0.141 |
| + False-positive loss | 0.988 | 0.004 |
Table II. Fine-tuning ablation.
Sparse-retention increases the final F1 score relative to standard Growing NCA, demonstrating the benefit of training on partial assembly states. Adding the false-positive loss further improves mean F1 and significantly reduces variation
across runs. The ablation thereby provides direct empirical justification for the proposed fine-tuning procedure, that significantly increases both performance and consistency.
Hardware Validation
For hardware validation, we use eight Crazyflie quadrotors to assemble two desired lattice morphologies, E and 4. Since the platform lacks the required relative-position sensing, Lighthouse tracking and centralized computation are used as an experimental interface to provide robot positions and reconstruct local-frame observations. These local observations are consumed by the proposed framework and return body-frame velocity commands. This setup preserves the algorithm’s local information structure despite the platform’s sensing limitations.
Figure 3 shows overhead snapshots and corresponding lattice-state visualizations during the formation of E and 4. The sequences illustrate progressive attachment-site discovery and robot recruitment, resulting in the desired formations. These experiments demonstrate the execution of the proposed pipeline on physical robots despite localization noise, actuation error, and asynchronous motion

Figure 3. Real-robot experiments with eight Crazyflie quadrotors. Top: overhead snapshots during formation of E and 4. Bottom: corresponding lattice-state visualizations, with gray and red circles denoting Joiners and Advertisers respectively, and colored cells indicating foreground morphology sites.
Conclusion
We presented a modular NCA-based framework for distributed swarm morphogenesis, integrating learned attachment-site discovery with existing assignment and collision-aware control. Robots progressively assemble desired formations without a predefined list of attachment sites during deployment. The ablation demonstrates that fine-tuning substantially improves morphology accuracy over standard Growing NCA, while the additional false-positive loss achieves high accuracy with consistent results. Simulations demonstrate diverse morphologies and scalability to large swarms, while Crazyflie experiments validate the integrated pipeline on physical robots.
References
- [1]E. Montijano, E. Cristofalo, D. Zhou, M. Schwager, and C. Sagüés, “Vision-based distributed formation control without an external positioning system,” IEEE Transactions on Robotics, vol. 32, no. 2, pp. 339–351, 2016.
- [2]K. Guo, X. Li, and L. Xie, “Ultra-wideband and odometry-based cooperative relative localization with application to multi-uav formation control,” IEEE Transactions on Cybernetics, vol. 50, no. 6, pp. 2590–2603, 2020.DOI
- [3]R. Suttner and Z. Sun, “Formation shape control based on distance measurements using Lie bracket approximations,” SIAM Journal on Control and Optimization, vol. 56, no. 6, pp. 4405–4433, 2018.arxiv.org/abs/1803.01606
- [4]J. Lü, K. Ze, S. Yue, K. Liu, W. Wang, and G. Sun, “Concurrent-learning based relative localization in shape formation of robot swarms,” IEEE Transactions on Automatic Science and Engineering, vol. 22, pp. 11 188–11 204, 2025.DOI
- [5]H.-L. Choi, L. Brunet, and J. P. How, “Consensus-based decentralized auctions for robust task allocation,” IEEE Transactions on Robotics, vol. 25, no. 4, pp. 912–926, 2009.
- [6]H. Wang and M. Rubenstein, “Shape formation in homogeneous swarms using local task swapping,” IEEE Transactions on Robotics, vol. 36, no. 3, pp. 597–612, 2020.DOI
- [7]X. Li, R. Zhou, Y. Zhang, and G. Sun, “Distributed shape formation of multirobot systems via dynamic assignment,” IEEE Transactions on Industrial Electronics, vol. 72, no. 3, pp. 3017–3027, Mar. 2025.DOI
- [8]G. Sun, R. Zhou, Z. Ma, Y. Li, R. Groß, Z. Chen, and S. Zhao, “Mean-shift exploration in shape assembly of robot swarms,” Nature Communications, vol. 14, p. 3476, 2023.DOI
- [9]Y. Zhang, R. Zhou, X. Li, and G. Sun, “Mean-shift shape formation of multi-robot systems without target assignment,” IEEE Robotics and Automation Letters, vol. 9, no. 2, pp. 1772–1779, 2024.DOI
- [10]A. Mordvintsev, E. Randazzo, E. Niklasson, and M. Levin, “Growing neural cellular automata,” Distill, vol. 5, no. 2, 2020.DOI
- [11]D. Grattarola, L. Livi, and C. Alippi, “Learning graph cellular automata,” in Advances in Neural Information Processing Systems, vol. 34, 2021, pp. 20 983–20 994.
- [12]G. Gala, D. Grattarola, and E. Quaeghebeur, “E(n)-equivariant graph neural cellular automata,” Transactions on Machine Learning Research, 2024.arxiv.org/abs/2301.10497
- [13]E. Pajouheshgar, Y. Xu, A. Abbasi, A. Mordvintsev, W. Jakob, and S. Süsstrunk, “Neural cellular automata: From cells to pixels,” in ACM SIGGRAPH 2026 Conference Papers. Association for Computing Machinery, 2026, pp. 1–11.
- [14]M. A. Hsieh, V. Kumar, and L. Chaimowicz, “Decentralized controllers for shape generation with robotic swarms,” Robotica, vol. 26, no. 5, pp. 691–701, 2008.DOI
- [15]Y. Xiang, J. Song, Z. Zheng, X. Lei, and Z. Peng, “Density-driven progressive shape formation for swarm robots in dynamic environments,” IEEE Robotics and Automation Letters, vol. 11, no. 2, pp. 1186–1193, 2026.DOI
- [16]Z. Nie, Q. Zhang, X. Wang, F. Wang, and T. Hu, “Triangular lattice formation in robot swarms with minimal local sensing,” IET Cyber-Systems and Robotics, vol. 5, no. 2, 2023.DOI
- [17]G. Li, D. St-Onge, C. Pinciroli, A. Gasparri, E. Garone, and G. Beltrame, “Decentralized progressive shape formation with robot swarms,” Autonomous Robots, vol. 43, no. 6, pp. 1505–1521, 2019.DOI
- [18]M. Rubenstein, A. Cornejo, and R. Nagpal, “Programmable self-assembly in a thousand-robot swarm,” Science, vol. 345, no. 6198, pp. 795–799, 2014.DOI
- [19]Z. Pan, G. Wen, H. Yin, S. Yin, and Z. Tan, “Crystallization-inspired design and modeling of self-assembly lattice-formation swarm robotics,” Sensors, vol. 24, no. 10, p. 3081, 2024.DOI
- [20]Y. Meng, H. Guo, and Y. Jin, “A morphogenetic approach to flexible and robust shape formation for swarm robotic systems,” Robotics and Autonomous Systems, vol. 61, no. 1, pp. 25–38, 2013.DOI
- [21]I. Slavkov, D. Carrillo-Zapata, N. Carranza, X. Diego, F. Jansson, J. Kaandorp, S. Hauert, and J. Sharpe, “Morphogenesis in robot swarms,” Science Robotics, vol. 3, no. 25, p. eaau9178, 2018.DOI
- [22]K. Horibe, K. Walker, and S. Risi, “Regenerating soft robots through neural cellular automata,” in Genetic Programming, ser. Lecture Notes in Computer Science, vol. 12691. Springer, 2021, pp. 36–50.arxiv.org/abs/2102.02579
- [23]K. Walker, R. B. Palm, R. Moreno, A. Faiña, K. Støy, and S. Risi, “Physical neural cellular automata for 2D shape classification,” in 2022 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2022, pp. 12 667–12 673.arxiv.org/abs/2203.07548
- [24]C. Jiang, X. Huang, and Y. Guo, “End-to-end decentralized formation control using a graph neural network-based learning method,” Frontiers in Robotics and AI, vol. 10, p. 1285412, 2023.DOI
- [25]H. Yang, X. Bao, S. Zhang, and X. Wang, “A multi-robot formation platform based on an indoor global positioning system,” Applied Sciences, vol. 9, no. 6, p. 1165, 2019.DOI