Coding for Random Projections

Ping Li, Michael Mitzenmacher, Anshumali Shrivastava

TL;DR

This paper demonstrates that the "random offset" step used in standard random projection coding (like Locality Sensitive Hashing) is actually unnecessary and often harmful. By switching to simple uniform quantization or a novel 2-bit non-uniform scheme, researchers can achieve higher accuracy in similarity estimation and classification while using fewer bits and requiring less parameter tuning.

What Problem Does This Paper Address?

In large-scale machine learning, we often use random projections to squash high-dimensional data into a smaller, more manageable space. However, the resulting projected values are still real numbers, which are expensive to store and slow to process. To fix this, we "code" or quantize these numbers into bits.

For years, the gold standard for this process (established by Datar et al. in 2004) involved a "window-and-random-offset" scheme. This method uses a bin width ($w$) and a random shift ($q$) to turn real numbers into integers. This paper questions whether that random offset $q$ is actually helping. The authors argue that it complicates the algorithm, increases estimation variance, and makes the system overly sensitive to the choice of bin width.

Methods

The authors compare three main coding schemes:

  1. Uniform Quantization ($h_w$): A simple floor operation, $h_w(u) = \lfloor u/w \rfloor$. No random offset is used.
  2. 2-Bit Non-Uniform Quantization ($h_{w,2}$): The authors divide the range of projected values into four specific regions: $(-\infty, -w), [-w, 0), [0, w), [w, \infty)$. This is designed to better capture information for highly similar data points.
  3. 1-Bit Coding ($h_1$): Simply recording the sign of the projected value (positive or negative).

The core of the paper is a rigorous theoretical analysis of the collision probability (the chance that two different vectors get assigned the same code) and the variance of the resulting similarity estimators. They prove that the simple uniform scheme is mathematically superior to the traditional offset-based method.

Key Insights and Ideas

The "Random Offset" is Detrimental

In the traditional scheme, as the bin width $w$ increases, even completely orthogonal (unrelated) vectors eventually get the same code. In the authors' proposed uniform scheme, orthogonal vectors correctly maintain a low collision probability regardless of $w$.

Collision Probability Comparison

As shown above, the collision probability for the traditional offset scheme ($P_{w,q}$, dashed line) approaches 1 as $w$ increases, even when correlation $\rho=0$. The uniform scheme ($P_w$, solid red line) correctly plateaus at a lower probability, preserving the distinction between unrelated vectors.

Robustness to Parameters

The traditional method is very sensitive to the choice of $w$. If you pick the wrong bin width, accuracy plummets. The proposed uniform quantization is much more "forgiving," maintaining low variance across a wide range of $w$ values.

Variance Factor Comparison

The variance factor plots clearly illustrate this sensitivity. The variance for the offset method ($V_{w,q}$) blows up as $w$ increases past an optimal point, whereas the uniform method ($V_w$) remains stable and consistently lower across different correlation levels ($\rho$).

1-Bit vs. 2-Bit Coding

While 1-bit coding (just the sign) is incredibly efficient for low-to-medium similarity, it loses too much information when data points are very similar. The 2-bit non-uniform scheme provides a "sweet spot," offering high accuracy for near-neighbors without the overhead of many bits. Furthermore, for linear SVMs, the training speed depends on the sparsity of the data. Using a 2-bit code allows for faster learning compared to using more bits, as it results in a sparser feature representation.

Key Results

  • Lower Variance: Theoretical and empirical results show that the uniform quantization estimator consistently has lower variance than the window-and-offset estimator.
  • SVM Accuracy: On the URL dataset, the proposed $h_w$ scheme significantly outperformed the traditional $h_{w,q}$ scheme when the bin width was large (e.g., $w=6$). When $w$ was small, they performed similarly, proving the offset adds no value.
  • LSH Retrieval: In retrieval tasks on the Youtube dataset, the uniform scheme ($h_w$) achieved the same recall as the traditional method but retrieved a smaller fraction of the database, meaning it is more precise and efficient.

Datasets Evaluated

The authors evaluated their methods on several high-dimensional benchmarks from the UCI repository and real-world sources, including URL (malicious URL detection, ~3.2M dimensions), ARCENE (mass-spectrometry, 10K dimensions), FARM (marketing, ~55K dimensions), and Youtube (used specifically for LSH retrieval experiments).

Limitations and Future Work

  • Dense Projections: This study focuses primarily on dense random projections. The authors note that investigating how these coding schemes interact with very sparse random projections is a key area for future research.
  • Norm Assumptions: The analysis assumes that the marginal Euclidean norms of the original data vectors are known or that the data is normalized. While common in practice (e.g., in SVMs), it is a prerequisite for their specific estimators.
  • Non-linear Estimators: The authors suggest that while they focused on linear estimators (inner products), there is significant room to improve accuracy further by using non-linear maximum likelihood estimators in the "re-ranking" stage of near-neighbor searches.

Summary updated

BibTeX
@inproceedings{li2014coding,
  author = {Ping Li and Michael Mitzenmacher and Anshumali Shrivastava},
  title = {{Coding for Random Projections}},
  booktitle = {International Conference on Machine Learning},
  year = {2014},
  url = {https://openreview.net/forum?id=B1WUv2WubS},
}
Figure