Approximate Matrix Multiplication over Sliding Windows

Ziqi Yao, Lianzhi Li, Mingsong Chen, Xian Wei, Cheng Chen

Abstract

Approximate Matrix Multiplication (AMM) is a fundamental operation in large-scale data analysis, but it becomes computationally prohibitive in streaming environments where data follows a sliding window model. This paper introduces DS-COD (Dump Snapshot Co-occurring Directions), a deterministic algorithm that achieves the theoretical optimum for space-error tradeoff in AMM over sliding windows. By reducing the space complexity dependence on the error parameter $\epsilon$ from $1/\epsilon^2$ to $1/\epsilon$, DS-COD significantly outperforms previous state-of-the-art methods.

Introduction

In the era of big data, multiplying massive matrices is a significant computational bottleneck, typically scaling at $O(n^3)$. Streaming applications—such as network traffic monitoring or social media trend analysis—introduce the additional challenge of the sliding window model, where only the most recent $N$ data points are considered relevant. Maintaining an accurate product of two matrices within this window using limited memory is a difficult task. While prior algorithms like EH-COD and DI-COD existed, they were not space-optimal. This work establishes the theoretical lower bound for memory usage in deterministic AMM algorithms and presents DS-COD as the first algorithm to reach this "floor."

The DS-COD Algorithm

The proposed Dump Snapshot Co-occurring Directions (DS-COD) algorithm builds upon the classic Co-occurring Directions (COD) framework by introducing a novel "snapshot" mechanism to manage the sliding window efficiently.

The core mechanism involves:

  1. Snapshot Dumping: The algorithm maintains residual sketches of incoming data. When the importance (singular value) of a direction in the sketch exceeds a predefined threshold $\theta$, that direction is "dumped" as a snapshot with a timestamp and removed from the active sketch.
  2. Hierarchical Structure (hDS-COD): To accommodate data with varying norms, a hierarchy of levels with exponentially increasing thresholds is maintained, ensuring snapshots are captured at the appropriate granularity.
  3. Adaptive Adjustment (aDS-COD): A single-level adaptive version dynamically adjusts its threshold based on the current number of snapshots, improving practical efficiency by avoiding the overhead of a fixed hierarchy.
The DS-COD mechanism: directions are processed, and those exceeding the threshold are dumped as snapshots into a queue.

Experimental Evaluation

The authors evaluated DS-COD against several baselines using both synthetic and real-world datasets, including Amazon Product Reviews (APR), text analysis data (PAN11), and multilingual corpora (EURO).

Key Results

Experimental results consistently demonstrate that DS-COD and its adaptive variant provide a superior error-to-space ratio.

  • Space Efficiency: As illustrated in the performance plots, for any given total space cost, DS-COD variants achieve significantly lower average and maximum errors compared to existing baselines across all datasets.
  • Stability: The DS-COD series exhibited greater stability on synthetic datasets, whereas previous methods showed high variance in error.
  • Adaptive Performance: In practice, aDS-COD often outperformed the hierarchical hDS-COD by avoiding multi-level maintenance overhead while remaining within theoretical error bounds.
Comparison of correlation error against total space cost. DS-COD variants (blue and orange) consistently sit lower than baselines, indicating better accuracy for the same memory footprint.

Conclusion and Future Work

The primary contribution of this work is the proof of an optimal space bound for the AMM sliding window problem: $\Omega(\frac{m_x+m_y}{\epsilon}(\log N + 1))$ bits. DS-COD matches this bound, representing a theoretical 100x improvement in space efficiency for a precision of $\epsilon=0.01$ compared to previous $1/\epsilon^2$ methods. The core innovation lies in decoupling important directions (snapshots) from residual noise, allowing for more efficient expiration of outdated data.

Future research will focus on optimizing the algorithm for sparse data, such as user-item interaction grids. Adapting the snapshot mechanism to exploit sparsity could yield even greater performance gains in real-world applications.

Summary updated

BibTeX
@inproceedings{yao2024approximate,
  author = {Ziqi Yao and Lianzhi Li and Mingsong Chen and Xian Wei and Cheng Chen},
  title = {{Approximate Matrix Multiplication over Sliding Windows}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2024},
  url = {https://openreview.net/forum?id=kQvTlc1OPr},
}

Loading related content...

Figure