Tracking evaporative cooling of a mesoscopic atomic quantum gas in real time

The fluctuations in thermodynamic and transport properties in many-body systems gain importance as the number of constituent particles is reduced. Ultracold atomic gases provide a clean setting for the study of mesoscopic systems; however, the detection of temporal fluctuations is hindered by the typically destructive detection, precluding repeated precise measurements on the same sample. Here, we overcome this hindrance by utilizing the enhanced light--matter coupling in an optical cavity to perform a minimally invasive continuous measurement and track the time evolution of the atom number in a quasi two-dimensional atomic gas during evaporation from a tilted trapping potential. We demonstrate sufficient measurement precision to detect atom number fluctuations well below the level set by Poissonian statistics. Furthermore, we characterize the non-linearity of the evaporation process and the inherent fluctuations of the transport of atoms out of the trapping volume through two-time correlations of the atom number. Our results establish coupled atom--cavity systems as a novel testbed for observing thermodynamics and transport phenomena in mesosopic cold atomic gases and, generally, pave the way for measuring multi-time correlation functions of ultracold quantum gases.

The fluctuations in thermodynamic and transport properties in many-body systems gain importance as the number of constituent particles is reduced. Ultracold atomic gases provide a clean setting for the study of mesoscopic systems; however, the detection of temporal fluctuations is hindered by the typically destructive detection, precluding repeated precise measurements on the same sample. Here, we overcome this hindrance by utilizing the enhanced light-matter coupling in an optical cavity to perform a minimally invasive continuous measurement and track the time evolution of the atom number in a quasi two-dimensional atomic gas during evaporation from a tilted trapping potential. We demonstrate sufficient measurement precision to detect atom number fluctuations well below the level set by Poissonian statistics. Furthermore, we characterize the nonlinearity of the evaporation process and the inherent fluctuations of the transport of atoms out of the trapping volume through two-time correlations of the atom number. Our results establish coupled atom-cavity systems as a novel testbed for observing thermodynamics and transport phenomena in mesosopic cold atomic gases and, generally, pave the way for measuring multi-time correlation functions of ultracold quantum gases.

I. INTRODUCTION
Tracking out-of-equilibrium dynamical processes and their fluctuations in mesoscopic systems is central to thermodynamics at intermediate scales [1,2] and transport in solid state systems [3]. For example, current fluctuations in mesoscopic electronic devices reveal the charge quantization of elementary or emergent particles, shedding light on the underlying microscopic physics [4,5]. Advanced experimental control and precise measurements make ultracold atomic gases an ideal testbed for studying transport phenomena with solid-state analogs and beyond [6][7][8]. Furthermore, the achievable system sizes, ranging from single to millions of atoms in different setups, naturally provide access to explore the mesoscopic domain with ensembles of cold atoms. However, solid-state and ultracold-atom mesoscopic systems differ in their fragility against measurement. Solidstate devices are coupled to large thermal reservoirs, which rapidly dissipate the backaction of measurement, and are refreshed with large particle reservoirs. In contrast, ultracold-atom systems are well isolated from thermal environments. Technical and backaction disturbance from measurement, such as from optical force fluctuations caused by light scattering, is absorbed within the mesoscopic system itself and can change the properties of the system significantly. Thus, the measured fluctuations within a mesoscopic cold-atom system can be strongly altered by continuous or stroboscopic measurements performed on the system. Accessing real-time information in such systems therefore requires strategies to maximize the extracted information for a given heating rate associated with the measurement. The enhanced atom-light interaction in high-finesse optical cavities [9] provides a means for performing minimally invasive, extremely sensitive measurements on atomic gases. Demonstrations span from recording transient signals of single or few atoms passing through an optical cavity [10,11] to measurements on static and dynamically evolving mesoscopic trapped atomic ensembles [12][13][14][15][16][17], or the probing of dynamical evolution of novel states of matter realized in the cavity [18][19][20]. Cavity-enhanced dispersive atom number measurements have been proposed as a non-invasive probe for dynamical and transport phenomena in mesoscopic samples [21][22][23]. The achievable precision surpasses that of stroboscopic free-space dispersive measurements, which have been performed on macroscopic atomic gases with greater capacity than mesoscopic gases to absorb backaction disturbance [24][25][26][27]. Cavity-enhanced atom-number readout with single-atom precision has been demonstrated, but was accompanied by strong disturbance that precluded repeated measurement on the gas [13]. In this work, we employ cavity-enhanced measurements to continuously track the non-equilibrium process of evaporative cooling [28][29][30][31][32] of a mesoscopic sample for long evolution times, which allows us to probe temporal correlations at all times under observation. Evaporative cooling occurs in a gas of temperature T and atom number N when collisions drive atoms to energies above the finite trap depth U , whereupon these atoms escape the trap, reducing the number of atoms remaining as well as their temperature. The ensuing dynamics depend on dimensionality, atom number, and temperature of the gas, all features also at the heart of transport phenomena studied with destructive measurements [21]. A a Allan dev. The atoms dispersively couple to the cavity, resulting in an atom-number-dependent shift ∆N of the transmission line shape (blue solid traces) compared to an empty cavity (blue dashed line). Tracking the side of fringe (marked by red dot and line) provides a dynamical measurement of atom number. c The cavity resonance is tracked using a feedback loop involving the cavity-coupled atomic cloud (dark red), located at the intensity maximum of a probe beam in the cavity (light red). The transmitted intensity of probe light is detected using a heterodyne receiver with local oscillator (LO) and a radiofrequency power detector (Det). This power is kept constant using a feedback loop (PID) adjusting the frequency of probe and LO through an acousto-optic modulator (AO). The atom number is derived from an in-loop measurement of the voltage used to adjust a voltage controlled oscillator driving the AO. d A single unfiltered trace of equivalent atom number N vs. time with the filter procedure indicated (gray shaded areas). e The Allan deviation ∆N is dominated by photonic shot noise for small integration times τ and by dynamics of the atom number for large τ . A low pass filter of the traces with optimal integration timeτ minimizes the noise associated with both effects. The solid lines represent guides to the eye. Larger photon number n (orange: n = 1.9(1), blue: n = 3.2(1), red: n = 6.0(1) and green: n = 9.7(1)) results in reduced shot noise, but also faster loss of the atoms and therefore increased imprecision at longer integration times. The colored ticks mark the noise level set by Poissonian statistics for our lowest measured mean atom number for each n. The light symbols show a reduced Allan deviation, where the average dynamics has been subtracted from each trace before calculating ∆N .
simple model captures the interplay between temperature and atom number in an evaporatively cooled atomic ensemble [30]: To evaporate from the trap, atoms have to be collisionally transferred to the high-energy tail of the Maxwell-Boltzmann distribution, such that the average evaporation rate,Ṅ ∝ −ηe −η , depends exponentially on η = U/k B T . This implies that samples with initially higher temperature evaporate atoms more quickly than samples with lower temperature. Moreover, due to the density-dependent thermalization rate of an evaporatively cooled gas [29,30] and the presence of threebody collisions [33], the evaporation dynamics can be expected to be non-linear in atom number. In the course of evaporative cooling, thermodynamic properties of the trapped atomic gas also undergo stochastic fluctuations. For example, a linear single-particle loss process results in a binomial partition of the gas between trapped and untrapped populations, with fluctuations described by the binomial distribution. Non-linearity associated with few-body loss processes, and also the non-linear dependence of evaporative cooling on instantaneous atom number and temperature, can be expected to modify these fluctuations, which are particularly pronounced in mesoscopic systems.
Here, we observe the non-equilibrium dynamics of an ultracold quantum gas during forced evaporation in a tilted trap potential by collecting real-time traces of the atom number dynamics (see Fig. 1a). We utilize the enhanced optical cross section of atoms coupled to a single mode of a high-finesse optical cavity to perform minimally invasive high-precision atom number measurements. In particular, we reveal two distinct dynamical regimes during evaporation: first, a super-linear regime driven by temperature variations early in the evaporation process, and, second, a sub-linear regime when these variations are damped away. Furthermore, we directly observe the temporal growth of stochastic fluctuations inherent in the evaporative cooling process itself.

II. DISPERSIVE ATOM NUMBER READOUT
The principle of continuous dynamical dispersive atom number readout of our atomic cloud is illustrated in   We consider a cloud of atoms that is localized at the intensity maximum of the standing wave formed by a probe beam coupled into the TEM 00 mode of a Fabry-Perot optical cavity. The cavity resonance is at a frequency ω c in the absence of atoms, which are coupled to the cavity with a single-atom vacuum Rabi coupling g on an optical transition with frequency ω a , linewidth Γ and atom-cavity detuning ∆ ca = ω c − ω a . In the dispersive limit |∆ ca | √ N g Γ , the presence of N atoms causes a frequency shift of the light-like mode of the coupled atom-cavity system by an amount proportional to the atom number [12][13][14], We detect this dispersive shift by feedback-stabilizing the frequency of the weak cavity probe to the side of fringe of the cavity transmission, realizing a continuous quantum non-demolition measurement of atom number [14]. During the measurement, the probe power in the cavity is held constant at a level characterized by the intracavity photon number n = P/(2 ω c κ c ), where κ denotes the cavity half linewidth, P is the power transmitted through the cavity and c quantifies the photon extraction efficiency. The frequency shift of the cavity resonance is extracted through the feedback signal; see Fig. 1b and Fig. 5. We use knowledge of g [12,16,34] and ∆ ca to calculate the dispersive cavity shift due to a single atom, ∆ 1 , and estimate the instantaneous "equivalent atom number" N (t) = ∆ N (t) /∆ 1 , see Fig. 1d, where "equivalent" reflects a slight reduction of the vacuum Rabi coupling in our experiment (see Appendix A) and is implied if not stated explicitly otherwise. We monitor the evolution of the intracavity gas during evaporation dynamics initiated by an applied magnetic field gradient [35]; see Fig. 1a. In the following, we discuss different quantities used to extract dynamics, measurement noise and intrinsic fluctuations from our data. Commonly adopted measures to quantify the imprecision in the real-time measurement for different integration times are the Allan deviation ∆N (τ ) = ( (N τ (t i+1 ) − N τ (t i )) 2 /2) 1/2 [12,13] or the corresponding Allan variance ∆N 2 . Here, the trace N τ (t i ) is obtained by low-pass filtering the full trace N (t) with an integration time τ and then resampling at discrete times t i separated by time intervals of length τ . The angle brackets denote the average over all i. Photon shot noise limits the measurement precision of the dispersive cavity shift for short integration times; see Fig. 1e. For integration times above approximately 1 ms, the dynamics of the evaporation process start dominating the Allan deviation. Choosing such a long integration time leads to a loss of information about the dynamical system under observation. As a consequence, the dynamics set an upper bound on the achievable integration times and therefore suppression of photonic shot noise in the measurement; see Appendix D. Despite this, the minimal imprecision and therefore the measurement noise of our cavity-assisted detection is well below the level set by Poissonian fluctuations of size √ N for N atoms for all measured traces and all times presented in the following; see Fig. 1e. The effect of dynamics on the optimal integration time can be mitigated by subtracting the average dynamics from each trace. The reduced Allan deviation calculated from these subtracted traces lacks the strong increase towards longer integration times, such that, in this case, the optimal integration times are typically longer; see Fig. 1e. As described in detail below, a generalization of this method with an adjusted time separation between the two integration intervals detects the intrinsic stochastic fluctuations inherent in a dynamically evolving system. We started our experiment with an atomic cloud of about 2200 87 Rb atoms with a mean temperature of approximately T 0 = 2.6 µK. The gas was prepared in its hyperfine state |F, m F = |2, 2 and was trapped predominantly in a single well of a far-detuned optical lattice potential with an initial depth U 0 /k B = 31(1) µK in an optical cavity [16,34,36]. The lattice provided strong confinement in the z-direction with a trapping frequency of ω z /2π = 91(2) kHz, putting the gas in the quasi two-dimensional regime ω z > k B T 0 . At these parameters, we estimate the phase-space density to be 0.3, close to the quantum degenerate regime. Crucially, accurate positioning of the atomic cloud along the cavity axis at the peak of the probe standing wave maximized the atom-cavity coupling, rendered it nearly identical for all atoms, and minimized optomechanical backaction heating [36,37]. The cavity length was stabilized such that its resonance frequency was kept at a near-constant red detuning ∆ ca /2π ≈ −42 GHz with respect to the D2 line of 87 Rb, for which the atomic resonance linewidth is Γ/2π ≈ 6 MHz. The detuning of the cavity probe from atomic resonance together with the vacuum Rabi coupling g/2π = 13.1 MHz led to a maximal cavity shift |∆ 1 /2π| ≈ 4 kHz per atom. The cavity probe was maintained at a constant detuning of δ pc /2π = κ/2π = 1.8 MHz from the atom-shifted cavity resonance frequency. The frequency lock of the probe to the cavity was realized by stabilizing the radiofrequency power output from a heterodyne receiver monitoring the probe transmission through the cavity; see Fig. 1c and Appendix A. The large single-atom cooperativity C = g 2 /κΓ = 15.9 and consequently low cavity probe powers of a few picowatts in our experiment allowed us to minimize the probe-induced off-resonant scattering and associated heating rate. This sets the cavity-based measurement apart from free-space methods and was key for achieving the long measurement times at the imprecision required for performing atom counting in mesoscopic system; see Appendix D.
In a first set of experiments, we tracked the equivalent atom number for different intracavity photon numbers n, while slowly lowering the trap potential U/k B from 31 µK to approximately 8 µK by ramping up a magnetic field gradient within 330 ms; see Fig. 7 and Appendix A.
The resulting ensemble of atom number traces is shown in Fig. 2, with every individual trace representing a new run of the experiment. The traces taken together form a statistical ensemble that encompasses both the variation in evaporation trajectories with different initial atom number and temperature, and also the fluctuations in atom number generated by evaporation dynamics in individual trajectories. In order to minimize the effect of noise, each trace was filtered with a bandwidth corresponding to the optimal integration timeτ extracted from the Allan deviation shown in Fig. 1c. For clarity we suppress the subscript and write N (t) ≡ Nτ (t) in the following. Our measurements of N (t) show a clear trend to lower final atom numbers as the intracavity photon number is increased. This trend reflects the larger measurementinduced heating at increasing probe power, which leads to an increase in the number of atoms ejected from the trap during evaporation.
In general, decorrelation of two measured atom numbers N (t 1 ) ≡ N 1 and N (t 2 ) ≡ N 2 at two points in time, indicated by t 1 and t 2 , arises from three sources: technical noise, measurement noise and stochastic noise due to the evaporation process itself. We extract the correlations from the slope of the standardized atom numbers N 2,s vs. N 1,s , which equals the Pearson cor- The standardized atom numbers are defined as and σ 1 (σ 2 ) are the mean and the standard deviation of the non-standardized atom number distribution measured at time t 1 (t 2 ). In our experiment, we observe dominant linear correlations of around ρ 12 = 97% at all intracavity photon numbers for two measurements closely spaced in time; see Fig. 2 upper panel. The strong observed correlation indicates a small influence of all noise sources at these early times. In particular, it confirms that our measurement noise is small, consistent with our previous analysis of the imprecision. For a time t 2 = 275 ms, later on the evaporation trajectory, the fluctuations accrued over the process of evaporation are much more prominent. However, there is still some degree of linear correlation present. The reduction of the correlation from ρ 12 = 75.9(1)% at the smallest intracavity photon number n = 1.9(1) to 35.0(1)% at the largest intracavity photon number n = 9.7(1) indicates a larger impact of stochastic noise coupled into the system at larger lost fraction of atoms. Extracting the final temperature of the evaporating ensemble from a time of flight absorption image after our real-time measurement, we estimate the temperature to drop to less than 1.5(1) µK for n = 1.9(1), which implies a phase-space density increase of at least 13%, but possibly significantly more; see Fig. 6 and Appendix A.

III. NON-LINEARITY OF EVAPORATION
The non-linear dynamics of a system are captured already by the evolution of statistical averages. In the following, we outline how two-time correlations extrac-

Sub-linear Super-linear Linear
Remaining fraction p p a Figure 3.
Non-linearity of evaporation process. a Schematic illustrating the non-linearity measure. Super-(sub-) linearity is equivalent to a slope a of the scatter of N2 vs. N1 that is larger (smaller) than the remaining fraction of atoms p. For a linear process, a = p. b Subtracted slope as = a − p for different initial times t1 (dark to bright color, indicated in legend) used to quantify the non-linearity of the evaporation process vs. remaining fraction of atoms p. The shaded region shows the standard deviation calculated by bootstrapping for the smallest and largest initial time.
ted from a continuous measurement of the atom number of the same cloud enable us to uncover the non-linear character of evaporative cooling. To this end, we compare the remaining fraction of atoms, p = N 2 / N 1 , to the slope extracted from scatter plots such as those shown in Fig. 2, calculated as the least squares estimate a = ρ 12 σ 2 /σ 1 . For a linear process, defined by a constant evaporation rate per atom and henceṄ ∝ −N , the two quantities should coincide and hence a = p, whereas nonlinear effects lead to a deviation from this expectation; see Fig. 3a and Appendix C. As an example, the casė N ∝ −N α with α > 1 leads to a < p, which we term "sub-linear" to indicate a scatter slope smaller than in the linear case. For our evaporation sequence, we find systematic deviations from a simple linear relationship; see Fig. 3b. Recording the difference a s = a − p versus the remaining fraction of atoms p, we observe a pronounced super-linear behavior with a > p, when p is calculated relative to a small initial time t 1 . We interpret this super-linear behavior as being mediated by temperature variations in our sample distribution: Atomic gases are prepared with a low initial atom number because of higher atom losses from an initially high gas temperature. The high temperature hastens evaporation, leading to a higher per-atom loss rate and thus a relatively lower final atom number, leading altogether to a > p. This picture is backed by simulations of the evaporation process; see Fig. 8 and The rapid evaporation of hotter gases also quickly reduces their temperatures, such that over time different realizations of the gas arrive at nearly the same final temperature irrespective of their initial temperatures. This interesting transient behavior is often implicitly assumed in literature quoting that the temperature locks to a fixed fraction 1/η of the trap depth [29,30,32] and ultimately originates from the competition between exponential truncation and temperature-dependent thermalization of atoms in the evaporation process. At later times in the evaporation process, after the effect of initial temperature variation is suppressed, we find slightly sub-linear behavior, where an initial excess of atoms at time t 1 is reduced during the evolution. This behavior can be explained by increased three-body losses towards the end of the evaporation ramp, which reduce ensemble variations due to their non-linear character [33]; see Fig. 8. Interestingly, our observations imply that evaporation first moderates temperature variation and then, thereafter, atom number variation in different realizations, ultimately resulting in a stabilizing effect for both atom number and temperature.

IV. STOCHASTIC CHARACTER OF EVAPORATION
The mesoscopic nature of our samples together with the continuous, high-precision measurement enables us to characterize also the stochastic fluctuations inherent in evaporative cooling accrued on a single trajectory. These cannot be obtained from the average evolution of an evaporating gas. Crucially, analysis of two-time correlations allows for discriminating the effect of variation in initial conditions from the inherent stochastic fluctuations, which reach up to an rms on the order of √ N in mesoscopic samples with small N . To access stochastic fluctuations directly, we analyze the unexplained variance σ 2 u = σ 2 2 1 − ρ 2 12 as the amount of variance in atom number measured at time t 2 that is not predictable through correlation with the initial atom number at time t 1 ; that is, the unexplained variance captures the variance beyond that explained by the linear slope in an N 1 -N 2 scatter plot; see also Figs. 2 and 3. The unexplained variance also generalizes the reduced Allan variance (see Fig. 1e) to arbitrary time separations, and is dominated by the measurement noise and additionally the stochastic noise associated with atom loss; see Appendix C. We observe distinctly different behavior at early times and at late times during the evaporation process. Referenced to an early initial time t 1 = 10 ms, the the unexplained variance grows rapidly; see Fig. 4a. Compared to a simple parameter-free theoretical model (see Appendix C) we find that the fluctuations are up to a factor of three above the fluctuations expected for a purely uncorrelated atom loss, which is described by a Poissonian stochastic  c Unexplained variance σ 2 u for p ≈ 1 (t2 = t1 + τ , darker points) and p = 0.60(2) (t2 = t1 + 95(5) ms, lighter points) for different integration times τ . For p ≈ 1, the unexplained variance corresponds to twice the reduced Allan variance (solid orange line). The bright orange line denotes the full Allan variance without subtracting the mean dynamics (see Fig. 1e). The gray tick indicates the integration time τ = 4 ms that minimizes σ 2 u and was used to produce the curves shown in a and b. d Scaling of unexplained variance for fixed lost fraction p = 0.60(2) with initial atom number N1. The constant measurement noise has been subtracted from the data for each n, to compare different n (color coded as in Fig. 2). The gray solid line denotes the linear Poissonian expectationσ 2 u (N1) = p(1 − p) N1. The errorbars denote one standard deviation.
process. Consistent with our earlier interpretation, we ascribe these large fluctuations to additional variance in the initial temperature that is uncorrelated with the initial atom number. Referenced to a later initial time t 1 = 180 ms, when unexplained temperature variations have been suppressed, we observe a slower growth of σ 2 u . Here, we find good agreement with a linear, Poissonian stochastic loss process, indicating that linear single-atom loss dominates the fluctuations of the cooling process even in presence of a non-linear three-body loss; see Fig. 4b. For large remaining fraction of atoms p ≈ 1 (t 2 close to t 1 ), the unexplained variance is consistent with the sum of measurement noise in N 1 and N 2 and, hence, coincides with twice the reduced Allan variance; see Fig. 4c. We note that, in the fluctuation analysis, the mean dynamics is subtracted, such that the optimal integration time can be increased to τ = 4 ms without compromising time resolution of our dynamical measurement; see Fig. 1e. In order to further corroborate the stochastic nature of the unexplained variance above measurement noise, we investigated the unexplained variance at a fixed fraction of lost atoms p = 0.60(2) for varying initial atom numbers N 1 ; see Fig. 4d. This strategy is motivated by quantum optics experiments, where the variance originating from photon (quantum) shot noise (∝ n) can be discriminated against technical noise (∝ n 2 ) through their scaling with photon number. In our experiment, we again find a strong excess in σ 2 u for large initial atom numbers N 1 . However, for smaller initial atom numbers, the unexplained variance approaches and traces the Poissonian expectation p(1 − p) N 1 for a range of N 1 at all n. This contrasts with the quadratic dependence of unexplained variance on initial atom number expected for technical noise.

V. CONCLUSION
The minimally invasive measurement of atom number dynamics in our cavity-coupled atomic gas opens numerous near-and longer term perspectives. First, our work provides an ideal starting point for further studies of evaporation dynamics in low-dimensional mesoscopic quantum gases. Specifically, our results call for a detailed study of the impact of N -body losses on evaporation, which are expected to lead to enhanced atom-number fluctuations but also have a moderating effect on ensemble variations due to the non-linear density dependence of the evaporation rate. Our results also indicate that feedback on the atom number [25,38] based on the non-destructive real-time record of an evaporating gas can prepare samples at a fixed temperature with controllable atom numbers fluctuating less than the amount set by Poissonian statistics. Samples stabilized this way provide an ideal starting condition to study atom-number-dependent collective phenomena in optical cavities such as dynamical instabilities [34]. Furthermore, the densities reached in our twodimensional system are close to the regime where corrections due to Bose statistics and interactions in the gas become relevant. We expect that we can reach this regime with only slightly higher initial atom numbers, which were limited technically in the present study. This prospect motivates further studies focusing on how evaporation dynamics, thermodynamics and stochastic fluctuations are modified by quantum statistics and atomic interactions. Approaching the superfluid transition, our technique complements recent studies in three-dimensional gases [26,27]. In particular, it enables highly sensitive studies of dynamical fluctuation growth and stochastic behavior in a two-dimensional mesoscopic setting and at strong interactions, providing a new window into the intriguing physics of interacting two-dimensional Bose gases [39]. Combining our technique with locally controlled coupling to the cavity [40] opens the path towards future non-invasive two-terminal transport measurements of strongly correlated quantum gases in optical cavities [22], for dynamical probing of fluctuation dissipation relations [41], or for realizing novel non-destructive local scanning probes of cold gases [23]. Such non-destructive probes are also directly relevant to uncovering dynamical fluctuations characteristic of non-equilibrium universality in transport phenomena [42], or at fluctuating interfaces [43], which can also be studied in neutral-atom systems [44]. Finally, leveraging the recent advances in optical tweezer technology, our detection scheme can be extended to the single-atom level through controlled coupling to optical cavities, realizing a versatile quantum sensor.
As a direct application, continuous non-destructive probing of single atoms has recently been identified as a key step to enable energy measurements in manybody systems [45], thereby bringing experimental tests of mesoscopic quantum thermodynamics [1] within reach.

Experimental sequence
We started our measurement by preparing a cloud of about 2200 87 Rb atoms with a temperature of approximately T 0 = 2.6 µK in a cavity-supported vertical optical standing wave, forming an optical lattice with lattice spacing a = 421 nm. Before loading the lattice, the cloud was compressed vertically in a tight magnetic trap created by an atom chip, such that predominantly a single slice of the lattice is populated [16,34,36]. We estimate the fraction of atoms in other slices to be maximally 20%, as was characterized by cavity-aided magnetic resonance microscopy [12]. The depth of the lattice trap was U 0 /2π = h × 641(30) kHz (k B × 31(1) µK) and the waist of the lattice beam in the cavity was w 0 = 26 µm, leading to axial and radial trapping frequencies of ω z /2π = 91(2) kHz and ω r /2π = 670(10) Hz. Given k B T 0 = h × 54 kHz, these parameters put the gas in a quasi two-dimensional regime, where motion along the z-direction is frozen out, but atomic collisions are still described by a three-dimensional scattering process. The cavity length and exact wavelength of the lattice laser were chosen such that the atomic cloud axially overlapped with the maximal probe intensity in the cavity. The atoms emerged from the magnetic trap purely in the |F, m F = |2, 2 hyperfine state. During probing, we applied a strong magnetic field of B z = 17 G along the cavity axis, and also drove the cavity with σ + circularly polarized probe light. Under these conditions, the lightatom interactions are reduced to an effective two-level scheme, the atomic spin polarization is preserved, and the vacuum Rabi coupling is maximized. The atom number was recorded using a cavity probe at a wavelength of 780 nm, detuned by ∆ ca /2π ≈ −42 GHz to the red of the D2 line. The transmission of this probe through the cavity was recorded on a heterodyne receiver. For heterodyne detection, we used a local oscillator (LO) with approximately 1 mW of optical power derived from the same laser but with its frequency offset by 10 MHz relative to the frequency of the probe. The probe beam was intensity stabilized before entering the cavity and the LO before coupling into the heterodyne receiver. The photon collection efficiency was reduced by cavity mirror losses ( c = 0.31), finite path efficiency of the heterodyne path ( p = 0.93), mode matching efficiency of local oscillator and probe beam ( mm = 0.89) and quantum efficiency of the heterodyne photodetector ( q ≈ 0.58). These effects combined to give an overall photon detection efficiency of = 0.149(10) in our heterodyne receiver.
After preparation of the cloud, forced evaporation was induced by exponentially ramping up the current through our atomic chip wires with a time constant of 70 ms. The resulting inhomogeneous magnetic field was accompanied by a magnetic field gradient increasing from zero up to 220 G/cm, strong enough to lower the trap depth dynamically; see Corresponding VCO frequency f . Bottom panel: Current in our atomic chip wires (red). Evaporation was induced by ramping up the current, which lowers the trap depth dynamically (see Fig. 7), and halted at 320 ms by ramping the current back down quickly. During evaporation (indicated by gray shading in all panels), the heterodyne magnitude was kept constant by a side-of-fringe lock. The atom-induced cavity shift was extracted from an in-loop measurement of the control voltage fed back to the VCO. At the end of an experimental run, a swept atom number measurement was performed, where δpc was varied by sweeping f down and up across cavity resonance. In these sweep measurements, the atom number was extracted from the shift of the cavity profile visible in the heterodyne magnitude signal, and was used just for calibration purposes.
log side-of-fringe feedback loop was engaged to keep the probe-cavity detuning fixed at δ pc /2π ≈ κ/2π = 1.8 MHz and thus the intracavity probe intensity constant. The time-zero of our measurement was chosen 8 ms after activating the feedback, which was enough time to avoid any effect of transients on our real-time atom-number traces. We believe, however, that these transients and variations caused by loading the cloud in our cavity lattice contribute to the initial temperature variation observed in our gas. To realize the side-of-fringe feedback loop, part of the heterodyne signal was split off after a radio-frequency amplifier, sent through a bandpass filter with a 2 MHz bandwidth, and its power was detected with a linear radiofrequency power detector (Analog Devices, AD8361). The detected power was kept constant by feeding back to the frequency of probe and LO through a voltage controlled oscillator (VCO) driving an acousto-optic modulator (AO) before the cavity. The required in-loop control voltage was monitored. An equivalent VCO signal was recorded after the sequence without the atoms present. The difference of this reference signal and the signal with atoms, together with the calibrated VCO characteristics, yielded the atom-induced cavity shift ∆ N . In order to re- duce the effect of photon shot noise, we subtracted a running average of five empty cavity traces of successive runs from each trace with atoms. The number of averaged empty cavity traces was a compromise between mitigating the influence of shot noise on the reference trace and avoiding additional imprecision due to longer-time technical drifts of the empty cavity resonance. After untilting the trap, we performed a swept atom number measurement; see Fig. 5. To this end, we swept the frequency of the cavity probe across the resonance of our cavity. The peak position of the recorded heterodyne signal relative to a reference measurement on an empty cavity taken at the end of the sequence reflected the atom-induced cavity shift; see Fig. 5. The swept measurement was used to benchmark the shift correction described in the next section. In order to verify the cooling of our gas, we performed a time-of-flight absorption measurement after our swept atom number measurement. To this end, we rapidly turned off the cavity lattice and let the cloud expand by 400 µs. The temperatures extracted from this time of flight measurement are shown in Fig. 6. We consider this extracted temperature to be an upper bound of the actual temperature due to the long additional hold time before the measurement, the additionally present swept atom number measurement, and the short expansion time of the gas limited by our cavity geometry. We note that the temperatures extracted from our simulation right at the end of the evaporation ramp are approximately a factor of two below these values; see Fig. 8.

Trap depth and shift correction
The magnetic field applied during evaporative cooling leads to a reduction of the trap depth to below 10 µK; see Fig. 7. We find the trap depth using the known waist size of the lattice trap in the cavity and the applied magnetic fields as the height of the saddle point of the combined potential of magnetic and optical traps relative to the trap bottom, including the small but non-negligible influence of the red-detuned probe. With increasing applied magnetic field gradients, the trap minimum is radially displaced from the center of the cavity mode, and hence away from the maximal coupling point of the probe laser. We calculate the displacement and the resulting reduced overlap with the probe laser for a point-like cloud. The maximal displacement is approximately 8 µm. For our probe waist of w p = 25 µm, this displacement leads to a change in g 2 and hence ∆ 1 of at most 15 % (see the inset of Fig. 7). We verified that the results of this procedure for a point-like cloud were almost identical to the case of a thermal cloud with a temperature of T 0 ≈ 2.6 µK, such that we use the former as an approximation for the latter. We confirm the accuracy of our calculated correction factor by comparing the corrected atom number measured at the maximal spatial displacement with a sweep measurement after removing the magnetic field gradient, see Fig. 5, where the atoms were located at the position of maximal probe coupling. Due to the strong latticeinduced confinement, the displacement of the cloud along the vertical direction is negligible. In addition to the sideways displacement, the applied magnetic field rotates the overall magnetic field direction. Consequently, the orientation of the quantization axis tilts and the projection of the circularly polarized light of the probe beam changes, resulting in maximally 3% of additional correction to the coupling strength. We estimate an associated maximal probability of 4% per scattered photon to result in transfer into other hyperfine ground states, with a negligible effect on our measured atom numbers. We also stress that the small correction of g 2 does not affect any of the conclusions drawn, and we have accounted for it in the direct quantitative comparison of our measurements with the theoretical models presented in the following.

APPENDIX B: MODELING EVAPORATIVE COOLING Theoretical model for evaporation
We model evaporative cooling in two dimensions, following references [29,32], by the time evolution of a truncated Maxwell-Boltzmann distribution in a harmonic trap with time-dependent depth. The change in atom number N for a truncation parameter η = U/k B T in the trap isṄ Here, γ = n th σv th is related to the elastic collision rate γ c = √ 2γ in a gas with density n th and thermal velocity v th = 8k B T /πm. The incomplete Gamma functions The trap depth of the combined potential of far off-resonant optical lattice trap, magnetic field and probe-induced potential as the magnetic gradient is ramped up from zero to its maximal value. The inset shows the correction factor required to correct g 2 for the shift of the cloud relative to the maximal probe intensity. Different colors correspond to different intracavity photon number, with the color code the same as in Fig. 2.
P (α, η) = η 0 dt t α−1 e −t /Γ (α) take into account truncation effects in a trap with finite depth [29]. We can rewrite Eq. (3) to bring out the temperature and atom number dependence explicitly, The constant c γ = γ 0 T 1 2 0 /N 0 contains the initial rate γ 0 , the initial temperature T 0 and the initial atom number N 0 . Notably, Eq. (3) indicates that, at constant temperature, atom spilling over a potential barrier constitutes a loss process which is non-linear in atom number. Evaporating atoms cause a change in the internal energy E = 2N k B T of the gas. Taking the time derivative and solving for the change in temperature, we obtain The change in energy is proportional to the atom loss rate multiplied with the energy of a leaving atom, corrected for truncation [29] where η = U/k B T . Plugging this into Eq. (4), we obtain the change in temperature aṡ In the last step, we have included a heating rate Γ h , caused, e.g., by photon recoil heating or other external heating sources. Three-body losses affect both the atom number dynamics and the temperature dynamics of evaporative cooling. Their atom number dynamics have to be treated separately from the atom number dynamics due to evaporating atoms. The atom loss rate due to three-body collisions isṄ Here, L 3 denotes the three-body loss coefficient [46], which is scaled appropriately for a thermal bosonic gas [47], and c 3 is an additional scaling coefficient. These losses do not contribute to the cooling of the gas. Rather, they lead to "anti-evaporation heating" [47], as the loss happens predominantly at the center of the trap, where the density is highest. Atoms in the central region of the trap have less than average potential energy, such that the gas effectively heats upon thermalization. Quantitatively, anti-evaporation heating leads to a change in temperature reflecting the difference in potential energy between an average atom and an atom lost through a three-body collision, Together with the known time-dependent trajectory of the trap depth U (t), equations (3) and (6) can be solved to obtain the mean atom number and temperature dynamics of evaporative cooling. The effect of three-body loss can be included by adding equations (7) to (3) and (8) to (6).

Evaporation dynamics
The model derived in the previous section can be used to check the influence of initial atom number and temperature variation on the evaporation dynamics, and serves as a benchmark of the subtracted slope presented in the main text as a measure of non-linear dynamics in the average evolution. To this end, we simulate the coupled atom-and temperature dynamics for our experimental configuration. We neglect the influence of adiabatic decompression [32], which is expected to be small in gradient-assisted evaporation [35]. In our case, the expected reduction of the trap frequency along the direction of the gradient is approximately 15%. The heating rate per photon is extracted from reference measurements to be Γ h = 7(3) µK s −1 . For our parameters, we expect scattering into free space to be a significant heating source. The off-resonant scattering rate Γ eff /n ≈ 3.6 s −1 leads to an expected recoil heating rate per intracavity photon of Γ r /n = 2E r Γ eff /n ≈ h × 27.1 kHz s −1 = k B × 1.3 µK s −1 , where we have used the recoil energy E r = 2 k 2 /2m ≈ h × 3.8 kHz for 87 Rb on the D2 line. We attribute the discrepancy between this estimate and the experimental  Fig. 7. We show 200 traces with initial atom numbers N0 and temperatures T0 sampled from Gaussian distributions in light color, for varying intracavity photon number n as indicated in the top right corner. The atom number samples have a mean N0 and a standard deviation of 2 N0 1/2 . The temperature distribution is centered about the initial temperature T0 and has a standard deviation of ∆T0 = 0.6 µK. We have included a three-body loss contribution scaled by c3 = 0.2. The dark line shows the measured atom number dynamics including shift correction. b Ratio of trap depth to temperature, η = U/kBT , for the same ensemble as in a. The initially broad distribution is rapidly narrowed down and then remains nearly constant during further evaporation. c Subtracted slope as for n = 1.9 for different temperature spreads (indicated in top right corner) in absence of three-body loss (c3 = 0). We observe the same trends as observed in our experiment, with a fast rise for small p and a decay with increasing initial time t1 (indicated in legend). The shaded region indicates the standard deviation extracted from a bootstrap analysis of the calculated samples. d Subtracted slope as for n = 3.2 and ∆T0 = 0.6 µK for increasing contribution of three-body loss characterized by the scaling factor c3 (indicated in top right corner). Three-body loss leads to a negative contribution to as, which suppresses the effect of initial temperature variation.
value to additional technical noise contributions from the side-of-fringe lock, which can lead to parametric heating of the cloud. To model variations in the initially prepared ensemble, we calculate 200 traces with atom number N 0 and temperature T 0 drawn from Gaussian distributions. The standard deviation of the atom number distribution is extracted from a fit to the measured initial atom number distribution. The standard deviation of the temperature distribution ∆T 0 is varied in the simulation. The elastic collision rate is calculated for each run using the drawn atom number and temperature assuming a quasi twodimensional gas. The resulting curves of the time evolution of the atom number for our trap ramp are shown in Fig. 8a, for a temperature spread of ∆T 0 = 0.6 µK and a three-body collision scale factor c 3 = 0.2. The overall temporal dynamics and the final atom numbers are in good agreement with the data for the chosen parameters. During the initial 100 ms of the evaporation process, the temperature variation, reflected in variation in the ratio of trap depth to temperature η, are rapidly suppressed and temperature locks to an approximately fixed fraction of trap depth provided the heating is small; see Fig. 8b. In order to support the introduction of the subtracted slope a s = ρ 12 σ 2 /σ 1 − p as a non-linearity measure (see main text and Appendix C), we study the effect of varying temperature spread and three-body loss on a s . The resulting dependencies are shown in Fig. 8c and Fig. 8d. We observe that, as expected and explained in the main text, an increase in the initial temperature spread is reflected as a positive signal in a s , which reduces to near zero and stays constant for later initial time t 1 . Contrarily, the introduction of strong three-body loss in the dynamics results in a negative a s and hence sub-linear behavior, as expected for an effect that reduces the atom number variance in time [33], even if strong initial temperature variations are present in the ensemble; see Fig. 8d. Qualitatively, the simulation shows the same features as observed in our data for three-body losses of approximately c 3 = 0.05 − 0.2 times the value expected according to Eq. (7). This reduction of three-body losses points to an overestimate of the density of the ensemble, for example due to interactions in the two-dimensional gas, which we have neglected in our treatment. Our simulations support our claim that the subtracted slope a s is a meaningful quantity sensitive to both initial temperature variation and three-body loss. We have verified that this is robustly the case also if the thermalization and heating rates are reduced. For stronger heating, we find experimentally and from our simulations that evaporation assumes linear character with a s = 0. While our simulations do reflect the effect of variation in the initial ensemble, we stress that the intrinsic stochastic character of evaporation is not captured. Further studies of the interplay between stochastic fluctuations and nonlinearities such as three-body loss would be of particular interest.

Non-linearity measure
The minimally invasive measurement strategy involving the cavity allows to go beyond single-time observables by constructing two-time correlations. The information about the linearity of the time evolution is encoded in the dependence of the measured atom number N 2 on the initial atom number N 1 . Here, we denote N 1 and N 2 as ensembles of measured atom number outcomes at times t 1 and t 2 respectively. The standard deviations of the distributions are denoted σ 1 and σ 2 respectively. Assuming a linear relationship between N 1 and N 2 , the optimal set of coefficients a and b of the model f (X, β) = aX + b can be found from linear regression analysis for the variables N 1 and N 2 . The parameters minimizing the squared residuals are Here, we have introduced the Pearson correlation coefficient calculated from the covariance of the two random variables. When standardizing the random variables by subtracting their mean and normalizing to the standard deviation, N 1(2),s = (N 1(2) − N 1(2) )/σ 1(2) , the correlation coefficient corresponds directly to the slope of the straight line minimizing the ordinary least squares in the scatter plot. A decreasing correlation coefficient in this case directly reflects the influence of measurement and stochastic noise in the system. Scatter plots of N 2,s vs. N 1,s are shown in Fig. 2 in the main text. To extract the non-linearity measure, we consider non-standardized variables. Here, for a strictly linear relationship, the fraction of remaining atoms p = N 2 / N 1 contains the full information on the dynamics. Therefore, it should hold that a = p in this case. Any deviation from a = p can be interpreted as a non-linearity and leads to increased (a > p) or decreased (a < p) relative variation in the ensemble at time t 2 . On average, a < p (a > p) implies a better (worse) predictive power of a measurement result obtained at time t 1 for a measurement performed at time t 2 . As an example, if the atom loss dynamics has a char-acterṄ ∝ −N α , α > 1, we expect realizations with more atoms initially to lose atoms more quickly. This leads to a value of a < p for later times, as more atoms were lost than expected for a linear process. Therefore, a loss process with α > 1 reduces atom number variation in an ensemble, which has been observed experimentally for a cloud with three-body loss (α = 3) [33] and is consistent with the simulations shown in Fig. 8d.

Unexplained variance
The correlation coefficient quantifies the degree of fluctuation between two random variables which can be explained by a linear model. For stochastic processes such as evaporative cooling or other transport phenomena, the fluctuations due to this randomness are also of interest. Relating measurements of an atom number N 2 at time t 2 to measurements N 1 at time t 1 of the same ensemble can shed light on this process noise, as it appears as fluctuations in N 2 which are not explained by any correlation with N 1 . We can quantify this "unexplained variance" by considering the prediction for N 2 based on the value of N 1 , which is This leads to the following unexplained variance This quantity is minimized for a = ρ 12 σ 2 /σ 1 (see Eq. (9)) and, thus, This expression shows that the correlation coefficient captures the fraction of the total variance explained by the linear relationship, which is subtracted from the total variance to obtain the unexplained variance. We evaluate the fraction of unexplained variance for our data; see Fig. 4.

Unexplained variance for uncorrelated atom loss
In the following, we will derive an expression for σ u assuming a given constant measurement noise σ m and a purely Poissonian ejection mechanism of atoms with corresponding stochastic noise. Under these assumptions, we expect the variance σ 2,th at time t 2 to contain contributions from measurement noise, stochastic noise and variation σ 1 of N 1 . Concretely, we get The second and third term are measurement noise and Poissonian stochastic noise, respectively. The first term reflects the scaled initial ensemble variation, which is obtained from the part of the variation σ 1 which is not originating from measurement noise. The prediction for the correlation coefficient defined in Eq. (11) becomes In the covariance in the numerator, only those parts of the variances without the measurement noise contribute. Note that this is strictly true only outside the correlation time of the measurement noise, which we assume to be white for simplicity. For equal-time measurements, the correlation coefficient equals unity. Using Eq. (15) and Eq. (16), we can get a prediction for the fraction of variance unexplained, This expression shows that the unexplained variance is affected by the initial variance, measurement noise and stochastic noise. Comparing with the expression for the variance σ 2 2,th , we see that the contribution from the initial variance is suppressed for small measurement noise σ 2 m σ 2 1 . For p → 1, the first term approaches σ 2 m , such that the total unexplained variance in this case approaches 2σ 2 m . We compare this model to our data in Fig. 4. The measurement noise σ m is extracted from the Allan deviation shown in Fig. 1e and the initial mean N 1 and standard deviation σ 1 are evaluated from the atom number distribution at time t 1 . The most striking discrepancy is caused by temperature variations: Initially hidden, they are converted to strong atom number variations upon cutting into the thermal distribution. These variations are not expected based on earlier atom number measurements alone. At later times, the unexplained variance approaches the prediction for uncorrelated atom loss. The good agreement between this simple model and our data at late times indicates that technical noise has a negligible impact on our measurements. The convex shape proportional to p(1 − p) of fraction of variance unexplained is masked to a large part by the first term in σ u,th , despite the small imprecision reached by cavityassisted atom number detection.

APPENDIX D: MEASUREMENT PRECISION
In the following, we show that the enhanced atom lightcoupling in an optical cavity is fundamental to highprecision atom counting. Minimally invasive measurements compromise between excess heating and consecutive fluctuations due to the measurement process and a sufficient number of extracted photons to reduce photonic shot noise [25,48,49]. For cavity-enhanced atom counting, we aim to find an optimal observation time as a compromise between averaging down photon shot noise of the detected probe field and probe-induced atom number fluctuations, e.g. by recoil heating or cavity backaction heating [12][13][14][15]. To quantify the photonic shot noise contribution, we use the Lorentzian cavity profile for the photon number n in the cavity n = n max κ 2 κ 2 + δ 2 pc .
Here, n max denotes the on-resonance (δ pc = 0) intracavity photon number and κ is the half linewidth of the cavity. The sensitivity ∆δ pc for determining the cavity-probe detuning as a function of photon noise ∆n is obtained by taking the derivative of Eq. (19) with respect to δ pc , At the side of fringe for δ pc = κ, the sensitivity becomes ∆n n = − ∆δpc κ . Taking into account the detection efficiency of the detection chain, the number of detected photons within a window of integration time τ is n det = 2κn τ . Note that for a heterodyne detector, the detection efficiency effectively reduces by a factor 2 ( → /2) if only the magnitude of the heterodyne signal is used in the detection, as is the case in our, in this sense, non-optimal feedback scheme. Assuming photonshot noise ∆n det = √ n det , we find the uncertainty Using the cavity shift per atom, ∆ 1 , we convert this to an atom number uncertainty In the last step, we have introduced the cooperativity C = g 2 /κΓ for a vacuum Rabi coupling g = d 2 ω a /2 0 V m on the optical transition with frequency ω a and dipole matrix element d and for a cavity mode volume V m . The dependence of the uncertainty on the cooperativity shows the advantage of a cavity-assisted measurement over its free-space equivalent. Furthermore, the fluctuations due to photonic shot noise decrease with the number of scattered photons Γ eff τ . The total number of scattered photons is also responsible for heating the cloud via recoil heating with a rate Γ r , which introduces atom number loss and associated fluctuations in a trap with finite depth. Assuming Poissonian fluctuations in the number of lost atoms within an integration time τ , we model the fluctuations in atom number in a trap with depth U as The proportionality constant α allows to take into account truncation in evaporative cooling. We can add the fluctuations due to atom loss to the photonic shot-noiseinduced fluctuations derived in Eq. (22) and obtain Minimizing the uncertainty with respect to τ , we get at a corresponding integration time We want to minimize both the minimal fluctuations as well as the corresponding integration time. Short integration times correspond to maximal dynamic range for measuring atom number dynamics. We see that both quantities benefit from a cavity with high cooperativity. Also, the dependence on collective cooperativity N C shows that precise cavity-enhanced atom counting is easier to achieve at larger atom numbers. Interestingly, the minimal atom number imprecision does not depend on the effective scattering rate Γ eff . We observe that the minimal atom number imprecision has no fundamental limit, as the ratio E r /U can be reduced by increasing the trap depth, which reduces the loss. If temperature is a relevant parameter in the probed dynamics, a further interesting quantity to take into account is the temperature increase of the gas during the integration time. From the increase in internal energy and assuming equipartition in a two-dimensional harmonically trapped gas, it is given as Taking the product of temperature added and minimal atom number uncertainty, the experiment-specific quantities U and α drop out and we are left with This relation implies that for a given minimal integration time, the energy deposited in the system bounds the atom number imprecision and vice versa. The exact value for the minimal integration time and thus the time resolution of the measurement can be chosen by changing the effective scattering rate, i.e. the atom-cavity detuning ∆ ca in our case. Our observed dependence of the imprecision quantified by the Allan deviation with integration time τ is shown in Fig. 1e, where we find a decrease of the imprecision with increasing integration time for small τ < 1 ms and then an increase for larger τ . We note, however, that there the increase in imprecision is dominated by the dynamically changing mean atom number, which leads to a scaling of the Allan variance with τ 2 . Directly comparing the two cases requires subtracting the known time dynamics of the mean atom number, only keeping the stochastic contribution (∝ τ ) discussed here. While these two effects can always be separated in post-processing even for an unknown dynamical process by subtracting the mean of all traces, this is generally not possible e.g. for applying feedback to a system with unknown atom number dynamics.