slides

New Characterizations in Turnstile
Streams with Applications
Yuqing Ai
Wei Hu
Tsinghua University
Tsinghua University
Yi Li
David Woodruff
Facebook
IBM Almaden
Turnstile Streaming Model
ο‚—
Underlying 𝑛-dimensional vector π‘₯ initialized to 0
ο‚—
Stream of updates π‘₯ ← π‘₯ + 𝑒𝑖 or π‘₯ ← π‘₯ βˆ’ 𝑒𝑖 for
standard unit vector 𝑒𝑖
ο‚—
At end of the stream, π‘₯ ∈ {βˆ’π‘š, … , βˆ’1, 0, 1, … , π‘š}𝑛
ο‚—
Output an approximation to 𝑓(π‘₯) w.h.p.
ο‚—
Goal: use as small space in bits as possible
Example: Estimating the β„“2 -norm
ο‚—
Output 𝑍 with 1 βˆ’ πœ– π‘₯
ο‚—
Algorithm:
2
≀𝑍 ≀ 1+πœ– π‘₯
2
1. Let π‘Ÿ = 1/πœ– 2
2. Choose an π‘Ÿ × π‘› matrix 𝐴 of i.i.d. sign random
variables (+1 w.p. 1/2, βˆ’1 w.p. 1/2)
3. Maintain 𝐴π‘₯ in the stream
4. Output
𝐴π‘₯ 2
π‘Ÿ
Generic Form
ο‚—
All known algorithms have the following generic
form (linear sketch):
1.
Sample a random matrix 𝐴
2.
Maintain 𝐴π‘₯ in the stream
3.
Output a function of 𝐴π‘₯
Question (?!): does the optimal algorithm for
approximating any function in the turnstile model
have this form?
The LNW Reduction
ο‚—
Yes! [Li, Nguyα»…n, Woodruff’14]
ο‚—
Theorem: for computing a function 𝑓 of π‘₯ in
βˆ’π‘š, … , π‘š 𝑛 in the turnstile model, there is a
randomized algorithm which
1. samples a matrix 𝐴 and a vector π‘ž uniformly
from 𝑂(𝑛 log π‘š) instances
2. maintains (𝐴π‘₯ mod π‘ž) in the stream
3. outputs a function of (𝐴π‘₯ mod π‘ž)
ο‚—
Space complexity is optimal up to a constant
factor (not including the 𝑂(log 𝑛 + log log π‘š) bits
for randomness)
Consequence
Input π‘₯
Create stream 𝑠(π‘₯)
Input 𝑦
Create stream 𝑠(𝑦)
Lower Bound Technique
Streaming algorithm π’œ
1. Run π’œ on 𝑠(π‘₯), send state of π’œ(𝑠(π‘₯)) to Bob
2. Bob computes π’œ(𝑠(π‘₯), 𝑠(𝑦))
3. If Bob solves 𝑔(π‘₯, 𝑦), space complexity of π’œ at
least the 1-way communication complexity of 𝑔
Consequence
Input π‘₯
Create stream 𝑠(π‘₯)
Input 𝑦
Create stream 𝑠(𝑦)
The LNW reduction implies
If players can solve 𝑔(π‘₯, 𝑦), then space of π’œ at least
the simultaneous communication complexity of 𝑔
Weaker model in which Alice and Bob simultaneously
send a message to a referee who outputs the answer
Our Result
ο‚—
Strengthen the LNW reduction from several
aspects:
β—¦ Remove the β€œbox constraint”
β—¦ Generalize to the strict turnstile model
β—¦ Extend to multi-pass algorithms
ο‚—
Obtain new tight lower bounds
Strengthen the LNW Reduction
ο‚—
Remove the β€œbox constraint”
ο‚—
Generalize to the strict turnstile model
ο‚—
Extend to multi-pass algorithms
The β€œBox Constraint”
ο‚—
The LNW reduction requires the algorithm to be
correct as long as π‘₯ ∈ βˆ’π‘š, … , π‘š 𝑛 at the end of
the stream.
ο‚—
While processing the stream, may have π‘₯
ο‚—
The algorithm is not allowed to abort if this
happens. It must still be correct at the end of the
stream as long as π‘₯ ∈ βˆ’π‘š, … , π‘š 𝑛 .
ο‚—
More natural requirement: the algorithm only needs
to be correct when π‘₯ belongs to βˆ’π‘š, … , π‘š 𝑛 at all
time in the stream.
∞
β‰«π‘š
Stream Automaton
…
βˆ’π‘’π‘›
+𝑒𝑛
…
βˆ’π‘’1 , +𝑒2
…
Start
…
+𝑒1
+𝑒1
+𝑒5
βˆ’π‘’1
…
…
Path-Independent Automaton
ο‚—
Every π‘₯ ∈ ℀𝑛 in a unique state
Path-Independent Automaton
βˆ’π‘’π‘›
+𝑒𝑛
…
βˆ’π‘’1 , +𝑒2
…
Start
…
+𝑒1
+𝑒1
+𝑒5
0 in two
different states
βˆ’π‘’1
…
…
Path-Independent Automaton
ο‚—
Every π‘₯ ∈ ℀𝑛 in a unique state
ο‚—
Equivalent to 𝐴π‘₯ mod π‘ž
Zero-Frequency Graph
ο‚—
For stream 𝜎, let freq 𝜎 ∈ ℀𝑛 be the β€œnet update”
to all coordinates.
ο‚—
Zero-freq graph: directed graph 𝐺 = (𝑉, 𝐸)
β—¦ 𝑉 = states of the automaton
β—¦ 𝑒, 𝑣 ∈ 𝐸 if there exists stream 𝜎 such that 𝑒 βŠ•
𝜎 = 𝑣 and freq 𝜎 = 0
ο‚—
Terminal equivalence class: strongly connected
component in 𝐺 with no outgoing edge
ο‚—
Walk in G is a sequence of zero-frequency streams
The LNW Reduction
𝐺: zero-frequency graph of π’œold
ο‚— States of new automaton π’œnew = terminal
equivalence classes in 𝐺
ο‚—
ο‚—
ο‚—
For a terminal equivalence class 𝐢 and an update 𝑒𝑖 ,
define transition as:
β—¦ Let 𝑣 ∈ 𝐢 be an arbitrary node
β—¦ Compute 𝑣 βŠ• 𝑒𝑖 using transition function of π’œold
β—¦ Walk from 𝑣 βŠ• 𝑒𝑖 in 𝐺 until reach a terminal
equivalence class 𝐢′
𝐢′ is unique
β—¦ Does not depend on 𝑣 or the walk
𝐢
Terminal
equivalence
class
𝑣
𝑒𝑖
freq(𝜎) = 0
Terminal
equivalence
class
𝐢′
The Box Constraint
ο‚—
For a stream 𝜎, define
|𝜎|max =
max
prefix πœ” of 𝜎
freq πœ”
∞
𝜎 = (𝜎1 , 𝜎2 , … , πœŽπ‘˜ ) on π’œnew
πœŽβ€² = (… , 𝜎1 , … , 𝜎2 , … , πœŽπ‘˜ , … ) on π’œold
𝜏1
ο‚—
ο‚—
ο‚—
𝜏2
𝜏3
𝜏4 𝜏5
𝜏6
…
𝜏1 , 𝜏2 , … are zero-frequency streams (walks in 𝐺)
Length of πœπ‘– could be very large
When |𝜎|max ≀ π‘š, |πœŽβ€²|max could be very large
Zero-Freq Stream Length
ο‚—
𝐿: upper bound on the lengths of πœπ‘– ’s
ο‚—
|𝜎|max ≀ π‘š ⟹ |πœŽβ€²|max ≀ π‘š + 𝐿/2
ο‚—
Want 𝐿 ≀ π‘š
ο‚—
Let s = # states in π’œold
Lemma: if there is a zero-freq stream from 𝑒 to 𝑣,
then there exists such a stream with length at most
𝑛
𝑠
poly 𝑛𝑠 β‹… + 1
ο‚—
𝑛
ο‚—
𝐿 ≀ poly 𝑛𝑠 β‹…
𝑠
𝑛
+1
𝑛
Tightness of Our Bound
ο‚—
ο‚—
𝐿 ≀ poly 𝑛𝑠 β‹…
𝑠
𝑛
+1
Lower bound: 𝐿 β‰₯
𝑛
𝑠 Ξ©(𝑛)
𝑛
Removing the Box Constraint
ο‚—
Want 𝐿 ≀ π‘š
ο‚—
𝐿 ≀ poly 𝑛𝑠 β‹…
ο‚—
𝑠 𝑐𝑛
πΏβ‰€π‘š ⟸
𝑠
𝑛
+1
𝑛
≀ 𝑠 𝑐𝑛
≀ π‘š ⟸ log 𝑠 ≀
log π‘š
𝑐𝑛
Space of π’œold
Application: Counting
𝑛=1
ο‚— Problem: output |π‘₯| up to additive error π‘š/4, while
π‘₯ varies in {βˆ’π‘š, … , π‘š}
ο‚—
ο‚—
𝑂(log π‘š) space algorithm
ο‚—
Is there an Ξ©(log π‘š) lower bound?
β—¦ For insertion streams, no: approximate counting
β—¦ For relative error, yes: but proof doesn’t apply
β—¦ For additive error… yes!
Application: Counting
ο‚—
Condition for removing box constraint: space ≀
log π‘š
log π‘š
=
𝑐𝑛
𝑐
log π‘š
,
𝑐
ο‚—
Assume space ≀
ο‚—
𝐴π‘₯ mod π‘ž = (π‘Ž1 π‘₯ mod π‘ž1 , π‘Ž2 π‘₯ mod π‘ž2 , … , π‘Žπ‘Ÿ π‘₯ mod π‘žπ‘Ÿ )
β—¦ Show lcm π‘ž1 , … , π‘žπ‘Ÿ = Ξ©(π‘š)
ο‚– Cannot distinguish π‘₯, π‘₯ + lcm, π‘₯ + 2 β‹… lcm, …
β—¦ Ξ©(π‘š) different states, Ξ©(log π‘š) space
otherwise done
Application: Norm Estimation
ο‚—
Problem: for π‘₯ ∈ βˆ’π‘š, … , π‘š 𝑛 , output π‘₯
1
additive error 𝑛1/𝑝 π‘š
𝑝
up to
4
ο‚—
Ξ©(log π‘š) space lower bound
ο‚—
𝑂(log π‘š + log log 𝑛) space algorithm (1 ≀ 𝑝 ≀ 2)
[KNW’10]
ο‚—
Lower bound tight when log log 𝑛 = 𝑂 log π‘š ⟺
𝑛 ≀ exp poly(π‘š)
Strengthen the LNW Reduction
ο‚—
Remove the β€œbox constraint”
ο‚—
Generalize to the strict turnstile model
ο‚—
Extend to multi-pass algorithms
The Strict Turnstile Model
ο‚—
The strict turnstile model: no negative coordinates,
i.e., π‘₯𝑖 β‰₯ 0 at all times in the stream
ο‚—
Dynamic graph streams: insertions and deletions of
edges
β—¦ Allow multi-graphs, but no negative edges
ο‚—
Generalize the LNW reduction to the strict turnstile
model
β—¦
β—¦
β—¦
β—¦
𝐿: upper bound on the length of zero-freq streams
Initialize all coordinates of π‘₯ to be 𝐿
Now the reduction guarantees π‘₯ is always nonnegative
Subtract 𝐿 from all coordinates at the end of the stream
Application: Maximum Matching
ο‚—
[AKLY’16]: For outputting an π‘›πœ– -approximate
maximum matching, space is Θ(𝑛2βˆ’3πœ– )
β—¦ Lower bound only in simultaneous communication
model
ο‚—
Can apply our reduction
Strengthen the LNW Reduction
ο‚—
Remove the β€œbox constraint”
ο‚—
Generalize to the strict turnstile model
ο‚—
Extend to multi-pass algorithms
Multi-Pass Algorithms
ο‚—
𝑝-pass automaton
β—¦ After 𝑖-th pass (𝑖 < 𝑝), output an automaton π’œπ‘–+1
β—¦ Run π’œπ‘–+1 on input stream in (𝑖 + 1)-st pass
β—¦ After 𝑝-th pass, output answer
ο‚—
Theorem: There is a 𝑝-pass automaton for which
each automaton in each pass is path-independent
β—¦ Space is optimal up to a constant factor
Conclusions
ο‚—
New progress on characterizing turnstile streaming
algorithms as linear sketches
ο‚—
Applications
β—¦ Optimal lower bounds for counting with additive
error, maximum matching in dynamic graph
ο‚—
Open questions
β—¦ Box constraint
β—¦ After removing box constraint, still have very long
streams
β—¦ Better reduction?
Thank you!