A primal role for balance in the development of coordinated locomotion

Mature locomotion requires that animal nervous systems coordinate distinct groups of muscles. The pressures that guide the development of coordination are not well understood. We studied vertical locomotion in developing zebrafish to understand how and why coordination might emerge. We found that zebrafish used their pectoral fins and bodies synergistically to climb. As they developed, zebrafish came to coordinate their fins and bodies to climb with increasing postural stability. Fin-body synergies were absent in mutants with-out vestibular sensation, linking balance and coordination. Similarly, synergies were systematically altered following cerebellar lesions, identifying a neural substrate regulating fin-body coordination. Computational modeling illustrated how coordinated climbing could improve balance as zebrafish mature. Together these findings link the sense of balance to the maturation of coordinated locomotion. As they develop, zebrafish improve postural stability by optimizing fin-body coordination. We therefore propose that the need to balance drives the development of coordinated locomotion.


Introduction
To locomote, the nervous system coordinates multiple e fectors, such as the trunk and limbs or ns, that collectively generate propulsive forces and maintain body posture. For example, humans walk by using the legs to move the body forward, swinging the arms to reduce angular momentum, and using axial musculature to support the trunk [ ]. As animals mature they change the way they coordinate these e fectors, a process driven both by experience and by changing motor goals [ -]. However, which sensations and goals guide the development of coordination is poorly understood. During development, both physical body shape and neural coordination change simultaneously [ ]. Understanding the constraints that guide neural control of coordination therefore requires a model in which the maturation of locomotion can be dissociated from changes in physical form [ ].
Development of coordination is simpli ed under water, where individual e fectors function dissociably [ , ]. Whereas forces generated while walking ultimately act through the feet, sh bodies and ns serve as independent control surfaces that need not be used in concert. For example, sh can climb in the water column using pectoral ns or body/caudal n undulation, meaning a given climb can be executed with varying mechanics [ -]. These mechanics can be de ned with respect to common mechanics of ight ( Figure A). Bodies that move in the direction they point -like a rocket -must direct thrust upwards by pitching upwards in order to climb [ ]. Similarly, sh pitch upwards to direct thrust from the body/caudal n, particularly sh with dorsoventrally symmetric bodies that generate minimal lif [ , ]. In contrast, bodies that generate lif -like a helicopter with its rotor -can remain horizontal while climbing. Fishes can produce lif using their pectoral ns (see technical note in Methods) [ ]. How sh coordinate their bodies and ns has direct consequences for balance. When a sh generates lif with its pectoral ns, it moves upwards relative to its body posture, creating an attack angle ( Figure A). Division of labor among the body and ns therefore de nes how far posture must deviate from horizontal in order to climb. Given that many sh actively balance near horizontal, even during the rst days of swimming [ , ], n use may be preferable. Pectoral n and body movements occur synchronously in larvae [ ], but the ns appear dispensable for routine swimming in the roll and yaw axes at this stage [ ]. We hypothesized that sh regulate n-body coordination in the pitch (nose-up/nose-down) axis as they develop, learning to increasingly utilize their ns to better maintain balance as they climb.
To examine how and why sh regulate n-body coordination across development, we studied larval zebra sh (Danio rerio) as they spontaneously climbed in the water column. We compared groups of siblings, or clutches, throughout the larval stage ( -days post-fertilization, dpf) [ ]. Larvae locomote in discrete bouts approximately once per second, simplifying kinematic analysis [ , ]. We found that larvae climbed with steeper trajectories than would be predicted from posture alone -evidence they were actively generating lif . Af er n amputation, larvae no longer generated lif . We found that larvae at all ages exhibited synergy between n-driven lif and body rotations, strong evidence for active coordination. Consistently, we found that n-body coordination was abolished in vestibular mutants with an impaired sense of balance [ ] and perturbed by cerebellar lesions. Developing larvae regulated n-body coordination to rely increasingly on their ns during climbs. Consequentially, older larvae were observed to climb with balanced postures closer to horizontal. To understand why larvae at di ferent ages coordinated their ns and bodies in di ferent ways, we built a model to explore trade-o fs between balance and e fort, de ned with respect to the underlying commands to control the ns and body [ , ]. Simulations showed that more mature coordination, dominated by pectoral ns, improved balance but cost greater e fort. We conclude that developing zebra sh come to optimize n-body coordination to stabilize posture while climbing. We therefore propose that a drive to balance guides the development of coordinated locomotion.

Results
Larvae use pectoral ns to balance while climbing First we examined climbing kinematics late in the larval stage, from bouts captured from larvae across clutches at weeks post-fertilization (wpf). Larvae tended to pitch upwards in order to swim upwards, yielding a positive correlation of trajectory and pitch-axis posture that re ected thrust-based climbing ( Figure B; Spearman's ρ = . ). In addition, larvae of en swam with positive attack angles (de ned here as the di ference between trajectory and posture) that re ect the production of lif . They exhibited positive attack angles preferentially when climbing, in . % of bouts with upwards trajectories ( / ). By comparison, larvae exhibited positive attack angles in only . % of bouts when diving ( / ). Larvae therefore climb by pitching upwards and generating lif . We hypothesized that larvae generated lif using their pectoral ns, because they tend to abduct the ns while swimming [ , ] and did so when propelling upwards (Supplemental Movies & ). When we amputated the pectoral ns and recorded , bouts, we found that positive attack angles were largely abolished ( Figure B). Control larvae exhibited attack angles of . °on average, compared to -. °for nless siblings ( Figure C; n= groups of -nless larvae, pairwise t-test: t = . , p = . ). A nless larva simply propelled in the direction it pointed, exhibiting a trajectory that closely approximated its posture, albeit with a minor downward bias. Accordingly, nless larvae never made the near vertical climbs of control siblings ( Figure B). Small negative attack angles exhibited by nless larvae are consistent with a slight negative buoyancy [ ] and an observed tendency to sink between propulsive bouts (Supplemental Figure S ; Supplemental Movie ). We conclude larvae at wpf used their pectoral ns to generate lif . Importantly, larvae e fected thrust-and lif -based climbing independently. Pectoral n amputation did not in uence body rotations in the pitch axis (Figure B, Supplemental Figure S ) or swimming more generally (Supplemental Figure S ; consistent with [ ]). Speci cally, amputation had no significant e fect on bout maximum speed (paired t-test, p> . , t =-. ), displacement (t =-. ), rate (t = . ), or absolute pitch-axis rotation (t = . ). We conclude that larvae do not require their pectoral ns to pitch upwards and climb, presumably instead rotating using the body and caudal n [ , ]. We hypothesized that larval pectoral ns are well suited for generating lif without torque because they attach near the body center of mass [ ]. Pectoral ns would therefore act over a small moment arm to generate torques in the pitch axis, making those torques small. We measured the rostrocaudal positions of pectoral n attachment from larvae and compared those to morphometrically estimated positions of the center of mass [ ]. Indeed, the pectoral ns attached consistently near the center of mass, on average . ± . body lengths rostrally (Supplemental Figure S ). The position of the pectoral ns in larval zebra sh may therefore facilitate dissociation of lif -and thrust-based climbing, enabling larvae to specically use pectoral ns to produce lif without causing pitch-axis body rotation.
Following pectoral n amputation, larvae compensated for loss of lif by controlling their posture. Larvae rotated farther from horizontal in order to climb. In order to produce climbs steeper than °, nless larvae pitched signi cantly farther upwards than control siblings; they adopted postures of . °compared to . °(Figures D, E; pairwise t-test, t = . , p = . ). Consistently, nless larvae were unable to produce steep climbs at horizontal postures, unlike control siblings. We conclude that use of the pectoral ns for climbing facilitates balance, enabling larvae to maintain postures near horizontal.
Larvae coordinate ns and bodies to climb Larvae could facilitate climbing by combining independent lif -and thrust-based mechanisms ( Figure A). Pairing nmediated lif with upwards posture changes would yield synergistic climbing e fects. Conversely, lif from ns would interfere with diving produced by downwards posture changes. If larvae concertedly use both their ns and bodies to climb and dive, we would expect attack angles and postural control to be correlated. To understand how developing larvae coordinated their ns and bodies, we examined concurrent control of these e fectors during bouts. We measured swimming at , , and wpf across clutches ( , , and bouts, respectively). Additionally, we examined their newly-swimming siblings at days post-fertilization and found that n use was indistinguishable from that at wpf ( bouts, Supplemental Table ). First, we assessed how larvae used their bodies to direct thrust. Because larvae actively control their posture during swim bouts, we reasoned that they may acutely change posture in pitch to direct thrust up or down [ , ]. To assess whether larvae changed posture before generating thrust, we compared the timing of angular and linear accelerations during spontaneous swim bouts. We found that larvae at all ages produced large, pitch-axis angular acceleration preceding and during thrust generation, when they accelerated forwards (Figure B). Angular acceleration lasted approximately msec and peaked . msec before larvae ceased generating thrust and began linear deceleration. We de ned the steering-related posture change of a bout from to msec before linear deceleration, and observed that all larvae exhibited comparable posture changes (Supplemental Table ; Two-way ANOVA, main e fect of age: F , = . , p = . ; main e fect of clutch: F , = . , p = . ).
Larvae used their ns and bodies synergistically, particularly during steep climbs. Larvae at all ages exhibited positively correlated attack angles and posture changes ( Figure  C), with Spearman's correlation coe cients of . ± . at wpf (mean±S.D. across clutches), . ± . at wpf, and . ± . at wpf (Supplemental Table ). In particular, larvae paired large, upwards posture changes (> °) with positive attack angles; of bouts with such posture changes across all ages, ( %) had positive attack angles (binomial test: p= . E-, given . % of all bouts had positive attack angles). To con rm that young larvae also generated positive attack angles with pectoral ns, we examined the e fects of n amputation at wpf. Large attack angles (greater than °) were rare but observable in control larvae at wpf ( . %, / bouts). In contrast, large attack angles were nearly abolished in siblings following pectoral n amputation ( . %, / bouts; n= groups of -nless larvae, pairwise t-test: t = . , p = . ). We conclude larvae at all ages coordinated their ns and bodies in order to climb.
Developing larvae regulate n-body coordination At all ages larvae paired positive posture changes with positive attack angles, but younger larvae paired a given posture change with smaller attack angles ( Figure C). As a rst pass, we quanti ed the ratio of attack angles to posture changes during shallow climbs (with posture changes from °to °) using a robust slope estimate; with age, the ratio of attack angles to posture changes nearly tripled, from . : at wpf to . : at wpf and . : at wpf. We conclude that older larvae produced small climbs with greater contribution from the pectoral ns.
Conversely, larvae at all ages made the steepest climbs similarly, re ecting comparable physical capabilities. Larvae at all ages paired the largest posture changes ( °-°) with comparable attack angles ( °-°, on average). Attack angles reached an asymptote as a function of posture change ( Figure C), which we interpret as a physical constraint on attack angle; af er maximizing attack angle, larvae could only climb more steeply by rotating farther upwards.
Given that larvae at all ages swam at comparable speeds (Supplemental Table , Two-way ANOVA with main e fects of age and clutch, F , = . , p = . ), we conclude that the pectoral ns produce consistent maximal acceleration in the dorsal direction throughout the larval stage. Consistently, pectoral ns maintained similar proportional lengths to the body at wpf ( . ± . body lengths), wpf ( . ± . ), and wpf ( . ± . , n= ; Supplemental Figure S , Sup-plemental Table ; One-way ANOVA, F , = . , p = . E − ). These data suggest that developing larvae do not become physically more capable of climbing with the ns.
Instead, developing larvae changed how they distributed labor among the body and ns. Older larvae used the largest attack angles to climb on a greater proportion of bouts than younger larvae. Larvae at wpf paired -°posture changes with large . °attack angles; although larvae at and wpf were capable of generating large attack angles, they paired -°posture changes with attack angles of . °and . °, respectively. Furthermore, older larvae exhibited near-maximal n use (> °attack angle) on a far greater proportion of bouts ( . % at wpf, . % at wpf, and . % at wpf). Accordingly, larvae exhibited gradually increasing attack angles with age (Figure C, marginals; main e fect of age by Two-way ANOVA, F , = . , p = . ), with signi cantly smaller angles at wpf ( . °) than wpf ( . °, p= . ; Tukey's posthoc test). Together, these data suggest changes to nbody coordination, rather than physical ability, account for the nearly -fold increase in attack angles from to wpf. To model how attack angle varied as a function of posture change, we t data with sigmoids ( Figure C). We used logistic functions comprising parameters: one to capture sigmoid amplitude, another for sigmoid steepness, and two for location (see Methods). Three parameters (for sigmoid amplitude and location) did not signi cantly di fer across ages, further support for the hypothesis that n capacity is constrained across early development (Supplemental Table ). In contrast, the dimensionless steepness parameter signi cantly varied with age.
Sigmoid steepness captured n-body coordination throughout development, re ecting increasing engagement of the ns during climbs. We found that sigmoid maximal slope increased more than four-fold with age (from . at wpf to . at wpf and . at wpf) af er xing the remaining parameters at their means across ages ( Figure D). We conclude that larvae at all ages were capable of the same range of attack angles, but older larvae paired large attack angles with smaller posture changes.
Sigmoid slope was su cient to describe variations in climbing behavior across clutches of sh. We measured sigmoid slope for individual clutches at each age, combining data over two successive recording days for good sigmoid ts (Supplemental Figure S ). Sigmoid slope exhibited a signi cant positive correlation with mean attack angle (Figure E, Pearson's r= . , p= . E-) but not mean trajectory (r= . , p= . ) or the frequency of steep climbs (r= . , p= . ). Furthermore, sigmoid slope re ected clutch di ferences in development of n use; only clutches with increased sigmoid slope from to wpf displayed increased attack angle ( Figure E). These data suggest larvae swam with more lif while making the same climbs simply by biasing the composition of n-body coordination towards the ns.
Sigmoid slope was also correlated with a drive to maintain the preferred horizontal posture, suggesting larvae bias towards n use to better balance. Slope exhibited a signi cant negative correlation with absolute deviation from horizontal ( Figure  F, r=-. , p= . E-). During climbs steeper than °, larvae at wpf adopted postures pitched signi cantly more upwards ( . °; Two-way ANOVA, main e fect of age: F , = . , p = .
) or wpf ( . °; Tukey's test, p = . ). Sigmoid slope also re ected clutch di ferences in development of balance; the lone clutch exhibiting a large decrease in sigmoid slope from to wpf (from . to . ) also exhibited worse balance, with larger deviation from horizontal at wpf ( . °) than at wpf ( . °; Figure F). Regardless of age, larvae that preferentially used their ns to climb remained nearer horizontal. We conclude that a single parameter captures variability of n-body coordination across development and its consequences for balance.

Fin-body coordination requires vestibular sensation
To con rm that correlated n and body actions arose due to coordination rather than biomechanics, we tested whether n-body correlations were in uenced by sensory perturbation. We examined swimming in larvae with genetic loss of function of utricular otoliths, sensors of head/body orientation relative to gravity [ ]. Utricular otolith formation is delayed from to dpf by loss-of-function mutation of otogelin [ , ] (Figure A). otogelin is expressed exclusively in cells in the otic capsule [ ] where it is required for tethering of the otolith to the macula [ ].
We found that correlated n-and body-mediated climbing was abolished in otog-/-larvae. Mutants exhibited no correlation of attack angle and posture change across , bouts ( Figure B; Spearman's ρ = . , p = . ; n= larvae from clutches). In contrast, control siblings with functioning utricles exhibited a signi cant, positive correlation of attack angle and posture change across , bouts (ρ = . , p = . E − ). The correlation between attack angle and posture change was signi cantly lower in otog-/-larvae than controls from the same clutch, assessed by pairwise t-test (t = . , p= . ). Accordingly, maximal slope of the best-t sigmoid to attack angle and posture change was signi cantly lower for mutants than controls and indistinguishable from zero (Figure C; with % CI: . ± . vs. . ± . ). Furthermore, otog-/-larvae failed to pair large, upwards posture changes (> °) with positive attack angles; of bouts with such posture changes, only had positive attack angles (binomial test: p= . , given that . % of bouts had positive attack angles). By comparison, control siblings exhibited positive attack angles on of bouts with large, upwards posture changes (binomial test: p= . E-, given that . % of bouts had posi-tive attack angles). We conclude that correlated actions of the ns and body are generated by the nervous system using sensory information, and therefore constitute coordination. As expected from the restricted pattern of gene expression, de cits in otog-/-larvae appeared to be speci c to the sensory periphery. Mutants have no reported defects in the central nervous system [ ] and appeared morphologically unaffected. We observed typical morphology of the body and pectoral ns ( . ± . mm n length vs. . ± . mm for controls; n= ; t = . , p= . ; Supplemental Table ). Consistently, distributions of attack angles were comparable for otog-/-larvae ( . ± . °) and siblings ( . ± . °; Figure B, marginals), suggesting they are capable of generating lif with the ns but fail to do so when climbing with the body. Validating direct comparison of climbing kinematics between mutants and control siblings, we found that otog-/-larvae made steep climbs (> °) as frequently as control siblings with utricles ( ± % vs. ± % for controls; pairwise t-test, t = . , p = . ) and could generally balance, orienting approximately horizontally on average in the light ( . °). Gross swimming properties were also similar between otog-/-larvae and controls (Supplemental Table ).
Like nless larvae, vestibular mutants that failed to coordinate their ns and bodies deviated farther from horizontal. Posture changes by otog-/-larvae were directed signi cantly more upwards than those by control siblings ( Figure D; pairwise t-test, t = . , p = . ), which presumably compensates for less lif while climbing. Accordingly, otog-/-larvae exhibited signi cantly larger deviations from horizontal during climbs steeper than °( Figure E; . ± . °vs. . ± . °f or controls; t = . , p = . ). We conclude that loss of n-body coordination necessitates larger deviations from horizontal to climb.

The cerebellum facilitates n-body coordination
The cerebellum is canonically involved in motor coordination and vestibular learning [ , ] and cerebellar circuitry is largely conserved among vertebrates [ , ]. We hypothesized that the zebra sh cerebellum facilitates n-body coordination. To test this hypothesis we lesioned cerebellar Purkinje cells using the photosensitizer, KillerRed [ ]. Purkinje cells are a necessary conduit for cerebellar information ow, providing sole innervation of cerebellar output neurons and themselves directly innervating the vestibular nuclei [ , ]. We restricted KillerRed expression using the gal :UAS system with a selective driver in Purkinje cells Tg(aldoca:GAL FF) [ ]. Af er light exposure, we measured swim bout kinematics ( from larvae) and compared them to bouts from unexposed KillerRed+ siblings ( from larvae). Swim kinematics were largely una fected by Purkinje cell lesions (Supplemental Table ) but postures tended nose-up ( . ± . °vs. . ± . °for controls).
Fin-body coordination was perturbed in larvae with Purkinje cell lesions. These larvae exhibited more positive attack angles than controls ( Figure A; . °vs. . °; Kolmogorov-Smirnov test, p= . E-), with comparable values to wild-type larvae a week older. Speci cally, larvae with lesions exhibited positive attack angles during bouts with nose-down posture changes. Typically, larvae at all ages suppressed positive attack angles while rotating nose down. Given that positive attack angles re ect lif generation by the ns, and nose-down posture changes direct thrust downwards, such n and body actions are con icting.
To determine the probability that larvae performed con icting n-body actions, we identi ed bouts with nose down posture changes (<-°) and measured the proportion with attack angles more positive than baseline (-. °, from wild-type ts at wpf, Supplemental Table ). Control larvae performed conicting actions signi cantly less frequently than chance (Figure B; . ± . , with %CI), and larvae with lesions performed con icting actions signi cantly more frequently than chance ( . ± . ). Larvae with lesions were also signicantly more likely to perform synergistic n-body actions, pairing positive attack angles with nose-up posture changes ( Figure  C; . ± . vs. . ± . for controls). Importantly, larvae with lesions exhibited more positive attack angles when making larger magnitude posture changes, be they nose-up or -down ( Figure A). In order to quantify the relative magnitude of attack angles to both positive and negative posture changes, we modeled these data as the sum of two sigmoids, one of which was re ected about the vertical axis. Best-t sigmoids captured the tendency to engage the ns during large positive and negative posture changes. For larvae with Purkinje cell lesions, the largest magnitude slope of the nose-down sigmoid signi cantly di fered from (Figure D; -. ). Furthermore, that slope did not signi cantly di fer in magnitude from the slope of the best-t nose-up sigmoid (Figure E; . ). In contrast, the double sigmoid was overparameterized for tting control data, and the maximal slope of the nose-down sigmoid did not di fer from (Figure D; -. ; see Methods). Finally, the slope of the nose-up sigmoid was significantly larger for larvae with Purkinje cell lesions compared to controls ( Figure E; . vs. . ). We conclude that the cerebellum actively suppresses n-mediated lif generation during pitch-axis steering. Our data suggest a dual role for cerebellar regulation of n-body coordination: to bias division of labor towards the body, and to prevent the production of con icting n-body actions.
A generative model of n-body coordination Why do developing larvae change how they divide labor between the ns and body? In other words, what cost function are larvae optimizing when they regulate n-body coordination? To address this question, we built a simple computa-tional model that allowed us to parameterize the division of labor between the ns and body (Figure A, details in Methods). In this control-theoretic model, a larva swam towards a target (up or down) by comparing the target's direction to the direction it would swim without steering (its current posture). From this di ference the larva generated a steering command. The larva steered its swim bouts by using its ns to generate lif and its body to direct thrust.
Simulated larvae coordinated their ns and bodies by controlling both e fectors with a mutual command. To vary the ratio of n and body actions (attack angles and posture changes, respectively), the command was di ferentially scaled for the ns and body. Commands to the ns were weighted by a n bias parameter ( ≤ α ≤ ) and commands to the body by ( − α). E fector-speci c commands were therefore positively correlated (when α and α ) in a ratio equal to α/( −α). Given this formulation, we could infer empirical n biases (α) from the ratio of empirical attack angles and posture changes, given by sigmoid slope (α=slope/( +slope); eq. ). Empirical n bias increased signi cantly with age (from . at wpf to . at wpf) like sigmoid slope, but ranged from to (Figure B; Supplemental Table ).
Commands were transformed into kinematic variables according to physical transfer functions ( Figure A) that increased approximately linearly near the origin, such that weak commands were faithfully transformed to movement; for large positive and negative commands, transfer functions reached asymptotes to model physical limitations. The asymptotes imposed empirically-derived constraints on the range of posture changes (-. to + . °) and attack angles (-. to + . °) of each bout. Additionally, Gaussian noise was added to swim trajectory to model errors in motor control and e fects of external forces like convective water currents that move larvae (ε).
The model permitted simulation of larvae across development, because sigmoid slope (and therefore n bias) captured developmental changes to swimming. We simulated larvae from each age group ( , ) identically, save for age-speci ĉ α, as they climbed in series of bouts until reaching targets positioned half the tank away ( mm). We placed the targets in directions randomly drawn from observed climbing trajectories (see Methods). Simulated attack angles and posture changes were sigmoidally related, with steeper sigmoid slopes for older larvae ( Figure C). Simply by varying n bias, simulated larvae exhibited mean attack angles comparable to empirical values ( Figure D). Simulated attack angles at age-and clutch-speci cα yielded close approximations of attack angle (R = . ). A model with a single parameter that scales divergent commands can therefore produce n-body coordination and mimic climbing behavior across development.
Increasing n bias improves balance but costs e fort in silico Next we varied n bias to assess direct consequences of nbody coordination for balance and climbing e cacy. The model allowed us to simulate larvae that climbed solely by generating lif (α = ) or solely by changing their posture (α = ), the former yielding larvae that never deviated from horizontal ( Figure A). As n bias increased, larvae remained closer to horizontal while climbing. Af er bouts towards the steepest drawn target ( °), larvae swimming without using their ns (α = ) deviated °from horizontal, larvae with small n bias (like those at wpf,α = . ) deviated °, and larvae with large n bias (like those at wpf,α = . ) deviated only °. By parameterizing n bias, we found that simulated deviations from horizontal were comparable to empirical values ( Figure B). Larger n biases were associated with smaller deviations from horizontal, re ecting better balance. Although the model was not explicitly t to postural variables, simulated deviations from horizontal explained % of empirical variance for clutches and time-points across development (with n biases spanning from . to . ). Additionally, at n biases below . , simulated deviations were consistent near °. otog-/-larvae exhibited very small n bias (α = . ) and large deviations from horizontal similar to simulated values at low α ( . °). We conclude that simulations accurately captured the consequences of n bias for balance, with greater n bias allowing larvae to remain nearer horizontal. To quantify how n bias a fected swimming e cacy when climbing to targets, we measured e fort. Because the speci c form an e fort term should take is unknown, we de ned effort as the sum of squared motor commands for steering, after [ , ]. There, the de nition of e fort was chosen to ensure a quadratic increase with the control signal. Increasing n bias had opposite consequences for swimming e fort, as larger n biases made climbing more e fortful. Larvae climbed farther at low n biases, bene ting from the cumulative e fects of posture change ( Figure A). Simulated larvae at wpf gained two-thirds more elevation ( . mm) than larvae at wpf ( . mm) and nearly three times as much as larvae swimming solely with the ns (α = , . mm). E fort increased monotonically with n bias ( Figure C). Steering solely with the ns (α = ) required times more e fort, on average, than steering solely by rotating the body (α = ). By evaluating simulated e fort at empirical n biases, we estimated that older larvae swam with greater e fort; e forts at empirical n biases (relative to e fort at α = ) corresponded to . %, . %, and . % at , , and wpf, respectively (Figure C, triangles). Further, very small n bias observed in otog-/-larvae approximately corresponded with the least e fortful swimming ( . % of e fort at α = ). Results were qualitatively similar when computing e fort as the sum of squared kinematic variables (posture change and attack angle), rather than commands (data not shown). We conclude that larvae achieve the least e fortful climbing at low n biases, and swim with increasing e fort as they develop.
Given that balance and e fort placed opposing demands on n-body coordination, we composed cost functions from terms for both balance and e fort ( Figure D). Speci cally, we tested whether combinations of balance and e fort terms could prescribe speci c n biases for optimal swimming. Cost functions are inherently dimensionless, so we summed normalized curves for balance (deviation from horizontal as a function of α, Figure B) and e fort (sum of square motor commands as a function of α, Figure C). To vary the relative importance of balance and e fort terms, we weighted them by β (balance weight) and -β, respectively. We parameterized β and found the optimal n bias (α * (β)), the n bias at which cost was minimized ( Figure E). As β increased and cost functions grew more similar to deviation from horizontal, cost was minimized at larger n biases. When β = and the cost function was identical to e fort, the optimal n bias was that which minimized e fort (α * ( ) = . ). Conversely, maximal n bias was optimal for a range of cost functions that heavily weighted balance (β > . ). At each age larvae appeared to swim optimally, given di ferential weights for balance and e fort. Empirical n biases minimized distinct cost functions composed from di ferent balance weights ( Figure E). From the cost functions that were minimized by empirical n biases, we estimated the inferred balance weight (β) at each age. Fin bias of larvae at wpf minimized a cost function composed from a very low inferred balance weight (Figure F)β = . ). Inferred balance increased by wpf and signi cantly by wpf, to . and . , respectively. By providing a framework to contextualize our observations, the model o fers a way to understand the trade-o fs facing developing larvae. We conclude that larvae regulate n-body coordination to optimize balance and e fort, and that development of n-body coordination can be explained by an increase in the importance of balance relative to e fort.

Discussion
Here we used a new model to study coordinated movements and discovered a fundamental role for balance in the development of locomotion. First, we demonstrated that to climb, zebra sh larvae used upward-orienting body rotations and lifproducing pectoral n actions. Larvae actively coordinated two independent e fectors, the trunk and the pectoral ns, to locomote upward. As they developed, larvae came to match larger n actions with smaller body rotations. The increasing reliance on n-mediated climbing facilitated postural stability. Gravity-blind larvae did not coordinate the trunk and ns de-spite performing similar body and n actions, linking sensed posture to coordination. Cerebellar lesions produced systematic changes to n and body coordination, revealing a neural substrate for regulation of n-body coordination. Increasingly stable posture came at a cost as animals developed: the e fort necessary to climb using ns. A generative model of locomotor development allowed us to explore the trade-o fs between e fort and balance. These simulations quanti ed the increasing importance of balance as sh grow. Taken together, our data show how the drive to balance comes to shape the development of coordinated locomotion.
Previous work using larval zebra sh examined pectoral n kinematics during yaw and roll turns [ , ]. Few di ferences were observed in yaw and roll between wild-type sh and mutants lacking pectoral ns. Instead, observed pectoral n movements between bouts led the authors to propose the intriguing hypothesis that pectoral n movements played a role in respiration. Complementarily, we nd that larvae use their pectoral ns during climbing bouts to generate lif . Our data establish a novel locomotor function for pectoral ns in larval zebra sh, providing a more complete picture of their utility.
Climbing mechanics are well-established for adult shes [ , , ]. While we de ne a role for the pectoral ns in larval zebra sh climbing, the relevant kinematics remain unknown. Our work establishes several important constraints on the maturation of pectoral n function. First, n loss had no apparent impact on the ability of larvae to rotate their bodies in the pitch axis. Consistently, we observed that pectoral ns were located rostrocaudally near the estimated body center of mass, yielding a small moment arm in the pitch axis [ ]. Second, across development, larvae exhibited similar maximal attack angles, suggesting that, as would thrust [ ], lif forces scaled with body mass as larvae developed. Comparable function of the pectoral ns with age may re ect their musculoskeletal simplicity in larvae [ , ]. In contrast to larvae, mature sh use their pectoral ns both to steer and as proprioceptors [ , ]. Future work relating pectoral n kinematics to vertical wake structure in developing zebra sh stands to illuminate how morphological maturation permits increasingly sophisticated movements across development.
We found that larval zebra sh coordinated their pectoral ns and bodies, controlling them independently but using them synergistically to facilitate climbing. Importantly, larvae missing their utricular otoliths, i.e. gravity-blind mutants [ ], did not coordinate n and body actions despite performing each typically. Two important conclusions follow from the mutant experiments. First, coordination of n and body movements re ects patterned control, distinct from movements that are correlated simply due to biomechanics [ ]. Second, though gravity-blind mutants could swim with a normal dorsal-up orientation in the light, utricular information is necessary for proper coordinated climbing. In mutant sh, posture changes and attack angles were normal, but unrelated. Synergistic n and body movements therefore re ect a neural transformation of vestibular information into coordinated commands for climbing.
Our discovery that loss of the utricular otoliths abolishes n and body synergy reveals a vestibular origin for the signals guiding coordinated climbing. On land, animals can infer their orientation relative to gravity from sensed pressure and muscle tension, allowing touch and proprioception to guide posture and locomotion [ , ]. In zebra sh, recent work has identi ed a class of spinal proprioceptors that provide feedback during axial locomotion [ ], and ascending feedback from the spinal cord in swimming tadpoles can drive compensatory ocular re exes [ ]. However, under water, the homogeneous physical environment necessitates vestibular strategies to guide coordinated locomotion with respect to gravity -such as the climbs we have studied here. Links between the vestibular system and postural orientation in the pitch axis are present in evolutionarily ancient vertebrates such as lamprey [ ]. Vestibular information can drive pectoral n movements in chondrichthyes [ ], one of the earliest classes in which pectoral ns appear [ ]. Considerable morphological [ ] and molecular [ ] work underscores the importance of the pectoral ns in the evolution of terrestrial appendages and gaits necessary for locomotion. Our ndings extend this work by linking sensed gravity to the underwater climbing behaviors these ancient appendages serve.
Existing literature suggests a neural substrate for the vestibular signals that promote coordination. The utricles transduce body orientation and self-motion but are insensitive to vertical forces orthogonal to the utricular macula [ , ], and should therefore be irrelevant for execution or perception of lif forces directly. A central origin for the signals that guide coordination is therefore more plausible, speci cally in the utriclerecipient hindbrain vestibular nuclei [ , ]. One of these, the tangential nucleus, contains "Ascending-Descending" neurons [ ]. These neurons are distinguished by bifurcating axons that project rostrally, ascending to a midbrain nucleus, the nucleus of the medial longidutinal fasciculus, a region responsible for descending control of swim kinematics [ -]. Ascending-Descending neurons are anatomically poised to also relay otolith-derived signals to the pectoral ns, as they make descending projections to th e locus of the pectoral n motoneurons: the caudal hindbrain/rostral spinal cord [ ]. Pectoral n motoneurons have been studied in the context of axial swimming, and this work has established that rostral hindbrain-derived signals are important for proper pectoral n control during fast swimming [ ]. In order to convey feedback to pectoral motoneurons about pitch-axis postural changes, Ascending-Descending neurons would need to en-code angular velocity, consistent with the transient responses to pitch-axis posture changes of neurons in the sh tangential nucleus [ ] and with hindbrain vestibular responses more broadly [ ]. Ascending-Descending neurons in the tangential vestibular nucleus are therefore a likely substrate by which utricular information comes to regulate n-body coordination.
The cerebellum has long been recognized for its role both in enabling [ ] and learning [ , ] coordinated movements, though the computations responsible remain contentious [ ]. We found that ablation of cerebellar Purkinje cells perturbed n-body coordination, leading to the production of con icting actions in which larvae generated nmediated lif while making nose-down rotations. Furthermore, ablation changed n-body coordination during noseup rotations, causing larvae to pair stronger n actions with the same body rotation. We conclude that the cerebellum acts to suppress lif generation by the ns during body rotations, and thereby prevents the production of con icting actions. Similarly, climbing in zebra sh will likely prove to be a uniquely tractable entry point into the study of the cerebellum's role in the development of coordinated locomotion.
The development of n-body coordination may speci cally re ect changes to sensory perception / processing, as opposed to motor capacity. Support for this proposal comes from our observation that uncoordinated gravity-blind mutants can use their ns as well as their wild-type counterparts, suggesting a fully-capable motor system. Further, young larvae were physically capable of producing large attack angles with the ns synergistically rotating their bodies to climb. Finally, the range of body rotations larvae produced did not change across development. Therefore, development does not require unlocking or composing new actions, but instead involves selecting a particular combination of equally functional innate actions [ , ]. As in other vertebrates [ ], the capacity of the vestibular system to stabilize gaze [ ] and posture [ ] improves markedly with age. In mature animals, vestibular information is thought to be weighted by reliability for perceptual computations [ ], consistent with learning rules [ ] that may underlie locomotor development. We propose that fundamental limit on locomotor development re ect not motor capabilities, but peripheral or central limits to perceived posture.
We hypothesized that the development of coordination is an adaptive process driven by dynamic optimization rules [ ].
To explore how larvae might implement these rules, we utilized simulations to quantify and compare the e fects of coordination parameters on performance variables: not only accuracy, but also e fort and balance [ , ]. Because the ns and body were redundant, accuracy constraints did not prescribe a speci c division of labor. Steering with the body had a distinct advantage: rotations reoriented the body towards the target, minimizing the need for subsequent steering. Further, the more a larva used its pectoral ns to climb, the more effort (de ned as the sum of the square of the inferred motor commands) it expended to reach its target. However, steering with ns facilitated balance, because the ns enabled climbing without changing trunk posture. We conclude that bodydominated climbing of young larvae is optimized primarily for e fort -or a variable that similarly scales with the sum of the control signals -while n-body synergies of older larvae are optimized both for e fort and balance. In this light, larvae at all ages may be considered equally skilled, with motor skill dened as the extent of optimization, and maturation considered a re ection of changing constraints on movement [ ].
Considerable e fort has gone into de ning the fundamental principles by which coordination emerges during locomotor development [ , ]. Maturation of coordination is thought to permit optimization of locomotion based on experience, and to facilitate adaptations to changing motor goals [ -]. Further, mature patterns of locomotion may be generally disfavored until balance can be maintained [ -]. However, the complexity of terrestrial biomechanics has made it dicult to understand why animals change the way they locomote, and how they accomplish these changes. We studied a simpler system -climbing underwater -to disentangle corporeal development from locomotor maturation. We discovered that the vestibular system shapes synergies between n and body actions as larval sh learn to climb. Our work demonstrates the fundamental importance of balance for the development of coordinated locomotion.

Fish husbandry and lines
Procedures involving larval zebra sh (Danio rerio) were approved by the Institutional Animal Care and Use Committee of New York University. Fertilized eggs were collected from in-crosses of a breeding population of Schoppik lab wildtype zebra sh maintained at . °C on a standard / hour light/dark cycle. Before dpf, larvae were maintained at densities of -larvae per petri dish of cm diameter, lled with -mL E with . ppm methylene blue. Subsequently, larvae were maintained on system water in L tanks at densities of -per tank and fed twice daily. Larvae received powdered food (Otohime A, Reed Mariculture, Campbell, CA) until dpf and brine shrimp thereaf er. Larvae were checked visually for swim bladder in ation before all behavioral measurements.
Transgenic sh with loss-of-function mutation of the inner ear-restricted gene, otogelin (otog-/-), which exhibit delayed development of utricular otoliths (rock solo AN

Surgery
Pectoral ns were amputated from wild-type larvae anesthetized in . % ethyl--aminobenzoic acid ethyl ester (MESAB, Sigma-Aldrich E , St. Louis, MO). Pairs of anesthetized, length-matched siblings were immobilized dorsal-up in % low-melting temperature agar (Thermo Fisher Scienti c ), and both pectoral ns of one larva were removed by pulling the base of the n at the scapulocoracoid laterally with forceps. Then, both siblings were freed from the agar with a scalpel and allowed to recover in E for -hours prior to behavioral measurement.

Cerebellar lesion
Cerebellar Purkinje cells were lesioned at dpf speci cally using transgenic expression of the photosensitizer, KillerRed. Larvae were mounted dorsal-up in agarose and anesthetized in MESAB. Control, transgenic sh were anesthetized in MESAB in parallel. Illumination conditions on a wide eld microscope (Axio Imager M , Zeiss, Oberkochen, Germany) were set under blue light ( / excitation lter from lter set , Chroma Technology, VT) to visualize but not activate KillerRed. Light was focused through a x, . NA water immersion objective (Zeiss Achroplan), stopped down to ll a . mm diameter region, and focused on the Purkinje cell somata. Green light ( / excitation lter from lter set , Chroma Technology, VT) was then applied for min, quenching KillerRed uorescence. The power at the sample plane, measured at nm with a . mm aperture silicon photodiode (PM D power meter, S C sensor, Thorlabs, NJ) was mW. Fish were allowed to recover for -hours before behavioral measurements.

Behavior measurement
Experiments were performed on clutches of wild-type siblings, with larvae per clutch recorded at dpf and , , and wpf as in a previous study [ ]. Additionally, clutches of -larvae each were divided evenly and compared with and without amputation of the pectoral ns, both at and wpf ( clutches each). Five clutches of siblings each, lacking utricles (otog-/-) and phenotypic controls (otog+/-or otog+/+), were measured at wpf before homozygous mutants develop utricles [ ]. Finally, Tg(aldoca:GAL FF;);Tg(UAS:KillerRed) siblings, lesioned and controls, were measured at wpf in constant darkness.
Larvae were lmed in groups of -siblings in a glass tank ( /G/ x x mm, Starna Cells, Inc., Atascadero, CA, USA) lled with -mL E and recorded for hours, with E re lled af er hours. The thin tank ( mm) restricted swimming near the focal plane. Water temperature was maintained at °C in an enclosure with overhead LEDs on a / hour light/dark cycle. Video was captured using digital CMOS cameras (BFLY-PGE-S M, Point Grey Research, Richmond, BC, Canada) equipped with close-focusing, manual zoom lenses ( -mm Macro Zoom Lens, Navitar, Inc., Rochester, NY, USA) with f-stop set to to maximize depth of focus. The eld-of-view, approximately x cm, was aligned concentrically with the tank face. A W nm infrared LED backlight (eBay) was transmitted through an aspheric condenser lens with a di fuser (ACL -DG -B, ThorLabs, NJ). An infrared lter ( -, Edmund Optics, NJ) was placed in the light path before the imaging lens.
Video acquisition was performed as previously [ ]. Digital video was recorded at Hz with an exposure time of ms. To extract kinematic data online using the NI-IMAQ vision acquisition environment of LabVIEW (National Instruments Corporation, Austin, TX, USA), background images were subtracted from live video, intensity thresholding and particle detection were applied, and age-speci c exclusion criteria for particle maximum Feret diameter (the greatest distance between two parallel planes restricting the particle) were used to identify larvae in each image [ ]. In each frame, the position of the visual center of mass and posture (body orientation in the pitch, or nose-up/down, axis) were collected. Posture was de ned as the orientation, relative to horizontal, of the line passing through the visual centroid that minimizes the visual moment of inertia, such that a larva with posture zero has its longitudinal axis horizontal.
Supplemental videos at high spatial resolution were alternatively lmed in a thinner glass tank ( /G/ x x mm, Starna Cells, Inc.) using a Sony IMX CMOS chip (ace acA -um, Basler AG, Germany) equipped with a highmagni cation xed focus lens (In nistix . x, In nity Optical Company, Boulder CO) and a high-pass infrared lter (Optcast , Edmund Optics). Infrared illumination was provided by multiple high-power LEDs ( W nm center wavelength, eBay); one, mounted behind the tank, provided transmitted light, passed through an aspheric condenser lens with di fuser (ACL -DG -B) and a piece of Cinegel # Filter paper (Rosco USA, Stamford CT). Three additional infrared LEDs were mounted between the lens and the tank to provide re ected illumination: one coupled to a ber optic ring light (Optcast , Edmund Optics) mounted on the lens barrel, and two additional bare LEDs mounted on either side of the tank at °angles. Full-frame ( x , -bit) video capture was triggered at Hz with a ms exposure time.

Behavior analysis
Data analysis was performed using Matlab (MathWorks, Natick, MA, USA). Epochs of consecutively saved frames lasting at least . sec were incorporated in subsequent analyses if they contained only one larva. Data were analyzed from the light phase during the rst hours of measurement, but excluded a hour period following transition from the dark phase to minimize in uence of light onset.
Deviation from horizontal was computed as the mean of absolute value of all postures observed. Instantaneous di ferences of body particle centroid position across frames were used to calculate speed. As previously [ ], bouts were de ned as periods with speeds exceeding mm·sec -, and consecutively detected bouts faster than Hz were merged. Numerous properties of swim bouts were measured or calculated. The maximum speed of a bout was determined from the largest displacement across two frames during the bout. The trajectory of a bout was de ned as the direction of instantaneous movement across those two frames. Bouts with backwards trajectories (> °or <-°, fewer than % of bouts across all ages) were excluded from analysis. The displacement across each pair of frames at speeds above mm·secwere summed to nd net bout displacement. Attack angle was de ned as the di ference between trajectory and posture of a larva at the peak speed of a bout, such that a larvae pointed horizontally and moving vertically upwards had an attack angle of °. Posture change during a bout was de ned as the di ference in body orientation observed and msec before peak speed, when rotations correlate with changes to trajectory [ ].
Instantaneous bout rate was de ned as the inverse of the interval between the rst frame exceeding mm·secin each of two successive bouts captured in a single epoch. Durations of bouts were calculated by linearly interpolating times crossing mm·secon the rising and falling phases of each bout. Interbout duration was computed as the di ference between inverse bout rate (instantaneous bout period) and bout duration. Vertical displacement during an inter-bout was computed as the di ference between the vertical position of larva centroid at the end and start of each inter-bout. A logistic function was used to t the sigmoidal relationship between attack angle (γ) and posture change (r), based on a simple formulation, , ( ) in which γ gives the lowest (most negative) attack angle (on average, in deg), (γ max + γ ) gives the largest positive attack angle (on average, in deg), and k is the steepness parameter (in deg − ). From the derivative of equation ( ), sigmoid maximal slope (dimensionless, found at r = r ) is given by kγ max / .
Because empirical data at all ages rose from the lower asymptote at similar values of posture change, sigmoid center position (r ) was itself de ned from a parameter for rise position (r rise , posture change at which the sigmoid rises to / of its upper asymptote): Parameter ts and con dence intervals were estimated in Matlab using a nonlinear regression-based solver (Levenberg-Marquardt) to minimize the sum of squared error between empirical and estimated attack angles given empirical posture changes. Initial parameter values were k= deg − , γ =-. °, γ max = °, and r rise =-°. Data were pooled across all bouts in a given group (age or utricle phenotype). To t data from individual clutches, pools of available swim bouts were increased by including data from hours of swimming, rather than hours. Given that γ , γ max , and r rise exhibited no consistent or signi cant trend with age (Supplemental Table ), values were xed at means across all ages (-. °, . °, and -. °, respectively) and sigmoid steepness was evaluated. One-parameter sigmoids t empirical data well across development relative to four-parameter sigmoids (Supplemental Table ).
In contrast, a one-parameter sigmoid poorly t empirical data for otog-/-larvae (R =-. ), which had uncorrelated attack angles and posture changes. Freeing the r rise parameter gave a sigmoid with a steepness of approximately that t slightly better than mean attack angle (R = . ), so n biases for otog-/and control larvae were calculated from maximal slopes of twoparameter sigmoids. From sigmoid ts, empirical n bias (α) was computed as an index of maximal sigmoid slope (slope/( +slope)). Fin bias therefore re ected the ratio of attack angle to posture change in a given climb. For sigmoids with positive steepness (k), In the generative swimming model (described below), commands to the ns (to generate attack angle) and body (to produce a posture change) were both calculated using the n bias parameter ( ≤ α ≤ ), such that attack angle and posture change had a maximal ratio of α/( − α). In this way, n bias re ects the ratio of attack angle and posture change for both empirical and simulated swimming. A single sigmoid (eq. ) poorly t empirical data for larvae with cerebellar lesions (R = . ) but not controls ( . ). While the single sigmoid accurately t data with positive posture changes and identi ed signi cant di ferences in steepness across conditions, it failed to capture the tendency in lesioned animals to pair positive attack angles with negative posture changes. Instead, these data were t with the sum of two sigmoids, one re ected about the vertical axis: ( ) The relative amplitudes of the two sigmoids were scaled by parameter χ, and the nose-up sigmoid amplitude was de ned as . °as for the one-parameter sigmoid. This four parameter function was t from initial values of χ= . , k= deg − , γ =-°, and r rise = °. For control larvae, the χ parameter did not signi cantly di fer from zero ( . ± . ), yielding a negligible contribution from the re ected sigmoid (see Results). Compared to the one-sigmoid function, the two-sigmoid function had minor e fects on the goodness-of-t and solutions for control data (R = . ; k = . vs. . ). In contrast, for lesion data the two-sigmoid function improved goodness-oft (R = . ), yielded a value for χ that signi cantly di fered from zero ( . ± . ), and drastically increased sigmoid steepness (k = . vs. . deg − ).

Swimming simulation
We made a generative swimming model in Matlab to estimate how n bias impacts balance and e fort while climbing. Simulated larvae moved in two dimensions (horizontal, x, and vertical, z) by making series of swim bouts (b = , ..., n) of variable trajectory (t) and xed displacement ( . mm, the mean empirical displacement across all ages). Larvae swam from an origin at ( , ) such that the position af er bout b was determined by the trajectory of all preceding bouts. For the horizontal dimension, in mm: ( ) Larvae swam until traversing ≥ % of both the horizontal and vertical distances from the origin to a target, located at distance d and angle ϕ from the origin, or (d · cos(ϕ), d · sin(ϕ)).
Larvae could control t during each bout through body rotation (r(b)) and by creating an attack angle with the pectoral ns (γ(b)). Body rotations allowed larvae to control their posture, which de ned the direction of thrust. Larvae began swimming at horizontal posture ( °), meaning Θ during bout b was given by the sum of rotations during that and all preceding bouts: ( ) For each bout, trajectory was de ned as the sum of posture (Θ(b)), attack angle (γ), and a noise term (ε, de ned below): To steer, larvae could directly vary γ with the ns or in uence Θ by rotating their bodies. Movement noise (ε) was introduced to model motor errors and convective water currents that push larvae while they swim. Assuming nless larvae actively produce no attack angles (γ = ; Figures B, C), their empirical attack angles re ect external forces (ε = t − Θ). Therefore, simulated ε for each bout was randomly drawn from a Gaussian distribution with a mean of and standard deviation measured from empirical attack angles of nless larvae at wpf ( . °). To make concerted posture changes and attack angles that steered towards a target, both r and γ were derived from a variable steering command (c(b), in degrees) that provided feedback about the direction of the target. This command was de ned before each bout and gave the direction of the target before the bout in egocentric terms (relative to the posture, Θ(b − ), and position of the larva (x(b − ), z(b − ))). For a larva oriented towards the target, c = such that no steering occurred. For the rst bout, angle c equaled ϕ, and thereaf er (for b > ) Rather than swim upside-down, model larvae were assumed to make yaw-axis turns (side-to-side) to keep the target horizontally forwards; if a larva swam past the target, its horizontal position was simply re ected about the horizontal position of the target, such that (d · cos(ϕ) − x) was always greater than . Commands for attack angle (γ ) and body rotation (r ) were computed as complementary fractions that summed to the common steering command, c. The relative magnitude of γ and r was dictated by n bias, α (de ned from [ , ]), according to When α = larvae steered solely by generating attack angles with the ns, and when α = steered solely with posture changes. When α adopted intermediate values, the ratio of n commands to body rotation commands was therefore α/( − α).
To transform commands (γ and r ) into kinematic variables (γ and r), we modeled physical limitations as a ceiling and oor imposed with logistic functions. These physical transfer functions for the ns and body had maximal slopes of and were constrained to the origin, faithfully transforming commands over a certain range but reaching asymptotes at positive and negative extremes ( Figure A). The n transfer function had asymptotes de ned by empirical best-t sigmoids to attack angle vs. posture change, averaged across ages (Supplemental Table ). The lower asymptote equaled γ (-. °) and the upper asymptote equaled γ max + γ ( . °). Given that the n transfer function was also constrained to have maximal slope of and pass through the origin, attack angle for a given bout was computed from the n command according to The body rotation transfer function was also constrained to have maximal slope of , pass through the origin, and have a range de ned by the middle . % of empirical body rotations (from -. °to . °). Body rotation for a given bout was computed from the rotation command according to To assess correlations of γ(b) and r(b) at age-, phenotype-, and clutch-speci c values ofα, we simulated , larvae at each n bias swimming to target at d= mm (half the length of the empirical tank). The direction of the target, ϕ, was randomly drawn from the positive lobe of a Gaussian distribution of mean and standard deviation of . °(that of trajectories of empirical bouts pooled across all ages). We also examined how deviation from horizontal, the mean of absolute value of simulated postures (Θ(b)), as well as mean attack angle varied as a function of α, parameterized from to in increments of . . Given that simulated larvae could deviate widely from horizontal, we computed circular mean posture in Matlab using CircStat [ ]). Af er a simulated larva reached its target in n bouts, e fort (E) was computed as the sum of squared steering commands, For comparison, e fort was also calculated as the sum of squared kinematic variables (r(i) + γ(i) ). Bootstrapped con-dence intervals were measured by resampling mean absolute postures times with replacement.

Cost function derivation
Cost (Q(α)) was calculated as a weighted sum of normalized deviation from horizontal (Θ * (α)), Figure B) and normalized e fort (E(α), Figure C), af er both were interpolatedfold and smoothed with a point sliding window. Deviation from horizontal was scaled by a balance weight coe cient ( ≤ β ≤ ) and e fort was scaled by ( -β), such that Parameterizing β yielded a family of cost functions. Finding the n bias at which cost was minimized gave the optimal n bias, α * (β). Con dence intervals on optimal n bias were taken as the farthest neighboring values of β, larger and smaller, at which the bootstrapped . percentile of cost exceeded the minimal cost. Inferred balance weights (β), those weights giving cost functions minimized by empirical n biases (α * =α) empirical n biases, were estimated by linear interpolation. Con dence estimates onβ were similarly interpolated from % con dence intervals of α * evaluated at % condence intervals ofα.

Statistics
Signi cance level was de ned at . . Pairwise t-tests were used to assess the e fects of n amputation on swim properties from sibling groups at both and wpf. Morphological properties were analyzed by One-way ANOVA assuming independence of all individual larvae. Two-way ANOVA with factors of age and clutch were used to assess e fects on swim properties from larvae , , and wpf, with signi cant main e fects of age followed by Tukey's post-hoc tests. One exception was the coe cient of determination of trajectory and posture, which failed the assumption of homoscedasticity; e fect of age was assessed with a non-parametric Kruskal-Wallis test.

A technical note on terminology
We use the term "attack angle" to describe the di ference between the orientation of the body's long axis and the trajectory of swimming. As our sh swim in stagnant water, this trajectory is assumed to oppose the direction of ow. Our de nition describes the orientation of an element's long axis relative to ow, consistent with the terminology in uid dynamics. Our sh vary the direction of motion with respect to the body, and we are speci cally interested in control of steering. Accordingly, we consider attack angles of the body because they are the consequence of forces orthogonal to the body long axisby which the sh steer upwards and downwards. We refer to these upwards forces as "lif " and attribute them to pectoral ns by inference, based on loss of positive attack angles following n amputation. However, we have no data that speak to n  ). , and wpf, with cropped attack angle probability distributions (right). Data plotted as means of equally-sized bins (black lines) and superimposed with best-t sigmoids and their bootstrapped S.D. (D) Maximal slopes of best-t sigmoids plotted with % con dence intervals as a function of age. (E,F) Mean attack angle (E) and absolute deviation from horizontal (F) for each clutch and age, evaluated over hours, are plotted as functions of maximal sigmoid slope with Pearson's correlation coe cients (r; p= . E-for attack angle and p= . E-for deviation from horizontal). Developmental trajectories for four individual clutches are plotted on identical axes (right).  Figure : A one-parameter control system captures n-body coordination in silico. (A) Circuit diagram to transform pitch-axis steering commands into climbing swims using the body and pectoral ns. Steering commands are de ned by the direction of a target in egocentric coordinates. The relative weight of commands to rotate the body (to direct thrust) and produce an attack angle with the ns (by generating lif ) is dictated by n bias (α). To model physical transformations from commands into kinematic variables, commands to the body and ns are ltered to impose empirically-derived ceilings and oors on posture changes and attack angles (see Methods). Swim trajectory is de ned by posture ( sh propel where they point) but modi ed by attack angle and error (ε). (B) Empirical n bias (α), computed from maximal sigmoid slope (slope/( +slope)), as a function of age with % con dence intervals. (C) Attack angle as a function of posture change, plotted as means of equally-sized bins. Climbs to , targets were simulated using empirical n bias (α) from , , and wpf larvae, and at α = for comparison. (D) Mean attack angle for simulated larvae with parameterized n bias (line), superimposed on empirical attack angles and n biases (α) for each clutch at each age. Simulated attack angles atα account for % of variation in empirically observed attack angles (R ). (α at wpf), and . , for larvae swimming towards targets µm away. Posture following the f h bout of the steepest climb is superimposed. Scale bar equals mm. (B) Simulated absolute deviation from horizontal posture as a function of α, plotted as mean (green line) and bootstrapped % con dence intervals (shaded band). Data are superimposed on empirical values for individual clutches of a given age (circles, Development, R = . ) and otog-/-larvae (diamond). (C) E fort, the sum of squared motor commands to the body and ns, from simulations in (B) normalized and plotted as a function of α as mean (line) and bootstrapped % con dence intervals (shaded band). Empirical n biases at , , and wpf and for otog-/-larvae are indicated with triangles. (D) Cost as a function of n bias, computed as sums of normalized curves in (B) and (C) weighted by β (balance weight) and ( − β), respectively (le ). When β = (green), cost is equivalent to normalized deviation from horizontal. When β = (ochre), cost is equivalent to e fort. Intermediate cost functions are plotted for β increasing by . , with % con dence interval (shaded band). (E) Fin bias at which cost was minimized is plotted at each value of balance weight, with % con dence intervals. (F) Inferred balance weight (β) is plotted as a function of age, with % con dence intervals. This weight gives the cost function minimized by empirical n bias at a given age (from the curve in E). Figure S . Larvae tend to sink between bouts. (A) Schematic of hydrostatic forces acting on larvae absent lif during bouts (top) and between bouts (bottom). (B) Trajectory as a function of swim speed, plotted as means of equally-sized bins for clutches (gray lines) and their mean (black). Swim bouts (light gray band, speeds faster than mm·sec − ) tended slightly upwards, while larvae sank at slow speeds, particularly slower than . mm·sec − (dark gray band). (C) Polar probability distributions of trajectories during swim bouts (light gray, top) and at speeds slower than . mm·sec − (dark gray, bottom). (D) Vertical displacement during the interval between two bouts (when speed decreased below mm·sec − ) as a function of interval duration, for individual bouts and mean of equally-sized bins.    S . Clutch-and age-speci c n bias. Attack angle as a function of posture change for individual clutches (columns) at each age (rows), plotted as means of equally-sized bins, superimposed with parameter sigmoid ts. Empirical n bias (α), computed as an index of maximal sigmoid slope (slope/( +slope)), is listed.

Supplemental Movies
Supplemental Movie . Lateral view of a freely-swimming, wpf larva producing bouts of upwards motion interleaved by periods of slow sinking.
Supplemental Movie . View down the long axis of a freely-swimming, wpf larva producing bouts of upwards motion with visible pectoral n abduction.