TExcelTAD
Home › Streaming, Sketching & Sublinear Algorithms › Space Lower Bounds from Communication Complexity

Space Lower Bounds from Communication Complexity

The upper bounds of the course come with matching lower bounds, and almost all of them are proved the same way: a streaming algorithm with little memory would give a cheap communication protocol for a problem known to need a lot of communication. This lesson sets up the reduction, states the two communication problems that do most of the work (INDEX and DISJOINTNESS), and derives from them the Ω(n)\Omega(n) bounds for exact distinct counting and for F∞F_\infty, the role of approximation and randomization, and the threshold n1−2/kn^{1-2/k} for higher moments. Proofs of the communication bounds themselves are stated, not proved; the reductions are given in full.

From streams to messages

In one-way two-party communication, Alice holds an input xx, Bob holds yy, Alice sends one message to Bob, and Bob must output g(x,y)g(x, y). In the randomized version they share random bits and Bob must be correct with probability at least 2/32/3 (or 1−δ1 - \delta) on every input. The cost is the length of the message in bits.

Lemma (streaming to communication). Suppose a one-pass streaming algorithm with ss bits of memory computes gg on streams of the form "a stream σ(x)\sigma(x) that depends only on xx, followed by a stream τ(y)\tau(y) that depends only on yy". Then there is a one-way protocol for gg with an ss-bit message, with the same error probability.

Proof. Alice runs the algorithm on σ(x)\sigma(x) (with the shared random bits as its coins) and sends the memory state. Bob loads the state, continues the run on τ(y)\tau(y) and outputs the answer. □\square

With pp passes, the state is handed back and forth, 2p−12p - 1 messages of ss bits, so a lower bound of CC bits on (two-way) communication gives s≥C/(2p−1)s \ge C/(2p - 1). A lower bound on communication is therefore a lower bound on space, and it holds for every algorithm, however clever, which is what makes the method powerful.

Two hard problems

INDEX. Alice holds x∈{0,1}nx \in \{0,1\}^n, Bob holds an index i∈[n]i \in [n]; Bob must output xix_i. One-way communication only (Bob cannot talk back).

Theorem (stated; Ablayev, 1996; Kremer, Nisan and Ron, 1999). Every randomized one-way protocol for INDEX with error at most δ<12\delta < \frac{1}{2} sends at least (1−H2(δ)) n(1 - H_2(\delta))\, n bits, where H2H_2 is the binary entropy. In particular it needs Ω(n)\Omega(n) bits for δ=13\delta = \frac{1}{3}.

Intuition. Bob can ask for any of the nn bits, so the message must allow recovering a random bit of a random xx with error δ\delta, which by Fano's inequality requires 1−H2(δ)1 - H_2(\delta) bits of information per bit of xx.

DISJOINTNESS. Alice holds A⊆[n]A \subseteq [n], Bob holds B⊆[n]B \subseteq [n]; decide whether A∩B=∅A \cap B = \emptyset. Two-way communication allowed.

Theorem (stated; Kalyanasundaram and Schnitger, 1992; Razborov, 1992). Every randomized protocol for DISJOINTNESS with error at most 13\frac{1}{3} communicates Ω(n)\Omega(n) bits, even when ∣A∣=∣B∣=n/4\lvert A \rvert = \lvert B \rvert = n/4 and the sets intersect in at most one element.

Exact distinct counting needs Ω(n)\Omega(n) bits

Theorem. Every randomized one-pass algorithm that computes F0F_0 exactly with probability 23\frac{2}{3} uses Ω(n)\Omega(n) bits of memory.

Proof. Reduce INDEX. Alice streams the set {j:xj=1}\{j : x_j = 1\} and Bob appends the single item ii. Before Bob's item the number of distinct items is ∣x∣\lvert x \rvert (Bob can read it from the algorithm, or Alice can append it to the message in log⁡n\log n bits), and Bob's item adds one more distinct item exactly when xi=0x_i = 0. An exact F0F_0 algorithm therefore answers INDEX, and the lemma turns ss bits of memory into an s+O(log⁡n)s + O(\log n)-bit message. □\square

The reduction also shows why approximation is necessary: Bob's item changes F0F_0 by one, a relative change of 1/∣x∣1/\lvert x \rvert, invisible to any (1±ε)(1 \pm \varepsilon)-approximation with ε≫1/n\varepsilon \gg 1/n. The program makes the reduction concrete. Its "algorithm" is a Bloom-filter-based distinct counter with ss bits; Alice runs it on her set, the state is the message, and Bob asks whether item ii increases the count. The table compares the measured error with the information-theoretic requirement: a protocol with error δ\delta must use at least (1−H2(δ))n(1 - H_2(\delta)) n bits.

python · try it yourself
import math, random

MASK = (1 << 64) - 1
def mix64(x):
    x = (x + 0x9E3779B97F4A7C15) & MASK
    x = ((x ^ (x >> 30)) * 0xBF58476D1CE4E5B9) & MASK
    x = ((x ^ (x >> 27)) * 0x94D049BB133111EB) & MASK
    return x ^ (x >> 31)

class BloomDistinct:
    """A one-pass 'distinct counter' with s bits: a Bloom filter with 2 hashes that counts items it has not seen."""
    def __init__(self, s, salt):
        self.s, self.salt, self.bits, self.count = s, salt, 0, 0
    def add(self, x):
        h = mix64(x ^ self.salt)
        pos = [h % self.s, (h >> 32) % self.s]
        if not all(self.bits >> p & 1 for p in pos):
            self.count += 1
        for p in pos:
            self.bits |= 1 << p
    def state(self):                       # everything Alice must send: s bits (+ the counter)
        return self.bits, self.count

def index_protocol(x, i, s, salt):
    """INDEX from distinct counting: Alice streams {j : x_j = 1}, sends the state, Bob appends i."""
    alg = BloomDistinct(s, salt)
    for j, bit in enumerate(x):
        if bit:
            alg.add(j)
    msg = alg.state()                      # the one-way message
    bob = BloomDistinct(s, salt)
    bob.bits, bob.count = msg
    before = bob.count
    bob.add(i)
    return 0 if bob.count > before else 1  # the count grew: i was new, so x_i = 0

def H(p):
    return 0.0 if p in (0, 1) else -p * math.log2(p) - (1 - p) * math.log2(1 - p)

rng = random.Random(1999)
n, trials = 256, 400
print(f"INDEX with n = {n}: answer x_i from an s-bit message")
print("  s bits   s/n   measured error   bound: any protocol with this error needs s/n >= 1 - H(error)")
for s in [32, 64, 128, 256, 512, 1024, 2048]:
    wrong = 0
    for t in range(trials):
        x = [rng.randrange(2) for _ in range(n)]
        i = rng.randrange(n)
        wrong += index_protocol(x, i, s, t) != x[i]
    d = wrong / trials
    print(f"  {s:6}   {s / n:4.2f}   {d:14.3f}   {1 - H(d):.3f}")
INDEX with n = 256: answer x_i from an s-bit message
  s bits   s/n   measured error   bound: any protocol with this error needs s/n >= 1 - H(error)
      32   0.12            0.512   0.000
      64   0.25            0.492   0.000
     128   0.50            0.385   0.039
     256   1.00            0.220   0.240
     512   2.00            0.075   0.616
    1024   4.00            0.035   0.781
    2048   8.00            0.000   1.000

The measured points respect the bound, as they must. With s<ns < n bits the Bloom-filter counter is wrong about a quarter of the time or more; at s=2ns = 2n the error is still 7.5%, more than an optimal protocol would need for that many bits, because a Bloom filter is not an optimal encoding. No algorithm of any kind can do much better: a near-zero error forces s≈ns \approx n.

F∞F_\infty and other moments need Ω(n)\Omega(n) bits

Theorem (Alon, Matias and Szegedy, 1996). Every randomized algorithm with pp passes that approximates F∞F_\infty within a factor better than 2 with probability 23\frac{2}{3} uses Ω(n/p)\Omega(n/p) bits.

Proof. Reduce DISJOINTNESS: stream Alice's set, then Bob's. Every item has frequency 1 or 2, and F∞=2F_\infty = 2 exactly when the sets intersect. An approximation within a factor below 2 distinguishes F∞=1F_\infty = 1 from F∞=2F_\infty = 2, and a pp-pass algorithm with ss bits gives a protocol with (2p−1)s(2p - 1)s bits of communication. □\square

The same stream shows that exact F0F_0 and exact FkF_k for k≠1k \ne 1 need Ω(n)\Omega(n) bits even with several passes: F0=∣A∣+∣B∣−∣A∩B∣F_0 = \lvert A \rvert + \lvert B \rvert - \lvert A \cap B \rvert and Fk=∣A∣+∣B∣+(2k−2)∣A∩B∣F_k = \lvert A \rvert + \lvert B \rvert + (2^k - 2)\lvert A \cap B \rvert both reveal whether the sets intersect, while F1=∣A∣+∣B∣F_1 = \lvert A \rvert + \lvert B \rvert does not, as the table confirms.

python · try it yourself
import random
from collections import Counter

def stream_from(A, B):
    return sorted(A) + sorted(B)          # Alice's items, then Bob's

rng = random.Random(7)
n = 20
print("  |A|  |B|  A and B disjoint?   F_inf   F_0    |A| + |B| - F_0   F_2 - (|A| + |B|)")
for t in range(6):
    A = set(rng.sample(range(n), 5))
    B = set(rng.sample(range(n), 5)) if t % 2 else set(rng.sample(sorted(set(range(n)) - A), 5))
    f = Counter(stream_from(A, B))
    F0, F2, Finf = len(f), sum(v * v for v in f.values()), max(f.values())
    print(f"  {len(A):3}  {len(B):3}  {str(not (A & B)):>17}   {Finf:5}   {F0:3}    {len(A) + len(B) - F0:15}   {F2 - len(A) - len(B):17}")
  |A|  |B|  A and B disjoint?   F_inf   F_0    |A| + |B| - F_0   F_2 - (|A| + |B|)
    5    5               True       1    10                  0                   0
    5    5              False       2     8                  2                   4
    5    5               True       1    10                  0                   0
    5    5              False       2     8                  2                   4
    5    5               True       1    10                  0                   0
    5    5              False       2     9                  1                   2

Approximation, randomization and the constants

The reductions above use exactness or a factor below 2. For approximation algorithms, finer communication problems give the finer bounds:

  • Deterministic approximation. A deterministic algorithm that estimates F0F_0 within a factor 1.1 needs Ω(n)\Omega(n) bits (Alon, Matias and Szegedy, 1996). The proof uses a large family of sets with small pairwise intersections (from an error-correcting code): the algorithm's state must distinguish them, because merging two of them changes F0F_0 by a constant factor. So for F0F_0, randomization is essential.
  • The 1/ε21/\varepsilon^2 term. Any randomized (1±ε)(1 \pm \varepsilon)-approximation of F0F_0 or F2F_2 needs Ω(1/ε2)\Omega(1/\varepsilon^2) bits (Indyk and Woodruff, 2003; Woodruff, 2004), by reduction from Gap-Hamming: Alice and Bob hold x,y∈{0,1}1/ε2x, y \in \{0,1\}^{1/\varepsilon^2} and must decide whether their Hamming distance is above 12ε2+1ε\frac{1}{2\varepsilon^2} + \frac{1}{\varepsilon} or below 12ε2−1ε\frac{1}{2\varepsilon^2} - \frac{1}{\varepsilon}. Its one-way complexity is Ω(1/ε2)\Omega(1/\varepsilon^2), and its two-way complexity too (Chakrabarti and Regev, 2011), so even multi-pass algorithms cannot avoid the term.
  • Higher moments. For FkF_k with k>2k > 2, the reduction uses multi-party disjointness: tt players with sets that are either pairwise disjoint or share exactly one common element. Choosing t≈n1/kt \approx n^{1/k} makes a shared element contribute tk≈nt^k \approx n to FkF_k, about as much as everything else. The players must communicate Ω(n/t)\Omega(n/t) bits in total, up to logarithmic factors in the earlier results (Bar-Yossef, Jayram, Kumar and Sivakumar, 2004; Chakrabarti, Khot and Sun, 2003; Gronemeier, 2009), so one of the t−1t - 1 messages of a one-pass simulation has Ω(n/t2)\Omega(n/t^2) bits, which gives the space bound Ω(n1−2/k)\Omega(n^{1-2/k}), matched by the algorithm of Indyk and Woodruff (2005) up to polylogarithmic factors.
  • Heavy hitters. INDEX also shows that additive error m/km/k for frequencies needs Ω(klog⁡(n/k))\Omega(k \log(n/k)) bits: Alice encodes a kk-element subset of [n][n] as a stream with each element repeated, and point queries recover it.
Problem Lower bound Communication problem
exact F0F_0, one pass Ω(n)\Omega(n) bits INDEX
exact F0F_0 or FkF_k (k≠1k \ne 1), F∞F_\infty within factor <2< 2, pp passes Ω(n/p)\Omega(n/p) bits DISJOINTNESS
deterministic F0F_0 within 1.11.1 Ω(n)\Omega(n) bits equality on a code
(1±ε)(1 \pm \varepsilon) for F0F_0, F2F_2 Ω(ε−2)\Omega(\varepsilon^{-2}) bits Gap-Hamming
(1±ε)(1 \pm \varepsilon) for FkF_k, k>2k > 2 Ω(n1−2/k)\Omega(n^{1-2/k}) bits multi-party disjointness

Test yourself

How does a one-pass streaming algorithm with ss bits of memory give a one-way protocol?

  1. Alice sends her whole input
  2. Alice runs the algorithm on her part of the stream and sends the ss-bit memory state; Bob continues the run on his part
  3. Bob sends his input to Alice
  4. They run the algorithm twice

In the reduction from INDEX to exact F0F_0, what does Bob learn from the change in F0F_0 when he appends item ii?

  1. The size of Alice's set
  2. Whether ii was already in Alice's set, that is xix_i: F0F_0 grows by one exactly when xi=0x_i = 0
  3. The number of ones in xx
  4. Nothing

Why does approximating F∞F_\infty within a factor below 2 need Ω(n)\Omega(n) bits?

  1. Because F∞F_\infty can be huge
  2. Because streaming Alice's set and then Bob's gives F∞=2F_\infty = 2 exactly when the sets intersect, so the algorithm would solve DISJOINTNESS
  3. Because hashing fails
  4. Because of INDEX with one bit

Which communication problem gives the Ω(1/ε2)\Omega(1/\varepsilon^2) lower bound for (1±ε)(1 \pm \varepsilon)-approximating F0F_0?

  1. INDEX
  2. Gap-Hamming: deciding whether the Hamming distance of two vectors of length 1/ε21/\varepsilon^2 is above or below its typical value by 1/ε1/\varepsilon
  3. Equality
  4. Pointer chasing