Une implémentation GPU de la méthode de recherche approximative FlyHash

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

Presented at the 2023 Conference on Artificial Intelligence for Defense (CAID), this research addresses the computational challenges of FlyHash, a locality-sensitive hashing (LSH) algorithm inspired by the neurobiology of the fruit fly (Drosophila). While FlyHash offers unique advantages for similarity search and federated learning, its traditional CPU-based implementations struggle with the "Winner-Take-All" (WTA) computational bottleneck. This paper introduces a novel GPU-accelerated approach that achieves an order-of-magnitude speedup.

The Computational Bottleneck of FlyHash

Locality-Sensitive Hashing is essential for finding near neighbors in high-dimensional datasets without exhaustive pairwise comparisons. FlyHash stands out by mimicking the olfactory system of the fruit fly, which maps odors to sparse, high-dimensional representations.

Biological architecture of the fruit fly olfactory system, the inspiration for FlyHash.

The core of the FlyHash algorithm involves projecting input data into a higher-dimensional space and then applying a Winner-Take-All (WTA) mechanism. In this step, only the top $k$ strongest signals are preserved, while the rest are silenced. On a standard CPU, identifying these top $k$ values across large batches of data requires sorting or selection algorithms that become prohibitively slow as data volume and hash length increase.

Methods: Parallelized Thresholding on GPU

To overcome the CPU bottleneck, the authors developed a parallelized WTA algorithm specifically for the NVIDIA CUDA architecture using the Julia programming language and the CUDA.jl package.

The primary innovation lies in moving away from traditional sorting. Sorting is computationally expensive on GPUs when dealing with large datasets due to complex data movement. Instead, the authors implemented a parallel binary search to determine a threshold value.

  1. Batch Processing: The implementation processes data as a matrix where each column represents a distinct data point, allowing for massive parallelism.
  2. Threshold Discovery: For every column, the GPU cores perform a binary search to find a threshold value such that exactly $k$ elements exceed it.
  3. Efficiency: By executing this search in parallel across thousands of cores, the algorithm avoids the overhead of a full sort. The researchers found that 64 iterations are sufficient for single-precision floating-point accuracy, and this can be further reduced for applications where a small margin of error is tolerable.

Performance and Results

The implementation was benchmarked against a high-end Intel Xeon Gold CPU using standard image datasets (FashionMNIST and CIFAR10) and synthetic data to test scaling.

Comparison of execution time (seconds) between CPU and GPU for CIFAR10 and FashionMNIST datasets.

The results demonstrate a clear performance advantage for the GPU implementation:

  • 10x Speedup: On the FashionMNIST and CIFAR10 benchmarks, the GPU version was approximately ten times faster than the CPU version.
  • Scalability: The performance gap becomes even more pronounced as batch sizes increase. While CPU execution time scales steeply and linearly, the GPU maintains high efficiency, making it suitable for processing continuous, high-throughput data streams in real-time.

Conclusion and Future Directions

The study proves that neurobiological models like FlyHash can be scaled for industrial applications when paired with appropriate hardware-specific optimizations. By leveraging parallel binary search on GPUs, the authors transformed a biologically inspired curiosity into a high-performance tool for modern data science.

Future work includes developing lower-level CUDA kernels in C++ to further optimize performance and integrating this accelerated FlyHash into deep learning frameworks like SLIDE. The authors also envision applications in "one-shot" federated learning, where efficient, sparse hashing can minimize communication overhead between distributed clients.

Summary updated

BibTeX
@inproceedings{cunha2023une,
  author = {Arthur da Cunha and Damien Rivet and Emanuele Natale and Aurora Rossi},
  title = {{Une implémentation GPU de la méthode de recherche approximative FlyHash}},
  booktitle = {SPIRE},
  year = {2023},
}
Figure