{'fraction_non_alphanumeric': 0.03534924845269673, 'fraction_numerical': 0.010893015030946066, 'mean_word_length': 4.237658608872835, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Efficient Batch Query Answering Under Differential Privacy

Differential privacy is a rigorous privacy condition achieved by randomizing query answers. This paper develops efficient algorithms for answering multiple queries under differential privacy with low error. We pursue this goal by advancing a recent approach called the matrix mechanism, which generalizes standard differentially private mechanisms. This new mechanism works by first answering a different set of queries (a strategy) and then inferring the answers to the desired workload of queries. Although a few strategies are known to work well on specific workloads, finding the strategy which minimizes error on an arbitrary workload is intractable. We prove a new lower bound on the optimal error of this mechanism, and we propose an efficient algorithm that approaches this bound for a wide range of workloads.


Introduction
Differential privacy [4] is a rigorous privacy condition, guaranteeing participants that the information released about the data will be virtually indistinguishable whether or not their personal data is included. Differential privacy is achieved by randomizing query answers. While there are a number of general-purpose mechanisms for satisfying differential privacy [2], there are comparatively few results showing that these mechanisms are optimally accurate-that is, that the least possible distortion has been introduced to satisfy the privacy criterion. For a single numerical query, the addition of appropriately-scaled Laplace noise satisfies -differential privacy and has been proven optimally accurate [5]. For workloads of multiple queries, optimally accurate mechanisms are not known.
Our focus is on batch query answering, in which multiple queries are answered at one time, in a single interaction with the private server. A batch of queries, or a workload, here consists of a set of linear counting queries. These include predicate counting queries, histograms, sets of marginals, data cubes, or any combination of these.
The goal of research in this area is to devise an efficient algorithm that can achieve the least possible error under differential privacy. In this work we pursue this goal by advancing a recently-proposed technique called the matrix mechanism [10]. The matrix mechanism generalizes standard differentially private output perturbation techniques, and we explain it by comparing it with the standard Laplace mechanism.
The Laplace mechanism answers a workload of queries by adding to each query a sample chosen independently at random from a Laplace distribution. The distribution is scaled to the sensitivity of the workload (the maximum possible change to the query answers induced by the addition or removal of one tuple). Consider using the Laplace mechanism to simultaneously release answers to the set of all range-count queries over a database containing ages for a community. This workload consists of all queries AgeCount(a, b) which return the number of individuals whose age is between a and b, for any constants a, b ∈ {1, . . . 120}.
Using the Laplace mechanism directly results in extremely noisy query answers for this workload because the noise added to each query in the workload is proportional to the sensitivity of the workload. The sensitivity of this workload is O(n 2 ) where n is the size of the domain (120 in this example). In addition, because independent noise is added to each query, the answers are inconsistent: e.g. the sum of AgeCount(20, 40) and AgeCount(41, 60) will not, in general, equal AgeCount(20, 60) as one might hope.
An alternative to the direct application of the Laplace mechanism arises from recognizing that the workload of all range-count queries can be computed from a smaller set of query answers-namely counts for each individual age 1, 2, . . . 120. Because each count is independent, this approach has very low sensitivity and does not introduce inconsistency. However, the released query results must be summed to get the answers to the desired range queries: e.g. AgeCount (1,10) is the sum AgeCount(1, 1) + · · · + AgeCount (10,10). Although each individual count has low error, the expected error accumulates when computing the sum, leading to significant error for large ranges.
The matrix mechanism (so named because workloads are represented as matrices and analyzed algebraically) can be seen as a generalization of the multi-query Laplace mechanism. The approaches above can be seen as two extremes: one in which the workload is submitted to the Laplace mechanism, and one in which the workload is divided into independent queries and those are submitted. The matrix mechanism encompasses both of these extremes, along with many other approaches, some offering significantly lower error.
Given a workload of queries, the matrix mechanism uses the Laplace mechanism to answer a different set of queries, called a strategy. The answers to the strategy queries are then used to derive the query answers ultimately desired-the workload queries. If there are related queries in the strategy, linear regression is used to combine the evidence from all available query answers (in an optimal way) to produce the final answers. The result is a consistent final answer to the workload queries, often with improved error. The matrix mechanism can improve error because the strategy queries can be used to avoid or reduce redundancy that may be present in the workload, thus lowering sensitivity. Also, redundancy that does exist in the strategy queries is exploited by the linear regression process to improve accuracy.
Using the matrix mechanism requires instantiating it with a set of strategy queries which is a good match for the workload. For the workload of all range queries, two approaches were independently proposed recently, one based on a wavelet transform [13], and one based on a hierarchical query set [9]. While these approaches look quite different at first glance, they are in fact different sets of strategy queries which can be analyzed as instances of the matrix mechanism [10]. Both strategies result in much lower error: O(log 3 n) instead of O(n 4 ) for the workload itself or O(n) for the approach that asks for individual counts.
Thus research to date has shown that for a particular workload (the set of all range-count queries) there are strategies that offer significantly lower error. But these strategies do not work well for all workloads. To exploit the full power of the matrix mechanism, we must customize strategies to the given workload.
Unfortunately, we cannot hope for exact solutions to this problem. The strategy design problem, i.e., calculating the strategy that results in the minimal error for a given workload, is intractable [10]. Nevertheless, in this paper we provide efficient algorithms for computing a set of strategy queries for a workload and show that they approach optimally accurate strategies.
A key aspect of our approach is the move from standard -differential privacy, to ( , δ)-differential privacy, a modest relaxation of the privacy condition often called approximate differential privacy. The matrix mechanism is easily adapted to approximate differential privacy. Computing the strategy with minimal error remains computationally infeasible. But we show that under this definition the matrix mechanism has a number of nice features which make it amenable to analysis and which lead to better approximate solutions.
Our contributions are organized as follows. The central theoretical result, shown in Sec. 3, is a tight lower bound on the minimum total error achievable for a workload. It can be efficiently computed from the spectral properties of a workload when it is represented in matrix form. In Sec. 4, we propose an efficient localized search algorithm for solving the strategy design problem. In Sec 5, we show experimentally that, for a variety of workloads, our algorithm produces strategies that approach the optimal.
We use our bound on error to understand workload complexity-that is, the relative difficulty of simultaneously answering a workload of queries accurately. For instance, sets of multi-dimensional range queries are "easier" to answer than one dimensional range queries. We also use the error bound to evaluate the quality of existing approaches. The hierarchical and wavelet strategies mentioned above are fairly close to optimal in some cases, but can be significantly improved in others. For example, for two-dimensional range queries, the wavelet strategy results in error 2.2 times the optimal while our algorithm finds a strategy that is just 10% greater than the optimal. Ultimately, we conclude that adapting the matrix mechanism to the specific properties of a workload is crucial: there are workloads for which the total error achieved using our algorithm is an order of magnitude less than that of existing techniques.

Background
In this section we describe our data model and privacy conditions. We also review the fundamentals of the matrix mechanism, including error measurement and our main problem of strategy design.

Data model and linear queries
The database I is an instance of a single-relation schema R(A), with attributes A = {A 1 , A 2 , . . . , A m }. The crossproduct of the attribute domains, written dom(A), is the set of all possible tuples. In order to express our queries, we first construct from I a vector x of cell counts. Each element x i of x is associated with cell(x i ), a disjoint subset of dom(A). Then x i is the count of the tuples from cell(x i ) that are present in I: x i = |{t ∈ I|t ∈ cell(x i )}|. All queries are expressed using the cell counts in x. We always use n for the size of x, which we sometimes refer to simply as the domain size.
One way to define the vector x is to choose the smallest possible cells: one cell for each tuple in dom(A). This is often inefficient (the size of the x vector is the product of the attribute domain sizes) and ineffective (the base counts are typically too small to be estimated accurately under the privacy condition). Instead, we often consider queries over larger cells. A common way to form a vector of base counts is to partition each dom(A i ) into d i regions, which could correspond to ranges over an ordered domain, or individual elements (or sets of elements) in a categorical domain. Then the individual cells are defined by taking the crossproduct of the regions in each domain. Other alternatives are possible as the cells need not be formed from contiguous subsets of the attribute domains as long as all cells are disjoint. Constructing a vector of base counts appropriate to a workload is usually straightforward but we provide a practical example in App. A to aid the reader.
A linear query computes a specified linear combination of the cell counts in x.
Definition 2.1 (Linear query). A linear query is a length-n row vector q = [q 1 . . . q n ] with each q i ∈ R. The answer to a linear query q on x is the vector product qx = q 1 x 1 + · · · + q n x n .
A set of queries is represented as a matrix, each row of which is a single linear query.

Definition 2.2 (Query matrix).
A query matrix is a collection of m linear queries, arranged by rows to form an m × n matrix.
If W is an m × n query matrix, the query answer for W is a length m column vector of query results, which can be computed as the matrix product Wx.
A workload is a query matrix representing a batch of linear queries of interest to a user. We introduce notation for two common workloads which contain all queries of a certain type. AllRange(d 1 , . . . d k ) refers to the set of all multi-dimensional range-count queries over k ordered domains, where each is divided into d i regions. Here the size of the cell count vector, n, is the product is the set of all predicate counting queries over n cells. AllPredicate(n) contains all 2 n linear queries of size n with coefficients of 0 or 1. We also consider workloads consisting of arbitrary subsets of each of these types of queries, low-order marginals, and their combinations.

Privacy definitions and mechanisms
Standard -differential privacy [4] places a bound (controlled by ) on the difference in the probability of query answers for any two neighboring databases. For database instance I, we denote by nbrs(I) the set of databases differing from I in at most one record. Approximate differential privacy [3,11], is a modest relaxation in which the bound on query answer probabilities may be violated with small probability (controlled by δ). Definition 2.3 (Approximate Differential Privacy). A randomized algorithm K is ( , δ)-differentially private if for any instance I, any I ∈ nbrs(I), and any subset of outputs S ⊆ Range(K), the following holds: Both definitions can be satisfied by adding random noise to query answers. The magnitude of the required noise is determined by the sensitivity of a set of queries: the maximum change in a vector of query answers over any two neighboring databases. However, the two privacy definitions differ in the measurement of sensitivity and in their noise distributions. Standard differential privacy can be achieved by adding Laplace noise calibrated to the L 1 sensitivity of the queries [4]. Approximate differential privacy can be achieved by adding Gaussian noise calibrated to the L 2 sensitivity of the queries [3,11]. This small difference in the sensitivity metric-from L 1 to L 2 -has important consequences for our algorithms and our theoretical results. Our results focus on approximate differential privacy, but App. B contains a thorough comparison of these two definitions as they pertain to the matrix mechanism and the results of this paper.
Since our query workloads are represented as matrices, we express the sensitivity of a workload as a matrix norm. Because neighboring databases I and I differ in exactly one tuple, and because cells are disjoint, it follows that the corresponding vectors x and x differ in exactly one component, by exactly one, in which case we write x ∈ nbrs(x). The L 2 sensitivity of W is equal to the maximum L 2 norm of the columns of W. Below, cols(W) is the set of column vectors W i of W. Proposition 2.1 (L 2 Query matrix sensitivity). The L 2 sensitivity of a query matrix W is denoted ||W|| 2 , defined as follows: The classic differentially private mechanism adds independent noise calibrated to the sensitivity of a query workload. We use Normal(σ) m to denote a column vector consisting of m independent samples drawn from a Gaussian distribution with mean 0 and scale σ. Proposition 2.2. (Gaussian mechanism [3,11]) Given an m × n query matrix W, the randomized algorithm G that outputs the following vector is ( , δ)-differentially private: Recall that Wx is a vector of the true answers to each query in W. The algorithm above adds independent Gaussian noise (scaled by the sensitivity of W, , and δ) to each query answer. Thus G(W, x) is a length-m column vector containing a noisy answer for each linear query in W.
The matrix mechanism has a similar form as the algorithm above, but adds a more complex noise vector. It uses a different set of queries (the strategy matrix, A) to construct this vector. [10]) Given an m × n query matrix W, and assuming A is a full rank p × n strategy matrix, the randomized algorithm M A that outputs the following vector is ( , δ)-differentially private: where σ = ||A|| 2 2 ln(2/δ)/ Here A + is the pseudo-inverse of A: The intuitive justification for this mechanism is that it is equivalent to the following three-step process: (1) the queries in the strategy are submitted to the Gaussian mechanism; (2) an estimatex for x is derived by computing thex that minimizes the squared sum of errors (this step consists of standard linear regression and requires that A be full rank to ensure a unique solution); (3) noisy answers to the workload queries are then computed as Wx. The answers to W derived in step (3) are always consistent because they are computed from a single noisy version of the cell counts,x.
Like the Gaussian mechanism, the matrix mechanism computes the true answer vector Wx and adds noise to each component. But a key difference is that the scale of the Gaussian noise is calibrated to the sensitivity of the strategy matrix A, not that of the workload. In addition, the noise added to query answers is no longer independent, because the vector of independent Gaussian samples is transformed by the matrix WA + .
Example 2.1. The full rank strategy matrix with least sensitivity is the identity matrix, I, which has sensitivity 1. With A = I, the matrix mechanism formalizes the approach mentioned in Sec. 1 which computes individual counts and sums them to answer range queries. At the other extreme, the workload itself can be used as the strategy: A = W. In this case, there is no benefit in sensitivity over the Gaussian mechanism. For many workloads, neither of these naive strategies offer optimal error. For W = AllRange(n), two strategies were recently proposed. The hierarchical strategy includes the total sum over the whole domain, the count of each half of the domain, and so on, terminating with counts of individual elements of the domain. The wavelet strategy consists of the matrix describing the Haar wavelet transformation. Informally, these achieve low error because they each have low sensitivity, O(logn), and every range query can be expressed as a linear combination of few strategy queries.

Error of the Matrix Mechanism
We measure the accuracy of differentially private query answers using mean squared error. For a workload of queries, the error is defined as the total of individual query errors.

Definition 2.4 (Query and Workload Error).
Letŵ be the estimate for query w under the matrix mechanism using query strategy A. That is,ŵ = M A (w, x). The mean squared error of the estimate for w using strategy A is: Given a workload W, the total mean squared error of answering W using strategy A is: The query answers returned by the matrix mechanism are linear combinations of noisy strategy query answers to which independent Gaussian noise has been added. Thus, as the following proposition shows, we can directly compute the error for any linear query w or workload W: Proposition 2.4. (Total Error) Given a workload W, the total error of answering W using the ( , δ) matrix mechanism with query strategy A is: The trace is the sum of the elements on the main diagonal of a square matrix. Our main objective is to minimize this formula, which is determined by the relationship between A and W. Note that x (the vector of cell counts corresponding to the database) does not appear in this expression. The minimum error strategy depends on the workload alone, not on the database instance.

The strategy design problem
The optimal strategy for a workload W is defined to be one that minimizes the total error under the ( , δ)-matrix mechanism.
Problem 2.1. (Minimizing Total Error) Given a workload W, find a query strategy A 0 such that: The exact solution to Problem 2.1 can be computed using a semi-definite program (SDP) [10]. However, finding the solutions of the program with standard SDP solvers takes O(n 8 ) time, making it infeasible for common applications. Therefore, our goal in this paper is to efficiently find approximations to the optimal strategy, for any provided workload.

Theoretical Analysis
In this section we present novel theoretical results which provide a foundation for the algorithms that come later, and which aid in evaluating both the quality of strategy matrices and the complexity of workloads.

Analysis of Strategies
An analysis of strategies allows us to characterize those which are possible solutions to the strategy design problem.
Definition 3.1 (Partial Order on Strategies). The following relation defines a partial order on strategies.
Strategy Equivalence: Two strategy matrices A 1 and A 2 are equivalent ( Strategy Efficiency: Strategy A 1 is more efficient than A 2 , written A 1 ≤ A 2 , if for all linear queries q, A strategy can never be the solution to the strategy design problem (Problem 2.1) if there is another strategy that is more efficient than it. We call a strategy minimal if it is a minimal element in the partial order above.
We show next that the set of minimal strategies has a straightforward characterization for the ( , δ) matrix mechanism. Notice that since the sensitivity of a strategy is measured according to its maximum column norm, a strategy with some columns that do not match the maximum is wasteful: we could add queries containing non-zero entries in the deficient columns without increasing sensitivity. These added queries will provide additional evidence that can be used to reduce overall error, so completing deficient columns can never result in a worse strategy. This suggests that column uniformity is a necessary condition for a minimal strategy. But we can also show that it is a sufficient condition. (The proof is included in App. D.1.) Another important property of the ( , δ) matrix mechanism is that redundant queries do not lead to less efficient strategies. We say a query in strategy matrix A is redundant if it is a linear combination of another query in A. In this case the queries provide the same evidence about the database, but one may be scaled relative to the other, resulting in lesser or greater accuracy. The following theorem shows that a strategy with a redundant queries is equivalent to a strategy with the redundancy removed.
The fact that the presence of redundant queries does not lead to less efficient strategies has important consequences for efficient strategy design algorithms. Because of this property, an algorithm can make a local choice to add a query to a strategy, adding the same query again later to augment its weight if necessary.
Thm. 3.1 and Thm. 3.2 do not hold for the -matrix mechanism. Please see App. B for details.

The singular value bound
Next we explain our main theoretical result, a lower bound on the error for a workload. We first define the singular value decomposition of a workload.

Definition 3.3 (Decomposition of Workload).
Let W be any m × n query workload. The singular value decomposition (SVD) of W is a factorization of the form A = Q W D W P T W such that Q W is a m × m orthogonal matrix, D W is a m × n diagonal matrix and P W is a n × n orthogonal matrix. When m > n, the diagonal matrix D W consists of an n × n diagonal submatrix combined with 0 (m−n)×n .
The bound on the total error for a workload is derived from its singular value decomposition.
A strategy matrix A can be considered to have two parts: its eigenvalues and its eigenvectors. When A is column-uniform, the total error can be represented as a polynomial of those two parts. The key idea behind the SVD bound is to ignore the constraint that A is column uniform and choose eigenvalues and eigenvectors separately to minimize the polynomial, which leads to an under-estimate of the total error. The details of this proof are presented in App. D.1.
We use svdb(W) as shorthand for the singular value bound of workload W. Given a workload W, svdb(W) can be computed easily using standard methods for matrix decomposition, or it can be computed directly from W T W: where P ( , δ) For m × n workload W, computing svdb(W) takes O(mn 2 ) time on W itself and takes O(n 3 ) time on W T W, which significantly reduces the running time when the number of queries, m, is much larger than n. In the case of large regular workloads such as AllRange and AllPredicate, W T W can be computed directly. Then computing svdb(W) improves from O(n 5 ) to O(n 3 ) for AllRange and O(n 2 2 n ) to O(n 3 ) for AllPredicate.
Example 3.1. For AllRange(1024) and AllRange(32, 32), the SVD bound on the total error is 5.32×10 6 and 4.39×10 6 , respectively. Below we report, as a ratio of the SVDB bound, the total error of these workloads for a number of known strategy matrices: the workload itself, the identity, hierarchical and wavelet: workload In the next section we present an algorithm that finds better strategies: the ratio of total error on AllRange(1024) and AllRange(32, 32) using the strategies computed by the algorithm is 1.26 and 1.08, respectively.

Properties of the singular value bound
The SVD bound has a number of properties which make it a reliable measure of workload complexity. Notice that in the expression for Error A (W) in Prop. 2.4, the workload W appears only in the trace term, as W T W. An immediate implication is that a strategy that achieves minimal total error for a given workload W 1 achieves minimal error for any workload W 2 such that W T 1 W 1 = W T 2 W 2 . We therefore define the following notion of equivalence: Since the SVD bound is determined by the singular values, it follows immediately that equivalent workloads have equal error bounds. That is, if W 1 ≡ W 2 , then svdb(W 1 ) = svdb(W 2 ). In addition, as we would hope, the SVD bound of a workload increases monotonically under the addition of new queries. Thus if W 1 is a workload and W 2 is a workload that results from adding one or more linear queries to the rows of W 1 , then svdb(W 1 ) ≤ svdb(W 2 ). A more general result is shown below, accounting for the fact that the larger workload may be the augmentation of any workload equivalent to the smaller workload. (The proof is omitted.) Theorem 3.4. Let W 1 , W 2 be workloads. If there exists a workload W 2 equivalent to W 2 and the rows of W 2 contain all the rows of W 1 , then svdb(W 1 ) ≤ svdb(W 2 ).
Lastly, and most importantly, the singular value bound is tight. For a certain set of variable agnostic workloads, it is possible to directly construct a strategy achieving the bound. Intuitively, variable agnostic workloads treat every variable in the domain in an equivalent manner. The workload AllPredicate(n) is variable agnostic, but AllRange(n) is not because, for example, variables in the middle of the domain occur more often in the set of all range queries. In App. C we show how to construct the optimal strategy for any variable agnostic workload, including for AllPredicate(n).
We do not know if the singular value bound is achievable for every workload (namely those that are not variable-agnostic). However experimentally we find that we can compute strategies that approach this bound.

Strategy Selection Algorithms
In this section we present an algorithm, along with a set of performance optimizations, for computing a close-to-optimal strategy for a given workload.

The Level Selection Algorithm (LSA)
The Level Selection Algorithm (LSA) takes as input a workload and returns a strategy matrix designed to offer low error for the workload. LSA is a localized search algorithm which builds a strategy matrix by choosing, at each step, the level of queries whose addition maximally reduces error for the workload. A level is a set of linear queries consisting of coefficients 0 or 1, determined by a partitioning of the variables, so that each variable appears in exactly one query. Recall that, according to Thm. 3.1, minimal strategy matrices are precisely those that are column uniform. By constructing a strategy by levels, the LSA algorithm always chooses among minimal strategies.
To construct a new level, the LSA algorithm starts with the simplest level: the query [1, 1, . . . 1] which is the sum of all cells. The algorithm then performs a top-down search, recursively bisecting the query into smaller queries such that the error of the workload is maximally reduced. Once a level is completed, the LSA algorithm computes the total error of the workload with and without that level. If the total error is not improved by the level, the algorithm terminates and outputs the current strategy. Otherwise the level is added to the output strategy, and, subject to a user-defined threshold k on the number of levels, the next level is then constructed.
The search space of LSA is quite general. Both the hierarchical strategies from [9] and (a strategy equivalent to) the wavelet strategy [13] can be constructed by levels. But the LSA algorithm is not limited to hierarchical strategies because there is no constraint that lower level queries are contained in higher level queries. Further, while levels are constructed initially with coefficients of 0 or 1, the final output strategy may have a complex set of weights on queries, because redundant queries may be added in different levels. These redundant queries can be combined, as shown in Thm. 3.2, by appropriate weighting.  for each query q in δ A do 6: find a pair (i, j) such that split at position i on dimension j such that using query: i-th dimension greater than or equal to j} to take the place of query q in δ A and A = A δ A minimizes Error A (W). 7: end for 8: if Error A (W) is reduced then update δ A , 9: until δ A was not updated; 10: if Error A (W) ≤ Error A (W) then A = A . 11: until A was not updated or ||A|| 2 2 ≥ k; 12: return A.

Complexity of the LSA algorithm
Note that Program 4.1 can use W T W instead of W as input without impacting any computation or the final output. This implies that equivalent workloads produce equivalent outputs, and also that the complexity of Program 4.1 does not depend on the number of queries in W.
In each iteration, the algorithm needs to find the split point which maximizes the reduction of total error. This occurs in Step 6 and it is the most time-consuming part of Prog  In experiments we have run the LSA algorithm to termination and found that the number of levels is much smaller than n and that it converges quickly. Fig. 1 shows the convergence of the error as a function of the bound k on the number of levels for W = AllRange(512). In addition, although the worst case cost of the LSA algorithm is O(kn 4 ), empirically we find that the running time increases approximately with O(kn 3 ).

The LSA Algorithm on Large Domains
In the remainder of this section we present two techniques for efficiently scaling the LSA algorithm to larger domains.

Workload Separation
The domain for workloads over multi-dimensional data can increase with the product of the attribute domains. To avoid this, many common workloads, such as those resulting from sets of low-order marginals, can be decomposed so that each dimension can be treated separately. This process of workload separation can significantly improve efficiency with little impact on overall error. Definition 4.1. Given a workload W, query q is called a separating query for W if there exists a list of subsets W 1 , W 2 , . . . , W k of W for which the estimate of W i does not involve queries in W 1 , . . . , W i−1 , W i+1 , . . . , W k when the answer of query q is fixed. The subsets W 1 , W 2 , . . . , W k are called separated workloads of W under query q.
Given a workload W and one of its separating queries q, notice that answering queries in each separated workload does not involve other queries in the workload. Thus workload separation can be applied in two phases. In the first phase, the separating query q is answered directly, using the Gaussian mechanism with fixed accuracy. In the second phase, the strategies for each separated workload of W are computed with the LSA algorithm. Since each separated workload contains queries with simpler structure, the buckets that always appear at the same time in one separated workload can be grouped into a single bucket so as to reduce the domain size.
One of the key applications of workload separation is for workloads consisting of sets of marginal queries and predicate queries over marginals, explained in the following theorem.
Theorem 4.2. Let W 1 , . . . , W k be sets of predicate queries over one-way marginals on k different dimensions. Let q 0 be the sum of all the entries on the domain. With the answer of q 0 given, the estimate of any query in W i does not involve queries in W 1 , . . . , W i−1 , W i+1 , . . . , W k .
More generally, when a workload contains predicate queries over up to k-way marginals, such as datacube queries, workload separation can then be applied recursively, reducing the problem to low-or even onedimensional problems.
Example 4.2. Consider a query workload consisting of all one-dimensional range queries over each of two dimensions, with domains of size n 1 and n 2 . Such a workload would typically be represented over a set of cell counts of size n 1 × n 2 , and the LSA algorithm would take O(k(n 1 n 2 ) 4 ) time. The separated workloads are AllRange(n 1 ) and AllRange(n 2 ) and the cost of running LSA is reduced to O(k(n 4 1 + n 4 2 )).

Workload Generalization
As a second optimization, called workload generalization, we initially merge cells in the domain, creating an approximation of the original workload over a much smaller domain. The LSA algorithm is executed on this generalized workload to produce an initial generalized strategy. Then, in a second phase, we run a slightly modified  . This is the asymptotic cost as matrix multiplication, thus it is a natural lower bound for the running time of an algorithm of this form. Workload generalization results in much faster execution time, but sacrifices solution quality in comparison the LSA algorithm, resulting in modestly higher error. We evaluate this experimentally in the next section.

Experimental Evaluation
There are two parts to the experimental evaluation of our techniques. First, we study the complexity of different workloads using the singular value bound. Second, we evaluate the quality of strategies generated by the LSA algorithm, as well as the effectiveness of the workload separation and generalization techniques. Recall from Sec. 2.3 that the error of the matrix mechanism, and therefore the choice of strategy, is independent of the database instance. As a consequence, the results that follow do not use an input database-they are purely an analysis of workloads and the error rates possible in answering these workloads.

Workload Complexity
We can use the singular value bound to gain insight into the complexity of workloads-the essential hardness of answering a set of queries under the matrix mechanism. We begin by reporting the SVD bound for all range workloads on five different domains, all with a domain size 1024 but different number of dimensions. The comparison is shown as the lightest grey bars in Figure 3(a), where 2 10 means the 10-dimensional domain with each dimension size equal to 2. As the number of dimensions increases with the overall domain fixed, the total number of range queries decreases, leading to lower complexity workloads, as shown by the decreasing SVD bound in the figure.
Our next experiment, shown in Figure 2, samples a matching number of distinct queries from each workload and considers the average error of the sampled query sets. The complexity of a sampled query set is measured by the ratio between average error of the sample and the average error of the complete query set. Moreover, the experiment uses both uniform sampling and a biased sampling method 1 to study whether the SVD bound is related to the sampling method.  shows that even very small workloads of uniformly sampled queries (10000 queries, or roughly 2-6% of the entire workload of range queries) reach the error levels of the entire workload. When biased sampling is used to construct workloads, the error ratio approaches 1 more slowly. Overall, this may have important consequences for the strategy selection problem. It suggests that, for workloads of just modest size, there is no error penalty in adopting a query strategy tuned to a larger regular workload such as AllRange for the appropriate domain size.

Effectiveness of the LSA Algorithm
To assess the effectiveness of the LSA algorithm we compare the total error under its strategies with other strategies from the literature, and with the optimal error as derived from the SVD bound. The first experiment, shown in Figure 3(a), explores AllRange workloads over the five multi-dimensional domains mentioned above. We compare the LSA-computed strategy with the wavelet strategy [13] and the hierarchoosing a range decreases exponentially with the distance between the center of the query and the center of the domain. The motivation of having this sampling method is to create a way of sampling that has different properties with uniform sampling, which can also be viewed as a process where users whose most interested region is at the extreme of the domain so that they tend to generate queries that are far away from the center. chical strategy [9]. Recall that both these strategy matrices were are originally designed for -differential privacy, but in fact they perform even better under ( , δ)-differential privacy. The hierarchical tree algorithm only appears in the first group of comparisons because it is oriented towards one-dimensional queries.
Both the wavelet and the hierarchical strategies perform well in the one-dimensional case: their error is 1.53 times the optimal and 1.78 times the optimal, respectively. The LSA algorithm finds a better strategy, 1.26 times the optimal. In higher dimensions the performance improvement over wavelet is much larger, demonstrating the importance of adapting the strategy to the workload. For example, for AllRange (16, 8, 8), LSA error is 1.07 times optimal while wavelet is 4.17 times optimal. Overall, the error of LSA strategies comes very close to the optimal singular value bound in higher dimensions.
To further test the benefits of adapting the strategy to the workload, we considered random workloads of range queries grouped by average coverage percentage, which is the average percentage of cells that are covered by a query. As shown in Figure 3(b) (note the logarithmic scale), the LSA strategies have error rates very close to optimal and outperform the wavelet strategy by more than an order of the magnitude in the most extreme case.
Next we evaluate the workload separation and workload generalization techniques for improved efficiency of the LSA algorithm on large domains. Figure 3(c) shows the workload separation technique on range queries over pairs of one-way marginals with increasing domain sizes. Using LSA with workload separation has a negligible penalty in error: it is almost identical to the original LSA (and the optimal SVD bound), yet the computational cost is improved by more than three orders of magnitude: On domain 32 · 32, the running time is reduced from 5079 seconds to merely 2.44 seconds.
To evaluate the workload generalization techniques we considered skew-sampled workloads on one dimension, since their properties differ from AllRange workloads. Figure 3(d) compares the performance of LSA generalized on domain size n 1/3 , the original LSA algorithm, the wavelet strategy, and the singular value bound. Generalized LSA performs almost as well as the original LSA algorithm. However, the computational cost is decreased significantly: for domain 1024, the cost is reduced by a factor of 18.

Related Work
The matrix mechanism [10] analyzed in a unified framework two prior techniques for accurately answering range queries. The first used a wavelet transformation [13]; the second used a hierarchical set of queries followed by inference [9]. The original work on the matrix mechanism focused primarily on -differential privacy, although ( , δ)-differential privacy was considered briefly. In both cases, it was shown that semidefinite programming could be used to compute a minimum error strategy for a workload, but solving such programs is not infeasible. The present work provides tractable methods for computing low-error strategies for any given workload.
Workload complexity under -differential privacy has been studied before. Hardt and Talwar [8] present a lower bound for randomly generated predicate workloads. More generally, Blum et al. [1] show that workload complexity is related to the VC dimension of the workload. This measure is not directly comparable to our singular value bound since the former concerns -differential privacy. Also, the VC dimension of any onedimensional range workload is constant, while our measure captures more detailed differences in workloads.
Put in our terms, Xiao et al. [14] propose a method for computing a strategy matrix using KD-trees and private accesses to the database. Their query answers could be improved and made consistent by employing the matrix mechanism. Roth and Roughgarden [12] describe a data-dependent mechanism to answer predicate queries on databases with 0-1 entries. Hardt et. al [7] provide a linear time algorithm for the same query and database setting. The trade-off between accuracy and efficiency among data-dependent and data-independent methods deserves further investigation.

Conclusion
Standard differentially-private mechanisms for answering a workload of queries require noise determined by the sensitivity of the queries. We have shown that it is possible to satisfy the privacy condition with substantially less noise, and that the noise required is related to the spectral properties workload. Our methods allow the privacy mechanism to be efficiently adapted to the workload, achieving error improvements of as much as one order of magnitude over prior techniques.

A Data model and Domain
In this section we provide a brief concrete example to explain how a workload of counting queries can be expressed as a set of linear queries over a vector of cell counts x. Consider the following relational schema describing students: Note that each query of interest should be listed in the workload. We do not omit queries whose answers could be calculated from other queries in the workload. For example, Q 2 is included in the workload even though it could be computed by summing Q 3 and Q 4 . Noise accumulates when summing noisy query answers, so we include each desired query and minimize the total error. Also, the relative accuracy of a query in the workload can be controlled by linearly scaling its row by a coefficient.
For this domain, the workload of all range queries is written AllRange(4, 2) and consists of all two dimensional range queries over gradyear and gender, where the possible "ranges" for gender are simply M , F , or (M ∨ F ). This workload consists of 30 queries. The workload AllPredicate(8) includes all 2 8 linear queries expressed over x with coefficients in {0, 1}.
Also note that for the workload W above, the pair of elements x 5 , x 6 and x 7 , x 8 always appear together. The included queries do not distinguish between males and females in year 2013, or in year 2014. For this reason, each pair of variables could be replaced by a single variable, reducing the vector x to size 6.

B Comparison of the -and ( , δ)-Matrix Mechanisms
In this appendix we consider how our main results, which apply to approximate differential privacy, compare to corresponding results under standard differential privacy. We begin with definitions for the -matrix mechanism in Sec. B.1. Then, in Sec. B.2, we describe key differences that make the strategy selection problem harder under -differential privacy. While the privacy guarantees of the two mechanisms are formally distinct, for conservative settings of δ, one may be indifferent to the two guarantees and consider which mechanism offers lower error for a fixed . In Sec. B.3 we show that the error of the ( , δ)-matrix mechanism is favorable for a wide range of strategies including those considered in this paper.

B.1 Definitions, -Matrix Mechanism
Standard differential privacy is defined as follows: Definition B.1 (Differential Privacy). A randomized algorithm K is -differentially private if for any instance I, any I ∈ nbrs(I), and any subset of outputs S ⊆ Range(K), the following holds:   Under the -matrix mechanism, Y 2 is strictly more efficient than Y 1 because Y 2 1 < Y 1 1 .
Under -differential privacy, query sensitivity is measured using the L 1 distance. For a query matrix W, the L 1 sensitivity is the maximum L 1 norm of the columns of W.
Proposition B.1 (L 1 Query matrix sensitivity). The L 1 sensitivity of a query matrix W is denoted W 1 and is defined as follows: The standard mechanism for achieving -differential privacy adds Laplace noise calibrated to the L 1 sensitivity. We use Laplace(b) m to denote a column vector consisting of m independent samples drawn from a Laplace distribution with mean 0 and scale b.
Proposition B.2 (Laplace mechanism). Given an m × n query matrix W, the randomized algorithm L that outputs the following vector is -differentially private: The matrix mechanism is defined almost identically to Prop. 2.2, but with Laplace noise in place of Gaussian noise. Proposition B.3. ( -Matrix Mechanism [10]) Let A be a full rank m × n strategy matrix and let W be any p × n workload matrix. Then the randomized algorithm M A that outputs the following vector is -differentially private: The analysis of error for the -matrix mechanism differs only in the sensitivity and terms: Proposition B.4. (Total Error) Given a workload W, the total error of answering W using the matrix mechanism with query strategy A is:

B.2 Main Distinctions
The analysis of error differs between the two mechanisms because of the difference in sensitivity metrics. From Prop. B.4 and Prop. 2.4 the two expressions for error can be compared (ignoring privacy parameters): The trace terms are identical, so these expressions differ only in the sensitivity metric applied to A. The implications of this small difference are significant for optimizing the expressions, primarily because ||A|| 2 is uniquely determined by A T A (it is in fact the largest diagonal entry of matrix A T A). This means that whenever two different strategies A and B are such that A T A = B T B, then under ( , δ)-matrix mechanism they have equivalent error, so A ≡ B. But A 1 is not determined by A T A, so it is possible to have Then it follows that under -matrix mechanism A and B are not equivalent. Instead strategy B is strictly more efficient than A.
This difference in invalidates many results that hold for the ( , δ)-matrix mechanism. First of all, the optimal strategy under ( , δ)-matrix mechanism can be found via a semi-definite programming (SDP) that computes the matrix A T A to minimize the total error formula. The solution to this program is insufficient, however, under the -matrix mechanism, because we need to compute an strategy A with minimum L 1 sensitivity. To do so, extra non-convex constraints must be added which requires solving a non-convex extension of an SDP (an SDP with rank constraints) to get an optimal strategy.
Further, the singular value bound does not hold under the -matrix mechanism and the properties of redundant queries under -matrix mechanism change. Unlike Thm. 3.2, the presence of redundant queries leads to unneeded error: Theorem B.1 (Redundant Queries). Suppose strategy A 1 = {A 0 ∪ q ∪ c 1 q} for some strategy A 0 , some linear query q, and some constant c 1 . Then, under -matrix mechanism, the reduced strategy A 2 = {A 0 ∪c 2 q} where c 2 = 1 + c 2 1 is strictly more efficient than A 1 . Fig. 4 shows an example of a strategy matrix with redundant queries (Y 1 ) and a reduced strategy with lower L 1 sensitivity.
Finally, column uniformity no longer characterizes the minimal strategies (as in Thm. 3.1) and the quality of the output of the LSA algorithm tends to be lower. Intuitively, in the -matrix mechanism, the algorithm only has one chance to add a query to the strategy and needs to choose the correct weight before knowing how the remainder of the strategy will be built.

B.3 Error Comparison
Suppose we fix in both mechanisms and choose δ = 2/n 2 in ( , δ)-matrix mechanism, where n is the domain size. This is a conservative choice for δ, which results in error of the ( , δ)-matrix mechanism equal to: Comparing this equation with Eq. (4), indicates that the ( , δ) mechanism introduces less error whenever ||A|| 1 > log 1 4 n||A|| 2 . In particular, for strategy matrices A which consists of predicate queries (such as the output of LSA algorithm, hierarchical strategies [9] and (a strategy equivalent to) the wavelet strategy [13]), ||A|| 2 = ||A|| 1 . Using such a strategy matrix A, when ||A|| 1 > √ log n, the ( , δ)-matrix mechanism provides less error than -matrix mechanism.

C The Optimal Strategy for Variable Agnostic Workloads
To demonstrate that the singular value bound is a tight lower bound, we discuss a special type of workloads called the variable agnostic workloads and construct a strategy to such workloads that introduce error as low as the singular value bound.
Definition C.1 (Variable agnostic workload). A workload W is variable agnostic if W T W is unchanged when we swap two columns of W.
For any variable agnostic workloads W, W T W has the following form, for constants a and b: The next corollary gives a strategies which work on variable agnostic workloads with size n and have the total error equal to the the singular value bound.
Theorem C.1. For positive integer k and n = 2 k , let W be any m × n variable-agnostic workload. Then W T W has the following form, for constants a and b: and there exists a strategy A which attains the singular value bound which is svdb(W) = 1 n ( a + (n − 1)b+ Here we prove the following result: Q k is an eignvector matrix for W T k W k where W k is any 2 k × 2 k variable-agnostic workload. The eigenvalue corresponds to the first column of Q k is a + (2 k − 1)b and the eigenvalue corresponds to all the other columns is a − b, where a is the diagonal entry of W T k W k and b is the off diagonal entry of W T k W k . One can verify the result is true when k = 1. Now suppose the result is true for k − 1. Then Here J is the matrix whose all entries are 1. The computation of Eq. 5 uses the fact that the sum of first column of Q k is 2 k and the sum of any other column of Q k is 0. In addition, since, we know Q k is a eigenvector matrix for W T W. From above, we know the eigenvalues and a set of corresponding eigenvectors of W T W. According to the proof of Thm. 3.3, the svdb(W) can be achieved if and only if is a column-uniform matrix. Notice Q s k = J 2 k , according to Thm. D.1, the matrix above is column-uniform.
The total errors of using the identity matrix or the workload itself as the strategy matrix are both na. Compared with those total errors, the ratio of total error reduced by using the strategy in Thm. C.1 is approximately 1 − b a . Since the workload AllPredicate(n) is variable agnostic, a consequence of the above theorem is that we can find its optimal strategy.
Corollary C.1. For n = 2 k , the minimized total error for the workload AllPredicate(n) is equal to the singular value bound, which is 2 n−2 n (n − 1 + √ n + 1) 2 .

D Proof of Main Theorems
This section contains proofs of the most important theorems in Section 3 and 4.

D.1 Analysis of Minimal Strategies
Here we complete the proof characterizing minimal strategies and continue the discussion in order to prove the singular value bound.
Theorem 3.1. A strategy matrix A is minimal iff it is column-uniform.
Proof. If a strategy A 1 is not column-uniform, the strategy A 2 that is more efficient A 1 can be found according to the augmenting strategy theorem from [10]. Here we only show the proof that any columnuniform matrix is minimal under the partial order. Given two column uniform strategies A 1 and A 2 such that A 1 ≤ A 2 . Without loss of generality, we assume both of them have L 2 sensitivity 1, which means all diagonal entries of A T 1 A 1 and A T 2 A 2 are 1. Since A 1 ≤ A 2 , for any query w, Error A1 (w) ≤ Error A2 (w). According to the definition, Since (6) is true for arbitrary w, A T 2 A 2 − A T 1 A 1 is a positive semi-definite matrix. In addition, as the assumption, the diagonal entries of A T 1 A 1 and A T 2 A 2 are 1. Therefore the diagonal entries of A T 2 A 2 −A T 1 A 1 are all 0. According to properties of positive semi-definite matrix, there is an unique semi-definite matrix whose diagonal entries are all 0, which is the 0 matrix. Thus we have A 1 = A 2 .
As an application of Thm. 3.1, we have the following theorem.
Theorem D.1. If an m × n strategy matrix A connects to an optimal solution of Problem 2.1, A ∈ U m×n , which is also equivalent to Here A = Q A Λ A P A is the singular decomposition of A, vector λ A is the vector consists of the singular values of A, k is a real number and A s represents the element-wise square of a matrix A.
For any strategy matrix A, one can find an n × n matrix B such that A T A = B T B by decomposing matrix A T A. It is follows that Error A (W) = Error B (W) and therefore it is sufficient to consider only n × n strategy matrices in Problem 2.1 .Thus (1) can be represented using Frobenius norms, which is defined as following.
Definition D.1. (Frobenius Norm) Given an m × n matrix A = {a ij }, the Frobenius norm of matrix A is defined as the square root of the sum of squares of its elements It is also equal to the square root of the trace of matrix A T A According to the definition of Frobenius norm, assume strategy matrix A is a square matrix, (2) can be rewritten as follows: Lemma 1. If a workload W consists of two sets of independent queries, i.e. there exists an orthogonal matrix P such that , the strategy matrix A that minimizes total error has form where A 1 , A 2 are the solutions to problem 2.1 for W 1 , W 2 , respectively.
Proof. Given a strategy matrix A, consider the cholesky decomposition of A T A, which is in form Let strategy matrix A d be

Notice that
||A || 2 2 ≤ max{||A 1 || 2 2 , ||A 2 || 2 2 } = ||A d || 2 2 , we know Error A d (W) ≤ Error A (W). Thus the strategy matrix that minimizes (1) also has the same form as A d . Furthermore, if A 1 is not an optimal strategy for workload W 1 , let A * 1 be an optimal strategy for W 1 . Notice ||A1||2 ||A * ! ||2 A * 1 is also an optimal strategy for W 1 and substitute A 1 by ||A1||2 ||A * ! ||2 A * 1 in A d will bring down the Frobenius norm without boosting ||A d || 2 so that the total error becomes smaller. Thus, if A d is an optimal strategy for W, A 1 , A 2 must be the solutions to problem 2.1 for W 1 , W 2 , respectively.  Proof. For a given workload W, according to Thm. D.1, its optimal strategy matrix A satisfies A ∈ U n×n . Therefore, Let W = Q W Λ W P W and A = Q A Λ A P W be the singular decomposition of W and W, respectively, we have: As the proof of Lemma 1, the minimum of (8) achieved when P T W P A is a diagonal matrix. Thus P A = P W and The equal sign in (9) is satisfied if and only if Λ A = √ Λ W . Notice the inequality in (8) comes from removing the constraint that (Λ A P A ) ∈ U n×n , to satisfied the equal signs in (8) and (9) simultaneously, we need √ Λ W P W ∈ U n×n .

D.2 The LSA Algorithm and Extensions.
Lastly, we prove the complexity of the LSA algorithm and the basis of the workload separation technique. Proof. Notice in step 6 of Program 4.1, each time we compute the total error of a possible split of row [v 1 , v 2 , . . . , v n ] on position i, it is equivalent to modify matrix A by removing this selected row and add the following two rows to matrix A .
To apply Lemma 2, let X = A T A and U, Λ, V be the following matrices:  Let W 1 , . . . , W k be sets of predicate queries over one-way marginals on k different dimensions. Let q 0 be the sum of all the entries on the domain. With the answer of q 0 given, the estimate of any query in W i does not involve queries in W 1 , . . . , W i−1 , W i+1 , . . . , W k .
Proof. For any i, 1 ≤ i ≤ k and a query q ∈ W i . To estimate q, one needs to find a set of queries whose linear combination is equal to q 0 . Let the representation be q = l j=1 α j q j + h j=1 β j p j , where q j ∈ W i , 1 ≤ j ≤ l and p j ∈ n t=1,t =i W t , 1 ≤ j ≤ h. The equation above is equivalent to Notice the left hand side of Eq. (11) is the sum of one-way marginal queries on i-th dimension and the right hand side of Eq. (11) is the sum of one-way marginal queries that are not on i-th dimension. Since the only query that shared by the one-way marginal queries on i-th and not on i-th dimension is the total sum q 0 , where α 0 is a constant. Since the answer of q 0 is given, estimate with α 0 q 0 always have better accuracy than with the combination of h j=1 β j p j (which are noisy answers). Therefore estimating q only relates to queries in W i and q 0 but not queries in W 1 , . . . , W i−1 , W i+1 , . . . , W k .