Une implémentation GPU de l'algorithme FlyHash: Des mouches plus rapides pour la fouille de données massives

Arthur da Cunha, Emanuele Natale, Damien Rivet, Aurora RossiHAL 2023

Abstract

FlyHash, a Locality Sensitive Hashing (LSH) algorithm inspired by the fruit fly's olfactory system, is highly effective for similarity search, particularly in federated learning. However, its "winner-take-all" (WTA) binarization step is a major computational bottleneck. This paper proposes an efficient GPU-based WTA algorithm using parallel binary search, implemented in CUDA, achieving significant speedups over traditional CPU implementations.

In the era of big data, finding similar items—such as images, documents, or genomic sequences—within massive datasets is a fundamental challenge. Locality-Sensitive Hashing (LSH) has emerged as a standard solution, mapping similar data points to the same "hash bucket" with high probability.

A biologically inspired variant, FlyHash, mimics the neural architecture of the fruit fly (Drosophila) olfactory system. It expands input dimensions into a high-dimensional, sparse representation. The critical step in this process is Winner-Take-All (WTA) binarization: only the $k$ strongest signals are preserved as 1s, while all others are set to 0. While mathematically robust, WTA is computationally expensive on traditional CPUs because it typically requires sorting, a process that scales poorly with large datasets and high dimensions.

Methods: Parallelizing the Fly's Brain

The authors address this bottleneck by implementing FlyHash on GPUs using the Julia programming language and the CUDA.jl library. The core innovation lies in replacing the sorting-based WTA with a parallel binary search for a threshold value.

Algorithm 1: The FlyHash procedure, highlighting the WTA step.

Instead of sorting each column to find the top $k$ elements, the GPU-accelerated algorithm:

  1. Calculates a midpoint between the minimum and maximum values in the projected data.
  2. Counts how many elements exceed this midpoint in parallel.
  3. Adjusts the threshold iteratively (binary search) until approximately $k$ elements remain.

The researchers found that 64 iterations provide sufficient precision for data mining tasks, yielding an error rate of only $\approx 2 \times 10^{-7}$. This approach avoids the heavy data movement associated with parallel sorting, making it ideal for GPU architectures.

Key Results: 10x Performance Gains

The implementation was benchmarked against an optimized CPU version (Intel Xeon Gold 6240) using an NVIDIA Quadro RTX 8000. Testing on standard datasets like CIFAR10 and FashionMNIST, as well as synthetic data, revealed dramatic performance improvements.

Performance comparison between CPU and GPU implementations across datasets and batch sizes.

As shown in the results, the GPU version consistently achieves a one order of magnitude speedup. On the CIFAR10 dataset, processing time dropped from nearly 100 seconds on the CPU to approximately 10 seconds on the GPU. Furthermore, the GPU implementation exhibits superior scaling; while CPU processing time grows exponentially with batch size, the GPU's execution time remains relatively flat, demonstrating its suitability for massive real-time data streams.

Conclusion and Future Work

By rethinking a biological mechanism through the lens of parallel hardware, this work removes a significant barrier to using FlyHash at scale. Future research will focus on developing lower-level CUDA kernels to further optimize performance and integrating this accelerated hashing into federated learning pipelines where communication and computation efficiency are paramount.

Summary updated

BibTeX
@inproceedings{cunha2023une,
  author = {Arthur da Cunha and Emanuele Natale and Damien Rivet and Aurora Rossi},
  title = {{Une implémentation GPU de l'algorithme FlyHash: Des mouches plus rapides pour la fouille de données massives}},
  booktitle = {HAL},
  year = {2023},
}
Figure