Animal behaviour is dynamic, evolving over multiple timescales from milliseconds to days and even across a lifetime. To understand the mechanisms governing these dynamics, it is necessary to capture multi-timescale structure from behavioural data. Here, we develop computational tools and study the behaviour of hundreds of larval zebrafish tracked continuously across multiple 24-hour day/night cycles. We extracted millions of movements and pauses, termed bouts, and used unsupervised learning to reduce each larva's behaviour to an alternating sequence of active and inactive bout types, termed modules. Through hierarchical compression, we identified recurrent behavioural patterns, termed motifs. Module and motif usage varied across the day/night cycle, revealing structure at subsecond to day-long timescales. We further demonstrate that module and motif analysis can uncover novel pharmacological and genetic mutant phenotypes. Overall, our work reveals the organisation of larval zebrafish behaviour at multiple timescales and provides tools to identify structure from largescale behavioural datasets. 2005), the sedating drug, melatonin (Zhdanova et al., 2001), and hypocretin receptor (hcrtr) mutant 59 larva (Yokogawa et al., 2007), loss of which is associated with narcolepsy in humans (Lin et al., 1999) 60 and altered bout structure in zebrafish (Yokogawa et al., 2007; Elbaz et al., 2012). We found that our 61 computational approach could readily detect both compound dose and mutant specific differences in 62 module and motif usage, demonstrating the biological relevance of our behavioural description. 63 64 Ultimately, our work reveals the organisation of larval zebrafish behaviour at sub-second to day-long 65 timescales and provides new computational tools to identify structure from large-scale behavioural 66 datasets. 67 68 69 70 4 Results 71 Behaviour at Scale 72Larval zebrafish behaviour consists of an alternating sequence of movements and pauses, termed 73 bouts, that are organised at sub-second timescales. To capture this structure from high-throughput, 74 long-timescale experiments, we used a 96-well plate set-up with a single larva housed in each well 75 ( Supplementary Figure 1a) and as a proxy for movement recorded the number of pixels that changed 76 intensity within each well between successive pairs of frames, a metric we term Δ pixels. We built on 77 previous work using this set-up (reviewed in: Barlow and Rihel, 2017; Oikonomou and Prober, 2017) 78 by analysing Δ pixels data at 25Hz, rather than in one-minute bins. When recorded in this way, Δ pixels 79 data is an alternating sequence of positive values representing movement magnitude and zeros 80 representing periods of inactivity (Figure 1a, Supplementary video 1). We defined active bouts as any 81 single or consecutive frames with non-zero Δ pixels values and described each bout using several 82 features including the mean and standard deviation of Δ pixels values across the bout (Figure 1a). We 83 defined inactive bouts as any single or conse...