Enhancing the Speed and Sensitivity of a Nonlinear Optical Sensor with Noise

We demonstrate how noise can be turned into a resource for optical sensing using a nonlinear cavity. The cavity is driven by a continuous-wave laser into the regime of optical bistability. Due to the influence of fluctuations, the cavity switches randomly between two metastable states. By analyzing the residence times in these two states, perturbations to the resonance frequency of the cavity can be detected. Here, such an analysis is presented as a function of the strength of the perturbation and of the noise. By increasing the standard deviation of the noise, we find that the detection speed increases monotonically while the sensitivity peaks at a finite value of the noise strength. Furthermore, we discuss how noise-assisted sensing can be optimized in state-of-the-art experimental platforms, relying solely on the minimum amount of noise present in the cavity due to its dissipation. These results open up new perspectives for the ultrafast detection of nanoparticles, contaminants, gases, or other perturbations to the resonance frequency of an optical resonator, at low powers and in noisy environments.


I. INTRODUCTION
A sensor is a device that reports a change in its environment. The sensor-environment coupling leads to dissipation, which-according to the fluctuationdissipation theorem [1]-makes the output of the sensor necessarily noisy. This minimum amount of noise places a lower bound on the magnitude of the perturbation that a linear dissipative sensor can detect within a certain time. Additional noise in the sensor or the environment typically degrades the sensing performance further; the measurement time needed to detect a certain perturbation only increases with the noise strength.
In 2002, Gammaitoni and Bulsara introduced a sensor the performance of which can be enhanced by nonlinearity and noise; they called it a noise-activated nonlinear dynamical sensor (NANDS) [2]. The physics of a NANDS is reminiscent of the Brownian particle in a double-well potential (DWP) mastered by Kramers [3]. If the DWP is symmetric, the average residence time of the particle in each well is the same. However, if the DWP is tilted, the residence-time difference (RTD) is nonzero on average. Thus, RTD measurements can be used to detect perturbations affecting the symmetry of the * s.rodriguez@amolf.nl potential. A similar sensing scheme can be realized with noisy nonlinear oscillators. A cubic nonlinearity leads to an effective DWP and noise can make the oscillator switch between two states corresponding to the minima of the DWP [4].
Up to now, the RTD sensing scheme has been successfully employed in the context of magnetic field detection [5,6]. Experiments and calculations on NANDS have focused on configurations involving a periodic modulation of the DWP [5][6][7][8][9][10], where noise plays a secondary role with respect to the periodic force. This is likely the best detection strategy in systems where slow dynamics and weak noise make fully noise-activated sensing too slow or impractical. As shown later, the situation is different for several technologically relevant optical systems.
Linear optical resonators are already well known for their sensing capabilities, which are mainly attributed to their high quality factors, small mode volumes, high operation frequencies, and the possibility of easily and remotely reading out their state with light [11][12][13][14][15][16][17][18][19][20]. Nonetheless, as the size and power budget of optical sensors continue to decrease, noise is playing an increasingly deleterious role in their performance. In this vein, many efforts have focused on realizing nanophotonic sensors with enhanced sensitivities, as expected near exceptional points, for example [21][22][23]. However, as long as those sensors remain linear, time-invariant, and passive, noise stands on the way of exploiting the enhanced sensitivity to detect small perturbations [24][25][26]. These developments suggest that a detection strategy that harnesses rather than avoids noise, as in the RTD scheme, may lead to a new frontier in optical sensing.
Here, we demonstrate how the minimum amount of noise present in a nonlinear optical resonator, as dictated by the fluctuation-dissipation theorem, can be turned into a resource for sensing. The sensing scheme that we propose is based on measuring the RTD without any periodic driving. This scheme can be realized in resonators supporting optical bistability [27][28][29][30][31][32][33], i.e., two steady states with different photon numbers at a single driving condition. We show that optically bistable resonators can be used as sensors with the following remarkable properties: (i) a detection speed that increases monotonically with the standard deviation of the noise and (ii) a sensitivity that is maximized for a particular value of the standard deviation of the noise.

II. A NOISY NONLINEAR OPTICAL CAVITY AS A SENSOR
For concreteness but without loss of generality, we consider a single-mode Fabry-Pérot cavity (see Fig. 1) as our resonator and sensor. The cavity is made of two distributed Bragg reflectors facing each other. One of the mirrors is concave, as experimentally realized in Refs. [34][35][36], for example. The other mirror is planar and is coated with a nonlinear material, leading to optical bistability. Singlemode operation is possible when the radius of curvature of the concave mirror and the resonance line widths are sufficiently small for the transverse cavity modes to be well isolated from each other. In the following, we investigate the dynamics of such a single-mode nonlinear cavity when its resonance frequency is perturbed. The perturbation can be a single nanoparticle entering the cavity's mode volume, as investigated in Ref. [35], for example.
FIG. 1. A single-mode cavity with resonance frequency ω 0 , intrinsic loss rate γ , and Kerr nonlinearity corresponding to effective photon-photon interactions of strength U is driven by a coherent field of amplitude F and frequency ω. κ 1,2 are the leakage rates of the optical mode through the mirrors. The transmitted intensity shows that the cavity switches randomly between two states due to the nonlinearity and the influence of fluctuations. The residence times of the cavity in these two states are highly sensitive to perturbations to the resonance frequency. A nanoparticle is an example of such a perturbation, here labeled as . The cavity is driven by a continuous-wave laser with frequency ω and amplitude F. In a frame rotating at the driving frequency, the dynamics of the intracavity field α are governed by the following equation: (1) = ω − ω 0 is the detuning between the laser frequency and the cavity resonance frequency ω 0 . = γ + κ 1 + κ 2 is the total loss rate, with γ the internal cavity loss rate and κ 1,2 the leakage rates of the cavity field across the mirrors. U is the effective photon-photon interaction strength, associated with the nonlinear material inside the cavity. The term Dξ(t) accounts for white noise, with standard deviation D, in the two quadratures of the light field. The stochastic term ξ(t) = ξ(t) + iξ(t) is a complex Gaussian process with zero mean and is delta correlated, i.e., ξ = ξ = 0 and ξ (t)ξ (t + t ) = ξ (t)ξ (t + t ) = δ(t ). Moreover, ξ and ξ are mutually delta correlated: Let us briefly review the steady-state response of the cavity without noise, obtained by settingα = 0 and D = 0 in Eq. (1). Appendix A describes how to calculate the number of photons in the cavity |α| 2 in steady state and how to assess the stability of those states. Figure 2(a) shows calculations of |α| 2 as a function of F for two different detunings / ; A MATLAB script producing these results is provided as Supplemental Material [37]. For / = 1.0965, the thick black curves represent stable states and the gray dashed curve represents unstable states. The calculation shows that there exists a range of F for which two stable steady states with different photon numbers can be observed at a single driving condition. This phenomenon, known as optical bistability [27], can be observed whenever > √ 3 /2, provided that U > 0. In the bistability, the cavity can reside in either of two steady states depending on the initial conditions and the driving history of the system. Since there is no noise, the residence time of the cavity in either state is infinite. Experimentally, optical bistability can be evidenced by measuring the transmission of a laser through the cavity as a function of the laser power. In this regard, for a given γ , the values of κ 1 and κ 2 can be judiciously selected (e.g., by varying the reflectivity of the mirrors) in order to maximize the cavity transmission [38]. Here, we follow this approach by selecting κ 1 − κ 2 = γ . While such an enhanced transmission can be convenient for experimental implementations of the sensing scheme that we present later, the choice of κ 1,2 is totally irrelevant to the present theoretical work.
In the presence of noise, the cavity can switch randomly between the two states of the cavity with different numbers of photons. To illustrate this switching behavior, we perform stochastic calculations using the XSPDE package [39]. In Fig. 2(b), we plot |α| 2 as a function of time for constant F = 10.57 √ κ 1 , D = √ /2, and for one realization of the noise. The calculations show a bimodal distribution for |α| 2 (see also Appendix B). The peaks of this distribution correspond to two attractors (stable fixed points) in phase space, associated with different average numbers of photons in the cavity. Moreover, the observed switching behavior corresponds to transitions from the basin of attraction of one stable fixed point to the basin of attraction of the other stable fixed point. In view of these dynamical effects, one could say that the states are metastable instead of steady. Metastable-state dynamics have been observed in the transmission of noisy laser-driven cavities a number of times [30][31][32][33]. Midway in the calculations in Fig. 2(b), we introduce a perturbation to the resonance frequency of the cavity. More precisely, the perturbation is set by letting → (1 + ), with = 0.02. Since / is of order one, can be approximately interpreted as the fractional change in the resonance frequency relative to the line width. Note in Fig. 2(b) how the perturbation influences the switching behavior and biases the system toward the low-density metastable state. This biasing can be regarded as a tilting of the effective DWP for the intracavity light field. For reference, the thin blue curve in Fig. 2(a) shows the steady-state number of photons in the perturbed cavity. The biasing of the system toward the low-density state can be inferred from the enhanced proximity of the driving amplitude [vertical dashed line in Fig. 2(a)] to the threshold value for which the system jumps from the upper to the lower branch. Similarities between light confined in a nonlinear cavity and a Brownian particle in a DWP can be recognized in the probability distribution of the complex field α. To calculate such a distribution, we let the system evolve for a long time and plot a histogram of the state of the system as a function of the real and imaginary parts of α. By "long time," we mean that tν 1, with ν the average rate at which the cavity switches between states. For large photon numbers (|α| 2 1) in the bistability region, such a histogram corresponds to the Wigner function obtained through a quantum approach [40,41].
The results of our calculations are shown in Fig. 3(a) for = 0 and in Fig. 3 Fig. 2(b), respectively. Both panels in Fig. 3 display a bimodal distribution indicating bistability. The peaks of these distributions represent the minima of the DWP in Kramers' problem. Note, however, that the effective potential for the light field involves two dynamical variables, namely the real and imaginary parts of α. Comparison of Figs. 3(a) and 3(b) reveals that the perturbation decreases the probability of finding the system in the state around Re[α] = 10.5 and Im[α] = 0, which is the high-density state. This is akin to tilting the DWP toward the low-density state. Note also that the highdensity state has a significantly reduced uncertainty along the real component of α. This squeezing may be exploited for sensing by performing homodyne detection, but we will not comment on this further.

III. SENSITIVITY AND DETECTION SPEED
We would now like to quantify the sensitivity of the cavity to perturbations in . Such perturbations are common in optical sensing settings such as the one illustrated in Fig. 1. Note, however, that the stochastic dynamics of the cavity actually depend on the ratio / [32]. Here, for 024032-3 simplicity, we assume that is unaffected by the perturbation. In the event that such an assumption cannot be made, perturbations that increase both and can be regarded as effectively weaker than those that increase only or . The first step in our sensing protocol is to define a threshold density N th above (respectively, below) which the cavity is said to reside in state N ↑ (respectively, N ↓ ). Appendix B shows how N th can be defined by analyzing the probability density function of |α| 2 . Next, we define residence times τ ↑ and τ ↓ as the time intervals for which the cavity continuously resides in states N ↑ and N ↓ , respectively. For example, in Fig. 2(b), we indicate two events with residence times τ ↑ and τ ↓ and we indicate N th with a horizontal dashed line. Naturally, the random nature of the switching leads to distributions of residence times. Therefore, a reliable detection strategy should be constructed based on the properties of these distributions. In particular, we inspect the time-averaged RTD δτ = τ ↑ − τ ↓ .
In Fig. 4, we analyze how δτ (referenced to the constant τ 0 = [τ ↑ ( = 0) + τ ↓ ( = 0)]/2) scales with the strength of the perturbation . The open circles are the result of numerical calculations for the same parameter values as in Fig. 2(b) and Fig. 3, except that is now varied. For all , δτ is first time averaged based on 4000 residence events and then ensemble averaged over 100 realizations with different noise seeds. By varying the noise seed, we take into account that nominally identical measurements can give slightly different values of δτ in finite time. Most importantly, by varying the noise seed we avoid having the same realization of the noise for any two perturbations; that would enable the detection of arbitrarily small perturbations because the stochastic trajectories of cavity fields with different perturbations would be correlated. Figure 4 shows that δτ scales nonlinearly with . This scaling behavior can be understood by recalling the aforementioned analogy between a noisy Kerr-nonlinear cavity and a Brownian particle in a DWP. As shown by Kramers FIG. 4. The average RTD δτ between the N ↑ and N ↓ states (see Fig. 2) versus the strength of the perturbation in the detuning. δτ is divided by τ 0 = [τ ↑ ( = 0) + τ ↓ ( = 0)]/2, which is the average residence time of the system in states N ↑ and N ↓ at = 0. In this way, changes in δτ relative to the residence times of the unperturbed cavity can be estimated. The gray and black curves are exponential fits to the data as explained in the text. The values of the parameters used in the calculations are given in Fig. 2. [3], the average residence time of the Brownian particle in one well grows exponentially with the ratio of the barrier height to the thermal energy. In our noisy nonlinear optical cavity, the effective barrier height is determined by , which can tilt the DWP as shown in Fig. 3. Therefore, we may expect an exponential scaling of δτ with . To verify this hypothesis, we fit the numerical results in Fig. 4 with a function of the form Ae B + C, with A, B, and C as the fitting parameters. For this purpose, the numerical data are separated into two parts. One part is associated with δτ ≥ 0 and the other part is associated with δτ ≤ 0. This partition is made because the output of the fitting function is strictly non-negative and for the second part δτ ≤ 0. Thus, since we are only interested in the scaling behavior, we let δτ → −δτ for the second part. Figure 4 shows as a gray curve the fit to the part of the data for which δτ ≥ 0 and as a black curve the fit to the part of the data for which δτ ≤ 0. In both cases, the high quality of the exponential fits to the numerical data confirms the following: the signal of our sensor, namely δτ , scales exponentially with the strength of the perturbation . This result stands in stark contrast with the behavior of standard optical sensors, for which the signal (e.g., the change in the number of photons in the cavity) scales linearly with the perturbation. Therefore, relatively large perturbations can be much more easily detected with our nonlinear sensing scheme. Note, however, that δτ is approximately linear for small . Hence, we can fit a line to the data near = 0 in order to estimate a lower bound of the sensitivity S = ∂δτ /∂ . From the slope of the fitted line (not shown), we obtain the lower bound S LB = 138.6 ± 9 s, with the uncertainty corresponding to a 95% confidence interval.
Another important figure of merit is the detection speed. Assessing the detection speed of our stochastic nonlinear cavity is tantamount to answering the following question: how many residence events are needed to detect a certain perturbation? In Fig. 5, we illustrate how this question can be answered, taking a tiny perturbation of = 0.003 as an example. Figure 5(a) shows several calculations of δτ as the number of residence events involved in the timeaveraging increases. The black and blue lines correspond to unperturbed ( = 0) and perturbed ( = 0.003) cavities, respectively. Various lines of the same color correspond to nominally identical configurations but with different realizations of the noise ξ(t) obtained from different seeds. The results in Fig. 5(a) show how, as the number of residence events involved in the time averaging increases, the spread in the values of δτ decreases. For t → ∞, all values of δτ for a given converge to a single value indicated by a thick horizontal line. The long-time difference in δτ with and without perturbation is determined by the aforementioned sensitivity.
The number of residence events needed to detect = 0.003 with a single noise realization can be determined by comparing two quantities: (i) the change in the average RTD due to the perturbation, i.e., δτ 0 − δτ ; and (ii) the sum of the standard deviations of the RTD distributions, i.e., σ + σ . We recall that each element of the RTD distributions is associated with a different noise seed. A simple criterion for detection can be |δτ 0 − δτ | > (σ 0 + σ ). This corresponds to a shift in δτ that is greater than the sum of the uncertainties. Using this criterion, Fig. 5(b) shows that = 0.003 can be detected with approximately 1000 residence events or more. Note that we adopt a stringent criterion for the detection threshold. A reliable detection strategy can still be constructed with significantly fewer residence events, provided that we accept larger probabilities of false alarm and missed detection [42].
In the following, we show how the sensing performance of the cavity depends on the standard deviation of the noise D. To this end, we vary D without adjusting . This enables us to demonstrate that the minimum amount of noise imposed by the fluctuation-dissipation relation is sufficient to enhance the performance of the sensor. Otherwise, if we were to adjust according to D in order to always satisfy the fluctuation-dissipation relation, the laser amplitude F needed for bistability would change. Consequently, the number of cavity photons in the metastable states would also change. All of these changes would make it difficult to reveal how the sensing performance depends on the noise. Hence, we take a pragmatic approach and vary D alone, with the understanding that: (i) D > √ /2 simply corresponds to a physical system with more noise than that imposed by the fluctuation-dissipation relation; and (ii) while D < √ /2 is not physically possible, it is a convenient theoretical parameter regime (widely used to describe deterministic systems) allowing us to reveal the minimum amount of noise needed for our detection strategy to succeed. In Fig. 6 Fig. 5(b), seems to suggest that the sensing performance of our nonlinear cavity improves indefinitely with the addition of noise. However, this is not the case because the sensitivity also depends on the noise. In Fig. 7, we plot (δτ 0 − δτ )/(σ 0 + σ ) as a function of D/ √ /2, for a fixed measurement time 2 × 10 5 −1 .
As before, we take = 0.003 as an example. Recall that |δτ 0 − δτ | is proportional to the sensitivity and |δτ 0 − δτ | > (σ 0 + σ ) is the detection threshold we previously defined. According to the results in Fig. 7 is exactly the minimum amount of noise in the cavity demanded by the fluctuation-dissipation relation. Moreover, for D = √ /2, the average residence time at the center of the bistability, where τ ↑ = τ ↓ , corresponds to the so-called quantum-tunneling time of bistability [32]. Details on how to calculate this tunneling time based on a quantum-master-equation approach can be found in Refs. [41,43].
To understand why the sensitivity peaks for a finite amount of noise, consider the behavior of the system for extreme values of D. For D → 0, the number of residence events within the measurement time decreases. Consequently, σ + σ increases and the presence of a small perturbation becomes increasingly uncertain. Conversely, for large D the residence time becomes too short. Effectively, this can be associated with a potential barrier that is too small. Such a small barrier makes it practically impossible to detect perturbations affecting the symmetry of the potential. In particular, the sensitivity is degraded when the height of the barrier is much less than (i) the change in energy between the minima of the DWP due to the perturbation and (ii) the average energy in the fluctuations. Hence, a finite amount of noise is needed for a detection strategy based on RTDs to succeed.
In practice, a system can be operated with the optimum amount of noise either by injecting noise or by judiciously selecting the laser intensity and the laser-cavity detuning. The laser power and detuning determine the number of photons involved in the bistability, which in turn determines the average residence times. Thus, by varying the laser parameters one can effectively adjust the potential barrier. Note also that the overall optimum amount of noise does not need to coincide with the peak sensitivity. For instance, the results in Figs. 6 and 7 show that increasing D/ √ /2 from 0.8 to 1.2 degrades the RTD shift by approximately 7%, while the number of residence events that can be acquired within a fixed measurement time increases by approximately 460%. Correspondingly, the amount of noise optimizing the overall performance of the sensor is above the value for which the sensitivity peaks.
In order to connect our proposal with a potential experimental realization, we would like to specify parameter values that may be achieved using present-day technologies. For example, consider a cavity with a resonance frequency ω 0 = 360 THz, a total loss rate = 10 GHz, and U/ = 0.01; these values are typical for III-V semiconductor cavities in Refs. [32,33,44,45]. The calculations in Figs. 2-7 are all done for U/ = 0.01, so we can immediately read out the corresponding time scales. In particular, in Fig. 5 we note that a perturbation of = 0.003 can be detected with approximately 1000 residence events, using the minimum amount of noise present in the cavity due to the dissipation. For a switching rate of 10γ , which can be achieved in the range 0.9 / 1, we conclude that a tiny shift in the resonance frequency that is approximately 0.3% of the line width can be detected within a measurement time of approximately 10 ns. Larger perturbations (still on the order of a few percent of the resonance line width) that make the system depart out of the bistability can be detected with fewer residence events, since the system will stop switching. For the parameter values we consider, this means that perturbations of a few percent of the resonance line width can be detected within approximately 0.1 ns.
In our analysis so far, we have not mentioned the fact that the residence times also depend on the strength of the photon-photon interactions relative to the dissipation, i.e., U/ [32]. As U/ decreases, the number of photons involved in the bistability increases. Consequently, residence times for fixed / will be longer at the center of the bistability. This is not a problem for our sensing scheme, as long as greater laser power is available and the frequency of the laser or the cavity resonance can be tuned. As shown in Ref. [32], for small detunings ( / ∼ 0.9) residence times at the center of the bistability are all on the order of 10 −1 for vastly different values of U/ . Thus, our sensing scheme can be realized in systems with vastly different, albeit finite, nonlinearity. The validity of our model is only expected to break down for extremely strong nonlinearity, i.e., U/ ∼ 1. In those cases, our mean-field equation plus stochastic terms (the so-called truncated Wigner approximation [46]) is no longer valid, and a full quantum-master-equation approach is needed.

IV. CONCLUSION AND PERSPECTIVES
In conclusion, we propose a noisy nonlinear optical cavity as a reliable and ultrafast sensor. Such a sensor can be used to detect perturbations to the resonance frequency of the cavity. The detection speed of this sensor increases with the noise strength, while its sensitivity peaks for a particular noise strength. This unusual dependence of the sensing performance on noise may open up new possibilities for sensing at low optical powers and in noisy environments. Noise-assisted optical sensing can be used to detect nanoparticles, contaminants, biological entities, or gases, affecting the resonance frequency of an optical resonator, for example.
For concreteness, we focus the discussion on a Fabry-Pérot cavity. However, our results hold for any singlemode nonlinear optical resonator. For example, microdisks [17], ring resonators [28], and photonic crystal cavities [29] have all displayed optical bistability at room temperature. Alternatively, an overdamped optically levitated nanoparticle [47] can also display bistability. These systems are therefore suitable candidates for realizing the sensing scheme in this proposal. One should note, however, that in some of these systems bistability emerges from a slow nonlinear response-due, for example, to thermal effects. In those cases, the sensing scheme proposed herein can still be realized but the noninstantaneous character of the nonlinearity [48] will limit the operation speed of the sensor.
Beyond single-mode physics, our approach could also be implemented in systems involving two or more modes. Such systems could display regimes with greater sensitivity than single-mode systems. For example, one could drive a coupled-cavity system, as demonstrated in Ref. [49], into parametrically unstable [50,51] or symmetry-breaking [52,53] regimes. Optomechanical systems involving coupled optical and mechanical modes constitute yet another interesting possibility for noise-assisted sensing. This possibility is appealing given the great current interest in optomechanical systems and the known equivalence between optomechanical systems and Kerr nonlinear resonators [54,55]. Finally, parametric driving of a nonlinear oscillator [56] is another interesting possibility that could be combined with the RTD strategy to achieve greater sensitivity.

ACKNOWLEDGMENTS
I am grateful to Javier del Pino for critical comments and to Zhou Geng and Kevin Peters for stimulating discussions. This work is part of the research program of the Netherlands Organisation for Scientific Research (NWO). I acknowledge financial support from NWO through a Veni Grant No. 016.Veni.189.039.

APPENDIX A: STEADY STATES AND STABILITY ANALYSIS
We calculate the steady-state solutions to Eq. (1) with D = 0 by settingα = 0. Next, we multiply the resultant equation with its complex conjugate and obtain where N = |α| 2 is the mean number of photons in the cavity. Equation (A1) is a third-order polynomial in N . Hence, we may expect three solutions corresponding to the roots of that polynomial. However, because of the requirement that N be real, not all solutions may be physical. In fact, one finds that the system may support either one or three steady states depending on the parameters ( , , U, and F).
Having found the mean number of cavity photons in steady state, N SS , we proceed to assess the stability of those states as done, for example, in Ref. [57]. For this purpose, we first need an expression for the complex steady-state field α SS . Such an expression can be obtained by recalling the relation α = √ N e iφ , where φ is the phase of the intracavity field. Replacing α with √ N e iφ in Eq. (1) and settinġ α = 0 and D = 0, we obtain Thus, we can construct α SS = √ N SS e iφ SS by first finding the real roots of Eq. (A1) to get N SS and then inserting N SS in Eq. (A2) to obtain e iφ SS .
We are now in a position to assess the stability of the steady states corresponding to the fields α SS . To this end, we consider the dynamical effect of adding a small fluctuation δα to α SS , i.e., We are interested in the time evolution of the fluctuation δα and its complex conjugate δα * . To get the equation of motion for δα, we insert the above expression forα in Eq.
(1) and retain terms that are linear in δα only. Similarly, to get the equation of motion for δα * , we insertα * in Eq. (1) and retain terms that are linear in δα * only. Consequently, we arrive at the coupled equations which has solutions of the form where η and λ are the eigenvectors and eigenvalues of A, respectively. Hence, we need to solve the eigenvalue problem

APPENDIX B: DEFINITION OF N th
Here, we explain how the threshold density N th , separating the states N ↑ and N ↓ , can be defined. To this end, we need a long trace of the transmitted intensity by the cavity, proportional to |α| 2 . By creating a histogram of events with different values of |α| 2 , we can calculate a probability density function of |α| 2 as shown in Fig. 8. The values of the model parameters used in the calculations of Fig. 8 are the same as those reported in the caption of Fig. 2. The results in Fig. 8 show a bimodal distribution, corresponding to bistability. Between the two peaks there is a local minimum in |α| 2 . This local minimum maps to the peak of the potential barrier in the DWP description. We therefore ascribe the value of |α| 2 at this minimum to N th .

APPENDIX C: COMPARISON TO LINEAR OPTICAL SENSING
Here, we compare the sensing performance of linear and nonlinear cavities. Using a linear cavity, a perturbation can be detected by recording the transmitted intensity T ∝ N at a single driving condition. A scan of is unnecessary, since it does not provide more information than an FIG. 8. The probability density function of the number of photons in the cavity, for the same parameter values as given in Fig. 2, with = 0. The vertical dashed line indicates a local minimum. This minimum corresponds to the threshold density N th above (respectively, below) which the system is said to reside in state N ↑ (respectively, N ↓ ).
optimal single-frequency measurement [25]. Moreover, for a sufficiently long measurement time τ m , there is in principle no limit to the magnitude of the perturbation that can be detected. Therefore, we are ultimately interested in the detection speed of the sensor.
To illustrate how the detection speed can be assessed in the linear case, we follow a similar approach to the one that was used to produce the results in Fig. 5. However, while for the nonlinear cavity δτ is the signal, for the linear cavity N is the signal. To ease comparison between the two sensing schemes, we perform linear calculations using the same parameter values as used for the calculations in Fig. 5 (reported in the Fig. 2 caption), except of course U = 0. In particular, for all calculations we set κ 1 = 1 s −1 , κ 2 = 2κ 1 /3, = 2κ 1 , F = 10.57 √ κ 1 , / = 1.0965, and D = √ /2, and we consider a perturbation of strength = 0.003. Figure 9(a) shows several calculations of the photon number in the unperturbed and perturbed cavities, N 0 and N respectively. N 0 and N are plotted as a function of the measurement time τ m , which is the time over which a measurement of N is averaged. The black and blue lines correspond to unperturbed ( = 0) and perturbed ( = 0.003) cavities, respectively. Various lines of the same color correspond to nominally identical configurations but with different realizations of the noise ξ(t) obtained from different seed. Note in Fig. 9 how the spread in the values of N decreases as τ m increases. As τ m → ∞, all values of N for a given converge to a single value indicated by a thick horizontal line.
The time needed to detect = 0.003 with a single noise realization can be determined by comparing the time evolution of two quantities: (i) N 0 − N averaged over different noise realizations and (ii) σ + σ , i.e., the sum of the standard deviations of N 0 and N . Similar to the nonlinear case, we can take |N 0 − N | > (σ 0 + σ ) as a criterion for detection. This corresponds to a shift in N exceeding the sum of the uncertainties. Using this criterion, the results in Fig. 9(b) show that = 0.003 can be detected with τ m ∼ 15000 −1 .
Let us now compare the value of τ m obtained above with the corresponding time needed to detect = 0.003 using a nonlinear cavity. Figure 5(b) shows that 1000 residence events are needed to detect the perturbation = 0.003. In addition, Fig. 6 shows that the average residence time for = 0 is τ 0 = 32 −1 , for the particular noise strength D = √ /2 that we take. Consequently, the measurement time needed for the nonlinear sensing scheme to succeed in this task is τ NL m ∼ 32000 −1 . Thus, the nonlinear cavity is approximately twice as slow as the linear cavity in detecting this small perturbation and using the minimum amount of noise imposed by fluctuation-dissipation relation.
While the above results may seem discouraging for employing the nonlinear sensing scheme, we would like to stress that the comparison has been done without optimizing parameter values. In particular, the following factors need to considered. First, the scaling of the signal δτ with is approximately linear for the small perturbation that we consider, as Fig. 4 shows. Therefore, we do not exploit the exponential scaling of δτ with in the nonlinear sensing scheme. This exponential scaling can be advantageous for greater perturbations. Second, the key feature of the nonlinear sensing scheme is its unusual dependence on noise. In particular, Fig. 6 shows that the average residence time decreases to τ 0 = 15 −1 when D/ √ /2 increases from 1.0 to 1.3. Meanwhile, the sensitivity is only marginally affected as shown in Fig. 7. In stark contrast, for a linear optical sensor the measurement time only increases with D. Therefore, it is plausible that for a different set of parameters, the measurement time τ m using the nonlinear cavity can be shorter than that of the linear cavity. A third point of attention is that the strength and speed of the nonlinearity, as well as noise, can be leveraged to decrease the measurement time in the nonlinear scheme. For instance, a slow (e.g., thermo-optical) nonlinearity can make residence-time distributions narrower by suppressing fast switching events. Such a high-frequency cutoff could potentially make residence-time distributions narrower, and the detection of a perturbation faster, in the nonlinear sensing scheme.