Boundary conditions and partition functions in higher spin AdS3/CFT2

We discuss alternative definitions of the semiclassical partition function in two-dimensional CFTs with higher spin symmetry, in the presence of sources for the higher spin currents. Theories of this type can often be described via Hamiltonian reduction of current algebras, and a holographic description in terms of three-dimensional Chern-Simons theory with generalized AdS boundary conditions becomes available. By studying the CFT Ward identities in the presence of sources, we determine the appropriate choice of boundary terms and boundary conditions in Chern-Simons theory for the various types of partition functions considered. In particular, we compare the Chern-Simons description of deformations of the field theory Hamiltonian versus those encoding deformations of the CFT action. Our analysis clarifies various issues and confusions that have permeated the literature on this subject.


Introduction
The study of higher spin theories in anti-de Sitter (AdS) space has been recently revitalized, partly because they provide an example of holographic duality in which the field theory is essentially non-interacting, and one often has good analytic control over both local and nonlocal observables. At least in principle, this feature allows for a very precise holographic dictionary to be established and tested: roughly speaking, the higher spin symmetries emerge in a regime in which one can compute reliably in both the bulk and the boundary sides of the correspondence. A very interesting example of these dualities is the conjecture [1] of Klebanov and Polyakov relating three-dimensional critical O(N ) vector models and the Fradkin-Vasiliev higher spin theories in AdS 4 [2,3,4], for which robust evidence has been provided recently (see [5] and references therein).
Another setup where both sides of the duality are amenable to study is that of AdS 3 /CFT 2 : here the boundary theories correspond to two-dimensional CFTs with extended current algebras, and the gauge sector of the three-dimensional bulk gravitational theory can be formulated as a Chern-Simons gauge theory. Indeed, starting with the proposal of Gaberdiel and Gopakumar [6,7] relating the three-dimensional interacting higher spin theories [8,9] to a family of minimal model coset CFTs with W-symmetry, 1 several results have been obtained that show agreement between quantities computed in CFT and from the bulk duals. These include the spectrum [11,12,13,14,15], partition functions [16,17,18], scalar correlators [19,20], and entanglement entropies [21,22,23], to name a few. While the full realization of the duality also involves matter fields in the bulk, which couple to operators other than conserved currents, the pure higher spin sector of the correspondence already provides an interesting arena where universal aspects of the duality can be explored.
In the present article we will focus on the sector of the latter dualities describing the CFT's conserved currents, where the corresponding symmetries emerge via Hamiltonian reduction of current algebras and admit a simple holographic description in terms of two copies of Chern-Simons theory. Our main goal will be to clarify the interpretation of different boundary conditions in Chern-Simons theory from the point of view of the dual CFT, in the presence of sources for the conserved currents furnishing the extended (possibly higher spin) symmetries. 1 See [10] for a comprehensive review of W-symmetry in CFT.
In particular, we will argue that certain boundary conditions correspond to a deformation of the CFT Hamiltonian, while others correspond to deformations of the CFT action.
More precisely, given a CFT with Hamiltonian H CFT and action S CFT , we can distinguish at least four types of deformations depending on whether they are chiral or non-chiral and whether they are defined as modifications of S CFT or H CFT : Here W s and W s are a set of currents of weight (s, 0) and (0, s), respectively, obeying appropriate Poisson or Dirac bracket chiral algebras which will typically be non-linear extensions of the Virasoro algebra, and σ denotes a compact coordinate on the cylinder. The deformation parameters µ s andμ s can be thought of as chemical potentials or background gauge fields: provided they transform suitably, the partition functions defined from the above Hamiltonians/actions will be invariant under the symmetry algebra furnished by the currents. The dots in (1.2) denote the fact that, in the presence of deformations of both chiralities, the corresponding action requires terms to all orders in the chemical potentials in order to realize the symmetry. On the other hand, as we will discuss in detail in due course, at the level of the Hamiltonian the linear couplings suffice, even when both chiralities are present, because W s and W s Poisson-commute.
The program that we will follow can be summarized quite simply. The fact that the partition functions associated with the various types of deformations above enjoy a symmetry will as usual result in Ward identities for the one-point functions of the currents in the presence of sources. The precise form of these Ward identities will depend on the particular type of deformation under consideration, but in all cases one can encode them as a flatness condition on suitable 2d gauge connections in "Drinfeld-Sokolov form" [24]. If we now regard the CFT as being defined on the boundary of a 3d manifold, these 2d gauge connections become boundary conditions for 3d Chern-Simons gauge fields, with the flatness conditions enforced by the Chern-Simons equations of motion. From a practical point of view, the advantage of this formulation is that one can now use Chern-Simons theory to derive a number of universal results for the boundary theories quite efficiently, including thermodynamic quantities such as entropy and free energy, and even non-local observables such as entanglement and Rényi entropies which are usually quite difficult to obtain using solely CFT techniques. For example, formulae for the thermal entropy in the presence of higher spin chemical potentials written entirely in terms of the Chern-Simons connections were derived in [25,26], and two proposals for higher spin entanglement entropy in terms of Wilson lines in Chern-Simons theory were put forward in [21] and [22].
It is worth mentioning that the logic behind the holographic formulation of the current sector of these theories predates the advent of the AdS/CFT correspondence, and can be seen as a special case of the usual connection between Chern-Simons theory and Wess-Zumino-Witten (WZW) models. In fact, the different types of deformations we discuss as well as their associated symmetries were studied more than two decades ago in the context of gauging of W-algebras and the so-called W-gravity. Similarly, the connection between deformations of the Hamiltonian and chiral deformations of the CFT action was discussed in [27] from a fieldtheoretical perspective. Our main goal will be to derive the implications of these results for the Ward identities and their connection to Chern-Simons theory, in the hope that these considerations will help to bridge the gap between the existing literature and the recent discussions in the context of higher spin AdS 3 /CFT 2 .
Importantly, in order to derive the Chern-Simons formulation one does not use holography or the existence of a holographic dual of the starting CFT. Our analysis, however, is only valid at the classical level (which in the dual CFT corresponds to a limit where c → ∞, with c the central charge), and uses no properties of the CFT except that it possesses particular symmetries. It is only when studying subleading corrections to various quantities that one would need to have a more detailed knowledge of the matter content of the field theory, which in the bulk corresponds to specific couplings of matter fields to Chern-Simons theory. In the latter situation the details of the full-fledged holographic correspondence become important.
While the problem at hand may appear to be of a fairly technical nature, it is conceivable that the techniques developed in the context of the higher spin AdS 3 /CFT 2 duality may find an application to realistic systems. In fact, Hamiltonians of the form (1.3) feature prominently in the study of the dynamics of one-dimensional integrable condensed matter systems following a quantum quench, where they are referred to as a "generalized Gibbs ensemble" or GGE (see e.g. [28] and references therein). Similarly, the large-N limit of certain coset CFTs proposed to describe strange metals in one spatial dimension has been related to higher spin theories on AdS 3 [29]. Furthermore, even though most of the results that we will derive are strictly speaking applicable in the large central charge regime, one may hope that some of the conclusions and lessons from the holographic analysis will retain their validity in other corners of parameter space, which would make these results appealing to a wider community. In fact, some of the predictions for entanglement entropy in the presence of sources derived in [21] using a novel holographic proposal have been recently argued to apply beyond the large central charge limit from a purely CFT perspective [30,23], with the first perturbative correction in the higher spin sources being moreover universal.
The rest of the article is organized as follows. In section 2 we consider Hamiltonian deformations of the CFT and rewrite the canonical partition function as a path integral in first order form, and exploit this representation to derive the Ward identities obeyed by the one-point function of currents in the presence of sources. Although we employ a free boson realization to perform the calculation, we will find that the resulting Ward identities take a generic form, independent of the specific realization and particular symmetry algebra. Moreover, we will discover that these Ward identities have a slightly different structure from the ones usually discussed in the literature. In section 3 we consider deformations of the CFT action instead, and exhibit the form of the corresponding Ward identities. In section 4 we determine the precise "Drinfeld-Sokolov pair" that allows to rewrite the Ward identities for Hamiltonian and action deformations as the flatness condition on 2d connections. Using holography, we then extend them into 3d flat connections with suitable boundary conditions, and use the associated variational principle to derive expressions for the free energy and entropy, for example.
We also revisit and discuss a few results that have generated some confusion in the recent literature, and point out a useful relation obeyed by flat connections in Drinfeld-Sokolov form.
We conclude in section 5. Useful formulas and examples that complement the discussion are collected in the appendices.

Hamiltonian deformations and the canonical partition function
The basic object of interest is the canonical torus partition function where the trace is assumed to be taken over the Hilbert space H of the CFT, W denote the zero modes of conserved currents of weight (s, 0) and (0, s), respectively, and α s , α s the corresponding sources. In our conventions the torus has volume Vol(T 2 ) = 4π 2 Im(τ ) with τ = τ 1 + iβ/(2π) , where β is the inverse temperature. The sum over s runs over the particular spectrum of operators present in the theory, which depends on the symmetry algebra in question. 2 Before proceeding further it is convenient to clarify our terminology: in agreement with common usage in the literature, we will refer to the CFT operators of conformal dimension 2 In the holographic realization that we will study in section 4, the spectrum is fixed by the choice of gauge greater than two as "higher spin operators", to the symmetries they generate as "higher spin symmetries", and to their sources as "higher spin sources/chemical potentials". Therefore, in our CFT discussion we will often use the terms conformal dimension and spin interchangeably.
One notices that where H = L 0 +L 0 − c 12 is the Hamiltonian and J = L 0 −L 0 the angular momentum, with L 0 ,L 0 the Virasoro generators on the cylinder. 3 Defining the chemical potentials we see that the partition function describes a theory with density operator where the deformed Hamiltonian H µ is given by

Partition function in first order form
We will now assume the theory possesses a Lagrangian representation. Denoting the set of fields collectively by φ, and their (Euclidean) conjugate momenta by P , the partition function can be written in a path integral representation as where the Hamiltonian form of the action is algebra g ⊕ g for the bulk Chern-Simons theory, plus a choice of embedding of the sl(2, R) factor corresponding to the gravitational (spin-2) degrees of freedom into g . 3 As usual, one thinks of the torus as a cylinder of finite length with the ends identified up to a twist.
A few comments are in order here. First, we notice that it is the rescaled sources µ = iβ −1 α , namely the chemical potentials, that enter in the action. This is the usual result in finitetemperature field theory, and can be established by carefully discretizing the operator trace (see [31,32] for example). Secondly, in the reasoning above the potential Ω for angular momentum was treated in the same footing as the other deformations. We can instead "geometrize" this potential by introducing a twist in the boundary conditions. Doing so the partition function becomes where d 2 z is the standard measure on the Euclidean plane (we are assuming a flat torus) and the path integral is performed with boundary conditions Notice that while we have been working with constant µ s ,μ s up to now, we are free to make µ s andμ s time-and space-dependent in this path integral representation of Z can , as long as we specialize to constant µ s ,μ s when we want to compute Z can .
A point that will be crucial for the considerations to follow is that in general the currents W s corresponding to higher spin operators are at least cubic in momenta. Therefore, if we transition to a Lagrangian path integral description by integrating out the momenta (i.e. Legendre-transforming) we find that the resulting action is non-linear in the sources, and in fact it will generically involve mixing between the two chiral sectors. What this means is that the canonical partition function is in general quite different from a simple second order version of the path integral with linear couplings, which we denote by Z Lag,naive : where S 0 is the Lagrangian action in the absence of deformations. Fortunately, as we will discuss in detail in the rest of this section, for the purpose of deriving the Ward identities obeyed by the partition function Z can it will suffice to stay within the first order form of the action, where the deformations appear only linearly and the two chiral sectors do not mix.
It is important to emphasize that the action deformed by linear couplings which enters the path integral (2.12) is not invariant under the higher spin symmetries furnished by the currents when both chiral sectors are deformed simultaneously, even if one allows the sources to transform. When both chiralities are present an invariant action involves corrections to all orders in the sources [33,34,35], and we will return to this point in section 3.3. In general, this means that the naive partition function Z Lag,naive does not obey the usual Ward identities when both µ s andμ s are switched on. The fact that Z can and Z Lag,naive are different objects is in fact true even for deformations involving "lower spin" currents (relevant operators), and has important consequences for modular invariance, for example. To illustrate this point, in appendix A we review an example involving U (1) currents in a free compact boson realization.
Our next goal is to derive the Ward identities obeyed by the canonical partition function Z can . For the sake of concreteness, we will often resort to a theory with W 3 symmetry deformed by sources for the stress tensor and weight-3 currents as our basic example. Even though we will use a simple boson realization to derive these identities, we will find that the result is completely fixed by the symmetry algebra and does not rely on details of the explicit realization. By the same token, our conclusions will be general enough to later allow us to make a connection with flat connections in three dimensions and to find the appropriate boundary conditions these should obey in order to reproduce the canonical computations (c.f. section 4). We will first work in Lorentzian signature, where the discussion of symmetries, conserved charges and Ward identities is more transparent. When discussing the Lorentzian theory on the cylinder we will often refer to the chemical potentials µ,μ as the sources. On the other hand, once we transition to the finite temperature theory defined on the torus we will reserve the term sources to denote the α = −iβµ ,ᾱ = iβμ .

A W 3 theory in Hamiltonian form
Free field realizations of the W-current algebras were originally discussed in [36,37]. Here we will follow the Hamiltonian approach employed in [38], which will prove very advantageous.
Consider then a theory of n real bosons X i (i = 1, . . . , n) on the cylinder with coordinates (t, σ) (where σ σ + 2π). We denote the canonical momentum conjugate to X i by P i , with equal-time Poisson brackets and raise and lower Latin indices with the flat metric δ ij . 4 Define now which satisfy One then constructs the generators relations that guarantee the closure of the algebra [34]. For example, defining T ± = W ± and provided [33,39] Below we will discuss how to generalize this construction to allow for a semiclassical central charge c , in terms of which κ = −16/c . The condition on d ijk guarantees that the spin-4 term in the r.h.s. of the {W, W } bracket is proportional to T 2 , closing the algebra of the stress tensor T and the dimension-3 current W , albeit non-linearly. We stress that, since we are using Poisson brackets and working at the semiclassical level, we have considered the product of currents such as T 2 without worrying about operator ordering issues.
Before integrating over momenta, the partition function for the deformed theory involves the first-order action whose symmetries we want to study. The dot notation indicates time derivatives as usual. A convenient feature of the first order formalism is that the W (s) + and W (s) − generators Poissoncommute, so the separation of left-and right-movers is exact. To avoid unnecessary clutter we will often work exclusively with the + sector and drop the subindex to simplify the notation, i.e. we use T ≡ T + , W ≡ W + and so forth when there is no risk for confusion. Naturally, all the conclusions apply to the other chiral sector as well.
The key point we want to stress is that integrating out the momenta one obtains the second order form of the action, which is non-linear in the sources and mixes left-and rightmovers in a non-trivial way. A related observation is that, in the absence of deformations (i.e. µ ± 2 = µ ± 3 = 0) the equation of motion for P i implies P i = ∂ t X i , so that Π i ± = ∂ ± X i in the undeformed theory. The undeformed currents are then schematically of the form W (s) ± ∼ (∂ ± X) s and obviously chiral. On the other hand, when the chemical potentials are switched on the P i acquire explicit dependence on them to all orders, and so do the currents themselves.
For the purpose of studying the symmetries of the partition function and the associated Ward identities it will be very advantageous to stay within the first order formulation, because the sources enter linearly and the chiral sectors remain factorized.

Adding central extensions
We will now extend the Hamiltonian analysis of [38] to include classical central extensions.
This can be achieved by adding improvement terms to the generators, often times called "background charges" in the literature, along the lines of [37,33,39]: where the a i , e ij and f i are constant coefficients. With these additions, the W 3 Poisson algebra becomes is that, upon normal-ordering the products of currents, the Jacobi identities (associativity) will imply that the structure constants in the quantum version of the algebra acquire O(1/c) corrections (see e.g. [39]). It is in this sense that the non-linear Poisson bracket algebra is a "large-c" version of the full quantum algebra.
With the Poisson algebra at our disposal, we can compute the transformation of the currents under the various symmetries. Defining the integrated spin-2 and spin-3 charges under an infinitesimal spin-2 transformation one finds (with similar expressions in the other chiral sector) and we recognize the transformation of the stress tensor and a weight-3 primary operator under diffeomorphisms of the form x + → x + + (σ). Similarly, under the spin-3 symmetry one finds

Symmetries of the action
Let us now discuss the symmetries of the action. To this end it is useful to think of the sources as gauge fields, i.e. Lagrange multipliers imposing constraints that generate the W algebra or any other symmetry in question. We emphasize however that the sources are background fields which are not being integrated over in the path integral. We will denote the currents generating the symmetry of interest by a vector J with components J α , and the corresponding Lagrange multipliers by a vector µ with components µ α . In our W 3 example we will have The action we consider is then of the generic form where H 0 denotes the undeformed Hamiltonian. We will study the symmetries of the associated partition function using the improved generators, i.e. when the algebra acquires semiclassical central extensions: where as before we have suppressed the explicit time dependence of the currents for the sake of notational simplicity. The functions c αβ are proportional to the semiclassical central charge c , but do not depend on the phase space variables.
Before moving forward, we can take two steps that will simplify the task of finding the Ward identities obeyed by the currents in the presence of sources. First, we note that the undeformed Hamiltonian is simply H 0 = T + + T − . 6 It is then possible to eliminate H 0 from the action by shifting the spin-2 chemical potentials as µ ± 2 → ν ± 2 − 1, while keeping the higher spin chemical potentials the same. Consequently, for practical purposes we will define a new vector . .} and drop H 0 . Even though the shift in the spin-2 deformation could be thought of as a "gauge choice", the undeformed theory has generically a non-zero Hamiltonian H 0 , so we must remember to translate our results back to the µ α at the end if we are to interpret the sources strictly as deformations of the original theory. Secondly, we will define for convenience an auxiliary action I c which includes an "identity gauge field" ν c which can be thought of as coupling to an extra Abelian generator [40]: The role of this additional Lagrange multiplier, which is purely a bookkeeping device, is to cancel contributions to the variation of the action coming from central extensions. Naturally, at the end of the day we will set ν c = 0 in order to obtain the Ward identities obeyed by the original partition function.
We are now in position to discuss the symmetries of the action in the presence of deformations. It is straightforward to check that under an infinitesimal transformation of the fields and sources of the form (2.41) 6 More precisely, in the presence of improvement terms we have H0 = 1 where we used the shorthand ν 2 ≡ ν + 2 and µ 3 ≡ µ + 3 , with similar expressions for the sources in the other chiral sector. Shifting back to the original spin-2 source µ 2 = ν 2 − 1 we obtain the desired transformation rules: Notice the appearance of the chiral derivative defined as . We then see that the only effect of the undeformed Hamiltonian H 0 is to turn the time derivatives in (2.39) into chiral derivatives.
It is worth emphasizing that the theory and in particular the partition function are defined at fixed values of the sources. The fact that one needs to transform the µ α in order to realize the symmetry, therefore moving in the space of theories, shows that generically these deformations will explicitly break the original conformal as well as higher spin and Lorentz symmetries. 7

Ward identities
Having derived the transformation of the sources, the basic result (2.41) showing the invariance of the action under the combined transformation of background sources and fundamental fields will imply a Ward identity for the currents. From the point of view of the path integral, changing the fields X i and momenta P i is a just a change of integration variables. Hence, the where denotes equivalence up to surface terms (the integral of total time derivatives). Setting ν c = 0 in order to recover the Ward identity obeyed by the original partition function we obtain where the J α are interpreted as the one-point function of the currents in the presence of external sources. Plugging the explicit form (2.39) of the variations δν α and integrating by parts we find the identity Note that defining the extended Hamiltonian the above Ward identity takes a very compact form: In other words, in Hamiltonian language the Ward identities are just the equations of motion of the currents, with the time evolution generated by the deformed Hamiltonian H ν .
We emphasize that the source vector ν α in (2.48) and (2.50) contains the shifted spin-2 deformation ν 2 = µ 2 + 1 that allowed us to absorb the undeformed Hamiltonian H 0 . In the specific W 3 example, using (B.15)-(B.20) it is easy to see that (2.48) yields, after shifting back to µ 2 , where ∂ − = ∂ t − ∂ σ . Just as before, shifting back to µ 2 produced an extra term that combined with the time derivatives in (2.48) to turn them into chiral derivatives. This was to be expected, because ∂ − T = 0 and ∂ − W = 0 are the Ward identities in the free theory (i.e. when µ 2 = µ 3 = 0). More generally, if in a slight abuse of notation we let J α , f γ αβ and c αβ denote the currents, structure constants and central extensions on a single chiral copy of the algebra, our results for the Ward identity in terms of the original sources µ β becomes It is somewhat peculiar that the right-hand side of the Ward identities involves σ-derivatives as opposed to x + -derivatives, which to our knowledge has not been emphasized in the literature before. As we have seen this is an automatic consequence of our canonical treatment, with the Hamiltonian as the starting point. In section 4.1 we will show that these Ward identities can be written as the flatness condition on sl(N, R) ⊕ sl(N, R) gauge fields with appropriate boundary conditions.

Action deformations and the holomorphic partition function
By now we have established the structure of the Ward identities corresponding to a deformation of the CFT Hamiltonian by higher spin currents. Our next task is to consider a different partition function obtained by deforming the CFT action. Many of the technical aspects in the analysis below are analogous to the canonical case discussed in depth in the previous section, so in what follows we will omit unessential details for the sake of brevity.

Chiral deformations
We will begin by studying the symmetries of the partition function and the associated Ward identities in the presence of chiral deformations. To this end we will again resort to the free boson realization, and consider an action of the form where the vector G = {L, W} contains the currents 8 and λ = {λ 2 , λ 3 } the corresponding sources. Following the Noether procedure, it was established long ago that this linear coupling is in fact enough for the action with chiral deformations to enjoy a gauge invariance [33,34], akin to a chiral half of (2.37)-(2.39). A particularly transparent way of understanding this result, which also allows to make direct contact with the calculations in section 2, is to realize that the above action is amenable to study in a Hamiltonian formalism with the light-cone direction x − thought of as "time" [41,34,42], and where the undeformed Hamiltonian is identically zero, H 0 = 0 .
The key observation in [42] is that, after taking into account the presence of the second Given the form of this bracket and the currents (3.2) (compare with the basic canonical bracket (2.16) and currents (2.17)), from the reasoning in the previous section it is clear that the holomorphic currents enjoy the Dirac bracket algebra provided d (ijk d k m)n = κ δ (ij δ m)n as before. Classical central extensions can be incorporated exactly as in the canonical analysis by adding improvement terms to the generators, which will now involve terms of higher order in chiral derivatives, e.g. L = (1/2)∂ + X i ∂ + X i + a i ∂ 2 + X i (compare with (2.23)). It is then immediate that the improved generators fulfill one copy of the centrally extended algebra (2.25), (2.26), (2.27), with spatial derivatives ∂ σ replaced by chiral derivatives ∂ + , provided the coefficients of the improvement terms obey the constraints (B.3)-(B.13). In simple terms, all the calculations performed in the canonical formulation carry over to the chiral deformation case provided one replaces Π i + → ∂ + X i and ∂ σ → ∂ + .
Parameterizing the extended Dirac brackets of the currents as (in order to simplify the notation we omit the explicit x − dependence below) it was shown in [42] that under the infinitesimal transformation the action (3.1) transforms as 9 where as before denotes equivalence up to surface terms. Repeating the manipulations that lead to (2.48), in this case we find the Ward identities Using the fact that the structure constants f γ αβ and central extensions c αβ now involve ∂ + derivatives (as opposed to ∂ σ derivatives), in the W 3 example we find Just as for the algebra itself, the Ward identities associated with a chiral deformation of the field theory action have the same form as those associated with a chiral deformation of the Hamiltonian, but with spatial derivatives ∂ σ replaced by light-cone derivatives ∂ + . As shown in e.g. [43], these Ward identities also follow by computing the one point of L and W in the presence of the insertion e d 2 z λ α Gα by expanding the exponential and using the OPE of the holomorphic currents. In this sense, (3.12)-(3.13) could be said to be the "usual" Ward identities. As discussed in section 4 and appendix D, these Ward identities (in fact two chiral copies of them) can be rewritten as the flatness condition on sl(N ) ⊕ sl(N ) gauge fields with appropriate boundary conditions.

The coupling to the modular parameter and the notion of energy
Consider adding to the Euclidean free boson action a chiral stress tensor deformation and a chiral deformation by a weight-s current: For simplicity we have not added improvement terms to the generators, which as we have seen allow to incorporate semiclassical central charges. We will moreover restrict to odd s, in which case the closure of the Dirac bracket algebra (obtained interpretingz as time) requires [34] Allowing µ 2 and µ s to have spacetime dependence, the above action is invariant under the following infinitesimal transformation of fields and sources: with associated Ward identities In order to discuss a thermal partition function, we now take µ 2 and µ s to be constant chemical potentials and put the theory on a torus with modular parameter τ , with 2πIm(τ ) = β as before. In the canonical formulation of section 2, the modular parameter τ of the torus couples by definition to the Virasoro zero modes. We would now like to understand what are the quantities that couple to τ andτ in the presence of chiral deformations of the action. This is an important question, as these couplings define for example the quantity that is conjugate to the inverse temperature β, namely the energy of the system. The original torus has metric and identifications given by and volume Vol(T 2 ) = 4π 2 Im(τ ) . Since the periodicity of the coordinates depends on τ , care must be exercised when taking variations with respect to the modular parameter. A convenient way of dealing with this problem consists in passing first to coordinates (w,w) of fixed periodicity, e.g. [44] which implies One then takes variations of the action in the (w,w) coordinates, and transforms back to (z,z) at the end. In this way one obtains for example Denoting the free (undeformed) boson action by S 0 and taking the variation as indicated yields the expected result 10 with L as in (3.15) and Extending the above computation to include the effects of the chiral deformations requires some caution, as we first have to define what exactly are the independent thermodynamic variables that we are going to use. It might be tempting to use µ s andμ s , besides τ,τ , as independent variables, but we will find it more natural and convenient to use Im(τ )µ s , Im(τ )μ s , τ andτ as independent variables. We make this choice because (i) a similar choice was made in eq. (2.3), (ii) when taking µ s and W s constant the integral d 2 z µ s W s reduces to 4π 2 Im(τ )µ s W s , and (iii) this is also the standard procedure in thermal field theory in the presence of chemical potentials [32]. An additional independent reason supporting this choice of thermal sources, motivated from holographic considerations, will be given in section 4.4. In the present context this means that we must take the τ -variation of the action with δ Im(τ )µ = 0 . Taking into account the contribution of the chiral deformations and performing the variation of (3.14) as described one obtains We would now like to rewrite this variation entirely in terms of the generators themselves.
To this end we can use the reparametrization freedom of the path integral and consider a (non-local) field redefinition such that The variation of the free action will then cancel the offending terms in the second line of (3.31) provided we set Taking into account the new terms generated by the variation of the (µ 2 L + µ s W s ) piece, the final result for the combined variation of the complex structure plus field redefinition is where we defined the "energies" E and E as The above simple-minded calculation glossed over many details: it did not take central terms into account, it applies to a single higher spin deformation only, and the field redefinition we have performed is non-local. A rigorous calculation should involve e.g. treating the kernel of the derivative operator (in particular zero modes) carefully. Barring these technical complications, the naive calculation exemplifies some facts that should remain true once these subtleties are taken into account. In particular, it shows that even for a chiral deformation the notion of energy on the opposite chiral sector is modified. In fact, the generalization of (3.35) was obtained in [25] using Chern-Simons theory. 11 We now see that the mixing of chiralities has a very simple origin in field theory: it arises due to the mixing of left-and right-movers in (3.26) and (3.27). We will return to this result and its interpretation in section 4.3 and appendix D.

Non-chiral deformations
Having studied chiral deformations of the CFT action, a natural question is whether one can simultaneously turn on sources for both left-and right-moving chiral algebras in such a way that the Ward identities consist of two copies of (3.11) (with ∂ + and ∂ − interchanged). As we 11 The calculation performed in [25] moreover involved non-chiral deformations, but reduces to the above results once the chemical potentials in the barred sector are switched off.
have anticipated, a naive second order path integral with linear couplings, i.e.
would not lead to the desired Ward identities. A simple way to appreciate the problems associated with this definition is to notice that in order to derive the desired Ward identities one would need to assume that the chiral sectors are decoupled, whereas in practice the OPE between e.g. W s and W s involves contact terms. In terms of free bosons X i , these contact . Though contact terms are perhaps often associated to quantum effects, it is straightforward to see that here W s transforms non-trivially under a higher spin transformation generated by W s already at the classical level, thereby spoiling the derivation of the Ward identities.
In certain cases one can indeed write down a partition function whose symmetries result in two copies of the chiral Ward identities, at the expense of introducing auxiliary fields [35]. As anticipated, integrating out the auxiliary fields results in an action involving infinitely many higher order terms in µ s andμ s , which would be the Lagrangian version of the theory with wellseparated left-and right-movers. Even though we will not discuss the auxiliary field formalism in detail, in appendix C we review an example involving non-chiral stress tensor deformations that illustrates various general features of the construction. We emphasize that the difficulties associated with non-chiral deformations do not arise in the holographic formulation using Chern-Simons theory. In particular, it was already shown in [43] that two copies of the chiral Ward identities arise as the flatness condition on sl(N ) ⊕ sl(N ) gauge fields with appropriate boundary conditions (c.f. section 4.3). The difficult only emerges when one tries to associate a deformed CFT path integral to the bulk theory with these boundary conditions.
In our considerations above, the non-decoupling of the chiral sectors in the path integral (3.36) was easy to see because it involved classical field variations only. One could however contemplate other definitions of the path integral, for example using conformal perturbation theory, where contact terms play no role since one regularizes the integrated correlators by excising small disks around each operator insertion. At first sight, this prescription then leads to a factorization of the chiral and non-chiral deformations, since they only interact through contact terms in correlation functions of the form WW , and therefore also to the correct separate Ward identities. 12 It is somewhat puzzling that conformal perturbation theory naively yields an answer which differs from that obtained using classical field variations, especially since the disagreement is already there at the classical level and has nothing to do with quantum issues. One possibility is that the treatment using conformal perturbation theory becomes subtle when going to higher orders, since one needs to separate the chiral and anti-chiral 12 We thank Per Kraus for bringing this scenario to our attention.
insertions from each other, and that this induces some mixing. Alternatively, we are dealing with two different prescriptions which simply differ by finite local counterterms. It would be interesting to investigate this issue further.

Holography
The semiclassical analysis in sections 2 and 3 culminating in the Ward identities (2.53) and (3.11), respectively, was purely field-theoretical and did not presume the existence of a holographic description. In particular, for any theory with W 3 symmetry we showed that the As we have mentioned, the W N algebras are an example of symmetries that emerge via the so-called Hamiltonian or Drinfeld-Sokolov [24] reduction of current algebras, and such theories can be described in terms of Chern-Simons theories on a three-dimensional manifold with boundary (see the recent [6,45,46,47,48,49,43,50,18,17], and [51,52,53,54,55,56,57] for earlier work). The pure Chern-Simons sector is in fact a consistent truncation of the full interacting Prokushkin-Vasiliev theory [8,9], where the matter sector decouples. When the connections are valued in sl(N, R) ⊕ sl(N, R) the dual CFT possesses W N symmetry [46,45]. Replacing the gauge algebra by two copies of the infinite-dimensional hs[λ] algebra, the resulting theory enjoys W ∞ [λ] symmetry [47,49]. For a succinct overview of the basic facts concerning the formulation of three-dimensional gravitational theories in Chern-Simons language, as applied to higher spin AdS 3 /CFT 2 , we refer the reader to [25,21]. Full details can be found in the comprehensive reviews [48,7,58].
We do not need the full machinery referred to in the previous paragraph to describe the connection to Chern-Simons theory, however. Consider Chern-Simons theory, augmented with a suitable boundary term and boundary conditions, on a three-manifold with boundary. The Ward identities can be obtained in this way. In the remainder, we will assume the latter to be true, and in order to select a three-manifold we will pick the dominant saddle point suggested by AdS/CFT in the case where the sources are turned off. We expect this to remain the dominant saddle for sufficiently small values of the sources, but an analysis of exactly which saddle dominates for which values of the sources is beyond the scope of the present paper.
Note that (4.1) requires one to identify precisely what sources one chooses, and different choices of sources or thermodynamic variables will correspond to different boundary terms and boundary conditions, as recently discussed in [25]. A class of boundary conditions was studied in [59,60,61,62,63,64,65] that lead to the so-called "canonical thermodynamics", consistent with canonical definitions of conserved charges and thermodynamics in gravitational theories, with a perturbative application of Wald-like formulae for the entropy and energy [66], and with the thermal limit of entanglement entropy calculations in higher spin theories [21,22]. A feature of the canonical approach is that, once sources for the currents are switched on, quantities such as the energy and higher spin charges, for example, acquire an explicit dependence on the chemical potentials and differ from their undeformed counterparts. On the other hand, alternative "holomorphic" boundary conditions were employed in [43,50,17,26] which yielded results consistent with various independent CFT calculations [18,20,19]. The question that concerns us here is what is the precise interpretation of these boundary conditions in terms of the dual field theory.
The picture we want to put forward is that while canonical boundary conditions are associated with deformations of the CFT Hamiltonian, of the type studied in section 2, the holomorphic ones are related to deformations of the CFT action as described in section 3. 13

Canonical boundary conditions and variational principle
We will begin our discussion from the perspective of holography by deriving the boundary conditions that realize the canonical structure discussed in section 2. Taking the W 3 case as The first part of the question, concerning the transformation of the charges, was already answered in [46]: focusing on the unbarred sector for simplicity, one starts by gauging away the dependence of the connection on the bulk radial coordinate ρ and works with the reduced or "two-dimensional" connection a defined through To obtain the right Ward identities, one needs to choose the asymptotic boundary conditions to be of Drinfeld-Sokolov form, i.e. 14 where Q a highest weight matrix ([Q, L −1 ] = 0) whose entries contain the stress tensor and the higher spin currents. For example, in the spin-3 case we write the spatial component of the sl(3, R) connection as where k = 4G 3 . By definition, the asymptotic symmetry algebra is generated by the gauge The general structure at play is more clearly appreciated in terms of a "Drinfeld-Sokolov pair", consisting of one component of the connection carrying the currents as highest weights, and a conjugate component carrying the corresponding sources as lowest weights. This is conveniently summarized as 15 where as before Q is linear in the currents and satisfies [Q, L −1 ] = 0, M is a matrix linear in the sources which satisfies [M, L 1 ] = 0 , and the dots stand for higher weight terms completely fixed by the equations of motion once a suitable normalization of the sources is chosen (see [25,63] and appendix D for details). In particular, in the above example we have To make sure that the partition functions also agree, all that remains is to find an appropriate boundary term which is compatible with the Dirichlet boundary conditions on the sources, and which will guarantee that the charges are indeed coupled in the right way to the currents. We will turn back to these boundary terms momentarily.
In order to facilitate comparison with the recent literature, we note that the above boundary conditions written in light-cone coordinates Turning back to the boundary terms, the necessary techniques to find these were introduced in [25], generalizing the results of [59]. The Lorentzian Chern-Simons action on a threedimensional manifold M reads 16 where [11] k cs = k 2Tr [L 0 L 0 ] (4.15) in order to match with the normalization of the Einstein-Hilbert action in the pure gravity case.
With this normalization, the central charge in the dual CFT is given by c = 12k cs Tr [L 0 L 0 ] .
The total action will be of the form where I B is the required boundary term. In terms of the ρ-independent connections a,ā, the variation of the bulk action I CS , evaluated on-shell, is easily seen to be where d 2 x ≡ (1/2)dx − ∧ dx + = dt dσ . The necessary boundary term is (4.19) and the variation of the full action I, evaluated on-shell, is then This confirms that the boundary term above is well-suited to the Dirichlet problem (fixed sources).

Canonical thermodynamics revisited
We will now describe the boundary conditions in the Euclidean formulation of Chern-Simons theory, and derive general expressions for the free energy and entropy in the dual theory. In order to introduce temperature, the Euclidean time direction is compactified and the topology of the three-dimensional manifold M becomes that of a solid torus. Complex coordinates (z,z) 16 All traces in this section are taken in the fundamental representation.
are introduced by analytically continuing the light-cone directions as x + → z , x − → −z , with identifications z z + 2π z + 2πτ , where τ is the modular parameter of the boundary twotorus. In the semiclassical limit (large temperature and central charges), the CFT partition function is obtained from the saddle point approximation of the Euclidean on-shell action: , Mirroring the field theory discussion in section 3.2, when computing the variation of the Chern-Simons action one should acknowledge that the modular parameter of the torus is varying. As before, a convenient way of dealing with this fact is to compute the variation in coordinates with fixed-periodicity (where τ appears in the connection itself), and change back to the z coordinates at the end. Following the steps detailed in [25], in the present case we find that the variation of the full action, evaluated on-shell, is given by First, we notice that the quantities conjugate to τ andτ , namely the left-and right-moving energies T and T , are given by In particular one notices that the mixing of chiralities encountered in 3.2 from the field theory perspective, and in [25] from the Chern-Simons perspective, does not arise when using canonical boundary conditions. Secondly, we see that the quantities coupling to the higher spin currents (4.30) 17 A slightly different definition of the sources was employed in [63], as lowest weights in τ az +τ az . One notes however that τ az +τ az = (τ − τ )az + τ (az + az), and since az + az is a highest weight matrix, this implies that the lowest weights in τ az +τ az and (τ − τ )az are in fact the same. By the same token, in the Lorentzian theory the sources can be said to be the lowest weights in at − aσ or equivalently in at, because aσ is a highest weight matrix. The difference between these two approaches amounts simply to a shift in the definition of the spin-2 source. 18 See [59] for a discussion of the subtleties associated with the evaluation of the bulk piece.

As usual, the free energy is a function of the temperature and chemical potentials. A standard
Legendre transform produces the entropy, a function of the charges. The term implementing the Legendre transformation can be read off from (4.24), and the thermal entropy is then which after using (4.30) yields S can = −2iπk cs Tr (a z + az) (τ a z +τ az) − (ā z +āz) (τā z +τāz) . This formula for the entropy was first derived in [25]. In the particular case of the W 3 theory (N = 3) in the principal embedding, it agrees with a result derived in the metric formulation [61], as well as the perturbative application of Wald's entropy formula [66]. We emphasize however that equations (4.30) and (4.32) are valid for any N , and any choice of embedding.
Moreover, they are valid for the hs[λ] theory as well, provided the trace is interpreted accordingly (see section 4 of [63] for a complete discussion of this case). The above form of the entropy has been also recovered as the thermal limit of entanglement entropy proposals for higher spin theories [21,22].
It is important to mention that the charges and their conjugate sources have to be related in a particular way for the first law of thermodynamics to hold. In the Chern-Simons formulation this requirement has been encoded in an elegant way in terms of holonomies of the connection [43]. In a few words, one demands that the connection has trivial holonomy around the thermal cycle of the boundary torus, that becomes contractible in the bulk. This is the Chern-Simons analogue of the familiar statement for Euclidean black holes that the thermal circle should be smoothly contractible. Using these holonomy conditions, it was also shown in [25] that the above formula for the entropy can be written very compactly as where λ and λ are diagonal matrices containing the eigenvalues of the component of the connection along the non-contractible cycle of the boundary torus, i.e.
λ ≡ Eigen (a z + az) , λ ≡ Eigen (ā z +āz) . be then viewed as the generalization of the Cardy formula for higher spin theories. As a side remark we note that in the principally-embedded sl(N, R) ⊕ sl(N, R) theory, the above expression for the entropy can be also written in a representation-independent way as [21] S can = 2πk cs λ − λ , ρ (4. 35) where λ, λ are the weight vectors dual to λ and λ (which belong to the Cartan subalgebra), ρ denotes the Weyl vector of sl(N ) (which is dual to L 0 ), and the brackets denote the usual inner product induced by the Killing form.

Holomorphic boundary conditions and thermodynamics
The holomorphic partition functions we discussed in this paper correspond to deformations of the Lagrangian instead of the Hamiltonian. The analysis proceeds exactly as for the canonical case, the main difference being that the boundary conditions become instead of (4.26), and similarly in Lorentzian signature (see [25]) where they result in two copies of the Ward identities (3.11) [43]. Accordingly, instead of (4.23) the appropriate boundary term now reads As discussed in [25], the corresponding free energy is There are several marked differences with the canonical case. For example, under variations of the complex structure one finds [25] δ τ,τ ln Z holo = −2πi We then see that the operator that couples to τ is now much more complicated, and involves a mixture of left and right movers. The content of (4.41) is that the energy of the system is manifestly modified by the higher spin sources, and in particular it does no longer correspond to the zero modes of the stress tensor as defined in the undeformed theory. We presented a qualitative field theory explanation of this mixture in section 3.2, and it would be very interesting to derive the form of this operator directly from the path integral. A hint as to how this might come about comes from a property of Drinfeld-Sokolov connections that we discuss below.
In order to characterize the operators E and E , we note that the Drinfeld-Sokolov form of the connection with holomorphic boundary conditions is easily seen to imply (c.f. appendix with L the stress tensor, and similarly in the other chiral sector. 19 The only quantity left to characterize is then −k cs Tr a 2 z . In appendix D we point out the useful relation where ∆L N ≡ N s=3 µ s W s is the deformation operator, and provide the explicit form of P N for N = 2, 3, 4. We notice however that P N does not contribute under the integral sign in (4.40). In other words, the contribution of −k cs Tr a 2 z to the energies is given precisely by the second order pole in the OPE of the Lagrangian deformation with itself. We emphasize that (4.44) holds for arbitrary spacetime-dependent sources, and it therefore applies beyond the thermodynamic analysis. We leave a further study of this curious relation to future work.
In order to obtain the entropy we need to perform an appropriate Legendre transform of the free energy, which in this case reads and evaluates to the same expression (4.32) for the entropy as in the canonical case, namely S holo = −2πik cs Tr (a z + az) (τ a z +τ az) − (ā z +āz) (τā z +τāz) . In particular, this result can be written in the same form as 4.33. However, despite the apparent similarity, there is an important difference once again: whereas in the canonical case (a z + az) depends on the charges only and the eigenvalues λ andλ immediately yield an expression for the entropy as a function of the charges, in the holomorphic case a z + az depends on both the charges and chemical potentials in a complicated way. Hence, in order to find an expression for the entropy, in the latter case one needs to explicitly solve the monodromy conditions which allow to express the sources in terms of the charges.

Other holomorphic boundary conditions
In the context of holography, the first discussion of boundary conditions in the presence of higher spin sources and the associated thermodynamics was given in the original work [43] of For chiral deformations of this sort, we have given a particular partition function in CFT which corresponds to a deformation of the action by a linear coupling, which indeed reproduces a single chiral copy of these Ward identities. We have also pointed out that when sources for currents of both chiralities are present, the corresponding partition function in CFT that reproduces the Ward identities involves terms to all orders in the sources, including terms that mix both chiralities. This can be understood, for example, using the auxiliary field formalism introduced in [35], which unfortunately needs to be formulated on a case by case basis.
By considering thermodynamics of Chern-Simons theory on a solid torus, an entropy was found in [43] whose precise form was determined by the first law of thermodynamics based on a definition of the sources (α,ᾱ) that involved rescaling the chemical potentials (µ,μ) by the modular parameter τ of the boundary torus torus, e.g. α =τ µ andᾱ = τμ . It was then shown in [25] that the entropy formula obtained in [43] can be written quite generally as 47) or, equivalently, where λ z and λ z are diagonal matrices containing the eigenvalues of the a z andāz components of the connection.
It may appear strange that although the Ward identities take the same "holomorphic" form in [43] as we obtained from deformations of the action, the entropy (4.46) one obtains from the latter formulation is clearly distinct from ( Finally, to see how the Gutperle-Kraus result fits in our general framework, we would like to present a computation in deformed 2d CFT which reproduces the appropriate free energy and entropy. To this end, we first recall that one can find the free energy by e.g. varying the entropy to read off the sources and charges (4.49) and the free energy is then given by the corresponding Legendre transform [25] −βF G-K = ln Z G-K = − 2πik cs Tr τ a 2 One can derive from the results in [25] that this free energy follows by computing the partition function on a square torus of the following deformed CFT with some numerical constants c 1 , c 2 which we did determine explicitly. Let us reemphasize that this theory lives on a square torus of fixed periodicities and that the dependence on τ is only through the explicit appearance in the action. It remains to be seen whether deformations of the type (4.51) have any particularly nice intrinsic properties, or whether they were merely stumbled upon by accident as a by-product of the definitions in [43].

Field redefinitions
Even though different boundary conditions in Chern-Simons theory describe different partition functions in the two-dimensional boundary theory, it was already pointed out in [25] that field redefinitions exist which allow to map between different Drinfeld-Sokolov pairs. This suggests that redefinitions of the sources might be possible which allow to relate partition functions corresponding to, say, a chiral deformation of the Hamiltonian and a chiral deformation of the action. We will now discuss to what extent this is indeed possible. It will in general turn out to be relatively easy to find redefinitions of the charges in such a way that the entropies transform into each other, but difficult to find redefinitions of the sources to map the free energies into each other.
We will first use chiral stress tensor deformations as an example. This is, for the theory defined on a torus T 2 with modular parameter τ , we would like to relate a Hamiltonian deformation of the form with q = e 2πiτ , and an action deformation of the form with L the left-moving stress tensor.
Given a Drinfeld-Sokolov pair, for constant sources the flatness of the gauge connection implies that the conjugate components of the gauge field commute. In the particular case of a stress tensor deformation, that can be described by sl(2, R) connections, the two components are actually proportional to each other. Denoting the connection describing the Hamiltonian deformation by a and that describing an action deformation by b, from our discussion above in the canonical case plus the corresponding results for the holomorphic case (see [25]) it follows Using the on-shell relations (4.54) these conditions become (4.59) This is precisely the same relation obtained in [27] using field theory techniques, reproduced here with very simple manipulations in terms of flat connections in Chern-Simons theory.
Why did this work? The reason is that To be a bit more explicit about the above map at the level of free energies, consider the canonical free energy (4.30) and the Gutperle-Kraus free energy (4.50). It is easy to see that if we start with the former, and make the following change of variable (restricting to the chiral sector for simplicity) we get precisely the Gutperle-Kraus free energy in terms of b z , bz . In addition, if (a z + az, az) was a Drinfeld-Sokolov pair, then so is (b z , bz), and the trivial monodromy around the contractible cycle is preserved because τ a z +τ az = τ b z +τ bz . The field redefinition (4.62) then realizes a map between Hamiltonian deformations, dual to canonical boundary conditions, and deformations of the type (4.51), which are dual to Gutperle-Kraus boundary conditions.
Given that the Gutperle-Kraus boundary conditions are dual to action deformations, while the canonical boundary conditions are dual to Hamiltonian deformations, it might seem surprising that a detailed agreement was found between the free energies computed from the bulk theory with Gutperle-Kraus boundary conditions [17] and a CFT calculation that involved Hamiltonian deformations by zero modes [18]. From the map (4.62) and the above discussion it is clear that the functional form of the canonical free energy, as a function of the canonical sources α Im(τ )µ , is exactly the same as that of the Gutperle-Kraus free energy as a function of the sources α G-K =τ µ . This explains why the two calculations seemingly agreed, even though they involve two a priori different partition functions. We will further comment on the implications of these findings in section 5.

Modular transformations
Recall that in 2d CFT modular transformations can be understood as a change of coordinates followed by a scale transformation, which are symmetries of the deformed action when the currents and sources transform appropriately [27]. In our example involving stress tensor deformations, this implies in particular that λ 2 above transforms covariantly under modular transformations; from (4.59) it then follows that the canonical source α 2 transforms in a complicated way. Another way to understand this fact is to notice that the rescaling amounts to a gauge transformation, and that the combined effect of the change of coordinates and gauge transformation preserves the Drinfeld-Sokolov form of the pair (b z , bz) , but not that of (a z + az , az). An additional compensating transformation would be necessary to put the gauge field a back into the appropriate Drinfeld-Sokolov form, which explains why the canonical source α 2 transforms in a complicated way under modular transformations. Whether such transformations exist when higher sources are turned on is not clear.
It is instructive to describe the Chern-Simons perspective on modular transformations, an issue that was recently investigated in [68]. Here we will provide a succinct derivation that will once more make it clear why modular transformations are simple for deformed Lagrangians and complicated for deformed Hamiltonians. We will only consider chiral deformations in what follows, but the results can be generalized to the non-chiral case in a straightforward way.
As we have discussed, there are different possible three-manifolds we can use to evaluate the Chern-Simons action. If the boundary is a two-torus, there is an entire SL(2, Z) family of three-manifolds we can choose, each yielding a different answer for the on-shell value of the action.
To write this answer explicitly, we rewrite (4.39) for one chiral sector as ln Z holo = − πik cs Tr (τ a z +τ az)(a z + az) where the first term is the contribution from the on-shell value of the Chern-Simons action, and the second term is the contribution from the boundary term. For a different three-manifold, labeled by an SL(2, Z) matrix the partition function becomes 21 ln Z holo [R] = −πik cs Tr α (τ a z +τ az) + β(a z + az) γ (τ a z +τ az) + δ(a z + az) In the first term, we recognize the product of the monodromies of the gauge field along the new a-cycle and b-cycle of the boundary two-torus.
Suppose that in the above me make the substitution This substitution preserves the Drinfeld-Sokolov form of the gauge field, i.e. if (a z , az) is a Drinfeld-Sokolov pair then so is (b z , bz). Morever, by direct calculation, we observe that after this substitution the partition function takes the original form (4.39) with τ replaced by (ατ + β)/(γτ + δ). Thus, to summarize, we have shown that where Z holo [1] on the r.h.s. denotes the partition function in the original manifold, labeled by R = 1 . This is the Chern-Simons version of modular invariance, and we see that (4.66) provides the transformation rules for the sources, in agreement with what one gets directly from the deformed action. 21 As we have emphasized the boundary term is the same for any choice of three-manifold, but the on-shell value of the Chern-Simons action depends on how the two-torus is filled, namely the choice of contractible and non-contractible cycles in the bulk.
Interestingly, for deformations of the Hamiltonian the above computation does not work due to the different structure of the boundary term, and we have not succeeded in deriving a general transformation rule under modular transformations for the sources in that case. It would be very interesting to explore this issue further.

Discussion
Starting from two-dimensional CFTs with a (possibly higher spin) current symmetry algebra, we have reviewed different types of deformations that are possible once sources are switched on. While some of these can be understood as deformations of the CFT Hamiltonian, others are defined as changes directly at the level of the action. Associated with each of these theories there is a notion of partition function that is a function of the background sources, and whose associated Ward identities we have studied. Using the Ward identities as the guiding principle, we have argued that these different theories map to different boundary conditions in a holographic realization in terms of Chern-Simons theory on a three-dimensional manifold with boundary. The issue of boundary conditions in the higher spin AdS 3 /CFT 2 correspondence has proven to be particularly subtle, and it is therefore worth summarizing how our analysis fits with the recent literature.
In the holographic context, a first set of boundary conditions in the presence of higher spin sources was proposed in [43,50], with the flatness condition on the connection resulting in Ward identities of the form (3.11). We have argued that these boundary conditions most naturally correspond to a deformation of the CFT action of the form (3.1) in the chiral case, and to an action involving infinitely many higher order terms in the sources in the non-chiral case. The latter can be rewritten linearly in the sources at the expense of introducing auxiliary fields, but this formulation has to be constructed on a case by case basis.
For the finite temperature version of the holomorphic theory on the torus, two definitions of the thermal higher spin sources have been proposed. The first alternative was put forward in [43,50] and identifies the sources schematically as α =τ µ andᾱ = τμ , where µ andμ are the chemical potentials. This choice implies in particular that the expression for the energy is the same as in the absence of sources, and leads to an entropy of the form (4.47). This identification of the sources is not what one gets from deformations of the form (3.1), but maps instead to a peculiar deformation of the form (4.51), with the theory defined on a square torus. An alternative definition was studied in [25], which consists in defining the thermal sources as α = −iβµ ,ᾱ = iβμ with β = 2πIm(τ ) the inverse temperature. This case precisely describes deformed actions of the form (3.1) and the expression for the energy is explicitly modified with respect to the undeformed theory, a fact that we have rederived from a field theory perspective in section 3.2, and one is led in particular to the formula (4.46) for the entropy [25].
A different set of "canonical" boundary conditions in the presence of sources was proposed in [64,63,62,65]  It has been proposed [62,65] that the solutions constructed in [43,50] that realize the holomorphic W 3 boundary conditions are in fact W 3 boundary conditions in disguise. This conclusion was arrived at by interpreting the solutions of [43,50] It is conceivable that a canonical structure based on a null coordinate could be at odds with a well-posed Cauchy problem in the bulk when sources of both chiralities are switched on, and this issue deserves further scrutiny. On the other hand, we have argued that well-defined partition functions exist in CFT whose Ward identities are indeed those obtained in [43,50], and we expect them to have a dual description in the bulk. Consequently, our point of view is that the W 3 boundary conditions proposed in [43,50] do indeed give rise to W 3 symmetry, and that no conflict arises when they are interpreted in a light-cone framework as in [41] (or a suitable generalization thereof in the non-chiral case).
To add to this, we emphasize than just providing a solution of the Chern-Simons field equations, i.e. a flat connection, is not sufficient; we also need to specify an a priori choice of boundary conditions, boundary terms, and identification of sources and dual expectation values, and different choices can provide different interpretations for the same flat connections.
For one choice the flat connections in [43,50] describe a solution with W 3 boundary conditions, and for another choice they describe a solution with W 3 boundary conditions. Both are valid but inequivalent points of view.
Regarding the matching between bulk and boundary computations, it might appear as somewhat surprising that a chiral half of the partition function (free energy) derived in [17] from the bulk theory with Gutperle-Kraus boundary conditions, which as we have seen here correspond to a linear deformation of the CFT action, has been matched by a CFT calculation involving a chiral deformation of the Hamiltonian by zero modes [18]. To clarify this issue, in section 4.5 we have shown that the functional form of the partition function (as a function of the sources) and of the entropy (as a function of the charges) is the same with canonical or Gutperle-Kraus boundary conditions, even though different definitions of the sources and charges themselves are been used in one version of the theory or the other. As we have discussed in depth, the detailed matching between charges and sources in the bulk and boundary, namely the holographic dictionary, will however change depending on what precise version of the theory we want to describe. As a consequence, one should in principle expect observables such as correlators, which are generically not fixed by symmetry or otherwise, to be sensible to these choices. These subtle differences have indeed been noticed in calculations of thermal correlators of scalar primaries in CFTs with higher spin symmetry [20], and we expect our analysis to shed light on these issues as well.
It is perhaps worthwhile to briefly discuss the validity and interpretation of the irrelevant deformations that we considered. A priori, theories deformed by irrelevant deformations are ill-defined. In the present case we are deforming by conserved currents, which might improve the situation. Let us first think what happens when we expand the theories as a power series in terms of the sources, with each term being an integrated correlation function. These correlation functions are singular when points coincide and some regularization has to be employed. In standard conformal perturbation theory, one cuts out small disks around the points and subtracts all singularities that arise when shrinking the disks to zero size. We expect this procedure to yield finite, well-defined answers, in particular since the conserved currents cannot develop anomalous dimensions. 22 Therefore, the theories we consider may well have well-defined perturbative expansions in µ s andμ s . These perturbative expansions presumably have zero radius of convergence, and it is an interesting questions whether one can directly define the deformed theories non-perturbatively e.g. by choosing suitable complex contours.
There are two other arguments that these deformed theories make sense. First, one the 22 One might worry that contact terms produce divergences containing new operators which would need to be added to the theory to make it consistent. For example, the OPE of two spin-three currents contains T 2 , the square of the energy-momentum tensor, which does not appear in the deformed theory. We do not see any need, at least classically, to add such deformations to the theory. plane, we can perform a higher spin transformation which puts all µ s = 0 , mapping the deformed theory to the original, undeformed theory. The latter is clearly well-defined, and so should the former? Perhaps, except that it is not clear that the required higher spin transformations act in a reasonable way, they could for example map normalizable field configurations into non-normalizable field configurations. Moreover, on a torus one cannot get rid of the zero modes of the µ s andμ s in this way and the argument no longer applies. A second argument that these deformed theories are well-defined is that we can use Chern-Simons theory to compute their partition functions, and the result is a non-pathological function of µ s andμ s .
Clearly, more work is required before we can make a definite statement about the existence of so what their 2d CFT interpretation is. Similarly, one could extend our considerations to encompass the non-AdS (non-CFT) higher spin dualities studied in [69,70]. As discussed in section 4.6 and appendix A, the different types of partition functions we have studied moreover differ in their modular transformations properties. We have not found a change of variable which directly connects deformations of the action to deformations of the Hamiltonian, however, and in particular we have not been able to determine the behavior of the latter under modular transformations. It is possible that in order to find such a change of variable additional operators need to be included, such as normal-ordered products of higher spin fields and their derivatives, and it would be interesting to explore whether such more general deformed theories still admit dual Chern-Simons descriptions. These interesting questions will be discussed elsewhere.

A A U (1) example
Here we will briefly review a non-higher spin example from [71], involving deformations by U (1) currents in a compact boson realization. The canonical partition function with sources for left-and right-momenta is where q = exp(2πiτ ) and It is tempting to conclude that the path integral representation of this partition function is where S 0 is the free action (we consider a flat torus with ds 2 (T 2 ) = dzdz = dt 2 E + dσ 2 ) and the background gauge field, whose components are the chemical potentials, given by In particular, since modular transformations correspond to a change of coordinates followed by a Weyl rescaling, which are symmetries of the deformed action, Z Lag,naive is modular invariant: On the other hand, following the standard steps to discretize the operator trace, the path integral representation of Z can is found to be with P the momentum conjugate to X . Integrating out P one concludes [71] Z can [τ, α L , α R ] = e − π(α L +α R ) 2

B Useful W 3 formulae
As explained in the main text, the improved W 3 generators in the bosonic realization are The improved T T bracket takes the usual form ( and It is worth pointing out that there is some degree of redundancy in these constraints; if so desired, one could choose a minimal set that contains all the information. We emphasize that the above conditions were derived semiclassically, at the level of Poisson brackets, and therefore ignoring operator ordering issues. The resulting expressions can be viewed as the "large-c" version of the full constraints obtained from the quantum W 3 algebra, derived in [39]. An immediate consequence of the conditions on the various coefficients is that at least two scalars are needed in order to support an arbitrary semiclassical central charge.
When the above conditions are satisfied, the improved generators satisfy the Poisson algebra and Writing the boundary Chern-Simons connection in highest weight gauge, 23 it was found in [46] that the gauge transformations δa = dλ + [a, λ] that respect the Drinfeld-Sokolov form of a σ are generated by an infinitesimal parameter where 1 ≡ and χ 2 ≡ χ . Under such transformations, the change in the charges is precisely given by (2.30)-(2.33).

C Non-chiral stress tensor deformations
In certain cases it is possible to write down a partition function whose symmetries give rise to two decoupled copies of Ward identities of the type (3.12)-(3.13), at the expense of introducing auxiliary fields [35] (see [72] for a review). The auxiliary field formalism is non-universal and has to be constructed on a case-by-case basis, but we can illustrate many of its important features by considering a simple example involving stress tensor deformations. Consider then the action for the scalar field theory with both left-and right-moving stress tensor deformations where Π i ± denote the auxiliary fields and For the sake of simplicity, we have omitted improvement terms that would generate classical central extensions. When µ ±± = 0 , S aux yields the free boson action upon integrating out the auxiliary fields. When deformations are present, the action is invariant under the infinitesimal transformation Since the path integral contains an integration over X and Π, this symmetry yields the Ward identity Plugging the explicit variation (C.4) of the sources we obtain which are the familiar holomorphic Ward identities (in the absence of central extensions).
In the context of holography, these Ward identities (including central extensions) and their supersymmetric extension were derived in [73] using the Chern-Simons formulation of threedimensional anti-de Sitter gravity.
One notices that the equation of motion for the auxiliary fields is which can be solved to give From (C.2) we see that the stress tensor obeying the holomorphic Ward identities is not merely ∼ (∂ ± X) 2 , but rather (C.11) The fact that the naive free-field expressions for the currents are modified in a source-dependent way in the presence of non-chiral deformations is a general feature of the construction.
Another general feature we have emphasized in the body of the paper is that the process of integrating out the auxiliary fields results in a second order action which contains corrections to all orders in the sources. To illustrate this point we can replace (C.10) back into the action, obtaining a flat space theory with Lagrangian The spin-2 symmetries are of course still present: under the transformations (note the infinitesimal parameters k ± below are different from the p ± above) the second order action changes as 16) The fact that the action is non-linear in the sources should come as no surprise if we recall that the gauging of spin-2 deformations is equivalent to putting the theory on a curved background metric. Indeed, the second order action involving the Lagrangian (C.12) can be written covariantly as with metric [72] 24 As emphasized in [72], (C.18) does not correspond to partial gauge fixing: it is a general parameterization of a two-dimensional metric. In our conventions √ −g = Ω is the conformal mode of the metric, which as usual drops from the action because of Weyl invariance. It is straightforward to verify that the transformations of the covariant fields induced by the transformation (C.13)-(C.15) of the sources are simply In other words, the symmetry transformations (C.13)-(C.15) are a combination of diffeomorphism generated by k µ plus a Weyl rescaling generated by − (∇ ρ k ρ ) .
Note that the components of the covariant stress tensor are given byT This illustrates yet another subtle point: the definition of the stress tensor depends on what the sources are, namely what is kept fixed in the variation. While the covariant stress tensor couples to the metric g µν , the currents T ±± satisfying the usual Ward identities (C.7)-(C. 8) couple instead to the sources µ ±± . 24 Notice that our parameterization of the metric differs slightly from that in [72].

D Tr a 2 z and the OPE
In what follows we will exemplify various relations satisfied by flat connections in Drinfeld-Sokolov form. A 2d Drinfeld-Sokolov connection consists of a component a J that contains a set of currents as highest weights, and a conjugate component a µ whose lowest weights are linear in the corresponding sources. The various relations we discuss below rely exclusively on this lowest/highest weight structure, and therefore apply to any choice of boundary conditions.
However, for the sake of concreteness we will exemplify them for holomorphic boundary conditions, where the currents sit in a z and the sources in az and (z,z) denote complex coordinates.
We will moreover work with the theory defined by the principal sl(2) embedding into sl(N ) , but the expressions adapt straightforwardly to other embeddings as well (see [25] for example).

(D.2)
Here k ≡ c/6 and α s and β s are normalization constants which will be fixed as indicated below, and the higher weight terms in az are completely determined by solving the flatness conditions. The latter contain N − 1 additional constraints which amount to the Ward identities obeyed by the currents J s in the presence of sources µ s .
In order to derive the symmetries associated to the above connection, one notices that the most general gauge transformation δa = dΛ+[a, Λ] that preserves the form of a z contains N −1 independent infinitesimal parameters 2 , . . . , N . Moreover, given that the flatness condition (D.14) Since we are always free to normalize the sources in this way, this proves (D.7).
In order to prove (D.8) we will first obtain the useful intermediate results where P N will be determined below for N = 2, 3, 4 . In other words, up to a total second derivative, the quantity −k cs Tr a 2 z is the coefficient of the second order pole in the ∆L N (z)∆L N (w) OPE.