Normalizing Flows and the Real-Time Sign Problem

Normalizing flows have recently been applied to the problem of accelerating Markov chains in lattice field theory. We propose a generalization of normalizing flows that allows them to applied to theories with a sign problem. These complex normalizing flows are closely related to contour deformations (i.e. the generalized Lefschetz thimble method), which been applied to sign problems in the past. We discuss the question of the existence of normalizing flows: they do not exist in the most general case, but we argue that exact normalizing flows are likely to exist for many physically interesting problems, including cases where the Lefschetz thimble decomposition has an intractable sign problem. Finally, normalizing flows can be constructed in perturbation theory. We give numerical results on their effectiveness across a range of couplings for the Schwinger-Keldysh sign problem associated to a real scalar field in $0+1$ dimensions.


I. INTRODUCTION
Monte Carlo methods, applied to lattice quantum field theory, are unique in providing nonperturbative access to observables in QCD and other field theories. These methods are not, however, equally applicable to all theories and observables. In particular, when applied to theories with a finite density of relativistic fermions, or to observables involving real-time evolution, lattice Monte Carlo methods are afflicted by the so-called sign problem. This obstacle to computing quantum real-time dynamics has persisted for a considerable time, and is a central motivation for the use of quantum computers in high energy and nuclear physics.
Lattice methods work by framing the observable to be computed as a ratio of high-dimensional integrals. Spacetime is discretized, and Feynman's path integral becomes a finite-(but large-) dimensional integral. For many theories, this procedure results in a probability distribution over field configurations, which can be importance sampled with Markov chain Monte Carlo methods. However, in the case of a finite density of relativistic fermions, or nonequilibirium calculations, the Boltzmann factor e −S is generally complex, and cannot be treated as a probability distribution. In such cases, a standard approach is to sample according to the "quenched" Boltzmann factor e − Re S , and include the phases by reweighting. The cost of reweighting is generically exponential in the spacetime volume of the system being simulated.
Recent work has introduced normalizing flows as a tool for accelerating Markov chain Monte Carlo methods [1][2][3][4][5]. The idea is to construct (usually training by gradient descent) a generative model that samples approximately according to the lattice Boltzmann factor. Either by reweighting or by using the model to create proposals for a Markov chain, the systemic bias of training is removed. This method is particularly anticipated to reduce the cost associated with the approach to the continuum limit ("critical slowing down").
Normalizing flows, as usually formulated, are not directly helpful for the sign problem: a generative model necessarily models a real probability distribution, rather than the complex weights associated to lattice models with a sign problem. In this paper, we show how normalizing flows may be generalized to alleviate or remove a sign problem. The core of this idea is the observation that a normalizing flow, suitably generalized, implicitly defines an integration contour along which the sign problem may be alleviated or removed. These complex normalizing flows are thus in the same family of methods as the Lefschetz thimble approach [6], the generalized Lefschetz thimble method [7,8], and the search for signoptimized manifolds [9][10][11][12].
Complex normalizing flows exist only when a manifold is available that exactly solves the sign problem. We discuss the conditions under which such perfect manifolds exist. By modifying the holomorphic gradient flow of [7,13], we argue that locally perfect manifolds, on which there are no local fluctuations of the phase of the Boltzmann factor, always exist. These manifolds may nonetheless possess a global sign problem: different components of the manifold, separated by singularities of the action, may contribute with the integral with different phases, and therefore (partially) cancel. Conditioned on a mild conjecture regarding the dependence of locally perfect manifolds on the parameters of the action, we argue that globally perfect manifolds are likely to exist for a broad class of physical systems, including the Schwinger-Keldysh sign problem.
When a manifold is available that merely approximately solves the sign problem, an approximate normalizing flow exists. A simple physical argument suggests that for many problems of physical relevance, manifolds that approximately solve the sign problem (with the approximation getting better in the infinite volume limit) should be available.
We also find that the tool of normalizing flows results in a method for perturbatively approximating signproblem-ameliorating integration contours, as well as a new approach for machine learning of such contours (a prospect previously explored in [9,10,12,14,15]). We explore the in-practice effectiveness of the perturbatively constructed flow with numerical experiments on modest 0 + 1 lattices. This method does not appear to have scaling properties that would allow it to be used, at least without serious improvement, in higher-dimensional theories.
Finally, a perturbative view of normalizing flows gives rise to a method of computing lattice expectation values by solving a certain high-dimensional first-order partial differential equation. We demonstrate this method on lattice scalar field theory. Unfortunately, this is mostly a curiosity, chiefly because the practical algorithm for solving the differential equations represents an uncontrolled approximation. On theories with no sign problem, the fact that reliable error bars are not available renders it inferior to standard methods; on theories with a sign problem, solving the differential equation turns out to be hard in practice (for reasons apparently closely connected to the sign problem itself).
The remainder of this paper is structured as follows. In Sec. II we describe the lattice Schwinger-Keldysh formalism and the origin of the sign problem. Sec. III details the generalization of normalizing flows to the complex setting, and shows how they relate to contour integrals and the generalized thimble method. We discuss the question of the existence of complex normalizing flows (and correspondingly, manifolds that solve the sign problem) in Sec. IV; the notions of "global" and "local" sign problems are defined here. Perturbative constructions of complex normalizing flows are given in Sec. V, with numerical experiments characterizing their effectiveness. Finally, Sec. VI outlines future avenues to explore.

II. LATTICE SCHWINGER-KELDYSH
The lattice Schwinger-Keldysh method was introduced in [16,17], for use with the generalized Lefschetz thimble method, as a formalism for computing real-time observables -that is, observables where the operators have some time separation. The Schwinger-Keldysh action is readily derived by considering a lattice field theory in the Hamiltonian formulation. We are interested in a timeseparated observable, of the form O(t)O(0) , with the expectation value taken in a thermal ensemble of inverse temperature β. Removing time-dependences from the operators, this expectation value can be written The ordinary lattice path integral involves only the imaginary-time operator, e −βH . That operator is split up into a product of many e −aτ H , each of which is Trotterized. Resolutions of the identity are inserted between each pair of operators, resulting in an integral over all (discrete) paths of field configurations. The Schwinger-Keldysh path integral does not differ in its derivation. After all time-evolution operators (whether real or imaginary) are Trotterized and the field integrals inserted, the expectation value is given by with the (Euclidean) action, in the case of a single real scalar field, Here m is the bare mass and λ the coupling. Because some of the Trotterized time-evolution operators were imaginary time and others were real time, the timelike lattice spacing a 0 is taken to vary over the lattice. In this paper we will take it to be defined by the "S-contour", although other choices are possible: Here N t and N β denote the number of real-time and thermodynamic time evolution steps, respectively. This choice of action is equivalent to an O(a 2 0 ) Trotter approximation to e −βH/2 e iHt e −βH/2 e −iHt .
If there were no timeslices with Im a 0 = 0, the action would be real. In that case, the Metropolis method gives an algorithm by which the computer can sample from the probability distribution proportional to e −S . Expectation values with respect to that distribution correspond to physical expectation values.
As things are, the action is not pure real, and the Boltzmann factor does not correspond to any probability distribution -at least, not any distribution of real-valued fields. The standard approach at this point is to sample with respect to the quenched Boltzmann factor e − Re S , and then reweight, computing observables as Here · Q denotes an expectation value with respect to the quenched distribution. The denominator, e −iS I Q , is known as the average phase, and characteristically decays exponentially in the spacetime volume of the system. A simple but robust argument shows that this exponential decay is a generic phenomenon. The average phase can be written as a ratio Z/Z Q of the physical partition function to the quenched partition function Z Q ≡ e − Re S . The physical partition function, in the large volume limit, behaves thermodynamically as the exponential of the (extrinsic) free energy, and therefore scales as e f V , with f the free energy density. The quenched partition function describes some (less interesting) thermodynamic system, and is therefore expected to have the same scaling, but with a different exponent: e f Q V . Thus, the ratio will exponentially decay. This can be avoided only when f Q = f exactly: when there is no sign problem at all. The real-time portion of the Schwinger-Keldysh contour gives the action an imaginary part. Note that fields along the real-time portion of the contour do not contribute at all to the real part of the action. Along those directions, importance sampling has no effect and the sign problem is maximally bad -this is generic to all field theories. Specially to scalar field theory, because the domain of the path integral has infinite measure, the quenched partition function does not converge and the average phase is exactly zero.

III. NORMALIZING FLOWS AND CONTOUR INTEGRALS
We begin by introducing normalizing flows in the case of a theory with no sign problem. To accelerate the process of sampling from the Boltzmann distribution e −S , we can look for a mapφ(φ) with the property The mapφ (termed a normalizing flow 1 in the machine learning literature) transforms a Gaussian distribution, which can be sampled from efficiently, to the physical distribution desired. The normalization constant N is inserted to account for the fact that the partition function Z is generically not equal to the Gaussian integral. If the flowφ(φ) is exact, it allows expectation values to be computed directly (and is referred to as a trivializing map). A flow which is merely an approximation induces an effective action on the fieldsφ which is unequal to the desired physical action: where φ is the preimage ofφ under the normalizing flow. To compute the correct expectation values, we must reweight by computing a ratio of expectation values: where · n denotes an expectation value with respect to the normal distribution over φ. In practice, it is often more efficient to use the normalizing flow to generate proposals for a Markov Chain instead -the distinction will not matter here. This procedure can begin with any easily sampled distribution. The use of a Gaussian is a convenient choice when the domain of integration is R N . For compact domains of integration, a uniform distribution is likely to be a more convenient starting point.
Note also that normalizing flows compose. Given a sequence of distributions p 1 , . . . , p k , and k − 1 normalizing flows transforming p i to p i+1 , the composition of those normalizing flows transforms p 1 to p k . This compositional property is preserved by the complex normalizing flows defined below.
This method is clearly not directly applicable to models with a sign problem. The normalizing flow induces an effective action on the physical fieldsφ which is always real 2 , and therefore will never match the physical action S[φ]. We can construct a normalizing flow for the quenched action Re S[φ], but this will at most lead to a polynomial speed up in an exponentially slow algorithm 3 .
Instead, inspired by the generalized thimble method, we can allowφ(φ) to map real trivial fields φ ∈ R N to complex-valued physical fieldsφ ∈ C N . We dub such a construction a complex normalizing flow. The condition Eq. (6) remains the same; to guarantee equality of expectation values, we will see that additional constraints on the behavior ofφ are needed.
Assuming for the moment that Eq. (6) holds exactly, let us see what expectation values are computed.
Although the integrand is the desired one, the domain of integration is incorrect. The physical expectation value O is obtained by an integral over the real plane R N ⊂ C N . The domain of integration used in Eq. (9) is the image of R N under the mapφ. In order for the two integrals to be guaranteed equal, we must require the following: • The Boltzmann factor e −S[φ] is holomorphic, as is the product with the observable e −S O [18].
• The contours R N and M are connected by a homotopy; that is, there exists a continuous fam- Implicit in the last condition is the requirement that, when the complexified domain is not compact, the asymptotic behavior of the manifold at infinity not change. A change in this asymptotic behavior is considered equivalent to the manifold passing through the singularity at infinity. From the conditions for equality above, it is clear that a complex normalizing flow induces a manifold of integration M of exactly the sort used in the generalized thimble method. For an exactly normalizing flow, the integration along this manifold exhibits no sign problem. Therefore, (exact) complex normalizing flows exist only if there is a manifold which exactly solves the sign problem. In fact, as discussed in Sec. IV E below, the converse holds as well: the existence of a manifold with no sign problem implies the existence of an exact normalizing flow.
In cases where the complex normalizing flow is not exact, reweighting is used to recover the precise expectation values as usual. This will generally be necessary throughout the numerical methods explored in this paper.

IV. EXISTENCE
A theory of complex normalizing flows does little good if such flows do not exist for problems of physical interest. The section is devoted to investigating when complex normalizing flows exist. Although in no (non-trivial) case can we show that normalizing flows certainly exist, the evidence suggests that such flows are more likely to exist in the case of bosonic (including real-time) sign problems than in the case of fermion sign problems.
First, we construct manifolds that entirely remove local phase fluctuations, leaving only global cancellations between different parts of the manifold of integration. This construction uses the holomorphic gradient flow (often used to approximate or define Lefschetz thimbles), defined and characterized in Sec. IV A. The existence of locally sign-free manifolds is argued for in the subsequent section. In Sec. IV C, we conjecture that locally perfect manifolds behave smoothly as parameters of the action are varied; using this conjecture we argue that perfect manifolds exist for the Schwinger-Keldysh sign problem in scalar field theory. Several examples, where sign-free manifolds can either be found explicitly or shown not to exist at all, are given in Sec. IV D; these examples suggest a pattern in which sign-free manifolds generically exist for bosonic, but not fermionic, sign problems. Finally, in Sec. IV E, we use well-known results regarding normalizing flows in the real setting to conclude that, conditional on a perfect manifold existing, a complex normalizing flow must exist.

A. Holomorphic Gradient Flow
The holomorphic gradient flow is a first-order differential equation used to approximate Lefschetz thimbles [7,13]. Lefschetz thimbles are the surfaces of steepest descent of Re S proceeding from critical points of the action. A certain union of the thimbles can be shown to yield the same integral as the real plane R N . Because the thimbles are generically sub-optimal in terms of the sign problem, we will ignore them and focus on the behavior of the flow itself. The key result is that, when a Boltzmann factor has local phase fluctuations on the real plane, the holomorphic gradient flow can always be used to find a nearby manifold with an improved sign problem.
The holomorphic gradient flow is defined by Here the partial derivative ∂ ∂z denotes the usual holomorphic derivative (i.e. the Wirtinger derivative). We will assume throughout that the action S is holomorphic in the field variables z. This differential equation governs the evolution of a field configuration z through complex space. When applied to all field configurations in a manifold, we obtain a family of manifolds parameterized by the flow time t. Note that the flow time is purely fictional, and is unrelated to the physical time (represented as part of the lattice).
Considering the evolution of the field equation, note that the imaginary part of the action never changes, and the real part can only increase (or remain the same, if we begin at a critical point): This can be taken as a motivation for the holomorphic gradient flow, as by increasing the real part of the action, we may hope to decrease the quenched partition function and improve the average phase. Following this observation, it is convenient to work with the real part of the action u ≡ Re S.
The flow Eq. (10) is most frequently applied to manifolds beginning from the real plane (R N ⊂ C N ). Let us examine its behavior at early times. Note that, as a consequence of Cauchy's integral theorem, the partition function itself will not be changed by the flow [19]; only the quenched partition function will change. The change in the quenched partition function is given by where we have chosen to parameterize the infinitesimally flowed manifold z(x) by the real plane. Because the domain of integration is unchanged, being the parameterizing real plane for any t, we may proceed to inspect the derivative of the integrand.
We have already seen that du dt = | ∂S ∂z | 2 is guaranteed to be non-negative, and positive away from a critical point. The Jacobian term, however, may be larger than the guaranteed-negative term, resulting in a worsening sign problem with flow time t. Empirically, this is indeed the case at sufficiently long flow times: the average phase is maximized at some intermediate t, rather than in the limit t → ∞. Beginning from the real plane, however, the Jacobian is the identity, and we find The real part reduces to i Consider each i independently. Each term is very nearly a total derivative, since To connect the two expressions, observe that the magnitude of the derivative of the action can be written where v ≡ Im S. As a result, we find that the change in the quenched partition function, when starting from the real plane 4 , is 4 The same argument applies to any flat manifold. This is never positive; hence, the sign problem is always improved by a small amount of flow from the real plane. Moreover, as long as the imaginary part of the action is non-constant on the portion of the real plane where e −u is nonvanishing, a small amount of flow will make the quenched partition function strictly smaller. This is the key result regarding the holomorphic gradient flow: when beginning from the real plane, if Im S is not constant where Re S is finite, a small amount of flow is guaranteed to improve the sign problem.
One other property of the holomorphic gradient flow is of interest: regions of C N at which Re S diverges (becoming large and positive) act as attractors. The flow will collide with these singularities in a finite flow time. This does not cause the evolution of the manifold itself to be ill-defined. The manifold will be continuous, but not smooth, where it intersects singularities of the action. Because the Boltzmann factor vanishes at these singularities, the manifold's behavior there contributes neither to the integral nor to the sign problem.

B. Existence of Locally Perfect Manifolds
The holomorphic gradient flow is not guaranteed to result in a perfect manifold at asymptotically large times. The asymptotic manifold under this flow is a union of Lefschetz thimbles. Two features of the Lefschetz thimbles contribute a nonvanishing sign problem. First, on each thimble Im S is constant, but different thimbles generically have different values of Im S. Thus, cancellations occur between different thimbles, which may become severe when multiple thimbles have similar quenched weights. Second, although Im S is constant, the phase in the integral is actually Im S − Im log det J, with the Jacobian term coming from the integration measure dz. Each thimble, therefore, comes with local phase fluctuations, which have been found to become severe on large lattices [20].
These two problems are sometimes contrasted and referred to as "global" vs "local" sign problems. An example of an unremovable global sign problem was given in [19]: the one-dimensional integral (cos θ + )dθ, for small , cannot have its sign problem repaired by any contour deformation. Local sign problems, in contrast, have been found to be removable even where the thimbles fail. In the heavy-dense limit of the Thirring model, numerical experiments show that the flow results in a suboptimal manifold even when a perfect manifold does exist [20].
We will see in this section that local sign problems are always removable; that is, a piecewise-smooth contour exists along which there are no locally fluctuating phases, but there may be cancellations between different pieces. Combined with the observation above that at least some global sign problems are unremovable, this indicates that the distinction is well defined. Sign problems can be decomposed into a local and global part, with the local part fixable by an appropriate choice of integration contour, but the global part requiring more drastic manipulations. Now we turn to a procedure, based on the holomorphic gradient flow, for removing local sign problems. Begin with M 0 = R N ⊂ C N , and flow for a small amount of time . This defines a manifold M 1 , parameterized approximately viaφ (In this discussion, for illustrative purposes, we will expand to linear order in the flow time , as if a discrete jump was made. To treat the zeros of e −S correctly, it is important to perform a proper evolution by the flow equation instead.) By the argument in the previous section, the quenched partition function on M 1 is no larger than that on M 0 ; moreover, if M 0 = M 1 , then the quenched partition function is smaller. Consider the effective action S 1 induced byφ 1 ; this is a function from R N to the complex numbers. We would now like to flow with respect to this effective action. Doing so would guarantee that the sign problem once again improves. In order for this to make sense, however, S 1 must be holomorphic. Naively, it appears not to be. In particular, its definition includes the explicitly antiholomorphic term ∂S ∂φ , preventing us from repeating the last step.
This is a fiction. First considerφ 1 (φ) as defined in Eq. (19). As written, it appears to contain both a holomorphic and an antiholomorphic term. However, the only aspect ofφ 1 we care about is its definition on R N . Functions R N → C are neither holomorphic nor antiholomorphic; as long asφ 1 is sufficiently smooth, it can be analytically continued into the complex plane in a purely holomorphic way. Concretely, we can replace Eq. (19) bỹ that is, we evaluate the function ∂S ∂φ atφ. This parameterizes exactly the same manifold (as the two functions agree on R N ), but also defines a holomorphic map when evaluated on the rest of the complex plane. Now we return to the effective action, which after one step is given by As initially defined, this is an analytic function of the real plane alone. As withφ 1 , we can choose its behavior in the complex plane to be holomorphic, at least in some region around the real plane. We can now flow the real plane again, this time with respect to S 1 . As before, this is guaranteed to improve the sign problem. We obtain a functionφ 2 which maps the real plane (the domain of S 1 ) to some slightly deformed contour. Composingφ 2 •φ 1 yields a map from the domain of the original action S to a deformed contour. Thus, we obtain a new integration manifold M 2 =φ 2 •φ 1 (R N ), which induces an effective action S 2 , and we repeat. At every step of this modified flow, we have the freedom to arbitrarily reparameterize the integration manifold. There is no requirement that the parameterizations be "connected" from one step to the next. This means that the evolution of the manifold from step to step is non-unique.
What can happen to the manifold in the limit of a large number of steps? As long as the manifold is changing, Z Q is shrinking; this implies that we cannot reach a cycle. The development of some singular behavior, unremovable by reparameterization, could require us to take ever-smaller steps . We do not have a formal proof forbidding this; however, numerical experience with the holomorphic gradient flow indicates that it does not create singularities away from zeros of the Boltzmann factor. The last possibility is a fixed point: subsequent manifolds are ever-better approximations (or perhaps equal) to a manifold M f which is unchanged by the holomorphic gradient flow under the effective action.
The properties of such a fixed-point manifold are best understood by considering the corresponding effective action S f . Since M f is unchanged after a step of flow, it must be that the flow vectors ∂S f ∂φ lie entirely within the real plane. Equivalently, since the sign problem is not improved by flow, Im S must be constant everywhere e −S > 0. Critically, this does not imply that Im S is in fact globally constant, merely that regions of distinct Im S are separated by vanishing Boltzmann factors.
To summarize: the effective action S f on the real plane satisfies e − Re S ∂ Im S = 0. The imaginary part is locally constant except at places where the entire action diverges (and the Boltzmann factor vanishes). The real plane is thus divided into distinct regions, each with constant Im S f and therefore no local sign problem, but with the possiblity of cancellations between the regions.
What does this imply about M f ? Regions on R N where S f does not diverge correspond to smooth parts of the fixed-point manifold, which have no sign problem when integrated over. These smooth regions terminate where M f intersects with singularites of S, either due to a fermion determinant become 0, or (in the case of bosonic sign problems) where one or more fieldsφ diverge.
The similarities of M f to the Lefschetz thimbles M T are striking. Like M f , when the Lefschetz thimbles are parameterized by the real plane, they are separated from each other by regions of vanishing effective Boltzmann factor. Those regions on the real plane correspond to the places in C N where M T intersects with divergences of S. The key difference is that, when working with the thimbles, the imaginary part of the physical action is constant but the effective action (due to the Jacobian) may have imaginary fluctuations. The fixed-point man-ifold M f will have a fluctuating imaginary action, but constant effective action on the real plane.
On the fixed-point manifold, the notion of a "global" sign problem becomes clear. Different parts of the manifold have different Im S f , with those differences apparently not removable by any choice of integration contour. Which physical systems possess global sign problems remains an open question.
Hints of this notion of a "global" sign problem are, as mentioned earlier, visible already when considering the Lefschetz thimbles. When the integral over the real line is equal to a sum of integrals over two (or more) thimbles with different phases, it is tempting to disregard the local part of the sign problem on the thimbles, and attribute the cancellations between thimbles to a global sign problem. However, as we will see in Sec. IV D below, such a global sign problem on the thimbles does not imply an unremovable global sign problem.
In the context of Lefschetz thimbles, it has been argued that cancellations between different thimbles should not be severe in the infinite volume limit. One such argument proceeds as follows [21]. Each thimble is associated to a critical point of the action; i.e., a classical solution to the equations of motion. At large volumes, we may reasonably expect the integral to be dominated by thimbles associated with large-scale classical solutions. These solutions, and therefore their associated thimbles, persist as we enlarge the volume. Therefore, we may now talk about "a thimble" across multiple volumes. Each thimble's contribution to the path integral should grow thermodynamically, defining a per-thimble free energy. Unless protected by some symmetry, each of these free energies will generically be different, causing one thimble to dominate in the large-volume limit. Even in the case of the thimbles, this argument is not a proof. Its applicability to the fixed-point manifolds is particularly unclear.

C. Existence of Perfect Manifolds
In the restricted case of polynomial actions (this excludes lattice models with a fermion determinant), we can show that globally perfect manifolds are likely to exist, provided that locally perfect manifolds depend smoothly on the parameters of the action. To be precise, the conjecture we need is: This conjecture empirically holds in several onedimensional models explored in the next section. It is also motivated by thinking of normalizing flows as analytic functions not just of the field variables, but also of the parameters of the action. Suppose we start from an action S 0 that has no sign problem on the real plane, whether local or global. Later actions S t have a sign problem. By definition the corresponding manifolds M t have no local sign problem; can a global sign problem be created?
One way for a global sign problem to be created, without requiring discontinuous behavior of the family M t , is for singularities of the action to intersect with the manifold. In the case of the Schwinger-Keldysh action Eq. (3) and other polynomial actions, however, there are no singularities of the action except at infinity. Any global sign problem must come from regions of M t on which all fields can become arbitrarily large.
Creating a global sign problem, therefore, implies introducing a new such region of M t . This is possible 5 , but much more difficult than intersecting a zero which lies a finite distance from the origin. If we are to hold to the previous conjecture, this argument suggests that this family of manifolds is not only locally perfect, but in fact globally perfect.

D. Examples
In one dimension, manifolds with no sign problem can be readily found by a numerical search. As an example, the left panel of Fig. 1 shows such manifolds for the action for various values of m 2 , λ, b, and φ. These examples motivate the conjecture that similarly structured sign problems (in particular, those with a polynomial action) generally admit perfect manifolds. The right-hand panel of Fig. 1 demonstrates the existence of a perfect manifold in a situation where the Lefschetz thimbles display both global and local cancellations. There are two thimbles, each of which has curvature and therefore a local sign problem coming from the nontrivial Jacobian. The imaginary parts of the action at the two contributing critical points are different, meaning that the two thimbles also exhibit cancellations between each other, worsening the sign problem. Nevertheless, a single manifold exist which has neither sort of sign problem.
The availability of perfect manifolds does not hold even for all one-dimensional integrals, however. A simple example, not physically motivated, was given in [19]. The integral of (cos θ + ) has a sign problem of order −1 for small . For sufficiently small , it cannot have its sign problem removed by any contour deformation. This 5 A previous version of this paper claimed that the creation of such a region constituted a discontinuous operation on the family of manifolds. This is not true, as long as this region of Mt can be deformed away from infinity while keeping the action bounded below. is readily confirmed by noticing that the magnitude of cos(a + ib) (which is the quenched Boltzmann factor) is minimized when b = 0. The integral along the real line will then have the smallest quenched partition function, and therefore the best possible sign problem.
In the previous section, we discussed how a global sign problem could be created when singularities of the action intersected with a locally perfect manifold. The case of (cos θ + ) is a clear demonstration of this phenomenon. At > 1, there are two zeros of the Boltzmann factor, at Re θ = 0 and Im θ = ± cosh −1 . As epsilon is lowered, these move towards the real line; at = 1 they merge at θ = 0. At this point, no global sign problem yet exists, but the locally perfect manifold now passes through a zero. Continue lowering , and the two zeros again split, now at Re θ = ± cos −1 . Although the manifold has never changed, it now consists of segments with cancelling phases.
Let us now consider a more physical model: the 0 + 1dimensional Thirring model as studied in [7,13]. The Boltzmann factor defining this model is where g is a coupling constant, µ is the chemical potential (and origin of the sign problem), and m is the bare mass. The z 1 , . . . , z β are the degrees of freedom being integrated over; there are β links on the lattice. The fermion determinant depends only on the sum of the fields βσ = i z i . A natural simplification, therefore, is to consider the "mean-field" model, a one-dimensional integral with Boltzmann factor e −S(σ) = e β 2g 2 cos σ cos(β(σ − iµ)) + 1 .
We have taken m = 0 for convenience (and neglected an overall normalization). For our purposes, an interesting limit is that of large β, while keeping the coupling and chemical potential both of order unity. Numerical experiments indicate that there is no contour that exactly solves the sign problem with these parameters -indeed, the average phase falls exponentially in β, as one would expect. This holds even if we neglect the Jacobian. In particular, write the quenched Boltzmann factor explicitly in terms of the real and imaginary parts of σ = σ R + iσ I : The quenched partition function can be given a lower bound by minimizing |e −S[σ R ,σ I (σ R )] | over all functions σ I . The minimization over σ I can be done individually for each σ R . Even this lower bound on the quenched partition function still falls exponentially above the physical partition function. Note that the fact that no manifold exists to resolve the mean-field sign problem does not prove that no manifold exists that resolves the sign problem of the original theory: it is merely suggestive. It seems plausible that a similar technique could be used to establish the impossibility of the original sign problem.
This fermionic example differs sharply from the Schwinger-Keldysh action (and from Eq. (22)). The action is not a polynomial, and relatedly, the Boltzmann factor falls to zero away from infinity (and nearly on the real plane). If the failure to have a perfect manifold is related to these features, then we expect fermionic sign problems to frequently be unresolvable via contour deformation, while bosonic sign problems would generically be resolvable.

E. Existence of Normalizing Flows
A parameterizationφ(φ) of a manifold with no sign problem induces an effective action on the real plane that is always real. Thanks to the composability of normalizing flows, the problem of finding a complex normalizing flow reduces to the problem of finding an ordinary normalizing flow for that effective action. Provided that this can be done, the existence of a perfect manifold implies the existence of a complex normalizing flow.
As it happens, given probability distributions p(x) and π(x), a map x →x always exists such that the measure p(x)dx induces the measure π(x)dx; that is, such that The construction is simplest, and unique, in one dimension. Define the cumulative distribution functions P and Π, of p and π respectively: The CDF can be seen as a normalizing flow from a probability distribution to the uniform distribution on the unit interval. Therefore, the desired map is given by Π −1 • P . In the multidimensional case such maps are known to exist as well, but cease to be unique. Finding maps with desirable properties is an active area of research; see [22] for a review.
Heuristically, one expects a normalizing flow to depend smoothly -even analytically -on the parameters of the action. This is certainly the case for the one-dimensional models considered above. This provides a new perspective on the conjecture of Sec. IV C above. Suppose the action S λ (z) depends on a potentially complex parameter λ, but is real (having no sign problem) when λ is real. A smooth family of normalizing flows z = φ(x; λ) for real λ can be analytically continued to complex λ, defining a smoothly varying family of locally perfect manifolds as per the conjecture.
The remainder of this work is dedicated to the task of finding approximate normalizing flows, under the assumption that such flows exist.

V. PERTURBING FLOWS
In principle, a complex normalizing flow can be trained in much the same way as a regular normalizing flow. In practice, this training is a difficult process. One principal reason, closely linked to the sign problem, is that when comparing Boltzmann factors, a difference of 2π in the action is invisible. As a result, if the physical Boltzmann factor is 1 and the induced Boltzmann factor is −1, the gradient descent procedure has no way to know whether the induced Im S should be changed by π or −π (or perhaps 3π). Circumventing this requires either maintaining a normalizing flow which is always "within π" of being exact, or defining the flow in such a way that the imaginary part of the induced action is itself well defined. Instead, we will work in the spirit of [23], and construct normalizing flows in perturbation theory.

A. Leading Order
A normalizing flow need not begin with a Gaussian distribution. In the general case, the condition for a normalizing flow reads where S 0 is the action defining the original probability distribution, which φ →φ transforms into e −S . Consider the case where S is merely a perturbation of S 0 ; that is, where for small λ. When λ = 0, a suitable normalizing flow is simplyφ = φ. For small λ, we expandφ as a power series: φ = φ + λ∆ (1) . Returning to Eq. (28) and expanding to leading order in λ, we find the differential equation for ∆ (1) : Here the expectation value O is evaluated with respect to the original action S 0 . We can obtain Eq. (30) more quickly simply by considering the integral of ∇· ∆e −S0 , for any ∆ that decays at infinity, or diverges sufficiently slowly. As the integral of a total derivative, it must vanish. This implies that the expectation value of ∇ · ∆ − ∆ · ∇S 0 vanishes as well. When perturbing from a free theory (that is, when S 0 defines a Gaussian), Eq. (30) can be solved exactly. In particular, with the perturbative flow ∆ (1) is given by Note that Eq. (31) is a generalization of the Schwinger-Keldysh action Eq. (3). Any two Gaussians are trivially connected by a normalizing flow, and as noted earlier, normalizing flows compose. Thus, Eq. (32) implicitly defines a (perturbative) normalizing flow for the Schwinger-Keldysh sign problem in φ 4 field theory. Unfortunately, Eq. (28) is not the only condition constraining a complex normalizing flow. As discussed in Sec. III, the asymptotic behavior of the contourφ(R N ) must match that of the real plane; i.e., the two manifolds must be in the same homology class. It is not a surprise that the perturbative flow Eq. (32) violates this condition, as the perturbative expansion is equivalent to an expansion in small fields φ, while the asymptotic behavior is purely determined by the behavior of ∆ (1) when φ is large.
To get the correct asymptotic behavior, we can work instead in the strong coupling expansion to obtain ∆ (1,strong) , which becomes a good approximation at large φ. For an action of the form of Eq. (31), it is convenient to construct our normalizing flow as a sequence of four maps: 2. Rotate and scale the complex plane via ψ 2 = F 2 (ψ 1 ) to obtain the distribution e −Λψ 4 2 .
3. Introduce a perturbative quadratic piece via a per- 4. Rescale the fields to restore the correct field normalization viaφ = F 4 (ψ 3 ), finally obtaining the desired distribution e −S(φ) , with the action defined in Eq. (31) Note that the first two maps, F 1 and F 2 , factor into one-dimensional maps, which can be obtained straightforwardly via the prescription following Eq. (27). Accordingly, F 1 can be written as Above, Γ(x) is the gamma function, Γ(s, x) is the upper incomplete gamma function, and Erf(x) is the error function.
The second map is given by simply multiplying φ by Λ −1/4 i . This is a rotation of the complex plane on most of the lattice, with an additional scaling factor of 2 1/8 on the corners of the Schwinger-Keldysh contour. Thus the map F 2 is defined as The map F 3 is where the strong coupling expansion is performed. The differential equation for δ (1) is of the form of Eq. (30), with O = ij φ i M ij φ j . The expectation value O must now be evaluated with respect to the leading-order action i , and using the fact that φ i φ j vanishes when i = j (in the strong coupling limit), the differential equation reads The expectation value required is φ 2 Λi . Using the fact that only diagonal and nearest-neighbor terms of M are non-zero, the solution is Above, (·) 1/4 refers specifically to the principle fourth root. A specific choice of C = 1 gives a solution which vanishes at ψ i → ∞ and is oscillation-free. Finally, F 4 rescales the field by a factor of λ 1/4 : Putting it all together, the entire perturbative flow from e − i ψ 2 i to e −S(φ) at the leading order is The left panel of Fig. 2 shows the average phase obtained by this flow on a 12-site lattice with m = 0.5, as the coupling is varied. As expected, at strong coupling, the sign problem is almost entirely removed, whereas at sufficiently small coupling the average phase is too small to be distinguished from zero. As a check of the correctness and convergence of the flow, the right panel of the same figure shows the real-time correlator obtained with m = 0.5 and λ 24 = 0.33, compared with an exact Hamiltonian calculation. The lattice behind this calculation has 14 sites (two thermal links and six temporal links in each direction), and the average phase was computed to be σ = 0.096 (5).
As with many other methods for mitigating the sign problem, the parameters in an ansatz flow can be tuned nonperturbatively [9,10,12,15,23]. One method for achieving this is similar to the standard technique for training real normalizing flows [1][2][3]: the normal distribution is sampled from and Eq. (6) enforced on the samples via gradient descent.

B. Extracting Expectation Values
When the action S 0 defines a probability distribution from which sampling can be performed efficiently, Eq. (30) provides a means to approximately sample from the perturbed distribution defined by S. However, that equation is still valid when S 0 is itself hard to sample from (and perhaps afflicted with a sign problem). Any vector field ∆ i corresponds to some observable O whose expectation value is known -and for a fixed desired observable, a numerical solution to ∆ can be attempted, which will automatically yield the expectation value.
The differential equation is in a number of dimensions equal to the number of sites on the lattice. Neural networks have been profitably applied to solving such highdimensional differential equations [24]. Our strategy is as follows. A multi-layer perceptron (MLP), with parameters labelled W , will represent ∆ as a function of the (real) fields φ; a single additional training parameter E represents O . We train these parameters with respect to the cost function which is estimated by randomly sampling from the Gaussian distribution in φ.
The left panel of Fig. 3 showcases this method on 0+1dimensional scalar field theory -equivalent to the model of Eq. (3) with no real-time evolution. The lattice parameters are m = 0.5, β = 10; expectation values are given as a function of the coupling. A two-layer MLP is used with hyperbolic tangent as an activation function. The method is seen to have reasonable agreement with the exact answer across all couplings.
This method has serious drawbacks. Most importantly, it represents an uncontrolled approximation. The error in the estimation of O is due to the shortcomings of the ansatz used for ∆, rather than insufficient statistics; therefore, this error cannot be estimated with bootstrap nor removed with a larger number of samples.
In the case of the Schwinger-Keldysh action with N t > 0, another issue emerges. The most natural cost function for training ∆ would be The task of evaluating this cost function itself has a sign problem; estimating its derivatives with respect to the MLP parameters has a related signal-to-noise problem.
Training with respect to the cost function of Eq. (42) has no such difficulty, but a small value of that cost function does not imply that ∆ is a good approximation in terms of the 'true' cost function. This mismatch allows an apparently good fit to correspond to very inaccurate expectation values. The right panel of Fig. 3 showcases this failure more clearly, in the case of N β = 2, for various real-time evolutions N t . Shown is the expectation value φ(t)φ(0) for several time separations t, at an inverse temperature of β = 2, with lattice parameters m = 0.5 and g = 0.5. Although some qualitative features of the true correlator are reproduced, for larger time evolutions, the learned correlator systematically diverges from the exact answer.

VI. FURTHER DISCUSSION
This paper introduced the notion of complex normalizing flows, which extend the applicability of normalizing flow-based methods to (some) models afflicted with a sign problem. Unlike real normalizing flows, which always exist, complex normalizing flows exist only when an integration contour is available which exactly removes the sign problem. Approximate normalizing flows can be constructed in perturbation theory, but low-order perturbative approximations were found to not have a tractable sign problem on lattices with more than ∼ 20 sites. Thus, at the order computed in this paper, perturbatively constructed normalizing flows do not perform as well as methods based on the holomorphic gradient flow [16,17]. Moreover, given the exponential cost associated with going to higher orders, this particular construction of normalizing flows is unlikely to represent a practical attack on sign problems of higher-dimensional theories.
The general question of when sign problem-solving integration contours exist remains open. For simple fermionic models, they can be readily shown not to exist, although the possibility remains that the manner of integrating out fermions could be changed to remedy this. Simple models inspired by the Schwinger-Keldysh action do have contours which exactly solve the sign problem. Conjecturally, this is a generic feature of polynomial actions.
The Schwinger-Keldysh sign problem for scalar fields comes from a polynomial action, but this is far from an unusual property. Consider the case of SU (N ) gauge theories in the absence of fermions. The complexification of SU (N ) is the group of complex N × N matrices U obeying det U = 1, SL(N ; C). On this space, the standard Wilson action and its many improvements can be written holomorphically as a polynomial of U and U † . Cramer's rule for the inversion of matrices provides an ex-pression for U −1 in terms of the elements of U , in which the only non-polynomial factor is (det U ) −1 . In the case of SL(N ; C) matrices, this factor is always 1 and can be neglected. What remains in the action is a polynomial of the field variables.
We argued that contours always exist which locally solve the sign problem, by describing an iterative procedure for removing local fluctuations in Im S, and studying the properties of its fixed points. Analogous to the Lefschetz thimbles 6 , a fixed-point manifold of this procedure can be decomposed into several smooth pieces, separated from each other by singularities of the physical action. The key difference is that on this manifold, the imaginary part of the effective action is constant, rather than the imaginary part of the physical action.
If the evidence presented earlier is taken at face value, it is likely that manifolds exist that resolve the real-time bosonic sign problem. It is critical to note that this is not equivalent to a solution to that sign problem. Difficulties could still exist with the computational task of finding such manifolds, or there may be no efficient algorithms for sampling from them. In fact, in the case of a real-time sign problem with arbitrary time-dependent source terms (which is still a polynomial action), this is the expected result: it was shown in [25] that the task of computing amplitudes in such a context is BQP-hard.