Code to replicate the figures in the corresponding paper can be found on Github.
Introduction
In this work, we study the task of approximating a d×d matrix A with a matrix A of a sparsity pattern (e.g. diagonal, tridiagonal, block diagonal, etc.).
There are many existing linear algebra algorithms for matrices of a given sparsity pattern, so this task yields a proxy for A which is compatible with such algorithms.
For example, a banded approximation to A=M−1 could be used as a preconditioned to systems involving M.
The catch is that we assume A can only be accessed using matrix-vector products (called matvecs).
That is, we restrict ourselves to algorithms which choose vectors x1,…,xm and subsequently receive responses Ax1,…,Axm from some black-box, but cannot look at A in any other way.
We will measure the cost of algorithms by m, the total number of matrix-vector queries done, which in many settings may be a realistic proxy for the real-world costs.
This is often called the matrix-vector query model.
It’s worth noting that we can recover A in this access model by simply reading off the columns of A one-by-one.
This means we can effectively run any classical algorithm for the cost of d matvecs.
If d is very big this is not practical, but it is worth keeping in mind as a trivial upper bound for the cost of any algorithm in this model.
In general, our goal will be to design algorithms which use m≪d matvecs.
One of the most powerful features of the matvec query model is that it is often possible to prove lower-bounds for the hardness of a given task.
That is, to show that it is impossible (for any algorithm) to solve the task unless the algorithm uses at least a certain number of queries.
This is exciting, because it offers a way of understanding the “difficulty” of linear algebra tasks!
In contrast, proving lower-bounds on the number of floating point operations (which has classically been the measure of cost for linear-algebra algorithms), is seemingly far beyond current techniques.
One thing I think is really cool about this paper, is that almost everything is self-contained!
In particular, besides a few well-known results on properties of Gaussian matrices and a qualitative central limit theorem called the Berry-Esseen theorem, everything needed is proved within the paper using relatively elementary techniques which would be understandable to anyone with an undergraduate-level knowledge of linear-algebra and probability.
In fact, the general technique is so simple that we even prove a lower-bound for diagonal estimation on this page!
Overall, I hope that this paper can serve as a case-study on the power and beauty of the matrix-vector query model.
Two theoretical problems
For convenience, we will measure the error in the Frobenius norm:
∥A−A∥F=i,j∑([A]i,j−[A]i,j)2.
Let’s also encode the desired sparsity pattern in a binary matrix S.
The nonzero entries of S will tell us where A is allowed to have a nonzero entries.
It is pretty clear then that the best sparse approximation to A is simply S∘A, where “∘” is the Hadamard (entrywise) product.
That is, the best approximation is obtained by zeroing out the entries of A which are required to be zero.
We will study the following problems:
Problem 1 (Best approximation by a matrix of fixed sparsity).
Given a matrix A∈Rn×d and a binary matrix S∈{0,1}n×d, find a matrix A so that A=S∘A and
∥A−A∥F≤(1+ε)∥A−S∘A∥F.
Problem 2 (Best approximation to on-sparsity-pattern entries).
Given a matrix A∈Rn×d and a binary matrix S∈{0,1}n×d, find a matrix A so that A=S∘A and
∥S∘A−A∥F2≤ε∥A−S∘A∥F2.
Note that since A has the same sparsity as S; i.e. A=S∘A,
∥A−A∥F2=∥A−S∘A∥F2+∥S∘A−A∥F2.
This allows us to relate Problems 1 and 2, and for ε∈(0,1), the two are equivalent up to (small) constants.
A simple algorithm
When the sparsity pattern S has at most s non-zero entries per row, this algorithm uses m=O(s/ε) non-adaptive matrix-vector product queries.
Specifically, the algorithm computes Z=AG, where G is a d×m matrix with independent standard normal entries, and then outputs the matrix
A=X=S∘Xargmin∥Z−XG∥F.
It’s not hard to see how to implement this algorithm.
First, observe that each row of the approximation can be computed independently.
Then, note that the solution to each row is obtained by solving a standard least squares problem involving the relevant rows of G.
Using standard tools from high dimensional probability, which characterize the expected Frobenius norm of the pseudoinverse of a Gaussian matrix, it is relatively simple to establish the following convergence guarantee:
Theorem 1.
Consider any A∈Rn×d and any S∈{0,1}n×d with at most s nonzero entries per row.
Then, for any m≥s+2, using m randomized matrix-vector queries, the matrix A is equal to S∘A in expectation and satisfies
E[∥S∘A−A∥F2]≤m−s−1s∥A−S∘A∥F2.
The above inequality is equality if each row of S has exactly s non-zero entries.
If we set m=O(s/ε), then we solve Problem 2 (and hence Problem 1), at least in expectation.
One can then use Markov’s inequality to get a probability bound.
This matches the gurantees for a number of existing algorithms for special cases of Problem 1 and 2 [1,], [2], [3], [4], etc., and we comment on the connections in more detail in the paper.
A lower bound
For any fixed A, there is an algorithm which solves Problem 1 exactly using zero queries; simply hard-code the algorithm to output S∘A.
This is not a practically useful algorithm, because it only works for the one particular A and we would be unable to practically ``find’’ such an algorithm for a given matrix.
However, it means it’s impossible to prove a statement like: “For any matrix A, no algorithm using (some amount of queries depending on ε) can solve Problem 1”.
Instead, it is standard to consider a distribution of matrices A (or equivalently, a random matrix).
While an algorithm might be hard-coded for the particular distribution we consider, there is hope that the distribution is always still very random, even conditioned on a small number of arbitrary matvec queries.
In particular, in the paper we prove a precise version of the following:
Theorem 2.
There are constants c,C>0 so that, for any ε∈(0,c) and s≥1, there is a distribution on matrices A such that, for any sparsity pattern S in a broad class of sparsity patterns, and for any algorithm that uses m≤Cs/ε matrix-vector queries to A to output a matrix A,
P[∥A−A∥F≤(1+ε)∥A−S∘A∥F]≤251.
This shows that there are problems for which no algorithm can use more than a constant (e.g. 100) times fewer matvecs than the algorithm analyzed in the previous section.
At a high-level, the lower-bound technique is pretty simple.
The basic idea is that if A=GTG, where G is d×d random Gaussian matrix, then after a small number of (possibly adaptive) matvec queries to A, there is still too much randomness in A (conditioned on the information leared by the queri– in the compressed sensing setting, we have a necessaryes) to learn what we need [5].
A proof for diagonal estimation
To give a flavor of how the above lower-bound above is proved, we will now prove a simpler result for diagonal estimation; i.e. for when S=I.
We will be a bit cavalier 🤠 , providing a TCS style proof (you shouldn’t be just trusting things on the internet anyway).
Theorem 3.
There is a constant C>0 such that, for any ε>0 there are matrices A such that, for any algorithm that uses m≤C/ε matrix-vector queries to A to output a diagonal matrix A,
P[∥I∘A−A∥F2≤ε∥A−I∘A∥F2]≤251.
The key technical tool will be the following Lemma:
Lemma 1. Suppose A∼Gaussian(d,d) and let x1,…,xm and y1=Ax1,…,ym=Axm be such that, for each j=0,1,…,m, xj was chosen based only on the query vectors x1,…,xj−1 and the outputs y1,…,yj−1 and (w.l.o.g.) unit-length and orthogonal to x1,…,xj−1.
Let X=[x1,…,xm] and Y=[y1,…,ym].
Then, A can be factored as
A=[YG][XTZT],
where ZTX=0, ZTZ=I, and G∼Gaussian(d,d−m), independently of X and Y.
Proof.
Clearly A must be decomposed as above for matrix G (because this is just encoding what A does to the vectors in X).
It therefore suffices to argue that G is a Gauassian matrix independent of X and Y.
We proceed by induction, noting that the base case is trivial.
Suppose the lemma holds for m queries.
Choose xm+1 as a unit vector orthogonal to x1,…,xm (i.e. so that XTxm+1=0.
Note that xm+1=Zc, for some length d−m unit vector c; indeed, if xm+1 is orthogonal to X then it is in the span of Z, and it is unit-length if and only if c is unit-length.
Deterministically complete c or an orthogonal matrix
C=[cC^].
By the invariance of Gaussian vectors under unitary transforms,
[ym+1GC^]=GC∼Gaussian(d,d−m).
Moreover, since G was independent of X and Y, so is GC.
Thus, GC^ is independent of X, Y, and xm+1 and ym+1.
Now, using the orthogonality of C,
A=[YGC][XTCTZT]=[Yym+1GC^]XTxT(ZC^)T
Relabeling quantities gives the result.
□
We will also use the following fact:
Lemma 2.
Suppose a1+⋯+ad=d/2 and ai≤1.
Then at least d/4 of the ai are larger than 1/4.
Proof.
Let L={i:∣ai∣>1/4}.
Suppose, for the sake of contradiction, that ∣L∣<d/4.
Then
2d=i∈L∑ai+i∈Lc∑ai≤∣L∣⋅1+(d−∣L∣)⋅41<4d⋅1+d⋅41=2d.
This is a contradiction, so the result holds. □
Proof of Theorem 3
Set
d=ε1,m=4d,k=d−m,
and let A∼Gaussian(d).
First, note that ∥A∥F2 is a Chi-squared random variable with d2 degrees of freedom, and therefore has mean d2.
Therefore, by Markov’s inequality,
P[∥A∥2≤50d2]≥5049.
The algorithm want’s to approxiamte the diagonal of A=YXT+GZT, but after m queries it only knows X, Y, and Z.
We will show the diagonal of GZT is too random, so that it can’t be approxiamted well (in squared norm relative to O(d)).
Write the rows of G and giT and the columns of ZT as zi.
Then,
d=diag(GZT)=[g1Tz1,g2Tz2,⋯,gdTzd].
Note that since the entries of G are all independent Gaussians, the entries of d are also independent Gaussians!
In particular,
[d]i=giTzi=j=1∑k[gi]j⋅[zi]j∼j=1∑kN(0,[zi]j2)∼N(0,∥zi∥22).
The algorithm knows this, so the best choice of a guess for d is d=0; indeed, each entry is a mean zero Gaussian.
Thus, the algorithm can output a guess d=diag(YXT) for diag(A).
Then
∥diag(A)−d∥22=∥d∥22.
We will show that ∥d∥22 is typically large, so that the output always has high expected error.
Intuitively this makes sense; since the entries of d are Gaussian, and since the variance of a Gaussian is 1,
E[∥d∥22]=i=1∑dE[∣[d]i∣2]=i=1∑d∥zi∥22=∥Z∥F2=k=43d.
This is on the right scale, since ∥A−I∘A∥F2≤∥A∥F2=O(d2)=O(εd).
However, an expectation bound doesn’t prove a probability bound; it’s possible to have a large expectation because of a very large and very unlikely value.
In this particular case, we could simply use a standard anti-concentration result for Gaussians.
However, for the sake of mirroring the proof we used in the paper, we will use an alternate approach.
Note that the ∥zi∥22 can’t all be super small.
Indeed, let
L={i:∥zi∥22≥1/4}.
Since [XZ] is an orthogonal matrix ∥zi∥22≤1 and ∥Z∥F2=k≥d/2.
Thus, by Lemma 2, ∣L∣≥d/4.
Now, define
P={i∈L:∣[d]i∣>10−3}.
If i∈L, just by standard properties of Gaussians,
P[∣[d]i∣>10−3]≥10099.
This implies that P is not much smaller than L.
In particular,
P[∣P∣>∣L∣/2]≥5049.
We have now established that
∣P∣>∣L∣/2≥d/8 with probability at least 49/50, and
∥A−I∘A∥F2≤∥A∥F2≤50d2 with probability at least 49/50.
Thus, by a union bound, both events happen simultaneously with probability at least 24/25.
In this case, for some constant D,
∥I∘A−A∥F2≥∥d∥22=i=1∑d[d]i2≥4d⋅(10−3)2≥Dε∥A−I∘A∥F2.
Replacing ε with ε/D throughout the proof gives the result with C=1/(4D).
□
What changes in the general case?
The above proof actually captures pretty much all of the important ideas we use for the lower-bound provided in the paper.
There are a number of details which differ.
The most important are perhaps the following:
In the above proof, the entries of d were independent. For other sparsity patterns this won’t be the case.
While we used independence in our computation of the variance (which was just for intuition), we did not use independence in the actual proof.
In the paper, we use the distribution GTG.
This somewhat complicates the analog of Lemma 1, as well as computations (since things aren’t all Gaussian anymore).
However, it gives a lower-bound against the larger class of algorithms which can perform matvecs with the transpose.
In the paper we are more careful about saying things like “let d=1/ε” and “d=0 is the best choice”, and handle these cases explicitly / precisely.
References
1.
Curtis, A.R.; Powell, M.J.D.; Reid, J.K. On the Estimation of Sparse Jacobian Matrices. IMA Journal of Applied Mathematics1974, 13, 117–119, doi:10.1093/imamat/13.1.117.
2.
Bekas, C.; Kokiopoulou, E.; Saad, Y. An Estimator for the Diagonal of a Matrix. Applied Numerical Mathematics2007, 57, 1214–1229, doi:10.1016/j.apnum.2007.01.003.
3.
Halikias, D.; Townsend, A. Structured Matrix Recovery from Matrix‐vector Products. Numerical Linear Algebra with Applications2023, 31, doi:10.1002/nla.2531.
Braverman, M.; Hazan, E.; Simchowitz, M.; Woodworth, B. The Gradient Complexity of Linear Regression. In Proceedings of the Proceedings of thirty third conference on learning theory; Abernethy, J., Agarwal, S., Eds.; PMLR, 2020; Vol. 125, pp. 627–647.